From 5c3606ac289cefda6f000041fd5cceabe1033535 Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Fri, 4 Nov 2022 16:28:18 +0800 Subject: [PATCH 001/189] Darwinia 2.0 --- .dockerignore | 12 ++++++++++++ .editorconfig | 21 +++++++++++++++++++++ .gitattributes | 1 + .gitignore | 15 +++++++++++++++ .rustfmt.toml | 29 +++++++++++++++++++++++++++++ rust-toolchain.toml | 5 +++++ 6 files changed, 83 insertions(+) create mode 100644 .dockerignore create mode 100644 .editorconfig create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 .rustfmt.toml create mode 100644 rust-toolchain.toml diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..b341e4706 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,12 @@ +# System +.DS_Store + +# Integrated Development Environment +.idea +.vscode + +# Package Manager +## cargo +/target +## npm +node_modules diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 000000000..7a124a295 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,21 @@ +root = true + +[*] +charset=utf-8 +end_of_line=lf +indent_size=tab +indent_style=tab +insert_final_newline=true +max_line_length=100 +tab_width=4 +trim_trailing_whitespace=true + +[*.py] +charset=utf-8 +indent_size=4 +indent_style=space + +[*.{sh,yml,yaml}] +indent_size=2 +indent_style=space +tab_width=8 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..9bd26362b --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +Cargo.lock linguist-generated=true diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..fa143606b --- /dev/null +++ b/.gitignore @@ -0,0 +1,15 @@ +# System +.DS_Store + +# Integrated Development Environment +.idea +.vscode + +# Package Manager +## cargo +/target +## npm +node_modules + +# Test data +test-data diff --git a/.rustfmt.toml b/.rustfmt.toml new file mode 100644 index 000000000..8f17dfe50 --- /dev/null +++ b/.rustfmt.toml @@ -0,0 +1,29 @@ +# Basic +edition = "2021" +hard_tabs = true +max_width = 100 +tab_spaces = 4 + +# Imports +imports_granularity = "Crate" +reorder_imports = true + +# Format comments +comment_width = 100 +wrap_comments = true + +# Misc +match_arm_blocks = false +match_block_trailing_comma = true +newline_style = "Unix" +reorder_impl_items = true +reorder_modules = true +use_field_init_shorthand = true +use_small_heuristics = "Max" + +# Wait for stablization +# format_code_in_doc_comments = true + +# Could give it a try +# group_imports = "StdExternalCrate" +# inline_attribute_width = 100 diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 000000000..fe0f225b6 --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,5 @@ +[toolchain] +channel = "nightly-2022-07-24" +components = ["cargo", "clippy", "rustc", "rustfmt", "rust-src"] +profile = "minimal" +targets = ["wasm32-unknown-unknown"] From 11780e3a95a58def83f27a5c6634752effe6b76a Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Thu, 10 Nov 2022 19:29:59 +0800 Subject: [PATCH 002/189] Darwinia shell chain (#27) * Skeleton * XCM configs * Bump toolchain * Code cleaning part.1 * Code cleaning part.2 * Update SS58 * Rename * Update token decimals * Format * Extract darwinia core primitives * License * Benchmarks * Extract constants * Docs * CI part.1 * Adjust the runtime pallets structure (#29) * frame-system * pallet-timestamp * pallet-authorship * pallet-balances * pallet-transaction-payment * pallet-parachain-system * pallet-parachain-info * pallet-aura-ext * pallet-xcmp-queue * pallet-dmp-queue * pallet-session * pallet-aura * pallet-collator-selection * format * deal ambiguous name * fix compile * clear imports * update visibility for pallets * add license for pallets * update darwinia comments * CI part.2 Signed-off-by: Xavier Lau * CI part.3 * CI part.4 * Add missing features * Case * Setup build environment * CI part.5 * Enable `kusama-native`, `rococo-native` Signed-off-by: Xavier Lau Co-authored-by: Guantong <04637@163.com> --- .github/shrink-cache.sh | 9 + .github/workflows/auto-author-assign.yml | 15 + .github/workflows/checks.yml | 182 + .maintain/license-header | 17 + Cargo.lock | 12194 ++++++++++++++++ Cargo.toml | 9 + core/primitives/Cargo.toml | 21 + core/primitives/src/lib.rs | 96 + node/Cargo.toml | 113 + node/build.rs | 22 + node/src/chain_spec.rs | 244 + node/src/cli.rs | 111 + node/src/command.rs | 472 + node/src/main.rs | 31 + node/src/rpc.rs | 77 + node/src/service.rs | 550 + runtime/Cargo.toml | 200 + runtime/build.rs | 24 + runtime/src/lib.rs | 441 + runtime/src/pallets/aura.rs | 26 + runtime/src/pallets/aura_ext.rs | 22 + runtime/src/pallets/authorship.rs | 31 + runtime/src/pallets/balances.rs | 40 + runtime/src/pallets/collator_selection.rs | 47 + runtime/src/pallets/dmp_queue.rs | 26 + runtime/src/pallets/mod.rs | 56 + runtime/src/pallets/parachain_info_.rs | 22 + runtime/src/pallets/parachain_system.rs | 37 + runtime/src/pallets/session.rs | 40 + runtime/src/pallets/system.rs | 108 + runtime/src/pallets/timestamp.rs | 32 + runtime/src/pallets/transaction_payment.rs | 35 + runtime/src/pallets/xcmp_queue.rs | 31 + runtime/src/weights/block_weights.rs | 52 + .../src/weights/cumulus_pallet_xcmp_queue.rs | 67 + runtime/src/weights/extrinsic_weights.rs | 52 + runtime/src/weights/frame_system.rs | 88 + runtime/src/weights/mod.rs | 40 + runtime/src/weights/pallet_balances.rs | 97 + .../src/weights/pallet_collator_selection.rs | 111 + runtime/src/weights/pallet_session.rs | 69 + runtime/src/weights/pallet_timestamp.rs | 64 + runtime/src/weights/paritydb_weights.rs | 63 + runtime/src/weights/rocksdb_weights.rs | 63 + runtime/src/xcm_config/barrier.rs | 108 + runtime/src/xcm_config/mod.rs | 148 + rust-toolchain.toml | 2 +- 47 files changed, 16404 insertions(+), 1 deletion(-) create mode 100755 .github/shrink-cache.sh create mode 100644 .github/workflows/auto-author-assign.yml create mode 100644 .github/workflows/checks.yml create mode 100644 .maintain/license-header create mode 100644 Cargo.lock create mode 100644 Cargo.toml create mode 100644 core/primitives/Cargo.toml create mode 100644 core/primitives/src/lib.rs create mode 100644 node/Cargo.toml create mode 100644 node/build.rs create mode 100644 node/src/chain_spec.rs create mode 100644 node/src/cli.rs create mode 100644 node/src/command.rs create mode 100644 node/src/main.rs create mode 100644 node/src/rpc.rs create mode 100644 node/src/service.rs create mode 100644 runtime/Cargo.toml create mode 100644 runtime/build.rs create mode 100644 runtime/src/lib.rs create mode 100644 runtime/src/pallets/aura.rs create mode 100644 runtime/src/pallets/aura_ext.rs create mode 100644 runtime/src/pallets/authorship.rs create mode 100644 runtime/src/pallets/balances.rs create mode 100644 runtime/src/pallets/collator_selection.rs create mode 100644 runtime/src/pallets/dmp_queue.rs create mode 100644 runtime/src/pallets/mod.rs create mode 100644 runtime/src/pallets/parachain_info_.rs create mode 100644 runtime/src/pallets/parachain_system.rs create mode 100644 runtime/src/pallets/session.rs create mode 100644 runtime/src/pallets/system.rs create mode 100644 runtime/src/pallets/timestamp.rs create mode 100644 runtime/src/pallets/transaction_payment.rs create mode 100644 runtime/src/pallets/xcmp_queue.rs create mode 100644 runtime/src/weights/block_weights.rs create mode 100644 runtime/src/weights/cumulus_pallet_xcmp_queue.rs create mode 100644 runtime/src/weights/extrinsic_weights.rs create mode 100644 runtime/src/weights/frame_system.rs create mode 100644 runtime/src/weights/mod.rs create mode 100644 runtime/src/weights/pallet_balances.rs create mode 100644 runtime/src/weights/pallet_collator_selection.rs create mode 100644 runtime/src/weights/pallet_session.rs create mode 100644 runtime/src/weights/pallet_timestamp.rs create mode 100644 runtime/src/weights/paritydb_weights.rs create mode 100644 runtime/src/weights/rocksdb_weights.rs create mode 100644 runtime/src/xcm_config/barrier.rs create mode 100644 runtime/src/xcm_config/mod.rs diff --git a/.github/shrink-cache.sh b/.github/shrink-cache.sh new file mode 100755 index 000000000..900207ad3 --- /dev/null +++ b/.github/shrink-cache.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +cargo clean --release -p darwinia 2> /dev/null || true +cargo clean --release -p darwinia-runtime 2> /dev/null || true +rm -rf target/release/wbuild 2> /dev/null || true + +cargo clean -p darwinia 2> /dev/null || true +cargo clean -p darwinia-runtime 2> /dev/null || true +rm -rf target/debug/wbuild 2> /dev/null || true diff --git a/.github/workflows/auto-author-assign.yml b/.github/workflows/auto-author-assign.yml new file mode 100644 index 000000000..c42a29f82 --- /dev/null +++ b/.github/workflows/auto-author-assign.yml @@ -0,0 +1,15 @@ +name: "Auto author assign" + +on: + pull_request_target: + types: [opened, reopened] + +permissions: + pull-requests: write + +jobs: + assign-author: + name: Author assign + runs-on: ubuntu-latest + steps: + - uses: toshimaru/auto-author-assign@v1.4.0 diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml new file mode 100644 index 000000000..7469ecd9d --- /dev/null +++ b/.github/workflows/checks.yml @@ -0,0 +1,182 @@ +name: Checks +on: + push: + branches: + - main + paths: + - "**.rs" + - "**.toml" + - "**lock" + - "**.json" + - "**.yml" + pull_request: + types: [opened, synchronize, ready_for_review] + branches: + - main + paths: + - "**.rs" + - "**.toml" + - "**lock" + - "**.json" + - "**.yml" + +env: + GITHUB_CACHE_VERSION: 0 + + RUST_TOOLCHAIN: nightly + RUST_BACKTRACE: full + RUSTC_WRAPPER: sccache + + SCCACHE_LINK: https://github.com/mozilla/sccache/releases/download + SCCACHE_VERSION: v0.3.0 + SCCACHE_DIR: /home/runner/.cache/sccache + + SUBALFRED_LINK: https://github.com/hack-ink/subalfred/releases/latest/download/subalfred-x86_64-unknown-linux-gnu.zst + +jobs: + basic-checks: + name: Task ${{ matrix.action }} darwinia + if: github.event_name == 'push' || !github.event.pull_request.draft + runs-on: ubuntu-latest + strategy: + matrix: + action: [build, test] + + steps: + - name: Setup build environment + run: sudo apt install -y protobuf-compiler + - name: Install Rust ${{ env.RUST_TOOLCHAIN }} toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ env.RUST_TOOLCHAIN }} + default: true + - name: Install Sccache + run: | + export SCCACHE_FILE=sccache-${{ env.SCCACHE_VERSION }}-x86_64-unknown-linux-musl + curl -L ${{ env.SCCACHE_LINK }}/${{ env.SCCACHE_VERSION }}/$SCCACHE_FILE.tar.gz | tar xz + sudo mv $SCCACHE_FILE/sccache /usr/bin + sudo chmod u+x /usr/bin/sccache + - name: Fetch latest code + uses: actions/checkout@v3 + - name: Cache cargo + uses: actions/cache@v2 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + target + key: cargo-${{ matrix.action }}-${{ env.GITHUB_CACHE_VERSION }}-${{ hashFiles('**/Cargo.lock') }} + restore-keys: cargo-${{ matrix.action }}-${{ env.GITHUB_CACHE_VERSION }}- + - name: Cache sccache + uses: actions/cache@v2 + with: + path: ${{ env.SCCACHE_DIR}} + key: sccache-${{ matrix.action }}-${{ env.GITHUB_CACHE_VERSION }}-${{ hashFiles('**/Cargo.lock') }} + restore-keys: sccache-${{ matrix.action }}-${{ env.GITHUB_CACHE_VERSION }}- + - name: Action ${{ matrix.action }} + uses: actions-rs/cargo@v1 + with: + command: ${{ matrix.action }} + args: --release --locked --features all-native + - name: Compress + if: matrix.action != 'test' + run: | + mv target/release/darwinia . + tar cf darwinia.tar.zst darwinia -I pzstd + - name: Upload + if: matrix.action != 'test' + uses: actions/upload-artifact@v2 + with: + name: darwinia + path: darwinia.tar.zst + - name: Shrink cache + run: .github/shrink-cache.sh + + features-checks: + name: Task check features + if: github.event_name == 'push' || !github.event.pull_request.draft + runs-on: ubuntu-latest + steps: + - name: Install Rust ${{ env.RUST_TOOLCHAIN }} toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ env.RUST_TOOLCHAIN }} + default: true + - name: Install Subalfred + run: | + curl -L ${{ env.SUBALFRED_LINK }} | zstd -o subalfred -d + chmod u+x subalfred + sudo mv subalfred /usr/bin + sudo chmod u+x /usr/bin/subalfred + - name: Fetch latest code + uses: actions/checkout@v3 + - name: Check + run: | + unset RUSTC_WRAPPER + subalfred check features runtime + + runtime-checks: + name: Task check runtime + if: github.event_name == 'push' || !github.event.pull_request.draft + needs: [basic-checks] + runs-on: ubuntu-latest + steps: + - name: Install Subalfred + run: | + curl -L ${{ env.SUBALFRED_LINK }} | zstd -o subalfred -d + chmod u+x subalfred + sudo mv subalfred /usr/bin + sudo chmod u+x /usr/bin/subalfred + - name: Download darwinia + uses: actions/download-artifact@v2 + with: + name: darwinia + - name: Install darwinia + run: | + tar xf darwinia.tar.zst -I pzstd + sudo mv darwinia /usr/bin + - id: check-darwinia-runtime-version + name: Check Darwinia runtime version + run: | + OUTPUT=$(subalfred check runtime --executable darwinia --chain local --live https://rpc.polkadot.io --property version) + OUTPUT="${OUTPUT//'%'/'%25'}​" + OUTPUT="${OUTPUT//$'\n'/'%0A'}" + OUTPUT="${OUTPUT//$'\r'/'%0D'}" + echo "::set-output name=check-darwinia-runtime-version::$OUTPUT" + - id: check-darwinia-runtime-storage + name: Check Darwinia runtime storage + run: | + OUTPUT=$(subalfred check runtime --executable darwinia --chain local --live https://rpc.polkadot.io --property storage) + OUTPUT="${OUTPUT//'%'/'%25'}​" + OUTPUT="${OUTPUT//$'\n'/'%0A'}" + OUTPUT="${OUTPUT//$'\r'/'%0D'}" + echo "::set-output name=check-darwinia-runtime-storage::$OUTPUT" + - if: github.ref != 'refs/heads/master' + uses: marocchino/sticky-pull-request-comment@v2 + with: + append: true + message: | +
+ Commit ${{ github.event.pull_request.head.sha }} + + **Darwinia** + > Check Runtime Version + ```diff + ${{ steps.check-darwinia-runtime-version.outputs.check-darwinia-runtime-version }} + ``` + > Check Storage Prefix + ```diff + ${{ steps.check-darwinia-runtime-storage.outputs.check-darwinia-runtime-storage }} + ``` +
+ + checks-cleaning: + name: Task checks cleaning + if: always() + needs: [features-checks, runtime-checks] + steps: + - name: Clean artifacts + uses: geekyeggo/delete-artifact@v1 + with: + name: darwinia + runs-on: ubuntu-latest diff --git a/.maintain/license-header b/.maintain/license-header new file mode 100644 index 000000000..c89e30c59 --- /dev/null +++ b/.maintain/license-header @@ -0,0 +1,17 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 000000000..6037189d2 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,12194 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "Inflector" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" +dependencies = [ + "lazy_static", + "regex", +] + +[[package]] +name = "addr2line" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9ecd88a8c8378ca913a680cd98f0f13ac67383d35993f86c90a70e3f137816b" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" + +[[package]] +name = "aead" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b613b8e1e3cf911a086f53f03bf286f52fd7a7258e4fa606f0ef220d39d8877" +dependencies = [ + "generic-array 0.14.6", +] + +[[package]] +name = "aes" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e8b47f52ea9bae42228d07ec09eb676433d7c4ed1ebdf0f1d1c29ed446f1ab8" +dependencies = [ + "cfg-if 1.0.0", + "cipher 0.3.0", + "cpufeatures", + "opaque-debug 0.3.0", +] + +[[package]] +name = "aes-gcm" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df5f85a83a7d8b0442b6aa7b504b8212c1733da07b98aae43d4bc21b2cb3cdf6" +dependencies = [ + "aead", + "aes", + "cipher 0.3.0", + "ctr", + "ghash", + "subtle", +] + +[[package]] +name = "ahash" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" +dependencies = [ + "getrandom 0.2.8", + "once_cell", + "version_check", +] + +[[package]] +name = "aho-corasick" +version = "0.7.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4f55bd91a0978cbfd91c457a164bab8b4001c833b7f323132c0a4e1922dd44e" +dependencies = [ + "memchr", +] + +[[package]] +name = "always-assert" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbf688625d06217d5b1bb0ea9d9c44a1635fd0ee3534466388d18203174f4d11" + +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + +[[package]] +name = "ansi_term" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" +dependencies = [ + "winapi", +] + +[[package]] +name = "anyhow" +version = "1.0.66" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "216261ddc8289130e551ddcd5ce8a064710c0d064a4d2895c67151c92b5443f6" + +[[package]] +name = "approx" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cab112f0a86d568ea0e627cc1d6be74a1e9cd55214684db5561995f6dad897c6" +dependencies = [ + "num-traits", +] + +[[package]] +name = "array-bytes" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a913633b0c922e6b745072795f50d90ebea78ba31a57e2ac8c2fc7b50950949" + +[[package]] +name = "arrayref" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" + +[[package]] +name = "arrayvec" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd9fd44efafa8690358b7408d253adf110036b88f55672a933f01d616ad9b1b9" +dependencies = [ + "nodrop", +] + +[[package]] +name = "arrayvec" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" + +[[package]] +name = "arrayvec" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" + +[[package]] +name = "asn1_der" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e22d1f4b888c298a027c99dc9048015fac177587de20fc30232a057dfbe24a21" + +[[package]] +name = "assert_matches" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b34d609dfbaf33d6889b2b7106d3ca345eacad44200913df5ba02bfd31d2ba9" + +[[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.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e14485364214912d3b19cc3435dde4df66065127f05fa0d75c712f36f12c2f28" +dependencies = [ + "concurrent-queue", + "event-listener", + "futures-core", +] + +[[package]] +name = "async-executor" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "871f9bb5e0a22eeb7e8cf16641feb87c9dc67032ccf8ff49e772eb9941d3a965" +dependencies = [ + "async-task", + "concurrent-queue", + "fastrand", + "futures-lite", + "once_cell", + "slab", +] + +[[package]] +name = "async-global-executor" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1b6f5d7df27bd294849f8eec66ecfc63d11814df7a4f5d74168a2394467b776" +dependencies = [ + "async-channel", + "async-executor", + "async-io", + "async-lock", + "blocking", + "futures-lite", + "once_cell", +] + +[[package]] +name = "async-io" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8121296a9f05be7f34aa4196b1747243b3b62e048bb7906f644f3fbfc490cf7" +dependencies = [ + "async-lock", + "autocfg", + "concurrent-queue", + "futures-lite", + "libc", + "log", + "parking", + "polling", + "slab", + "socket2", + "waker-fn", + "winapi", +] + +[[package]] +name = "async-lock" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8101efe8695a6c17e02911402145357e718ac92d3ff88ae8419e84b1707b685" +dependencies = [ + "event-listener", + "futures-lite", +] + +[[package]] +name = "async-process" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02111fd8655a613c25069ea89fc8d9bb89331fa77486eb3bc059ee757cfa481c" +dependencies = [ + "async-io", + "autocfg", + "blocking", + "cfg-if 1.0.0", + "event-listener", + "futures-lite", + "libc", + "once_cell", + "signal-hook", + "winapi", +] + +[[package]] +name = "async-std" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62565bb4402e926b29953c785397c6dc0391b7b446e45008b0049eb43cec6f5d" +dependencies = [ + "async-attributes", + "async-channel", + "async-global-executor", + "async-io", + "async-lock", + "async-process", + "crossbeam-utils", + "futures-channel", + "futures-core", + "futures-io", + "futures-lite", + "gloo-timers", + "kv-log-macro", + "log", + "memchr", + "once_cell", + "pin-project-lite 0.2.9", + "pin-utils", + "slab", + "wasm-bindgen-futures", +] + +[[package]] +name = "async-std-resolver" +version = "0.21.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f2f8a4a203be3325981310ab243a28e6e4ea55b6519bffce05d41ab60e09ad8" +dependencies = [ + "async-std", + "async-trait", + "futures-io", + "futures-util", + "pin-utils", + "socket2", + "trust-dns-resolver", +] + +[[package]] +name = "async-task" +version = "4.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a40729d2133846d9ed0ea60a8b9541bccddab49cd30f0715a1da672fe9a2524" + +[[package]] +name = "async-trait" +version = "0.1.58" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e805d94e6b5001b651426cf4cd446b1ab5f319d27bab5c644f61de0a804360c" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "asynchronous-codec" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06a0daa378f5fd10634e44b0a29b2a87b890657658e072a30d6f26e57ddee182" +dependencies = [ + "bytes", + "futures-sink", + "futures-util", + "memchr", + "pin-project-lite 0.2.9", +] + +[[package]] +name = "atomic-waker" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "065374052e7df7ee4047b1160cca5e1467a12351a40b3da123c870ba0b8eda2a" + +[[package]] +name = "atty" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" +dependencies = [ + "hermit-abi", + "libc", + "winapi", +] + +[[package]] +name = "autocfg" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + +[[package]] +name = "backoff" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b62ddb9cb1ec0a098ad4bbf9344d0713fa193ae1a80af55febcff2627b6a00c1" +dependencies = [ + "futures-core", + "getrandom 0.2.8", + "instant", + "pin-project-lite 0.2.9", + "rand 0.8.5", + "tokio", +] + +[[package]] +name = "backtrace" +version = "0.3.66" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cab84319d616cfb654d03394f38ab7e6f0919e181b1b57e1fd15e7fb4077d9a7" +dependencies = [ + "addr2line", + "cc", + "cfg-if 1.0.0", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", +] + +[[package]] +name = "base-x" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cbbc9d0964165b47557570cce6c952866c2678457aca742aafc9fb771d30270" + +[[package]] +name = "base16ct" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "349a06037c7bf932dd7e7d1f653678b2038b9ad46a74102f1fc7bd7872678cce" + +[[package]] +name = "base58" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6107fe1be6682a68940da878d9e9f5e90ca5745b3dec9fd1bb393c8777d4f581" + +[[package]] +name = "base64" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" + +[[package]] +name = "base64ct" +version = "1.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b645a089122eccb6111b4f81cbc1a49f5900ac4666bb93ac027feaecf15607bf" + +[[package]] +name = "beef" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a8241f3ebb85c056b509d4327ad0358fbbba6ffb340bf388f26350aeda225b1" +dependencies = [ + "serde", +] + +[[package]] +name = "beefy-gadget" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "array-bytes", + "async-trait", + "beefy-primitives", + "fnv", + "futures", + "futures-timer", + "log", + "parity-scale-codec", + "parking_lot 0.12.1", + "sc-chain-spec", + "sc-client-api", + "sc-consensus", + "sc-finality-grandpa", + "sc-keystore", + "sc-network", + "sc-network-common", + "sc-network-gossip", + "sc-utils", + "sp-api", + "sp-application-crypto", + "sp-arithmetic", + "sp-blockchain", + "sp-consensus", + "sp-core", + "sp-keystore", + "sp-mmr-primitives", + "sp-runtime", + "substrate-prometheus-endpoint", + "thiserror", + "wasm-timer", +] + +[[package]] +name = "beefy-gadget-rpc" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "beefy-gadget", + "beefy-primitives", + "futures", + "jsonrpsee", + "log", + "parity-scale-codec", + "parking_lot 0.12.1", + "sc-rpc", + "sc-utils", + "serde", + "sp-core", + "sp-runtime", + "thiserror", +] + +[[package]] +name = "beefy-merkle-tree" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "beefy-primitives", + "sp-api", +] + +[[package]] +name = "beefy-primitives" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "parity-scale-codec", + "scale-info", + "sp-api", + "sp-application-crypto", + "sp-core", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "bimap" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc0455254eb5c6964c4545d8bac815e1a1be4f3afe0ae695ea539c12d728d44b" + +[[package]] +name = "bincode" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" +dependencies = [ + "serde", +] + +[[package]] +name = "bindgen" +version = "0.59.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bd2a9a458e8f4304c52c43ebb0cfbd520289f8379a52e329a38afda99bf8eb8" +dependencies = [ + "bitflags", + "cexpr", + "clang-sys", + "lazy_static", + "lazycell", + "peeking_take_while", + "proc-macro2", + "quote", + "regex", + "rustc-hash", + "shlex", +] + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitvec" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c" +dependencies = [ + "funty", + "radium", + "tap", + "wyz", +] + +[[package]] +name = "blake2" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9cf849ee05b2ee5fba5e36f97ff8ec2533916700fc0758d40d92136a42f3388" +dependencies = [ + "digest 0.10.5", +] + +[[package]] +name = "blake2-rfc" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d6d530bdd2d52966a6d03b7a964add7ae1a288d25214066fd4b600f0f796400" +dependencies = [ + "arrayvec 0.4.12", + "constant_time_eq", +] + +[[package]] +name = "blake2b_simd" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72936ee4afc7f8f736d1c38383b56480b5497b4617b4a77bdbf1d2ababc76127" +dependencies = [ + "arrayref", + "arrayvec 0.7.2", + "constant_time_eq", +] + +[[package]] +name = "blake2s_simd" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db539cc2b5f6003621f1cd9ef92d7ded8ea5232c7de0f9faa2de251cd98730d4" +dependencies = [ + "arrayref", + "arrayvec 0.7.2", + "constant_time_eq", +] + +[[package]] +name = "blake3" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a08e53fc5a564bb15bfe6fae56bd71522205f1f91893f9c0116edad6496c183f" +dependencies = [ + "arrayref", + "arrayvec 0.7.2", + "cc", + "cfg-if 1.0.0", + "constant_time_eq", + "digest 0.10.5", +] + +[[package]] +name = "block-buffer" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" +dependencies = [ + "block-padding", + "byte-tools", + "byteorder", + "generic-array 0.12.4", +] + +[[package]] +name = "block-buffer" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" +dependencies = [ + "generic-array 0.14.6", +] + +[[package]] +name = "block-buffer" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cce20737498f97b993470a6e536b8523f0af7892a4f928cceb1ac5e52ebe7e" +dependencies = [ + "generic-array 0.14.6", +] + +[[package]] +name = "block-padding" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5" +dependencies = [ + "byte-tools", +] + +[[package]] +name = "blocking" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6ccb65d468978a086b69884437ded69a90faab3bbe6e67f242173ea728acccc" +dependencies = [ + "async-channel", + "async-task", + "atomic-waker", + "fastrand", + "futures-lite", + "once_cell", +] + +[[package]] +name = "bounded-vec" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3372be4090bf9d4da36bd8ba7ce6ca1669503d0cf6e667236c6df7f053153eb6" +dependencies = [ + "thiserror", +] + +[[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.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba3569f383e8f1598449f1a423e72e99569137b47740b1da11ef19af3d5c3223" +dependencies = [ + "memchr", +] + +[[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 = "bumpalo" +version = "3.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "572f695136211188308f16ad2ca5c851a712c464060ae6974944458eb83880ba" + +[[package]] +name = "byte-slice-cast" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c" + +[[package]] +name = "byte-tools" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" + +[[package]] +name = "byteorder" +version = "1.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" + +[[package]] +name = "bytes" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec8a7b6a70fde80372154c65702f00a0f56f3e1c36abbc6c440484be248856db" + +[[package]] +name = "bzip2-sys" +version = "0.1.11+1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "736a955f3fa7875102d57c82b8cac37ec45224a07fd32d58f9f7a186b6cd4cdc" +dependencies = [ + "cc", + "libc", + "pkg-config", +] + +[[package]] +name = "cache-padded" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1db59621ec70f09c5e9b597b220c7a2b43611f4710dc03ceb8748637775692c" + +[[package]] +name = "camino" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88ad0e1e3e88dd237a156ab9f571021b8a158caa0ae44b1968a241efb5144c1e" +dependencies = [ + "serde", +] + +[[package]] +name = "cargo-platform" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cbdb825da8a5df079a43676dbe042702f1707b1109f713a01420fbb4cc71fa27" +dependencies = [ + "serde", +] + +[[package]] +name = "cargo_metadata" +version = "0.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4acbb09d9ee8e23699b9634375c72795d095bf268439da88562cf9b501f181fa" +dependencies = [ + "camino", + "cargo-platform", + "semver 1.0.14", + "serde", + "serde_json", +] + +[[package]] +name = "cc" +version = "1.0.75" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41ca34107f97baef6cfb231b32f36115781856b8f8208e8c580e0bcaea374842" +dependencies = [ + "jobserver", +] + +[[package]] +name = "cexpr" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" +dependencies = [ + "nom", +] + +[[package]] +name = "cfg-expr" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0aacacf4d96c24b2ad6eb8ee6df040e4f27b0d0b39a5710c30091baa830485db" +dependencies = [ + "smallvec", +] + +[[package]] +name = "cfg-if" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "cfg_aliases" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e" + +[[package]] +name = "chacha20" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c80e5460aa66fe3b91d40bcbdab953a597b60053e34d684ac6903f863b680a6" +dependencies = [ + "cfg-if 1.0.0", + "cipher 0.3.0", + "cpufeatures", + "zeroize", +] + +[[package]] +name = "chacha20poly1305" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a18446b09be63d457bbec447509e85f662f32952b035ce892290396bc0b0cff5" +dependencies = [ + "aead", + "chacha20", + "cipher 0.3.0", + "poly1305", + "zeroize", +] + +[[package]] +name = "chrono" +version = "0.4.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfd4d1b31faaa3a89d7934dbded3111da0d2ef28e3ebccdb4f0179f5929d1ef1" +dependencies = [ + "iana-time-zone", + "js-sys", + "num-integer", + "num-traits", + "time", + "wasm-bindgen", + "winapi", +] + +[[package]] +name = "cid" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6ed9c8b2d17acb8110c46f1da5bf4a696d745e1474a16db0cd2b49cd0249bf2" +dependencies = [ + "core2", + "multibase", + "multihash", + "serde", + "unsigned-varint", +] + +[[package]] +name = "cipher" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ee52072ec15386f770805afd189a01c8841be8696bed250fa2f13c4c0d6dfb7" +dependencies = [ + "generic-array 0.14.6", +] + +[[package]] +name = "cipher" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1873270f8f7942c191139cb8a40fd228da6c3fd2fc376d7e92d47aa14aeb59e" +dependencies = [ + "crypto-common", + "inout", +] + +[[package]] +name = "ckb-merkle-mountain-range" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f061f97d64fd1822664bdfb722f7ae5469a97b77567390f7442be5b5dc82a5b" +dependencies = [ + "cfg-if 0.1.10", +] + +[[package]] +name = "clang-sys" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa2e27ae6ab525c3d369ded447057bca5438d86dc3a68f6faafb8269ba82ebf3" +dependencies = [ + "glob", + "libc", + "libloading 0.7.4", +] + +[[package]] +name = "clap" +version = "3.2.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71655c45cb9845d3270c9d6df84ebe72b4dad3c2ba3f7023ad47c144e4e473a5" +dependencies = [ + "atty", + "bitflags", + "clap_derive", + "clap_lex", + "indexmap", + "once_cell", + "strsim", + "termcolor", + "textwrap", +] + +[[package]] +name = "clap_derive" +version = "3.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea0c8bce528c4be4da13ea6fead8965e95b6073585a2f05204bd8f4119f82a65" +dependencies = [ + "heck", + "proc-macro-error", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "clap_lex" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2850f2f5a82cbf437dd5af4d49848fbdfc27c157c3d010345776f952765261c5" +dependencies = [ + "os_str_bytes", +] + +[[package]] +name = "cmake" +version = "0.1.49" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db34956e100b30725f2eb215f90d4871051239535632f84fea3bc92722c66b7c" +dependencies = [ + "cc", +] + +[[package]] +name = "coarsetime" +version = "0.1.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "454038500439e141804c655b4cd1bc6a70bcb95cd2bc9463af5661b6956f0e46" +dependencies = [ + "libc", + "once_cell", + "wasi 0.11.0+wasi-snapshot-preview1", + "wasm-bindgen", +] + +[[package]] +name = "codespan-reporting" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e" +dependencies = [ + "termcolor", + "unicode-width", +] + +[[package]] +name = "comfy-table" +version = "6.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1090f39f45786ec6dc6286f8ea9c75d0a7ef0a0d3cda674cef0c3af7b307fbc2" +dependencies = [ + "strum", + "strum_macros", + "unicode-width", +] + +[[package]] +name = "concurrent-queue" +version = "1.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af4780a44ab5696ea9e28294517f1fffb421a83a25af521333c838635509db9c" +dependencies = [ + "cache-padded", +] + +[[package]] +name = "const-oid" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4c78c047431fee22c1a7bb92e00ad095a02a983affe4d8a72e2a2c62c1b94f3" + +[[package]] +name = "constant_time_eq" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" + +[[package]] +name = "convert_case" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" + +[[package]] +name = "core-foundation" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" + +[[package]] +name = "core2" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b49ba7ef1ad6107f8824dbe97de947cbaac53c44e7f9756a1fba0d37c1eec505" +dependencies = [ + "memchr", +] + +[[package]] +name = "cpp_demangle" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eeaa953eaad386a53111e47172c2fedba671e5684c8dd601a5f474f4f118710f" +dependencies = [ + "cfg-if 1.0.0", +] + +[[package]] +name = "cpufeatures" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28d997bd5e24a5928dd43e46dc529867e207907fe0b239c3477d924f7f2ca320" +dependencies = [ + "libc", +] + +[[package]] +name = "cranelift-bforest" +version = "0.88.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44409ccf2d0f663920cab563d2b79fcd6b2e9a2bcc6e929fef76c8f82ad6c17a" +dependencies = [ + "cranelift-entity", +] + +[[package]] +name = "cranelift-codegen" +version = "0.88.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "98de2018ad96eb97f621f7d6b900a0cc661aec8d02ea4a50e56ecb48e5a2fcaf" +dependencies = [ + "arrayvec 0.7.2", + "bumpalo", + "cranelift-bforest", + "cranelift-codegen-meta", + "cranelift-codegen-shared", + "cranelift-entity", + "cranelift-isle", + "gimli", + "log", + "regalloc2", + "smallvec", + "target-lexicon", +] + +[[package]] +name = "cranelift-codegen-meta" +version = "0.88.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5287ce36e6c4758fbaf298bd1a8697ad97a4f2375a3d1b61142ea538db4877e5" +dependencies = [ + "cranelift-codegen-shared", +] + +[[package]] +name = "cranelift-codegen-shared" +version = "0.88.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2855c24219e2f08827f3f4ffb2da92e134ae8d8ecc185b11ec8f9878cf5f588e" + +[[package]] +name = "cranelift-entity" +version = "0.88.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b65673279d75d34bf11af9660ae2dbd1c22e6d28f163f5c72f4e1dc56d56103" +dependencies = [ + "serde", +] + +[[package]] +name = "cranelift-frontend" +version = "0.88.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ed2b3d7a4751163f6c4a349205ab1b7d9c00eecf19dcea48592ef1f7688eefc" +dependencies = [ + "cranelift-codegen", + "log", + "smallvec", + "target-lexicon", +] + +[[package]] +name = "cranelift-isle" +version = "0.88.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3be64cecea9d90105fc6a2ba2d003e98c867c1d6c4c86cc878f97ad9fb916293" + +[[package]] +name = "cranelift-native" +version = "0.88.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4a03a6ac1b063e416ca4b93f6247978c991475e8271465340caa6f92f3c16a4" +dependencies = [ + "cranelift-codegen", + "libc", + "target-lexicon", +] + +[[package]] +name = "cranelift-wasm" +version = "0.88.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c699873f7b30bc5f20dd03a796b4183e073a46616c91704792ec35e45d13f913" +dependencies = [ + "cranelift-codegen", + "cranelift-entity", + "cranelift-frontend", + "itertools", + "log", + "smallvec", + "wasmparser", + "wasmtime-types", +] + +[[package]] +name = "crc32fast" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" +dependencies = [ + "cfg-if 1.0.0", +] + +[[package]] +name = "crossbeam-channel" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2dd04ddaf88237dc3b8d8f9a3c1004b506b54b3313403944054d23c0870c521" +dependencies = [ + "cfg-if 1.0.0", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-deque" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "715e8152b692bba2d374b53d4875445368fdf21a94751410af607a5ac677d1fc" +dependencies = [ + "cfg-if 1.0.0", + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f916dfc5d356b0ed9dae65f1db9fc9770aa2851d2662b988ccf4fe3516e86348" +dependencies = [ + "autocfg", + "cfg-if 1.0.0", + "crossbeam-utils", + "memoffset", + "scopeguard", +] + +[[package]] +name = "crossbeam-queue" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cd42583b04998a5363558e5f9291ee5a5ff6b49944332103f251e7479a82aa7" +dependencies = [ + "cfg-if 1.0.0", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edbafec5fa1f196ca66527c1b12c2ec4745ca14b50f1ad8f9f6f720b55d11fac" +dependencies = [ + "cfg-if 1.0.0", +] + +[[package]] +name = "crunchy" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" + +[[package]] +name = "crypto-bigint" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03c6a1d5fa1de37e071642dfa44ec552ca5b299adb128fab16138e24b548fd21" +dependencies = [ + "generic-array 0.14.6", + "rand_core 0.6.4", + "subtle", + "zeroize", +] + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array 0.14.6", + "typenum", +] + +[[package]] +name = "crypto-mac" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab" +dependencies = [ + "generic-array 0.14.6", + "subtle", +] + +[[package]] +name = "crypto-mac" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1d1a86f49236c215f271d40892d5fc950490551400b02ef360692c29815c714" +dependencies = [ + "generic-array 0.14.6", + "subtle", +] + +[[package]] +name = "ctor" +version = "0.1.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d2301688392eb071b0bf1a37be05c469d3cc4dbbd95df672fe28ab021e6a096" +dependencies = [ + "quote", + "syn", +] + +[[package]] +name = "ctr" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "049bb91fb4aaf0e3c7efa6cd5ef877dbbbd15b39dad06d9948de4ec8a75761ea" +dependencies = [ + "cipher 0.3.0", +] + +[[package]] +name = "cuckoofilter" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b810a8449931679f64cd7eef1bbd0fa315801b6d5d9cdc1ace2804d6529eee18" +dependencies = [ + "byteorder", + "fnv", + "rand 0.7.3", +] + +[[package]] +name = "cumulus-client-cli" +version = "0.1.0" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.30#7b1fc0ed107fe42bb7e6a5dfefb586f4c3ae4328" +dependencies = [ + "clap", + "parity-scale-codec", + "sc-chain-spec", + "sc-cli", + "sc-service", + "sp-core", + "sp-runtime", + "url", +] + +[[package]] +name = "cumulus-client-collator" +version = "0.1.0" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.30#7b1fc0ed107fe42bb7e6a5dfefb586f4c3ae4328" +dependencies = [ + "cumulus-client-consensus-common", + "cumulus-client-network", + "cumulus-primitives-core", + "cumulus-relay-chain-interface", + "futures", + "parity-scale-codec", + "parking_lot 0.12.1", + "polkadot-node-primitives", + "polkadot-node-subsystem", + "polkadot-overseer", + "polkadot-primitives", + "sc-client-api", + "sp-api", + "sp-consensus", + "sp-core", + "sp-runtime", + "tracing", +] + +[[package]] +name = "cumulus-client-consensus-aura" +version = "0.1.0" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.30#7b1fc0ed107fe42bb7e6a5dfefb586f4c3ae4328" +dependencies = [ + "async-trait", + "cumulus-client-consensus-common", + "cumulus-primitives-core", + "futures", + "parity-scale-codec", + "sc-client-api", + "sc-consensus", + "sc-consensus-aura", + "sc-consensus-slots", + "sc-telemetry", + "sp-api", + "sp-application-crypto", + "sp-block-builder", + "sp-blockchain", + "sp-consensus", + "sp-consensus-aura", + "sp-core", + "sp-inherents", + "sp-keystore", + "sp-runtime", + "substrate-prometheus-endpoint", + "tracing", +] + +[[package]] +name = "cumulus-client-consensus-common" +version = "0.1.0" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.30#7b1fc0ed107fe42bb7e6a5dfefb586f4c3ae4328" +dependencies = [ + "async-trait", + "cumulus-relay-chain-interface", + "dyn-clone", + "futures", + "parity-scale-codec", + "polkadot-primitives", + "sc-client-api", + "sc-consensus", + "sp-api", + "sp-blockchain", + "sp-consensus", + "sp-runtime", + "sp-trie", + "tracing", +] + +[[package]] +name = "cumulus-client-network" +version = "0.1.0" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.30#7b1fc0ed107fe42bb7e6a5dfefb586f4c3ae4328" +dependencies = [ + "async-trait", + "cumulus-relay-chain-interface", + "derive_more", + "futures", + "futures-timer", + "parity-scale-codec", + "parking_lot 0.12.1", + "polkadot-node-primitives", + "polkadot-parachain", + "polkadot-primitives", + "sc-client-api", + "sp-api", + "sp-blockchain", + "sp-consensus", + "sp-core", + "sp-runtime", + "sp-state-machine", + "tracing", +] + +[[package]] +name = "cumulus-client-pov-recovery" +version = "0.1.0" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.30#7b1fc0ed107fe42bb7e6a5dfefb586f4c3ae4328" +dependencies = [ + "cumulus-primitives-core", + "cumulus-relay-chain-interface", + "futures", + "futures-timer", + "parity-scale-codec", + "polkadot-node-primitives", + "polkadot-node-subsystem", + "polkadot-overseer", + "polkadot-primitives", + "rand 0.8.5", + "sc-client-api", + "sc-consensus", + "sp-api", + "sp-consensus", + "sp-maybe-compressed-blob", + "sp-runtime", + "tracing", +] + +[[package]] +name = "cumulus-client-service" +version = "0.1.0" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.30#7b1fc0ed107fe42bb7e6a5dfefb586f4c3ae4328" +dependencies = [ + "cumulus-client-cli", + "cumulus-client-collator", + "cumulus-client-consensus-common", + "cumulus-client-pov-recovery", + "cumulus-primitives-core", + "cumulus-relay-chain-interface", + "parking_lot 0.12.1", + "polkadot-overseer", + "polkadot-primitives", + "sc-client-api", + "sc-consensus", + "sc-consensus-babe", + "sc-service", + "sc-telemetry", + "sc-tracing", + "sp-api", + "sp-blockchain", + "sp-consensus", + "sp-core", + "sp-runtime", + "tracing", +] + +[[package]] +name = "cumulus-pallet-aura-ext" +version = "0.1.0" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.30#7b1fc0ed107fe42bb7e6a5dfefb586f4c3ae4328" +dependencies = [ + "frame-executive", + "frame-support", + "frame-system", + "pallet-aura", + "parity-scale-codec", + "scale-info", + "serde", + "sp-application-crypto", + "sp-consensus-aura", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "cumulus-pallet-dmp-queue" +version = "0.1.0" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.30#7b1fc0ed107fe42bb7e6a5dfefb586f4c3ae4328" +dependencies = [ + "cumulus-primitives-core", + "frame-support", + "frame-system", + "log", + "parity-scale-codec", + "scale-info", + "sp-io", + "sp-runtime", + "sp-std", + "xcm", + "xcm-executor", +] + +[[package]] +name = "cumulus-pallet-parachain-system" +version = "0.1.0" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.30#7b1fc0ed107fe42bb7e6a5dfefb586f4c3ae4328" +dependencies = [ + "bytes", + "cumulus-pallet-parachain-system-proc-macro", + "cumulus-primitives-core", + "cumulus-primitives-parachain-inherent", + "environmental", + "frame-support", + "frame-system", + "impl-trait-for-tuples", + "log", + "pallet-balances", + "parity-scale-codec", + "polkadot-parachain", + "scale-info", + "serde", + "sp-core", + "sp-externalities", + "sp-inherents", + "sp-io", + "sp-runtime", + "sp-state-machine", + "sp-std", + "sp-trie", + "sp-version", + "xcm", +] + +[[package]] +name = "cumulus-pallet-parachain-system-proc-macro" +version = "0.1.0" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.30#7b1fc0ed107fe42bb7e6a5dfefb586f4c3ae4328" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "cumulus-pallet-session-benchmarking" +version = "3.0.0" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.30#7b1fc0ed107fe42bb7e6a5dfefb586f4c3ae4328" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "pallet-session", + "parity-scale-codec", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "cumulus-pallet-xcm" +version = "0.1.0" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.30#7b1fc0ed107fe42bb7e6a5dfefb586f4c3ae4328" +dependencies = [ + "cumulus-primitives-core", + "frame-support", + "frame-system", + "parity-scale-codec", + "scale-info", + "serde", + "sp-io", + "sp-runtime", + "sp-std", + "xcm", +] + +[[package]] +name = "cumulus-pallet-xcmp-queue" +version = "0.1.0" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.30#7b1fc0ed107fe42bb7e6a5dfefb586f4c3ae4328" +dependencies = [ + "cumulus-primitives-core", + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "parity-scale-codec", + "rand_chacha 0.3.1", + "scale-info", + "sp-runtime", + "sp-std", + "xcm", + "xcm-executor", +] + +[[package]] +name = "cumulus-primitives-core" +version = "0.1.0" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.30#7b1fc0ed107fe42bb7e6a5dfefb586f4c3ae4328" +dependencies = [ + "frame-support", + "parity-scale-codec", + "polkadot-core-primitives", + "polkadot-parachain", + "polkadot-primitives", + "sp-api", + "sp-runtime", + "sp-std", + "sp-trie", +] + +[[package]] +name = "cumulus-primitives-parachain-inherent" +version = "0.1.0" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.30#7b1fc0ed107fe42bb7e6a5dfefb586f4c3ae4328" +dependencies = [ + "async-trait", + "cumulus-primitives-core", + "cumulus-relay-chain-interface", + "cumulus-test-relay-sproof-builder", + "parity-scale-codec", + "sc-client-api", + "scale-info", + "sp-api", + "sp-core", + "sp-inherents", + "sp-runtime", + "sp-state-machine", + "sp-std", + "sp-storage", + "sp-trie", + "tracing", +] + +[[package]] +name = "cumulus-primitives-timestamp" +version = "0.1.0" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.30#7b1fc0ed107fe42bb7e6a5dfefb586f4c3ae4328" +dependencies = [ + "cumulus-primitives-core", + "futures", + "parity-scale-codec", + "sp-inherents", + "sp-std", + "sp-timestamp", +] + +[[package]] +name = "cumulus-primitives-utility" +version = "0.1.0" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.30#7b1fc0ed107fe42bb7e6a5dfefb586f4c3ae4328" +dependencies = [ + "cumulus-primitives-core", + "frame-support", + "log", + "parity-scale-codec", + "polkadot-core-primitives", + "polkadot-parachain", + "polkadot-primitives", + "sp-runtime", + "sp-std", + "sp-trie", + "xcm", + "xcm-builder", + "xcm-executor", +] + +[[package]] +name = "cumulus-relay-chain-inprocess-interface" +version = "0.1.0" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.30#7b1fc0ed107fe42bb7e6a5dfefb586f4c3ae4328" +dependencies = [ + "async-trait", + "cumulus-primitives-core", + "cumulus-relay-chain-interface", + "futures", + "futures-timer", + "polkadot-cli", + "polkadot-client", + "polkadot-service", + "sc-cli", + "sc-client-api", + "sc-consensus-babe", + "sc-network", + "sc-sysinfo", + "sc-telemetry", + "sc-tracing", + "sp-api", + "sp-blockchain", + "sp-consensus", + "sp-core", + "sp-runtime", + "sp-state-machine", + "tracing", +] + +[[package]] +name = "cumulus-relay-chain-interface" +version = "0.1.0" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.30#7b1fc0ed107fe42bb7e6a5dfefb586f4c3ae4328" +dependencies = [ + "async-trait", + "cumulus-primitives-core", + "derive_more", + "futures", + "jsonrpsee-core", + "parity-scale-codec", + "parking_lot 0.12.1", + "polkadot-overseer", + "polkadot-service", + "sc-client-api", + "sp-api", + "sp-blockchain", + "sp-core", + "sp-runtime", + "sp-state-machine", + "thiserror", +] + +[[package]] +name = "cumulus-relay-chain-rpc-interface" +version = "0.1.0" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.30#7b1fc0ed107fe42bb7e6a5dfefb586f4c3ae4328" +dependencies = [ + "async-trait", + "backoff", + "cumulus-primitives-core", + "cumulus-relay-chain-interface", + "futures", + "futures-timer", + "jsonrpsee", + "parity-scale-codec", + "parking_lot 0.12.1", + "polkadot-service", + "sc-client-api", + "sc-rpc-api", + "sp-api", + "sp-core", + "sp-runtime", + "sp-state-machine", + "sp-storage", + "tokio", + "tracing", + "url", +] + +[[package]] +name = "cumulus-test-relay-sproof-builder" +version = "0.1.0" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.30#7b1fc0ed107fe42bb7e6a5dfefb586f4c3ae4328" +dependencies = [ + "cumulus-primitives-core", + "parity-scale-codec", + "polkadot-primitives", + "sp-runtime", + "sp-state-machine", + "sp-std", +] + +[[package]] +name = "curve25519-dalek" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a9b85542f99a2dfa2a1b8e192662741c9859a846b296bef1c92ef9b58b5a216" +dependencies = [ + "byteorder", + "digest 0.8.1", + "rand_core 0.5.1", + "subtle", + "zeroize", +] + +[[package]] +name = "curve25519-dalek" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b9fdf9972b2bd6af2d913799d9ebc165ea4d2e65878e329d9c6b372c4491b61" +dependencies = [ + "byteorder", + "digest 0.9.0", + "rand_core 0.5.1", + "subtle", + "zeroize", +] + +[[package]] +name = "curve25519-dalek" +version = "4.0.0-pre.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4033478fbf70d6acf2655ac70da91ee65852d69daf7a67bf7a2f518fb47aafcf" +dependencies = [ + "byteorder", + "digest 0.9.0", + "rand_core 0.6.4", + "subtle", + "zeroize", +] + +[[package]] +name = "cxx" +version = "1.0.81" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97abf9f0eca9e52b7f81b945524e76710e6cb2366aead23b7d4fbf72e281f888" +dependencies = [ + "cc", + "cxxbridge-flags", + "cxxbridge-macro", + "link-cplusplus", +] + +[[package]] +name = "cxx-build" +version = "1.0.81" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7cc32cc5fea1d894b77d269ddb9f192110069a8a9c1f1d441195fba90553dea3" +dependencies = [ + "cc", + "codespan-reporting", + "once_cell", + "proc-macro2", + "quote", + "scratch", + "syn", +] + +[[package]] +name = "cxxbridge-flags" +version = "1.0.81" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ca220e4794c934dc6b1207c3b42856ad4c302f2df1712e9f8d2eec5afaacf1f" + +[[package]] +name = "cxxbridge-macro" +version = "1.0.81" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b846f081361125bfc8dc9d3940c84e1fd83ba54bbca7b17cd29483c828be0704" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "darwinia" +version = "6.0.0" +dependencies = [ + "clap", + "cumulus-client-cli", + "cumulus-client-collator", + "cumulus-client-consensus-aura", + "cumulus-client-consensus-common", + "cumulus-client-network", + "cumulus-client-service", + "cumulus-primitives-core", + "cumulus-primitives-parachain-inherent", + "cumulus-relay-chain-inprocess-interface", + "cumulus-relay-chain-interface", + "cumulus-relay-chain-rpc-interface", + "darwinia-runtime", + "dc-primitives", + "frame-benchmarking", + "frame-benchmarking-cli", + "jsonrpsee", + "log", + "pallet-transaction-payment-rpc", + "parity-scale-codec", + "polkadot-cli", + "polkadot-parachain", + "polkadot-primitives", + "polkadot-service", + "sc-basic-authorship", + "sc-chain-spec", + "sc-cli", + "sc-client-api", + "sc-consensus", + "sc-executor", + "sc-keystore", + "sc-network", + "sc-network-common", + "sc-rpc", + "sc-rpc-api", + "sc-service", + "sc-sysinfo", + "sc-telemetry", + "sc-tracing", + "sc-transaction-pool", + "sc-transaction-pool-api", + "serde", + "sp-api", + "sp-block-builder", + "sp-blockchain", + "sp-consensus", + "sp-consensus-aura", + "sp-core", + "sp-inherents", + "sp-keystore", + "sp-offchain", + "sp-runtime", + "sp-session", + "sp-timestamp", + "sp-transaction-pool", + "substrate-build-script-utils", + "substrate-frame-rpc-system", + "substrate-prometheus-endpoint", + "try-runtime-cli", + "xcm", +] + +[[package]] +name = "darwinia-runtime" +version = "6.0.0" +dependencies = [ + "array-bytes", + "cumulus-pallet-aura-ext", + "cumulus-pallet-dmp-queue", + "cumulus-pallet-parachain-system", + "cumulus-pallet-session-benchmarking", + "cumulus-pallet-xcm", + "cumulus-pallet-xcmp-queue", + "cumulus-primitives-core", + "cumulus-primitives-timestamp", + "cumulus-primitives-utility", + "dc-primitives", + "frame-benchmarking", + "frame-executive", + "frame-support", + "frame-system", + "frame-system-benchmarking", + "frame-system-rpc-runtime-api", + "frame-try-runtime", + "pallet-aura", + "pallet-authorship", + "pallet-balances", + "pallet-collator-selection", + "pallet-session", + "pallet-sudo", + "pallet-timestamp", + "pallet-transaction-payment", + "pallet-transaction-payment-rpc-runtime-api", + "pallet-xcm", + "parachain-info", + "parity-scale-codec", + "polkadot-parachain", + "polkadot-runtime-common", + "scale-info", + "smallvec", + "sp-api", + "sp-block-builder", + "sp-consensus-aura", + "sp-core", + "sp-inherents", + "sp-io", + "sp-offchain", + "sp-runtime", + "sp-session", + "sp-std", + "sp-transaction-pool", + "sp-version", + "substrate-wasm-builder", + "xcm", + "xcm-builder", + "xcm-executor", +] + +[[package]] +name = "data-encoding" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ee2393c4a91429dffb4bedf19f4d6abf27d8a732c8ce4980305d782e5426d57" + +[[package]] +name = "data-encoding-macro" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86927b7cd2fe88fa698b87404b287ab98d1a0063a34071d92e575b72d3029aca" +dependencies = [ + "data-encoding", + "data-encoding-macro-internal", +] + +[[package]] +name = "data-encoding-macro-internal" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5bbed42daaa95e780b60a50546aa345b8413a1e46f9a40a12907d3598f038db" +dependencies = [ + "data-encoding", + "syn", +] + +[[package]] +name = "dc-primitives" +version = "6.0.0" +dependencies = [ + "sp-core", + "sp-runtime", +] + +[[package]] +name = "der" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6919815d73839e7ad218de758883aae3a257ba6759ce7a9992501efbb53d705c" +dependencies = [ + "const-oid", +] + +[[package]] +name = "derivative" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "derive_more" +version = "0.99.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" +dependencies = [ + "convert_case", + "proc-macro2", + "quote", + "rustc_version", + "syn", +] + +[[package]] +name = "digest" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" +dependencies = [ + "generic-array 0.12.4", +] + +[[package]] +name = "digest" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" +dependencies = [ + "generic-array 0.14.6", +] + +[[package]] +name = "digest" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adfbc57365a37acbd2ebf2b64d7e69bb766e2fea813521ed536f5d0520dcf86c" +dependencies = [ + "block-buffer 0.10.3", + "crypto-common", + "subtle", +] + +[[package]] +name = "directories" +version = "4.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f51c5d4ddabd36886dd3e1438cb358cdcb0d7c499cb99cb4ac2e38e18b5cb210" +dependencies = [ + "dirs-sys", +] + +[[package]] +name = "directories-next" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "339ee130d97a610ea5a5872d2bbb130fdf68884ff09d3028b81bec8a1ac23bbc" +dependencies = [ + "cfg-if 1.0.0", + "dirs-sys-next", +] + +[[package]] +name = "dirs-sys" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6" +dependencies = [ + "libc", + "redox_users", + "winapi", +] + +[[package]] +name = "dirs-sys-next" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" +dependencies = [ + "libc", + "redox_users", + "winapi", +] + +[[package]] +name = "dns-parser" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4d33be9473d06f75f58220f71f7a9317aca647dc061dbd3c361b0bef505fbea" +dependencies = [ + "byteorder", + "quick-error", +] + +[[package]] +name = "downcast-rs" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" + +[[package]] +name = "dtoa" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8a6eee2d5d0d113f015688310da018bd1d864d86bd567c8fca9c266889e1bfa" + +[[package]] +name = "dyn-clonable" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e9232f0e607a262ceb9bd5141a3dfb3e4db6994b31989bbfd845878cba59fd4" +dependencies = [ + "dyn-clonable-impl", + "dyn-clone", +] + +[[package]] +name = "dyn-clonable-impl" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "558e40ea573c374cf53507fd240b7ee2f5477df7cfebdb97323ec61c719399c5" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "dyn-clone" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f94fa09c2aeea5b8839e414b7b841bf429fd25b9c522116ac97ee87856d88b2" + +[[package]] +name = "ecdsa" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0d69ae62e0ce582d56380743515fefaf1a8c70cec685d9677636d7e30ae9dc9" +dependencies = [ + "der", + "elliptic-curve", + "rfc6979", + "signature", +] + +[[package]] +name = "ed25519" +version = "1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e9c280362032ea4203659fc489832d0204ef09f247a0506f170dafcac08c369" +dependencies = [ + "signature", +] + +[[package]] +name = "ed25519-dalek" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c762bae6dcaf24c4c84667b8579785430908723d5c889f469d76a41d59cc7a9d" +dependencies = [ + "curve25519-dalek 3.2.0", + "ed25519", + "rand 0.7.3", + "serde", + "sha2 0.9.9", + "zeroize", +] + +[[package]] +name = "ed25519-zebra" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c24f403d068ad0b359e577a77f92392118be3f3c927538f2bb544a5ecd828c6" +dependencies = [ + "curve25519-dalek 3.2.0", + "hashbrown", + "hex", + "rand_core 0.6.4", + "sha2 0.9.9", + "zeroize", +] + +[[package]] +name = "either" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797" + +[[package]] +name = "elliptic-curve" +version = "0.11.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25b477563c2bfed38a3b7a60964c49e058b2510ad3f12ba3483fd8f62c2306d6" +dependencies = [ + "base16ct", + "crypto-bigint", + "der", + "ff", + "generic-array 0.14.6", + "group", + "rand_core 0.6.4", + "sec1", + "subtle", + "zeroize", +] + +[[package]] +name = "enum-as-inner" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21cdad81446a7f7dc43f6a77409efeb9733d2fa65553efef6018ef257c959b73" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "enumflags2" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e75d4cd21b95383444831539909fbb14b9dc3fdceb2a6f5d36577329a1f55ccb" +dependencies = [ + "enumflags2_derive", +] + +[[package]] +name = "enumflags2_derive" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f58dc3c5e468259f19f2d46304a6b28f1c3d034442e14b322d2b850e36f6d5ae" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "enumn" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "038b1afa59052df211f9efd58f8b1d84c242935ede1c3dbaed26b018a9e06ae2" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "env_logger" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a12e6657c4c97ebab115a42dcee77225f7f482cdd841cf7088c657a42e9e00e7" +dependencies = [ + "atty", + "humantime", + "log", + "regex", + "termcolor", +] + +[[package]] +name = "environmental" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68b91989ae21441195d7d9b9993a2f9295c7e1a8c96255d8b729accddc124797" + +[[package]] +name = "errno" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1" +dependencies = [ + "errno-dragonfly", + "libc", + "winapi", +] + +[[package]] +name = "errno-dragonfly" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" +dependencies = [ + "cc", + "libc", +] + +[[package]] +name = "event-listener" +version = "2.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" + +[[package]] +name = "exit-future" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e43f2f1833d64e33f15592464d6fdd70f349dda7b1a53088eb83cd94014008c5" +dependencies = [ + "futures", +] + +[[package]] +name = "expander" +version = "0.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a718c0675c555c5f976fff4ea9e2c150fa06cefa201cadef87cfbf9324075881" +dependencies = [ + "blake3", + "fs-err", + "proc-macro2", + "quote", +] + +[[package]] +name = "expander" +version = "0.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3774182a5df13c3d1690311ad32fbe913feef26baba609fa2dd5f72042bd2ab6" +dependencies = [ + "blake2", + "fs-err", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "fake-simd" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" + +[[package]] +name = "fallible-iterator" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" + +[[package]] +name = "fastrand" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7a407cfaa3385c4ae6b23e84623d48c2798d06e3e6a1878f7f59f17b3f86499" +dependencies = [ + "instant", +] + +[[package]] +name = "fatality" +version = "0.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ad875162843b0d046276327afe0136e9ed3a23d5a754210fb6f1f33610d39ab" +dependencies = [ + "fatality-proc-macro", + "thiserror", +] + +[[package]] +name = "fatality-proc-macro" +version = "0.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f5aa1e3ae159e592ad222dc90c5acbad632b527779ba88486abe92782ab268bd" +dependencies = [ + "expander 0.0.4", + "indexmap", + "proc-macro-crate", + "proc-macro2", + "quote", + "syn", + "thiserror", +] + +[[package]] +name = "fdlimit" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c4c9e43643f5a3be4ca5b67d26b98031ff9db6806c3440ae32e02e3ceac3f1b" +dependencies = [ + "libc", +] + +[[package]] +name = "ff" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "131655483be284720a17d74ff97592b8e76576dc25563148601df2d7c9080924" +dependencies = [ + "rand_core 0.6.4", + "subtle", +] + +[[package]] +name = "file-per-thread-logger" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21e16290574b39ee41c71aeb90ae960c504ebaf1e2a1c87bd52aa56ed6e1a02f" +dependencies = [ + "env_logger", + "log", +] + +[[package]] +name = "filetime" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b9663d381d07ae25dc88dbdf27df458faa83a9b25336bcac83d5e452b5fc9d3" +dependencies = [ + "cfg-if 1.0.0", + "libc", + "redox_syscall", + "windows-sys 0.42.0", +] + +[[package]] +name = "finality-grandpa" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b22349c6a11563a202d95772a68e0fcf56119e74ea8a2a19cf2301460fcd0df5" +dependencies = [ + "either", + "futures", + "futures-timer", + "log", + "num-traits", + "parity-scale-codec", + "parking_lot 0.12.1", + "scale-info", +] + +[[package]] +name = "fixed-hash" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcf0ed7fe52a17a03854ec54a9f76d6d84508d1c0e66bc1793301c73fc8493c" +dependencies = [ + "byteorder", + "rand 0.8.5", + "rustc-hex", + "static_assertions", +] + +[[package]] +name = "fixedbitset" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" + +[[package]] +name = "flate2" +version = "1.0.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f82b0f4c27ad9f8bfd1f3208d882da2b09c301bc1c828fd3a00d0216d2fbbff6" +dependencies = [ + "crc32fast", + "libz-sys", + "miniz_oxide", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "fork-tree" +version = "3.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "parity-scale-codec", +] + +[[package]] +name = "form_urlencoded" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9c384f161156f5260c24a097c56119f9be8c798586aecc13afbcbe7b7e26bf8" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "frame-benchmarking" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "frame-support", + "frame-system", + "linregress", + "log", + "parity-scale-codec", + "paste", + "scale-info", + "serde", + "sp-api", + "sp-application-crypto", + "sp-core", + "sp-io", + "sp-runtime", + "sp-runtime-interface", + "sp-std", + "sp-storage", +] + +[[package]] +name = "frame-benchmarking-cli" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "Inflector", + "array-bytes", + "chrono", + "clap", + "comfy-table", + "frame-benchmarking", + "frame-support", + "frame-system", + "gethostname", + "handlebars", + "hash-db", + "itertools", + "kvdb", + "lazy_static", + "linked-hash-map", + "log", + "memory-db", + "parity-scale-codec", + "rand 0.8.5", + "rand_pcg 0.3.1", + "sc-block-builder", + "sc-cli", + "sc-client-api", + "sc-client-db", + "sc-executor", + "sc-service", + "sc-sysinfo", + "serde", + "serde_json", + "serde_nanos", + "sp-api", + "sp-blockchain", + "sp-core", + "sp-database", + "sp-externalities", + "sp-inherents", + "sp-keystore", + "sp-runtime", + "sp-state-machine", + "sp-storage", + "sp-trie", + "tempfile", + "thiserror", + "thousands", +] + +[[package]] +name = "frame-election-provider-solution-type" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "frame-election-provider-support" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "frame-election-provider-solution-type", + "frame-support", + "frame-system", + "parity-scale-codec", + "scale-info", + "sp-arithmetic", + "sp-npos-elections", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "frame-executive" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "frame-support", + "frame-system", + "frame-try-runtime", + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", + "sp-tracing", +] + +[[package]] +name = "frame-metadata" +version = "15.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df6bb8542ef006ef0de09a5c4420787d79823c0ed7924225822362fd2bf2ff2d" +dependencies = [ + "cfg-if 1.0.0", + "parity-scale-codec", + "scale-info", + "serde", +] + +[[package]] +name = "frame-support" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "bitflags", + "frame-metadata", + "frame-support-procedural", + "impl-trait-for-tuples", + "k256", + "log", + "once_cell", + "parity-scale-codec", + "paste", + "scale-info", + "serde", + "smallvec", + "sp-api", + "sp-arithmetic", + "sp-core", + "sp-core-hashing-proc-macro", + "sp-inherents", + "sp-io", + "sp-runtime", + "sp-staking", + "sp-state-machine", + "sp-std", + "sp-tracing", + "sp-weights", + "tt-call", +] + +[[package]] +name = "frame-support-procedural" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "Inflector", + "cfg-expr", + "frame-support-procedural-tools", + "itertools", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "frame-support-procedural-tools" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "frame-support-procedural-tools-derive", + "proc-macro-crate", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "frame-support-procedural-tools-derive" +version = "3.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "frame-system" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "frame-support", + "log", + "parity-scale-codec", + "scale-info", + "serde", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", + "sp-version", + "sp-weights", +] + +[[package]] +name = "frame-system-benchmarking" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "frame-system-rpc-runtime-api" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "parity-scale-codec", + "sp-api", +] + +[[package]] +name = "frame-try-runtime" +version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "frame-support", + "parity-scale-codec", + "sp-api", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "fs-err" +version = "2.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0845fa252299212f0389d64ba26f34fa32cfe41588355f21ed507c59a0f64541" + +[[package]] +name = "fs-swap" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03d47dad3685eceed8488986cad3d5027165ea5edb164331770e2059555f10a5" +dependencies = [ + "lazy_static", + "libc", + "libloading 0.5.2", + "winapi", +] + +[[package]] +name = "fs2" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9564fc758e15025b46aa6643b1b77d047d1a56a1aea6e01002ac0c7026876213" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "fs_extra" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2022715d62ab30faffd124d40b76f4134a550a87792276512b18d63272333394" + +[[package]] +name = "funty" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" + +[[package]] +name = "futures" +version = "0.3.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38390104763dc37a5145a53c29c63c1290b5d316d6086ec32c293f6736051bb0" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52ba265a92256105f45b719605a571ffe2d1f0fea3807304b522c1d778f79eed" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04909a7a7e4633ae6c4a9ab280aeb86da1236243a77b694a49eacd659a4bd3ac" + +[[package]] +name = "futures-executor" +version = "0.3.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7acc85df6714c176ab5edf386123fafe217be88c0840ec11f199441134a074e2" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", + "num_cpus", +] + +[[package]] +name = "futures-io" +version = "0.3.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00f5fb52a06bdcadeb54e8d3671f8888a39697dcb0b81b23b55174030427f4eb" + +[[package]] +name = "futures-lite" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7694489acd39452c77daa48516b894c153f192c3578d5a839b62c58099fcbf48" +dependencies = [ + "fastrand", + "futures-core", + "futures-io", + "memchr", + "parking", + "pin-project-lite 0.2.9", + "waker-fn", +] + +[[package]] +name = "futures-macro" +version = "0.3.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bdfb8ce053d86b91919aad980c220b1fb8401a9394410e1c289ed7e66b61835d" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "futures-rustls" +version = "0.22.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2411eed028cdf8c8034eaf21f9915f956b6c3abec4d4c7949ee67f0721127bd" +dependencies = [ + "futures-io", + "rustls", + "webpki", +] + +[[package]] +name = "futures-sink" +version = "0.3.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39c15cf1a4aa79df40f1bb462fb39676d0ad9e366c2a33b590d7c66f4f81fcf9" + +[[package]] +name = "futures-task" +version = "0.3.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ffb393ac5d9a6eaa9d3fdf37ae2776656b706e200c8e16b1bdb227f5198e6ea" + +[[package]] +name = "futures-timer" +version = "3.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e64b03909df88034c26dc1547e8970b91f98bdb65165d6a4e9110d94263dbb2c" + +[[package]] +name = "futures-util" +version = "0.3.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "197676987abd2f9cadff84926f410af1c183608d36641465df73ae8211dc65d6" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite 0.2.9", + "pin-utils", + "slab", +] + +[[package]] +name = "fxhash" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" +dependencies = [ + "byteorder", +] + +[[package]] +name = "generic-array" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffdf9f34f1447443d37393cc6c2b8313aebddcd96906caf34e54c68d8e57d7bd" +dependencies = [ + "typenum", +] + +[[package]] +name = "generic-array" +version = "0.14.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bff49e947297f3312447abdca79f45f4738097cc82b06e72054d2223f601f1b9" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "gethostname" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1ebd34e35c46e00bb73e81363248d627782724609fe1b6396f553f68fe3862e" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "getrandom" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" +dependencies = [ + "cfg-if 1.0.0", + "js-sys", + "libc", + "wasi 0.9.0+wasi-snapshot-preview1", + "wasm-bindgen", +] + +[[package]] +name = "getrandom" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" +dependencies = [ + "cfg-if 1.0.0", + "libc", + "wasi 0.11.0+wasi-snapshot-preview1", +] + +[[package]] +name = "ghash" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1583cc1656d7839fd3732b80cf4f38850336cdb9b8ded1cd399ca62958de3c99" +dependencies = [ + "opaque-debug 0.3.0", + "polyval", +] + +[[package]] +name = "gimli" +version = "0.26.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22030e2c5a68ec659fde1e949a745124b48e6fa8b045b7ed5bd1fe4ccc5c4e5d" +dependencies = [ + "fallible-iterator", + "indexmap", + "stable_deref_trait", +] + +[[package]] +name = "glob" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" + +[[package]] +name = "globset" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a1e17342619edbc21a964c2afbeb6c820c6a2560032872f397bb97ea127bd0a" +dependencies = [ + "aho-corasick", + "bstr", + "fnv", + "log", + "regex", +] + +[[package]] +name = "gloo-timers" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fb7d06c1c8cc2a29bee7ec961009a0b2caa0793ee4900c2ffb348734ba1c8f9" +dependencies = [ + "futures-channel", + "futures-core", + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "group" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc5ac374b108929de78460075f3dc439fa66df9d8fc77e8f12caa5165fcf0c89" +dependencies = [ + "ff", + "rand_core 0.6.4", + "subtle", +] + +[[package]] +name = "h2" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f9f29bc9dda355256b2916cf526ab02ce0aeaaaf2bad60d65ef3f12f11dd0f4" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http", + "indexmap", + "slab", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "handlebars" +version = "4.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "433e4ab33f1213cdc25b5fa45c76881240cfe79284cf2b395e8b9e312a30a2fd" +dependencies = [ + "log", + "pest", + "pest_derive", + "serde", + "serde_json", + "thiserror", +] + +[[package]] +name = "hash-db" +version = "0.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d23bd4e7b5eda0d0f3a307e8b381fdc8ba9000f26fbe912250c0a4cc3956364a" + +[[package]] +name = "hash256-std-hasher" +version = "0.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92c171d55b98633f4ed3860808f004099b36c1cc29c42cfc53aa8591b21efcf2" +dependencies = [ + "crunchy", +] + +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +dependencies = [ + "ahash", +] + +[[package]] +name = "heck" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9" + +[[package]] +name = "hermit-abi" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" +dependencies = [ + "libc", +] + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "hex-literal" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" + +[[package]] +name = "hex_fmt" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b07f60793ff0a4d9cef0f18e63b5357e06209987153a64648c972c1e5aff336f" + +[[package]] +name = "hmac" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "126888268dcc288495a26bf004b38c5fdbb31682f992c84ceb046a1f0fe38840" +dependencies = [ + "crypto-mac 0.8.0", + "digest 0.9.0", +] + +[[package]] +name = "hmac" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a2a2320eb7ec0ebe8da8f744d7812d9fc4cb4d09344ac01898dbcb6a20ae69b" +dependencies = [ + "crypto-mac 0.11.1", + "digest 0.9.0", +] + +[[package]] +name = "hmac-drbg" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17ea0a1394df5b6574da6e0c1ade9e78868c9fb0a4e5ef4428e32da4676b85b1" +dependencies = [ + "digest 0.9.0", + "generic-array 0.14.6", + "hmac 0.8.1", +] + +[[package]] +name = "hostname" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c731c3e10504cc8ed35cfe2f1db4c9274c3d35fa486e3b31df46f068ef3e867" +dependencies = [ + "libc", + "match_cfg", + "winapi", +] + +[[package]] +name = "http" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75f43d41e26995c17e71ee126451dd3941010b0514a81a9d11f3b341debc2399" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http-body" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" +dependencies = [ + "bytes", + "http", + "pin-project-lite 0.2.9", +] + +[[package]] +name = "httparse" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" + +[[package]] +name = "httpdate" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" + +[[package]] +name = "humantime" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" + +[[package]] +name = "hyper" +version = "0.14.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "034711faac9d2166cb1baf1a2fb0b60b1f277f8492fd72176c17f3515e1abd3c" +dependencies = [ + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project-lite 0.2.9", + "socket2", + "tokio", + "tower-service", + "tracing", + "want", +] + +[[package]] +name = "hyper-rustls" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d87c48c02e0dc5e3b849a2041db3029fd066650f8f717c07bf8ed78ccb895cac" +dependencies = [ + "http", + "hyper", + "log", + "rustls", + "rustls-native-certs", + "tokio", + "tokio-rustls", +] + +[[package]] +name = "iana-time-zone" +version = "0.1.53" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64c122667b287044802d6ce17ee2ddf13207ed924c712de9a66a5814d5b64765" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "wasm-bindgen", + "winapi", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0703ae284fc167426161c2e3f1da3ea71d94b21bedbcc9494e92b28e334e3dca" +dependencies = [ + "cxx", + "cxx-build", +] + +[[package]] +name = "idna" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8" +dependencies = [ + "matches", + "unicode-bidi", + "unicode-normalization", +] + +[[package]] +name = "idna" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e14ddfc70884202db2244c223200c204c2bda1bc6e0998d11b5e024d657209e6" +dependencies = [ + "unicode-bidi", + "unicode-normalization", +] + +[[package]] +name = "if-addrs" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cbc0fa01ffc752e9dbc72818cdb072cd028b86be5e09dd04c5a643704fe101a9" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "if-watch" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "015a7df1eb6dda30df37f34b63ada9b7b352984b0e84de2a20ed526345000791" +dependencies = [ + "async-io", + "core-foundation", + "fnv", + "futures", + "if-addrs", + "ipnet", + "log", + "rtnetlink", + "system-configuration", + "windows", +] + +[[package]] +name = "impl-codec" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba6a270039626615617f3f36d15fc827041df3b78c439da2cadfa47455a77f2f" +dependencies = [ + "parity-scale-codec", +] + +[[package]] +name = "impl-serde" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4551f042f3438e64dbd6226b20527fc84a6e1fe65688b58746a2f53623f25f5c" +dependencies = [ + "serde", +] + +[[package]] +name = "impl-trait-for-tuples" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11d7a9f6330b71fea57921c9b61c47ee6e84f72d394754eff6163ae67e7395eb" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "indexmap" +version = "1.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e" +dependencies = [ + "autocfg", + "hashbrown", + "serde", +] + +[[package]] +name = "inout" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5" +dependencies = [ + "generic-array 0.14.6", +] + +[[package]] +name = "instant" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +dependencies = [ + "cfg-if 1.0.0", +] + +[[package]] +name = "integer-encoding" +version = "3.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8bb03732005da905c88227371639bf1ad885cc712789c011c31c5fb3ab3ccf02" + +[[package]] +name = "integer-sqrt" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "276ec31bcb4a9ee45f58bec6f9ec700ae4cf4f4f8f2fa7e06cb406bd5ffdd770" +dependencies = [ + "num-traits", +] + +[[package]] +name = "io-lifetimes" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ce5ef949d49ee85593fc4d3f3f95ad61657076395cbbce23e2121fc5542074" + +[[package]] +name = "ip_network" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa2f047c0a98b2f299aa5d6d7088443570faae494e9ae1305e48be000c9e0eb1" + +[[package]] +name = "ipconfig" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "723519edce41262b05d4143ceb95050e4c614f483e78e9fd9e39a8275a84ad98" +dependencies = [ + "socket2", + "widestring", + "winapi", + "winreg", +] + +[[package]] +name = "ipnet" +version = "2.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f88c5561171189e69df9d98bcf18fd5f9558300f7ea7b801eb8a0fd748bd8745" + +[[package]] +name = "itertools" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4217ad341ebadf8d8e724e264f13e593e0648f5b3e94b3896a5df283be015ecc" + +[[package]] +name = "jobserver" +version = "0.1.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "068b1ee6743e4d11fb9c6a1e6064b3693a1b600e7f5f5988047d98b3dc9fb90b" +dependencies = [ + "libc", +] + +[[package]] +name = "js-sys" +version = "0.3.60" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49409df3e3bf0856b916e2ceaca09ee28e6871cf7d9ce97a692cacfdb2a25a47" +dependencies = [ + "wasm-bindgen", +] + +[[package]] +name = "jsonrpsee" +version = "0.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8bd0d559d5e679b1ab2f869b486a11182923863b1b3ee8b421763cdd707b783a" +dependencies = [ + "jsonrpsee-core", + "jsonrpsee-http-server", + "jsonrpsee-proc-macros", + "jsonrpsee-types", + "jsonrpsee-ws-client", + "jsonrpsee-ws-server", + "tracing", +] + +[[package]] +name = "jsonrpsee-client-transport" +version = "0.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8752740ecd374bcbf8b69f3e80b0327942df76f793f8d4e60d3355650c31fb74" +dependencies = [ + "futures-util", + "http", + "jsonrpsee-core", + "jsonrpsee-types", + "pin-project", + "rustls-native-certs", + "soketto", + "thiserror", + "tokio", + "tokio-rustls", + "tokio-util", + "tracing", + "webpki-roots", +] + +[[package]] +name = "jsonrpsee-core" +version = "0.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3dc3e9cf2ba50b7b1d7d76a667619f82846caa39e8e8daa8a4962d74acaddca" +dependencies = [ + "anyhow", + "arrayvec 0.7.2", + "async-lock", + "async-trait", + "beef", + "futures-channel", + "futures-timer", + "futures-util", + "globset", + "http", + "hyper", + "jsonrpsee-types", + "lazy_static", + "parking_lot 0.12.1", + "rand 0.8.5", + "rustc-hash", + "serde", + "serde_json", + "soketto", + "thiserror", + "tokio", + "tracing", + "tracing-futures", + "unicase", +] + +[[package]] +name = "jsonrpsee-http-server" +version = "0.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03802f0373a38c2420c70b5144742d800b509e2937edc4afb116434f07120117" +dependencies = [ + "futures-channel", + "futures-util", + "hyper", + "jsonrpsee-core", + "jsonrpsee-types", + "serde", + "serde_json", + "tokio", + "tracing", + "tracing-futures", +] + +[[package]] +name = "jsonrpsee-proc-macros" +version = "0.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd67957d4280217247588ac86614ead007b301ca2fa9f19c19f880a536f029e3" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "jsonrpsee-types" +version = "0.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e290bba767401b646812f608c099b922d8142603c9e73a50fb192d3ac86f4a0d" +dependencies = [ + "anyhow", + "beef", + "serde", + "serde_json", + "thiserror", + "tracing", +] + +[[package]] +name = "jsonrpsee-ws-client" +version = "0.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ee5feddd5188e62ac08fcf0e56478138e581509d4730f3f7be9b57dd402a4ff" +dependencies = [ + "http", + "jsonrpsee-client-transport", + "jsonrpsee-core", + "jsonrpsee-types", +] + +[[package]] +name = "jsonrpsee-ws-server" +version = "0.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d488ba74fb369e5ab68926feb75a483458b88e768d44319f37e4ecad283c7325" +dependencies = [ + "futures-channel", + "futures-util", + "http", + "jsonrpsee-core", + "jsonrpsee-types", + "serde_json", + "soketto", + "tokio", + "tokio-stream", + "tokio-util", + "tracing", + "tracing-futures", +] + +[[package]] +name = "k256" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19c3a5e0a0b8450278feda242592512e09f61c72e018b8cd5c859482802daf2d" +dependencies = [ + "cfg-if 1.0.0", + "ecdsa", + "elliptic-curve", + "sec1", +] + +[[package]] +name = "keccak" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9b7d56ba4a8344d6be9729995e6b06f928af29998cdf79fe390cbf6b1fee838" + +[[package]] +name = "kusama-runtime" +version = "0.9.30" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +dependencies = [ + "beefy-primitives", + "bitvec", + "frame-benchmarking", + "frame-election-provider-support", + "frame-executive", + "frame-support", + "frame-system", + "frame-system-benchmarking", + "frame-system-rpc-runtime-api", + "frame-try-runtime", + "hex-literal", + "kusama-runtime-constants", + "log", + "pallet-authority-discovery", + "pallet-authorship", + "pallet-babe", + "pallet-bags-list", + "pallet-balances", + "pallet-bounties", + "pallet-child-bounties", + "pallet-collective", + "pallet-democracy", + "pallet-election-provider-multi-phase", + "pallet-election-provider-support-benchmarking", + "pallet-elections-phragmen", + "pallet-fast-unstake", + "pallet-gilt", + "pallet-grandpa", + "pallet-identity", + "pallet-im-online", + "pallet-indices", + "pallet-membership", + "pallet-multisig", + "pallet-nomination-pools", + "pallet-nomination-pools-benchmarking", + "pallet-nomination-pools-runtime-api", + "pallet-offences", + "pallet-offences-benchmarking", + "pallet-preimage", + "pallet-proxy", + "pallet-recovery", + "pallet-scheduler", + "pallet-session", + "pallet-session-benchmarking", + "pallet-society", + "pallet-staking", + "pallet-staking-reward-fn", + "pallet-timestamp", + "pallet-tips", + "pallet-transaction-payment", + "pallet-transaction-payment-rpc-runtime-api", + "pallet-treasury", + "pallet-utility", + "pallet-vesting", + "pallet-xcm", + "pallet-xcm-benchmarks", + "parity-scale-codec", + "polkadot-primitives", + "polkadot-runtime-common", + "polkadot-runtime-parachains", + "rustc-hex", + "scale-info", + "serde", + "serde_derive", + "smallvec", + "sp-api", + "sp-arithmetic", + "sp-authority-discovery", + "sp-block-builder", + "sp-consensus-babe", + "sp-core", + "sp-inherents", + "sp-io", + "sp-mmr-primitives", + "sp-npos-elections", + "sp-offchain", + "sp-runtime", + "sp-session", + "sp-staking", + "sp-std", + "sp-transaction-pool", + "sp-version", + "static_assertions", + "substrate-wasm-builder", + "xcm", + "xcm-builder", + "xcm-executor", +] + +[[package]] +name = "kusama-runtime-constants" +version = "0.9.30" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +dependencies = [ + "frame-support", + "polkadot-primitives", + "polkadot-runtime-common", + "smallvec", + "sp-runtime", +] + +[[package]] +name = "kv-log-macro" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0de8b303297635ad57c9f5059fd9cee7a47f8e8daa09df0fcd07dd39fb22977f" +dependencies = [ + "log", +] + +[[package]] +name = "kvdb" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a301d8ecb7989d4a6e2c57a49baca77d353bdbf879909debe3f375fe25d61f86" +dependencies = [ + "parity-util-mem", + "smallvec", +] + +[[package]] +name = "kvdb-memorydb" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ece7e668abd21387aeb6628130a6f4c802787f014fa46bc83221448322250357" +dependencies = [ + "kvdb", + "parity-util-mem", + "parking_lot 0.12.1", +] + +[[package]] +name = "kvdb-rocksdb" +version = "0.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca7fbdfd71cd663dceb0faf3367a99f8cf724514933e9867cec4995b6027cbc1" +dependencies = [ + "fs-swap", + "kvdb", + "log", + "num_cpus", + "owning_ref", + "parity-util-mem", + "parking_lot 0.12.1", + "regex", + "rocksdb", + "smallvec", +] + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "lazycell" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" + +[[package]] +name = "libc" +version = "0.2.137" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc7fcc620a3bff7cdd7a365be3376c97191aeaccc2a603e600951e452615bf89" + +[[package]] +name = "libloading" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2b111a074963af1d37a139918ac6d49ad1d0d5e47f72fd55388619691a7d753" +dependencies = [ + "cc", + "winapi", +] + +[[package]] +name = "libloading" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f" +dependencies = [ + "cfg-if 1.0.0", + "winapi", +] + +[[package]] +name = "libm" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "292a948cd991e376cf75541fe5b97a1081d713c618b4f1b9500f8844e49eb565" + +[[package]] +name = "libp2p" +version = "0.46.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81327106887e42d004fbdab1fef93675be2e2e07c1b95fce45e2cc813485611d" +dependencies = [ + "bytes", + "futures", + "futures-timer", + "getrandom 0.2.8", + "instant", + "lazy_static", + "libp2p-autonat", + "libp2p-core", + "libp2p-deflate", + "libp2p-dns", + "libp2p-floodsub", + "libp2p-gossipsub", + "libp2p-identify", + "libp2p-kad", + "libp2p-mdns", + "libp2p-metrics", + "libp2p-mplex", + "libp2p-noise", + "libp2p-ping", + "libp2p-plaintext", + "libp2p-pnet", + "libp2p-relay", + "libp2p-rendezvous", + "libp2p-request-response", + "libp2p-swarm", + "libp2p-swarm-derive", + "libp2p-tcp", + "libp2p-uds", + "libp2p-wasm-ext", + "libp2p-websocket", + "libp2p-yamux", + "multiaddr", + "parking_lot 0.12.1", + "pin-project", + "rand 0.7.3", + "smallvec", +] + +[[package]] +name = "libp2p-autonat" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4decc51f3573653a9f4ecacb31b1b922dd20c25a6322bb15318ec04287ec46f9" +dependencies = [ + "async-trait", + "futures", + "futures-timer", + "instant", + "libp2p-core", + "libp2p-request-response", + "libp2p-swarm", + "log", + "prost 0.10.4", + "prost-build 0.10.4", + "rand 0.8.5", +] + +[[package]] +name = "libp2p-core" +version = "0.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbf9b94cefab7599b2d3dff2f93bee218c6621d68590b23ede4485813cbcece6" +dependencies = [ + "asn1_der", + "bs58", + "ed25519-dalek", + "either", + "fnv", + "futures", + "futures-timer", + "instant", + "lazy_static", + "libsecp256k1", + "log", + "multiaddr", + "multihash", + "multistream-select", + "parking_lot 0.12.1", + "pin-project", + "prost 0.10.4", + "prost-build 0.10.4", + "rand 0.8.5", + "ring", + "rw-stream-sink", + "sha2 0.10.6", + "smallvec", + "thiserror", + "unsigned-varint", + "void", + "zeroize", +] + +[[package]] +name = "libp2p-deflate" +version = "0.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0183dc2a3da1fbbf85e5b6cf51217f55b14f5daea0c455a9536eef646bfec71" +dependencies = [ + "flate2", + "futures", + "libp2p-core", +] + +[[package]] +name = "libp2p-dns" +version = "0.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6cbf54723250fa5d521383be789bf60efdabe6bacfb443f87da261019a49b4b5" +dependencies = [ + "async-std-resolver", + "futures", + "libp2p-core", + "log", + "parking_lot 0.12.1", + "smallvec", + "trust-dns-resolver", +] + +[[package]] +name = "libp2p-floodsub" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "98a4b6ffd53e355775d24b76f583fdda54b3284806f678499b57913adb94f231" +dependencies = [ + "cuckoofilter", + "fnv", + "futures", + "libp2p-core", + "libp2p-swarm", + "log", + "prost 0.10.4", + "prost-build 0.10.4", + "rand 0.7.3", + "smallvec", +] + +[[package]] +name = "libp2p-gossipsub" +version = "0.39.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74b4b888cfbeb1f5551acd3aa1366e01bf88ede26cc3c4645d0d2d004d5ca7b0" +dependencies = [ + "asynchronous-codec", + "base64", + "byteorder", + "bytes", + "fnv", + "futures", + "hex_fmt", + "instant", + "libp2p-core", + "libp2p-swarm", + "log", + "prometheus-client", + "prost 0.10.4", + "prost-build 0.10.4", + "rand 0.7.3", + "regex", + "sha2 0.10.6", + "smallvec", + "unsigned-varint", + "wasm-timer", +] + +[[package]] +name = "libp2p-identify" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c50b585518f8efd06f93ac2f976bd672e17cdac794644b3117edd078e96bda06" +dependencies = [ + "asynchronous-codec", + "futures", + "futures-timer", + "libp2p-core", + "libp2p-swarm", + "log", + "lru 0.7.8", + "prost 0.10.4", + "prost-build 0.10.4", + "prost-codec", + "smallvec", + "thiserror", + "void", +] + +[[package]] +name = "libp2p-kad" +version = "0.38.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "740862893bb5f06ac24acc9d49bdeadc3a5e52e51818a30a25c1f3519da2c851" +dependencies = [ + "arrayvec 0.7.2", + "asynchronous-codec", + "bytes", + "either", + "fnv", + "futures", + "futures-timer", + "instant", + "libp2p-core", + "libp2p-swarm", + "log", + "prost 0.10.4", + "prost-build 0.10.4", + "rand 0.7.3", + "sha2 0.10.6", + "smallvec", + "thiserror", + "uint", + "unsigned-varint", + "void", +] + +[[package]] +name = "libp2p-mdns" +version = "0.38.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "66e5e5919509603281033fd16306c61df7a4428ce274b67af5e14b07de5cdcb2" +dependencies = [ + "async-io", + "data-encoding", + "dns-parser", + "futures", + "if-watch", + "lazy_static", + "libp2p-core", + "libp2p-swarm", + "log", + "rand 0.8.5", + "smallvec", + "socket2", + "void", +] + +[[package]] +name = "libp2p-metrics" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef8aff4a1abef42328fbb30b17c853fff9be986dc39af17ee39f9c5f755c5e0c" +dependencies = [ + "libp2p-core", + "libp2p-gossipsub", + "libp2p-identify", + "libp2p-kad", + "libp2p-ping", + "libp2p-relay", + "libp2p-swarm", + "prometheus-client", +] + +[[package]] +name = "libp2p-mplex" +version = "0.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61fd1b20638ec209c5075dfb2e8ce6a7ea4ec3cd3ad7b77f7a477c06d53322e2" +dependencies = [ + "asynchronous-codec", + "bytes", + "futures", + "libp2p-core", + "log", + "nohash-hasher", + "parking_lot 0.12.1", + "rand 0.7.3", + "smallvec", + "unsigned-varint", +] + +[[package]] +name = "libp2p-noise" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "762408cb5d84b49a600422d7f9a42c18012d8da6ebcd570f9a4a4290ba41fb6f" +dependencies = [ + "bytes", + "curve25519-dalek 3.2.0", + "futures", + "lazy_static", + "libp2p-core", + "log", + "prost 0.10.4", + "prost-build 0.10.4", + "rand 0.8.5", + "sha2 0.10.6", + "snow", + "static_assertions", + "x25519-dalek", + "zeroize", +] + +[[package]] +name = "libp2p-ping" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "100a6934ae1dbf8a693a4e7dd1d730fd60b774dafc45688ed63b554497c6c925" +dependencies = [ + "futures", + "futures-timer", + "instant", + "libp2p-core", + "libp2p-swarm", + "log", + "rand 0.7.3", + "void", +] + +[[package]] +name = "libp2p-plaintext" +version = "0.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be27bf0820a6238a4e06365b096d428271cce85a129cf16f2fe9eb1610c4df86" +dependencies = [ + "asynchronous-codec", + "bytes", + "futures", + "libp2p-core", + "log", + "prost 0.10.4", + "prost-build 0.10.4", + "unsigned-varint", + "void", +] + +[[package]] +name = "libp2p-pnet" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a5a702574223aa55d8878bdc8bf55c84a6086f87ddaddc28ce730b4caa81538" +dependencies = [ + "futures", + "log", + "pin-project", + "rand 0.8.5", + "salsa20", + "sha3", +] + +[[package]] +name = "libp2p-relay" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4931547ee0cce03971ccc1733ff05bb0c4349fd89120a39e9861e2bbe18843c3" +dependencies = [ + "asynchronous-codec", + "bytes", + "either", + "futures", + "futures-timer", + "instant", + "libp2p-core", + "libp2p-swarm", + "log", + "pin-project", + "prost 0.10.4", + "prost-build 0.10.4", + "prost-codec", + "rand 0.8.5", + "smallvec", + "static_assertions", + "thiserror", + "void", +] + +[[package]] +name = "libp2p-rendezvous" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9511c9672ba33284838e349623319c8cad2d18cfad243ae46c6b7e8a2982ea4e" +dependencies = [ + "asynchronous-codec", + "bimap", + "futures", + "futures-timer", + "instant", + "libp2p-core", + "libp2p-swarm", + "log", + "prost 0.10.4", + "prost-build 0.10.4", + "rand 0.8.5", + "sha2 0.10.6", + "thiserror", + "unsigned-varint", + "void", +] + +[[package]] +name = "libp2p-request-response" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "508a189e2795d892c8f5c1fa1e9e0b1845d32d7b0b249dbf7b05b18811361843" +dependencies = [ + "async-trait", + "bytes", + "futures", + "instant", + "libp2p-core", + "libp2p-swarm", + "log", + "rand 0.7.3", + "smallvec", + "unsigned-varint", +] + +[[package]] +name = "libp2p-swarm" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95ac5be6c2de2d1ff3f7693fda6faf8a827b1f3e808202277783fea9f527d114" +dependencies = [ + "either", + "fnv", + "futures", + "futures-timer", + "instant", + "libp2p-core", + "log", + "pin-project", + "rand 0.7.3", + "smallvec", + "thiserror", + "void", +] + +[[package]] +name = "libp2p-swarm-derive" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f54a64b6957249e0ce782f8abf41d97f69330d02bf229f0672d864f0650cc76" +dependencies = [ + "quote", + "syn", +] + +[[package]] +name = "libp2p-tcp" +version = "0.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a6771dc19aa3c65d6af9a8c65222bfc8fcd446630ddca487acd161fa6096f3b" +dependencies = [ + "async-io", + "futures", + "futures-timer", + "if-watch", + "ipnet", + "libc", + "libp2p-core", + "log", + "socket2", +] + +[[package]] +name = "libp2p-uds" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d125e3e5f0d58f3c6ac21815b20cf4b6a88b8db9dc26368ea821838f4161fd4d" +dependencies = [ + "async-std", + "futures", + "libp2p-core", + "log", +] + +[[package]] +name = "libp2p-wasm-ext" +version = "0.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec894790eec3c1608f8d1a8a0bdf0dbeb79ed4de2dce964222011c2896dfa05a" +dependencies = [ + "futures", + "js-sys", + "libp2p-core", + "parity-send-wrapper", + "wasm-bindgen", + "wasm-bindgen-futures", +] + +[[package]] +name = "libp2p-websocket" +version = "0.36.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9808e57e81be76ff841c106b4c5974fb4d41a233a7bdd2afbf1687ac6def3818" +dependencies = [ + "either", + "futures", + "futures-rustls", + "libp2p-core", + "log", + "parking_lot 0.12.1", + "quicksink", + "rw-stream-sink", + "soketto", + "url", + "webpki-roots", +] + +[[package]] +name = "libp2p-yamux" +version = "0.38.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6dea686217a06072033dc025631932810e2f6ad784e4fafa42e27d311c7a81c" +dependencies = [ + "futures", + "libp2p-core", + "parking_lot 0.12.1", + "thiserror", + "yamux", +] + +[[package]] +name = "librocksdb-sys" +version = "0.6.1+6.28.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81bc587013734dadb7cf23468e531aa120788b87243648be42e2d3a072186291" +dependencies = [ + "bindgen", + "bzip2-sys", + "cc", + "glob", + "libc", + "libz-sys", + "tikv-jemalloc-sys", +] + +[[package]] +name = "libsecp256k1" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95b09eff1b35ed3b33b877ced3a691fc7a481919c7e29c53c906226fcf55e2a1" +dependencies = [ + "arrayref", + "base64", + "digest 0.9.0", + "hmac-drbg", + "libsecp256k1-core", + "libsecp256k1-gen-ecmult", + "libsecp256k1-gen-genmult", + "rand 0.8.5", + "serde", + "sha2 0.9.9", + "typenum", +] + +[[package]] +name = "libsecp256k1-core" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5be9b9bb642d8522a44d533eab56c16c738301965504753b03ad1de3425d5451" +dependencies = [ + "crunchy", + "digest 0.9.0", + "subtle", +] + +[[package]] +name = "libsecp256k1-gen-ecmult" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3038c808c55c87e8a172643a7d87187fc6c4174468159cb3090659d55bcb4809" +dependencies = [ + "libsecp256k1-core", +] + +[[package]] +name = "libsecp256k1-gen-genmult" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3db8d6ba2cec9eacc40e6e8ccc98931840301f1006e95647ceb2dd5c3aa06f7c" +dependencies = [ + "libsecp256k1-core", +] + +[[package]] +name = "libz-sys" +version = "1.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9702761c3935f8cc2f101793272e202c72b99da8f4224a19ddcf1279a6450bbf" +dependencies = [ + "cc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "link-cplusplus" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9272ab7b96c9046fbc5bc56c06c117cb639fe2d509df0c421cad82d2915cf369" +dependencies = [ + "cc", +] + +[[package]] +name = "linked-hash-map" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" + +[[package]] +name = "linked_hash_set" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47186c6da4d81ca383c7c47c1bfc80f4b95f4720514d860a5407aaf4233f9588" +dependencies = [ + "linked-hash-map", +] + +[[package]] +name = "linregress" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6c601a85f5ecd1aba625247bca0031585fb1c446461b142878a16f8245ddeb8" +dependencies = [ + "nalgebra", + "statrs", +] + +[[package]] +name = "linux-raw-sys" +version = "0.0.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4d2456c373231a208ad294c33dc5bff30051eafd954cd4caae83a712b12854d" + +[[package]] +name = "lock_api" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df" +dependencies = [ + "autocfg", + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" +dependencies = [ + "cfg-if 1.0.0", + "value-bag", +] + +[[package]] +name = "lru" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e999beba7b6e8345721bd280141ed958096a2e4abdf74f67ff4ce49b4b54e47a" +dependencies = [ + "hashbrown", +] + +[[package]] +name = "lru" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6e8aaa3f231bb4bd57b84b2d5dc3ae7f350265df8aa96492e0bc394a1571909" +dependencies = [ + "hashbrown", +] + +[[package]] +name = "lru-cache" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31e24f1ad8321ca0e8a1e0ac13f23cb668e6f5466c2c57319f6a5cf1cc8e3b1c" +dependencies = [ + "linked-hash-map", +] + +[[package]] +name = "lz4" +version = "1.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e9e2dd86df36ce760a60f6ff6ad526f7ba1f14ba0356f8254fb6905e6494df1" +dependencies = [ + "libc", + "lz4-sys", +] + +[[package]] +name = "lz4-sys" +version = "1.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57d27b317e207b10f69f5e75494119e391a96f48861ae870d1da6edac98ca900" +dependencies = [ + "cc", + "libc", +] + +[[package]] +name = "mach" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b823e83b2affd8f40a9ee8c29dbc56404c1e34cd2710921f2801e2cf29527afa" +dependencies = [ + "libc", +] + +[[package]] +name = "match_cfg" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffbee8634e0d45d258acb448e7eaab3fce7a0a467395d4d9f228e3c1f01fb2e4" + +[[package]] +name = "matchers" +version = "0.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f099785f7595cc4b4553a174ce30dd7589ef93391ff414dbb67f62392b9e0ce1" +dependencies = [ + "regex-automata", +] + +[[package]] +name = "matches" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" + +[[package]] +name = "matrixmultiply" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "add85d4dd35074e6fedc608f8c8f513a3548619a9024b751949ef0e8e45a4d84" +dependencies = [ + "rawpointer", +] + +[[package]] +name = "memchr" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" + +[[package]] +name = "memfd" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "480b5a5de855d11ff13195950bdc8b98b5e942ef47afc447f6615cdcc4e15d80" +dependencies = [ + "rustix", +] + +[[package]] +name = "memmap2" +version = "0.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95af15f345b17af2efc8ead6080fb8bc376f8cec1b35277b935637595fe77498" +dependencies = [ + "libc", +] + +[[package]] +name = "memoffset" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" +dependencies = [ + "autocfg", +] + +[[package]] +name = "memory-db" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6566c70c1016f525ced45d7b7f97730a2bafb037c788211d0c186ef5b2189f0a" +dependencies = [ + "hash-db", + "hashbrown", + "parity-util-mem", +] + +[[package]] +name = "memory-lru" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce95ae042940bad7e312857b929ee3d11b8f799a80cb7b9c7ec5125516906395" +dependencies = [ + "lru 0.8.1", +] + +[[package]] +name = "memory_units" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" + +[[package]] +name = "merlin" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e261cf0f8b3c42ded9f7d2bb59dea03aa52bc8a1cbc7482f9fc3fd1229d3b42" +dependencies = [ + "byteorder", + "keccak", + "rand_core 0.5.1", + "zeroize", +] + +[[package]] +name = "mick-jaeger" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69672161530e8aeca1d1400fbf3f1a1747ff60ea604265a4e906c2442df20532" +dependencies = [ + "futures", + "rand 0.8.5", + "thrift", +] + +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + +[[package]] +name = "miniz_oxide" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96590ba8f175222643a85693f33d26e9c8a015f599c216509b1a6894af675d34" +dependencies = [ + "adler", +] + +[[package]] +name = "mio" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5d732bc30207a6423068df043e3d02e0735b155ad7ce1a6f76fe2baa5b158de" +dependencies = [ + "libc", + "log", + "wasi 0.11.0+wasi-snapshot-preview1", + "windows-sys 0.42.0", +] + +[[package]] +name = "multiaddr" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c580bfdd8803cce319b047d239559a22f809094aaea4ac13902a1fdcfcd4261" +dependencies = [ + "arrayref", + "bs58", + "byteorder", + "data-encoding", + "multihash", + "percent-encoding", + "serde", + "static_assertions", + "unsigned-varint", + "url", +] + +[[package]] +name = "multibase" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b3539ec3c1f04ac9748a260728e855f261b4977f5c3406612c884564f329404" +dependencies = [ + "base-x", + "data-encoding", + "data-encoding-macro", +] + +[[package]] +name = "multihash" +version = "0.16.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c346cf9999c631f002d8f977c4eaeaa0e6386f16007202308d0b3757522c2cc" +dependencies = [ + "blake2b_simd", + "blake2s_simd", + "blake3", + "core2", + "digest 0.10.5", + "multihash-derive", + "sha2 0.10.6", + "sha3", + "unsigned-varint", +] + +[[package]] +name = "multihash-derive" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc076939022111618a5026d3be019fd8b366e76314538ff9a1b59ffbcbf98bcd" +dependencies = [ + "proc-macro-crate", + "proc-macro-error", + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "multimap" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a" + +[[package]] +name = "multistream-select" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "363a84be6453a70e63513660f4894ef815daf88e3356bffcda9ca27d810ce83b" +dependencies = [ + "bytes", + "futures", + "log", + "pin-project", + "smallvec", + "unsigned-varint", +] + +[[package]] +name = "nalgebra" +version = "0.27.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "462fffe4002f4f2e1f6a9dcf12cc1a6fc0e15989014efc02a941d3e0f5dc2120" +dependencies = [ + "approx", + "matrixmultiply", + "nalgebra-macros", + "num-complex", + "num-rational 0.4.1", + "num-traits", + "rand 0.8.5", + "rand_distr", + "simba", + "typenum", +] + +[[package]] +name = "nalgebra-macros" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01fcc0b8149b4632adc89ac3b7b31a12fb6099a0317a4eb2ebff574ef7de7218" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "names" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7d66043b25d4a6cccb23619d10c19c25304b355a7dccd4a8e11423dd2382146" +dependencies = [ + "rand 0.8.5", +] + +[[package]] +name = "nanorand" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a51313c5820b0b02bd422f4b44776fbf47961755c74ce64afc73bfad10226c3" + +[[package]] +name = "netlink-packet-core" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "345b8ab5bd4e71a2986663e88c56856699d060e78e152e6e9d7966fcd5491297" +dependencies = [ + "anyhow", + "byteorder", + "libc", + "netlink-packet-utils", +] + +[[package]] +name = "netlink-packet-route" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9ea4302b9759a7a88242299225ea3688e63c85ea136371bb6cf94fd674efaab" +dependencies = [ + "anyhow", + "bitflags", + "byteorder", + "libc", + "netlink-packet-core", + "netlink-packet-utils", +] + +[[package]] +name = "netlink-packet-utils" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25af9cf0dc55498b7bd94a1508af7a78706aa0ab715a73c5169273e03c84845e" +dependencies = [ + "anyhow", + "byteorder", + "paste", + "thiserror", +] + +[[package]] +name = "netlink-proto" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65b4b14489ab424703c092062176d52ba55485a89c076b4f9db05092b7223aa6" +dependencies = [ + "bytes", + "futures", + "log", + "netlink-packet-core", + "netlink-sys", + "thiserror", + "tokio", +] + +[[package]] +name = "netlink-sys" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92b654097027250401127914afb37cb1f311df6610a9891ff07a757e94199027" +dependencies = [ + "async-io", + "bytes", + "futures", + "libc", + "log", +] + +[[package]] +name = "nix" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "195cdbc1741b8134346d515b3a56a1c94b0912758009cfd53f99ea0f57b065fc" +dependencies = [ + "bitflags", + "cfg-if 1.0.0", + "libc", +] + +[[package]] +name = "nodrop" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" + +[[package]] +name = "nohash-hasher" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451" + +[[package]] +name = "nom" +version = "7.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8903e5a29a317527874d0402f867152a3d21c908bb0b933e416c65e301d4c36" +dependencies = [ + "memchr", + "minimal-lexical", +] + +[[package]] +name = "num-bigint" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "090c7f9998ee0ff65aa5b723e4009f7b217707f1fb5ea551329cc4d6231fb304" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-bigint" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f93ab6289c7b344a8a9f60f88d80aa20032336fe78da341afc91c8a2341fc75f" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-complex" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ae39348c8bc5fbd7f40c727a9925f03517afd2ab27d46702108b6a7e5414c19" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-format" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54b862ff8df690cf089058c98b183676a7ed0f974cc08b426800093227cbff3b" +dependencies = [ + "arrayvec 0.7.2", + "itoa", +] + +[[package]] +name = "num-integer" +version = "0.1.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" +dependencies = [ + "autocfg", + "num-traits", +] + +[[package]] +name = "num-rational" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c000134b5dbf44adc5cb772486d335293351644b801551abe8f75c84cfa4aef" +dependencies = [ + "autocfg", + "num-bigint 0.2.6", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-rational" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" +dependencies = [ + "autocfg", + "num-bigint 0.4.3", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" +dependencies = [ + "autocfg", + "libm", +] + +[[package]] +name = "num_cpus" +version = "1.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6058e64324c71e02bc2b150e4f3bc8286db6c83092132ffa3f6b1eab0f9def5" +dependencies = [ + "hermit-abi", + "libc", +] + +[[package]] +name = "object" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21158b2c33aa6d4561f1c0a6ea283ca92bc54802a93b263e910746d679a7eb53" +dependencies = [ + "crc32fast", + "hashbrown", + "indexmap", + "memchr", +] + +[[package]] +name = "once_cell" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860" + +[[package]] +name = "opaque-debug" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" + +[[package]] +name = "opaque-debug" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" + +[[package]] +name = "openssl-probe" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" + +[[package]] +name = "orchestra" +version = "0.0.1" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +dependencies = [ + "async-trait", + "dyn-clonable", + "futures", + "futures-timer", + "orchestra-proc-macro", + "pin-project", + "prioritized-metered-channel", + "thiserror", + "tracing", +] + +[[package]] +name = "orchestra-proc-macro" +version = "0.0.1" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +dependencies = [ + "expander 0.0.6", + "itertools", + "petgraph", + "proc-macro-crate", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "ordered-float" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3305af35278dd29f46fcdd139e0b1fbfae2153f0e5928b39b035542dd31e37b7" +dependencies = [ + "num-traits", +] + +[[package]] +name = "os_str_bytes" +version = "6.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3baf96e39c5359d2eb0dd6ccb42c62b91d9678aa68160d261b9e0ccbf9e9dea9" + +[[package]] +name = "owning_ref" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ff55baddef9e4ad00f88b6c743a2a8062d4c6ade126c2a528644b8e444d52ce" +dependencies = [ + "stable_deref_trait", +] + +[[package]] +name = "pallet-aura" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "frame-support", + "frame-system", + "pallet-timestamp", + "parity-scale-codec", + "scale-info", + "sp-application-crypto", + "sp-consensus-aura", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "pallet-authority-discovery" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "frame-support", + "frame-system", + "pallet-session", + "parity-scale-codec", + "scale-info", + "sp-application-crypto", + "sp-authority-discovery", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "pallet-authorship" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "frame-support", + "frame-system", + "impl-trait-for-tuples", + "parity-scale-codec", + "scale-info", + "sp-authorship", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "pallet-babe" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "pallet-authorship", + "pallet-session", + "pallet-timestamp", + "parity-scale-codec", + "scale-info", + "sp-application-crypto", + "sp-consensus-babe", + "sp-consensus-vrf", + "sp-io", + "sp-runtime", + "sp-session", + "sp-staking", + "sp-std", +] + +[[package]] +name = "pallet-bags-list" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "frame-benchmarking", + "frame-election-provider-support", + "frame-support", + "frame-system", + "log", + "pallet-balances", + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", + "sp-tracing", +] + +[[package]] +name = "pallet-balances" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "parity-scale-codec", + "scale-info", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "pallet-beefy" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "beefy-primitives", + "frame-support", + "frame-system", + "pallet-session", + "parity-scale-codec", + "scale-info", + "serde", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "pallet-beefy-mmr" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "array-bytes", + "beefy-merkle-tree", + "beefy-primitives", + "frame-support", + "frame-system", + "log", + "pallet-beefy", + "pallet-mmr", + "pallet-session", + "parity-scale-codec", + "scale-info", + "serde", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "pallet-bounties" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "pallet-treasury", + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "pallet-child-bounties" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "pallet-bounties", + "pallet-treasury", + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "pallet-collator-selection" +version = "3.0.0" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.30#7b1fc0ed107fe42bb7e6a5dfefb586f4c3ae4328" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "pallet-authorship", + "pallet-session", + "parity-scale-codec", + "rand 0.8.5", + "scale-info", + "serde", + "sp-runtime", + "sp-staking", + "sp-std", +] + +[[package]] +name = "pallet-collective" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "pallet-democracy" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "parity-scale-codec", + "scale-info", + "serde", + "sp-io", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "pallet-election-provider-multi-phase" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "frame-benchmarking", + "frame-election-provider-support", + "frame-support", + "frame-system", + "log", + "pallet-election-provider-support-benchmarking", + "parity-scale-codec", + "rand 0.7.3", + "scale-info", + "sp-arithmetic", + "sp-core", + "sp-io", + "sp-npos-elections", + "sp-runtime", + "sp-std", + "static_assertions", + "strum", +] + +[[package]] +name = "pallet-election-provider-support-benchmarking" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "frame-benchmarking", + "frame-election-provider-support", + "frame-system", + "parity-scale-codec", + "sp-npos-elections", + "sp-runtime", +] + +[[package]] +name = "pallet-elections-phragmen" +version = "5.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-io", + "sp-npos-elections", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "pallet-fast-unstake" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "frame-benchmarking", + "frame-election-provider-support", + "frame-support", + "frame-system", + "log", + "pallet-balances", + "pallet-staking", + "pallet-timestamp", + "parity-scale-codec", + "scale-info", + "sp-io", + "sp-runtime", + "sp-staking", + "sp-std", +] + +[[package]] +name = "pallet-gilt" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "parity-scale-codec", + "scale-info", + "sp-arithmetic", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "pallet-grandpa" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "pallet-authorship", + "pallet-session", + "parity-scale-codec", + "scale-info", + "sp-application-crypto", + "sp-core", + "sp-finality-grandpa", + "sp-io", + "sp-runtime", + "sp-session", + "sp-staking", + "sp-std", +] + +[[package]] +name = "pallet-identity" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "enumflags2", + "frame-benchmarking", + "frame-support", + "frame-system", + "parity-scale-codec", + "scale-info", + "sp-io", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "pallet-im-online" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "pallet-authorship", + "parity-scale-codec", + "scale-info", + "sp-application-crypto", + "sp-core", + "sp-io", + "sp-runtime", + "sp-staking", + "sp-std", +] + +[[package]] +name = "pallet-indices" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-io", + "sp-keyring", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "pallet-membership" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "pallet-mmr" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "ckb-merkle-mountain-range", + "frame-benchmarking", + "frame-support", + "frame-system", + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-io", + "sp-mmr-primitives", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "pallet-mmr-rpc" +version = "3.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "jsonrpsee", + "parity-scale-codec", + "serde", + "sp-api", + "sp-blockchain", + "sp-core", + "sp-mmr-primitives", + "sp-runtime", +] + +[[package]] +name = "pallet-multisig" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "parity-scale-codec", + "scale-info", + "sp-io", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "pallet-nomination-pools" +version = "1.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "frame-support", + "frame-system", + "log", + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-io", + "sp-runtime", + "sp-staking", + "sp-std", +] + +[[package]] +name = "pallet-nomination-pools-benchmarking" +version = "1.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "frame-benchmarking", + "frame-election-provider-support", + "frame-support", + "frame-system", + "pallet-bags-list", + "pallet-nomination-pools", + "pallet-staking", + "parity-scale-codec", + "scale-info", + "sp-runtime", + "sp-runtime-interface", + "sp-staking", + "sp-std", +] + +[[package]] +name = "pallet-nomination-pools-runtime-api" +version = "1.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "parity-scale-codec", + "sp-api", + "sp-std", +] + +[[package]] +name = "pallet-offences" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "frame-support", + "frame-system", + "log", + "pallet-balances", + "parity-scale-codec", + "scale-info", + "serde", + "sp-runtime", + "sp-staking", + "sp-std", +] + +[[package]] +name = "pallet-offences-benchmarking" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "frame-benchmarking", + "frame-election-provider-support", + "frame-support", + "frame-system", + "pallet-babe", + "pallet-balances", + "pallet-grandpa", + "pallet-im-online", + "pallet-offences", + "pallet-session", + "pallet-staking", + "parity-scale-codec", + "scale-info", + "sp-runtime", + "sp-staking", + "sp-std", +] + +[[package]] +name = "pallet-preimage" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "pallet-proxy" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "parity-scale-codec", + "scale-info", + "sp-io", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "pallet-recovery" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "parity-scale-codec", + "scale-info", + "sp-io", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "pallet-scheduler" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "parity-scale-codec", + "scale-info", + "sp-io", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "pallet-session" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "frame-support", + "frame-system", + "impl-trait-for-tuples", + "log", + "pallet-timestamp", + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-io", + "sp-runtime", + "sp-session", + "sp-staking", + "sp-std", + "sp-trie", +] + +[[package]] +name = "pallet-session-benchmarking" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "pallet-session", + "pallet-staking", + "rand 0.7.3", + "sp-runtime", + "sp-session", + "sp-std", +] + +[[package]] +name = "pallet-society" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "frame-support", + "frame-system", + "parity-scale-codec", + "rand_chacha 0.2.2", + "scale-info", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "pallet-staking" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "frame-benchmarking", + "frame-election-provider-support", + "frame-support", + "frame-system", + "log", + "pallet-authorship", + "pallet-session", + "parity-scale-codec", + "rand_chacha 0.2.2", + "scale-info", + "serde", + "sp-application-crypto", + "sp-io", + "sp-runtime", + "sp-staking", + "sp-std", +] + +[[package]] +name = "pallet-staking-reward-curve" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "pallet-staking-reward-fn" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "log", + "sp-arithmetic", +] + +[[package]] +name = "pallet-sudo" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "frame-support", + "frame-system", + "parity-scale-codec", + "scale-info", + "sp-io", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "pallet-timestamp" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "parity-scale-codec", + "scale-info", + "sp-inherents", + "sp-io", + "sp-runtime", + "sp-std", + "sp-timestamp", +] + +[[package]] +name = "pallet-tips" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "pallet-treasury", + "parity-scale-codec", + "scale-info", + "serde", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "pallet-transaction-payment" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "frame-support", + "frame-system", + "parity-scale-codec", + "scale-info", + "serde", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "pallet-transaction-payment-rpc" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "jsonrpsee", + "pallet-transaction-payment-rpc-runtime-api", + "parity-scale-codec", + "sp-api", + "sp-blockchain", + "sp-core", + "sp-rpc", + "sp-runtime", +] + +[[package]] +name = "pallet-transaction-payment-rpc-runtime-api" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "pallet-transaction-payment", + "parity-scale-codec", + "sp-api", + "sp-runtime", +] + +[[package]] +name = "pallet-treasury" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "impl-trait-for-tuples", + "pallet-balances", + "parity-scale-codec", + "scale-info", + "serde", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "pallet-utility" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "pallet-vesting" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "parity-scale-codec", + "scale-info", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "pallet-xcm" +version = "0.9.30" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +dependencies = [ + "frame-support", + "frame-system", + "log", + "parity-scale-codec", + "scale-info", + "serde", + "sp-core", + "sp-runtime", + "sp-std", + "xcm", + "xcm-executor", +] + +[[package]] +name = "pallet-xcm-benchmarks" +version = "0.9.30" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "parity-scale-codec", + "scale-info", + "sp-runtime", + "sp-std", + "xcm", + "xcm-executor", +] + +[[package]] +name = "parachain-info" +version = "0.1.0" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.30#7b1fc0ed107fe42bb7e6a5dfefb586f4c3ae4328" +dependencies = [ + "cumulus-primitives-core", + "frame-support", + "frame-system", + "parity-scale-codec", + "scale-info", + "serde", +] + +[[package]] +name = "parity-db" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c8fdb726a43661fa54b43e7114e6b88b2289cae388eb3ad766d9d1754d83fce" +dependencies = [ + "blake2-rfc", + "crc32fast", + "fs2", + "hex", + "libc", + "log", + "lz4", + "memmap2", + "parking_lot 0.12.1", + "rand 0.8.5", + "snap", +] + +[[package]] +name = "parity-scale-codec" +version = "3.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "366e44391a8af4cfd6002ef6ba072bae071a96aafca98d7d448a34c5dca38b6a" +dependencies = [ + "arrayvec 0.7.2", + "bitvec", + "byte-slice-cast", + "bytes", + "impl-trait-for-tuples", + "parity-scale-codec-derive", + "serde", +] + +[[package]] +name = "parity-scale-codec-derive" +version = "3.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9299338969a3d2f491d65f140b00ddec470858402f888af98e8642fb5e8965cd" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "parity-send-wrapper" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa9777aa91b8ad9dd5aaa04a9b6bcb02c7f1deb952fca5a66034d5e63afc5c6f" + +[[package]] +name = "parity-util-mem" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c32561d248d352148124f036cac253a644685a21dc9fea383eb4907d7bd35a8f" +dependencies = [ + "cfg-if 1.0.0", + "hashbrown", + "impl-trait-for-tuples", + "parity-util-mem-derive", + "parking_lot 0.12.1", + "primitive-types", + "smallvec", + "winapi", +] + +[[package]] +name = "parity-util-mem-derive" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f557c32c6d268a07c921471619c0295f5efad3a0e76d4f97a05c091a51d110b2" +dependencies = [ + "proc-macro2", + "syn", + "synstructure", +] + +[[package]] +name = "parity-wasm" +version = "0.32.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16ad52817c4d343339b3bc2e26861bd21478eda0b7509acf83505727000512ac" +dependencies = [ + "byteorder", +] + +[[package]] +name = "parity-wasm" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1ad0aff30c1da14b1254fcb2af73e1fa9a28670e584a626f53a369d0e157304" + +[[package]] +name = "parking" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "427c3892f9e783d91cc128285287e70a59e206ca452770ece88a76f7a3eddd72" + +[[package]] +name = "parking_lot" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" +dependencies = [ + "instant", + "lock_api", + "parking_lot_core 0.8.5", +] + +[[package]] +name = "parking_lot" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +dependencies = [ + "lock_api", + "parking_lot_core 0.9.4", +] + +[[package]] +name = "parking_lot_core" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216" +dependencies = [ + "cfg-if 1.0.0", + "instant", + "libc", + "redox_syscall", + "smallvec", + "winapi", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4dc9e0dc2adc1c69d09143aff38d3d30c5c3f0df0dad82e6d25547af174ebec0" +dependencies = [ + "cfg-if 1.0.0", + "libc", + "redox_syscall", + "smallvec", + "windows-sys 0.42.0", +] + +[[package]] +name = "paste" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1de2e551fb905ac83f73f7aedf2f0cb4a0da7e35efa24a202a936269f1f18e1" + +[[package]] +name = "pbkdf2" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "216eaa586a190f0a738f2f918511eecfa90f13295abec0e457cdebcceda80cbd" +dependencies = [ + "crypto-mac 0.8.0", +] + +[[package]] +name = "pbkdf2" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d95f5254224e617595d2cc3cc73ff0a5eaf2637519e25f03388154e9378b6ffa" +dependencies = [ + "crypto-mac 0.11.1", +] + +[[package]] +name = "peeking_take_while" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" + +[[package]] +name = "percent-encoding" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" + +[[package]] +name = "pest" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a528564cc62c19a7acac4d81e01f39e53e25e17b934878f4c6d25cc2836e62f8" +dependencies = [ + "thiserror", + "ucd-trie", +] + +[[package]] +name = "pest_derive" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5fd9bc6500181952d34bd0b2b0163a54d794227b498be0b7afa7698d0a7b18f" +dependencies = [ + "pest", + "pest_generator", +] + +[[package]] +name = "pest_generator" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2610d5ac5156217b4ff8e46ddcef7cdf44b273da2ac5bca2ecbfa86a330e7c4" +dependencies = [ + "pest", + "pest_meta", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "pest_meta" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "824749bf7e21dd66b36fbe26b3f45c713879cccd4a009a917ab8e045ca8246fe" +dependencies = [ + "once_cell", + "pest", + "sha1", +] + +[[package]] +name = "petgraph" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6d5014253a1331579ce62aa67443b4a658c5e7dd03d4bc6d302b94474888143" +dependencies = [ + "fixedbitset", + "indexmap", +] + +[[package]] +name = "pin-project" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad29a609b6bcd67fee905812e544992d216af9d755757c05ed2d0e15a74c6ecc" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "069bdb1e05adc7a8990dce9cc75370895fbe4e3d58b9b73bf1aee56359344a55" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "pin-project-lite" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "257b64915a082f7811703966789728173279bdebb956b143dbcd23f6f970a777" + +[[package]] +name = "pin-project-lite" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "pkcs8" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7cabda3fb821068a9a4fab19a683eac3af12edf0f34b94a8be53c4972b8149d0" +dependencies = [ + "der", + "spki", + "zeroize", +] + +[[package]] +name = "pkg-config" +version = "0.3.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160" + +[[package]] +name = "platforms" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8d0eef3571242013a0d5dc84861c3ae4a652e56e12adf8bdc26ff5f8cb34c94" + +[[package]] +name = "polkadot-approval-distribution" +version = "0.9.30" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +dependencies = [ + "futures", + "polkadot-node-network-protocol", + "polkadot-node-primitives", + "polkadot-node-subsystem", + "polkadot-node-subsystem-util", + "polkadot-primitives", + "rand 0.8.5", + "tracing-gum", +] + +[[package]] +name = "polkadot-availability-bitfield-distribution" +version = "0.9.30" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +dependencies = [ + "futures", + "polkadot-node-network-protocol", + "polkadot-node-subsystem", + "polkadot-node-subsystem-util", + "polkadot-primitives", + "rand 0.8.5", + "tracing-gum", +] + +[[package]] +name = "polkadot-availability-distribution" +version = "0.9.30" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +dependencies = [ + "derive_more", + "fatality", + "futures", + "lru 0.7.8", + "parity-scale-codec", + "polkadot-erasure-coding", + "polkadot-node-network-protocol", + "polkadot-node-primitives", + "polkadot-node-subsystem", + "polkadot-node-subsystem-util", + "polkadot-primitives", + "rand 0.8.5", + "sp-core", + "sp-keystore", + "thiserror", + "tracing-gum", +] + +[[package]] +name = "polkadot-availability-recovery" +version = "0.9.30" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +dependencies = [ + "fatality", + "futures", + "lru 0.7.8", + "parity-scale-codec", + "polkadot-erasure-coding", + "polkadot-node-network-protocol", + "polkadot-node-primitives", + "polkadot-node-subsystem", + "polkadot-node-subsystem-util", + "polkadot-primitives", + "rand 0.8.5", + "sc-network", + "thiserror", + "tracing-gum", +] + +[[package]] +name = "polkadot-cli" +version = "0.9.30" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +dependencies = [ + "clap", + "frame-benchmarking-cli", + "futures", + "log", + "polkadot-client", + "polkadot-node-core-pvf", + "polkadot-node-metrics", + "polkadot-performance-test", + "polkadot-service", + "sc-cli", + "sc-service", + "sc-sysinfo", + "sc-tracing", + "sp-core", + "sp-keyring", + "sp-trie", + "substrate-build-script-utils", + "thiserror", + "try-runtime-cli", +] + +[[package]] +name = "polkadot-client" +version = "0.9.30" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +dependencies = [ + "beefy-primitives", + "frame-benchmarking", + "frame-benchmarking-cli", + "frame-system", + "frame-system-rpc-runtime-api", + "kusama-runtime", + "pallet-transaction-payment", + "pallet-transaction-payment-rpc-runtime-api", + "polkadot-core-primitives", + "polkadot-node-core-parachains-inherent", + "polkadot-primitives", + "polkadot-runtime", + "polkadot-runtime-common", + "rococo-runtime", + "sc-client-api", + "sc-consensus", + "sc-executor", + "sc-service", + "sp-api", + "sp-authority-discovery", + "sp-block-builder", + "sp-blockchain", + "sp-consensus", + "sp-consensus-babe", + "sp-core", + "sp-finality-grandpa", + "sp-inherents", + "sp-keyring", + "sp-mmr-primitives", + "sp-offchain", + "sp-runtime", + "sp-session", + "sp-storage", + "sp-timestamp", + "sp-transaction-pool", +] + +[[package]] +name = "polkadot-collator-protocol" +version = "0.9.30" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +dependencies = [ + "always-assert", + "fatality", + "futures", + "futures-timer", + "polkadot-node-network-protocol", + "polkadot-node-primitives", + "polkadot-node-subsystem", + "polkadot-node-subsystem-util", + "polkadot-primitives", + "sp-core", + "sp-keystore", + "sp-runtime", + "thiserror", + "tracing-gum", +] + +[[package]] +name = "polkadot-core-primitives" +version = "0.9.30" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +dependencies = [ + "parity-scale-codec", + "parity-util-mem", + "scale-info", + "sp-core", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "polkadot-dispute-distribution" +version = "0.9.30" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +dependencies = [ + "derive_more", + "fatality", + "futures", + "lru 0.7.8", + "parity-scale-codec", + "polkadot-erasure-coding", + "polkadot-node-network-protocol", + "polkadot-node-primitives", + "polkadot-node-subsystem", + "polkadot-node-subsystem-util", + "polkadot-primitives", + "sc-network", + "sp-application-crypto", + "sp-keystore", + "thiserror", + "tracing-gum", +] + +[[package]] +name = "polkadot-erasure-coding" +version = "0.9.30" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +dependencies = [ + "parity-scale-codec", + "polkadot-node-primitives", + "polkadot-primitives", + "reed-solomon-novelpoly", + "sp-core", + "sp-trie", + "thiserror", +] + +[[package]] +name = "polkadot-gossip-support" +version = "0.9.30" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +dependencies = [ + "futures", + "futures-timer", + "polkadot-node-network-protocol", + "polkadot-node-subsystem", + "polkadot-node-subsystem-util", + "polkadot-primitives", + "rand 0.8.5", + "rand_chacha 0.3.1", + "sc-network", + "sp-application-crypto", + "sp-core", + "sp-keystore", + "tracing-gum", +] + +[[package]] +name = "polkadot-network-bridge" +version = "0.9.30" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +dependencies = [ + "always-assert", + "async-trait", + "bytes", + "fatality", + "futures", + "parity-scale-codec", + "parking_lot 0.12.1", + "polkadot-node-network-protocol", + "polkadot-node-subsystem", + "polkadot-node-subsystem-util", + "polkadot-overseer", + "polkadot-primitives", + "sc-network", + "sc-network-common", + "sp-consensus", + "thiserror", + "tracing-gum", +] + +[[package]] +name = "polkadot-node-collation-generation" +version = "0.9.30" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +dependencies = [ + "futures", + "parity-scale-codec", + "polkadot-erasure-coding", + "polkadot-node-primitives", + "polkadot-node-subsystem", + "polkadot-node-subsystem-util", + "polkadot-primitives", + "sp-core", + "sp-maybe-compressed-blob", + "thiserror", + "tracing-gum", +] + +[[package]] +name = "polkadot-node-core-approval-voting" +version = "0.9.30" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +dependencies = [ + "bitvec", + "derive_more", + "futures", + "futures-timer", + "kvdb", + "lru 0.7.8", + "merlin", + "parity-scale-codec", + "polkadot-node-jaeger", + "polkadot-node-primitives", + "polkadot-node-subsystem", + "polkadot-node-subsystem-util", + "polkadot-overseer", + "polkadot-primitives", + "sc-keystore", + "schnorrkel", + "sp-application-crypto", + "sp-consensus", + "sp-consensus-slots", + "sp-runtime", + "thiserror", + "tracing-gum", +] + +[[package]] +name = "polkadot-node-core-av-store" +version = "0.9.30" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +dependencies = [ + "bitvec", + "futures", + "futures-timer", + "kvdb", + "parity-scale-codec", + "polkadot-erasure-coding", + "polkadot-node-primitives", + "polkadot-node-subsystem", + "polkadot-node-subsystem-util", + "polkadot-overseer", + "polkadot-primitives", + "thiserror", + "tracing-gum", +] + +[[package]] +name = "polkadot-node-core-backing" +version = "0.9.30" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +dependencies = [ + "bitvec", + "fatality", + "futures", + "polkadot-erasure-coding", + "polkadot-node-primitives", + "polkadot-node-subsystem", + "polkadot-node-subsystem-util", + "polkadot-primitives", + "polkadot-statement-table", + "sp-keystore", + "thiserror", + "tracing-gum", +] + +[[package]] +name = "polkadot-node-core-bitfield-signing" +version = "0.9.30" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +dependencies = [ + "futures", + "polkadot-node-subsystem", + "polkadot-node-subsystem-util", + "polkadot-primitives", + "sp-keystore", + "thiserror", + "tracing-gum", + "wasm-timer", +] + +[[package]] +name = "polkadot-node-core-candidate-validation" +version = "0.9.30" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +dependencies = [ + "async-trait", + "futures", + "parity-scale-codec", + "polkadot-node-core-pvf", + "polkadot-node-primitives", + "polkadot-node-subsystem", + "polkadot-node-subsystem-util", + "polkadot-parachain", + "polkadot-primitives", + "sp-maybe-compressed-blob", + "tracing-gum", +] + +[[package]] +name = "polkadot-node-core-chain-api" +version = "0.9.30" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +dependencies = [ + "futures", + "polkadot-node-subsystem", + "polkadot-node-subsystem-util", + "polkadot-primitives", + "sc-client-api", + "sc-consensus-babe", + "sp-blockchain", + "tracing-gum", +] + +[[package]] +name = "polkadot-node-core-chain-selection" +version = "0.9.30" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +dependencies = [ + "futures", + "futures-timer", + "kvdb", + "parity-scale-codec", + "polkadot-node-primitives", + "polkadot-node-subsystem", + "polkadot-node-subsystem-util", + "polkadot-primitives", + "thiserror", + "tracing-gum", +] + +[[package]] +name = "polkadot-node-core-dispute-coordinator" +version = "0.9.30" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +dependencies = [ + "fatality", + "futures", + "kvdb", + "lru 0.7.8", + "parity-scale-codec", + "polkadot-node-primitives", + "polkadot-node-subsystem", + "polkadot-node-subsystem-util", + "polkadot-primitives", + "sc-keystore", + "thiserror", + "tracing-gum", +] + +[[package]] +name = "polkadot-node-core-parachains-inherent" +version = "0.9.30" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +dependencies = [ + "async-trait", + "futures", + "futures-timer", + "polkadot-node-subsystem", + "polkadot-primitives", + "sp-blockchain", + "sp-inherents", + "sp-runtime", + "thiserror", + "tracing-gum", +] + +[[package]] +name = "polkadot-node-core-provisioner" +version = "0.9.30" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +dependencies = [ + "bitvec", + "fatality", + "futures", + "futures-timer", + "polkadot-node-primitives", + "polkadot-node-subsystem", + "polkadot-node-subsystem-util", + "polkadot-primitives", + "rand 0.8.5", + "thiserror", + "tracing-gum", +] + +[[package]] +name = "polkadot-node-core-pvf" +version = "0.9.30" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +dependencies = [ + "always-assert", + "assert_matches", + "async-process", + "async-std", + "futures", + "futures-timer", + "parity-scale-codec", + "pin-project", + "polkadot-core-primitives", + "polkadot-node-metrics", + "polkadot-parachain", + "rand 0.8.5", + "rayon", + "sc-executor", + "sc-executor-common", + "sc-executor-wasmtime", + "slotmap", + "sp-core", + "sp-externalities", + "sp-io", + "sp-maybe-compressed-blob", + "sp-tracing", + "sp-wasm-interface", + "tempfile", + "tracing-gum", +] + +[[package]] +name = "polkadot-node-core-pvf-checker" +version = "0.9.30" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +dependencies = [ + "futures", + "polkadot-node-primitives", + "polkadot-node-subsystem", + "polkadot-node-subsystem-util", + "polkadot-overseer", + "polkadot-primitives", + "sp-keystore", + "thiserror", + "tracing-gum", +] + +[[package]] +name = "polkadot-node-core-runtime-api" +version = "0.9.30" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +dependencies = [ + "futures", + "memory-lru", + "parity-util-mem", + "polkadot-node-subsystem", + "polkadot-node-subsystem-types", + "polkadot-node-subsystem-util", + "polkadot-primitives", + "sp-consensus-babe", + "tracing-gum", +] + +[[package]] +name = "polkadot-node-jaeger" +version = "0.9.30" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +dependencies = [ + "async-std", + "lazy_static", + "log", + "mick-jaeger", + "parity-scale-codec", + "parking_lot 0.12.1", + "polkadot-node-primitives", + "polkadot-primitives", + "sc-network", + "sp-core", + "thiserror", +] + +[[package]] +name = "polkadot-node-metrics" +version = "0.9.30" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +dependencies = [ + "bs58", + "futures", + "futures-timer", + "log", + "parity-scale-codec", + "polkadot-primitives", + "prioritized-metered-channel", + "sc-cli", + "sc-service", + "sc-tracing", + "substrate-prometheus-endpoint", + "tracing-gum", +] + +[[package]] +name = "polkadot-node-network-protocol" +version = "0.9.30" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +dependencies = [ + "async-trait", + "derive_more", + "fatality", + "futures", + "hex", + "parity-scale-codec", + "polkadot-node-jaeger", + "polkadot-node-primitives", + "polkadot-primitives", + "rand 0.8.5", + "sc-authority-discovery", + "sc-network", + "sc-network-common", + "strum", + "thiserror", + "tracing-gum", +] + +[[package]] +name = "polkadot-node-primitives" +version = "0.9.30" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +dependencies = [ + "bounded-vec", + "futures", + "parity-scale-codec", + "polkadot-parachain", + "polkadot-primitives", + "schnorrkel", + "serde", + "sp-application-crypto", + "sp-consensus-babe", + "sp-consensus-vrf", + "sp-core", + "sp-keystore", + "sp-maybe-compressed-blob", + "thiserror", + "zstd", +] + +[[package]] +name = "polkadot-node-subsystem" +version = "0.9.30" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +dependencies = [ + "polkadot-node-jaeger", + "polkadot-node-subsystem-types", + "polkadot-overseer", +] + +[[package]] +name = "polkadot-node-subsystem-types" +version = "0.9.30" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +dependencies = [ + "async-trait", + "derive_more", + "futures", + "orchestra", + "polkadot-node-jaeger", + "polkadot-node-network-protocol", + "polkadot-node-primitives", + "polkadot-primitives", + "polkadot-statement-table", + "sc-network", + "smallvec", + "sp-api", + "sp-authority-discovery", + "sp-consensus-babe", + "substrate-prometheus-endpoint", + "thiserror", +] + +[[package]] +name = "polkadot-node-subsystem-util" +version = "0.9.30" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +dependencies = [ + "async-trait", + "derive_more", + "fatality", + "futures", + "itertools", + "kvdb", + "lru 0.7.8", + "parity-db", + "parity-scale-codec", + "parity-util-mem", + "parking_lot 0.11.2", + "pin-project", + "polkadot-node-jaeger", + "polkadot-node-metrics", + "polkadot-node-network-protocol", + "polkadot-node-primitives", + "polkadot-node-subsystem", + "polkadot-overseer", + "polkadot-primitives", + "prioritized-metered-channel", + "rand 0.8.5", + "sp-application-crypto", + "sp-core", + "sp-keystore", + "thiserror", + "tracing-gum", +] + +[[package]] +name = "polkadot-overseer" +version = "0.9.30" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +dependencies = [ + "async-trait", + "futures", + "futures-timer", + "lru 0.7.8", + "orchestra", + "parity-util-mem", + "parking_lot 0.12.1", + "polkadot-node-metrics", + "polkadot-node-network-protocol", + "polkadot-node-primitives", + "polkadot-node-subsystem-types", + "polkadot-primitives", + "sc-client-api", + "sp-api", + "sp-core", + "tracing-gum", +] + +[[package]] +name = "polkadot-parachain" +version = "0.9.30" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +dependencies = [ + "derive_more", + "frame-support", + "parity-scale-codec", + "parity-util-mem", + "polkadot-core-primitives", + "scale-info", + "serde", + "sp-core", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "polkadot-performance-test" +version = "0.9.30" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +dependencies = [ + "env_logger", + "kusama-runtime", + "log", + "polkadot-erasure-coding", + "polkadot-node-core-pvf", + "polkadot-node-primitives", + "quote", + "thiserror", +] + +[[package]] +name = "polkadot-primitives" +version = "0.9.30" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +dependencies = [ + "bitvec", + "frame-system", + "hex-literal", + "parity-scale-codec", + "parity-util-mem", + "polkadot-core-primitives", + "polkadot-parachain", + "scale-info", + "serde", + "sp-api", + "sp-application-crypto", + "sp-arithmetic", + "sp-authority-discovery", + "sp-consensus-slots", + "sp-core", + "sp-inherents", + "sp-io", + "sp-keystore", + "sp-runtime", + "sp-staking", + "sp-std", + "sp-trie", + "sp-version", +] + +[[package]] +name = "polkadot-rpc" +version = "0.9.30" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +dependencies = [ + "beefy-gadget", + "beefy-gadget-rpc", + "jsonrpsee", + "pallet-mmr-rpc", + "pallet-transaction-payment-rpc", + "polkadot-primitives", + "sc-chain-spec", + "sc-client-api", + "sc-consensus-babe", + "sc-consensus-babe-rpc", + "sc-consensus-epochs", + "sc-finality-grandpa", + "sc-finality-grandpa-rpc", + "sc-rpc", + "sc-sync-state-rpc", + "sc-transaction-pool-api", + "sp-api", + "sp-block-builder", + "sp-blockchain", + "sp-consensus", + "sp-consensus-babe", + "sp-keystore", + "sp-runtime", + "substrate-frame-rpc-system", + "substrate-state-trie-migration-rpc", +] + +[[package]] +name = "polkadot-runtime" +version = "0.9.30" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +dependencies = [ + "beefy-primitives", + "bitvec", + "frame-benchmarking", + "frame-election-provider-support", + "frame-executive", + "frame-support", + "frame-system", + "frame-system-benchmarking", + "frame-system-rpc-runtime-api", + "frame-try-runtime", + "hex-literal", + "log", + "pallet-authority-discovery", + "pallet-authorship", + "pallet-babe", + "pallet-bags-list", + "pallet-balances", + "pallet-bounties", + "pallet-child-bounties", + "pallet-collective", + "pallet-democracy", + "pallet-election-provider-multi-phase", + "pallet-election-provider-support-benchmarking", + "pallet-elections-phragmen", + "pallet-fast-unstake", + "pallet-grandpa", + "pallet-identity", + "pallet-im-online", + "pallet-indices", + "pallet-membership", + "pallet-multisig", + "pallet-nomination-pools", + "pallet-nomination-pools-benchmarking", + "pallet-nomination-pools-runtime-api", + "pallet-offences", + "pallet-offences-benchmarking", + "pallet-preimage", + "pallet-proxy", + "pallet-scheduler", + "pallet-session", + "pallet-session-benchmarking", + "pallet-staking", + "pallet-staking-reward-curve", + "pallet-timestamp", + "pallet-tips", + "pallet-transaction-payment", + "pallet-transaction-payment-rpc-runtime-api", + "pallet-treasury", + "pallet-utility", + "pallet-vesting", + "pallet-xcm", + "parity-scale-codec", + "polkadot-primitives", + "polkadot-runtime-common", + "polkadot-runtime-constants", + "polkadot-runtime-parachains", + "rustc-hex", + "scale-info", + "serde", + "serde_derive", + "smallvec", + "sp-api", + "sp-authority-discovery", + "sp-block-builder", + "sp-consensus-babe", + "sp-core", + "sp-inherents", + "sp-io", + "sp-mmr-primitives", + "sp-npos-elections", + "sp-offchain", + "sp-runtime", + "sp-session", + "sp-staking", + "sp-std", + "sp-transaction-pool", + "sp-version", + "static_assertions", + "substrate-wasm-builder", + "xcm", + "xcm-builder", + "xcm-executor", +] + +[[package]] +name = "polkadot-runtime-common" +version = "0.9.30" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +dependencies = [ + "beefy-primitives", + "bitvec", + "frame-benchmarking", + "frame-election-provider-support", + "frame-support", + "frame-system", + "impl-trait-for-tuples", + "libsecp256k1", + "log", + "pallet-authorship", + "pallet-babe", + "pallet-bags-list", + "pallet-balances", + "pallet-beefy-mmr", + "pallet-election-provider-multi-phase", + "pallet-session", + "pallet-staking", + "pallet-timestamp", + "pallet-transaction-payment", + "pallet-treasury", + "pallet-vesting", + "parity-scale-codec", + "polkadot-primitives", + "polkadot-runtime-parachains", + "rustc-hex", + "scale-info", + "serde", + "serde_derive", + "slot-range-helper", + "sp-api", + "sp-core", + "sp-inherents", + "sp-io", + "sp-npos-elections", + "sp-runtime", + "sp-session", + "sp-staking", + "sp-std", + "static_assertions", + "xcm", +] + +[[package]] +name = "polkadot-runtime-constants" +version = "0.9.30" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +dependencies = [ + "frame-support", + "polkadot-primitives", + "polkadot-runtime-common", + "smallvec", + "sp-runtime", +] + +[[package]] +name = "polkadot-runtime-metrics" +version = "0.9.30" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +dependencies = [ + "bs58", + "parity-scale-codec", + "polkadot-primitives", + "sp-std", + "sp-tracing", +] + +[[package]] +name = "polkadot-runtime-parachains" +version = "0.9.30" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +dependencies = [ + "bitflags", + "bitvec", + "derive_more", + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "pallet-authority-discovery", + "pallet-authorship", + "pallet-babe", + "pallet-balances", + "pallet-session", + "pallet-staking", + "pallet-timestamp", + "pallet-vesting", + "parity-scale-codec", + "polkadot-primitives", + "polkadot-runtime-metrics", + "rand 0.8.5", + "rand_chacha 0.3.1", + "rustc-hex", + "scale-info", + "serde", + "sp-api", + "sp-application-crypto", + "sp-core", + "sp-inherents", + "sp-io", + "sp-keystore", + "sp-runtime", + "sp-session", + "sp-staking", + "sp-std", + "static_assertions", + "xcm", + "xcm-executor", +] + +[[package]] +name = "polkadot-service" +version = "0.9.30" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +dependencies = [ + "async-trait", + "beefy-gadget", + "beefy-primitives", + "frame-support", + "frame-system-rpc-runtime-api", + "futures", + "hex-literal", + "kusama-runtime", + "kusama-runtime-constants", + "kvdb", + "kvdb-rocksdb", + "lru 0.7.8", + "pallet-babe", + "pallet-im-online", + "pallet-staking", + "pallet-transaction-payment-rpc-runtime-api", + "parity-db", + "polkadot-approval-distribution", + "polkadot-availability-bitfield-distribution", + "polkadot-availability-distribution", + "polkadot-availability-recovery", + "polkadot-client", + "polkadot-collator-protocol", + "polkadot-dispute-distribution", + "polkadot-gossip-support", + "polkadot-network-bridge", + "polkadot-node-collation-generation", + "polkadot-node-core-approval-voting", + "polkadot-node-core-av-store", + "polkadot-node-core-backing", + "polkadot-node-core-bitfield-signing", + "polkadot-node-core-candidate-validation", + "polkadot-node-core-chain-api", + "polkadot-node-core-chain-selection", + "polkadot-node-core-dispute-coordinator", + "polkadot-node-core-parachains-inherent", + "polkadot-node-core-provisioner", + "polkadot-node-core-pvf-checker", + "polkadot-node-core-runtime-api", + "polkadot-node-network-protocol", + "polkadot-node-primitives", + "polkadot-node-subsystem", + "polkadot-node-subsystem-types", + "polkadot-node-subsystem-util", + "polkadot-overseer", + "polkadot-parachain", + "polkadot-primitives", + "polkadot-rpc", + "polkadot-runtime", + "polkadot-runtime-constants", + "polkadot-runtime-parachains", + "polkadot-statement-distribution", + "rococo-runtime", + "rococo-runtime-constants", + "sc-authority-discovery", + "sc-basic-authorship", + "sc-block-builder", + "sc-chain-spec", + "sc-client-api", + "sc-client-db", + "sc-consensus", + "sc-consensus-babe", + "sc-consensus-slots", + "sc-executor", + "sc-finality-grandpa", + "sc-keystore", + "sc-network", + "sc-network-common", + "sc-offchain", + "sc-service", + "sc-sync-state-rpc", + "sc-sysinfo", + "sc-telemetry", + "sc-transaction-pool", + "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-io", + "sp-keystore", + "sp-offchain", + "sp-runtime", + "sp-session", + "sp-state-machine", + "sp-storage", + "sp-timestamp", + "sp-transaction-pool", + "sp-trie", + "substrate-prometheus-endpoint", + "thiserror", + "tracing-gum", + "westend-runtime", +] + +[[package]] +name = "polkadot-statement-distribution" +version = "0.9.30" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +dependencies = [ + "arrayvec 0.5.2", + "fatality", + "futures", + "indexmap", + "parity-scale-codec", + "polkadot-node-network-protocol", + "polkadot-node-primitives", + "polkadot-node-subsystem", + "polkadot-node-subsystem-util", + "polkadot-primitives", + "sp-keystore", + "sp-staking", + "thiserror", + "tracing-gum", +] + +[[package]] +name = "polkadot-statement-table" +version = "0.9.30" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +dependencies = [ + "parity-scale-codec", + "polkadot-primitives", + "sp-core", +] + +[[package]] +name = "polling" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab4609a838d88b73d8238967b60dd115cc08d38e2bbaf51ee1e4b695f89122e2" +dependencies = [ + "autocfg", + "cfg-if 1.0.0", + "libc", + "log", + "wepoll-ffi", + "winapi", +] + +[[package]] +name = "poly1305" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "048aeb476be11a4b6ca432ca569e375810de9294ae78f4774e78ea98a9246ede" +dependencies = [ + "cpufeatures", + "opaque-debug 0.3.0", + "universal-hash", +] + +[[package]] +name = "polyval" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8419d2b623c7c0896ff2d5d96e2cb4ede590fed28fcc34934f4c33c036e620a1" +dependencies = [ + "cfg-if 1.0.0", + "cpufeatures", + "opaque-debug 0.3.0", + "universal-hash", +] + +[[package]] +name = "ppv-lite86" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" + +[[package]] +name = "prettyplease" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c142c0e46b57171fe0c528bee8c5b7569e80f0c17e377cd0e30ea57dbc11bb51" +dependencies = [ + "proc-macro2", + "syn", +] + +[[package]] +name = "primitive-types" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e28720988bff275df1f51b171e1b2a18c30d194c4d2b61defdacecd625a5d94a" +dependencies = [ + "fixed-hash", + "impl-codec", + "impl-serde", + "scale-info", + "uint", +] + +[[package]] +name = "prioritized-metered-channel" +version = "0.2.0" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +dependencies = [ + "coarsetime", + "crossbeam-queue", + "derive_more", + "futures", + "futures-timer", + "nanorand", + "thiserror", + "tracing", +] + +[[package]] +name = "proc-macro-crate" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eda0fc3b0fb7c975631757e14d9049da17374063edb6ebbcbc54d880d4fe94e9" +dependencies = [ + "once_cell", + "thiserror", + "toml", +] + +[[package]] +name = "proc-macro-error" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +dependencies = [ + "proc-macro-error-attr", + "proc-macro2", + "quote", + "syn", + "version_check", +] + +[[package]] +name = "proc-macro-error-attr" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +dependencies = [ + "proc-macro2", + "quote", + "version_check", +] + +[[package]] +name = "proc-macro2" +version = "1.0.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ea3d908b0e36316caf9e9e2c4625cdde190a7e6f440d794667ed17a1855e725" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "prometheus" +version = "0.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "449811d15fbdf5ceb5c1144416066429cf82316e2ec8ce0c1f6f8a02e7bbcf8c" +dependencies = [ + "cfg-if 1.0.0", + "fnv", + "lazy_static", + "memchr", + "parking_lot 0.12.1", + "thiserror", +] + +[[package]] +name = "prometheus-client" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac1abe0255c04d15f571427a2d1e00099016506cf3297b53853acd2b7eb87825" +dependencies = [ + "dtoa", + "itoa", + "owning_ref", + "prometheus-client-derive-text-encode", +] + +[[package]] +name = "prometheus-client-derive-text-encode" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8e12d01b9d66ad9eb4529c57666b6263fc1993cb30261d83ead658fdd932652" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "prost" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71adf41db68aa0daaefc69bb30bcd68ded9b9abaad5d1fbb6304c4fb390e083e" +dependencies = [ + "bytes", + "prost-derive 0.10.1", +] + +[[package]] +name = "prost" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0841812012b2d4a6145fae9a6af1534873c32aa67fff26bd09f8fa42c83f95a" +dependencies = [ + "bytes", + "prost-derive 0.11.2", +] + +[[package]] +name = "prost-build" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ae5a4388762d5815a9fc0dea33c56b021cdc8dde0c55e0c9ca57197254b0cab" +dependencies = [ + "bytes", + "cfg-if 1.0.0", + "cmake", + "heck", + "itertools", + "lazy_static", + "log", + "multimap", + "petgraph", + "prost 0.10.4", + "prost-types 0.10.1", + "regex", + "tempfile", + "which", +] + +[[package]] +name = "prost-build" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d8b442418ea0822409d9e7d047cbf1e7e9e1760b172bf9982cf29d517c93511" +dependencies = [ + "bytes", + "heck", + "itertools", + "lazy_static", + "log", + "multimap", + "petgraph", + "prettyplease", + "prost 0.11.2", + "prost-types 0.11.2", + "regex", + "syn", + "tempfile", + "which", +] + +[[package]] +name = "prost-codec" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00af1e92c33b4813cc79fda3f2dbf56af5169709be0202df730e9ebc3e4cd007" +dependencies = [ + "asynchronous-codec", + "bytes", + "prost 0.10.4", + "thiserror", + "unsigned-varint", +] + +[[package]] +name = "prost-derive" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b670f45da57fb8542ebdbb6105a925fe571b67f9e7ed9f47a06a84e72b4e7cc" +dependencies = [ + "anyhow", + "itertools", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "prost-derive" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "164ae68b6587001ca506d3bf7f1000bfa248d0e1217b618108fba4ec1d0cc306" +dependencies = [ + "anyhow", + "itertools", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "prost-types" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d0a014229361011dc8e69c8a1ec6c2e8d0f2af7c91e3ea3f5b2170298461e68" +dependencies = [ + "bytes", + "prost 0.10.4", +] + +[[package]] +name = "prost-types" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "747761bc3dc48f9a34553bf65605cf6cb6288ba219f3450b4275dbd81539551a" +dependencies = [ + "bytes", + "prost 0.11.2", +] + +[[package]] +name = "psm" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5787f7cda34e3033a72192c018bc5883100330f362ef279a8cbccfce8bb4e874" +dependencies = [ + "cc", +] + +[[package]] +name = "quick-error" +version = "1.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" + +[[package]] +name = "quicksink" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77de3c815e5a160b1539c6592796801df2043ae35e123b46d73380cfa57af858" +dependencies = [ + "futures-core", + "futures-sink", + "pin-project-lite 0.1.12", +] + +[[package]] +name = "quote" +version = "1.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "radium" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" + +[[package]] +name = "rand" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" +dependencies = [ + "getrandom 0.1.16", + "libc", + "rand_chacha 0.2.2", + "rand_core 0.5.1", + "rand_hc", + "rand_pcg 0.2.1", +] + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha 0.3.1", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_chacha" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" +dependencies = [ + "ppv-lite86", + "rand_core 0.5.1", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_core" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" +dependencies = [ + "getrandom 0.1.16", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.8", +] + +[[package]] +name = "rand_distr" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32cb0b9bc82b0a0876c2dd994a7e7a2683d3e7390ca40e6886785ef0c7e3ee31" +dependencies = [ + "num-traits", + "rand 0.8.5", +] + +[[package]] +name = "rand_hc" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" +dependencies = [ + "rand_core 0.5.1", +] + +[[package]] +name = "rand_pcg" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429" +dependencies = [ + "rand_core 0.5.1", +] + +[[package]] +name = "rand_pcg" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59cad018caf63deb318e5a4586d99a24424a364f40f1e5778c29aca23f4fc73e" +dependencies = [ + "rand_core 0.6.4", +] + +[[package]] +name = "rawpointer" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3" + +[[package]] +name = "rayon" +version = "1.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd99e5772ead8baa5215278c9b15bf92087709e9c1b2d1f97cdb5a183c933a7d" +dependencies = [ + "autocfg", + "crossbeam-deque", + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "258bcdb5ac6dad48491bb2992db6b7cf74878b0384908af124823d118c99683f" +dependencies = [ + "crossbeam-channel", + "crossbeam-deque", + "crossbeam-utils", + "num_cpus", +] + +[[package]] +name = "redox_syscall" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" +dependencies = [ + "bitflags", +] + +[[package]] +name = "redox_users" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" +dependencies = [ + "getrandom 0.2.8", + "redox_syscall", + "thiserror", +] + +[[package]] +name = "reed-solomon-novelpoly" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3bd8f48b2066e9f69ab192797d66da804d1935bf22763204ed3675740cb0f221" +dependencies = [ + "derive_more", + "fs-err", + "itertools", + "static_init 0.5.2", + "thiserror", +] + +[[package]] +name = "ref-cast" +version = "1.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53b15debb4f9d60d767cd8ca9ef7abb2452922f3214671ff052defc7f3502c44" +dependencies = [ + "ref-cast-impl", +] + +[[package]] +name = "ref-cast-impl" +version = "1.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abfa8511e9e94fd3de6585a3d3cd00e01ed556dc9814829280af0e8dc72a8f36" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "regalloc2" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d43a209257d978ef079f3d446331d0f1794f5e0fc19b306a199983857833a779" +dependencies = [ + "fxhash", + "log", + "slice-group-by", + "smallvec", +] + +[[package]] +name = "regex" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e076559ef8e241f2ae3479e36f97bd5741c0330689e217ad51ce2c76808b868a" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" +dependencies = [ + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.6.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" + +[[package]] +name = "remote-externalities" +version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "env_logger", + "jsonrpsee", + "log", + "parity-scale-codec", + "serde", + "serde_json", + "sp-core", + "sp-io", + "sp-runtime", + "sp-version", +] + +[[package]] +name = "remove_dir_all" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" +dependencies = [ + "winapi", +] + +[[package]] +name = "resolv-conf" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52e44394d2086d010551b14b53b1f24e31647570cd1deb0379e2c21b329aba00" +dependencies = [ + "hostname", + "quick-error", +] + +[[package]] +name = "rfc6979" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96ef608575f6392792f9ecf7890c00086591d29a83910939d430753f7c050525" +dependencies = [ + "crypto-bigint", + "hmac 0.11.0", + "zeroize", +] + +[[package]] +name = "ring" +version = "0.16.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" +dependencies = [ + "cc", + "libc", + "once_cell", + "spin", + "untrusted", + "web-sys", + "winapi", +] + +[[package]] +name = "rocksdb" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "620f4129485ff1a7128d184bc687470c21c7951b64779ebc9cfdad3dcd920290" +dependencies = [ + "libc", + "librocksdb-sys", +] + +[[package]] +name = "rococo-runtime" +version = "0.9.30" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +dependencies = [ + "beefy-merkle-tree", + "beefy-primitives", + "frame-benchmarking", + "frame-executive", + "frame-support", + "frame-system", + "frame-system-benchmarking", + "frame-system-rpc-runtime-api", + "hex-literal", + "log", + "pallet-authority-discovery", + "pallet-authorship", + "pallet-babe", + "pallet-balances", + "pallet-beefy", + "pallet-beefy-mmr", + "pallet-bounties", + "pallet-child-bounties", + "pallet-collective", + "pallet-democracy", + "pallet-elections-phragmen", + "pallet-gilt", + "pallet-grandpa", + "pallet-identity", + "pallet-im-online", + "pallet-indices", + "pallet-membership", + "pallet-mmr", + "pallet-multisig", + "pallet-offences", + "pallet-preimage", + "pallet-proxy", + "pallet-recovery", + "pallet-scheduler", + "pallet-session", + "pallet-society", + "pallet-staking", + "pallet-sudo", + "pallet-timestamp", + "pallet-tips", + "pallet-transaction-payment", + "pallet-transaction-payment-rpc-runtime-api", + "pallet-treasury", + "pallet-utility", + "pallet-vesting", + "pallet-xcm", + "pallet-xcm-benchmarks", + "parity-scale-codec", + "polkadot-parachain", + "polkadot-primitives", + "polkadot-runtime-common", + "polkadot-runtime-parachains", + "rococo-runtime-constants", + "scale-info", + "serde", + "serde_derive", + "smallvec", + "sp-api", + "sp-authority-discovery", + "sp-block-builder", + "sp-consensus-babe", + "sp-core", + "sp-inherents", + "sp-io", + "sp-mmr-primitives", + "sp-offchain", + "sp-runtime", + "sp-session", + "sp-staking", + "sp-std", + "sp-transaction-pool", + "sp-version", + "static_assertions", + "substrate-wasm-builder", + "xcm", + "xcm-builder", + "xcm-executor", +] + +[[package]] +name = "rococo-runtime-constants" +version = "0.9.30" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +dependencies = [ + "frame-support", + "polkadot-primitives", + "polkadot-runtime-common", + "smallvec", + "sp-runtime", +] + +[[package]] +name = "rpassword" +version = "7.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20c9f5d2a0c3e2ea729ab3706d22217177770654c3ef5056b68b69d07332d3f5" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "rtnetlink" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "322c53fd76a18698f1c27381d58091de3a043d356aa5bd0d510608b565f469a0" +dependencies = [ + "async-global-executor", + "futures", + "log", + "netlink-packet-route", + "netlink-proto", + "nix", + "thiserror", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342" + +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + +[[package]] +name = "rustc-hex" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" + +[[package]] +name = "rustc_version" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +dependencies = [ + "semver 1.0.14", +] + +[[package]] +name = "rustix" +version = "0.35.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "727a1a6d65f786ec22df8a81ca3121107f235970dc1705ed681d3e6e8b9cd5f9" +dependencies = [ + "bitflags", + "errno", + "io-lifetimes", + "libc", + "linux-raw-sys", + "windows-sys 0.42.0", +] + +[[package]] +name = "rustls" +version = "0.20.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "539a2bfe908f471bfa933876bd1eb6a19cf2176d375f82ef7f99530a40e48c2c" +dependencies = [ + "log", + "ring", + "sct", + "webpki", +] + +[[package]] +name = "rustls-native-certs" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0167bac7a9f490495f3c33013e7722b53cb087ecbe082fb0c6387c96f634ea50" +dependencies = [ + "openssl-probe", + "rustls-pemfile", + "schannel", + "security-framework", +] + +[[package]] +name = "rustls-pemfile" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0864aeff53f8c05aa08d86e5ef839d3dfcf07aeba2db32f12db0ef716e87bd55" +dependencies = [ + "base64", +] + +[[package]] +name = "rustversion" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97477e48b4cf8603ad5f7aaf897467cf42ab4218a38ef76fb14c2d6773a6d6a8" + +[[package]] +name = "rw-stream-sink" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26338f5e09bb721b85b135ea05af7767c90b52f6de4f087d4f4a3a9d64e7dc04" +dependencies = [ + "futures", + "pin-project", + "static_assertions", +] + +[[package]] +name = "ryu" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09" + +[[package]] +name = "salsa20" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97a22f5af31f73a954c10289c93e8a50cc23d971e80ee446f1f6f7137a088213" +dependencies = [ + "cipher 0.4.3", +] + +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "sc-allocator" +version = "4.1.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "log", + "sp-core", + "sp-wasm-interface", + "thiserror", +] + +[[package]] +name = "sc-authority-discovery" +version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "async-trait", + "futures", + "futures-timer", + "ip_network", + "libp2p", + "log", + "parity-scale-codec", + "prost 0.10.4", + "prost-build 0.10.4", + "rand 0.7.3", + "sc-client-api", + "sc-network-common", + "sp-api", + "sp-authority-discovery", + "sp-blockchain", + "sp-core", + "sp-keystore", + "sp-runtime", + "substrate-prometheus-endpoint", + "thiserror", +] + +[[package]] +name = "sc-basic-authorship" +version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "futures", + "futures-timer", + "log", + "parity-scale-codec", + "sc-block-builder", + "sc-client-api", + "sc-proposer-metrics", + "sc-telemetry", + "sc-transaction-pool-api", + "sp-api", + "sp-blockchain", + "sp-consensus", + "sp-core", + "sp-inherents", + "sp-runtime", + "substrate-prometheus-endpoint", +] + +[[package]] +name = "sc-block-builder" +version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "parity-scale-codec", + "sc-client-api", + "sp-api", + "sp-block-builder", + "sp-blockchain", + "sp-core", + "sp-inherents", + "sp-runtime", + "sp-state-machine", +] + +[[package]] +name = "sc-chain-spec" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "impl-trait-for-tuples", + "memmap2", + "parity-scale-codec", + "sc-chain-spec-derive", + "sc-network-common", + "sc-telemetry", + "serde", + "serde_json", + "sp-core", + "sp-runtime", +] + +[[package]] +name = "sc-chain-spec-derive" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "sc-cli" +version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "array-bytes", + "chrono", + "clap", + "fdlimit", + "futures", + "libp2p", + "log", + "names", + "parity-scale-codec", + "rand 0.7.3", + "regex", + "rpassword", + "sc-client-api", + "sc-client-db", + "sc-keystore", + "sc-network", + "sc-network-common", + "sc-service", + "sc-telemetry", + "sc-tracing", + "sc-utils", + "serde", + "serde_json", + "sp-blockchain", + "sp-core", + "sp-keyring", + "sp-keystore", + "sp-panic-handler", + "sp-runtime", + "sp-version", + "thiserror", + "tiny-bip39", + "tokio", +] + +[[package]] +name = "sc-client-api" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "fnv", + "futures", + "hash-db", + "log", + "parity-scale-codec", + "parking_lot 0.12.1", + "sc-executor", + "sc-transaction-pool-api", + "sc-utils", + "sp-api", + "sp-blockchain", + "sp-consensus", + "sp-core", + "sp-database", + "sp-externalities", + "sp-keystore", + "sp-runtime", + "sp-state-machine", + "sp-storage", + "sp-trie", + "substrate-prometheus-endpoint", +] + +[[package]] +name = "sc-client-db" +version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "hash-db", + "kvdb", + "kvdb-memorydb", + "kvdb-rocksdb", + "linked-hash-map", + "log", + "parity-db", + "parity-scale-codec", + "parking_lot 0.12.1", + "sc-client-api", + "sc-state-db", + "sp-arithmetic", + "sp-blockchain", + "sp-core", + "sp-database", + "sp-runtime", + "sp-state-machine", + "sp-trie", +] + +[[package]] +name = "sc-consensus" +version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "async-trait", + "futures", + "futures-timer", + "libp2p", + "log", + "parking_lot 0.12.1", + "sc-client-api", + "sc-utils", + "serde", + "sp-api", + "sp-blockchain", + "sp-consensus", + "sp-core", + "sp-runtime", + "sp-state-machine", + "substrate-prometheus-endpoint", + "thiserror", +] + +[[package]] +name = "sc-consensus-aura" +version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "async-trait", + "futures", + "log", + "parity-scale-codec", + "sc-block-builder", + "sc-client-api", + "sc-consensus", + "sc-consensus-slots", + "sc-telemetry", + "sp-api", + "sp-application-crypto", + "sp-block-builder", + "sp-blockchain", + "sp-consensus", + "sp-consensus-aura", + "sp-consensus-slots", + "sp-core", + "sp-inherents", + "sp-keystore", + "sp-runtime", + "substrate-prometheus-endpoint", + "thiserror", +] + +[[package]] +name = "sc-consensus-babe" +version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "async-trait", + "fork-tree", + "futures", + "log", + "merlin", + "num-bigint 0.2.6", + "num-rational 0.2.4", + "num-traits", + "parity-scale-codec", + "parking_lot 0.12.1", + "rand 0.7.3", + "sc-client-api", + "sc-consensus", + "sc-consensus-epochs", + "sc-consensus-slots", + "sc-keystore", + "sc-telemetry", + "schnorrkel", + "serde", + "sp-api", + "sp-application-crypto", + "sp-block-builder", + "sp-blockchain", + "sp-consensus", + "sp-consensus-babe", + "sp-consensus-slots", + "sp-consensus-vrf", + "sp-core", + "sp-inherents", + "sp-io", + "sp-keystore", + "sp-runtime", + "sp-version", + "substrate-prometheus-endpoint", + "thiserror", +] + +[[package]] +name = "sc-consensus-babe-rpc" +version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "futures", + "jsonrpsee", + "sc-consensus-babe", + "sc-consensus-epochs", + "sc-rpc-api", + "serde", + "sp-api", + "sp-application-crypto", + "sp-blockchain", + "sp-consensus", + "sp-consensus-babe", + "sp-core", + "sp-keystore", + "sp-runtime", + "thiserror", +] + +[[package]] +name = "sc-consensus-epochs" +version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "fork-tree", + "parity-scale-codec", + "sc-client-api", + "sc-consensus", + "sp-blockchain", + "sp-runtime", +] + +[[package]] +name = "sc-consensus-slots" +version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "async-trait", + "futures", + "futures-timer", + "log", + "parity-scale-codec", + "sc-client-api", + "sc-consensus", + "sc-telemetry", + "sp-arithmetic", + "sp-blockchain", + "sp-consensus", + "sp-consensus-slots", + "sp-core", + "sp-inherents", + "sp-runtime", + "sp-state-machine", + "thiserror", +] + +[[package]] +name = "sc-executor" +version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "lazy_static", + "lru 0.7.8", + "parity-scale-codec", + "parking_lot 0.12.1", + "sc-executor-common", + "sc-executor-wasmi", + "sc-executor-wasmtime", + "sp-api", + "sp-core", + "sp-core-hashing-proc-macro", + "sp-externalities", + "sp-io", + "sp-panic-handler", + "sp-runtime-interface", + "sp-tasks", + "sp-trie", + "sp-version", + "sp-wasm-interface", + "tracing", + "wasmi", +] + +[[package]] +name = "sc-executor-common" +version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "environmental", + "parity-scale-codec", + "sc-allocator", + "sp-maybe-compressed-blob", + "sp-sandbox", + "sp-wasm-interface", + "thiserror", + "wasm-instrument", + "wasmi", +] + +[[package]] +name = "sc-executor-wasmi" +version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "log", + "parity-scale-codec", + "sc-allocator", + "sc-executor-common", + "sp-runtime-interface", + "sp-sandbox", + "sp-wasm-interface", + "wasmi", +] + +[[package]] +name = "sc-executor-wasmtime" +version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "cfg-if 1.0.0", + "libc", + "log", + "once_cell", + "parity-scale-codec", + "parity-wasm 0.45.0", + "rustix", + "sc-allocator", + "sc-executor-common", + "sp-runtime-interface", + "sp-sandbox", + "sp-wasm-interface", + "wasmtime", +] + +[[package]] +name = "sc-finality-grandpa" +version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "ahash", + "array-bytes", + "async-trait", + "dyn-clone", + "finality-grandpa", + "fork-tree", + "futures", + "futures-timer", + "log", + "parity-scale-codec", + "parking_lot 0.12.1", + "rand 0.8.5", + "sc-block-builder", + "sc-chain-spec", + "sc-client-api", + "sc-consensus", + "sc-keystore", + "sc-network", + "sc-network-common", + "sc-network-gossip", + "sc-telemetry", + "sc-utils", + "serde_json", + "sp-api", + "sp-application-crypto", + "sp-arithmetic", + "sp-blockchain", + "sp-consensus", + "sp-core", + "sp-finality-grandpa", + "sp-keystore", + "sp-runtime", + "substrate-prometheus-endpoint", + "thiserror", +] + +[[package]] +name = "sc-finality-grandpa-rpc" +version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "finality-grandpa", + "futures", + "jsonrpsee", + "log", + "parity-scale-codec", + "sc-client-api", + "sc-finality-grandpa", + "sc-rpc", + "serde", + "serde_json", + "sp-blockchain", + "sp-core", + "sp-runtime", + "thiserror", +] + +[[package]] +name = "sc-informant" +version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "ansi_term", + "futures", + "futures-timer", + "log", + "parity-util-mem", + "sc-client-api", + "sc-network-common", + "sc-transaction-pool-api", + "sp-blockchain", + "sp-runtime", +] + +[[package]] +name = "sc-keystore" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "array-bytes", + "async-trait", + "parking_lot 0.12.1", + "serde_json", + "sp-application-crypto", + "sp-core", + "sp-keystore", + "thiserror", +] + +[[package]] +name = "sc-network" +version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "array-bytes", + "async-trait", + "asynchronous-codec", + "bitflags", + "bytes", + "cid", + "either", + "fnv", + "fork-tree", + "futures", + "futures-timer", + "ip_network", + "libp2p", + "linked-hash-map", + "linked_hash_set", + "log", + "lru 0.7.8", + "parity-scale-codec", + "parking_lot 0.12.1", + "pin-project", + "prost 0.10.4", + "rand 0.7.3", + "sc-block-builder", + "sc-client-api", + "sc-consensus", + "sc-network-common", + "sc-peerset", + "sc-utils", + "serde", + "serde_json", + "smallvec", + "sp-arithmetic", + "sp-blockchain", + "sp-consensus", + "sp-core", + "sp-runtime", + "substrate-prometheus-endpoint", + "thiserror", + "unsigned-varint", + "zeroize", +] + +[[package]] +name = "sc-network-bitswap" +version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "cid", + "futures", + "libp2p", + "log", + "prost 0.11.2", + "prost-build 0.11.2", + "sc-client-api", + "sc-network-common", + "sp-blockchain", + "sp-runtime", + "thiserror", + "unsigned-varint", + "void", +] + +[[package]] +name = "sc-network-common" +version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "async-trait", + "bitflags", + "bytes", + "futures", + "futures-timer", + "libp2p", + "linked_hash_set", + "parity-scale-codec", + "prost-build 0.10.4", + "sc-consensus", + "sc-peerset", + "serde", + "smallvec", + "sp-blockchain", + "sp-consensus", + "sp-finality-grandpa", + "sp-runtime", + "substrate-prometheus-endpoint", + "thiserror", +] + +[[package]] +name = "sc-network-gossip" +version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "ahash", + "futures", + "futures-timer", + "libp2p", + "log", + "lru 0.7.8", + "sc-network-common", + "sc-peerset", + "sp-runtime", + "substrate-prometheus-endpoint", + "tracing", +] + +[[package]] +name = "sc-network-light" +version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "array-bytes", + "futures", + "libp2p", + "log", + "parity-scale-codec", + "prost 0.10.4", + "prost-build 0.10.4", + "sc-client-api", + "sc-network-common", + "sc-peerset", + "sp-blockchain", + "sp-core", + "sp-runtime", + "thiserror", +] + +[[package]] +name = "sc-network-sync" +version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "array-bytes", + "fork-tree", + "futures", + "libp2p", + "log", + "lru 0.7.8", + "parity-scale-codec", + "prost 0.10.4", + "prost-build 0.10.4", + "sc-client-api", + "sc-consensus", + "sc-network-common", + "sc-peerset", + "smallvec", + "sp-arithmetic", + "sp-blockchain", + "sp-consensus", + "sp-core", + "sp-finality-grandpa", + "sp-runtime", + "thiserror", +] + +[[package]] +name = "sc-network-transactions" +version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "array-bytes", + "futures", + "hex", + "libp2p", + "log", + "parity-scale-codec", + "pin-project", + "sc-network-common", + "sc-peerset", + "sp-consensus", + "sp-runtime", + "substrate-prometheus-endpoint", +] + +[[package]] +name = "sc-offchain" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "array-bytes", + "bytes", + "fnv", + "futures", + "futures-timer", + "hyper", + "hyper-rustls", + "libp2p", + "num_cpus", + "once_cell", + "parity-scale-codec", + "parking_lot 0.12.1", + "rand 0.7.3", + "sc-client-api", + "sc-network-common", + "sc-peerset", + "sc-utils", + "sp-api", + "sp-core", + "sp-offchain", + "sp-runtime", + "threadpool", + "tracing", +] + +[[package]] +name = "sc-peerset" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "futures", + "libp2p", + "log", + "sc-utils", + "serde_json", + "wasm-timer", +] + +[[package]] +name = "sc-proposer-metrics" +version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "log", + "substrate-prometheus-endpoint", +] + +[[package]] +name = "sc-rpc" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "futures", + "hash-db", + "jsonrpsee", + "log", + "parity-scale-codec", + "parking_lot 0.12.1", + "sc-block-builder", + "sc-chain-spec", + "sc-client-api", + "sc-rpc-api", + "sc-tracing", + "sc-transaction-pool-api", + "sc-utils", + "serde_json", + "sp-api", + "sp-blockchain", + "sp-core", + "sp-keystore", + "sp-offchain", + "sp-rpc", + "sp-runtime", + "sp-session", + "sp-version", +] + +[[package]] +name = "sc-rpc-api" +version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "futures", + "jsonrpsee", + "log", + "parity-scale-codec", + "parking_lot 0.12.1", + "sc-chain-spec", + "sc-transaction-pool-api", + "scale-info", + "serde", + "serde_json", + "sp-core", + "sp-rpc", + "sp-runtime", + "sp-tracing", + "sp-version", + "thiserror", +] + +[[package]] +name = "sc-rpc-server" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "futures", + "jsonrpsee", + "log", + "serde_json", + "substrate-prometheus-endpoint", + "tokio", +] + +[[package]] +name = "sc-service" +version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "async-trait", + "directories", + "exit-future", + "futures", + "futures-timer", + "hash-db", + "jsonrpsee", + "log", + "parity-scale-codec", + "parity-util-mem", + "parking_lot 0.12.1", + "pin-project", + "rand 0.7.3", + "sc-block-builder", + "sc-chain-spec", + "sc-client-api", + "sc-client-db", + "sc-consensus", + "sc-executor", + "sc-informant", + "sc-keystore", + "sc-network", + "sc-network-bitswap", + "sc-network-common", + "sc-network-light", + "sc-network-sync", + "sc-network-transactions", + "sc-offchain", + "sc-rpc", + "sc-rpc-server", + "sc-sysinfo", + "sc-telemetry", + "sc-tracing", + "sc-transaction-pool", + "sc-transaction-pool-api", + "sc-utils", + "serde", + "serde_json", + "sp-api", + "sp-application-crypto", + "sp-block-builder", + "sp-blockchain", + "sp-consensus", + "sp-core", + "sp-externalities", + "sp-inherents", + "sp-keystore", + "sp-runtime", + "sp-session", + "sp-state-machine", + "sp-storage", + "sp-tracing", + "sp-transaction-pool", + "sp-transaction-storage-proof", + "sp-trie", + "sp-version", + "static_init 1.0.3", + "substrate-prometheus-endpoint", + "tempfile", + "thiserror", + "tokio", + "tracing", + "tracing-futures", +] + +[[package]] +name = "sc-state-db" +version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "log", + "parity-scale-codec", + "parity-util-mem", + "parity-util-mem-derive", + "parking_lot 0.12.1", + "sc-client-api", + "sp-core", +] + +[[package]] +name = "sc-sync-state-rpc" +version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "jsonrpsee", + "parity-scale-codec", + "sc-chain-spec", + "sc-client-api", + "sc-consensus-babe", + "sc-consensus-epochs", + "sc-finality-grandpa", + "serde", + "serde_json", + "sp-blockchain", + "sp-runtime", + "thiserror", +] + +[[package]] +name = "sc-sysinfo" +version = "6.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "futures", + "libc", + "log", + "rand 0.7.3", + "rand_pcg 0.2.1", + "regex", + "sc-telemetry", + "serde", + "serde_json", + "sp-core", + "sp-io", + "sp-std", +] + +[[package]] +name = "sc-telemetry" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "chrono", + "futures", + "libp2p", + "log", + "parking_lot 0.12.1", + "pin-project", + "rand 0.7.3", + "serde", + "serde_json", + "thiserror", + "wasm-timer", +] + +[[package]] +name = "sc-tracing" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "ansi_term", + "atty", + "chrono", + "lazy_static", + "libc", + "log", + "once_cell", + "parking_lot 0.12.1", + "regex", + "rustc-hash", + "sc-client-api", + "sc-rpc-server", + "sc-tracing-proc-macro", + "serde", + "sp-api", + "sp-blockchain", + "sp-core", + "sp-rpc", + "sp-runtime", + "sp-tracing", + "thiserror", + "tracing", + "tracing-log", + "tracing-subscriber", +] + +[[package]] +name = "sc-tracing-proc-macro" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "sc-transaction-pool" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "futures", + "futures-timer", + "linked-hash-map", + "log", + "parity-scale-codec", + "parity-util-mem", + "parking_lot 0.12.1", + "sc-client-api", + "sc-transaction-pool-api", + "sc-utils", + "serde", + "sp-api", + "sp-blockchain", + "sp-core", + "sp-runtime", + "sp-tracing", + "sp-transaction-pool", + "substrate-prometheus-endpoint", + "thiserror", +] + +[[package]] +name = "sc-transaction-pool-api" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "futures", + "log", + "serde", + "sp-blockchain", + "sp-runtime", + "thiserror", +] + +[[package]] +name = "sc-utils" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "futures", + "futures-timer", + "lazy_static", + "log", + "parking_lot 0.12.1", + "prometheus", +] + +[[package]] +name = "scale-info" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88d8a765117b237ef233705cc2cc4c6a27fccd46eea6ef0c8c6dae5f3ef407f8" +dependencies = [ + "bitvec", + "cfg-if 1.0.0", + "derive_more", + "parity-scale-codec", + "scale-info-derive", + "serde", +] + +[[package]] +name = "scale-info-derive" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdcd47b380d8c4541044e341dcd9475f55ba37ddc50c908d945fc036a8642496" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "schannel" +version = "0.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88d6731146462ea25d9244b2ed5fd1d716d25c52e4d54aa4fb0f3c4e9854dbe2" +dependencies = [ + "lazy_static", + "windows-sys 0.36.1", +] + +[[package]] +name = "schnorrkel" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "021b403afe70d81eea68f6ea12f6b3c9588e5d536a94c3bf80f15e7faa267862" +dependencies = [ + "arrayref", + "arrayvec 0.5.2", + "curve25519-dalek 2.1.3", + "getrandom 0.1.16", + "merlin", + "rand 0.7.3", + "rand_core 0.5.1", + "sha2 0.8.2", + "subtle", + "zeroize", +] + +[[package]] +name = "scopeguard" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" + +[[package]] +name = "scratch" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8132065adcfd6e02db789d9285a0deb2f3fcb04002865ab67d5fb103533898" + +[[package]] +name = "sct" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4" +dependencies = [ + "ring", + "untrusted", +] + +[[package]] +name = "sec1" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08da66b8b0965a5555b6bd6639e68ccba85e1e2506f5fbb089e93f8a04e1a2d1" +dependencies = [ + "der", + "generic-array 0.14.6", + "pkcs8", + "subtle", + "zeroize", +] + +[[package]] +name = "secp256k1" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff55dc09d460954e9ef2fa8a7ced735a964be9981fd50e870b2b3b0705e14964" +dependencies = [ + "secp256k1-sys", +] + +[[package]] +name = "secp256k1-sys" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83080e2c2fc1006e625be82e5d1eb6a43b7fd9578b617fcc55814daf286bba4b" +dependencies = [ + "cc", +] + +[[package]] +name = "secrecy" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bd1c54ea06cfd2f6b63219704de0b9b4f72dcc2b8fdef820be6cd799780e91e" +dependencies = [ + "zeroize", +] + +[[package]] +name = "security-framework" +version = "2.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bc1bb97804af6631813c55739f771071e0f2ed33ee20b68c86ec505d906356c" +dependencies = [ + "bitflags", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0160a13a177a45bfb43ce71c01580998474f556ad854dcbca936dd2841a5c556" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "semver" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a3186ec9e65071a2095434b1f5bb24838d4e8e130f584c790f6033c79943537" +dependencies = [ + "semver-parser", +] + +[[package]] +name = "semver" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e25dfac463d778e353db5be2449d1cce89bd6fd23c9f1ea21310ce6e5a1b29c4" +dependencies = [ + "serde", +] + +[[package]] +name = "semver-parser" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" + +[[package]] +name = "serde" +version = "1.0.147" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d193d69bae983fc11a79df82342761dfbf28a99fc8d203dca4c3c1b590948965" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.147" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f1d362ca8fc9c3e3a7484440752472d68a6caa98f1ab81d99b5dfe517cec852" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce777b7b150d76b9cf60d28b55f5847135a003f7d7350c6be7a773508ce7d45" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "serde_nanos" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e44969a61f5d316be20a42ff97816efb3b407a924d06824c3d8a49fa8450de0e" +dependencies = [ + "serde", +] + +[[package]] +name = "sha-1" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99cd6713db3cf16b6c84e06321e049a9b9f699826e16096d23bbcc44d15d51a6" +dependencies = [ + "block-buffer 0.9.0", + "cfg-if 1.0.0", + "cpufeatures", + "digest 0.9.0", + "opaque-debug 0.3.0", +] + +[[package]] +name = "sha1" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3" +dependencies = [ + "cfg-if 1.0.0", + "cpufeatures", + "digest 0.10.5", +] + +[[package]] +name = "sha2" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a256f46ea78a0c0d9ff00077504903ac881a1dafdc20da66545699e7776b3e69" +dependencies = [ + "block-buffer 0.7.3", + "digest 0.8.1", + "fake-simd", + "opaque-debug 0.2.3", +] + +[[package]] +name = "sha2" +version = "0.9.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" +dependencies = [ + "block-buffer 0.9.0", + "cfg-if 1.0.0", + "cpufeatures", + "digest 0.9.0", + "opaque-debug 0.3.0", +] + +[[package]] +name = "sha2" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" +dependencies = [ + "cfg-if 1.0.0", + "cpufeatures", + "digest 0.10.5", +] + +[[package]] +name = "sha3" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bdf0c33fae925bdc080598b84bc15c55e7b9a4a43b3c704da051f977469691c9" +dependencies = [ + "digest 0.10.5", + "keccak", +] + +[[package]] +name = "sharded-slab" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "900fba806f70c630b0a382d0d825e17a0f19fcd059a2ade1ff237bcddf446b31" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "shlex" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3" + +[[package]] +name = "signal-hook" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a253b5e89e2698464fc26b545c9edceb338e18a89effeeecfea192c3025be29d" +dependencies = [ + "libc", + "signal-hook-registry", +] + +[[package]] +name = "signal-hook-registry" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e51e73328dc4ac0c7ccbda3a494dfa03df1de2f46018127f60c693f2648455b0" +dependencies = [ + "libc", +] + +[[package]] +name = "signature" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02658e48d89f2bec991f9a78e69cfa4c316f8d6a6c4ec12fae1aeb263d486788" +dependencies = [ + "digest 0.9.0", + "rand_core 0.6.4", +] + +[[package]] +name = "simba" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e82063457853d00243beda9952e910b82593e4b07ae9f721b9278a99a0d3d5c" +dependencies = [ + "approx", + "num-complex", + "num-traits", + "paste", +] + +[[package]] +name = "slab" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4614a76b2a8be0058caa9dbbaf66d988527d86d003c11a94fbd335d7661edcef" +dependencies = [ + "autocfg", +] + +[[package]] +name = "slice-group-by" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03b634d87b960ab1a38c4fe143b508576f075e7c978bfad18217645ebfdfa2ec" + +[[package]] +name = "slot-range-helper" +version = "0.9.30" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +dependencies = [ + "enumn", + "parity-scale-codec", + "paste", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "slotmap" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1e08e261d0e8f5c43123b7adf3e4ca1690d655377ac93a03b2c9d3e98de1342" +dependencies = [ + "version_check", +] + +[[package]] +name = "smallvec" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" + +[[package]] +name = "snap" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45456094d1983e2ee2a18fdfebce3189fa451699d0502cb8e3b49dba5ba41451" + +[[package]] +name = "snow" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "774d05a3edae07ce6d68ea6984f3c05e9bba8927e3dd591e3b479e5b03213d0d" +dependencies = [ + "aes-gcm", + "blake2", + "chacha20poly1305", + "curve25519-dalek 4.0.0-pre.1", + "rand_core 0.6.4", + "ring", + "rustc_version", + "sha2 0.10.6", + "subtle", +] + +[[package]] +name = "socket2" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02e2d2db9033d13a1567121ddd7a095ee144db4e1ca1b1bda3419bc0da294ebd" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "soketto" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d1c5305e39e09653383c2c7244f2f78b3bcae37cf50c64cb4789c9f5096ec2" +dependencies = [ + "base64", + "bytes", + "flate2", + "futures", + "httparse", + "log", + "rand 0.8.5", + "sha-1", +] + +[[package]] +name = "sp-api" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "hash-db", + "log", + "parity-scale-codec", + "sp-api-proc-macro", + "sp-core", + "sp-runtime", + "sp-state-machine", + "sp-std", + "sp-trie", + "sp-version", + "thiserror", +] + +[[package]] +name = "sp-api-proc-macro" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "blake2", + "proc-macro-crate", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "sp-application-crypto" +version = "6.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "parity-scale-codec", + "scale-info", + "serde", + "sp-core", + "sp-io", + "sp-std", +] + +[[package]] +name = "sp-arithmetic" +version = "5.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "integer-sqrt", + "num-traits", + "parity-scale-codec", + "scale-info", + "serde", + "sp-debug-derive", + "sp-std", + "static_assertions", +] + +[[package]] +name = "sp-authority-discovery" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "parity-scale-codec", + "scale-info", + "sp-api", + "sp-application-crypto", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "sp-authorship" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "async-trait", + "parity-scale-codec", + "sp-inherents", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "sp-block-builder" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "parity-scale-codec", + "sp-api", + "sp-inherents", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "sp-blockchain" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "futures", + "log", + "lru 0.7.8", + "parity-scale-codec", + "parking_lot 0.12.1", + "sp-api", + "sp-consensus", + "sp-database", + "sp-runtime", + "sp-state-machine", + "thiserror", +] + +[[package]] +name = "sp-consensus" +version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "async-trait", + "futures", + "futures-timer", + "log", + "parity-scale-codec", + "sp-core", + "sp-inherents", + "sp-runtime", + "sp-state-machine", + "sp-std", + "sp-version", + "thiserror", +] + +[[package]] +name = "sp-consensus-aura" +version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "async-trait", + "parity-scale-codec", + "scale-info", + "sp-api", + "sp-application-crypto", + "sp-consensus", + "sp-consensus-slots", + "sp-inherents", + "sp-runtime", + "sp-std", + "sp-timestamp", +] + +[[package]] +name = "sp-consensus-babe" +version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "async-trait", + "merlin", + "parity-scale-codec", + "scale-info", + "serde", + "sp-api", + "sp-application-crypto", + "sp-consensus", + "sp-consensus-slots", + "sp-consensus-vrf", + "sp-core", + "sp-inherents", + "sp-keystore", + "sp-runtime", + "sp-std", + "sp-timestamp", +] + +[[package]] +name = "sp-consensus-slots" +version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "parity-scale-codec", + "scale-info", + "serde", + "sp-arithmetic", + "sp-runtime", + "sp-std", + "sp-timestamp", +] + +[[package]] +name = "sp-consensus-vrf" +version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "parity-scale-codec", + "scale-info", + "schnorrkel", + "sp-core", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "sp-core" +version = "6.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "array-bytes", + "base58", + "bitflags", + "blake2", + "byteorder", + "dyn-clonable", + "ed25519-zebra", + "futures", + "hash-db", + "hash256-std-hasher", + "impl-serde", + "lazy_static", + "libsecp256k1", + "log", + "merlin", + "num-traits", + "parity-scale-codec", + "parity-util-mem", + "parking_lot 0.12.1", + "primitive-types", + "rand 0.7.3", + "regex", + "scale-info", + "schnorrkel", + "secp256k1", + "secrecy", + "serde", + "sp-core-hashing", + "sp-debug-derive", + "sp-externalities", + "sp-runtime-interface", + "sp-std", + "sp-storage", + "ss58-registry", + "substrate-bip39", + "thiserror", + "tiny-bip39", + "wasmi", + "zeroize", +] + +[[package]] +name = "sp-core-hashing" +version = "4.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "blake2", + "byteorder", + "digest 0.10.5", + "sha2 0.10.6", + "sha3", + "sp-std", + "twox-hash", +] + +[[package]] +name = "sp-core-hashing-proc-macro" +version = "5.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "proc-macro2", + "quote", + "sp-core-hashing", + "syn", +] + +[[package]] +name = "sp-database" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "kvdb", + "parking_lot 0.12.1", +] + +[[package]] +name = "sp-debug-derive" +version = "4.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "sp-externalities" +version = "0.12.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "environmental", + "parity-scale-codec", + "sp-std", + "sp-storage", +] + +[[package]] +name = "sp-finality-grandpa" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "finality-grandpa", + "log", + "parity-scale-codec", + "scale-info", + "serde", + "sp-api", + "sp-application-crypto", + "sp-core", + "sp-keystore", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "sp-inherents" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "async-trait", + "impl-trait-for-tuples", + "parity-scale-codec", + "sp-core", + "sp-runtime", + "sp-std", + "thiserror", +] + +[[package]] +name = "sp-io" +version = "6.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "bytes", + "futures", + "hash-db", + "libsecp256k1", + "log", + "parity-scale-codec", + "parking_lot 0.12.1", + "secp256k1", + "sp-core", + "sp-externalities", + "sp-keystore", + "sp-runtime-interface", + "sp-state-machine", + "sp-std", + "sp-tracing", + "sp-trie", + "sp-wasm-interface", + "tracing", + "tracing-core", +] + +[[package]] +name = "sp-keyring" +version = "6.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "lazy_static", + "sp-core", + "sp-runtime", + "strum", +] + +[[package]] +name = "sp-keystore" +version = "0.12.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "async-trait", + "futures", + "merlin", + "parity-scale-codec", + "parking_lot 0.12.1", + "schnorrkel", + "serde", + "sp-core", + "sp-externalities", + "thiserror", +] + +[[package]] +name = "sp-maybe-compressed-blob" +version = "4.1.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "thiserror", + "zstd", +] + +[[package]] +name = "sp-mmr-primitives" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "log", + "parity-scale-codec", + "serde", + "sp-api", + "sp-core", + "sp-debug-derive", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "sp-npos-elections" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "parity-scale-codec", + "scale-info", + "serde", + "sp-arithmetic", + "sp-core", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "sp-offchain" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "sp-api", + "sp-core", + "sp-runtime", +] + +[[package]] +name = "sp-panic-handler" +version = "4.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "backtrace", + "lazy_static", + "regex", +] + +[[package]] +name = "sp-rpc" +version = "6.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "rustc-hash", + "serde", + "sp-core", +] + +[[package]] +name = "sp-runtime" +version = "6.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "either", + "hash256-std-hasher", + "impl-trait-for-tuples", + "log", + "parity-scale-codec", + "parity-util-mem", + "paste", + "rand 0.7.3", + "scale-info", + "serde", + "sp-application-crypto", + "sp-arithmetic", + "sp-core", + "sp-io", + "sp-std", + "sp-weights", +] + +[[package]] +name = "sp-runtime-interface" +version = "6.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "bytes", + "impl-trait-for-tuples", + "parity-scale-codec", + "primitive-types", + "sp-externalities", + "sp-runtime-interface-proc-macro", + "sp-std", + "sp-storage", + "sp-tracing", + "sp-wasm-interface", + "static_assertions", +] + +[[package]] +name = "sp-runtime-interface-proc-macro" +version = "5.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "Inflector", + "proc-macro-crate", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "sp-sandbox" +version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "log", + "parity-scale-codec", + "sp-core", + "sp-io", + "sp-std", + "sp-wasm-interface", + "wasmi", +] + +[[package]] +name = "sp-session" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "parity-scale-codec", + "scale-info", + "sp-api", + "sp-core", + "sp-runtime", + "sp-staking", + "sp-std", +] + +[[package]] +name = "sp-staking" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "parity-scale-codec", + "scale-info", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "sp-state-machine" +version = "0.12.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "hash-db", + "log", + "num-traits", + "parity-scale-codec", + "parking_lot 0.12.1", + "rand 0.7.3", + "smallvec", + "sp-core", + "sp-externalities", + "sp-panic-handler", + "sp-std", + "sp-trie", + "thiserror", + "tracing", + "trie-root", +] + +[[package]] +name = "sp-std" +version = "4.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" + +[[package]] +name = "sp-storage" +version = "6.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "impl-serde", + "parity-scale-codec", + "ref-cast", + "serde", + "sp-debug-derive", + "sp-std", +] + +[[package]] +name = "sp-tasks" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "log", + "sp-core", + "sp-externalities", + "sp-io", + "sp-runtime-interface", + "sp-std", +] + +[[package]] +name = "sp-timestamp" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "async-trait", + "futures-timer", + "log", + "parity-scale-codec", + "sp-api", + "sp-inherents", + "sp-runtime", + "sp-std", + "thiserror", +] + +[[package]] +name = "sp-tracing" +version = "5.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "parity-scale-codec", + "sp-std", + "tracing", + "tracing-core", + "tracing-subscriber", +] + +[[package]] +name = "sp-transaction-pool" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "sp-api", + "sp-runtime", +] + +[[package]] +name = "sp-transaction-storage-proof" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "async-trait", + "log", + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-inherents", + "sp-runtime", + "sp-std", + "sp-trie", +] + +[[package]] +name = "sp-trie" +version = "6.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "ahash", + "hash-db", + "hashbrown", + "lazy_static", + "lru 0.7.8", + "memory-db", + "nohash-hasher", + "parity-scale-codec", + "parking_lot 0.12.1", + "scale-info", + "sp-core", + "sp-std", + "thiserror", + "tracing", + "trie-db", + "trie-root", +] + +[[package]] +name = "sp-version" +version = "5.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "impl-serde", + "parity-scale-codec", + "parity-wasm 0.45.0", + "scale-info", + "serde", + "sp-core-hashing-proc-macro", + "sp-runtime", + "sp-std", + "sp-version-proc-macro", + "thiserror", +] + +[[package]] +name = "sp-version-proc-macro" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "parity-scale-codec", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "sp-wasm-interface" +version = "6.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "impl-trait-for-tuples", + "log", + "parity-scale-codec", + "sp-std", + "wasmi", + "wasmtime", +] + +[[package]] +name = "sp-weights" +version = "4.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "impl-trait-for-tuples", + "parity-scale-codec", + "scale-info", + "serde", + "smallvec", + "sp-arithmetic", + "sp-core", + "sp-debug-derive", + "sp-std", +] + +[[package]] +name = "spin" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" + +[[package]] +name = "spki" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44d01ac02a6ccf3e07db148d2be087da624fea0221a16152ed01f0496a6b0a27" +dependencies = [ + "base64ct", + "der", +] + +[[package]] +name = "ss58-registry" +version = "1.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ab7554f8a8b6f8d71cd5a8e6536ef116e2ce0504cf97ebf16311d58065dc8a6" +dependencies = [ + "Inflector", + "num-format", + "proc-macro2", + "quote", + "serde", + "serde_json", + "unicode-xid", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[package]] +name = "static_init" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11b73400442027c4adedda20a9f9b7945234a5bd8d5f7e86da22bd5d0622369c" +dependencies = [ + "cfg_aliases", + "libc", + "parking_lot 0.11.2", + "static_init_macro 0.5.0", +] + +[[package]] +name = "static_init" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a2a1c578e98c1c16fc3b8ec1328f7659a500737d7a0c6d625e73e830ff9c1f6" +dependencies = [ + "bitflags", + "cfg_aliases", + "libc", + "parking_lot 0.11.2", + "parking_lot_core 0.8.5", + "static_init_macro 1.0.2", + "winapi", +] + +[[package]] +name = "static_init_macro" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2261c91034a1edc3fc4d1b80e89d82714faede0515c14a75da10cb941546bbf" +dependencies = [ + "cfg_aliases", + "memchr", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "static_init_macro" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70a2595fc3aa78f2d0e45dd425b22282dd863273761cc77780914b2cf3003acf" +dependencies = [ + "cfg_aliases", + "memchr", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "statrs" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05bdbb8e4e78216a85785a85d3ec3183144f98d0097b9281802c019bb07a6f05" +dependencies = [ + "approx", + "lazy_static", + "nalgebra", + "num-traits", + "rand 0.8.5", +] + +[[package]] +name = "strsim" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" + +[[package]] +name = "strum" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "063e6045c0e62079840579a7e47a355ae92f60eb74daaf156fb1e84ba164e63f" +dependencies = [ + "strum_macros", +] + +[[package]] +name = "strum_macros" +version = "0.24.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e385be0d24f186b4ce2f9982191e7101bb737312ad61c1f2f984f34bcf85d59" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "rustversion", + "syn", +] + +[[package]] +name = "substrate-bip39" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49eee6965196b32f882dd2ee85a92b1dbead41b04e53907f269de3b0dc04733c" +dependencies = [ + "hmac 0.11.0", + "pbkdf2 0.8.0", + "schnorrkel", + "sha2 0.9.9", + "zeroize", +] + +[[package]] +name = "substrate-build-script-utils" +version = "3.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "platforms", +] + +[[package]] +name = "substrate-frame-rpc-system" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "frame-system-rpc-runtime-api", + "futures", + "jsonrpsee", + "log", + "parity-scale-codec", + "sc-client-api", + "sc-rpc-api", + "sc-transaction-pool-api", + "serde_json", + "sp-api", + "sp-block-builder", + "sp-blockchain", + "sp-core", + "sp-runtime", +] + +[[package]] +name = "substrate-prometheus-endpoint" +version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "futures-util", + "hyper", + "log", + "prometheus", + "thiserror", + "tokio", +] + +[[package]] +name = "substrate-state-trie-migration-rpc" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "jsonrpsee", + "log", + "parity-scale-codec", + "sc-client-api", + "sc-rpc-api", + "scale-info", + "serde", + "sp-core", + "sp-io", + "sp-runtime", + "sp-state-machine", + "sp-std", + "sp-trie", + "trie-db", +] + +[[package]] +name = "substrate-wasm-builder" +version = "5.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "ansi_term", + "build-helper", + "cargo_metadata", + "filetime", + "sp-maybe-compressed-blob", + "strum", + "tempfile", + "toml", + "walkdir", + "wasm-gc-api", +] + +[[package]] +name = "subtle" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" + +[[package]] +name = "syn" +version = "1.0.103" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a864042229133ada95abf3b54fdc62ef5ccabe9515b64717bcb9a1919e59445d" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "synstructure" +version = "0.12.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "unicode-xid", +] + +[[package]] +name = "system-configuration" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d75182f12f490e953596550b65ee31bda7c8e043d9386174b353bda50838c3fd" +dependencies = [ + "bitflags", + "core-foundation", + "system-configuration-sys", +] + +[[package]] +name = "system-configuration-sys" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "tap" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" + +[[package]] +name = "target-lexicon" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9410d0f6853b1d94f0e519fb95df60f29d2c1eff2d921ffdf01a4c8a3b54f12d" + +[[package]] +name = "tempfile" +version = "3.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4" +dependencies = [ + "cfg-if 1.0.0", + "fastrand", + "libc", + "redox_syscall", + "remove_dir_all", + "winapi", +] + +[[package]] +name = "termcolor" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "textwrap" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d" + +[[package]] +name = "thiserror" +version = "1.0.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10deb33631e3c9018b9baf9dcbbc4f737320d2b576bac10f6aefa048fa407e3e" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "982d17546b47146b28f7c22e3d08465f6b8903d0ea13c1660d9d84a6e7adcdbb" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "thousands" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3bf63baf9f5039dadc247375c29eb13706706cfde997d0330d05aa63a77d8820" + +[[package]] +name = "thread_local" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5516c27b78311c50bf42c071425c560ac799b11c30b31f87e3081965fe5e0180" +dependencies = [ + "once_cell", +] + +[[package]] +name = "threadpool" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d050e60b33d41c19108b32cea32164033a9013fe3b46cbd4457559bfbf77afaa" +dependencies = [ + "num_cpus", +] + +[[package]] +name = "thrift" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b82ca8f46f95b3ce96081fe3dd89160fdea970c254bb72925255d1b62aae692e" +dependencies = [ + "byteorder", + "integer-encoding", + "log", + "ordered-float", + "threadpool", +] + +[[package]] +name = "tikv-jemalloc-sys" +version = "0.4.3+5.2.1-patched.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1792ccb507d955b46af42c123ea8863668fae24d03721e40cad6a41773dbb49" +dependencies = [ + "cc", + "fs_extra", + "libc", +] + +[[package]] +name = "time" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255" +dependencies = [ + "libc", + "wasi 0.10.0+wasi-snapshot-preview1", + "winapi", +] + +[[package]] +name = "tiny-bip39" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffc59cb9dfc85bb312c3a78fd6aa8a8582e310b0fa885d5bb877f6dcc601839d" +dependencies = [ + "anyhow", + "hmac 0.8.1", + "once_cell", + "pbkdf2 0.4.0", + "rand 0.7.3", + "rustc-hash", + "sha2 0.9.9", + "thiserror", + "unicode-normalization", + "wasm-bindgen", + "zeroize", +] + +[[package]] +name = "tinyvec" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +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" +version = "1.21.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9e03c497dc955702ba729190dc4aac6f2a0ce97f913e5b1b5912fc5039d9099" +dependencies = [ + "autocfg", + "bytes", + "libc", + "memchr", + "mio", + "num_cpus", + "parking_lot 0.12.1", + "pin-project-lite 0.2.9", + "signal-hook-registry", + "socket2", + "tokio-macros", + "winapi", +] + +[[package]] +name = "tokio-macros" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9724f9a975fb987ef7a3cd9be0350edcbe130698af5b8f7a631e23d42d052484" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tokio-rustls" +version = "0.23.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c43ee83903113e03984cb9e5cebe6c04a5116269e900e3ddba8f068a62adda59" +dependencies = [ + "rustls", + "tokio", + "webpki", +] + +[[package]] +name = "tokio-stream" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d660770404473ccd7bc9f8b28494a811bc18542b915c0855c51e8f419d5223ce" +dependencies = [ + "futures-core", + "pin-project-lite 0.2.9", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bb2e075f03b3d66d8d8785356224ba688d2906a371015e225beeb65ca92c740" +dependencies = [ + "bytes", + "futures-core", + "futures-io", + "futures-sink", + "pin-project-lite 0.2.9", + "tokio", + "tracing", +] + +[[package]] +name = "toml" +version = "0.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7" +dependencies = [ + "serde", +] + +[[package]] +name = "tower-service" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" + +[[package]] +name = "tracing" +version = "0.1.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" +dependencies = [ + "cfg-if 1.0.0", + "pin-project-lite 0.2.9", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4017f8f45139870ca7e672686113917c71c7a6e02d4924eda67186083c03081a" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tracing-core" +version = "0.1.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24eb03ba0eab1fd845050058ce5e616558e8f8d8fca633e6b163fe25c797213a" +dependencies = [ + "once_cell", + "valuable", +] + +[[package]] +name = "tracing-futures" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2" +dependencies = [ + "pin-project", + "tracing", +] + +[[package]] +name = "tracing-gum" +version = "0.9.30" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +dependencies = [ + "polkadot-node-jaeger", + "polkadot-primitives", + "tracing", + "tracing-gum-proc-macro", +] + +[[package]] +name = "tracing-gum-proc-macro" +version = "0.9.30" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +dependencies = [ + "expander 0.0.6", + "proc-macro-crate", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tracing-log" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ddad33d2d10b1ed7eb9d1f518a5674713876e97e5bb9b7345a7984fbb4f922" +dependencies = [ + "lazy_static", + "log", + "tracing-core", +] + +[[package]] +name = "tracing-serde" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc6b213177105856957181934e4920de57730fc69bf42c37ee5bb664d406d9e1" +dependencies = [ + "serde", + "tracing-core", +] + +[[package]] +name = "tracing-subscriber" +version = "0.2.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e0d2eaa99c3c2e41547cfa109e910a68ea03823cccad4a0525dcbc9b01e8c71" +dependencies = [ + "ansi_term", + "chrono", + "lazy_static", + "matchers", + "parking_lot 0.11.2", + "regex", + "serde", + "serde_json", + "sharded-slab", + "smallvec", + "thread_local", + "tracing", + "tracing-core", + "tracing-log", + "tracing-serde", +] + +[[package]] +name = "trie-db" +version = "0.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "004e1e8f92535694b4cb1444dc5a8073ecf0815e3357f729638b9f8fc4062908" +dependencies = [ + "hash-db", + "hashbrown", + "log", + "rustc-hex", + "smallvec", +] + +[[package]] +name = "trie-root" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a36c5ca3911ed3c9a5416ee6c679042064b93fc637ded67e25f92e68d783891" +dependencies = [ + "hash-db", +] + +[[package]] +name = "trust-dns-proto" +version = "0.21.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c31f240f59877c3d4bb3b3ea0ec5a6a0cff07323580ff8c7a605cd7d08b255d" +dependencies = [ + "async-trait", + "cfg-if 1.0.0", + "data-encoding", + "enum-as-inner", + "futures-channel", + "futures-io", + "futures-util", + "idna 0.2.3", + "ipnet", + "lazy_static", + "log", + "rand 0.8.5", + "smallvec", + "thiserror", + "tinyvec", + "url", +] + +[[package]] +name = "trust-dns-resolver" +version = "0.21.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4ba72c2ea84515690c9fcef4c6c660bb9df3036ed1051686de84605b74fd558" +dependencies = [ + "cfg-if 1.0.0", + "futures-util", + "ipconfig", + "lazy_static", + "log", + "lru-cache", + "parking_lot 0.12.1", + "resolv-conf", + "smallvec", + "thiserror", + "trust-dns-proto", +] + +[[package]] +name = "try-lock" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" + +[[package]] +name = "try-runtime-cli" +version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "clap", + "frame-try-runtime", + "jsonrpsee", + "log", + "parity-scale-codec", + "remote-externalities", + "sc-chain-spec", + "sc-cli", + "sc-executor", + "sc-service", + "serde", + "sp-core", + "sp-externalities", + "sp-io", + "sp-keystore", + "sp-runtime", + "sp-state-machine", + "sp-version", + "zstd", +] + +[[package]] +name = "tt-call" +version = "1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e66dcbec4290c69dd03c57e76c2469ea5c7ce109c6dd4351c13055cf71ea055" + +[[package]] +name = "twox-hash" +version = "1.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" +dependencies = [ + "cfg-if 1.0.0", + "digest 0.10.5", + "rand 0.8.5", + "static_assertions", +] + +[[package]] +name = "typenum" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" + +[[package]] +name = "ucd-trie" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e79c4d996edb816c91e4308506774452e55e95c3c9de07b6729e17e15a5ef81" + +[[package]] +name = "uint" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a45526d29728d135c2900b0d30573fe3ee79fceb12ef534c7bb30e810a91b601" +dependencies = [ + "byteorder", + "crunchy", + "hex", + "static_assertions", +] + +[[package]] +name = "unicase" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6" +dependencies = [ + "version_check", +] + +[[package]] +name = "unicode-bidi" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992" + +[[package]] +name = "unicode-ident" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ceab39d59e4c9499d4e5a8ee0e2735b891bb7308ac83dfb4e80cad195c9f6f3" + +[[package]] +name = "unicode-normalization" +version = "0.1.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "unicode-width" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" + +[[package]] +name = "unicode-xid" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" + +[[package]] +name = "universal-hash" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f214e8f697e925001e66ec2c6e37a4ef93f0f78c2eed7814394e10c62025b05" +dependencies = [ + "generic-array 0.14.6", + "subtle", +] + +[[package]] +name = "unsigned-varint" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d86a8dc7f45e4c1b0d30e43038c38f274e77af056aa5f74b93c2cf9eb3c1c836" +dependencies = [ + "asynchronous-codec", + "bytes", + "futures-io", + "futures-util", +] + +[[package]] +name = "untrusted" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" + +[[package]] +name = "url" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d68c799ae75762b8c3fe375feb6600ef5602c883c5d21eb51c09f22b83c4643" +dependencies = [ + "form_urlencoded", + "idna 0.3.0", + "percent-encoding", +] + +[[package]] +name = "valuable" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" + +[[package]] +name = "value-bag" +version = "1.0.0-alpha.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2209b78d1249f7e6f3293657c9779fe31ced465df091bbd433a1cf88e916ec55" +dependencies = [ + "ctor", + "version_check", +] + +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + +[[package]] +name = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" + +[[package]] +name = "void" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" + +[[package]] +name = "waker-fn" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d5b2c62b4012a3e1eca5a7e077d13b3bf498c4073e33ccd58626607748ceeca" + +[[package]] +name = "walkdir" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56" +dependencies = [ + "same-file", + "winapi", + "winapi-util", +] + +[[package]] +name = "want" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" +dependencies = [ + "log", + "try-lock", +] + +[[package]] +name = "wasi" +version = "0.9.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" + +[[package]] +name = "wasi" +version = "0.10.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "wasm-bindgen" +version = "0.2.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eaf9f5aceeec8be17c128b2e93e031fb8a4d469bb9c4ae2d7dc1888b26887268" +dependencies = [ + "cfg-if 1.0.0", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c8ffb332579b0557b52d268b91feab8df3615f265d5270fec2a8c95b17c1142" +dependencies = [ + "bumpalo", + "log", + "once_cell", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23639446165ca5a5de86ae1d8896b737ae80319560fbaa4c2887b7da6e7ebd7d" +dependencies = [ + "cfg-if 1.0.0", + "js-sys", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "052be0f94026e6cbc75cdefc9bae13fd6052cdcaf532fa6c45e7ae33a1e6c810" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07bc0c051dc5f23e307b13285f9d75df86bfdf816c5721e573dec1f9b8aa193c" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f" + +[[package]] +name = "wasm-gc-api" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0c32691b6c7e6c14e7f8fd55361a9088b507aa49620fcd06c09b3a1082186b9" +dependencies = [ + "log", + "parity-wasm 0.32.0", + "rustc-demangle", +] + +[[package]] +name = "wasm-instrument" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa1dafb3e60065305741e83db35c6c2584bb3725b692b5b66148a38d72ace6cd" +dependencies = [ + "parity-wasm 0.45.0", +] + +[[package]] +name = "wasm-timer" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be0ecb0db480561e9a7642b5d3e4187c128914e58aa84330b9493e3eb68c5e7f" +dependencies = [ + "futures", + "js-sys", + "parking_lot 0.11.2", + "pin-utils", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + +[[package]] +name = "wasmi" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06c326c93fbf86419608361a2c925a31754cf109da1b8b55737070b4d6669422" +dependencies = [ + "parity-wasm 0.45.0", + "wasmi-validation", + "wasmi_core", +] + +[[package]] +name = "wasmi-validation" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91ff416ad1ff0c42e5a926ed5d5fab74c0f098749aa0ad8b2a34b982ce0e867b" +dependencies = [ + "parity-wasm 0.45.0", +] + +[[package]] +name = "wasmi_core" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57d20cb3c59b788653d99541c646c561c9dd26506f25c0cebfe810659c54c6d7" +dependencies = [ + "downcast-rs", + "libm", + "memory_units", + "num-rational 0.4.1", + "num-traits", +] + +[[package]] +name = "wasmparser" +version = "0.89.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab5d3e08b13876f96dd55608d03cd4883a0545884932d5adf11925876c96daef" +dependencies = [ + "indexmap", +] + +[[package]] +name = "wasmtime" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1f511c4917c83d04da68333921107db75747c4e11a2f654a8e909cc5e0520dc" +dependencies = [ + "anyhow", + "bincode", + "cfg-if 1.0.0", + "indexmap", + "libc", + "log", + "object", + "once_cell", + "paste", + "psm", + "rayon", + "serde", + "target-lexicon", + "wasmparser", + "wasmtime-cache", + "wasmtime-cranelift", + "wasmtime-environ", + "wasmtime-jit", + "wasmtime-runtime", + "windows-sys 0.36.1", +] + +[[package]] +name = "wasmtime-asm-macros" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39bf3debfe744bf19dd3732990ce6f8c0ced7439e2370ba4e1d8f5a3660a3178" +dependencies = [ + "cfg-if 1.0.0", +] + +[[package]] +name = "wasmtime-cache" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ece42fa4676a263f7558cdaaf5a71c2592bebcbac22a0580e33cf3406c103da2" +dependencies = [ + "anyhow", + "base64", + "bincode", + "directories-next", + "file-per-thread-logger", + "log", + "rustix", + "serde", + "sha2 0.9.9", + "toml", + "windows-sys 0.36.1", + "zstd", +] + +[[package]] +name = "wasmtime-cranelift" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "058217e28644b012bdcdf0e445f58d496d78c2e0b6a6dd93558e701591dad705" +dependencies = [ + "anyhow", + "cranelift-codegen", + "cranelift-entity", + "cranelift-frontend", + "cranelift-native", + "cranelift-wasm", + "gimli", + "log", + "object", + "target-lexicon", + "thiserror", + "wasmparser", + "wasmtime-environ", +] + +[[package]] +name = "wasmtime-environ" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7af06848df28b7661471d9a80d30a973e0f401f2e3ed5396ad7e225ed217047" +dependencies = [ + "anyhow", + "cranelift-entity", + "gimli", + "indexmap", + "log", + "object", + "serde", + "target-lexicon", + "thiserror", + "wasmparser", + "wasmtime-types", +] + +[[package]] +name = "wasmtime-jit" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9028fb63a54185b3c192b7500ef8039c7bb8d7f62bfc9e7c258483a33a3d13bb" +dependencies = [ + "addr2line", + "anyhow", + "bincode", + "cfg-if 1.0.0", + "cpp_demangle", + "gimli", + "log", + "object", + "rustc-demangle", + "rustix", + "serde", + "target-lexicon", + "thiserror", + "wasmtime-environ", + "wasmtime-jit-debug", + "wasmtime-runtime", + "windows-sys 0.36.1", +] + +[[package]] +name = "wasmtime-jit-debug" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25e82d4ef93296785de7efca92f7679dc67fe68a13b625a5ecc8d7503b377a37" +dependencies = [ + "object", + "once_cell", + "rustix", +] + +[[package]] +name = "wasmtime-runtime" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f0e9bea7d517d114fe66b930b2124ee086516ee93eeebfd97f75f366c5b0553" +dependencies = [ + "anyhow", + "cc", + "cfg-if 1.0.0", + "indexmap", + "libc", + "log", + "mach", + "memfd", + "memoffset", + "paste", + "rand 0.8.5", + "rustix", + "thiserror", + "wasmtime-asm-macros", + "wasmtime-environ", + "wasmtime-jit-debug", + "windows-sys 0.36.1", +] + +[[package]] +name = "wasmtime-types" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69b83e93ed41b8fdc936244cfd5e455480cf1eca1fd60c78a0040038b4ce5075" +dependencies = [ + "cranelift-entity", + "serde", + "thiserror", + "wasmparser", +] + +[[package]] +name = "web-sys" +version = "0.3.60" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bcda906d8be16e728fd5adc5b729afad4e444e106ab28cd1c7256e54fa61510f" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "webpki" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f095d78192e208183081cc07bc5515ef55216397af48b873e5edcd72637fa1bd" +dependencies = [ + "ring", + "untrusted", +] + +[[package]] +name = "webpki-roots" +version = "0.22.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "368bfe657969fb01238bb756d351dcade285e0f6fcbd36dcb23359a5169975be" +dependencies = [ + "webpki", +] + +[[package]] +name = "wepoll-ffi" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d743fdedc5c64377b5fc2bc036b01c7fd642205a0d96356034ae3404d49eb7fb" +dependencies = [ + "cc", +] + +[[package]] +name = "westend-runtime" +version = "0.9.30" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +dependencies = [ + "beefy-primitives", + "bitvec", + "frame-benchmarking", + "frame-election-provider-support", + "frame-executive", + "frame-support", + "frame-system", + "frame-system-benchmarking", + "frame-system-rpc-runtime-api", + "frame-try-runtime", + "hex-literal", + "log", + "pallet-authority-discovery", + "pallet-authorship", + "pallet-babe", + "pallet-bags-list", + "pallet-balances", + "pallet-collective", + "pallet-democracy", + "pallet-election-provider-multi-phase", + "pallet-election-provider-support-benchmarking", + "pallet-elections-phragmen", + "pallet-fast-unstake", + "pallet-grandpa", + "pallet-identity", + "pallet-im-online", + "pallet-indices", + "pallet-membership", + "pallet-multisig", + "pallet-nomination-pools", + "pallet-nomination-pools-benchmarking", + "pallet-nomination-pools-runtime-api", + "pallet-offences", + "pallet-offences-benchmarking", + "pallet-preimage", + "pallet-proxy", + "pallet-recovery", + "pallet-scheduler", + "pallet-session", + "pallet-session-benchmarking", + "pallet-society", + "pallet-staking", + "pallet-staking-reward-curve", + "pallet-sudo", + "pallet-timestamp", + "pallet-transaction-payment", + "pallet-transaction-payment-rpc-runtime-api", + "pallet-treasury", + "pallet-utility", + "pallet-vesting", + "pallet-xcm", + "pallet-xcm-benchmarks", + "parity-scale-codec", + "polkadot-parachain", + "polkadot-primitives", + "polkadot-runtime-common", + "polkadot-runtime-parachains", + "rustc-hex", + "scale-info", + "serde", + "serde_derive", + "smallvec", + "sp-api", + "sp-authority-discovery", + "sp-block-builder", + "sp-consensus-babe", + "sp-core", + "sp-inherents", + "sp-io", + "sp-mmr-primitives", + "sp-npos-elections", + "sp-offchain", + "sp-runtime", + "sp-session", + "sp-staking", + "sp-std", + "sp-transaction-pool", + "sp-version", + "substrate-wasm-builder", + "westend-runtime-constants", + "xcm", + "xcm-builder", + "xcm-executor", +] + +[[package]] +name = "westend-runtime-constants" +version = "0.9.30" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +dependencies = [ + "frame-support", + "polkadot-primitives", + "polkadot-runtime-common", + "smallvec", + "sp-runtime", +] + +[[package]] +name = "which" +version = "4.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c831fbbee9e129a8cf93e7747a82da9d95ba8e16621cae60ec2cdc849bacb7b" +dependencies = [ + "either", + "libc", + "once_cell", +] + +[[package]] +name = "widestring" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17882f045410753661207383517a6f62ec3dbeb6a4ed2acce01f0728238d1983" + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-util" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +dependencies = [ + "winapi", +] + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows" +version = "0.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45296b64204227616fdbf2614cefa4c236b98ee64dfaaaa435207ed99fe7829f" +dependencies = [ + "windows_aarch64_msvc 0.34.0", + "windows_i686_gnu 0.34.0", + "windows_i686_msvc 0.34.0", + "windows_x86_64_gnu 0.34.0", + "windows_x86_64_msvc 0.34.0", +] + +[[package]] +name = "windows-sys" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2" +dependencies = [ + "windows_aarch64_msvc 0.36.1", + "windows_i686_gnu 0.36.1", + "windows_i686_msvc 0.36.1", + "windows_x86_64_gnu 0.36.1", + "windows_x86_64_msvc 0.36.1", +] + +[[package]] +name = "windows-sys" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc 0.42.0", + "windows_i686_gnu 0.42.0", + "windows_i686_msvc 0.42.0", + "windows_x86_64_gnu 0.42.0", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc 0.42.0", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d2aa71f6f0cbe00ae5167d90ef3cfe66527d6f613ca78ac8024c3ccab9a19e" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17cffbe740121affb56fad0fc0e421804adf0ae00891205213b5cecd30db881d" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4" + +[[package]] +name = "windows_i686_gnu" +version = "0.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2564fde759adb79129d9b4f54be42b32c89970c18ebf93124ca8870a498688ed" + +[[package]] +name = "windows_i686_gnu" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" + +[[package]] +name = "windows_i686_gnu" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbeae19f6716841636c28d695375df17562ca208b2b7d0dc47635a50ae6c5de7" + +[[package]] +name = "windows_i686_msvc" +version = "0.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9cd9d32ba70453522332c14d38814bceeb747d80b3958676007acadd7e166956" + +[[package]] +name = "windows_i686_msvc" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" + +[[package]] +name = "windows_i686_msvc" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84c12f65daa39dd2babe6e442988fc329d6243fdce47d7d2d155b8d874862246" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfce6deae227ee8d356d19effc141a509cc503dfd1f850622ec4b0f84428e1f4" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf7b1b21b5362cbc318f686150e5bcea75ecedc74dd157d874d754a2ca44b0ed" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09d525d2ba30eeb3297665bd434a54297e4170c7f1a44cad4ef58095b4cd2028" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d19538ccc21819d01deaf88d6a17eae6596a12e9aafdbb97916fb49896d89de9" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5" + +[[package]] +name = "winreg" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0120db82e8a1e0b9fb3345a539c478767c0048d842860994d96113d5b667bd69" +dependencies = [ + "winapi", +] + +[[package]] +name = "wyz" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30b31594f29d27036c383b53b59ed3476874d518f0efb151b27a4c275141390e" +dependencies = [ + "tap", +] + +[[package]] +name = "x25519-dalek" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a0c105152107e3b96f6a00a65e86ce82d9b125230e1c4302940eca58ff71f4f" +dependencies = [ + "curve25519-dalek 3.2.0", + "rand_core 0.5.1", + "zeroize", +] + +[[package]] +name = "xcm" +version = "0.9.30" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +dependencies = [ + "derivative", + "impl-trait-for-tuples", + "log", + "parity-scale-codec", + "scale-info", + "sp-runtime", + "xcm-procedural", +] + +[[package]] +name = "xcm-builder" +version = "0.9.30" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +dependencies = [ + "frame-support", + "frame-system", + "log", + "pallet-transaction-payment", + "parity-scale-codec", + "polkadot-parachain", + "scale-info", + "sp-arithmetic", + "sp-io", + "sp-runtime", + "sp-std", + "xcm", + "xcm-executor", +] + +[[package]] +name = "xcm-executor" +version = "0.9.30" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +dependencies = [ + "frame-benchmarking", + "frame-support", + "impl-trait-for-tuples", + "log", + "parity-scale-codec", + "sp-arithmetic", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", + "xcm", +] + +[[package]] +name = "xcm-procedural" +version = "0.9.30" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +dependencies = [ + "Inflector", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "yamux" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5d9ba232399af1783a58d8eb26f6b5006fbefe2dc9ef36bd283324792d03ea5" +dependencies = [ + "futures", + "log", + "nohash-hasher", + "parking_lot 0.12.1", + "rand 0.8.5", + "static_assertions", +] + +[[package]] +name = "zeroize" +version = "1.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c394b5bd0c6f669e7275d9c20aa90ae064cb22e75a1cad54e1b34088034b149f" +dependencies = [ + "zeroize_derive", +] + +[[package]] +name = "zeroize_derive" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f8f187641dad4f680d25c4bfc4225b418165984179f26ca76ec4fb6441d3a17" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "zstd" +version = "0.11.2+zstd.1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20cc960326ece64f010d2d2107537f26dc589a6573a316bd5b1dba685fa5fde4" +dependencies = [ + "zstd-safe", +] + +[[package]] +name = "zstd-safe" +version = "5.0.2+zstd.1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d2a5585e04f9eea4b2a3d1eca508c4dee9592a89ef6f450c11719da0726f4db" +dependencies = [ + "libc", + "zstd-sys", +] + +[[package]] +name = "zstd-sys" +version = "2.0.1+zstd.1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fd07cbbc53846d9145dbffdf6dd09a7a0aa52be46741825f5c97bdd4f73f12b" +dependencies = [ + "cc", + "libc", +] diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 000000000..b13f7f83a --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,9 @@ +[profile.release] +panic = "unwind" + +[workspace] +members = [ + "core/*", + "node", + "runtime", +] diff --git a/core/primitives/Cargo.toml b/core/primitives/Cargo.toml new file mode 100644 index 000000000..e080680fd --- /dev/null +++ b/core/primitives/Cargo.toml @@ -0,0 +1,21 @@ +[package] +authors = ["Darwinia Network "] +description = "Darwinia chain core primitives." +edition = "2021" +homepage = "https://darwinia.network" +license = "GPL-3.0" +name = "dc-primitives" +readme = "README.md" +repository = "https://github.com/darwinia-network/darwinia" +version = "6.0.0" + +[dependencies] +sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } + +[features] +default = ["std"] +std = [ + "sp-core/std", + "sp-runtime/std", +] diff --git a/core/primitives/src/lib.rs b/core/primitives/src/lib.rs new file mode 100644 index 000000000..319717e9e --- /dev/null +++ b/core/primitives/src/lib.rs @@ -0,0 +1,96 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Darwinia chain core primitives. +//! +//! # Opaque types. +//! These are used by the CLI to instantiate machinery that don't need to know +//! the specifics of the runtime. They can then be made to be agnostic over specific formats +//! of data like extrinsics, allowing for them to continue syncing the network through upgrades +//! to even the core data structures. + +#![cfg_attr(not(feature = "std"), no_std)] +#![deny(missing_docs)] + +/// Alias to 512-bit hash when used in the context of a transaction signature on the chain. +pub type Signature = sp_runtime::MultiSignature; + +/// Some way of identifying an account on the chain. +/// We intentionally make it equivalent to the public key of our transaction signing scheme. +pub type AccountId = <::Signer as sp_runtime::traits::IdentifyAccount>::AccountId; + +/// Balance of an account. +pub type Balance = u128; + +/// Index of a transaction in the chain. +pub type Index = u32; + +/// Nonce of an account in the chain. +pub type Nonce = u32; + +/// A hash of some data used by the chain. +pub type Hash = sp_core::H256; + +/// An index to a block. +pub type BlockNumber = u32; + +/// The address format for describing accounts. +pub type Address = sp_runtime::MultiAddress; + +/// Block header type. +pub type Header = sp_runtime::generic::Header; + +/// Block type. +pub type Block = sp_runtime::generic::Block; + +/// This determines the average expected block time that we are targeting. +/// Blocks will be produced at a minimum duration defined by `SLOT_DURATION`. +/// `SLOT_DURATION` is picked up by `pallet_timestamp` which is in turn picked +/// up by `pallet_aura` to implement `fn slot_duration()`. +/// +/// Change this to adjust the block time. +pub const MILLISECS_PER_BLOCK: u64 = 6_000; + +// NOTE: Currently it is not possible to change the slot duration after the chain has started. +// Attempting to do so will brick block production. +/// Slot duration. +pub const SLOT_DURATION: u64 = MILLISECS_PER_BLOCK; + +// Time is measured by number of blocks. +/// 10 blocks. +pub const MINUTES: BlockNumber = 60_000 / (MILLISECS_PER_BLOCK as BlockNumber); +/// 600 blocks. +pub const HOURS: BlockNumber = MINUTES * 60; +/// 14,400 blocks. +pub const DAYS: BlockNumber = HOURS * 24; + +// Unit = the base number of indivisible units for balances +/// 1e18 wei — 1,000,000,000,000,000,000 +pub const UNIT: Balance = 1_000 * MILLIUNIT; +/// 1e15 wei — 1,000,000,000,000,000 +pub const MILLIUNIT: Balance = 1_000 * MICROUNIT; +/// 1e12 wei — 1,000,000,000,000 +pub const MICROUNIT: Balance = 1_000 * GWEI; +/// 1e9 wei — 1,000,000,000 +pub const GWEI: Balance = 1_000 * MWEI; +/// 1e6 wei — 1,000,000 +pub const MWEI: Balance = 1_000 * KWEI; +/// 1e3 wei — 1,000 +pub const KWEI: Balance = 1_000 * WEI; +/// 1 wei — 1 +pub const WEI: Balance = 1; diff --git a/node/Cargo.toml b/node/Cargo.toml new file mode 100644 index 000000000..4d685bb9c --- /dev/null +++ b/node/Cargo.toml @@ -0,0 +1,113 @@ +[package] +authors = ["Darwinia Network "] +description = "Darwinia node." +edition = "2021" +homepage = "https://darwinia.network" +license = "GPL-3.0" +name = "darwinia" +readme = "README.md" +repository = "https://github.com/darwinia-network/darwinia" +version = "6.0.0" + +[build-dependencies] +substrate-build-script-utils = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } + +[dependencies] +# crates.io +clap = { version = "3.2", features = ["derive"] } +codec = { package = "parity-scale-codec", version = "3.2" } +jsonrpsee = { version = "0.15", features = ["server"] } +log = { version = "0.4" } +serde = { version = "1.0", features = ["derive"] } + +# cumulus +cumulus-client-cli = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.30" } +cumulus-client-collator = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.30" } +cumulus-client-consensus-aura = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.30" } +cumulus-client-consensus-common = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.30" } +cumulus-client-network = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.30" } +cumulus-client-service = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.30" } +cumulus-primitives-core = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.30" } +cumulus-primitives-parachain-inherent = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.30" } +cumulus-relay-chain-inprocess-interface = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.30" } +cumulus-relay-chain-interface = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.30" } +cumulus-relay-chain-rpc-interface = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.30" } + +# darwinia +darwinia-runtime = { path = "../runtime" } +dc-primitives = { path = "../core/primitives" } + +# polkadot +polkadot-cli = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" } +polkadot-parachain = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" } +polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" } +polkadot-service = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" } +xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" } + +# substrate +frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +frame-benchmarking-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-transaction-payment-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sc-basic-authorship = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sc-chain-spec = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sc-cli = { features = ["wasmtime"], git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sc-executor = { features = ["wasmtime"], git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sc-keystore = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sc-network = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sc-network-common = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sc-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sc-rpc-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sc-service = { features = ["wasmtime"], git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sc-sysinfo = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sc-telemetry = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sc-tracing = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sc-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sc-transaction-pool-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-block-builder = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-consensus = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-consensus-aura = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-inherents = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-offchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-session = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +substrate-frame-rpc-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +substrate-prometheus-endpoint = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +try-runtime-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } + +[features] +default = [] + +runtime-benchmarks = [ + # darwinia + "darwinia-runtime/runtime-benchmarks", + + # polkadot + "polkadot-cli/runtime-benchmarks", +] + +try-runtime = [ + # darwinia + "darwinia-runtime/try-runtime", +] + +all-native = [ + # darwinia + "kusama-native", + "rococo-native", +] +kusama-native = [ + # polkadot + "polkadot-cli/kusama-native", +] +rococo-native = [ + # polkadot + "polkadot-cli/rococo-native", +] diff --git a/node/build.rs b/node/build.rs new file mode 100644 index 000000000..5aa5f33a2 --- /dev/null +++ b/node/build.rs @@ -0,0 +1,22 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +fn main() { + substrate_build_script_utils::generate_cargo_keys(); + substrate_build_script_utils::rerun_if_git_head_changed(); +} diff --git a/node/src/chain_spec.rs b/node/src/chain_spec.rs new file mode 100644 index 000000000..d4bfe77d2 --- /dev/null +++ b/node/src/chain_spec.rs @@ -0,0 +1,244 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +#![allow(clippy::derive_partial_eq_without_eq)] + +// crates.io +use serde::{Deserialize, Serialize}; +// cumulus +use cumulus_primitives_core::ParaId; +// darwinia +use darwinia_runtime::{AuraId, EXISTENTIAL_DEPOSIT}; +use dc_primitives::*; +// substrate +use sc_chain_spec::{ChainSpecExtension, ChainSpecGroup}; +use sc_service::ChainType; +use sp_core::{sr25519, Pair, Public}; +use sp_runtime::traits::{IdentifyAccount, Verify}; + +/// Specialized `ChainSpec` for the normal parachain runtime. +pub type ChainSpec = sc_service::GenericChainSpec; + +/// The default XCM version to set in genesis config. +const SAFE_XCM_VERSION: u32 = xcm::prelude::XCM_VERSION; + +/// Helper function to generate a crypto pair from seed +pub fn get_from_seed(seed: &str) -> ::Public { + TPublic::Pair::from_string(&format!("//{}", seed), None) + .expect("static values are valid; qed") + .public() +} + +/// The extensions for the [`ChainSpec`]. +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, ChainSpecGroup, ChainSpecExtension)] +#[serde(deny_unknown_fields)] +pub struct Extensions { + /// The relay chain of the Parachain. + pub relay_chain: String, + /// The id of the Parachain. + pub para_id: u32, +} +impl Extensions { + /// Try to get the extension from the given `ChainSpec`. + pub fn try_get(chain_spec: &dyn sc_service::ChainSpec) -> Option<&Self> { + sc_chain_spec::get_extension(chain_spec.extensions()) + } +} + +type AccountPublic = ::Signer; + +/// Generate collator keys from seed. +/// +/// This function's return type must always match the session keys of the chain in tuple format. +pub fn get_collator_keys_from_seed(seed: &str) -> AuraId { + get_from_seed::(seed) +} + +/// Helper function to generate an account ID from seed +pub fn get_account_id_from_seed(seed: &str) -> AccountId +where + AccountPublic: From<::Public>, +{ + AccountPublic::from(get_from_seed::(seed)).into_account() +} + +/// Generate the session keys from individual elements. +/// +/// The input must be a tuple of individual keys (a single arg for now since we have just one key). +pub fn session_keys(keys: AuraId) -> darwinia_runtime::SessionKeys { + darwinia_runtime::SessionKeys { aura: keys } +} + +pub fn development_config() -> ChainSpec { + // Give your base currency a unit name and decimal places + let mut properties = sc_chain_spec::Properties::new(); + properties.insert("tokenSymbol".into(), "UNIT".into()); + properties.insert("tokenDecimals".into(), 18.into()); + properties.insert("ss58Format".into(), 18.into()); + + ChainSpec::from_genesis( + // Name + "Development", + // ID + "dev", + ChainType::Development, + move || { + testnet_genesis( + // initial collators. + vec![ + ( + get_account_id_from_seed::("Alice"), + get_collator_keys_from_seed("Alice"), + ), + ( + get_account_id_from_seed::("Bob"), + get_collator_keys_from_seed("Bob"), + ), + ], + vec![ + get_account_id_from_seed::("Alice"), + get_account_id_from_seed::("Bob"), + get_account_id_from_seed::("Charlie"), + get_account_id_from_seed::("Dave"), + get_account_id_from_seed::("Eve"), + get_account_id_from_seed::("Ferdie"), + get_account_id_from_seed::("Alice//stash"), + get_account_id_from_seed::("Bob//stash"), + get_account_id_from_seed::("Charlie//stash"), + get_account_id_from_seed::("Dave//stash"), + get_account_id_from_seed::("Eve//stash"), + get_account_id_from_seed::("Ferdie//stash"), + ], + 1000.into(), + ) + }, + Vec::new(), + None, + None, + None, + None, + Extensions { + relay_chain: "rococo-local".into(), // You MUST set this to the correct network! + para_id: 1000, + }, + ) +} + +pub fn local_testnet_config() -> ChainSpec { + // Give your base currency a unit name and decimal places + let mut properties = sc_chain_spec::Properties::new(); + properties.insert("tokenSymbol".into(), "UNIT".into()); + properties.insert("tokenDecimals".into(), 18.into()); + properties.insert("ss58Format".into(), 18.into()); + + ChainSpec::from_genesis( + // Name + "Local Testnet", + // ID + "local_testnet", + ChainType::Local, + move || { + testnet_genesis( + // initial collators. + vec![ + ( + get_account_id_from_seed::("Alice"), + get_collator_keys_from_seed("Alice"), + ), + ( + get_account_id_from_seed::("Bob"), + get_collator_keys_from_seed("Bob"), + ), + ], + vec![ + get_account_id_from_seed::("Alice"), + get_account_id_from_seed::("Bob"), + get_account_id_from_seed::("Charlie"), + get_account_id_from_seed::("Dave"), + get_account_id_from_seed::("Eve"), + get_account_id_from_seed::("Ferdie"), + get_account_id_from_seed::("Alice//stash"), + get_account_id_from_seed::("Bob//stash"), + get_account_id_from_seed::("Charlie//stash"), + get_account_id_from_seed::("Dave//stash"), + get_account_id_from_seed::("Eve//stash"), + get_account_id_from_seed::("Ferdie//stash"), + ], + 1000.into(), + ) + }, + // Bootnodes + Vec::new(), + // Telemetry + None, + // Protocol ID + Some("darwinia"), + // Fork ID + None, + // Properties + Some(properties), + // Extensions + Extensions { + relay_chain: "rococo-local".into(), // You MUST set this to the correct network! + para_id: 1000, + }, + ) +} + +fn testnet_genesis( + invulnerables: Vec<(AccountId, AuraId)>, + endowed_accounts: Vec, + id: ParaId, +) -> darwinia_runtime::GenesisConfig { + darwinia_runtime::GenesisConfig { + system: darwinia_runtime::SystemConfig { + code: darwinia_runtime::WASM_BINARY + .expect("WASM binary was not build, please build it!") + .to_vec(), + }, + balances: darwinia_runtime::BalancesConfig { + balances: endowed_accounts.iter().cloned().map(|k| (k, 1 << 60)).collect(), + }, + parachain_info: darwinia_runtime::ParachainInfoConfig { parachain_id: id }, + collator_selection: darwinia_runtime::CollatorSelectionConfig { + invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(), + candidacy_bond: EXISTENTIAL_DEPOSIT * 16, + ..Default::default() + }, + session: darwinia_runtime::SessionConfig { + keys: invulnerables + .into_iter() + .map(|(acc, aura)| { + ( + acc.clone(), // account id + acc, // validator id + session_keys(aura), // session keys + ) + }) + .collect(), + }, + // no need to pass anything to aura, in fact it will panic if we do. Session will take care + // of this. + aura: Default::default(), + aura_ext: Default::default(), + parachain_system: Default::default(), + polkadot_xcm: darwinia_runtime::PolkadotXcmConfig { + safe_xcm_version: Some(SAFE_XCM_VERSION), + }, + } +} diff --git a/node/src/cli.rs b/node/src/cli.rs new file mode 100644 index 000000000..1a45276f9 --- /dev/null +++ b/node/src/cli.rs @@ -0,0 +1,111 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// std +use std::path::PathBuf; + +/// Sub-commands supported by the collator. +#[derive(Debug, clap::Subcommand)] +pub enum Subcommand { + /// Build a chain specification. + BuildSpec(sc_cli::BuildSpecCmd), + + /// Validate blocks. + CheckBlock(sc_cli::CheckBlockCmd), + + /// Export blocks. + ExportBlocks(sc_cli::ExportBlocksCmd), + + /// Export the state of a given block into a chain spec. + ExportState(sc_cli::ExportStateCmd), + + /// Import blocks. + ImportBlocks(sc_cli::ImportBlocksCmd), + + /// Revert the chain to a previous state. + Revert(sc_cli::RevertCmd), + + /// Remove the whole chain. + PurgeChain(cumulus_client_cli::PurgeChainCmd), + + /// Export the genesis state of the parachain. + ExportGenesisState(cumulus_client_cli::ExportGenesisStateCommand), + + /// Export the genesis wasm of the parachain. + ExportGenesisWasm(cumulus_client_cli::ExportGenesisWasmCommand), + + /// Sub-commands concerned with benchmarking. + /// The pallet benchmarking moved to the `pallet` sub-command. + #[clap(subcommand)] + Benchmark(frame_benchmarking_cli::BenchmarkCmd), + + /// Try some testing command against a specified runtime state. + TryRuntime(try_runtime_cli::TryRuntimeCmd), +} + +#[derive(Debug, clap::Parser)] +#[clap( + propagate_version = true, + args_conflicts_with_subcommands = true, + subcommand_negates_reqs = true +)] +pub struct Cli { + #[clap(subcommand)] + pub subcommand: Option, + + #[clap(flatten)] + pub run: cumulus_client_cli::RunCmd, + + /// Disable automatic hardware benchmarks. + /// + /// By default these benchmarks are automatically ran at startup and measure + /// the CPU speed, the memory bandwidth and the disk speed. + /// + /// The results are then printed out in the logs, and also sent as part of + /// telemetry, if telemetry is enabled. + #[clap(long)] + pub no_hardware_benchmarks: bool, + + /// Relay chain arguments + #[clap(raw = true)] + pub relay_chain_args: Vec, +} + +#[derive(Debug)] +pub struct RelayChainCli { + /// The actual relay chain cli object. + pub base: polkadot_cli::RunCmd, + + /// Optional chain id that should be passed to the relay chain. + pub chain_id: Option, + + /// The base path that should be used by the relay chain. + pub base_path: Option, +} +impl RelayChainCli { + /// Parse the relay chain CLI parameters using the para chain `Configuration`. + pub fn new<'a>( + para_config: &sc_service::Configuration, + relay_chain_args: impl Iterator, + ) -> Self { + let extension = crate::chain_spec::Extensions::try_get(&*para_config.chain_spec); + let chain_id = extension.map(|e| e.relay_chain.clone()); + let base_path = para_config.base_path.as_ref().map(|x| x.path().join("polkadot")); + Self { base_path, chain_id, base: clap::Parser::parse_from(relay_chain_args) } + } +} diff --git a/node/src/command.rs b/node/src/command.rs new file mode 100644 index 000000000..9565e73b6 --- /dev/null +++ b/node/src/command.rs @@ -0,0 +1,472 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// std +use std::net::SocketAddr; +// crates.io +use codec::Encode; +use log::info; +// cumulus +use cumulus_primitives_core::ParaId; +// darwinia +use crate::{ + chain_spec, + cli::{Cli, RelayChainCli, Subcommand}, + service::{self, DarwiniaRuntimeExecutor}, +}; +use darwinia_runtime::{Block, RuntimeApi}; +// substrate +use frame_benchmarking_cli::{BenchmarkCmd, SUBSTRATE_REFERENCE_HARDWARE}; +use sc_cli::{ + ChainSpec, CliConfiguration, DefaultConfigurationValues, ImportParams, KeystoreParams, + NetworkParams, Result, RuntimeVersion, SharedParams, SubstrateCli, +}; +use sc_service::{ + config::{BasePath, PrometheusConfig}, + TaskManager, +}; +use sp_core::hexdisplay::HexDisplay; +use sp_runtime::traits::{AccountIdConversion, Block as BlockT}; + +fn load_spec(id: &str) -> std::result::Result, String> { + Ok(match id { + "dev" => Box::new(chain_spec::development_config()), + "" | "local" => Box::new(chain_spec::local_testnet_config()), + path => Box::new(chain_spec::ChainSpec::from_json_file(std::path::PathBuf::from(path))?), + }) +} + +impl SubstrateCli for Cli { + fn impl_name() -> String { + "Darwinia".into() + } + + fn impl_version() -> String { + env!("SUBSTRATE_CLI_IMPL_VERSION").into() + } + + fn description() -> String { + format!( + "Darwinia\n\nThe command-line arguments provided first will be \ + passed to the parachain node, while the arguments provided after -- will be passed \ + to the relay chain node.\n\n\ + {} -- ", + Self::executable_name() + ) + } + + fn author() -> String { + env!("CARGO_PKG_AUTHORS").into() + } + + fn support_url() -> String { + "https://github.com/paritytech/cumulus/issues/new".into() + } + + fn copyright_start_year() -> i32 { + 2020 + } + + fn load_spec(&self, id: &str) -> std::result::Result, String> { + load_spec(id) + } + + fn native_runtime_version(_: &Box) -> &'static RuntimeVersion { + &darwinia_runtime::VERSION + } +} + +impl SubstrateCli for RelayChainCli { + fn impl_name() -> String { + "Darwinia".into() + } + + fn impl_version() -> String { + env!("SUBSTRATE_CLI_IMPL_VERSION").into() + } + + fn description() -> String { + format!( + "Darwinia\n\nThe command-line arguments provided first will be \ + passed to the parachain node, while the arguments provided after -- will be passed \ + to the relay chain node.\n\n\ + {} -- ", + Self::executable_name() + ) + } + + fn author() -> String { + env!("CARGO_PKG_AUTHORS").into() + } + + fn support_url() -> String { + "https://github.com/paritytech/cumulus/issues/new".into() + } + + fn copyright_start_year() -> i32 { + 2020 + } + + fn load_spec(&self, id: &str) -> std::result::Result, String> { + polkadot_cli::Cli::from_iter([RelayChainCli::executable_name()].iter()).load_spec(id) + } + + fn native_runtime_version(chain_spec: &Box) -> &'static RuntimeVersion { + polkadot_cli::Cli::native_runtime_version(chain_spec) + } +} + +macro_rules! construct_async_run { + (|$components:ident, $cli:ident, $cmd:ident, $config:ident| $( $code:tt )* ) => {{ + let runner = $cli.create_runner($cmd)?; + runner.async_run(|$config| { + let $components = service::new_partial::< + RuntimeApi, + DarwiniaRuntimeExecutor, + _ + >( + &$config, + crate::service::parachain_build_import_queue, + )?; + let task_manager = $components.task_manager; + { $( $code )* }.map(|v| (v, task_manager)) + }) + }} +} + +/// Parse command line arguments into service configuration. +pub fn run() -> Result<()> { + let cli = Cli::from_args(); + + match &cli.subcommand { + Some(Subcommand::BuildSpec(cmd)) => { + let runner = cli.create_runner(cmd)?; + runner.sync_run(|config| cmd.run(config.chain_spec, config.network)) + }, + Some(Subcommand::CheckBlock(cmd)) => { + construct_async_run!(|components, cli, cmd, config| { + Ok(cmd.run(components.client, components.import_queue)) + }) + }, + Some(Subcommand::ExportBlocks(cmd)) => { + construct_async_run!(|components, cli, cmd, config| { + Ok(cmd.run(components.client, config.database)) + }) + }, + Some(Subcommand::ExportState(cmd)) => { + construct_async_run!(|components, cli, cmd, config| { + Ok(cmd.run(components.client, config.chain_spec)) + }) + }, + Some(Subcommand::ImportBlocks(cmd)) => { + construct_async_run!(|components, cli, cmd, config| { + Ok(cmd.run(components.client, components.import_queue)) + }) + }, + Some(Subcommand::Revert(cmd)) => { + construct_async_run!(|components, cli, cmd, config| { + Ok(cmd.run(components.client, components.backend, None)) + }) + }, + Some(Subcommand::PurgeChain(cmd)) => { + let runner = cli.create_runner(cmd)?; + + runner.sync_run(|config| { + let polkadot_cli = RelayChainCli::new( + &config, + [RelayChainCli::executable_name()].iter().chain(cli.relay_chain_args.iter()), + ); + + let polkadot_config = SubstrateCli::create_configuration( + &polkadot_cli, + &polkadot_cli, + config.tokio_handle.clone(), + ) + .map_err(|err| format!("Relay chain argument error: {}", err))?; + + cmd.run(config, polkadot_config) + }) + }, + Some(Subcommand::ExportGenesisState(cmd)) => { + let runner = cli.create_runner(cmd)?; + runner.sync_run(|_config| { + let spec = cli.load_spec(&cmd.shared_params.chain.clone().unwrap_or_default())?; + let state_version = Cli::native_runtime_version(&spec).state_version(); + cmd.run::(&*spec, state_version) + }) + }, + Some(Subcommand::ExportGenesisWasm(cmd)) => { + let runner = cli.create_runner(cmd)?; + runner.sync_run(|_config| { + let spec = cli.load_spec(&cmd.shared_params.chain.clone().unwrap_or_default())?; + cmd.run(&*spec) + }) + }, + Some(Subcommand::Benchmark(cmd)) => { + let runner = cli.create_runner(cmd)?; + // Switch on the concrete benchmark sub-command- + match cmd { + BenchmarkCmd::Pallet(cmd) => + if cfg!(feature = "runtime-benchmarks") { + runner.sync_run(|config| cmd.run::(config)) + } else { + Err("Benchmarking wasn't enabled when building the node. \ + You can enable it with `--features runtime-benchmarks`." + .into()) + }, + BenchmarkCmd::Block(cmd) => runner.sync_run(|config| { + let partials = service::new_partial::( + &config, + crate::service::parachain_build_import_queue, + )?; + cmd.run(partials.client) + }), + #[cfg(not(feature = "runtime-benchmarks"))] + BenchmarkCmd::Storage(_) => Err(sc_cli::Error::Input( + "Compile with --features=runtime-benchmarks \ + to enable storage benchmarks." + .into(), + )), + #[cfg(feature = "runtime-benchmarks")] + BenchmarkCmd::Storage(cmd) => runner.sync_run(|config| { + let partials = service::new_partial::( + &config, + crate::service::parachain_build_import_queue, + )?; + let db = partials.backend.expose_db(); + let storage = partials.backend.expose_storage(); + + cmd.run(config, partials.client.clone(), db, storage) + }), + BenchmarkCmd::Machine(cmd) => + runner.sync_run(|config| cmd.run(&config, SUBSTRATE_REFERENCE_HARDWARE.clone())), + // NOTE: this allows the Client to leniently implement + // new benchmark commands without requiring a companion MR. + #[allow(unreachable_patterns)] + _ => Err("Benchmarking sub-command unsupported".into()), + } + }, + Some(Subcommand::TryRuntime(cmd)) => { + if cfg!(feature = "try-runtime") { + let runner = cli.create_runner(cmd)?; + + // grab the task manager. + let registry = &runner.config().prometheus_config.as_ref().map(|cfg| &cfg.registry); + let task_manager = + TaskManager::new(runner.config().tokio_handle.clone(), *registry) + .map_err(|e| format!("Error: {:?}", e))?; + + runner.async_run(|config| { + Ok((cmd.run::(config), task_manager)) + }) + } else { + Err("Try-runtime must be enabled by `--features try-runtime`.".into()) + } + }, + None => { + let runner = cli.create_runner(&cli.run.normalize())?; + let collator_options = cli.run.collator_options(); + + runner.run_node_until_exit(|config| async move { + let hwbench = if !cli.no_hardware_benchmarks { + config.database.path().map(|database_path| { + let _ = std::fs::create_dir_all(database_path); + sc_sysinfo::gather_hwbench(Some(database_path)) + }) + } else { + None + }; + + let para_id = chain_spec::Extensions::try_get(&*config.chain_spec) + .map(|e| e.para_id) + .ok_or("Could not find parachain ID in chain-spec.")?; + + let polkadot_cli = RelayChainCli::new( + &config, + [RelayChainCli::executable_name()].iter().chain(cli.relay_chain_args.iter()), + ); + + let id = ParaId::from(para_id); + + let parachain_account = + AccountIdConversion::::into_account_truncating(&id); + + let state_version = Cli::native_runtime_version(&config.chain_spec).state_version(); + let block: Block = + cumulus_client_cli::generate_genesis_block(&*config.chain_spec, state_version) + .map_err(|e| format!("{:?}", e))?; + let genesis_state = format!("0x{:?}", HexDisplay::from(&block.header().encode())); + + let tokio_handle = config.tokio_handle.clone(); + let polkadot_config = + SubstrateCli::create_configuration(&polkadot_cli, &polkadot_cli, tokio_handle) + .map_err(|err| format!("Relay chain argument error: {}", err))?; + + info!("Parachain id: {:?}", id); + info!("Parachain Account: {}", parachain_account); + info!("Parachain genesis state: {}", genesis_state); + info!("Is collating: {}", if config.role.is_authority() { "yes" } else { "no" }); + + crate::service::start_parachain_node( + config, + polkadot_config, + collator_options, + id, + hwbench, + ) + .await + .map(|r| r.0) + .map_err(Into::into) + }) + }, + } +} + +impl DefaultConfigurationValues for RelayChainCli { + fn p2p_listen_port() -> u16 { + 30334 + } + + fn rpc_ws_listen_port() -> u16 { + 9945 + } + + fn rpc_http_listen_port() -> u16 { + 9934 + } + + fn prometheus_listen_port() -> u16 { + 9616 + } +} + +impl CliConfiguration for RelayChainCli { + fn shared_params(&self) -> &SharedParams { + self.base.base.shared_params() + } + + fn import_params(&self) -> Option<&ImportParams> { + self.base.base.import_params() + } + + fn network_params(&self) -> Option<&NetworkParams> { + self.base.base.network_params() + } + + fn keystore_params(&self) -> Option<&KeystoreParams> { + self.base.base.keystore_params() + } + + fn base_path(&self) -> Result> { + Ok(self.shared_params().base_path()?.or_else(|| self.base_path.clone().map(Into::into))) + } + + fn rpc_http(&self, default_listen_port: u16) -> Result> { + self.base.base.rpc_http(default_listen_port) + } + + fn rpc_ipc(&self) -> Result> { + self.base.base.rpc_ipc() + } + + fn rpc_ws(&self, default_listen_port: u16) -> Result> { + self.base.base.rpc_ws(default_listen_port) + } + + fn prometheus_config( + &self, + default_listen_port: u16, + chain_spec: &Box, + ) -> Result> { + self.base.base.prometheus_config(default_listen_port, chain_spec) + } + + fn init( + &self, + _support_url: &String, + _impl_version: &String, + _logger_hook: F, + _config: &sc_service::Configuration, + ) -> Result<()> + where + F: FnOnce(&mut sc_cli::LoggerBuilder, &sc_service::Configuration), + { + unreachable!("PolkadotCli is never initialized; qed"); + } + + fn chain_id(&self, is_dev: bool) -> Result { + let chain_id = self.base.base.chain_id(is_dev)?; + + Ok(if chain_id.is_empty() { self.chain_id.clone().unwrap_or_default() } else { chain_id }) + } + + fn role(&self, is_dev: bool) -> Result { + self.base.base.role(is_dev) + } + + fn transaction_pool(&self, is_dev: bool) -> Result { + self.base.base.transaction_pool(is_dev) + } + + fn trie_cache_maximum_size(&self) -> Result> { + self.base.base.trie_cache_maximum_size() + } + + fn rpc_methods(&self) -> Result { + self.base.base.rpc_methods() + } + + fn rpc_ws_max_connections(&self) -> Result> { + self.base.base.rpc_ws_max_connections() + } + + fn rpc_cors(&self, is_dev: bool) -> Result>> { + self.base.base.rpc_cors(is_dev) + } + + fn default_heap_pages(&self) -> Result> { + self.base.base.default_heap_pages() + } + + fn force_authoring(&self) -> Result { + self.base.base.force_authoring() + } + + fn disable_grandpa(&self) -> Result { + self.base.base.disable_grandpa() + } + + fn max_runtime_instances(&self) -> Result> { + self.base.base.max_runtime_instances() + } + + fn announce_block(&self) -> Result { + self.base.base.announce_block() + } + + fn telemetry_endpoints( + &self, + chain_spec: &Box, + ) -> Result> { + self.base.base.telemetry_endpoints(chain_spec) + } + + fn node_name(&self) -> Result { + self.base.base.node_name() + } +} diff --git a/node/src/main.rs b/node/src/main.rs new file mode 100644 index 000000000..198e15255 --- /dev/null +++ b/node/src/main.rs @@ -0,0 +1,31 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Darwinia node CLI. + +#![deny(missing_docs)] + +mod chain_spec; +mod cli; +mod command; +mod rpc; +mod service; + +fn main() -> sc_cli::Result<()> { + command::run() +} diff --git a/node/src/rpc.rs b/node/src/rpc.rs new file mode 100644 index 000000000..84fc0d770 --- /dev/null +++ b/node/src/rpc.rs @@ -0,0 +1,77 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! A collection of node-specific RPC methods. +//! Substrate provides the `sc-rpc` crate, which defines the core RPC layer +//! used by Substrate nodes. This file extends those RPC definitions with +//! capabilities that are specific to this project's runtime configuration. + +pub use sc_rpc::{DenyUnsafe, SubscriptionTaskExecutor}; + +// std +use std::sync::Arc; +// darwinia +use dc_primitives::*; +// substrate +use sc_client_api::AuxStore; +use sc_transaction_pool_api::TransactionPool; +use sp_api::ProvideRuntimeApi; +use sp_block_builder::BlockBuilder; +use sp_blockchain::{Error as BlockChainError, HeaderBackend, HeaderMetadata}; + +/// A type representing all RPC extensions. +pub type RpcExtension = jsonrpsee::RpcModule<()>; + +/// Full client dependencies +pub struct FullDeps { + /// The client instance to use. + pub client: Arc, + /// Transaction pool instance. + pub pool: Arc

, + /// Whether to deny unsafe calls + pub deny_unsafe: DenyUnsafe, +} + +/// Instantiate all RPC extensions. +pub fn create_full( + deps: FullDeps, +) -> Result> +where + C: ProvideRuntimeApi + + HeaderBackend + + AuxStore + + HeaderMetadata + + Send + + Sync + + 'static, + C::Api: pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi + + substrate_frame_rpc_system::AccountNonceApi + + BlockBuilder, + P: TransactionPool + Sync + Send + 'static, +{ + // substrate + use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApiServer}; + use substrate_frame_rpc_system::{System, SystemApiServer}; + + let mut module = RpcExtension::new(()); + let FullDeps { client, pool, deny_unsafe } = deps; + + module.merge(System::new(client.clone(), pool, deny_unsafe).into_rpc())?; + module.merge(TransactionPayment::new(client).into_rpc())?; + Ok(module) +} diff --git a/node/src/service.rs b/node/src/service.rs new file mode 100644 index 000000000..a17bfe997 --- /dev/null +++ b/node/src/service.rs @@ -0,0 +1,550 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Service and service factory implementation. Specialized wrapper over substrate service. + +// std +use std::{sync::Arc, time::Duration}; + +// rpc +use jsonrpsee::RpcModule; + +use cumulus_client_cli::CollatorOptions; +// Local Runtime Types +use darwinia_runtime::RuntimeApi; +use dc_primitives::*; + +// Cumulus Imports +use cumulus_client_consensus_aura::{AuraConsensus, BuildAuraConsensusParams, SlotProportion}; +use cumulus_client_consensus_common::ParachainConsensus; +use cumulus_client_network::BlockAnnounceValidator; +use cumulus_client_service::{ + prepare_node_config, start_collator, start_full_node, StartCollatorParams, StartFullNodeParams, +}; +use cumulus_primitives_core::ParaId; +use cumulus_relay_chain_inprocess_interface::build_inprocess_relay_chain; +use cumulus_relay_chain_interface::{RelayChainError, RelayChainInterface, RelayChainResult}; +use cumulus_relay_chain_rpc_interface::{create_client_and_start_worker, RelayChainRpcInterface}; + +// Substrate Imports +use sc_executor::NativeElseWasmExecutor; +use sc_network::NetworkService; +use sc_network_common::service::NetworkBlock; +use sc_service::{Configuration, PartialComponents, TFullBackend, TFullClient, TaskManager}; +use sc_telemetry::{Telemetry, TelemetryHandle, TelemetryWorker, TelemetryWorkerHandle}; +use sp_api::ConstructRuntimeApi; +use sp_keystore::SyncCryptoStorePtr; +use sp_runtime::traits::BlakeTwo256; +use substrate_prometheus_endpoint::Registry; + +use polkadot_service::CollatorPair; + +/// Native executor instance. +pub struct DarwiniaRuntimeExecutor; + +impl sc_executor::NativeExecutionDispatch for DarwiniaRuntimeExecutor { + type ExtendHostFunctions = frame_benchmarking::benchmarking::HostFunctions; + + fn dispatch(method: &str, data: &[u8]) -> Option> { + darwinia_runtime::api::dispatch(method, data) + } + + fn native_version() -> sc_executor::NativeVersion { + darwinia_runtime::native_version() + } +} + +/// Starts a `ServiceBuilder` for a full service. +/// +/// Use this macro if you don't actually need the full service, but just the builder in order to +/// be able to perform chain operations. +#[allow(clippy::type_complexity)] +pub fn new_partial( + config: &Configuration, + build_import_queue: BIQ, +) -> Result< + PartialComponents< + TFullClient>, + TFullBackend, + (), + sc_consensus::DefaultImportQueue< + Block, + TFullClient>, + >, + sc_transaction_pool::FullPool< + Block, + TFullClient>, + >, + (Option, Option), + >, + sc_service::Error, +> +where + RuntimeApi: ConstructRuntimeApi>> + + Send + + Sync + + 'static, + RuntimeApi::RuntimeApi: sp_transaction_pool::runtime_api::TaggedTransactionQueue + + sp_api::Metadata + + sp_session::SessionKeys + + sp_api::ApiExt< + Block, + StateBackend = sc_client_api::StateBackendFor, Block>, + > + sp_offchain::OffchainWorkerApi + + sp_block_builder::BlockBuilder, + sc_client_api::StateBackendFor, Block>: sp_api::StateBackend, + Executor: sc_executor::NativeExecutionDispatch + 'static, + BIQ: FnOnce( + Arc>>, + &Configuration, + Option, + &TaskManager, + ) -> Result< + sc_consensus::DefaultImportQueue< + Block, + TFullClient>, + >, + sc_service::Error, + >, +{ + let telemetry = config + .telemetry_endpoints + .clone() + .filter(|x| !x.is_empty()) + .map(|endpoints| -> Result<_, sc_telemetry::Error> { + let worker = TelemetryWorker::new(16)?; + let telemetry = worker.handle().new_telemetry(endpoints); + Ok((worker, telemetry)) + }) + .transpose()?; + + let executor = sc_executor::NativeElseWasmExecutor::::new( + config.wasm_method, + config.default_heap_pages, + config.max_runtime_instances, + config.runtime_cache_size, + ); + + let (client, backend, keystore_container, task_manager) = + sc_service::new_full_parts::( + config, + telemetry.as_ref().map(|(_, telemetry)| telemetry.handle()), + executor, + )?; + let client = Arc::new(client); + + let telemetry_worker_handle = telemetry.as_ref().map(|(worker, _)| worker.handle()); + + let telemetry = telemetry.map(|(worker, telemetry)| { + task_manager.spawn_handle().spawn("telemetry", None, worker.run()); + telemetry + }); + + let transaction_pool = sc_transaction_pool::BasicPool::new_full( + config.transaction_pool.clone(), + config.role.is_authority().into(), + config.prometheus_registry(), + task_manager.spawn_essential_handle(), + client.clone(), + ); + + let import_queue = build_import_queue( + client.clone(), + config, + telemetry.as_ref().map(|telemetry| telemetry.handle()), + &task_manager, + )?; + + let params = PartialComponents { + backend, + client, + import_queue, + keystore_container, + task_manager, + transaction_pool, + select_chain: (), + other: (telemetry, telemetry_worker_handle), + }; + + Ok(params) +} + +async fn build_relay_chain_interface( + polkadot_config: Configuration, + parachain_config: &Configuration, + telemetry_worker_handle: Option, + task_manager: &mut TaskManager, + collator_options: CollatorOptions, + hwbench: Option, +) -> RelayChainResult<(Arc<(dyn RelayChainInterface + 'static)>, Option)> { + match collator_options.relay_chain_rpc_url { + Some(relay_chain_url) => { + let client = create_client_and_start_worker(relay_chain_url, task_manager).await?; + Ok((Arc::new(RelayChainRpcInterface::new(client)) as Arc<_>, None)) + }, + None => build_inprocess_relay_chain( + polkadot_config, + parachain_config, + telemetry_worker_handle, + task_manager, + hwbench, + ), + } +} + +/// Start a node with the given parachain `Configuration` and relay chain `Configuration`. +/// +/// This is the actual implementation that is abstract over the executor and the runtime api. +#[allow(clippy::too_many_arguments)] +#[sc_tracing::logging::prefix_logs_with("Parachain")] +async fn start_node_impl( + parachain_config: Configuration, + polkadot_config: Configuration, + collator_options: CollatorOptions, + id: ParaId, + _rpc_ext_builder: RB, + build_import_queue: BIQ, + build_consensus: BIC, + hwbench: Option, +) -> sc_service::error::Result<( + TaskManager, + Arc>>, +)> +where + RuntimeApi: ConstructRuntimeApi>> + + Send + + Sync + + 'static, + RuntimeApi::RuntimeApi: sp_transaction_pool::runtime_api::TaggedTransactionQueue + + sp_api::Metadata + + sp_session::SessionKeys + + sp_api::ApiExt< + Block, + StateBackend = sc_client_api::StateBackendFor, Block>, + > + sp_offchain::OffchainWorkerApi + + sp_block_builder::BlockBuilder + + cumulus_primitives_core::CollectCollationInfo + + pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi + + substrate_frame_rpc_system::AccountNonceApi, + sc_client_api::StateBackendFor, Block>: sp_api::StateBackend, + Executor: sc_executor::NativeExecutionDispatch + 'static, + RB: Fn( + Arc>, + ) -> Result, sc_service::Error> + + Send + + 'static, + BIQ: FnOnce( + Arc>>, + &Configuration, + Option, + &TaskManager, + ) -> Result< + sc_consensus::DefaultImportQueue< + Block, + TFullClient>, + >, + sc_service::Error, + > + 'static, + BIC: FnOnce( + Arc>>, + Option<&Registry>, + Option, + &TaskManager, + Arc, + Arc< + sc_transaction_pool::FullPool< + Block, + TFullClient>, + >, + >, + Arc>, + SyncCryptoStorePtr, + bool, + ) -> Result>, sc_service::Error>, +{ + let parachain_config = prepare_node_config(parachain_config); + + let params = new_partial::(¶chain_config, build_import_queue)?; + let (mut telemetry, telemetry_worker_handle) = params.other; + + let client = params.client.clone(); + let backend = params.backend.clone(); + let mut task_manager = params.task_manager; + + let (relay_chain_interface, collator_key) = build_relay_chain_interface( + polkadot_config, + ¶chain_config, + telemetry_worker_handle, + &mut task_manager, + collator_options.clone(), + hwbench.clone(), + ) + .await + .map_err(|e| match e { + RelayChainError::ServiceError(polkadot_service::Error::Sub(x)) => x, + s => s.to_string().into(), + })?; + + let block_announce_validator = BlockAnnounceValidator::new(relay_chain_interface.clone(), id); + + let force_authoring = parachain_config.force_authoring; + let validator = parachain_config.role.is_authority(); + let prometheus_registry = parachain_config.prometheus_registry().cloned(); + let transaction_pool = params.transaction_pool.clone(); + let import_queue = cumulus_client_service::SharedImportQueue::new(params.import_queue); + let (network, system_rpc_tx, tx_handler_controller, start_network) = + sc_service::build_network(sc_service::BuildNetworkParams { + config: ¶chain_config, + client: client.clone(), + transaction_pool: transaction_pool.clone(), + spawn_handle: task_manager.spawn_handle(), + import_queue: import_queue.clone(), + block_announce_validator_builder: Some(Box::new(|_| { + Box::new(block_announce_validator) + })), + warp_sync: None, + })?; + + let rpc_builder = { + let client = client.clone(); + let transaction_pool = transaction_pool.clone(); + + Box::new(move |deny_unsafe, _| { + let deps = crate::rpc::FullDeps { + client: client.clone(), + pool: transaction_pool.clone(), + deny_unsafe, + }; + + crate::rpc::create_full(deps).map_err(Into::into) + }) + }; + + sc_service::spawn_tasks(sc_service::SpawnTasksParams { + rpc_builder, + client: client.clone(), + transaction_pool: transaction_pool.clone(), + task_manager: &mut task_manager, + config: parachain_config, + keystore: params.keystore_container.sync_keystore(), + backend: backend.clone(), + network: network.clone(), + system_rpc_tx, + tx_handler_controller, + telemetry: telemetry.as_mut(), + })?; + + if let Some(hwbench) = hwbench { + sc_sysinfo::print_hwbench(&hwbench); + + if let Some(ref mut telemetry) = telemetry { + let telemetry_handle = telemetry.handle(); + task_manager.spawn_handle().spawn( + "telemetry_hwbench", + None, + sc_sysinfo::initialize_hwbench_telemetry(telemetry_handle, hwbench), + ); + } + } + + let announce_block = { + let network = network.clone(); + Arc::new(move |hash, data| network.announce_block(hash, data)) + }; + + let relay_chain_slot_duration = Duration::from_secs(6); + + if validator { + let parachain_consensus = build_consensus( + client.clone(), + prometheus_registry.as_ref(), + telemetry.as_ref().map(|t| t.handle()), + &task_manager, + relay_chain_interface.clone(), + transaction_pool, + network, + params.keystore_container.sync_keystore(), + force_authoring, + )?; + + let spawner = task_manager.spawn_handle(); + + let params = StartCollatorParams { + para_id: id, + block_status: client.clone(), + announce_block, + client: client.clone(), + task_manager: &mut task_manager, + relay_chain_interface, + spawner, + parachain_consensus, + import_queue, + collator_key: collator_key.expect("Command line arguments do not allow this. qed"), + relay_chain_slot_duration, + }; + + start_collator(params).await?; + } else { + let params = StartFullNodeParams { + client: client.clone(), + announce_block, + task_manager: &mut task_manager, + para_id: id, + relay_chain_interface, + relay_chain_slot_duration, + import_queue, + collator_options, + }; + + start_full_node(params)?; + } + + start_network.start_network(); + + Ok((task_manager, client)) +} + +/// Build the import queue for the parachain runtime. +#[allow(clippy::type_complexity)] +pub fn parachain_build_import_queue( + client: Arc>>, + config: &Configuration, + telemetry: Option, + task_manager: &TaskManager, +) -> Result< + sc_consensus::DefaultImportQueue< + Block, + TFullClient>, + >, + sc_service::Error, +> { + let slot_duration = cumulus_client_consensus_aura::slot_duration(&*client)?; + + cumulus_client_consensus_aura::import_queue::< + sp_consensus_aura::sr25519::AuthorityPair, + _, + _, + _, + _, + _, + >(cumulus_client_consensus_aura::ImportQueueParams { + block_import: client.clone(), + client, + create_inherent_data_providers: move |_, _| async move { + let timestamp = sp_timestamp::InherentDataProvider::from_system_time(); + + let slot = + sp_consensus_aura::inherents::InherentDataProvider::from_timestamp_and_slot_duration( + *timestamp, + slot_duration, + ); + + Ok((slot, timestamp)) + }, + registry: config.prometheus_registry(), + spawner: &task_manager.spawn_essential_handle(), + telemetry, + }) + .map_err(Into::into) +} + +/// Start a parachain node. +pub async fn start_parachain_node( + parachain_config: Configuration, + polkadot_config: Configuration, + collator_options: CollatorOptions, + id: ParaId, + hwbench: Option, +) -> sc_service::error::Result<( + TaskManager, + Arc>>, +)> { + start_node_impl::( + parachain_config, + polkadot_config, + collator_options, + id, + |_| Ok(RpcModule::new(())), + parachain_build_import_queue, + |client, + prometheus_registry, + telemetry, + task_manager, + relay_chain_interface, + transaction_pool, + sync_oracle, + keystore, + force_authoring| { + let slot_duration = cumulus_client_consensus_aura::slot_duration(&*client)?; + + let proposer_factory = sc_basic_authorship::ProposerFactory::with_proof_recording( + task_manager.spawn_handle(), + client.clone(), + transaction_pool, + prometheus_registry, + telemetry.clone(), + ); + + Ok(AuraConsensus::build::( + BuildAuraConsensusParams { + proposer_factory, + create_inherent_data_providers: move |_, (relay_parent, validation_data)| { + let relay_chain_interface = relay_chain_interface.clone(); + async move { + let parachain_inherent = + cumulus_primitives_parachain_inherent::ParachainInherentData::create_at( + relay_parent, + &relay_chain_interface, + &validation_data, + id, + ).await; + let timestamp = sp_timestamp::InherentDataProvider::from_system_time(); + + let slot = + sp_consensus_aura::inherents::InherentDataProvider::from_timestamp_and_slot_duration( + *timestamp, + slot_duration, + ); + + let parachain_inherent = parachain_inherent.ok_or_else(|| { + Box::::from( + "Failed to create parachain inherent", + ) + })?; + Ok((slot, timestamp, parachain_inherent)) + } + }, + block_import: client.clone(), + para_client: client, + backoff_authoring_blocks: Option::<()>::None, + sync_oracle, + keystore, + force_authoring, + slot_duration, + // We got around 500ms for proposing + block_proposal_slot_portion: SlotProportion::new(1f32 / 24f32), + // And a maximum of 750ms if slots are skipped + max_block_proposal_slot_portion: Some(SlotProportion::new(1f32 / 16f32)), + telemetry, + }, + )) + }, + hwbench, + ) + .await +} diff --git a/runtime/Cargo.toml b/runtime/Cargo.toml new file mode 100644 index 000000000..b4bc4f389 --- /dev/null +++ b/runtime/Cargo.toml @@ -0,0 +1,200 @@ +[package] +authors = ["Darwinia Network "] +description = "Darwinia runtime." +edition = "2021" +homepage = "https://darwinia.network" +license = "GPL-3.0" +name = "darwinia-runtime" +readme = "README.md" +repository = "https://github.com/darwinia-network/darwinia" +version = "6.0.0" + +[build-dependencies] +substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } + +[dependencies] +# crates.io +codec = { package = "parity-scale-codec", version = "3.2", default-features = false, features = ["derive"] } +scale-info = { version = "2.3", default-features = false, features = ["derive"] } +smallvec = { version = "1.10" } +# crates.io optional +array-bytes = { version = "4.1", optional = true } + +# cumulus +cumulus-pallet-aura-ext = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } +cumulus-pallet-dmp-queue = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } +cumulus-pallet-parachain-system = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } +cumulus-pallet-xcm = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } +cumulus-pallet-xcmp-queue = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } +cumulus-primitives-core = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } +cumulus-primitives-timestamp = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } +cumulus-primitives-utility = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } +pallet-collator-selection = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } +parachain-info = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } +# cumulus optional +cumulus-pallet-session-benchmarking = { optional = true, default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } + +# darwinia +dc-primitives = { default-features = false, path = "../core/primitives" } + +# polkadot +pallet-xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" } +polkadot-parachain = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" } +polkadot-runtime-common = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" } +xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" } +xcm-builder = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" } +xcm-executor = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" } + +# substrate +frame-executive = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +frame-system-rpc-runtime-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-aura = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-authorship = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-balances = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-session = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-sudo = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-timestamp = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-transaction-payment = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-transaction-payment-rpc-runtime-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-block-builder = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-consensus-aura = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-inherents = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-io = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-offchain = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-session = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-transaction-pool = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-version = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +# substrate optional +frame-benchmarking = { optional = true, default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +frame-system-benchmarking = { optional = true, default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +frame-try-runtime = { optional = true, default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } + +[features] +default = [ + "std", +] +std = [ + # crates.io + "codec/std", + "scale-info/std", + + # cumulus + "cumulus-pallet-aura-ext/std", + "cumulus-pallet-dmp-queue/std", + "cumulus-pallet-parachain-system/std", + "cumulus-pallet-xcm/std", + "cumulus-pallet-xcmp-queue/std", + "cumulus-primitives-core/std", + "cumulus-primitives-timestamp/std", + "cumulus-primitives-utility/std", + "pallet-collator-selection/std", + "parachain-info/std", + # cumulus optional + "cumulus-pallet-session-benchmarking?/std", + + # darwinia + "dc-primitives/std", + + # polkadot + "pallet-xcm/std", + "polkadot-parachain/std", + "polkadot-runtime-common/std", + "xcm/std", + "xcm-builder/std", + "xcm-executor/std", + + # substrate + "frame-executive/std", + "frame-support/std", + "frame-system/std", + "frame-system-rpc-runtime-api/std", + "pallet-aura/std", + "pallet-authorship/std", + "pallet-balances/std", + "pallet-session/std", + "pallet-sudo/std", + "pallet-timestamp/std", + "pallet-transaction-payment-rpc-runtime-api/std", + "pallet-transaction-payment/std", + "sp-api/std", + "sp-block-builder/std", + "sp-consensus-aura/std", + "sp-core/std", + "sp-inherents/std", + "sp-io/std", + "sp-offchain/std", + "sp-runtime/std", + "sp-session/std", + "sp-std/std", + "sp-transaction-pool/std", + "sp-version/std", + # substrate optional + "frame-benchmarking?/std", + "frame-system-benchmarking?/std", + "frame-try-runtime?/std", + +] + +runtime-benchmarks = [ + # crates.io + "array-bytes", + + # cumulus + "pallet-collator-selection/runtime-benchmarks", + "cumulus-pallet-parachain-system/runtime-benchmarks", + "cumulus-pallet-xcmp-queue/runtime-benchmarks", + # cumulus optional + "cumulus-pallet-session-benchmarking/runtime-benchmarks", + + # polkadot + "pallet-xcm/runtime-benchmarks", + "polkadot-parachain/runtime-benchmarks", + "polkadot-runtime-common/runtime-benchmarks", + "xcm-builder/runtime-benchmarks", + "xcm-executor/runtime-benchmarks", + + # substrate + "frame-support/runtime-benchmarks", + "frame-system/runtime-benchmarks", + "pallet-balances/runtime-benchmarks", + "pallet-timestamp/runtime-benchmarks", + "sp-runtime/runtime-benchmarks", + # substrate optional + "frame-benchmarking/runtime-benchmarks", + "frame-system-benchmarking/runtime-benchmarks", +] + +try-runtime = [ + # cumulus + "cumulus-pallet-aura-ext/try-runtime", + "cumulus-pallet-dmp-queue/try-runtime", + "cumulus-pallet-parachain-system/try-runtime", + "cumulus-pallet-xcm/try-runtime", + "cumulus-pallet-xcmp-queue/try-runtime", + "pallet-collator-selection/try-runtime", + "parachain-info/try-runtime", + + # polkadot + "pallet-xcm/try-runtime", + "polkadot-runtime-common/try-runtime", + + # substrate + "frame-executive/try-runtime", + "frame-support/try-runtime", + "frame-system/try-runtime", + "pallet-aura/try-runtime", + "pallet-authorship/try-runtime", + "pallet-balances/try-runtime", + "pallet-session/try-runtime", + "pallet-sudo/try-runtime", + "pallet-timestamp/try-runtime", + "pallet-transaction-payment/try-runtime", + # substrate optional + "frame-try-runtime", +] diff --git a/runtime/build.rs b/runtime/build.rs new file mode 100644 index 000000000..e5513c875 --- /dev/null +++ b/runtime/build.rs @@ -0,0 +1,24 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// crates.io +use substrate_wasm_builder::WasmBuilder; + +fn main() { + WasmBuilder::new().with_current_project().export_heap_base().import_memory().build() +} diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs new file mode 100644 index 000000000..6999e0e17 --- /dev/null +++ b/runtime/src/lib.rs @@ -0,0 +1,441 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Darwinia runtime. + +#![cfg_attr(not(feature = "std"), no_std)] +#![recursion_limit = "256"] + +#[cfg(feature = "std")] +include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); + +mod pallets; +use pallets::*; + +mod weights; + +mod xcm_config; +use xcm_config::{XcmConfig, XcmOriginToTransactDispatchOrigin}; + +pub use sp_consensus_aura::sr25519::AuthorityId as AuraId; + +// crates.io +use smallvec::smallvec; +// cumulus +use cumulus_pallet_parachain_system::RelayNumberStrictlyIncreases; +// darwinia +use dc_primitives::*; +// polkadot +use xcm::latest::prelude::BodyId; +use xcm_executor::XcmExecutor; +// substrate +use frame_support::{ + dispatch::DispatchClass, + weights::{ + ConstantMultiplier, Weight, WeightToFeeCoefficient, WeightToFeeCoefficients, + WeightToFeePolynomial, + }, + PalletId, +}; +use frame_system::EnsureRoot; +use sp_core::{crypto::KeyTypeId, OpaqueMetadata}; +#[cfg(any(feature = "std", test))] +pub use sp_runtime::BuildStorage; +use sp_runtime::{ + generic, + traits::Block as BlockT, + transaction_validity::{TransactionSource, TransactionValidity}, + ApplyExtrinsicResult, +}; +pub use sp_runtime::{MultiAddress, Perbill, Permill}; +use sp_std::prelude::*; +#[cfg(feature = "std")] +use sp_version::NativeVersion; +use sp_version::RuntimeVersion; + +/// Block type as expected by this runtime. +pub type Block = generic::Block; + +/// A Block signed with a Justification +pub type SignedBlock = generic::SignedBlock; + +/// The SignedExtension to the basic transaction logic. +pub type SignedExtra = ( + frame_system::CheckNonZeroSender, + frame_system::CheckSpecVersion, + frame_system::CheckTxVersion, + frame_system::CheckGenesis, + frame_system::CheckEra, + frame_system::CheckNonce, + frame_system::CheckWeight, + pallet_transaction_payment::ChargeTransactionPayment, +); + +/// Unchecked extrinsic type as expected by this runtime. +pub type UncheckedExtrinsic = + generic::UncheckedExtrinsic; + +/// Extrinsic type that has already been checked. +pub type CheckedExtrinsic = generic::CheckedExtrinsic; + +/// Executive: handles dispatch to the various modules. +pub type Executive = frame_executive::Executive< + Runtime, + Block, + frame_system::ChainContext, + Runtime, + AllPalletsWithSystem, +>; + +/// Handles converting a weight scalar to a fee value, based on the scale and granularity of the +/// node's balance type. +/// +/// This should typically create a mapping between the following ranges: +/// - `[0, MAXIMUM_BLOCK_WEIGHT]` +/// - `[Balance::min, Balance::max]` +/// +/// Yet, it can be used for any other sort of change to weight-fee. Some examples being: +/// - Setting it to `0` will essentially disable the weight fee. +/// - Setting it to `1` will cause the literal `#[weight = x]` values to be charged. +pub struct WeightToFee; +impl WeightToFeePolynomial for WeightToFee { + type Balance = Balance; + + fn polynomial() -> WeightToFeeCoefficients { + // in Rococo, extrinsic base weight (smallest non-zero weight) is mapped to 1 MILLIUNIT: + // here, we map to 1/10 of that, or 1/10 MILLIUNIT + let p = MILLIUNIT / 10; + let q = 100 * Balance::from(weights::ExtrinsicBaseWeight::get().ref_time()); + smallvec![WeightToFeeCoefficient { + degree: 1, + negative: false, + coeff_frac: Perbill::from_rational(p % q, q), + coeff_integer: p / q, + }] + } +} + +sp_runtime::impl_opaque_keys! { + pub struct SessionKeys { + pub aura: Aura, + } +} + +/// Runtime version. +#[sp_version::runtime_version] +pub const VERSION: RuntimeVersion = RuntimeVersion { + spec_name: sp_runtime::create_runtime_str!("Darwinia"), + impl_name: sp_runtime::create_runtime_str!("Darwinia"), + authoring_version: 1, + spec_version: 1, + impl_version: 0, + apis: RUNTIME_API_VERSIONS, + transaction_version: 1, + state_version: 1, +}; + +/// The existential deposit. Set to 1/10 of the Connected Relay Chain. +pub const EXISTENTIAL_DEPOSIT: Balance = MILLIUNIT; + +/// The version information used to identify this runtime when compiled natively. +#[cfg(feature = "std")] +pub fn native_version() -> NativeVersion { + NativeVersion { runtime_version: VERSION, can_author_with: Default::default() } +} + +// Create the runtime by composing the FRAME pallets that were previously configured. +frame_support::construct_runtime! { + pub enum Runtime where + Block = Block, + NodeBlock = dc_primitives::Block, + UncheckedExtrinsic = UncheckedExtrinsic, + { + // System stuff. + System: frame_system::{Pallet, Call, Config, Storage, Event} = 0, + ParachainSystem: cumulus_pallet_parachain_system::{ + Pallet, Call, Config, Storage, Inherent, Event, ValidateUnsigned, + } = 1, + Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent} = 2, + ParachainInfo: parachain_info::{Pallet, Storage, Config} = 3, + + // Monetary stuff. + Balances: pallet_balances::{Pallet, Call, Storage, Config, Event} = 4, + TransactionPayment: pallet_transaction_payment::{Pallet, Storage, Event} = 5, + + // Consensus stuff. + Authorship: pallet_authorship::{Pallet, Call, Storage} = 6, + CollatorSelection: pallet_collator_selection::{Pallet, Call, Storage, Event, Config} = 7, + Session: pallet_session::{Pallet, Call, Storage, Event, Config} = 8, + Aura: pallet_aura::{Pallet, Storage, Config} = 9, + AuraExt: cumulus_pallet_aura_ext::{Pallet, Storage, Config} = 10, + + // XCM stuff. + XcmpQueue: cumulus_pallet_xcmp_queue::{Pallet, Call, Storage, Event} = 11, + PolkadotXcm: pallet_xcm::{Pallet, Call, Event, Origin, Config} = 12, + CumulusXcm: cumulus_pallet_xcm::{Pallet, Event, Origin} = 13, + DmpQueue: cumulus_pallet_dmp_queue::{Pallet, Call, Storage, Event} = 14, + } +} + +#[cfg(feature = "runtime-benchmarks")] +frame_benchmarking::define_benchmarks! { + [frame_system, SystemBench::] + [pallet_balances, Balances] + [pallet_session, SessionBench::] + [pallet_timestamp, Timestamp] + [pallet_collator_selection, CollatorSelection] + [cumulus_pallet_xcmp_queue, XcmpQueue] +} + +sp_api::impl_runtime_apis! { + impl sp_consensus_aura::AuraApi for Runtime { + fn slot_duration() -> sp_consensus_aura::SlotDuration { + sp_consensus_aura::SlotDuration::from_millis(Aura::slot_duration()) + } + + fn authorities() -> Vec { + Aura::authorities().into_inner() + } + } + + impl sp_api::Core for Runtime { + fn version() -> RuntimeVersion { + VERSION + } + + fn execute_block(block: Block) { + Executive::execute_block(block) + } + + fn initialize_block(header: &::Header) { + Executive::initialize_block(header) + } + } + + impl sp_api::Metadata for Runtime { + fn metadata() -> OpaqueMetadata { + OpaqueMetadata::new(Runtime::metadata().into()) + } + } + + impl sp_block_builder::BlockBuilder for Runtime { + fn apply_extrinsic(extrinsic: ::Extrinsic) -> ApplyExtrinsicResult { + Executive::apply_extrinsic(extrinsic) + } + + fn finalize_block() -> ::Header { + Executive::finalize_block() + } + + fn inherent_extrinsics(data: sp_inherents::InherentData) -> Vec<::Extrinsic> { + data.create_extrinsics() + } + + fn check_inherents( + block: Block, + data: sp_inherents::InherentData, + ) -> sp_inherents::CheckInherentsResult { + data.check_extrinsics(&block) + } + } + + impl sp_transaction_pool::runtime_api::TaggedTransactionQueue for Runtime { + fn validate_transaction( + source: TransactionSource, + tx: ::Extrinsic, + block_hash: ::Hash, + ) -> TransactionValidity { + Executive::validate_transaction(source, tx, block_hash) + } + } + + impl sp_offchain::OffchainWorkerApi for Runtime { + fn offchain_worker(header: &::Header) { + Executive::offchain_worker(header) + } + } + + impl sp_session::SessionKeys for Runtime { + fn generate_session_keys(seed: Option>) -> Vec { + SessionKeys::generate(seed) + } + + fn decode_session_keys( + encoded: Vec, + ) -> Option, KeyTypeId)>> { + SessionKeys::decode_into_raw_public_keys(&encoded) + } + } + + impl frame_system_rpc_runtime_api::AccountNonceApi for Runtime { + fn account_nonce(account: AccountId) -> Nonce { + System::account_nonce(account) + } + } + + impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi for Runtime { + fn query_info( + uxt: ::Extrinsic, + len: u32, + ) -> pallet_transaction_payment_rpc_runtime_api::RuntimeDispatchInfo { + TransactionPayment::query_info(uxt, len) + } + fn query_fee_details( + uxt: ::Extrinsic, + len: u32, + ) -> pallet_transaction_payment::FeeDetails { + TransactionPayment::query_fee_details(uxt, len) + } + } + + impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentCallApi + for Runtime + { + fn query_call_info( + call: RuntimeCall, + len: u32, + ) -> pallet_transaction_payment::RuntimeDispatchInfo { + TransactionPayment::query_call_info(call, len) + } + fn query_call_fee_details( + call: RuntimeCall, + len: u32, + ) -> pallet_transaction_payment::FeeDetails { + TransactionPayment::query_call_fee_details(call, len) + } + } + + impl cumulus_primitives_core::CollectCollationInfo for Runtime { + fn collect_collation_info(header: &::Header) -> cumulus_primitives_core::CollationInfo { + ParachainSystem::collect_collation_info(header) + } + } + + #[cfg(feature = "runtime-benchmarks")] + impl frame_benchmarking::Benchmark for Runtime { + fn benchmark_metadata(extra: bool) -> ( + Vec, + Vec, + ) { + // substrate + use frame_benchmarking::*; + use frame_support::traits::StorageInfoTrait; + use frame_system_benchmarking::Pallet as SystemBench; + use cumulus_pallet_session_benchmarking::Pallet as SessionBench; + + let mut list = Vec::::new(); + + list_benchmarks!(list, extra); + + let storage_info = AllPalletsWithSystem::storage_info(); + + (list, storage_info) + } + + fn dispatch_benchmark( + config: frame_benchmarking::BenchmarkConfig + ) -> Result, sp_runtime::RuntimeString> { + // substrate + use frame_benchmarking::*; + + use frame_system_benchmarking::Pallet as SystemBench; + impl frame_system_benchmarking::Config for Runtime {} + + use cumulus_pallet_session_benchmarking::Pallet as SessionBench; + impl cumulus_pallet_session_benchmarking::Config for Runtime {} + + let whitelist: Vec = vec![ + // Block Number + array_bytes::hex_into_unchecked("26aa394eea5630e07c48ae0c9558cef702a5c1b19ab7a04f536c519aca4983ac"), + // Total Issuance + array_bytes::hex_into_unchecked("c2261276cc9d1f8598ea4b6a74b15c2f57c875e4cff74148e4628f264b974c80"), + // Execution Phase + array_bytes::hex_into_unchecked("26aa394eea5630e07c48ae0c9558cef7ff553b5a9862a516939d82b3d3d8661a"), + // Event Count + array_bytes::hex_into_unchecked("26aa394eea5630e07c48ae0c9558cef70a98fdbe9ce6c55837576c60c7af3850"), + // System Events + array_bytes::hex_into_unchecked("26aa394eea5630e07c48ae0c9558cef780d41e5e16056765bc8461851072c9d7"), + ]; + + let mut batches = Vec::::new(); + let params = (&config, &whitelist); + + add_benchmarks!(params, batches); + + if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) } + + Ok(batches) + } + } + + #[cfg(feature = "try-runtime")] + impl frame_try_runtime::TryRuntime for Runtime { + fn on_runtime_upgrade() -> (Weight, Weight) { + // substrate + use frame_support::log; + + log::info!("try-runtime::on_runtime_upgrade"); + + let weight = Executive::try_runtime_upgrade().unwrap(); + + (weight, RuntimeBlockWeights::get().max_block) + } + + fn execute_block(block: Block, state_root_check: bool, select: frame_try_runtime::TryStateSelect) -> Weight { + // substrate + use frame_support::log; + + log::info!( + "try-runtime: executing block #{} ({:?}) / root checks: {:?} / sanity-checks: {:?}", + block.header.number, + block.header.hash(), + state_root_check, + select, + ); + + Executive::try_execute_block(block, state_root_check, select).expect("try_execute_block failed") + } + } +} + +struct CheckInherents; +impl cumulus_pallet_parachain_system::CheckInherents for CheckInherents { + fn check_inherents( + block: &Block, + relay_state_proof: &cumulus_pallet_parachain_system::RelayChainStateProof, + ) -> sp_inherents::CheckInherentsResult { + let relay_chain_slot = relay_state_proof + .read_slot() + .expect("Could not read the relay chain slot from the proof"); + + let inherent_data = + cumulus_primitives_timestamp::InherentDataProvider::from_relay_chain_slot_and_duration( + relay_chain_slot, + sp_std::time::Duration::from_secs(6), + ) + .create_inherent_data() + .expect("Could not create the timestamp inherent data"); + + inherent_data.check_extrinsics(block) + } +} +cumulus_pallet_parachain_system::register_validate_block! { + Runtime = Runtime, + BlockExecutor = cumulus_pallet_aura_ext::BlockExecutor::, + CheckInherents = CheckInherents, +} diff --git a/runtime/src/pallets/aura.rs b/runtime/src/pallets/aura.rs new file mode 100644 index 000000000..c45e11180 --- /dev/null +++ b/runtime/src/pallets/aura.rs @@ -0,0 +1,26 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +impl pallet_aura::Config for Runtime { + type AuthorityId = AuraId; + type DisabledValidators = (); + type MaxAuthorities = MaxAuthorities; +} diff --git a/runtime/src/pallets/aura_ext.rs b/runtime/src/pallets/aura_ext.rs new file mode 100644 index 000000000..77c924dab --- /dev/null +++ b/runtime/src/pallets/aura_ext.rs @@ -0,0 +1,22 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +impl cumulus_pallet_aura_ext::Config for Runtime {} diff --git a/runtime/src/pallets/authorship.rs b/runtime/src/pallets/authorship.rs new file mode 100644 index 000000000..6b9c3be86 --- /dev/null +++ b/runtime/src/pallets/authorship.rs @@ -0,0 +1,31 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +frame_support::parameter_types! { + pub const UncleGenerations: u32 = 0; +} + +impl pallet_authorship::Config for Runtime { + type EventHandler = (CollatorSelection,); + type FilterUncle = (); + type FindAuthor = pallet_session::FindAccountFromAuthorIndex; + type UncleGenerations = UncleGenerations; +} diff --git a/runtime/src/pallets/balances.rs b/runtime/src/pallets/balances.rs new file mode 100644 index 000000000..1518b1c53 --- /dev/null +++ b/runtime/src/pallets/balances.rs @@ -0,0 +1,40 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +frame_support::parameter_types! { + pub const ExistentialDeposit: Balance = EXISTENTIAL_DEPOSIT; + pub const MaxLocks: u32 = 50; + pub const MaxReserves: u32 = 50; +} + +impl pallet_balances::Config for Runtime { + type AccountStore = System; + /// The type for recording an account's balance. + type Balance = Balance; + type DustRemoval = (); + type ExistentialDeposit = ExistentialDeposit; + type MaxLocks = MaxLocks; + type MaxReserves = MaxReserves; + type ReserveIdentifier = [u8; 8]; + /// The ubiquitous event type. + type RuntimeEvent = RuntimeEvent; + type WeightInfo = weights::pallet_balances::WeightInfo; +} diff --git a/runtime/src/pallets/collator_selection.rs b/runtime/src/pallets/collator_selection.rs new file mode 100644 index 000000000..610420061 --- /dev/null +++ b/runtime/src/pallets/collator_selection.rs @@ -0,0 +1,47 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +// We allow root only to execute privileged collator selection operations. +pub type CollatorSelectionUpdateOrigin = EnsureRoot; +frame_support::parameter_types! { + pub const PotId: PalletId = PalletId(*b"PotStake"); + pub const MaxCandidates: u32 = 1000; + pub const MinCandidates: u32 = 5; + pub const SessionLength: BlockNumber = 6 * HOURS; + pub const MaxInvulnerables: u32 = 100; + pub const ExecutiveBody: BodyId = BodyId::Executive; +} + +impl pallet_collator_selection::Config for Runtime { + type Currency = Balances; + // should be a multiple of session or things will get inconsistent + type KickThreshold = Period; + type MaxCandidates = MaxCandidates; + type MaxInvulnerables = MaxInvulnerables; + type MinCandidates = MinCandidates; + type PotId = PotId; + type RuntimeEvent = RuntimeEvent; + type UpdateOrigin = CollatorSelectionUpdateOrigin; + type ValidatorId = ::AccountId; + type ValidatorIdOf = pallet_collator_selection::IdentityCollator; + type ValidatorRegistration = Session; + type WeightInfo = weights::pallet_collator_selection::WeightInfo; +} diff --git a/runtime/src/pallets/dmp_queue.rs b/runtime/src/pallets/dmp_queue.rs new file mode 100644 index 000000000..609488318 --- /dev/null +++ b/runtime/src/pallets/dmp_queue.rs @@ -0,0 +1,26 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +impl cumulus_pallet_dmp_queue::Config for Runtime { + type ExecuteOverweightOrigin = EnsureRoot; + type RuntimeEvent = RuntimeEvent; + type XcmExecutor = XcmExecutor; +} diff --git a/runtime/src/pallets/mod.rs b/runtime/src/pallets/mod.rs new file mode 100644 index 000000000..4b6de8fc7 --- /dev/null +++ b/runtime/src/pallets/mod.rs @@ -0,0 +1,56 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +mod system; +pub use system::*; + +mod timestamp; +pub use timestamp::*; + +mod authorship; +pub use authorship::*; + +mod balances; +pub use balances::*; + +mod transaction_payment; +pub use transaction_payment::*; + +mod parachain_system; +pub use parachain_system::*; + +mod parachain_info_; +pub use parachain_info_::*; + +mod aura_ext; +pub use aura_ext::*; + +mod xcmp_queue; +pub use xcmp_queue::*; + +mod dmp_queue; +pub use dmp_queue::*; + +mod session; +pub use session::*; + +mod aura; +pub use aura::*; + +mod collator_selection; +pub use collator_selection::*; diff --git a/runtime/src/pallets/parachain_info_.rs b/runtime/src/pallets/parachain_info_.rs new file mode 100644 index 000000000..ff727f636 --- /dev/null +++ b/runtime/src/pallets/parachain_info_.rs @@ -0,0 +1,22 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +impl parachain_info::Config for Runtime {} diff --git a/runtime/src/pallets/parachain_system.rs b/runtime/src/pallets/parachain_system.rs new file mode 100644 index 000000000..a97fd540a --- /dev/null +++ b/runtime/src/pallets/parachain_system.rs @@ -0,0 +1,37 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +frame_support::parameter_types! { + pub const ReservedXcmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT.saturating_div(4); + pub const ReservedDmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT.saturating_div(4); +} + +impl cumulus_pallet_parachain_system::Config for Runtime { + type CheckAssociatedRelayNumber = RelayNumberStrictlyIncreases; + type DmpMessageHandler = DmpQueue; + type OnSystemEvent = (); + type OutboundXcmpMessageSource = XcmpQueue; + type ReservedDmpWeight = ReservedDmpWeight; + type ReservedXcmpWeight = ReservedXcmpWeight; + type RuntimeEvent = RuntimeEvent; + type SelfParaId = parachain_info::Pallet; + type XcmpMessageHandler = XcmpQueue; +} diff --git a/runtime/src/pallets/session.rs b/runtime/src/pallets/session.rs new file mode 100644 index 000000000..2ec09faa7 --- /dev/null +++ b/runtime/src/pallets/session.rs @@ -0,0 +1,40 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +frame_support::parameter_types! { + pub const Period: u32 = 6 * HOURS; + pub const Offset: u32 = 0; + pub const MaxAuthorities: u32 = 100_000; +} + +impl pallet_session::Config for Runtime { + type Keys = SessionKeys; + type NextSessionRotation = pallet_session::PeriodicSessions; + type RuntimeEvent = RuntimeEvent; + // Essentially just Aura, but lets be pedantic. + type SessionHandler = ::KeyTypeIdProviders; + type SessionManager = CollatorSelection; + type ShouldEndSession = pallet_session::PeriodicSessions; + type ValidatorId = ::AccountId; + // we don't have stash and controller, thus we don't need the convert as well. + type ValidatorIdOf = pallet_collator_selection::IdentityCollator; + type WeightInfo = weights::pallet_session::WeightInfo; +} diff --git a/runtime/src/pallets/system.rs b/runtime/src/pallets/system.rs new file mode 100644 index 000000000..b2efc5348 --- /dev/null +++ b/runtime/src/pallets/system.rs @@ -0,0 +1,108 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +/// We assume that ~5% of the block weight is consumed by `on_initialize` handlers. This is +/// used to limit the maximal weight of a single extrinsic. +const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(5); + +/// We allow `Normal` extrinsics to fill up the block up to 75%, the rest can be used by +/// `Operational` extrinsics. +const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75); + +/// We allow for 0.5 of a second of compute with a 12 second average block time. +pub const MAXIMUM_BLOCK_WEIGHT: Weight = + frame_support::weights::constants::WEIGHT_PER_SECOND.saturating_div(2); + +frame_support::parameter_types! { + pub const BlockHashCount: BlockNumber = 2400; + pub const Version: sp_version::RuntimeVersion = VERSION; + pub RuntimeBlockLength: frame_system::limits::BlockLength = + frame_system::limits::BlockLength::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO); + pub RuntimeBlockWeights: frame_system::limits::BlockWeights = frame_system::limits::BlockWeights::builder() + .base_block(weights::BlockExecutionWeight::get()) + .for_class(DispatchClass::all(), |weights| { + weights.base_extrinsic = weights::ExtrinsicBaseWeight::get(); + }) + .for_class(DispatchClass::Normal, |weights| { + weights.max_total = Some(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT); + }) + .for_class(DispatchClass::Operational, |weights| { + weights.max_total = Some(MAXIMUM_BLOCK_WEIGHT); + // Operational transactions have some extra reserved space, so that they + // are included even if block reached `MAXIMUM_BLOCK_WEIGHT`. + weights.reserved = Some( + MAXIMUM_BLOCK_WEIGHT - NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT + ); + }) + .avg_block_initialization(AVERAGE_ON_INITIALIZE_RATIO) + .build_or_panic(); + pub const SS58Prefix: u8 = 42; +} + +impl frame_system::Config for Runtime { + /// The data to be stored in an account. + type AccountData = pallet_balances::AccountData; + /// The identifier used to distinguish between accounts. + type AccountId = AccountId; + /// The basic call filter to use in dispatchable. + type BaseCallFilter = frame_support::traits::Everything; + /// Maximum number of block number to block hash mappings to keep (oldest pruned first). + type BlockHashCount = BlockHashCount; + /// The maximum length of a block (in bytes). + type BlockLength = RuntimeBlockLength; + /// The index type for blocks. + type BlockNumber = BlockNumber; + /// Block & extrinsics weights: base values and limits. + type BlockWeights = RuntimeBlockWeights; + /// The weight of database operations that the runtime can invoke. + type DbWeight = weights::RocksDbWeight; + /// The type for hashing blocks and tries. + type Hash = Hash; + /// The hashing algorithm used. + type Hashing = sp_runtime::traits::BlakeTwo256; + /// The header type. + type Header = generic::Header; + /// The index type for storing how many extrinsics an account has signed. + type Index = Index; + /// The lookup mechanism to get account ID from whatever is passed in dispatchers. + type Lookup = sp_runtime::traits::AccountIdLookup; + type MaxConsumers = frame_support::traits::ConstU32<16>; + /// What to do if an account is fully reaped from the system. + type OnKilledAccount = (); + /// What to do if a new account is created. + type OnNewAccount = (); + /// The action to take on a Runtime Upgrade + type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode; + /// Converts a module to an index of this module in the runtime. + type PalletInfo = PalletInfo; + /// The aggregated dispatch type that is available for extrinsics. + type RuntimeCall = RuntimeCall; + /// The ubiquitous event type. + type RuntimeEvent = RuntimeEvent; + /// The ubiquitous origin type. + type RuntimeOrigin = RuntimeOrigin; + /// This is used as an identifier of the chain. 42 is the generic substrate prefix. + type SS58Prefix = SS58Prefix; + /// Weight information for the extrinsics of this pallet. + type SystemWeightInfo = weights::frame_system::WeightInfo; + /// Runtime version. + type Version = Version; +} diff --git a/runtime/src/pallets/timestamp.rs b/runtime/src/pallets/timestamp.rs new file mode 100644 index 000000000..721751b06 --- /dev/null +++ b/runtime/src/pallets/timestamp.rs @@ -0,0 +1,32 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +frame_support::parameter_types! { + pub const MinimumPeriod: u64 = SLOT_DURATION / 2; +} + +impl pallet_timestamp::Config for Runtime { + type MinimumPeriod = MinimumPeriod; + /// A timestamp: milliseconds since the unix epoch. + type Moment = u64; + type OnTimestampSet = (); + type WeightInfo = weights::pallet_timestamp::WeightInfo; +} diff --git a/runtime/src/pallets/transaction_payment.rs b/runtime/src/pallets/transaction_payment.rs new file mode 100644 index 000000000..e79ae8264 --- /dev/null +++ b/runtime/src/pallets/transaction_payment.rs @@ -0,0 +1,35 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +frame_support::parameter_types! { + /// Relay Chain `TransactionByteFee` / 10 + pub const TransactionByteFee: Balance = 10 * MICROUNIT; + pub const OperationalFeeMultiplier: u8 = 5; +} + +impl pallet_transaction_payment::Config for Runtime { + type FeeMultiplierUpdate = polkadot_runtime_common::SlowAdjustingFeeUpdate; + type LengthToFee = ConstantMultiplier; + type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter; + type OperationalFeeMultiplier = OperationalFeeMultiplier; + type RuntimeEvent = RuntimeEvent; + type WeightToFee = WeightToFee; +} diff --git a/runtime/src/pallets/xcmp_queue.rs b/runtime/src/pallets/xcmp_queue.rs new file mode 100644 index 000000000..21fca8060 --- /dev/null +++ b/runtime/src/pallets/xcmp_queue.rs @@ -0,0 +1,31 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +impl cumulus_pallet_xcmp_queue::Config for Runtime { + type ChannelInfo = ParachainSystem; + type ControllerOrigin = EnsureRoot; + type ControllerOriginConverter = XcmOriginToTransactDispatchOrigin; + type ExecuteOverweightOrigin = EnsureRoot; + type RuntimeEvent = RuntimeEvent; + type VersionWrapper = (); + type WeightInfo = weights::cumulus_pallet_xcmp_queue::WeightInfo; + type XcmExecutor = XcmExecutor; +} diff --git a/runtime/src/weights/block_weights.rs b/runtime/src/weights/block_weights.rs new file mode 100644 index 000000000..c00430733 --- /dev/null +++ b/runtime/src/weights/block_weights.rs @@ -0,0 +1,52 @@ +// This file is part of Substrate. + +// Copyright (C) 2022 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. + +pub mod constants { + use frame_support::{ + parameter_types, + weights::{constants, Weight}, + }; + + parameter_types! { + /// Importing a block with 0 Extrinsics. + pub const BlockExecutionWeight: Weight = constants::WEIGHT_PER_NANOS.saturating_mul(5_000_000); + } + + #[cfg(test)] + mod test_weights { + use frame_support::weights::constants; + + /// Checks that the weight exists and is sane. + // NOTE: If this test fails but you are sure that the generated values are fine, + // you can delete it. + #[test] + fn sane() { + let w = super::constants::BlockExecutionWeight::get(); + + // At least 100 µs. + assert!( + w.ref_time() >= 100u64 * constants::WEIGHT_PER_MICROS.ref_time(), + "Weight should be at least 100 µs." + ); + // At most 50 ms. + assert!( + w.ref_time() <= 50u64 * constants::WEIGHT_PER_MILLIS.ref_time(), + "Weight should be at most 50 ms." + ); + } + } +} diff --git a/runtime/src/weights/cumulus_pallet_xcmp_queue.rs b/runtime/src/weights/cumulus_pallet_xcmp_queue.rs new file mode 100644 index 000000000..d018169e2 --- /dev/null +++ b/runtime/src/weights/cumulus_pallet_xcmp_queue.rs @@ -0,0 +1,67 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `cumulus_pallet_xcmp_queue` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2022-11-09, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `inv.cafe`, CPU: `AMD Ryzen 9 5950X 16-Core Processor` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("local"), DB CACHE: 1024 + +// Executed Command: +// target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --chain +// local +// --output +// runtime/src/weights +// --extrinsic +// * +// --pallet +// cumulus-pallet-xcmp-queue + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `cumulus_pallet_xcmp_queue`. +pub struct WeightInfo(PhantomData); +impl cumulus_pallet_xcmp_queue::WeightInfo for WeightInfo { + // Storage: XcmpQueue QueueConfig (r:1 w:1) + fn set_config_with_u32() -> Weight { + Weight::from_ref_time(13_340_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: XcmpQueue QueueConfig (r:1 w:1) + fn set_config_with_weight() -> Weight { + Weight::from_ref_time(12_610_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } +} diff --git a/runtime/src/weights/extrinsic_weights.rs b/runtime/src/weights/extrinsic_weights.rs new file mode 100644 index 000000000..3ce6b73d5 --- /dev/null +++ b/runtime/src/weights/extrinsic_weights.rs @@ -0,0 +1,52 @@ +// This file is part of Substrate. + +// Copyright (C) 2022 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. + +pub mod constants { + use frame_support::{ + parameter_types, + weights::{constants, Weight}, + }; + + parameter_types! { + /// Executing a NO-OP `System::remarks` Extrinsic. + pub const ExtrinsicBaseWeight: Weight = constants::WEIGHT_PER_NANOS.saturating_mul(125_000); + } + + #[cfg(test)] + mod test_weights { + use frame_support::weights::constants; + + /// Checks that the weight exists and is sane. + // NOTE: If this test fails but you are sure that the generated values are fine, + // you can delete it. + #[test] + fn sane() { + let w = super::constants::ExtrinsicBaseWeight::get(); + + // At least 10 µs. + assert!( + w.ref_time() >= 10u64 * constants::WEIGHT_PER_MICROS.ref_time(), + "Weight should be at least 10 µs." + ); + // At most 1 ms. + assert!( + w.ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(), + "Weight should be at most 1 ms." + ); + } + } +} diff --git a/runtime/src/weights/frame_system.rs b/runtime/src/weights/frame_system.rs new file mode 100644 index 000000000..b074be2fc --- /dev/null +++ b/runtime/src/weights/frame_system.rs @@ -0,0 +1,88 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `frame_system` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2022-11-09, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `inv.cafe`, CPU: `AMD Ryzen 9 5950X 16-Core Processor` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("local"), DB CACHE: 1024 + +// Executed Command: +// target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --chain +// local +// --output +// runtime/src/weights +// --extrinsic +// * +// --pallet +// frame-system + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `frame_system`. +pub struct WeightInfo(PhantomData); +impl frame_system::WeightInfo for WeightInfo { + /// The range of component `b` is `[0, 3932160]`. + fn remark(_b: u32, ) -> Weight { + Weight::from_ref_time(1_074_555_000 as u64) + } + /// The range of component `b` is `[0, 3932160]`. + fn remark_with_event(_b: u32, ) -> Weight { + Weight::from_ref_time(4_724_488_000 as u64) + } + // Storage: System Digest (r:1 w:1) + // Storage: unknown [0x3a686561707061676573] (r:0 w:1) + fn set_heap_pages() -> Weight { + Weight::from_ref_time(14_110_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) + } + // Storage: Skipped Metadata (r:0 w:0) + /// The range of component `i` is `[1, 1000]`. + fn set_storage(_i: u32, ) -> Weight { + Weight::from_ref_time(655_299_000 as u64) + .saturating_add(T::DbWeight::get().writes(1000 as u64)) + } + // Storage: Skipped Metadata (r:0 w:0) + /// The range of component `i` is `[1, 1000]`. + fn kill_storage(_i: u32, ) -> Weight { + Weight::from_ref_time(555_697_000 as u64) + .saturating_add(T::DbWeight::get().writes(1000 as u64)) + } + // Storage: Skipped Metadata (r:0 w:0) + /// The range of component `p` is `[1, 1000]`. + fn kill_prefix(_p: u32, ) -> Weight { + Weight::from_ref_time(1_089_395_000 as u64) + .saturating_add(T::DbWeight::get().writes(1000 as u64)) + } +} diff --git a/runtime/src/weights/mod.rs b/runtime/src/weights/mod.rs new file mode 100644 index 000000000..74dbfcbbd --- /dev/null +++ b/runtime/src/weights/mod.rs @@ -0,0 +1,40 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Expose the auto generated weight files. + +#![allow(clippy::unnecessary_cast)] + +pub mod block_weights; +pub use block_weights::constants::BlockExecutionWeight; + +pub mod extrinsic_weights; +pub use extrinsic_weights::constants::ExtrinsicBaseWeight; + +pub mod paritydb_weights; +pub use paritydb_weights::constants::ParityDbWeight; + +pub mod rocksdb_weights; +pub use rocksdb_weights::constants::RocksDbWeight; + +pub mod cumulus_pallet_xcmp_queue; +pub mod frame_system; +pub mod pallet_balances; +pub mod pallet_collator_selection; +pub mod pallet_session; +pub mod pallet_timestamp; diff --git a/runtime/src/weights/pallet_balances.rs b/runtime/src/weights/pallet_balances.rs new file mode 100644 index 000000000..830c7c8cb --- /dev/null +++ b/runtime/src/weights/pallet_balances.rs @@ -0,0 +1,97 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `pallet_balances` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2022-11-09, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `inv.cafe`, CPU: `AMD Ryzen 9 5950X 16-Core Processor` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("local"), DB CACHE: 1024 + +// Executed Command: +// target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --chain +// local +// --output +// runtime/src/weights +// --extrinsic +// * +// --pallet +// pallet-balances + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_balances`. +pub struct WeightInfo(PhantomData); +impl pallet_balances::WeightInfo for WeightInfo { + // Storage: System Account (r:1 w:1) + fn transfer() -> Weight { + Weight::from_ref_time(57_141_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: System Account (r:1 w:1) + fn transfer_keep_alive() -> Weight { + Weight::from_ref_time(43_271_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: System Account (r:1 w:1) + fn set_balance_creating() -> Weight { + Weight::from_ref_time(29_941_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: System Account (r:1 w:1) + fn set_balance_killing() -> Weight { + Weight::from_ref_time(34_490_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: System Account (r:2 w:2) + fn force_transfer() -> Weight { + Weight::from_ref_time(54_911_000 as u64) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) + } + // Storage: System Account (r:1 w:1) + fn transfer_all() -> Weight { + Weight::from_ref_time(49_671_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: System Account (r:1 w:1) + fn force_unreserve() -> Weight { + Weight::from_ref_time(26_120_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } +} diff --git a/runtime/src/weights/pallet_collator_selection.rs b/runtime/src/weights/pallet_collator_selection.rs new file mode 100644 index 000000000..affdfcef8 --- /dev/null +++ b/runtime/src/weights/pallet_collator_selection.rs @@ -0,0 +1,111 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `pallet_collator_selection` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2022-11-09, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `inv.cafe`, CPU: `AMD Ryzen 9 5950X 16-Core Processor` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("local"), DB CACHE: 1024 + +// Executed Command: +// target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --chain +// local +// --output +// runtime/src/weights +// --extrinsic +// set_invulnerables,set_desired_candidates,set_candidacy_bond,leave_intent,new_session,note_author +// --pallet +// pallet-collator-selection + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_collator_selection`. +pub struct WeightInfo(PhantomData); +impl pallet_collator_selection::WeightInfo for WeightInfo { + // Storage: Session NextKeys (r:1 w:0) + // Storage: CollatorSelection Invulnerables (r:0 w:1) + /// The range of component `b` is `[1, 100]`. + fn set_invulnerables(_b: u32, ) -> Weight { + Weight::from_ref_time(317_565_000 as u64) + .saturating_add(T::DbWeight::get().reads(100 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: CollatorSelection DesiredCandidates (r:0 w:1) + fn set_desired_candidates() -> Weight { + Weight::from_ref_time(19_951_000 as u64) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: CollatorSelection CandidacyBond (r:0 w:1) + fn set_candidacy_bond() -> Weight { + Weight::from_ref_time(19_730_000 as u64) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + fn register_as_candidate(c: u32) -> Weight { + Weight::from_ref_time(71_196_000 as u64) + // Standard Error: 0 + .saturating_add(Weight::from_ref_time(198_000 as u64).saturating_mul(c as u64)) + .saturating_add(T::DbWeight::get().reads(4 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) + } + // Storage: CollatorSelection Candidates (r:1 w:1) + // Storage: CollatorSelection LastAuthoredBlock (r:0 w:1) + /// The range of component `c` is `[6, 1000]`. + fn leave_intent(_c: u32, ) -> Weight { + Weight::from_ref_time(181_302_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) + } + // Storage: System Account (r:2 w:2) + // Storage: System BlockWeight (r:1 w:1) + // Storage: CollatorSelection LastAuthoredBlock (r:0 w:1) + fn note_author() -> Weight { + Weight::from_ref_time(43_091_000 as u64) + .saturating_add(T::DbWeight::get().reads(3 as u64)) + .saturating_add(T::DbWeight::get().writes(4 as u64)) + } + // Storage: CollatorSelection Candidates (r:1 w:1) + // Storage: CollatorSelection LastAuthoredBlock (r:1000 w:1) + // Storage: System Account (r:1 w:1) + // Storage: CollatorSelection Invulnerables (r:1 w:0) + // Storage: System BlockWeight (r:1 w:1) + /// The range of component `r` is `[1, 1000]`. + /// The range of component `c` is `[1, 1000]`. + fn new_session(_r: u32, c: u32, ) -> Weight { + Weight::from_ref_time(28_111_000 as u64) + // Standard Error: 39_309 + .saturating_add(Weight::from_ref_time(3_055_761 as u64).saturating_mul(c as u64)) + .saturating_add(T::DbWeight::get().reads(4 as u64)) + .saturating_add(T::DbWeight::get().reads((1 as u64).saturating_mul(c as u64))) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } +} diff --git a/runtime/src/weights/pallet_session.rs b/runtime/src/weights/pallet_session.rs new file mode 100644 index 000000000..f776ff689 --- /dev/null +++ b/runtime/src/weights/pallet_session.rs @@ -0,0 +1,69 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `pallet_session` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2022-11-09, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `inv.cafe`, CPU: `AMD Ryzen 9 5950X 16-Core Processor` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("local"), DB CACHE: 1024 + +// Executed Command: +// target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --chain +// local +// --output +// runtime/src/weights +// --extrinsic +// * +// --pallet +// pallet-session + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_session`. +pub struct WeightInfo(PhantomData); +impl pallet_session::WeightInfo for WeightInfo { + // Storage: Session NextKeys (r:1 w:1) + // Storage: Session KeyOwner (r:1 w:1) + fn set_keys() -> Weight { + Weight::from_ref_time(30_781_000 as u64) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) + } + // Storage: Session NextKeys (r:1 w:1) + // Storage: Session KeyOwner (r:0 w:1) + fn purge_keys() -> Weight { + Weight::from_ref_time(22_911_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) + } +} diff --git a/runtime/src/weights/pallet_timestamp.rs b/runtime/src/weights/pallet_timestamp.rs new file mode 100644 index 000000000..fba28a6b0 --- /dev/null +++ b/runtime/src/weights/pallet_timestamp.rs @@ -0,0 +1,64 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `pallet_timestamp` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2022-11-09, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `inv.cafe`, CPU: `AMD Ryzen 9 5950X 16-Core Processor` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("local"), DB CACHE: 1024 + +// Executed Command: +// target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --chain +// local +// --output +// runtime/src/weights +// --extrinsic +// * +// --pallet +// pallet-timestamp + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_timestamp`. +pub struct WeightInfo(PhantomData); +impl pallet_timestamp::WeightInfo for WeightInfo { + // Storage: Timestamp Now (r:1 w:1) + fn set() -> Weight { + Weight::from_ref_time(13_230_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + fn on_finalize() -> Weight { + Weight::from_ref_time(5_710_000 as u64) + } +} diff --git a/runtime/src/weights/paritydb_weights.rs b/runtime/src/weights/paritydb_weights.rs new file mode 100644 index 000000000..dca7d3483 --- /dev/null +++ b/runtime/src/weights/paritydb_weights.rs @@ -0,0 +1,63 @@ +// This file is part of Substrate. + +// Copyright (C) 2022 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. + +pub mod constants { + use frame_support::{ + parameter_types, + weights::{constants, RuntimeDbWeight}, + }; + + parameter_types! { + /// `ParityDB` can be enabled with a feature flag, but is still experimental. These weights + /// are available for brave runtime engineers who may want to try this out as default. + pub const ParityDbWeight: RuntimeDbWeight = RuntimeDbWeight { + read: 8_000 * constants::WEIGHT_PER_NANOS.ref_time(), + write: 50_000 * constants::WEIGHT_PER_NANOS.ref_time(), + }; + } + + #[cfg(test)] + mod test_db_weights { + use super::constants::ParityDbWeight as W; + use frame_support::weights::constants; + + /// Checks that all weights exist and have sane values. + // NOTE: If this test fails but you are sure that the generated values are fine, + // you can delete it. + #[test] + fn sane() { + // At least 1 µs. + assert!( + W::get().reads(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(), + "Read weight should be at least 1 µs." + ); + assert!( + W::get().writes(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(), + "Write weight should be at least 1 µs." + ); + // At most 1 ms. + assert!( + W::get().reads(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(), + "Read weight should be at most 1 ms." + ); + assert!( + W::get().writes(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(), + "Write weight should be at most 1 ms." + ); + } + } +} diff --git a/runtime/src/weights/rocksdb_weights.rs b/runtime/src/weights/rocksdb_weights.rs new file mode 100644 index 000000000..87867ebfe --- /dev/null +++ b/runtime/src/weights/rocksdb_weights.rs @@ -0,0 +1,63 @@ +// This file is part of Substrate. + +// Copyright (C) 2022 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. + +pub mod constants { + use frame_support::{ + parameter_types, + weights::{constants, RuntimeDbWeight}, + }; + + parameter_types! { + /// By default, Substrate uses `RocksDB`, so this will be the weight used throughout + /// the runtime. + pub const RocksDbWeight: RuntimeDbWeight = RuntimeDbWeight { + read: 25_000 * constants::WEIGHT_PER_NANOS.ref_time(), + write: 100_000 * constants::WEIGHT_PER_NANOS.ref_time(), + }; + } + + #[cfg(test)] + mod test_db_weights { + use super::constants::RocksDbWeight as W; + use frame_support::weights::constants; + + /// Checks that all weights exist and have sane values. + // NOTE: If this test fails but you are sure that the generated values are fine, + // you can delete it. + #[test] + fn sane() { + // At least 1 µs. + assert!( + W::get().reads(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(), + "Read weight should be at least 1 µs." + ); + assert!( + W::get().writes(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(), + "Write weight should be at least 1 µs." + ); + // At most 1 ms. + assert!( + W::get().reads(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(), + "Read weight should be at most 1 ms." + ); + assert!( + W::get().writes(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(), + "Write weight should be at most 1 ms." + ); + } + } +} diff --git a/runtime/src/xcm_config/barrier.rs b/runtime/src/xcm_config/barrier.rs new file mode 100644 index 000000000..e1fcf22c3 --- /dev/null +++ b/runtime/src/xcm_config/barrier.rs @@ -0,0 +1,108 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// core +use core::marker::PhantomData; +// polkadot +use xcm::latest::{prelude::*, Weight as XCMWeight}; +use xcm_builder::*; +use xcm_executor::traits::ShouldExecute; +// substrate +use frame_support::{log, traits::Everything}; + +frame_support::match_types! { + pub type ParentOrParentsExecutivePlurality: impl Contains = { + MultiLocation { parents: 1, interior: Here } | + MultiLocation { parents: 1, interior: X1(Plurality { id: BodyId::Executive, .. }) } + }; +} + +//TODO: move DenyThenTry to polkadot's xcm module. +/// Deny executing the xcm message if it matches any of the Deny filter regardless of anything else. +/// If it passes the Deny, and matches one of the Allow cases then it is let through. +pub struct DenyThenTry(PhantomData, PhantomData) +where + Deny: ShouldExecute, + Allow: ShouldExecute; + +impl ShouldExecute for DenyThenTry +where + Deny: ShouldExecute, + Allow: ShouldExecute, +{ + fn should_execute( + origin: &MultiLocation, + message: &mut Xcm, + max_weight: XCMWeight, + weight_credit: &mut XCMWeight, + ) -> Result<(), ()> { + Deny::should_execute(origin, message, max_weight, weight_credit)?; + Allow::should_execute(origin, message, max_weight, weight_credit) + } +} + +// See issue #5233 +pub struct DenyReserveTransferToRelayChain; +impl ShouldExecute for DenyReserveTransferToRelayChain { + fn should_execute( + origin: &MultiLocation, + + message: &mut Xcm, + _max_weight: XCMWeight, + _weight_credit: &mut XCMWeight, + ) -> Result<(), ()> { + if message.0.iter().any(|inst| { + matches!( + inst, + InitiateReserveWithdraw { + reserve: MultiLocation { parents: 1, interior: Here }, + .. + } | DepositReserveAsset { dest: MultiLocation { parents: 1, interior: Here }, .. } + | TransferReserveAsset { + dest: MultiLocation { parents: 1, interior: Here }, + .. + } + ) + }) { + return Err(()); // Deny + } + + // An unexpected reserve transfer has arrived from the Relay Chain. Generally, `IsReserve` + // should not allow this, but we just log it here. + if matches!(origin, MultiLocation { parents: 1, interior: Here }) + && message.0.iter().any(|inst| matches!(inst, ReserveAssetDeposited { .. })) + { + log::warn!( + target: "xcm::barriers", + "Unexpected ReserveAssetDeposited from the Relay Chain", + ); + } + // Permit everything else + Ok(()) + } +} + +pub type Barrier = DenyThenTry< + DenyReserveTransferToRelayChain, + ( + TakeWeightCredit, + AllowTopLevelPaidExecutionFrom, + AllowUnpaidExecutionFrom, + // ^^^ Parent and its exec plurality get free execution + ), +>; diff --git a/runtime/src/xcm_config/mod.rs b/runtime/src/xcm_config/mod.rs new file mode 100644 index 000000000..804a012c0 --- /dev/null +++ b/runtime/src/xcm_config/mod.rs @@ -0,0 +1,148 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +mod barrier; +use barrier::Barrier; + +// darwinia +use crate::*; +// polkadot +use pallet_xcm::XcmPassthrough; +use polkadot_parachain::primitives::Sibling; +use polkadot_runtime_common::impls::ToAuthor; +use xcm::latest::prelude::*; +use xcm_builder::*; +use xcm_executor::XcmExecutor; +// substrate +use frame_support::traits::{Everything, Nothing}; + +/// Means for transacting assets on this chain. +pub type LocalAssetTransactor = CurrencyAdapter< + // Use this currency: + Balances, + // Use this currency when it is a fungible asset matching the given location or name: + IsConcrete, + // Do a simple punn to convert an AccountId32 MultiLocation into a native chain account ID: + LocationToAccountId, + // Our chain's account ID type (we can't get away without mentioning it explicitly): + AccountId, + // We don't track any teleports. + (), +>; + +frame_support::parameter_types! { + pub const RelayNetwork: NetworkId = NetworkId::Any; + pub RelayChainOrigin: RuntimeOrigin = cumulus_pallet_xcm::Origin::Relay.into(); +} +/// Type for specifying how a `MultiLocation` can be converted into an `AccountId`. This is used +/// when determining ownership of accounts for asset transacting and when attempting to use XCM +/// `Transact` in order to determine the dispatch Origin. +pub type LocationToAccountId = ( + // The parent (Relay-chain) origin converts to the parent `AccountId`. + ParentIsPreset, + // Sibling parachain origins convert to AccountId via the `ParaId::into`. + SiblingParachainConvertsVia, + // Straight up local `AccountId32` origins just alias directly to `AccountId`. + AccountId32Aliases, +); +/// This is the type we use to convert an (incoming) XCM origin into a local `Origin` instance, +/// ready for dispatching a transaction with Xcm's `Transact`. There is an `OriginKind` which can +/// biases the kind of local `Origin` it will become. +pub type XcmOriginToTransactDispatchOrigin = ( + // Sovereign account converter; this attempts to derive an `AccountId` from the origin location + // using `LocationToAccountId` and then turn that into the usual `Signed` origin. Useful for + // foreign chains who want to have a local sovereign account on this chain which they control. + SovereignSignedViaLocation, + // Native converter for Relay-chain (Parent) location; will converts to a `Relay` origin when + // recognized. + RelayChainAsNative, + // Native converter for sibling Parachains; will convert to a `SiblingPara` origin when + // recognized. + SiblingParachainAsNative, + // Native signed account converter; this just converts an `AccountId32` origin into a normal + // `RuntimeOrigin::Signed` origin of the same 32-byte value. + SignedAccountId32AsNative, + // Xcm origins can be represented natively under the Xcm pallet's Xcm origin. + XcmPassthrough, +); + +frame_support::parameter_types! { + pub const RelayLocation: MultiLocation = MultiLocation::parent(); + pub const MaxInstructions: u32 = 100; + // One XCM operation is 1_000_000_000 weight - almost certainly a conservative estimate. + pub Ancestry: MultiLocation = Parachain(ParachainInfo::parachain_id().into()).into(); + pub UnitWeightCost: u64 = 1_000_000_000; +} + +pub struct XcmConfig; +impl xcm_executor::Config for XcmConfig { + type AssetClaims = PolkadotXcm; + // How to withdraw and deposit an asset. + type AssetTransactor = LocalAssetTransactor; + type AssetTrap = PolkadotXcm; + type Barrier = Barrier; + type IsReserve = NativeAsset; + type IsTeleporter = (); + // Teleporting is disabled. + type LocationInverter = LocationInverter; + type OriginConverter = XcmOriginToTransactDispatchOrigin; + type ResponseHandler = PolkadotXcm; + type RuntimeCall = RuntimeCall; + type SubscriptionService = PolkadotXcm; + type Trader = + UsingComponents>; + type Weigher = FixedWeightBounds; + type XcmSender = XcmRouter; +} + +/// No local origins on this chain are allowed to dispatch XCM sends/executions. +pub type LocalOriginToLocation = SignedToAccountId32; +/// The means for routing XCM messages which are not for local execution into the right message +/// queues. +pub type XcmRouter = ( + // Two routers - use UMP to communicate with the relay chain: + cumulus_primitives_utility::ParentAsUmp, + // ..and XCMP to communicate with the sibling chains. + XcmpQueue, +); + +impl pallet_xcm::Config for Runtime { + // ^ Override for AdvertisedXcmVersion default + type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion; + type ExecuteXcmOrigin = EnsureXcmOrigin; + type LocationInverter = LocationInverter; + type RuntimeCall = RuntimeCall; + type RuntimeEvent = RuntimeEvent; + type RuntimeOrigin = RuntimeOrigin; + type SendXcmOrigin = EnsureXcmOrigin; + type Weigher = FixedWeightBounds; + type XcmExecuteFilter = Nothing; + // ^ Disable dispatchable execute on the XCM pallet. + // Needs to be `Everything` for local testing. + type XcmExecutor = XcmExecutor; + type XcmReserveTransferFilter = Nothing; + type XcmRouter = XcmRouter; + type XcmTeleportFilter = Everything; + + const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100; +} + +impl cumulus_pallet_xcm::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type XcmExecutor = XcmExecutor; +} diff --git a/rust-toolchain.toml b/rust-toolchain.toml index fe0f225b6..f0a04ee40 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,5 +1,5 @@ [toolchain] -channel = "nightly-2022-07-24" +channel = "nightly-2022-09-19" components = ["cargo", "clippy", "rustc", "rustfmt", "rust-src"] profile = "minimal" targets = ["wasm32-unknown-unknown"] From 1aa4cc0d9dd9293bf937cb0e6d6c9022cad2780d Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Fri, 11 Nov 2022 11:49:02 +0800 Subject: [PATCH 003/189] Docs & formatting (#33) --- node/src/command.rs | 305 ++++++++++++++++++++++---------------------- node/src/rpc.rs | 12 +- node/src/service.rs | 60 ++++----- 3 files changed, 182 insertions(+), 195 deletions(-) diff --git a/node/src/command.rs b/node/src/command.rs index 9565e73b6..d4486f6dd 100644 --- a/node/src/command.rs +++ b/node/src/command.rs @@ -43,12 +43,22 @@ use sc_service::{ use sp_core::hexdisplay::HexDisplay; use sp_runtime::traits::{AccountIdConversion, Block as BlockT}; -fn load_spec(id: &str) -> std::result::Result, String> { - Ok(match id { - "dev" => Box::new(chain_spec::development_config()), - "" | "local" => Box::new(chain_spec::local_testnet_config()), - path => Box::new(chain_spec::ChainSpec::from_json_file(std::path::PathBuf::from(path))?), - }) +macro_rules! construct_async_run { + (|$components:ident, $cli:ident, $cmd:ident, $config:ident| $( $code:tt )* ) => {{ + let runner = $cli.create_runner($cmd)?; + runner.async_run(|$config| { + let $components = service::new_partial::< + RuntimeApi, + DarwiniaRuntimeExecutor, + _ + >( + &$config, + crate::service::parachain_build_import_queue, + )?; + let task_manager = $components.task_manager; + { $( $code )* }.map(|v| (v, task_manager)) + }) + }} } impl SubstrateCli for Cli { @@ -130,23 +140,137 @@ impl SubstrateCli for RelayChainCli { polkadot_cli::Cli::native_runtime_version(chain_spec) } } +impl DefaultConfigurationValues for RelayChainCli { + fn p2p_listen_port() -> u16 { + 30334 + } -macro_rules! construct_async_run { - (|$components:ident, $cli:ident, $cmd:ident, $config:ident| $( $code:tt )* ) => {{ - let runner = $cli.create_runner($cmd)?; - runner.async_run(|$config| { - let $components = service::new_partial::< - RuntimeApi, - DarwiniaRuntimeExecutor, - _ - >( - &$config, - crate::service::parachain_build_import_queue, - )?; - let task_manager = $components.task_manager; - { $( $code )* }.map(|v| (v, task_manager)) - }) - }} + fn rpc_ws_listen_port() -> u16 { + 9945 + } + + fn rpc_http_listen_port() -> u16 { + 9934 + } + + fn prometheus_listen_port() -> u16 { + 9616 + } +} +impl CliConfiguration for RelayChainCli { + fn shared_params(&self) -> &SharedParams { + self.base.base.shared_params() + } + + fn import_params(&self) -> Option<&ImportParams> { + self.base.base.import_params() + } + + fn network_params(&self) -> Option<&NetworkParams> { + self.base.base.network_params() + } + + fn keystore_params(&self) -> Option<&KeystoreParams> { + self.base.base.keystore_params() + } + + fn base_path(&self) -> Result> { + Ok(self.shared_params().base_path()?.or_else(|| self.base_path.clone().map(Into::into))) + } + + fn rpc_http(&self, default_listen_port: u16) -> Result> { + self.base.base.rpc_http(default_listen_port) + } + + fn rpc_ipc(&self) -> Result> { + self.base.base.rpc_ipc() + } + + fn rpc_ws(&self, default_listen_port: u16) -> Result> { + self.base.base.rpc_ws(default_listen_port) + } + + fn prometheus_config( + &self, + default_listen_port: u16, + chain_spec: &Box, + ) -> Result> { + self.base.base.prometheus_config(default_listen_port, chain_spec) + } + + fn init( + &self, + _support_url: &String, + _impl_version: &String, + _logger_hook: F, + _config: &sc_service::Configuration, + ) -> Result<()> + where + F: FnOnce(&mut sc_cli::LoggerBuilder, &sc_service::Configuration), + { + unreachable!("PolkadotCli is never initialized; qed"); + } + + fn chain_id(&self, is_dev: bool) -> Result { + let chain_id = self.base.base.chain_id(is_dev)?; + + Ok(if chain_id.is_empty() { self.chain_id.clone().unwrap_or_default() } else { chain_id }) + } + + fn role(&self, is_dev: bool) -> Result { + self.base.base.role(is_dev) + } + + fn transaction_pool(&self, is_dev: bool) -> Result { + self.base.base.transaction_pool(is_dev) + } + + fn trie_cache_maximum_size(&self) -> Result> { + self.base.base.trie_cache_maximum_size() + } + + fn rpc_methods(&self) -> Result { + self.base.base.rpc_methods() + } + + fn rpc_ws_max_connections(&self) -> Result> { + self.base.base.rpc_ws_max_connections() + } + + fn rpc_cors(&self, is_dev: bool) -> Result>> { + self.base.base.rpc_cors(is_dev) + } + + fn default_heap_pages(&self) -> Result> { + self.base.base.default_heap_pages() + } + + fn force_authoring(&self) -> Result { + self.base.base.force_authoring() + } + + fn disable_grandpa(&self) -> Result { + self.base.base.disable_grandpa() + } + + fn max_runtime_instances(&self) -> Result> { + self.base.base.max_runtime_instances() + } + + fn announce_block(&self) -> Result { + self.base.base.announce_block() + } + + fn telemetry_endpoints( + &self, + chain_spec: &Box, + ) -> Result> { + self.base.base.telemetry_endpoints(chain_spec) + } + + fn node_name(&self) -> Result { + self.base.base.node_name() + } } /// Parse command line arguments into service configuration. @@ -337,136 +461,11 @@ pub fn run() -> Result<()> { } } -impl DefaultConfigurationValues for RelayChainCli { - fn p2p_listen_port() -> u16 { - 30334 - } - - fn rpc_ws_listen_port() -> u16 { - 9945 - } - - fn rpc_http_listen_port() -> u16 { - 9934 - } - - fn prometheus_listen_port() -> u16 { - 9616 - } -} - -impl CliConfiguration for RelayChainCli { - fn shared_params(&self) -> &SharedParams { - self.base.base.shared_params() - } - - fn import_params(&self) -> Option<&ImportParams> { - self.base.base.import_params() - } - - fn network_params(&self) -> Option<&NetworkParams> { - self.base.base.network_params() - } - - fn keystore_params(&self) -> Option<&KeystoreParams> { - self.base.base.keystore_params() - } - - fn base_path(&self) -> Result> { - Ok(self.shared_params().base_path()?.or_else(|| self.base_path.clone().map(Into::into))) - } - - fn rpc_http(&self, default_listen_port: u16) -> Result> { - self.base.base.rpc_http(default_listen_port) - } - - fn rpc_ipc(&self) -> Result> { - self.base.base.rpc_ipc() - } - - fn rpc_ws(&self, default_listen_port: u16) -> Result> { - self.base.base.rpc_ws(default_listen_port) - } - - fn prometheus_config( - &self, - default_listen_port: u16, - chain_spec: &Box, - ) -> Result> { - self.base.base.prometheus_config(default_listen_port, chain_spec) - } - - fn init( - &self, - _support_url: &String, - _impl_version: &String, - _logger_hook: F, - _config: &sc_service::Configuration, - ) -> Result<()> - where - F: FnOnce(&mut sc_cli::LoggerBuilder, &sc_service::Configuration), - { - unreachable!("PolkadotCli is never initialized; qed"); - } - - fn chain_id(&self, is_dev: bool) -> Result { - let chain_id = self.base.base.chain_id(is_dev)?; - - Ok(if chain_id.is_empty() { self.chain_id.clone().unwrap_or_default() } else { chain_id }) - } - - fn role(&self, is_dev: bool) -> Result { - self.base.base.role(is_dev) - } - - fn transaction_pool(&self, is_dev: bool) -> Result { - self.base.base.transaction_pool(is_dev) - } - - fn trie_cache_maximum_size(&self) -> Result> { - self.base.base.trie_cache_maximum_size() - } - - fn rpc_methods(&self) -> Result { - self.base.base.rpc_methods() - } - - fn rpc_ws_max_connections(&self) -> Result> { - self.base.base.rpc_ws_max_connections() - } - - fn rpc_cors(&self, is_dev: bool) -> Result>> { - self.base.base.rpc_cors(is_dev) - } - - fn default_heap_pages(&self) -> Result> { - self.base.base.default_heap_pages() - } - - fn force_authoring(&self) -> Result { - self.base.base.force_authoring() - } - - fn disable_grandpa(&self) -> Result { - self.base.base.disable_grandpa() - } - - fn max_runtime_instances(&self) -> Result> { - self.base.base.max_runtime_instances() - } - - fn announce_block(&self) -> Result { - self.base.base.announce_block() - } - - fn telemetry_endpoints( - &self, - chain_spec: &Box, - ) -> Result> { - self.base.base.telemetry_endpoints(chain_spec) - } - fn node_name(&self) -> Result { - self.base.base.node_name() - } +fn load_spec(id: &str) -> std::result::Result, String> { + Ok(match id { + "dev" => Box::new(chain_spec::development_config()), + "" | "local" => Box::new(chain_spec::local_testnet_config()), + path => Box::new(chain_spec::ChainSpec::from_json_file(std::path::PathBuf::from(path))?), + }) } diff --git a/node/src/rpc.rs b/node/src/rpc.rs index 84fc0d770..a9139d9b8 100644 --- a/node/src/rpc.rs +++ b/node/src/rpc.rs @@ -52,17 +52,17 @@ pub fn create_full( deps: FullDeps, ) -> Result> where - C: ProvideRuntimeApi - + HeaderBackend - + AuxStore - + HeaderMetadata + C: 'static + Send + Sync - + 'static, + + ProvideRuntimeApi + + HeaderBackend + + AuxStore + + HeaderMetadata, C::Api: pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi + substrate_frame_rpc_system::AccountNonceApi + BlockBuilder, - P: TransactionPool + Sync + Send + 'static, + P: 'static + Send + Sync + TransactionPool, { // substrate use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApiServer}; diff --git a/node/src/service.rs b/node/src/service.rs index a17bfe997..f46e43be1 100644 --- a/node/src/service.rs +++ b/node/src/service.rs @@ -20,16 +20,10 @@ // std use std::{sync::Arc, time::Duration}; - -// rpc +// crates.io use jsonrpsee::RpcModule; - +// cumulus use cumulus_client_cli::CollatorOptions; -// Local Runtime Types -use darwinia_runtime::RuntimeApi; -use dc_primitives::*; - -// Cumulus Imports use cumulus_client_consensus_aura::{AuraConsensus, BuildAuraConsensusParams, SlotProportion}; use cumulus_client_consensus_common::ParachainConsensus; use cumulus_client_network::BlockAnnounceValidator; @@ -40,8 +34,12 @@ use cumulus_primitives_core::ParaId; use cumulus_relay_chain_inprocess_interface::build_inprocess_relay_chain; use cumulus_relay_chain_interface::{RelayChainError, RelayChainInterface, RelayChainResult}; use cumulus_relay_chain_rpc_interface::{create_client_and_start_worker, RelayChainRpcInterface}; - -// Substrate Imports +// darwinia +use darwinia_runtime::RuntimeApi; +use dc_primitives::*; +// polkadot +use polkadot_service::CollatorPair; +// substrate use sc_executor::NativeElseWasmExecutor; use sc_network::NetworkService; use sc_network_common::service::NetworkBlock; @@ -52,11 +50,8 @@ use sp_keystore::SyncCryptoStorePtr; use sp_runtime::traits::BlakeTwo256; use substrate_prometheus_endpoint::Registry; -use polkadot_service::CollatorPair; - /// Native executor instance. pub struct DarwiniaRuntimeExecutor; - impl sc_executor::NativeExecutionDispatch for DarwiniaRuntimeExecutor { type ExtendHostFunctions = frame_benchmarking::benchmarking::HostFunctions; @@ -95,10 +90,10 @@ pub fn new_partial( sc_service::Error, > where - RuntimeApi: ConstructRuntimeApi>> + RuntimeApi: 'static + Send + Sync - + 'static, + + ConstructRuntimeApi>>, RuntimeApi::RuntimeApi: sp_transaction_pool::runtime_api::TaggedTransactionQueue + sp_api::Metadata + sp_session::SessionKeys @@ -108,7 +103,7 @@ where > + sp_offchain::OffchainWorkerApi + sp_block_builder::BlockBuilder, sc_client_api::StateBackendFor, Block>: sp_api::StateBackend, - Executor: sc_executor::NativeExecutionDispatch + 'static, + Executor: 'static + sc_executor::NativeExecutionDispatch, BIQ: FnOnce( Arc>>, &Configuration, @@ -132,14 +127,12 @@ where Ok((worker, telemetry)) }) .transpose()?; - let executor = sc_executor::NativeElseWasmExecutor::::new( config.wasm_method, config.default_heap_pages, config.max_runtime_instances, config.runtime_cache_size, ); - let (client, backend, keystore_container, task_manager) = sc_service::new_full_parts::( config, @@ -147,14 +140,11 @@ where executor, )?; let client = Arc::new(client); - let telemetry_worker_handle = telemetry.as_ref().map(|(worker, _)| worker.handle()); - let telemetry = telemetry.map(|(worker, telemetry)| { task_manager.spawn_handle().spawn("telemetry", None, worker.run()); telemetry }); - let transaction_pool = sc_transaction_pool::BasicPool::new_full( config.transaction_pool.clone(), config.role.is_authority().into(), @@ -162,7 +152,6 @@ where task_manager.spawn_essential_handle(), client.clone(), ); - let import_queue = build_import_queue( client.clone(), config, @@ -170,7 +159,7 @@ where &task_manager, )?; - let params = PartialComponents { + Ok(PartialComponents { backend, client, import_queue, @@ -179,9 +168,7 @@ where transaction_pool, select_chain: (), other: (telemetry, telemetry_worker_handle), - }; - - Ok(params) + }) } async fn build_relay_chain_interface( @@ -191,7 +178,7 @@ async fn build_relay_chain_interface( task_manager: &mut TaskManager, collator_options: CollatorOptions, hwbench: Option, -) -> RelayChainResult<(Arc<(dyn RelayChainInterface + 'static)>, Option)> { +) -> RelayChainResult<(Arc<(dyn 'static + RelayChainInterface)>, Option)> { match collator_options.relay_chain_rpc_url { Some(relay_chain_url) => { let client = create_client_and_start_worker(relay_chain_url, task_manager).await?; @@ -226,10 +213,10 @@ async fn start_node_impl( Arc>>, )> where - RuntimeApi: ConstructRuntimeApi>> + RuntimeApi: 'static + Send + Sync - + 'static, + + ConstructRuntimeApi>>, RuntimeApi::RuntimeApi: sp_transaction_pool::runtime_api::TaggedTransactionQueue + sp_api::Metadata + sp_session::SessionKeys @@ -242,13 +229,14 @@ where + pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi + substrate_frame_rpc_system::AccountNonceApi, sc_client_api::StateBackendFor, Block>: sp_api::StateBackend, - Executor: sc_executor::NativeExecutionDispatch + 'static, - RB: Fn( - Arc>, - ) -> Result, sc_service::Error> + Executor: 'static + sc_executor::NativeExecutionDispatch, + RB: 'static + Send - + 'static, - BIQ: FnOnce( + + Fn( + Arc>, + ) -> Result, sc_service::Error>, + BIQ: 'static + + FnOnce( Arc>>, &Configuration, Option, @@ -259,7 +247,7 @@ where TFullClient>, >, sc_service::Error, - > + 'static, + >, BIC: FnOnce( Arc>>, Option<&Registry>, From e5dfcd69b23866c3d5fbc9c5aaa86c85a827b0c0 Mon Sep 17 00:00:00 2001 From: bear Date: Mon, 14 Nov 2022 18:14:33 +0800 Subject: [PATCH 004/189] Add EVM stuff (#30) * Skeleton * XCM configs * Bump toolchain * Code cleaning part.1 * Code cleaning part.2 * Update SS58 * Rename * Update token decimals * Format * Extract darwinia core primitives * Add frontier deps without fork! * License * Add pallets to runtime * Benchmarks * Append command part * Extract constants * Docs * CI part.1 * Adjust the runtime pallets structure (#29) * frame-system * pallet-timestamp * pallet-authorship * pallet-balances * pallet-transaction-payment * pallet-parachain-system * pallet-parachain-info * pallet-aura-ext * pallet-xcmp-queue * pallet-dmp-queue * pallet-session * pallet-aura * pallet-collator-selection * format * deal ambiguous name * fix compile * clear imports * update visibility for pallets * add license for pallets * update darwinia comments * Adapt main * Delete duplicated consts * Hack rpc * Client compile fix * Fix client * Move to ethereum mod * Add more precompile * Fix some issue * Solve conflict * Merge issues * Format * Add basic code for precompiles * Update EthRpcConfig * Use Hashing type * Foramt issue * Adjust service config * Add evm, ethereum feature * Add missing features * Move const * Doc * Format * Format * Format * Format * Format * Safer truncated * Clean importing * Suppress warnings * Remove empty line * Clean importing * Clean importing * Format * Clean importing * Restructure Co-authored-by: Xavier Lau Co-authored-by: Guantong <04637@163.com> --- Cargo.lock | 614 +++++++++++++++++++++++++++++++- core/primitives/src/lib.rs | 8 +- node/Cargo.toml | 14 +- node/src/chain_spec.rs | 56 ++- node/src/cli.rs | 49 +++ node/src/command.rs | 36 +- node/src/frontier_service.rs | 152 ++++++++ node/src/main.rs | 2 + node/src/rpc.rs | 133 ++++++- node/src/service.rs | 84 ++++- runtime/Cargo.toml | 31 ++ runtime/src/lib.rs | 268 +++++++++++++- runtime/src/pallets/base_fee.rs | 47 +++ runtime/src/pallets/ethereum.rs | 25 ++ runtime/src/pallets/evm.rs | 152 ++++++++ runtime/src/pallets/mod.rs | 9 + runtime/src/pallets/system.rs | 6 +- 17 files changed, 1636 insertions(+), 50 deletions(-) create mode 100644 node/src/frontier_service.rs create mode 100644 runtime/src/pallets/base_fee.rs create mode 100644 runtime/src/pallets/ethereum.rs create mode 100644 runtime/src/pallets/evm.rs diff --git a/Cargo.lock b/Cargo.lock index 6037189d2..dc5af3aaa 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -182,22 +182,22 @@ version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e14485364214912d3b19cc3435dde4df66065127f05fa0d75c712f36f12c2f28" dependencies = [ - "concurrent-queue", + "concurrent-queue 1.2.4", "event-listener", "futures-core", ] [[package]] name = "async-executor" -version = "1.4.1" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "871f9bb5e0a22eeb7e8cf16641feb87c9dc67032ccf8ff49e772eb9941d3a965" +checksum = "17adb73da160dfb475c183343c8cccd80721ea5a605d3eb57125f0a7b7a92d0b" dependencies = [ + "async-lock", "async-task", - "concurrent-queue", + "concurrent-queue 2.0.0", "fastrand", "futures-lite", - "once_cell", "slab", ] @@ -224,7 +224,7 @@ checksum = "e8121296a9f05be7f34aa4196b1747243b3b62e048bb7906f644f3fbfc490cf7" dependencies = [ "async-lock", "autocfg", - "concurrent-queue", + "concurrent-queue 1.2.4", "futures-lite", "libc", "log", @@ -354,6 +354,18 @@ dependencies = [ "winapi", ] +[[package]] +name = "auto_impl" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7862e21c893d65a1650125d157eaeec691439379a1cee17ee49031b79236ada4" +dependencies = [ + "proc-macro-error", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "autocfg" version = "1.1.0" @@ -781,9 +793,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.75" +version = "1.0.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41ca34107f97baef6cfb231b32f36115781856b8f8208e8c580e0bcaea374842" +checksum = "76a284da2e6fe2092f2353e51713435363112dfd60030e22add80be333fb928f" dependencies = [ "jobserver", ] @@ -1006,6 +1018,15 @@ dependencies = [ "cache-padded", ] +[[package]] +name = "concurrent-queue" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd7bef69dc86e3c610e4e7aed41035e2a7ed12e72dd7530f61327a6579a4390b" +dependencies = [ + "crossbeam-utils", +] + [[package]] name = "const-oid" version = "0.7.1" @@ -1864,8 +1885,18 @@ dependencies = [ "cumulus-relay-chain-rpc-interface", "darwinia-runtime", "dc-primitives", + "fc-cli", + "fc-consensus", + "fc-db", + "fc-mapping-sync", + "fc-rpc", + "fc-rpc-core", + "fp-evm", + "fp-rpc", + "fp-storage", "frame-benchmarking", "frame-benchmarking-cli", + "futures", "jsonrpsee", "log", "pallet-transaction-payment-rpc", @@ -1927,6 +1958,9 @@ dependencies = [ "cumulus-primitives-timestamp", "cumulus-primitives-utility", "dc-primitives", + "fp-evm", + "fp-rpc", + "fp-self-contained", "frame-benchmarking", "frame-executive", "frame-support", @@ -1937,7 +1971,14 @@ dependencies = [ "pallet-aura", "pallet-authorship", "pallet-balances", + "pallet-base-fee", "pallet-collator-selection", + "pallet-ethereum", + "pallet-evm", + "pallet-evm-precompile-blake2", + "pallet-evm-precompile-bn128", + "pallet-evm-precompile-modexp", + "pallet-evm-precompile-simple", "pallet-session", "pallet-sudo", "pallet-timestamp", @@ -2310,12 +2351,120 @@ dependencies = [ "libc", ] +[[package]] +name = "ethbloom" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11da94e443c60508eb62cf256243a64da87304c2802ac2528847f79d750007ef" +dependencies = [ + "crunchy", + "fixed-hash", + "impl-codec", + "impl-rlp", + "impl-serde", + "scale-info", + "tiny-keccak", +] + +[[package]] +name = "ethereum" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23750149fe8834c0e24bb9adcbacbe06c45b9861f15df53e09f26cb7c4ab91ef" +dependencies = [ + "bytes", + "ethereum-types", + "hash-db", + "hash256-std-hasher", + "parity-scale-codec", + "rlp", + "rlp-derive", + "scale-info", + "serde", + "sha3", + "triehash", +] + +[[package]] +name = "ethereum-types" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2827b94c556145446fcce834ca86b7abf0c39a805883fe20e72c5bfdb5a0dc6" +dependencies = [ + "ethbloom", + "fixed-hash", + "impl-codec", + "impl-rlp", + "impl-serde", + "primitive-types", + "scale-info", + "uint", +] + [[package]] name = "event-listener" version = "2.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" +[[package]] +name = "evm" +version = "0.36.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d388bbd18050623b996cc4ba0643971e2978693ad56ca8b7603080cfa5eaf738" +dependencies = [ + "auto_impl", + "environmental", + "ethereum", + "evm-core", + "evm-gasometer", + "evm-runtime", + "log", + "parity-scale-codec", + "primitive-types", + "rlp", + "scale-info", + "serde", + "sha3", +] + +[[package]] +name = "evm-core" +version = "0.36.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c5fb3a449a544a67c879d2f74e1c3d9022de3ec31c9a20817015816f687aa2af" +dependencies = [ + "parity-scale-codec", + "primitive-types", + "scale-info", + "serde", +] + +[[package]] +name = "evm-gasometer" +version = "0.36.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "170a27b6e49b8279016afffcdc6ebae9225d5acff3a546ad8589929b091e7ac5" +dependencies = [ + "environmental", + "evm-core", + "evm-runtime", + "primitive-types", +] + +[[package]] +name = "evm-runtime" +version = "0.36.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d48c2545a02e3a4d1a5184a96af11037334dce947b6bdb389b3503b3a6f8dcd" +dependencies = [ + "auto_impl", + "environmental", + "evm-core", + "primitive-types", + "sha3", +] + [[package]] name = "exit-future" version = "0.2.0" @@ -2396,6 +2545,136 @@ dependencies = [ "thiserror", ] +[[package]] +name = "fc-cli" +version = "1.0.0-dev" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.30#ce45aff1903e058f4cf6e660f2c9202847a15b25" +dependencies = [ + "clap", + "ethereum-types", + "fc-db", + "fp-rpc", + "fp-storage", + "sc-cli", + "sc-service", + "serde", + "serde_json", + "sp-api", + "sp-blockchain", + "sp-runtime", +] + +[[package]] +name = "fc-consensus" +version = "2.0.0-dev" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.30#ce45aff1903e058f4cf6e660f2c9202847a15b25" +dependencies = [ + "async-trait", + "fc-db", + "fp-consensus", + "fp-rpc", + "sc-client-api", + "sc-consensus", + "sp-api", + "sp-block-builder", + "sp-blockchain", + "sp-consensus", + "sp-runtime", + "thiserror", +] + +[[package]] +name = "fc-db" +version = "2.0.0-dev" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.30#ce45aff1903e058f4cf6e660f2c9202847a15b25" +dependencies = [ + "fp-storage", + "kvdb-rocksdb", + "log", + "parity-db", + "parity-scale-codec", + "parking_lot 0.12.1", + "sc-client-db", + "sp-blockchain", + "sp-core", + "sp-database", + "sp-runtime", +] + +[[package]] +name = "fc-mapping-sync" +version = "2.0.0-dev" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.30#ce45aff1903e058f4cf6e660f2c9202847a15b25" +dependencies = [ + "fc-db", + "fp-consensus", + "fp-rpc", + "futures", + "futures-timer", + "log", + "sc-client-api", + "sp-api", + "sp-blockchain", + "sp-runtime", +] + +[[package]] +name = "fc-rpc" +version = "2.0.0-dev" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.30#ce45aff1903e058f4cf6e660f2c9202847a15b25" +dependencies = [ + "ethereum", + "ethereum-types", + "evm", + "fc-db", + "fc-rpc-core", + "fp-ethereum", + "fp-evm", + "fp-rpc", + "fp-storage", + "futures", + "hex", + "jsonrpsee", + "libsecp256k1", + "log", + "lru 0.8.1", + "parity-scale-codec", + "prometheus", + "rand 0.8.5", + "rlp", + "sc-client-api", + "sc-network", + "sc-network-common", + "sc-rpc", + "sc-service", + "sc-transaction-pool", + "sc-transaction-pool-api", + "sp-api", + "sp-block-builder", + "sp-blockchain", + "sp-consensus", + "sp-core", + "sp-io", + "sp-runtime", + "sp-storage", + "substrate-prometheus-endpoint", + "tokio", +] + +[[package]] +name = "fc-rpc-core" +version = "1.1.0-dev" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.30#ce45aff1903e058f4cf6e660f2c9202847a15b25" +dependencies = [ + "ethereum", + "ethereum-types", + "jsonrpsee", + "rlp", + "rustc-hex", + "serde", + "serde_json", +] + [[package]] name = "fdlimit" version = "0.2.1" @@ -2505,6 +2784,86 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "fp-consensus" +version = "2.0.0-dev" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.30#ce45aff1903e058f4cf6e660f2c9202847a15b25" +dependencies = [ + "ethereum", + "parity-scale-codec", + "sp-core", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "fp-ethereum" +version = "1.0.0-dev" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.30#ce45aff1903e058f4cf6e660f2c9202847a15b25" +dependencies = [ + "ethereum", + "ethereum-types", + "fp-evm", + "frame-support", + "num_enum", + "parity-scale-codec", + "sp-core", + "sp-std", +] + +[[package]] +name = "fp-evm" +version = "3.0.0-dev" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.30#ce45aff1903e058f4cf6e660f2c9202847a15b25" +dependencies = [ + "evm", + "frame-support", + "parity-scale-codec", + "serde", + "sp-core", + "sp-std", +] + +[[package]] +name = "fp-rpc" +version = "3.0.0-dev" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.30#ce45aff1903e058f4cf6e660f2c9202847a15b25" +dependencies = [ + "ethereum", + "ethereum-types", + "fp-evm", + "parity-scale-codec", + "scale-info", + "sp-api", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "fp-self-contained" +version = "1.0.0-dev" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.30#ce45aff1903e058f4cf6e660f2c9202847a15b25" +dependencies = [ + "ethereum", + "frame-support", + "parity-scale-codec", + "parity-util-mem", + "scale-info", + "serde", + "sp-runtime", +] + +[[package]] +name = "fp-storage" +version = "2.0.0" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.30#ce45aff1903e058f4cf6e660f2c9202847a15b25" +dependencies = [ + "parity-scale-codec", + "serde", +] + [[package]] name = "frame-benchmarking" version = "4.0.0-dev" @@ -3337,6 +3696,15 @@ dependencies = [ "parity-scale-codec", ] +[[package]] +name = "impl-rlp" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f28220f89297a075ddc7245cd538076ee98b01f2a9c23a53a4f1105d5a322808" +dependencies = [ + "rlp", +] + [[package]] name = "impl-serde" version = "0.3.2" @@ -3785,6 +4153,9 @@ name = "lazy_static" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +dependencies = [ + "spin", +] [[package]] name = "lazycell" @@ -3820,9 +4191,9 @@ dependencies = [ [[package]] name = "libm" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "292a948cd991e376cf75541fe5b97a1081d713c618b4f1b9500f8844e49eb565" +checksum = "348108ab3fba42ec82ff6e9564fc4ca0247bdccdc68dd8af9764bbc79c3c8ffb" [[package]] name = "libp2p" @@ -4576,9 +4947,9 @@ dependencies = [ [[package]] name = "memmap2" -version = "0.5.7" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95af15f345b17af2efc8ead6080fb8bc376f8cec1b35277b935637595fe77498" +checksum = "4b182332558b18d807c4ce1ca8ca983b34c3ee32765e47b3f0f69b90355cc1dc" dependencies = [ "libc", ] @@ -4891,6 +5262,20 @@ dependencies = [ "minimal-lexical", ] +[[package]] +name = "num" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43db66d1170d347f9a065114077f7dccb00c1b9478c89384490a3425279a4606" +dependencies = [ + "num-bigint 0.4.3", + "num-complex", + "num-integer", + "num-iter", + "num-rational 0.4.1", + "num-traits", +] + [[package]] name = "num-bigint" version = "0.2.6" @@ -4942,6 +5327,17 @@ dependencies = [ "num-traits", ] +[[package]] +name = "num-iter" +version = "0.1.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d03e6c028c5dc5cac6e2dec0efda81fc887605bb3d884578bb6d6bf7514e252" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + [[package]] name = "num-rational" version = "0.2.4" @@ -4986,6 +5382,27 @@ dependencies = [ "libc", ] +[[package]] +name = "num_enum" +version = "0.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf5395665662ef45796a4ff5486c5d41d29e0c09640af4c5f17fd94ee2c119c9" +dependencies = [ + "num_enum_derive", +] + +[[package]] +name = "num_enum_derive" +version = "0.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b0498641e53dd6ac1a4f22547548caa6864cc4933784319cd1775271c5a46ce" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "object" version = "0.29.0" @@ -5182,6 +5599,21 @@ dependencies = [ "sp-std", ] +[[package]] +name = "pallet-base-fee" +version = "1.0.0" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.30#ce45aff1903e058f4cf6e660f2c9202847a15b25" +dependencies = [ + "fp-evm", + "frame-support", + "frame-system", + "parity-scale-codec", + "scale-info", + "serde", + "sp-core", + "sp-runtime", +] + [[package]] name = "pallet-beefy" version = "4.0.0-dev" @@ -5366,6 +5798,95 @@ dependencies = [ "sp-std", ] +[[package]] +name = "pallet-ethereum" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.30#ce45aff1903e058f4cf6e660f2c9202847a15b25" +dependencies = [ + "ethereum", + "ethereum-types", + "evm", + "fp-consensus", + "fp-ethereum", + "fp-evm", + "fp-rpc", + "fp-self-contained", + "fp-storage", + "frame-support", + "frame-system", + "pallet-evm", + "pallet-timestamp", + "parity-scale-codec", + "rlp", + "scale-info", + "serde", + "sp-io", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "pallet-evm" +version = "6.0.0-dev" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.30#ce45aff1903e058f4cf6e660f2c9202847a15b25" +dependencies = [ + "environmental", + "evm", + "fp-evm", + "frame-benchmarking", + "frame-support", + "frame-system", + "hex", + "log", + "pallet-timestamp", + "parity-scale-codec", + "primitive-types", + "rlp", + "scale-info", + "serde", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "pallet-evm-precompile-blake2" +version = "2.0.0-dev" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.30#ce45aff1903e058f4cf6e660f2c9202847a15b25" +dependencies = [ + "fp-evm", +] + +[[package]] +name = "pallet-evm-precompile-bn128" +version = "2.0.0-dev" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.30#ce45aff1903e058f4cf6e660f2c9202847a15b25" +dependencies = [ + "fp-evm", + "sp-core", + "substrate-bn", +] + +[[package]] +name = "pallet-evm-precompile-modexp" +version = "2.0.0-dev" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.30#ce45aff1903e058f4cf6e660f2c9202847a15b25" +dependencies = [ + "fp-evm", + "num", +] + +[[package]] +name = "pallet-evm-precompile-simple" +version = "2.0.0-dev" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.30#ce45aff1903e058f4cf6e660f2c9202847a15b25" +dependencies = [ + "fp-evm", + "ripemd", + "sp-io", +] + [[package]] name = "pallet-fast-unstake" version = "4.0.0-dev" @@ -6034,8 +6555,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c32561d248d352148124f036cac253a644685a21dc9fea383eb4907d7bd35a8f" dependencies = [ "cfg-if 1.0.0", + "ethereum-types", "hashbrown", "impl-trait-for-tuples", + "lru 0.7.8", "parity-util-mem-derive", "parking_lot 0.12.1", "primitive-types", @@ -7465,6 +7988,7 @@ checksum = "e28720988bff275df1f51b171e1b2a18c30d194c4d2b61defdacecd625a5d94a" dependencies = [ "fixed-hash", "impl-codec", + "impl-rlp", "impl-serde", "scale-info", "uint", @@ -8013,6 +8537,36 @@ dependencies = [ "winapi", ] +[[package]] +name = "ripemd" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd124222d17ad93a644ed9d011a40f4fb64aa54275c08cc216524a9ea82fb09f" +dependencies = [ + "digest 0.10.5", +] + +[[package]] +name = "rlp" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb919243f34364b6bd2fc10ef797edbfa75f33c252e7998527479c6d6b47e1ec" +dependencies = [ + "bytes", + "rustc-hex", +] + +[[package]] +name = "rlp-derive" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e33d7b2abe0c340d8797fe2907d3f20d3b5ea5908683618bfe80df7f621f672a" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "rocksdb" version = "0.18.0" @@ -10485,9 +11039,9 @@ dependencies = [ [[package]] name = "ss58-registry" -version = "1.33.0" +version = "1.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ab7554f8a8b6f8d71cd5a8e6536ef116e2ce0504cf97ebf16311d58065dc8a6" +checksum = "37a9821878e1f13aba383aa40a86fb1b33c7265774ec91e32563cb1dd1577496" dependencies = [ "Inflector", "num-format", @@ -10617,6 +11171,19 @@ dependencies = [ "zeroize", ] +[[package]] +name = "substrate-bn" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b5bbfa79abbae15dd642ea8176a21a635ff3c00059961d1ea27ad04e5b441c" +dependencies = [ + "byteorder", + "crunchy", + "lazy_static", + "rand 0.8.5", + "rustc-hex", +] + [[package]] name = "substrate-build-script-utils" version = "3.0.0" @@ -10886,6 +11453,15 @@ dependencies = [ "zeroize", ] +[[package]] +name = "tiny-keccak" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" +dependencies = [ + "crunchy", +] + [[package]] name = "tinyvec" version = "1.6.0" @@ -11116,6 +11692,16 @@ dependencies = [ "hash-db", ] +[[package]] +name = "triehash" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1631b201eb031b563d2e85ca18ec8092508e262a3196ce9bd10a67ec87b9f5c" +dependencies = [ + "hash-db", + "rlp", +] + [[package]] name = "trust-dns-proto" version = "0.21.2" diff --git a/core/primitives/src/lib.rs b/core/primitives/src/lib.rs index 319717e9e..8670ad098 100644 --- a/core/primitives/src/lib.rs +++ b/core/primitives/src/lib.rs @@ -52,8 +52,11 @@ pub type BlockNumber = u32; /// The address format for describing accounts. pub type Address = sp_runtime::MultiAddress; +/// Hashing type +pub type Hashing = sp_runtime::traits::BlakeTwo256; + /// Block header type. -pub type Header = sp_runtime::generic::Header; +pub type Header = sp_runtime::generic::Header; /// Block type. pub type Block = sp_runtime::generic::Block; @@ -94,3 +97,6 @@ pub const MWEI: Balance = 1_000 * KWEI; pub const KWEI: Balance = 1_000 * WEI; /// 1 wei — 1 pub const WEI: Balance = 1; + +/// Darwinia EVM addresses specific prefix. +pub const EVM_ADDR_PREFIX: &[u8] = b"dvm:"; diff --git a/node/Cargo.toml b/node/Cargo.toml index 4d685bb9c..8f981f0ed 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -16,6 +16,7 @@ substrate-build-script-utils = { git = "https://github.com/paritytech/substrate" # crates.io clap = { version = "3.2", features = ["derive"] } codec = { package = "parity-scale-codec", version = "3.2" } +futures = { version = "0.3" } jsonrpsee = { version = "0.15", features = ["server"] } log = { version = "0.4" } serde = { version = "1.0", features = ["derive"] } @@ -37,12 +38,23 @@ cumulus-relay-chain-rpc-interface = { git = "https://github.com/paritytech darwinia-runtime = { path = "../runtime" } dc-primitives = { path = "../core/primitives" } +# frontier +fc-cli = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +fc-consensus = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +fc-db = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +fc-mapping-sync = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +fc-rpc = { features = ["rpc_binary_search_estimate"], git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +fc-rpc-core = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +fp-evm = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +fp-rpc = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +fp-storage = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } + # polkadot polkadot-cli = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" } polkadot-parachain = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" } polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" } polkadot-service = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" } -xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" } +xcm = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" } # substrate frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } diff --git a/node/src/chain_spec.rs b/node/src/chain_spec.rs index d4bfe77d2..af56095d3 100644 --- a/node/src/chain_spec.rs +++ b/node/src/chain_spec.rs @@ -18,17 +18,21 @@ #![allow(clippy::derive_partial_eq_without_eq)] +// std +use std::{collections::BTreeMap, str::FromStr}; // crates.io use serde::{Deserialize, Serialize}; // cumulus use cumulus_primitives_core::ParaId; // darwinia -use darwinia_runtime::{AuraId, EXISTENTIAL_DEPOSIT}; +use darwinia_runtime::{AuraId, DarwiniaPrecompiles, EvmConfig, Runtime, EXISTENTIAL_DEPOSIT}; use dc_primitives::*; +// frontier +use fp_evm::GenesisAccount; // substrate use sc_chain_spec::{ChainSpecExtension, ChainSpecGroup}; use sc_service::ChainType; -use sp_core::{sr25519, Pair, Public}; +use sp_core::{sr25519, Pair, Public, H160, U256}; use sp_runtime::traits::{IdentifyAccount, Verify}; /// Specialized `ChainSpec` for the normal parachain runtime. @@ -37,6 +41,11 @@ pub type ChainSpec = sc_service::GenericChainSpec(seed: &str) -> ::Public { TPublic::Pair::from_string(&format!("//{}", seed), None) @@ -240,5 +249,48 @@ fn testnet_genesis( polkadot_xcm: darwinia_runtime::PolkadotXcmConfig { safe_xcm_version: Some(SAFE_XCM_VERSION), }, + ethereum: Default::default(), + evm: EvmConfig { + accounts: { + let mut map = BTreeMap::new(); + map.insert( + // Testing account. + H160::from_str("0x6be02d1d3665660d22ff9624b7be0551ee1ac91b") + .expect("internal `H160` is valid; qed"), + GenesisAccount { + balance: U256::from_str("0xffffffffffffffffffffffffffffffff") + .expect("internal `U256` is valid; qed"), + code: Default::default(), + nonce: Default::default(), + storage: Default::default(), + }, + ); + map.insert( + // Benchmarking account. + H160::from_str("1000000000000000000000000000000000000001") + .expect("internal `H160` is valid; qed"), + GenesisAccount { + nonce: U256::from(1), + balance: U256::from(1_000_000_000_000_000_000_000_000_u128), + storage: Default::default(), + code: vec![0x00], + }, + ); + + for precompile in DarwiniaPrecompiles::::used_addresses() { + map.insert( + precompile, + GenesisAccount { + nonce: Default::default(), + balance: Default::default(), + storage: Default::default(), + code: REVERT_BYTECODE.to_vec(), + }, + ); + } + map + }, + }, + base_fee: Default::default(), } } diff --git a/node/src/cli.rs b/node/src/cli.rs index 1a45276f9..89aeca2a2 100644 --- a/node/src/cli.rs +++ b/node/src/cli.rs @@ -49,6 +49,9 @@ pub enum Subcommand { /// Export the genesis wasm of the parachain. ExportGenesisWasm(cumulus_client_cli::ExportGenesisWasmCommand), + /// Db meta columns information. + FrontierDb(fc_cli::FrontierDbCmd), + /// Sub-commands concerned with benchmarking. /// The pallet benchmarking moved to the `pallet` sub-command. #[clap(subcommand)] @@ -84,6 +87,9 @@ pub struct Cli { /// Relay chain arguments #[clap(raw = true)] pub relay_chain_args: Vec, + + #[clap(flatten)] + pub eth_args: EthArgs, } #[derive(Debug)] @@ -109,3 +115,46 @@ impl RelayChainCli { Self { base_path, chain_id, base: clap::Parser::parse_from(relay_chain_args) } } } + +#[derive(Debug, clap::Parser)] +pub struct EthArgs { + /// Size in bytes of the LRU cache for block data. + #[clap(long, default_value = "300000000")] + pub eth_log_block_cache: usize, + + /// Size of the LRU cache for block data and their transaction statuses. + #[clap(long, default_value = "300000000")] + pub eth_statuses_cache: usize, + + /// Maximum number of logs in a query. + #[clap(long, default_value = "10000")] + pub max_past_logs: u32, + + /// Maximum fee history cache size. + #[clap(long, default_value = "2048")] + pub fee_history_limit: u64, +} +impl EthArgs { + pub fn build_eth_rpc_config(&self) -> EthRpcConfig { + EthRpcConfig { + eth_statuses_cache: self.eth_statuses_cache, + eth_log_block_cache: self.eth_log_block_cache, + max_past_logs: self.max_past_logs, + fee_history_limit: self.fee_history_limit, + } + } +} + +pub struct EthRpcConfig { + /// Size in bytes of the LRU cache for block data. + pub eth_log_block_cache: usize, + + /// Size in bytes of the LRU cache for transactions statuses data. + pub eth_statuses_cache: usize, + + /// Maximum fee history cache size. + pub fee_history_limit: u64, + + /// Maximum fee history cache size. + pub max_past_logs: u32, +} diff --git a/node/src/command.rs b/node/src/command.rs index d4486f6dd..1ce130171 100644 --- a/node/src/command.rs +++ b/node/src/command.rs @@ -27,9 +27,12 @@ use cumulus_primitives_core::ParaId; use crate::{ chain_spec, cli::{Cli, RelayChainCli, Subcommand}, + frontier_service, service::{self, DarwiniaRuntimeExecutor}, }; use darwinia_runtime::{Block, RuntimeApi}; +// frontier +use fc_db::frontier_database_dir; // substrate use frame_benchmarking_cli::{BenchmarkCmd, SUBSTRATE_REFERENCE_HARDWARE}; use sc_cli::{ @@ -38,7 +41,7 @@ use sc_cli::{ }; use sc_service::{ config::{BasePath, PrometheusConfig}, - TaskManager, + DatabaseSource, TaskManager, }; use sp_core::hexdisplay::HexDisplay; use sp_runtime::traits::{AccountIdConversion, Block as BlockT}; @@ -311,11 +314,26 @@ pub fn run() -> Result<()> { let runner = cli.create_runner(cmd)?; runner.sync_run(|config| { + // Remove Frontier DB. + let db_config_dir = frontier_service::db_config_dir(&config); + let frontier_database_config = match config.database { + DatabaseSource::RocksDb { .. } => DatabaseSource::RocksDb { + path: frontier_database_dir(&db_config_dir, "db"), + cache_size: 0, + }, + DatabaseSource::ParityDb { .. } => DatabaseSource::ParityDb { + path: frontier_database_dir(&db_config_dir, "paritydb"), + }, + _ => + return Err(format!("Cannot purge `{:?}` database", config.database).into()), + }; + + cmd.base.run(frontier_database_config)?; + let polkadot_cli = RelayChainCli::new( &config, [RelayChainCli::executable_name()].iter().chain(cli.relay_chain_args.iter()), ); - let polkadot_config = SubstrateCli::create_configuration( &polkadot_cli, &polkadot_cli, @@ -341,6 +359,16 @@ pub fn run() -> Result<()> { cmd.run(&*spec) }) }, + // TODO: https://github.com/darwinia-network/darwinia-2.0/issues/35 + Some(Subcommand::FrontierDb(cmd)) => { + let runner = cli.create_runner(cmd)?; + runner.sync_run(|config| { + // let PartialComponents { client, other, .. } = service::new_partial(&config, + // &cli)?; let frontier_backend = other.2; + // cmd.run::<_, Block>(client, frontier_backend) + todo!(); + }) + }, Some(Subcommand::Benchmark(cmd)) => { let runner = cli.create_runner(cmd)?; // Switch on the concrete benchmark sub-command- @@ -441,6 +469,8 @@ pub fn run() -> Result<()> { SubstrateCli::create_configuration(&polkadot_cli, &polkadot_cli, tokio_handle) .map_err(|err| format!("Relay chain argument error: {}", err))?; + let eth_rpc_config = cli.eth_args.build_eth_rpc_config(); + info!("Parachain id: {:?}", id); info!("Parachain Account: {}", parachain_account); info!("Parachain genesis state: {}", genesis_state); @@ -452,6 +482,7 @@ pub fn run() -> Result<()> { collator_options, id, hwbench, + eth_rpc_config, ) .await .map(|r| r.0) @@ -461,7 +492,6 @@ pub fn run() -> Result<()> { } } - fn load_spec(id: &str) -> std::result::Result, String> { Ok(match id { "dev" => Box::new(chain_spec::development_config()), diff --git a/node/src/frontier_service.rs b/node/src/frontier_service.rs new file mode 100644 index 000000000..c2f75a2e6 --- /dev/null +++ b/node/src/frontier_service.rs @@ -0,0 +1,152 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Service and service factory implementation. Specialized wrapper over substrate service. + +// std +use std::{collections::BTreeMap, path::PathBuf, sync::Arc, time::Duration}; +// crates.io +use futures::{future, StreamExt}; +// darwinia +use crate::cli::Cli; +use dc_primitives::{Block, BlockNumber, Hash, Hashing}; +// frontier +use fc_db::Backend as FrontierBackend; +use fc_mapping_sync::{MappingSyncWorker, SyncStrategy}; +use fc_rpc::{ + EthTask, OverrideHandle, RuntimeApiStorageOverride, SchemaV1Override, SchemaV2Override, + SchemaV3Override, StorageOverride, +}; +use fc_rpc_core::types::{FeeHistoryCache, FeeHistoryCacheLimit, FilterPool}; +use fp_storage::EthereumStorageSchema; +// substrate +use sc_cli::SubstrateCli; +use sc_client_api::backend::{AuxStore, Backend, StateBackend, StorageProvider}; +use sc_service::{BasePath, Configuration, TaskManager}; +use sp_api::ProvideRuntimeApi; +use sp_blockchain::{Error as BlockChainError, HeaderBackend, HeaderMetadata}; + +#[allow(clippy::too_many_arguments)] +pub fn spawn_frontier_tasks( + task_manager: &TaskManager, + client: Arc, + backend: Arc, + frontier_backend: Arc>, + filter_pool: Option, + overrides: Arc>, + fee_history_cache: FeeHistoryCache, + fee_history_cache_limit: FeeHistoryCacheLimit, +) where + C: 'static + + sp_api::ProvideRuntimeApi + + sp_blockchain::HeaderBackend + + sp_blockchain::HeaderMetadata + + sc_client_api::BlockOf + + sc_client_api::BlockchainEvents + + sc_client_api::backend::StorageProvider, + C::Api: sp_block_builder::BlockBuilder + fp_rpc::EthereumRuntimeRPCApi, + B: 'static + Send + Sync + sp_runtime::traits::Block, + B::Header: sp_api::HeaderT, + BE: 'static + sc_client_api::backend::Backend, + BE::State: sc_client_api::backend::StateBackend, +{ + task_manager.spawn_essential_handle().spawn( + "frontier-mapping-sync-worker", + Some("frontier"), + MappingSyncWorker::new( + client.import_notification_stream(), + Duration::new(6, 0), + client.clone(), + backend, + frontier_backend, + 3, + 0, + SyncStrategy::Parachain, + ) + .for_each(|()| future::ready(())), + ); + + // Spawn Frontier EthFilterApi maintenance task. + if let Some(filter_pool) = filter_pool { + // Each filter is allowed to stay in the pool for 100 blocks. + const FILTER_RETAIN_THRESHOLD: u64 = 100; + task_manager.spawn_essential_handle().spawn( + "frontier-filter-pool", + Some("frontier"), + EthTask::filter_pool_task(client.clone(), filter_pool, FILTER_RETAIN_THRESHOLD), + ); + } + + // Spawn Frontier FeeHistory cache maintenance task. + task_manager.spawn_essential_handle().spawn( + "frontier-fee-history", + Some("frontier"), + EthTask::fee_history_task(client, overrides, fee_history_cache, fee_history_cache_limit), + ); +} + +pub(crate) fn db_config_dir(config: &Configuration) -> PathBuf { + config + .base_path + .as_ref() + .map(|base_path| base_path.config_dir(config.chain_spec.id())) + .unwrap_or_else(|| { + BasePath::from_project("", "", &Cli::executable_name()) + .config_dir(config.chain_spec.id()) + }) +} + +pub(crate) fn overrides_handle(client: Arc) -> Arc> +where + C: 'static + + Send + + Sync + + ProvideRuntimeApi + + StorageProvider + + AuxStore + + HeaderBackend + + HeaderMetadata, + C::Api: sp_api::ApiExt + + fp_rpc::EthereumRuntimeRPCApi + + fp_rpc::ConvertTransactionRuntimeApi, + BE: 'static + Backend, + BE::State: StateBackend, +{ + let mut overrides_map = BTreeMap::new(); + + overrides_map.insert( + EthereumStorageSchema::V1, + Box::new(SchemaV1Override::new(client.clone())) + as Box + Send + Sync>, + ); + overrides_map.insert( + EthereumStorageSchema::V2, + Box::new(SchemaV2Override::new(client.clone())) + as Box + Send + Sync>, + ); + overrides_map.insert( + EthereumStorageSchema::V3, + Box::new(SchemaV3Override::new(client.clone())) + as Box + Send + Sync>, + ); + + Arc::new(OverrideHandle { + schemas: overrides_map, + fallback: Box::new(RuntimeApiStorageOverride::new(client)), + }) +} diff --git a/node/src/main.rs b/node/src/main.rs index 198e15255..f9a813ef0 100644 --- a/node/src/main.rs +++ b/node/src/main.rs @@ -23,6 +23,8 @@ mod chain_spec; mod cli; mod command; +// TODO: move to another place +mod frontier_service; mod rpc; mod service; diff --git a/node/src/rpc.rs b/node/src/rpc.rs index a9139d9b8..a5999d6b8 100644 --- a/node/src/rpc.rs +++ b/node/src/rpc.rs @@ -27,8 +27,17 @@ pub use sc_rpc::{DenyUnsafe, SubscriptionTaskExecutor}; use std::sync::Arc; // darwinia use dc_primitives::*; +// frontier +use fc_rpc::{EthBlockDataCacheTask, OverrideHandle}; +use fc_rpc_core::types::{FeeHistoryCache, FeeHistoryCacheLimit, FilterPool}; +use fp_rpc::NoTransactionConverter; // substrate -use sc_client_api::AuxStore; +use sc_client_api::{ + backend::{AuxStore, Backend, StateBackend, StorageProvider}, + BlockchainEvents, +}; +use sc_network::NetworkService; +use sc_transaction_pool::{ChainApi, Pool}; use sc_transaction_pool_api::TransactionPool; use sp_api::ProvideRuntimeApi; use sp_block_builder::BlockBuilder; @@ -38,40 +47,146 @@ use sp_blockchain::{Error as BlockChainError, HeaderBackend, HeaderMetadata}; pub type RpcExtension = jsonrpsee::RpcModule<()>; /// Full client dependencies -pub struct FullDeps { +pub struct FullDeps { /// The client instance to use. pub client: Arc, /// Transaction pool instance. pub pool: Arc

, + /// Graph pool instance. + pub graph: Arc>, /// Whether to deny unsafe calls pub deny_unsafe: DenyUnsafe, + /// The Node authority flag + pub is_authority: bool, + /// Network service + pub network: Arc>, + /// EthFilterApi pool. + pub filter_pool: Option, + /// Backend. + pub backend: Arc>, + /// Maximum number of logs in a query. + pub max_past_logs: u32, + /// Fee history cache. + pub fee_history_cache: FeeHistoryCache, + /// Maximum fee history cache size. + pub fee_history_cache_limit: FeeHistoryCacheLimit, + /// Ethereum data access overrides. + pub overrides: Arc>, + /// Cache for Ethereum block data. + pub block_data_cache: Arc>, } /// Instantiate all RPC extensions. -pub fn create_full( - deps: FullDeps, +pub fn create_full( + deps: FullDeps, + subscription_task_executor: SubscriptionTaskExecutor, ) -> Result> where + BE: 'static + Backend, + BE::State: StateBackend, C: 'static + Send + Sync + ProvideRuntimeApi + HeaderBackend + + StorageProvider + + BlockchainEvents + AuxStore - + HeaderMetadata, + + HeaderMetadata + + ProvideRuntimeApi + + AuxStore, C::Api: pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi + substrate_frame_rpc_system::AccountNonceApi + + fp_rpc::ConvertTransactionRuntimeApi + + fp_rpc::EthereumRuntimeRPCApi + BlockBuilder, - P: 'static + Send + Sync + TransactionPool, + P: 'static + Sync + Send + TransactionPool, + A: 'static + ChainApi, { + // frontier + use fc_rpc::{ + Eth, EthApiServer, EthFilter, EthFilterApiServer, EthPubSub, EthPubSubApiServer, Net, + NetApiServer, Web3, Web3ApiServer, + }; // substrate use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApiServer}; use substrate_frame_rpc_system::{System, SystemApiServer}; let mut module = RpcExtension::new(()); - let FullDeps { client, pool, deny_unsafe } = deps; + let FullDeps { + client, + pool, + graph, + deny_unsafe, + is_authority, + network, + filter_pool, + backend, + max_past_logs, + fee_history_cache, + fee_history_cache_limit, + overrides, + block_data_cache, + } = deps; + + module.merge(System::new(client.clone(), pool.clone(), deny_unsafe).into_rpc())?; + module.merge(TransactionPayment::new(client.clone()).into_rpc())?; + + module.merge( + Eth::new( + client.clone(), + pool.clone(), + graph, + >::None, + network.clone(), + vec![], + overrides.clone(), + backend.clone(), + is_authority, + block_data_cache.clone(), + fee_history_cache, + fee_history_cache_limit, + 10, + ) + .into_rpc(), + )?; + + if let Some(filter_pool) = filter_pool { + module.merge( + EthFilter::new( + client.clone(), + backend, + filter_pool, + 500_usize, // max stored filters + max_past_logs, + block_data_cache, + ) + .into_rpc(), + )?; + } + + module.merge( + EthPubSub::new( + pool, + client.clone(), + network.clone(), + subscription_task_executor, + overrides, + ) + .into_rpc(), + )?; + + module.merge( + Net::new( + client.clone(), + network, + // Whether to format the `peer_count` response as Hex (default) or not. + true, + ) + .into_rpc(), + )?; + + module.merge(Web3::new(client).into_rpc())?; - module.merge(System::new(client.clone(), pool, deny_unsafe).into_rpc())?; - module.merge(TransactionPayment::new(client).into_rpc())?; Ok(module) } diff --git a/node/src/service.rs b/node/src/service.rs index f46e43be1..8d34d1718 100644 --- a/node/src/service.rs +++ b/node/src/service.rs @@ -19,11 +19,24 @@ //! Service and service factory implementation. Specialized wrapper over substrate service. // std -use std::{sync::Arc, time::Duration}; +use std::{ + collections::BTreeMap, + sync::{Arc, Mutex}, + time::Duration, +}; // crates.io use jsonrpsee::RpcModule; // cumulus use cumulus_client_cli::CollatorOptions; +// darwinia +use crate::{cli::EthRpcConfig, frontier_service}; +use darwinia_runtime::RuntimeApi; +use dc_primitives::*; +// frontier +use fc_db::Backend as FrontierBackend; +use fc_rpc::EthBlockDataCacheTask; +use fc_rpc_core::types::{FeeHistoryCache, FeeHistoryCacheLimit, FilterPool}; +// cumulus use cumulus_client_consensus_aura::{AuraConsensus, BuildAuraConsensusParams, SlotProportion}; use cumulus_client_consensus_common::ParachainConsensus; use cumulus_client_network::BlockAnnounceValidator; @@ -34,9 +47,6 @@ use cumulus_primitives_core::ParaId; use cumulus_relay_chain_inprocess_interface::build_inprocess_relay_chain; use cumulus_relay_chain_interface::{RelayChainError, RelayChainInterface, RelayChainResult}; use cumulus_relay_chain_rpc_interface::{create_client_and_start_worker, RelayChainRpcInterface}; -// darwinia -use darwinia_runtime::RuntimeApi; -use dc_primitives::*; // polkadot use polkadot_service::CollatorPair; // substrate @@ -47,9 +57,7 @@ use sc_service::{Configuration, PartialComponents, TFullBackend, TFullClient, Ta use sc_telemetry::{Telemetry, TelemetryHandle, TelemetryWorker, TelemetryWorkerHandle}; use sp_api::ConstructRuntimeApi; use sp_keystore::SyncCryptoStorePtr; -use sp_runtime::traits::BlakeTwo256; use substrate_prometheus_endpoint::Registry; - /// Native executor instance. pub struct DarwiniaRuntimeExecutor; impl sc_executor::NativeExecutionDispatch for DarwiniaRuntimeExecutor { @@ -102,7 +110,7 @@ where StateBackend = sc_client_api::StateBackendFor, Block>, > + sp_offchain::OffchainWorkerApi + sp_block_builder::BlockBuilder, - sc_client_api::StateBackendFor, Block>: sp_api::StateBackend, + sc_client_api::StateBackendFor, Block>: sp_api::StateBackend, Executor: 'static + sc_executor::NativeExecutionDispatch, BIQ: FnOnce( Arc>>, @@ -208,6 +216,7 @@ async fn start_node_impl( build_import_queue: BIQ, build_consensus: BIC, hwbench: Option, + eth_rpc_config: EthRpcConfig, ) -> sc_service::error::Result<( TaskManager, Arc>>, @@ -227,8 +236,10 @@ where + sp_block_builder::BlockBuilder + cumulus_primitives_core::CollectCollationInfo + pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi + + fp_rpc::EthereumRuntimeRPCApi + + fp_rpc::ConvertTransactionRuntimeApi + substrate_frame_rpc_system::AccountNonceApi, - sc_client_api::StateBackendFor, Block>: sp_api::StateBackend, + sc_client_api::StateBackendFor, Block>: sp_api::StateBackend, Executor: 'static + sc_executor::NativeExecutionDispatch, RB: 'static + Send @@ -293,8 +304,25 @@ where let force_authoring = parachain_config.force_authoring; let validator = parachain_config.role.is_authority(); let prometheus_registry = parachain_config.prometheus_registry().cloned(); + let transaction_pool = params.transaction_pool.clone(); + let frontier_backend = Arc::new(FrontierBackend::open( + Arc::clone(&client), + ¶chain_config.database, + &frontier_service::db_config_dir(¶chain_config), + )?); + let filter_pool: Option = Some(Arc::new(Mutex::new(BTreeMap::new()))); + let fee_history_cache: FeeHistoryCache = Arc::new(Mutex::new(BTreeMap::new())); + let fee_history_cache_limit: FeeHistoryCacheLimit = eth_rpc_config.fee_history_limit; let import_queue = cumulus_client_service::SharedImportQueue::new(params.import_queue); + let overrides = frontier_service::overrides_handle(client.clone()); + let block_data_cache = Arc::new(EthBlockDataCacheTask::new( + task_manager.spawn_handle(), + overrides.clone(), + eth_rpc_config.eth_log_block_cache, + eth_rpc_config.eth_statuses_cache, + prometheus_registry.clone(), + )); let (network, system_rpc_tx, tx_handler_controller, start_network) = sc_service::build_network(sc_service::BuildNetworkParams { config: ¶chain_config, @@ -310,16 +338,33 @@ where let rpc_builder = { let client = client.clone(); - let transaction_pool = transaction_pool.clone(); - - Box::new(move |deny_unsafe, _| { + let pool = transaction_pool.clone(); + let network = network.clone(); + let filter_pool = filter_pool.clone(); + let frontier_backend = frontier_backend.clone(); + let overrides = overrides.clone(); + let fee_history_cache = fee_history_cache.clone(); + let max_past_logs = eth_rpc_config.max_past_logs; + let collator = parachain_config.role.is_authority(); + + Box::new(move |deny_unsafe, subscription_task_executor| { let deps = crate::rpc::FullDeps { client: client.clone(), - pool: transaction_pool.clone(), + pool: pool.clone(), + graph: pool.pool().clone(), deny_unsafe, + is_authority: collator, + network: network.clone(), + filter_pool: filter_pool.clone(), + backend: frontier_backend.clone(), + max_past_logs, + fee_history_cache: fee_history_cache.clone(), + fee_history_cache_limit, + overrides: overrides.clone(), + block_data_cache: block_data_cache.clone(), }; - crate::rpc::create_full(deps).map_err(Into::into) + crate::rpc::create_full(deps, subscription_task_executor).map_err(Into::into) }) }; @@ -337,6 +382,17 @@ where telemetry: telemetry.as_mut(), })?; + frontier_service::spawn_frontier_tasks( + &task_manager, + client.clone(), + backend, + frontier_backend, + filter_pool, + overrides, + fee_history_cache, + fee_history_cache_limit, + ); + if let Some(hwbench) = hwbench { sc_sysinfo::print_hwbench(&hwbench); @@ -458,6 +514,7 @@ pub async fn start_parachain_node( collator_options: CollatorOptions, id: ParaId, hwbench: Option, + eth_rpc_config: EthRpcConfig, ) -> sc_service::error::Result<( TaskManager, Arc>>, @@ -533,6 +590,7 @@ pub async fn start_parachain_node( )) }, hwbench, + eth_rpc_config, ) .await } diff --git a/runtime/Cargo.toml b/runtime/Cargo.toml index b4bc4f389..eea92e74c 100644 --- a/runtime/Cargo.toml +++ b/runtime/Cargo.toml @@ -37,6 +37,18 @@ cumulus-pallet-session-benchmarking = { optional = true, default-features = fals # darwinia dc-primitives = { default-features = false, path = "../core/primitives" } +# frontier +fp-evm = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +fp-rpc = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +fp-self-contained = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +pallet-base-fee = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +pallet-ethereum = { default-features = false, features = ["forbid-evm-reentrancy"], git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +pallet-evm = { default-features = false, features = ["forbid-evm-reentrancy"], git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +pallet-evm-precompile-blake2 = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +pallet-evm-precompile-bn128 = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +pallet-evm-precompile-modexp = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +pallet-evm-precompile-simple = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } + # polkadot pallet-xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" } polkadot-parachain = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" } @@ -101,6 +113,18 @@ std = [ # darwinia "dc-primitives/std", + # frontier + "fp-evm/std", + "fp-rpc/std", + "fp-self-contained/std", + "pallet-base-fee/std", + "pallet-ethereum/std", + "pallet-evm/std", + "pallet-evm-precompile-blake2/std", + "pallet-evm-precompile-bn128/std", + "pallet-evm-precompile-modexp/std", + "pallet-evm-precompile-simple/std", + # polkadot "pallet-xcm/std", "polkadot-parachain/std", @@ -152,6 +176,10 @@ runtime-benchmarks = [ # cumulus optional "cumulus-pallet-session-benchmarking/runtime-benchmarks", + # frontier + "pallet-ethereum/runtime-benchmarks", + "pallet-evm/runtime-benchmarks", + # polkadot "pallet-xcm/runtime-benchmarks", "polkadot-parachain/runtime-benchmarks", @@ -180,6 +208,9 @@ try-runtime = [ "pallet-collator-selection/try-runtime", "parachain-info/try-runtime", + # frontier + "pallet-ethereum/try-runtime", + # polkadot "pallet-xcm/try-runtime", "polkadot-runtime-common/try-runtime", diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index 6999e0e17..df9811e05 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -25,7 +25,7 @@ include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); mod pallets; -use pallets::*; +pub use pallets::*; mod weights; @@ -53,7 +53,7 @@ use frame_support::{ PalletId, }; use frame_system::EnsureRoot; -use sp_core::{crypto::KeyTypeId, OpaqueMetadata}; +use sp_core::{crypto::KeyTypeId, OpaqueMetadata, H160, H256, U256}; #[cfg(any(feature = "std", test))] pub use sp_runtime::BuildStorage; use sp_runtime::{ @@ -88,10 +88,11 @@ pub type SignedExtra = ( /// Unchecked extrinsic type as expected by this runtime. pub type UncheckedExtrinsic = - generic::UncheckedExtrinsic; + fp_self_contained::UncheckedExtrinsic; /// Extrinsic type that has already been checked. -pub type CheckedExtrinsic = generic::CheckedExtrinsic; +pub type CheckedExtrinsic = + fp_self_contained::CheckedExtrinsic; /// Executive: handles dispatch to the various modules. pub type Executive = frame_executive::Executive< @@ -102,6 +103,68 @@ pub type Executive = frame_executive::Executive< AllPalletsWithSystem, >; +impl fp_self_contained::SelfContainedCall for RuntimeCall { + type SignedInfo = H160; + + fn is_self_contained(&self) -> bool { + match self { + RuntimeCall::Ethereum(call) => call.is_self_contained(), + _ => false, + } + } + + fn check_self_contained( + &self, + ) -> Option> + { + match self { + RuntimeCall::Ethereum(call) => call.check_self_contained(), + _ => None, + } + } + + fn validate_self_contained( + &self, + info: &Self::SignedInfo, + dispatch_info: &sp_runtime::traits::DispatchInfoOf, + len: usize, + ) -> Option { + match self { + RuntimeCall::Ethereum(call) => call.validate_self_contained(info, dispatch_info, len), + _ => None, + } + } + + fn pre_dispatch_self_contained( + &self, + info: &Self::SignedInfo, + dispatch_info: &sp_runtime::traits::DispatchInfoOf, + len: usize, + ) -> Option> { + match self { + RuntimeCall::Ethereum(call) => + call.pre_dispatch_self_contained(info, dispatch_info, len), + _ => None, + } + } + + fn apply_self_contained( + self, + info: Self::SignedInfo, + ) -> Option>> { + // substrate + use sp_runtime::traits::Dispatchable; + + match self { + call @ RuntimeCall::Ethereum(pallet_ethereum::Call::transact { .. }) => + Some(call.dispatch(RuntimeOrigin::from( + pallet_ethereum::RawOrigin::EthereumTransaction(info), + ))), + _ => None, + } + } +} + /// Handles converting a weight scalar to a fee value, based on the scale and granularity of the /// node's balance type. /// @@ -189,6 +252,11 @@ frame_support::construct_runtime! { PolkadotXcm: pallet_xcm::{Pallet, Call, Event, Origin, Config} = 12, CumulusXcm: cumulus_pallet_xcm::{Pallet, Event, Origin} = 13, DmpQueue: cumulus_pallet_dmp_queue::{Pallet, Call, Storage, Event} = 14, + + // EVM stuff. + Ethereum: pallet_ethereum::{Pallet, Call, Storage, Config, Event, Origin} = 15, + Evm: pallet_evm::{Pallet, Call, Storage, Config, Event} = 16, + BaseFee: pallet_base_fee::{Pallet, Call, Storage, Config, Event} = 17, } } @@ -326,6 +394,180 @@ sp_api::impl_runtime_apis! { } } + impl fp_rpc::EthereumRuntimeRPCApi for Runtime { + fn chain_id() -> u64 { + ::ChainId::get() + } + + fn account_basic(address: H160) -> pallet_evm::Account { + let (account, _) = Evm::account_basic(&address); + + account + } + + fn gas_price() -> U256 { + // frontier + use pallet_evm::FeeCalculator; + + let (gas_price, _) = ::FeeCalculator::min_gas_price(); + + gas_price + } + + fn account_code_at(address: H160) -> Vec { + Evm::account_codes(address) + } + + fn author() -> H160 { + >::find_author() + } + + fn storage_at(address: H160, index: U256) -> H256 { + let mut tmp = [0u8; 32]; + + index.to_big_endian(&mut tmp); + + Evm::account_storages(address, H256::from_slice(&tmp[..])) + } + + fn call( + from: H160, + to: H160, + data: Vec, + value: U256, + gas_limit: U256, + max_fee_per_gas: Option, + max_priority_fee_per_gas: Option, + nonce: Option, + estimate: bool, + access_list: Option)>>, + ) -> Result { + // frontier + use pallet_evm::Runner; + // substrate + use sp_runtime::traits::UniqueSaturatedInto; + + let config = if estimate { + let mut config = ::config().clone(); + config.estimate = true; + Some(config) + } else { + None + }; + + let is_transactional = false; + let validate = true; + #[allow(clippy::or_fun_call)] + let evm_config = config.as_ref().unwrap_or(::config()); + ::Runner::call( + from, + to, + data, + value, + gas_limit.unique_saturated_into(), + max_fee_per_gas, + max_priority_fee_per_gas, + nonce, + access_list.unwrap_or_default(), + is_transactional, + validate, + evm_config, + ).map_err(|err| err.error.into()) + } + + fn create( + from: H160, + data: Vec, + value: U256, + gas_limit: U256, + max_fee_per_gas: Option, + max_priority_fee_per_gas: Option, + nonce: Option, + estimate: bool, + access_list: Option)>>, + ) -> Result { + // frontier + use pallet_evm::Runner; + // substrate + use sp_runtime::traits::UniqueSaturatedInto; + + let config = if estimate { + let mut config = ::config().clone(); + config.estimate = true; + Some(config) + } else { + None + }; + + let is_transactional = false; + let validate = true; + #[allow(clippy::or_fun_call)] + let evm_config = config.as_ref().unwrap_or(::config()); + ::Runner::create( + from, + data, + value, + gas_limit.unique_saturated_into(), + max_fee_per_gas, + max_priority_fee_per_gas, + nonce, + access_list.unwrap_or_default(), + is_transactional, + validate, + evm_config, + ).map_err(|err| err.error.into()) + } + + fn current_transaction_statuses() -> Option> { + Ethereum::current_transaction_statuses() + } + + fn current_block() -> Option { + Ethereum::current_block() + } + + fn current_receipts() -> Option> { + Ethereum::current_receipts() + } + + fn current_all() -> ( + Option, + Option>, + Option> + ) { + ( + Ethereum::current_block(), + Ethereum::current_receipts(), + Ethereum::current_transaction_statuses() + ) + } + + fn extrinsic_filter( + xts: Vec<::Extrinsic>, + ) -> Vec { + xts.into_iter().filter_map(|xt| match xt.0.function { + RuntimeCall::Ethereum( + pallet_ethereum::Call::::transact { transaction } + ) => Some(transaction), + _ => None + }).collect::>() + } + + fn elasticity() -> Option { + Some(BaseFee::elasticity()) + } + } + + impl fp_rpc::ConvertTransactionRuntimeApi for Runtime { + fn convert_transaction( + transaction: pallet_ethereum::Transaction + ) -> ::Extrinsic { + UncheckedExtrinsic::new_unsigned( + pallet_ethereum::Call::::transact { transaction }.into(), + ) + } + } + #[cfg(feature = "runtime-benchmarks")] impl frame_benchmarking::Benchmark for Runtime { fn benchmark_metadata(extra: bool) -> ( @@ -439,3 +681,21 @@ cumulus_pallet_parachain_system::register_validate_block! { BlockExecutor = cumulus_pallet_aura_ext::BlockExecutor::, CheckInherents = CheckInherents, } + +#[cfg(test)] +mod tests { + // darwinia + use super::{Runtime, WeightPerGas}; + // substrate + use frame_support::dispatch::DispatchClass; + + #[test] + fn configured_base_extrinsic_weight_is_evm_compatible() { + let min_ethereum_transaction_weight = WeightPerGas::get() * 21_000; + let base_extrinsic = ::BlockWeights::get() + .get(DispatchClass::Normal) + .base_extrinsic; + + assert!(base_extrinsic.ref_time() <= min_ethereum_transaction_weight.ref_time()); + } +} diff --git a/runtime/src/pallets/base_fee.rs b/runtime/src/pallets/base_fee.rs new file mode 100644 index 000000000..a7807d403 --- /dev/null +++ b/runtime/src/pallets/base_fee.rs @@ -0,0 +1,47 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +frame_support::parameter_types! { + pub DefaultBaseFeePerGas: U256 = U256::from(1_000_000_000); + pub DefaultElasticity: Permill = Permill::from_parts(125_000); +} + +pub struct BaseFeeThreshold; +impl pallet_base_fee::BaseFeeThreshold for BaseFeeThreshold { + fn lower() -> Permill { + Permill::zero() + } + + fn ideal() -> Permill { + Permill::from_parts(500_000) + } + + fn upper() -> Permill { + Permill::from_parts(1_000_000) + } +} + +impl pallet_base_fee::Config for Runtime { + type DefaultBaseFeePerGas = DefaultBaseFeePerGas; + type DefaultElasticity = DefaultElasticity; + type RuntimeEvent = RuntimeEvent; + type Threshold = BaseFeeThreshold; +} diff --git a/runtime/src/pallets/ethereum.rs b/runtime/src/pallets/ethereum.rs new file mode 100644 index 000000000..074feb5ba --- /dev/null +++ b/runtime/src/pallets/ethereum.rs @@ -0,0 +1,25 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +impl pallet_ethereum::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type StateRoot = pallet_ethereum::IntermediateStateRoot; +} diff --git a/runtime/src/pallets/evm.rs b/runtime/src/pallets/evm.rs new file mode 100644 index 000000000..1e5ade093 --- /dev/null +++ b/runtime/src/pallets/evm.rs @@ -0,0 +1,152 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; +use dc_primitives::EVM_ADDR_PREFIX; +// frontier +use pallet_ethereum::EthereumBlockHashMapping; +use pallet_evm::{ + AddressMapping, EnsureAddressTruncated, FeeCalculator, FixedGasWeightMapping, Precompile, + PrecompileHandle, PrecompileResult, PrecompileSet, +}; +use pallet_evm_precompile_blake2::Blake2F; +use pallet_evm_precompile_bn128::{Bn128Add, Bn128Mul, Bn128Pairing}; +use pallet_evm_precompile_modexp::Modexp; +use pallet_evm_precompile_simple::{ECRecover, Identity, Ripemd160, Sha256}; +// substrate +use frame_support::{traits::FindAuthor, ConsensusEngineId}; +use sp_core::crypto::ByteArray; +use sp_std::marker::PhantomData; + +const WEIGHT_PER_GAS: u64 = 40_000; + +frame_support::parameter_types! { + pub BlockGasLimit: U256 = U256::from(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT.ref_time() / WEIGHT_PER_GAS); + pub PrecompilesValue: DarwiniaPrecompiles = DarwiniaPrecompiles::<_>::new(); + pub WeightPerGas: Weight = Weight::from_ref_time(WEIGHT_PER_GAS); + pub const ChainId: u64 = 43; +} + +pub struct FindAuthorTruncated(PhantomData); +impl> FindAuthor for FindAuthorTruncated { + fn find_author<'a, I>(digests: I) -> Option + where + I: 'a + IntoIterator, + { + F::find_author(digests).and_then(|i| { + Aura::authorities().get(i as usize).and_then(|id| { + let raw = id.to_raw_vec(); + + if raw.len() >= 24 { + Some(H160::from_slice(&raw[4..24])) + } else { + None + } + }) + }) + } +} + +pub struct FixedGasPrice; +impl FeeCalculator for FixedGasPrice { + fn min_gas_price() -> (U256, Weight) { + (U256::from(GWEI), Weight::zero()) + } +} + +pub struct ConcatAddressMapping; +impl AddressMapping for ConcatAddressMapping +where + AccountId: From<[u8; 32]>, +{ + fn into_account_id(address: H160) -> AccountId { + let check_sum = |account_id: &[u8; 32]| -> u8 { + account_id[1..31].iter().fold(account_id[0], |sum, &byte| sum ^ byte) + }; + + let mut raw_account = [0u8; 32]; + raw_account[0..4].copy_from_slice(EVM_ADDR_PREFIX); + raw_account[11..31].copy_from_slice(&address[..]); + raw_account[31] = check_sum(&raw_account); + raw_account.into() + } +} + +pub struct DarwiniaPrecompiles(PhantomData); +impl DarwiniaPrecompiles +where + R: pallet_evm::Config, +{ + #[allow(clippy::new_without_default)] + pub fn new() -> Self { + Self(Default::default()) + } + + pub fn used_addresses() -> [H160; 9] { + [addr(1), addr(2), addr(3), addr(4), addr(5), addr(6), addr(7), addr(8), addr(9)] + } +} +impl PrecompileSet for DarwiniaPrecompiles +where + R: pallet_evm::Config, +{ + fn execute(&self, handle: &mut impl PrecompileHandle) -> Option { + match handle.code_address() { + // Ethereum precompiles: + a if a == addr(1) => Some(ECRecover::execute(handle)), + a if a == addr(2) => Some(Sha256::execute(handle)), + a if a == addr(3) => Some(Ripemd160::execute(handle)), + a if a == addr(4) => Some(Identity::execute(handle)), + a if a == addr(5) => Some(Modexp::execute(handle)), + a if a == addr(6) => Some(Bn128Add::execute(handle)), + a if a == addr(7) => Some(Bn128Mul::execute(handle)), + a if a == addr(8) => Some(Bn128Pairing::execute(handle)), + a if a == addr(9) => Some(Blake2F::execute(handle)), + // Non-Frontier specific nor Ethereum precompiles: + _ => None, + } + } + + fn is_precompile(&self, address: H160) -> bool { + Self::used_addresses().contains(&address) + } +} + +impl pallet_evm::Config for Runtime { + type AddressMapping = ConcatAddressMapping; + type BlockGasLimit = BlockGasLimit; + type BlockHashMapping = EthereumBlockHashMapping; + type CallOrigin = EnsureAddressTruncated; + type ChainId = ChainId; + type Currency = Balances; + type FeeCalculator = FixedGasPrice; + type FindAuthor = FindAuthorTruncated; + type GasWeightMapping = FixedGasWeightMapping; + type OnChargeTransaction = (); + type PrecompilesType = DarwiniaPrecompiles; + type PrecompilesValue = PrecompilesValue; + type Runner = pallet_evm::runner::stack::Runner; + type RuntimeEvent = RuntimeEvent; + type WeightPerGas = WeightPerGas; + type WithdrawOrigin = EnsureAddressTruncated; +} + +fn addr(a: u64) -> H160 { + H160::from_low_u64_be(a) +} diff --git a/runtime/src/pallets/mod.rs b/runtime/src/pallets/mod.rs index 4b6de8fc7..d87f947bc 100644 --- a/runtime/src/pallets/mod.rs +++ b/runtime/src/pallets/mod.rs @@ -54,3 +54,12 @@ pub use aura::*; mod collator_selection; pub use collator_selection::*; + +mod ethereum; +pub use ethereum::*; + +mod evm; +pub use evm::*; + +mod base_fee; +pub use base_fee::*; diff --git a/runtime/src/pallets/system.rs b/runtime/src/pallets/system.rs index b2efc5348..66958fff3 100644 --- a/runtime/src/pallets/system.rs +++ b/runtime/src/pallets/system.rs @@ -25,7 +25,7 @@ const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(5); /// We allow `Normal` extrinsics to fill up the block up to 75%, the rest can be used by /// `Operational` extrinsics. -const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75); +pub const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75); /// We allow for 0.5 of a second of compute with a 12 second average block time. pub const MAXIMUM_BLOCK_WEIGHT: Weight = @@ -77,9 +77,9 @@ impl frame_system::Config for Runtime { /// The type for hashing blocks and tries. type Hash = Hash; /// The hashing algorithm used. - type Hashing = sp_runtime::traits::BlakeTwo256; + type Hashing = Hashing; /// The header type. - type Header = generic::Header; + type Header = generic::Header; /// The index type for storing how many extrinsics an account has signed. type Index = Index; /// The lookup mechanism to get account ID from whatever is passed in dispatchers. From 56b31f88f98b9130413865ccdcc81019f9bac4d2 Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Mon, 14 Nov 2022 20:59:51 +0800 Subject: [PATCH 005/189] Polish RPC & service (#36) * Use full path * Abstract APIs & types * Format --- node/src/rpc.rs | 69 ++++++++++---------------- node/src/service.rs | 118 +++++++++++++++++++++----------------------- 2 files changed, 80 insertions(+), 107 deletions(-) diff --git a/node/src/rpc.rs b/node/src/rpc.rs index a5999d6b8..638cc8ca2 100644 --- a/node/src/rpc.rs +++ b/node/src/rpc.rs @@ -27,87 +27,71 @@ pub use sc_rpc::{DenyUnsafe, SubscriptionTaskExecutor}; use std::sync::Arc; // darwinia use dc_primitives::*; -// frontier -use fc_rpc::{EthBlockDataCacheTask, OverrideHandle}; -use fc_rpc_core::types::{FeeHistoryCache, FeeHistoryCacheLimit, FilterPool}; -use fp_rpc::NoTransactionConverter; -// substrate -use sc_client_api::{ - backend::{AuxStore, Backend, StateBackend, StorageProvider}, - BlockchainEvents, -}; -use sc_network::NetworkService; -use sc_transaction_pool::{ChainApi, Pool}; -use sc_transaction_pool_api::TransactionPool; -use sp_api::ProvideRuntimeApi; -use sp_block_builder::BlockBuilder; -use sp_blockchain::{Error as BlockChainError, HeaderBackend, HeaderMetadata}; /// A type representing all RPC extensions. pub type RpcExtension = jsonrpsee::RpcModule<()>; /// Full client dependencies -pub struct FullDeps { +pub struct FullDeps { /// The client instance to use. pub client: Arc, /// Transaction pool instance. pub pool: Arc

, /// Graph pool instance. - pub graph: Arc>, + pub graph: Arc>, /// Whether to deny unsafe calls - pub deny_unsafe: DenyUnsafe, + pub deny_unsafe: sc_rpc::DenyUnsafe, /// The Node authority flag pub is_authority: bool, /// Network service - pub network: Arc>, + pub network: Arc>, /// EthFilterApi pool. - pub filter_pool: Option, + pub filter_pool: Option, /// Backend. pub backend: Arc>, /// Maximum number of logs in a query. pub max_past_logs: u32, /// Fee history cache. - pub fee_history_cache: FeeHistoryCache, + pub fee_history_cache: fc_rpc_core::types::FeeHistoryCache, /// Maximum fee history cache size. - pub fee_history_cache_limit: FeeHistoryCacheLimit, + pub fee_history_cache_limit: fc_rpc_core::types::FeeHistoryCacheLimit, /// Ethereum data access overrides. - pub overrides: Arc>, + pub overrides: Arc>, /// Cache for Ethereum block data. - pub block_data_cache: Arc>, + pub block_data_cache: Arc>, } /// Instantiate all RPC extensions. pub fn create_full( deps: FullDeps, - subscription_task_executor: SubscriptionTaskExecutor, + subscription_task_executor: sc_rpc::SubscriptionTaskExecutor, ) -> Result> where - BE: 'static + Backend, - BE::State: StateBackend, + BE: 'static + sc_client_api::backend::Backend, + BE::State: sc_client_api::backend::StateBackend, C: 'static + Send + Sync - + ProvideRuntimeApi - + HeaderBackend - + StorageProvider - + BlockchainEvents - + AuxStore - + HeaderMetadata - + ProvideRuntimeApi - + AuxStore, - C::Api: pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi - + substrate_frame_rpc_system::AccountNonceApi - + fp_rpc::ConvertTransactionRuntimeApi + + sc_client_api::backend::StorageProvider + + sc_client_api::BlockchainEvents + + sc_client_api::backend::AuxStore + + sp_api::ProvideRuntimeApi + + sp_blockchain::HeaderBackend + + sp_blockchain::HeaderMetadata, + C::Api: fp_rpc::ConvertTransactionRuntimeApi + fp_rpc::EthereumRuntimeRPCApi - + BlockBuilder, - P: 'static + Sync + Send + TransactionPool, - A: 'static + ChainApi, + + sp_block_builder::BlockBuilder + + pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi + + substrate_frame_rpc_system::AccountNonceApi, + P: 'static + Sync + Send + sc_transaction_pool_api::TransactionPool, + A: 'static + sc_transaction_pool::ChainApi, { // frontier use fc_rpc::{ Eth, EthApiServer, EthFilter, EthFilterApiServer, EthPubSub, EthPubSubApiServer, Net, NetApiServer, Web3, Web3ApiServer, }; + use fp_rpc::NoTransactionConverter; // substrate use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApiServer}; use substrate_frame_rpc_system::{System, SystemApiServer}; @@ -131,7 +115,6 @@ where module.merge(System::new(client.clone(), pool.clone(), deny_unsafe).into_rpc())?; module.merge(TransactionPayment::new(client.clone()).into_rpc())?; - module.merge( Eth::new( client.clone(), @@ -175,7 +158,6 @@ where ) .into_rpc(), )?; - module.merge( Net::new( client.clone(), @@ -185,7 +167,6 @@ where ) .into_rpc(), )?; - module.merge(Web3::new(client).into_rpc())?; Ok(module) diff --git a/node/src/service.rs b/node/src/service.rs index 8d34d1718..4468a8eb9 100644 --- a/node/src/service.rs +++ b/node/src/service.rs @@ -53,11 +53,46 @@ use polkadot_service::CollatorPair; use sc_executor::NativeElseWasmExecutor; use sc_network::NetworkService; use sc_network_common::service::NetworkBlock; -use sc_service::{Configuration, PartialComponents, TFullBackend, TFullClient, TaskManager}; +use sc_service::{Configuration, PartialComponents, TFullClient, TaskManager}; use sc_telemetry::{Telemetry, TelemetryHandle, TelemetryWorker, TelemetryWorkerHandle}; use sp_api::ConstructRuntimeApi; use sp_keystore::SyncCryptoStorePtr; use substrate_prometheus_endpoint::Registry; + +type FullBackend = sc_service::TFullBackend; +type FullClient = + sc_service::TFullClient>; + +/// A set of APIs that darwinia-like runtimes must implement. +pub trait RuntimeApiCollection: + cumulus_primitives_core::CollectCollationInfo + + sp_api::ApiExt> + + sp_api::Metadata + + sp_block_builder::BlockBuilder + + sp_offchain::OffchainWorkerApi + + sp_session::SessionKeys + + sp_transaction_pool::runtime_api::TaggedTransactionQueue + + pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi + + fp_rpc::EthereumRuntimeRPCApi + + fp_rpc::ConvertTransactionRuntimeApi + + substrate_frame_rpc_system::AccountNonceApi +{ +} +impl RuntimeApiCollection for Api where + Api: cumulus_primitives_core::CollectCollationInfo + + sp_api::ApiExt> + + sp_api::Metadata + + sp_block_builder::BlockBuilder + + sp_offchain::OffchainWorkerApi + + sp_session::SessionKeys + + sp_transaction_pool::runtime_api::TaggedTransactionQueue + + pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi + + fp_rpc::EthereumRuntimeRPCApi + + fp_rpc::ConvertTransactionRuntimeApi + + substrate_frame_rpc_system::AccountNonceApi +{ +} + /// Native executor instance. pub struct DarwiniaRuntimeExecutor; impl sc_executor::NativeExecutionDispatch for DarwiniaRuntimeExecutor { @@ -82,46 +117,28 @@ pub fn new_partial( build_import_queue: BIQ, ) -> Result< PartialComponents< - TFullClient>, - TFullBackend, + FullClient, + FullBackend, (), - sc_consensus::DefaultImportQueue< - Block, - TFullClient>, - >, - sc_transaction_pool::FullPool< - Block, - TFullClient>, - >, + sc_consensus::DefaultImportQueue>, + sc_transaction_pool::FullPool>, (Option, Option), >, sc_service::Error, > where - RuntimeApi: 'static - + Send - + Sync - + ConstructRuntimeApi>>, - RuntimeApi::RuntimeApi: sp_transaction_pool::runtime_api::TaggedTransactionQueue - + sp_api::Metadata - + sp_session::SessionKeys - + sp_api::ApiExt< - Block, - StateBackend = sc_client_api::StateBackendFor, Block>, - > + sp_offchain::OffchainWorkerApi - + sp_block_builder::BlockBuilder, - sc_client_api::StateBackendFor, Block>: sp_api::StateBackend, + RuntimeApi: + 'static + Send + Sync + ConstructRuntimeApi>, + RuntimeApi::RuntimeApi: RuntimeApiCollection, + sc_client_api::StateBackendFor: sp_api::StateBackend, Executor: 'static + sc_executor::NativeExecutionDispatch, BIQ: FnOnce( - Arc>>, + Arc>, &Configuration, Option, &TaskManager, ) -> Result< - sc_consensus::DefaultImportQueue< - Block, - TFullClient>, - >, + sc_consensus::DefaultImportQueue>, sc_service::Error, >, { @@ -217,29 +234,12 @@ async fn start_node_impl( build_consensus: BIC, hwbench: Option, eth_rpc_config: EthRpcConfig, -) -> sc_service::error::Result<( - TaskManager, - Arc>>, -)> +) -> sc_service::error::Result<(TaskManager, Arc>)> where - RuntimeApi: 'static - + Send - + Sync - + ConstructRuntimeApi>>, - RuntimeApi::RuntimeApi: sp_transaction_pool::runtime_api::TaggedTransactionQueue - + sp_api::Metadata - + sp_session::SessionKeys - + sp_api::ApiExt< - Block, - StateBackend = sc_client_api::StateBackendFor, Block>, - > + sp_offchain::OffchainWorkerApi - + sp_block_builder::BlockBuilder - + cumulus_primitives_core::CollectCollationInfo - + pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi - + fp_rpc::EthereumRuntimeRPCApi - + fp_rpc::ConvertTransactionRuntimeApi - + substrate_frame_rpc_system::AccountNonceApi, - sc_client_api::StateBackendFor, Block>: sp_api::StateBackend, + RuntimeApi: + 'static + Send + Sync + ConstructRuntimeApi>, + RuntimeApi::RuntimeApi: RuntimeApiCollection, + sc_client_api::StateBackendFor: sp_api::StateBackend, Executor: 'static + sc_executor::NativeExecutionDispatch, RB: 'static + Send @@ -248,29 +248,21 @@ where ) -> Result, sc_service::Error>, BIQ: 'static + FnOnce( - Arc>>, + Arc>, &Configuration, Option, &TaskManager, ) -> Result< - sc_consensus::DefaultImportQueue< - Block, - TFullClient>, - >, + sc_consensus::DefaultImportQueue>, sc_service::Error, >, BIC: FnOnce( - Arc>>, + Arc>, Option<&Registry>, Option, &TaskManager, Arc, - Arc< - sc_transaction_pool::FullPool< - Block, - TFullClient>, - >, - >, + Arc>>, Arc>, SyncCryptoStorePtr, bool, From 4e5fac1856b3597b6b0eca88fd9557bcdd9e0744 Mon Sep 17 00:00:00 2001 From: Guantong <04637@163.com> Date: Tue, 15 Nov 2022 21:21:58 +0800 Subject: [PATCH 006/189] Extract darwinia-runtime (#32) * Skeleton * XCM configs * Bump toolchain * Code cleaning part.1 * Code cleaning part.2 * Update SS58 * Rename * Update token decimals * Format * Extract darwinia core primitives * License * Benchmarks * Extract constants * Docs * CI part.1 * Adjust the runtime pallets structure (#29) * frame-system * pallet-timestamp * pallet-authorship * pallet-balances * pallet-transaction-payment * pallet-parachain-system * pallet-parachain-info * pallet-aura-ext * pallet-xcmp-queue * pallet-dmp-queue * pallet-session * pallet-aura * pallet-collator-selection * format * deal ambiguous name * fix compile * clear imports * update visibility for pallets * add license for pallets * update darwinia comments * CI part.2 Signed-off-by: Xavier Lau * CI part.3 * CI part.4 * Add missing features * Case * Setup build environment * CI part.5 * init * adjust structure & fix compile * Move`type Barrier` out of `common` because of different runtimes may require different barriers * Add required xcm barriers * format * remove redundant files * format * format * try fix ci * merge main * fix ci * Format * remove unused dependencies * format * format * format * Format Signed-off-by: Xavier Lau Co-authored-by: Xavier Lau --- .github/workflows/checks.yml | 2 +- Cargo.lock | 47 ++++++++++--------- Cargo.toml | 2 +- node/Cargo.toml | 2 +- node/src/command.rs | 2 +- runtime/common/Cargo.toml | 27 +++++++++++ runtime/common/src/lib.rs | 21 +++++++++ .../barrier.rs => common/src/xcm_barrier.rs} | 17 ++----- runtime/{ => darwinia}/Cargo.toml | 8 ++-- runtime/{ => darwinia}/build.rs | 0 runtime/{ => darwinia}/src/lib.rs | 3 -- runtime/{ => darwinia}/src/pallets/aura.rs | 0 .../{ => darwinia}/src/pallets/aura_ext.rs | 0 .../{ => darwinia}/src/pallets/authorship.rs | 0 .../{ => darwinia}/src/pallets/balances.rs | 0 .../{ => darwinia}/src/pallets/base_fee.rs | 0 .../src/pallets/collator_selection.rs | 0 .../{ => darwinia}/src/pallets/dmp_queue.rs | 0 .../{ => darwinia}/src/pallets/ethereum.rs | 0 runtime/{ => darwinia}/src/pallets/evm.rs | 0 runtime/{ => darwinia}/src/pallets/mod.rs | 3 ++ .../src/pallets/parachain_info_.rs | 0 .../src/pallets/parachain_system.rs | 0 .../src/pallets/polkadot_xcm.rs} | 18 +++++-- runtime/{ => darwinia}/src/pallets/session.rs | 0 runtime/{ => darwinia}/src/pallets/system.rs | 0 .../{ => darwinia}/src/pallets/timestamp.rs | 0 .../src/pallets/transaction_payment.rs | 0 .../{ => darwinia}/src/pallets/xcmp_queue.rs | 0 .../src/weights/block_weights.rs | 0 .../src/weights/cumulus_pallet_xcmp_queue.rs | 0 .../src/weights/extrinsic_weights.rs | 0 .../src/weights/frame_system.rs | 0 runtime/{ => darwinia}/src/weights/mod.rs | 0 .../src/weights/pallet_balances.rs | 0 .../src/weights/pallet_collator_selection.rs | 0 .../src/weights/pallet_session.rs | 0 .../src/weights/pallet_timestamp.rs | 0 .../src/weights/paritydb_weights.rs | 0 .../src/weights/rocksdb_weights.rs | 0 40 files changed, 103 insertions(+), 49 deletions(-) create mode 100644 runtime/common/Cargo.toml create mode 100644 runtime/common/src/lib.rs rename runtime/{src/xcm_config/barrier.rs => common/src/xcm_barrier.rs} (90%) rename runtime/{ => darwinia}/Cargo.toml (98%) rename runtime/{ => darwinia}/build.rs (100%) rename runtime/{ => darwinia}/src/lib.rs (99%) rename runtime/{ => darwinia}/src/pallets/aura.rs (100%) rename runtime/{ => darwinia}/src/pallets/aura_ext.rs (100%) rename runtime/{ => darwinia}/src/pallets/authorship.rs (100%) rename runtime/{ => darwinia}/src/pallets/balances.rs (100%) rename runtime/{ => darwinia}/src/pallets/base_fee.rs (100%) rename runtime/{ => darwinia}/src/pallets/collator_selection.rs (100%) rename runtime/{ => darwinia}/src/pallets/dmp_queue.rs (100%) rename runtime/{ => darwinia}/src/pallets/ethereum.rs (100%) rename runtime/{ => darwinia}/src/pallets/evm.rs (100%) rename runtime/{ => darwinia}/src/pallets/mod.rs (96%) rename runtime/{ => darwinia}/src/pallets/parachain_info_.rs (100%) rename runtime/{ => darwinia}/src/pallets/parachain_system.rs (100%) rename runtime/{src/xcm_config/mod.rs => darwinia/src/pallets/polkadot_xcm.rs} (93%) rename runtime/{ => darwinia}/src/pallets/session.rs (100%) rename runtime/{ => darwinia}/src/pallets/system.rs (100%) rename runtime/{ => darwinia}/src/pallets/timestamp.rs (100%) rename runtime/{ => darwinia}/src/pallets/transaction_payment.rs (100%) rename runtime/{ => darwinia}/src/pallets/xcmp_queue.rs (100%) rename runtime/{ => darwinia}/src/weights/block_weights.rs (100%) rename runtime/{ => darwinia}/src/weights/cumulus_pallet_xcmp_queue.rs (100%) rename runtime/{ => darwinia}/src/weights/extrinsic_weights.rs (100%) rename runtime/{ => darwinia}/src/weights/frame_system.rs (100%) rename runtime/{ => darwinia}/src/weights/mod.rs (100%) rename runtime/{ => darwinia}/src/weights/pallet_balances.rs (100%) rename runtime/{ => darwinia}/src/weights/pallet_collator_selection.rs (100%) rename runtime/{ => darwinia}/src/weights/pallet_session.rs (100%) rename runtime/{ => darwinia}/src/weights/pallet_timestamp.rs (100%) rename runtime/{ => darwinia}/src/weights/paritydb_weights.rs (100%) rename runtime/{ => darwinia}/src/weights/rocksdb_weights.rs (100%) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 7469ecd9d..9f9f77119 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -113,7 +113,7 @@ jobs: - name: Check run: | unset RUSTC_WRAPPER - subalfred check features runtime + subalfred check features runtime/darwinia runtime-checks: name: Task check runtime diff --git a/Cargo.lock b/Cargo.lock index dc5af3aaa..0ac9c35cb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -182,22 +182,22 @@ version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e14485364214912d3b19cc3435dde4df66065127f05fa0d75c712f36f12c2f28" dependencies = [ - "concurrent-queue 1.2.4", + "concurrent-queue", "event-listener", "futures-core", ] [[package]] name = "async-executor" -version = "1.5.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17adb73da160dfb475c183343c8cccd80721ea5a605d3eb57125f0a7b7a92d0b" +checksum = "871f9bb5e0a22eeb7e8cf16641feb87c9dc67032ccf8ff49e772eb9941d3a965" dependencies = [ - "async-lock", "async-task", - "concurrent-queue 2.0.0", + "concurrent-queue", "fastrand", "futures-lite", + "once_cell", "slab", ] @@ -224,7 +224,7 @@ checksum = "e8121296a9f05be7f34aa4196b1747243b3b62e048bb7906f644f3fbfc490cf7" dependencies = [ "async-lock", "autocfg", - "concurrent-queue 1.2.4", + "concurrent-queue", "futures-lite", "libc", "log", @@ -793,9 +793,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.76" +version = "1.0.75" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76a284da2e6fe2092f2353e51713435363112dfd60030e22add80be333fb928f" +checksum = "41ca34107f97baef6cfb231b32f36115781856b8f8208e8c580e0bcaea374842" dependencies = [ "jobserver", ] @@ -1018,15 +1018,6 @@ dependencies = [ "cache-padded", ] -[[package]] -name = "concurrent-queue" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd7bef69dc86e3c610e4e7aed41035e2a7ed12e72dd7530f61327a6579a4390b" -dependencies = [ - "crossbeam-utils", -] - [[package]] name = "const-oid" version = "0.7.1" @@ -1943,6 +1934,15 @@ dependencies = [ "xcm", ] +[[package]] +name = "darwinia-common-runtime" +version = "6.0.0" +dependencies = [ + "frame-support", + "xcm", + "xcm-executor", +] + [[package]] name = "darwinia-runtime" version = "6.0.0" @@ -1957,6 +1957,7 @@ dependencies = [ "cumulus-primitives-core", "cumulus-primitives-timestamp", "cumulus-primitives-utility", + "darwinia-common-runtime", "dc-primitives", "fp-evm", "fp-rpc", @@ -4191,9 +4192,9 @@ dependencies = [ [[package]] name = "libm" -version = "0.2.6" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "348108ab3fba42ec82ff6e9564fc4ca0247bdccdc68dd8af9764bbc79c3c8ffb" +checksum = "292a948cd991e376cf75541fe5b97a1081d713c618b4f1b9500f8844e49eb565" [[package]] name = "libp2p" @@ -4947,9 +4948,9 @@ dependencies = [ [[package]] name = "memmap2" -version = "0.5.8" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b182332558b18d807c4ce1ca8ca983b34c3ee32765e47b3f0f69b90355cc1dc" +checksum = "95af15f345b17af2efc8ead6080fb8bc376f8cec1b35277b935637595fe77498" dependencies = [ "libc", ] @@ -11039,9 +11040,9 @@ dependencies = [ [[package]] name = "ss58-registry" -version = "1.34.0" +version = "1.33.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37a9821878e1f13aba383aa40a86fb1b33c7265774ec91e32563cb1dd1577496" +checksum = "3ab7554f8a8b6f8d71cd5a8e6536ef116e2ce0504cf97ebf16311d58065dc8a6" dependencies = [ "Inflector", "num-format", diff --git a/Cargo.toml b/Cargo.toml index b13f7f83a..696505b18 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,5 +5,5 @@ panic = "unwind" members = [ "core/*", "node", - "runtime", + "runtime/*", ] diff --git a/node/Cargo.toml b/node/Cargo.toml index 8f981f0ed..b30e2a29c 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -35,7 +35,7 @@ cumulus-relay-chain-interface = { git = "https://github.com/paritytech cumulus-relay-chain-rpc-interface = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.30" } # darwinia -darwinia-runtime = { path = "../runtime" } +darwinia-runtime = { path = "../runtime/darwinia" } dc-primitives = { path = "../core/primitives" } # frontier diff --git a/node/src/command.rs b/node/src/command.rs index 1ce130171..74f53e7a9 100644 --- a/node/src/command.rs +++ b/node/src/command.rs @@ -362,7 +362,7 @@ pub fn run() -> Result<()> { // TODO: https://github.com/darwinia-network/darwinia-2.0/issues/35 Some(Subcommand::FrontierDb(cmd)) => { let runner = cli.create_runner(cmd)?; - runner.sync_run(|config| { + runner.sync_run(|_config| { // let PartialComponents { client, other, .. } = service::new_partial(&config, // &cli)?; let frontier_backend = other.2; // cmd.run::<_, Block>(client, frontier_backend) diff --git a/runtime/common/Cargo.toml b/runtime/common/Cargo.toml new file mode 100644 index 000000000..7dfcf0437 --- /dev/null +++ b/runtime/common/Cargo.toml @@ -0,0 +1,27 @@ +[package] +authors = ["Darwinia Network "] +description = "Darwinia Common Runtime" +edition = "2021" +homepage = "https://darwinia.network/" +license = "GPL-3.0" +name = "darwinia-common-runtime" +readme = "README.md" +repository = "https://github.com/darwinia-network/darwinia" +version = "6.0.0" + +[dependencies] +# polkadot +xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" } +xcm-executor = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" } +# substrate +frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } + +[features] +default = ["std"] +std = [ + # polkadot + "xcm/std", + "xcm-executor/std", + # substrate + "frame-support/std", +] diff --git a/runtime/common/src/lib.rs b/runtime/common/src/lib.rs new file mode 100644 index 000000000..94bf9ed80 --- /dev/null +++ b/runtime/common/src/lib.rs @@ -0,0 +1,21 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +#![cfg_attr(not(feature = "std"), no_std)] + +pub mod xcm_barrier; diff --git a/runtime/src/xcm_config/barrier.rs b/runtime/common/src/xcm_barrier.rs similarity index 90% rename from runtime/src/xcm_config/barrier.rs rename to runtime/common/src/xcm_barrier.rs index e1fcf22c3..5fcb135f6 100644 --- a/runtime/src/xcm_config/barrier.rs +++ b/runtime/common/src/xcm_barrier.rs @@ -20,16 +20,19 @@ use core::marker::PhantomData; // polkadot use xcm::latest::{prelude::*, Weight as XCMWeight}; -use xcm_builder::*; use xcm_executor::traits::ShouldExecute; // substrate -use frame_support::{log, traits::Everything}; +use frame_support::log; frame_support::match_types! { pub type ParentOrParentsExecutivePlurality: impl Contains = { MultiLocation { parents: 1, interior: Here } | MultiLocation { parents: 1, interior: X1(Plurality { id: BodyId::Executive, .. }) } }; + pub type ParentOrSiblings: impl Contains = { + MultiLocation { parents: 1, interior: Here } | + MultiLocation { parents: 1, interior: X1(_) } + }; } //TODO: move DenyThenTry to polkadot's xcm module. @@ -96,13 +99,3 @@ impl ShouldExecute for DenyReserveTransferToRelayChain { Ok(()) } } - -pub type Barrier = DenyThenTry< - DenyReserveTransferToRelayChain, - ( - TakeWeightCredit, - AllowTopLevelPaidExecutionFrom, - AllowUnpaidExecutionFrom, - // ^^^ Parent and its exec plurality get free execution - ), ->; diff --git a/runtime/Cargo.toml b/runtime/darwinia/Cargo.toml similarity index 98% rename from runtime/Cargo.toml rename to runtime/darwinia/Cargo.toml index eea92e74c..1c1f0e72a 100644 --- a/runtime/Cargo.toml +++ b/runtime/darwinia/Cargo.toml @@ -35,7 +35,8 @@ parachain-info = { default-features = false, git = "https://git cumulus-pallet-session-benchmarking = { optional = true, default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } # darwinia -dc-primitives = { default-features = false, path = "../core/primitives" } +darwinia-common-runtime = { default-features = false, path = "../common" } +dc-primitives = { default-features = false, path = "../../core/primitives" } # frontier fp-evm = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } @@ -88,9 +89,7 @@ frame-system-benchmarking = { optional = true, default-features = false, git = " frame-try-runtime = { optional = true, default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } [features] -default = [ - "std", -] +default = ["std"] std = [ # crates.io "codec/std", @@ -111,6 +110,7 @@ std = [ "cumulus-pallet-session-benchmarking?/std", # darwinia + "darwinia-common-runtime/std", "dc-primitives/std", # frontier diff --git a/runtime/build.rs b/runtime/darwinia/build.rs similarity index 100% rename from runtime/build.rs rename to runtime/darwinia/build.rs diff --git a/runtime/src/lib.rs b/runtime/darwinia/src/lib.rs similarity index 99% rename from runtime/src/lib.rs rename to runtime/darwinia/src/lib.rs index df9811e05..6e974c5ae 100644 --- a/runtime/src/lib.rs +++ b/runtime/darwinia/src/lib.rs @@ -29,9 +29,6 @@ pub use pallets::*; mod weights; -mod xcm_config; -use xcm_config::{XcmConfig, XcmOriginToTransactDispatchOrigin}; - pub use sp_consensus_aura::sr25519::AuthorityId as AuraId; // crates.io diff --git a/runtime/src/pallets/aura.rs b/runtime/darwinia/src/pallets/aura.rs similarity index 100% rename from runtime/src/pallets/aura.rs rename to runtime/darwinia/src/pallets/aura.rs diff --git a/runtime/src/pallets/aura_ext.rs b/runtime/darwinia/src/pallets/aura_ext.rs similarity index 100% rename from runtime/src/pallets/aura_ext.rs rename to runtime/darwinia/src/pallets/aura_ext.rs diff --git a/runtime/src/pallets/authorship.rs b/runtime/darwinia/src/pallets/authorship.rs similarity index 100% rename from runtime/src/pallets/authorship.rs rename to runtime/darwinia/src/pallets/authorship.rs diff --git a/runtime/src/pallets/balances.rs b/runtime/darwinia/src/pallets/balances.rs similarity index 100% rename from runtime/src/pallets/balances.rs rename to runtime/darwinia/src/pallets/balances.rs diff --git a/runtime/src/pallets/base_fee.rs b/runtime/darwinia/src/pallets/base_fee.rs similarity index 100% rename from runtime/src/pallets/base_fee.rs rename to runtime/darwinia/src/pallets/base_fee.rs diff --git a/runtime/src/pallets/collator_selection.rs b/runtime/darwinia/src/pallets/collator_selection.rs similarity index 100% rename from runtime/src/pallets/collator_selection.rs rename to runtime/darwinia/src/pallets/collator_selection.rs diff --git a/runtime/src/pallets/dmp_queue.rs b/runtime/darwinia/src/pallets/dmp_queue.rs similarity index 100% rename from runtime/src/pallets/dmp_queue.rs rename to runtime/darwinia/src/pallets/dmp_queue.rs diff --git a/runtime/src/pallets/ethereum.rs b/runtime/darwinia/src/pallets/ethereum.rs similarity index 100% rename from runtime/src/pallets/ethereum.rs rename to runtime/darwinia/src/pallets/ethereum.rs diff --git a/runtime/src/pallets/evm.rs b/runtime/darwinia/src/pallets/evm.rs similarity index 100% rename from runtime/src/pallets/evm.rs rename to runtime/darwinia/src/pallets/evm.rs diff --git a/runtime/src/pallets/mod.rs b/runtime/darwinia/src/pallets/mod.rs similarity index 96% rename from runtime/src/pallets/mod.rs rename to runtime/darwinia/src/pallets/mod.rs index d87f947bc..61551bda4 100644 --- a/runtime/src/pallets/mod.rs +++ b/runtime/darwinia/src/pallets/mod.rs @@ -63,3 +63,6 @@ pub use evm::*; mod base_fee; pub use base_fee::*; + +mod polkadot_xcm; +pub use polkadot_xcm::*; diff --git a/runtime/src/pallets/parachain_info_.rs b/runtime/darwinia/src/pallets/parachain_info_.rs similarity index 100% rename from runtime/src/pallets/parachain_info_.rs rename to runtime/darwinia/src/pallets/parachain_info_.rs diff --git a/runtime/src/pallets/parachain_system.rs b/runtime/darwinia/src/pallets/parachain_system.rs similarity index 100% rename from runtime/src/pallets/parachain_system.rs rename to runtime/darwinia/src/pallets/parachain_system.rs diff --git a/runtime/src/xcm_config/mod.rs b/runtime/darwinia/src/pallets/polkadot_xcm.rs similarity index 93% rename from runtime/src/xcm_config/mod.rs rename to runtime/darwinia/src/pallets/polkadot_xcm.rs index 804a012c0..93cccefb5 100644 --- a/runtime/src/xcm_config/mod.rs +++ b/runtime/darwinia/src/pallets/polkadot_xcm.rs @@ -16,11 +16,9 @@ // You should have received a copy of the GNU General Public License // along with Darwinia. If not, see . -mod barrier; -use barrier::Barrier; - // darwinia use crate::*; +use darwinia_common_runtime::xcm_barrier::*; // polkadot use pallet_xcm::XcmPassthrough; use polkadot_parachain::primitives::Sibling; @@ -81,6 +79,20 @@ pub type XcmOriginToTransactDispatchOrigin = ( XcmPassthrough, ); +pub type Barrier = DenyThenTry< + DenyReserveTransferToRelayChain, + ( + TakeWeightCredit, + AllowTopLevelPaidExecutionFrom, + // Parent and its exec plurality get free execution + AllowUnpaidExecutionFrom, + // Expected responses are OK. + AllowKnownQueryResponses, + // Subscriptions for version tracking are OK. + AllowSubscriptionsFrom, + ), +>; + frame_support::parameter_types! { pub const RelayLocation: MultiLocation = MultiLocation::parent(); pub const MaxInstructions: u32 = 100; diff --git a/runtime/src/pallets/session.rs b/runtime/darwinia/src/pallets/session.rs similarity index 100% rename from runtime/src/pallets/session.rs rename to runtime/darwinia/src/pallets/session.rs diff --git a/runtime/src/pallets/system.rs b/runtime/darwinia/src/pallets/system.rs similarity index 100% rename from runtime/src/pallets/system.rs rename to runtime/darwinia/src/pallets/system.rs diff --git a/runtime/src/pallets/timestamp.rs b/runtime/darwinia/src/pallets/timestamp.rs similarity index 100% rename from runtime/src/pallets/timestamp.rs rename to runtime/darwinia/src/pallets/timestamp.rs diff --git a/runtime/src/pallets/transaction_payment.rs b/runtime/darwinia/src/pallets/transaction_payment.rs similarity index 100% rename from runtime/src/pallets/transaction_payment.rs rename to runtime/darwinia/src/pallets/transaction_payment.rs diff --git a/runtime/src/pallets/xcmp_queue.rs b/runtime/darwinia/src/pallets/xcmp_queue.rs similarity index 100% rename from runtime/src/pallets/xcmp_queue.rs rename to runtime/darwinia/src/pallets/xcmp_queue.rs diff --git a/runtime/src/weights/block_weights.rs b/runtime/darwinia/src/weights/block_weights.rs similarity index 100% rename from runtime/src/weights/block_weights.rs rename to runtime/darwinia/src/weights/block_weights.rs diff --git a/runtime/src/weights/cumulus_pallet_xcmp_queue.rs b/runtime/darwinia/src/weights/cumulus_pallet_xcmp_queue.rs similarity index 100% rename from runtime/src/weights/cumulus_pallet_xcmp_queue.rs rename to runtime/darwinia/src/weights/cumulus_pallet_xcmp_queue.rs diff --git a/runtime/src/weights/extrinsic_weights.rs b/runtime/darwinia/src/weights/extrinsic_weights.rs similarity index 100% rename from runtime/src/weights/extrinsic_weights.rs rename to runtime/darwinia/src/weights/extrinsic_weights.rs diff --git a/runtime/src/weights/frame_system.rs b/runtime/darwinia/src/weights/frame_system.rs similarity index 100% rename from runtime/src/weights/frame_system.rs rename to runtime/darwinia/src/weights/frame_system.rs diff --git a/runtime/src/weights/mod.rs b/runtime/darwinia/src/weights/mod.rs similarity index 100% rename from runtime/src/weights/mod.rs rename to runtime/darwinia/src/weights/mod.rs diff --git a/runtime/src/weights/pallet_balances.rs b/runtime/darwinia/src/weights/pallet_balances.rs similarity index 100% rename from runtime/src/weights/pallet_balances.rs rename to runtime/darwinia/src/weights/pallet_balances.rs diff --git a/runtime/src/weights/pallet_collator_selection.rs b/runtime/darwinia/src/weights/pallet_collator_selection.rs similarity index 100% rename from runtime/src/weights/pallet_collator_selection.rs rename to runtime/darwinia/src/weights/pallet_collator_selection.rs diff --git a/runtime/src/weights/pallet_session.rs b/runtime/darwinia/src/weights/pallet_session.rs similarity index 100% rename from runtime/src/weights/pallet_session.rs rename to runtime/darwinia/src/weights/pallet_session.rs diff --git a/runtime/src/weights/pallet_timestamp.rs b/runtime/darwinia/src/weights/pallet_timestamp.rs similarity index 100% rename from runtime/src/weights/pallet_timestamp.rs rename to runtime/darwinia/src/weights/pallet_timestamp.rs diff --git a/runtime/src/weights/paritydb_weights.rs b/runtime/darwinia/src/weights/paritydb_weights.rs similarity index 100% rename from runtime/src/weights/paritydb_weights.rs rename to runtime/darwinia/src/weights/paritydb_weights.rs diff --git a/runtime/src/weights/rocksdb_weights.rs b/runtime/darwinia/src/weights/rocksdb_weights.rs similarity index 100% rename from runtime/src/weights/rocksdb_weights.rs rename to runtime/darwinia/src/weights/rocksdb_weights.rs From a33bd4fc3ad6d0610cd743993d94c72c5d579934 Mon Sep 17 00:00:00 2001 From: Guantong <04637@163.com> Date: Tue, 15 Nov 2022 22:25:22 +0800 Subject: [PATCH 007/189] Polish service (#38) * use full path * RuntimeApi Co-authored-by: Xavier Lau --- node/src/service.rs | 265 ++++++++++++++++++++++++-------------------- 1 file changed, 143 insertions(+), 122 deletions(-) diff --git a/node/src/service.rs b/node/src/service.rs index 4468a8eb9..09b975f45 100644 --- a/node/src/service.rs +++ b/node/src/service.rs @@ -24,40 +24,11 @@ use std::{ sync::{Arc, Mutex}, time::Duration, }; -// crates.io -use jsonrpsee::RpcModule; -// cumulus -use cumulus_client_cli::CollatorOptions; // darwinia use crate::{cli::EthRpcConfig, frontier_service}; -use darwinia_runtime::RuntimeApi; use dc_primitives::*; -// frontier -use fc_db::Backend as FrontierBackend; -use fc_rpc::EthBlockDataCacheTask; -use fc_rpc_core::types::{FeeHistoryCache, FeeHistoryCacheLimit, FilterPool}; -// cumulus -use cumulus_client_consensus_aura::{AuraConsensus, BuildAuraConsensusParams, SlotProportion}; -use cumulus_client_consensus_common::ParachainConsensus; -use cumulus_client_network::BlockAnnounceValidator; -use cumulus_client_service::{ - prepare_node_config, start_collator, start_full_node, StartCollatorParams, StartFullNodeParams, -}; -use cumulus_primitives_core::ParaId; -use cumulus_relay_chain_inprocess_interface::build_inprocess_relay_chain; -use cumulus_relay_chain_interface::{RelayChainError, RelayChainInterface, RelayChainResult}; -use cumulus_relay_chain_rpc_interface::{create_client_and_start_worker, RelayChainRpcInterface}; -// polkadot -use polkadot_service::CollatorPair; // substrate -use sc_executor::NativeElseWasmExecutor; -use sc_network::NetworkService; use sc_network_common::service::NetworkBlock; -use sc_service::{Configuration, PartialComponents, TFullClient, TaskManager}; -use sc_telemetry::{Telemetry, TelemetryHandle, TelemetryWorker, TelemetryWorkerHandle}; -use sp_api::ConstructRuntimeApi; -use sp_keystore::SyncCryptoStorePtr; -use substrate_prometheus_endpoint::Registry; type FullBackend = sc_service::TFullBackend; type FullClient = @@ -113,30 +84,32 @@ impl sc_executor::NativeExecutionDispatch for DarwiniaRuntimeExecutor { /// be able to perform chain operations. #[allow(clippy::type_complexity)] pub fn new_partial( - config: &Configuration, + config: &sc_service::Configuration, build_import_queue: BIQ, ) -> Result< - PartialComponents< + sc_service::PartialComponents< FullClient, FullBackend, (), sc_consensus::DefaultImportQueue>, sc_transaction_pool::FullPool>, - (Option, Option), + (Option, Option), >, sc_service::Error, > where - RuntimeApi: - 'static + Send + Sync + ConstructRuntimeApi>, + RuntimeApi: 'static + + Send + + Sync + + sp_api::ConstructRuntimeApi>, RuntimeApi::RuntimeApi: RuntimeApiCollection, sc_client_api::StateBackendFor: sp_api::StateBackend, Executor: 'static + sc_executor::NativeExecutionDispatch, BIQ: FnOnce( Arc>, - &Configuration, - Option, - &TaskManager, + &sc_service::Configuration, + Option, + &sc_service::TaskManager, ) -> Result< sc_consensus::DefaultImportQueue>, sc_service::Error, @@ -147,7 +120,7 @@ where .clone() .filter(|x| !x.is_empty()) .map(|endpoints| -> Result<_, sc_telemetry::Error> { - let worker = TelemetryWorker::new(16)?; + let worker = sc_telemetry::TelemetryWorker::new(16)?; let telemetry = worker.handle().new_telemetry(endpoints); Ok((worker, telemetry)) }) @@ -184,7 +157,7 @@ where &task_manager, )?; - Ok(PartialComponents { + Ok(sc_service::PartialComponents { backend, client, import_queue, @@ -197,19 +170,30 @@ where } async fn build_relay_chain_interface( - polkadot_config: Configuration, - parachain_config: &Configuration, - telemetry_worker_handle: Option, - task_manager: &mut TaskManager, - collator_options: CollatorOptions, + polkadot_config: sc_service::Configuration, + parachain_config: &sc_service::Configuration, + telemetry_worker_handle: Option, + task_manager: &mut sc_service::TaskManager, + collator_options: cumulus_client_cli::CollatorOptions, hwbench: Option, -) -> RelayChainResult<(Arc<(dyn 'static + RelayChainInterface)>, Option)> { +) -> cumulus_relay_chain_interface::RelayChainResult<( + Arc<(dyn 'static + cumulus_relay_chain_interface::RelayChainInterface)>, + Option, +)> { match collator_options.relay_chain_rpc_url { Some(relay_chain_url) => { - let client = create_client_and_start_worker(relay_chain_url, task_manager).await?; - Ok((Arc::new(RelayChainRpcInterface::new(client)) as Arc<_>, None)) + let client = cumulus_relay_chain_rpc_interface::create_client_and_start_worker( + relay_chain_url, + task_manager, + ) + .await?; + Ok(( + Arc::new(cumulus_relay_chain_rpc_interface::RelayChainRpcInterface::new(client)) + as Arc<_>, + None, + )) }, - None => build_inprocess_relay_chain( + None => cumulus_relay_chain_inprocess_interface::build_inprocess_relay_chain( polkadot_config, parachain_config, telemetry_worker_handle, @@ -225,50 +209,55 @@ async fn build_relay_chain_interface( #[allow(clippy::too_many_arguments)] #[sc_tracing::logging::prefix_logs_with("Parachain")] async fn start_node_impl( - parachain_config: Configuration, - polkadot_config: Configuration, - collator_options: CollatorOptions, - id: ParaId, + parachain_config: sc_service::Configuration, + polkadot_config: sc_service::Configuration, + collator_options: cumulus_client_cli::CollatorOptions, + id: cumulus_primitives_core::ParaId, _rpc_ext_builder: RB, build_import_queue: BIQ, build_consensus: BIC, hwbench: Option, eth_rpc_config: EthRpcConfig, -) -> sc_service::error::Result<(TaskManager, Arc>)> +) -> sc_service::error::Result<(sc_service::TaskManager, Arc>)> where - RuntimeApi: - 'static + Send + Sync + ConstructRuntimeApi>, + RuntimeApi: 'static + + Send + + Sync + + sp_api::ConstructRuntimeApi>, RuntimeApi::RuntimeApi: RuntimeApiCollection, sc_client_api::StateBackendFor: sp_api::StateBackend, Executor: 'static + sc_executor::NativeExecutionDispatch, RB: 'static + Send + Fn( - Arc>, - ) -> Result, sc_service::Error>, + Arc>, + ) -> Result, sc_service::Error>, BIQ: 'static + FnOnce( Arc>, - &Configuration, - Option, - &TaskManager, + &sc_service::Configuration, + Option, + &sc_service::TaskManager, ) -> Result< sc_consensus::DefaultImportQueue>, sc_service::Error, >, BIC: FnOnce( Arc>, - Option<&Registry>, - Option, - &TaskManager, - Arc, + Option<&substrate_prometheus_endpoint::Registry>, + Option, + &sc_service::TaskManager, + Arc, Arc>>, - Arc>, - SyncCryptoStorePtr, + Arc>, + sp_keystore::SyncCryptoStorePtr, bool, - ) -> Result>, sc_service::Error>, + ) -> Result< + Box>, + sc_service::Error, + >, { - let parachain_config = prepare_node_config(parachain_config); + let parachain_config = cumulus_client_service::prepare_node_config(parachain_config); let params = new_partial::(¶chain_config, build_import_queue)?; let (mut telemetry, telemetry_worker_handle) = params.other; @@ -287,28 +276,34 @@ where ) .await .map_err(|e| match e { - RelayChainError::ServiceError(polkadot_service::Error::Sub(x)) => x, + cumulus_relay_chain_interface::RelayChainError::ServiceError( + polkadot_service::Error::Sub(x), + ) => x, s => s.to_string().into(), })?; - let block_announce_validator = BlockAnnounceValidator::new(relay_chain_interface.clone(), id); + let block_announce_validator = + cumulus_client_network::BlockAnnounceValidator::new(relay_chain_interface.clone(), id); let force_authoring = parachain_config.force_authoring; let validator = parachain_config.role.is_authority(); let prometheus_registry = parachain_config.prometheus_registry().cloned(); let transaction_pool = params.transaction_pool.clone(); - let frontier_backend = Arc::new(FrontierBackend::open( + let frontier_backend = Arc::new(fc_db::Backend::open( Arc::clone(&client), ¶chain_config.database, &frontier_service::db_config_dir(¶chain_config), )?); - let filter_pool: Option = Some(Arc::new(Mutex::new(BTreeMap::new()))); - let fee_history_cache: FeeHistoryCache = Arc::new(Mutex::new(BTreeMap::new())); - let fee_history_cache_limit: FeeHistoryCacheLimit = eth_rpc_config.fee_history_limit; + let filter_pool: Option = + Some(Arc::new(Mutex::new(BTreeMap::new()))); + let fee_history_cache: fc_rpc_core::types::FeeHistoryCache = + Arc::new(Mutex::new(BTreeMap::new())); + let fee_history_cache_limit: fc_rpc_core::types::FeeHistoryCacheLimit = + eth_rpc_config.fee_history_limit; let import_queue = cumulus_client_service::SharedImportQueue::new(params.import_queue); let overrides = frontier_service::overrides_handle(client.clone()); - let block_data_cache = Arc::new(EthBlockDataCacheTask::new( + let block_data_cache = Arc::new(fc_rpc::EthBlockDataCacheTask::new( task_manager.spawn_handle(), overrides.clone(), eth_rpc_config.eth_log_block_cache, @@ -420,7 +415,7 @@ where let spawner = task_manager.spawn_handle(); - let params = StartCollatorParams { + let params = cumulus_client_service::StartCollatorParams { para_id: id, block_status: client.clone(), announce_block, @@ -434,9 +429,9 @@ where relay_chain_slot_duration, }; - start_collator(params).await?; + cumulus_client_service::start_collator(params).await?; } else { - let params = StartFullNodeParams { + let params = cumulus_client_service::StartFullNodeParams { client: client.clone(), announce_block, task_manager: &mut task_manager, @@ -447,7 +442,7 @@ where collator_options, }; - start_full_node(params)?; + cumulus_client_service::start_full_node(params)?; } start_network.start_network(); @@ -458,14 +453,24 @@ where /// Build the import queue for the parachain runtime. #[allow(clippy::type_complexity)] pub fn parachain_build_import_queue( - client: Arc>>, - config: &Configuration, - telemetry: Option, - task_manager: &TaskManager, + client: Arc< + sc_service::TFullClient< + Block, + darwinia_runtime::RuntimeApi, + sc_executor::NativeElseWasmExecutor, + >, + >, + config: &sc_service::Configuration, + telemetry: Option, + task_manager: &sc_service::TaskManager, ) -> Result< sc_consensus::DefaultImportQueue< Block, - TFullClient>, + sc_service::TFullClient< + Block, + darwinia_runtime::RuntimeApi, + sc_executor::NativeElseWasmExecutor, + >, >, sc_service::Error, > { @@ -501,22 +506,28 @@ pub fn parachain_build_import_queue( /// Start a parachain node. pub async fn start_parachain_node( - parachain_config: Configuration, - polkadot_config: Configuration, - collator_options: CollatorOptions, - id: ParaId, + parachain_config: sc_service::Configuration, + polkadot_config: sc_service::Configuration, + collator_options: cumulus_client_cli::CollatorOptions, + id: cumulus_primitives_core::ParaId, hwbench: Option, eth_rpc_config: EthRpcConfig, ) -> sc_service::error::Result<( - TaskManager, - Arc>>, + sc_service::TaskManager, + Arc< + sc_service::TFullClient< + Block, + darwinia_runtime::RuntimeApi, + sc_executor::NativeElseWasmExecutor, + >, + >, )> { - start_node_impl::( + start_node_impl::( parachain_config, polkadot_config, collator_options, id, - |_| Ok(RpcModule::new(())), + |_| Ok(jsonrpsee::RpcModule::new(())), parachain_build_import_queue, |client, prometheus_registry, @@ -537,49 +548,59 @@ pub async fn start_parachain_node( telemetry.clone(), ); - Ok(AuraConsensus::build::( - BuildAuraConsensusParams { - proposer_factory, - create_inherent_data_providers: move |_, (relay_parent, validation_data)| { - let relay_chain_interface = relay_chain_interface.clone(); - async move { - let parachain_inherent = + Ok(cumulus_client_consensus_aura::AuraConsensus::build::< + sp_consensus_aura::sr25519::AuthorityPair, + _, + _, + _, + _, + _, + _, + >(cumulus_client_consensus_aura::BuildAuraConsensusParams { + proposer_factory, + create_inherent_data_providers: move |_, (relay_parent, validation_data)| { + let relay_chain_interface = relay_chain_interface.clone(); + async move { + let parachain_inherent = cumulus_primitives_parachain_inherent::ParachainInherentData::create_at( relay_parent, &relay_chain_interface, &validation_data, id, ).await; - let timestamp = sp_timestamp::InherentDataProvider::from_system_time(); + let timestamp = sp_timestamp::InherentDataProvider::from_system_time(); - let slot = + let slot = sp_consensus_aura::inherents::InherentDataProvider::from_timestamp_and_slot_duration( *timestamp, slot_duration, ); - let parachain_inherent = parachain_inherent.ok_or_else(|| { - Box::::from( - "Failed to create parachain inherent", - ) - })?; - Ok((slot, timestamp, parachain_inherent)) - } - }, - block_import: client.clone(), - para_client: client, - backoff_authoring_blocks: Option::<()>::None, - sync_oracle, - keystore, - force_authoring, - slot_duration, - // We got around 500ms for proposing - block_proposal_slot_portion: SlotProportion::new(1f32 / 24f32), - // And a maximum of 750ms if slots are skipped - max_block_proposal_slot_portion: Some(SlotProportion::new(1f32 / 16f32)), - telemetry, + let parachain_inherent = parachain_inherent.ok_or_else(|| { + Box::::from( + "Failed to create parachain inherent", + ) + })?; + Ok((slot, timestamp, parachain_inherent)) + } }, - )) + block_import: client.clone(), + para_client: client, + backoff_authoring_blocks: Option::<()>::None, + sync_oracle, + keystore, + force_authoring, + slot_duration, + // We got around 500ms for proposing + block_proposal_slot_portion: cumulus_client_consensus_aura::SlotProportion::new( + 1f32 / 24f32, + ), + // And a maximum of 750ms if slots are skipped + max_block_proposal_slot_portion: Some( + cumulus_client_consensus_aura::SlotProportion::new(1f32 / 16f32), + ), + telemetry, + })) }, hwbench, eth_rpc_config, From b27c66dc57c6610ee618d3c7b394e76d87448ba1 Mon Sep 17 00:00:00 2001 From: bear Date: Wed, 16 Nov 2022 14:38:32 +0800 Subject: [PATCH 008/189] Enable `FrontierDb` subcommand (#37) * Refactor `new_partial` * Try fix compile * Update `new_partial` * Yeah, make compiler happy * Code clean * Something about command * Resolve conflict * Adapt for main style * Self review * Ready for review * Revert full-path in command mod * Code cleaning Co-authored-by: Xavier Lau --- node/src/command.rs | 46 ++++++------- node/src/service.rs | 160 ++++++++++++++++++++++---------------------- 2 files changed, 100 insertions(+), 106 deletions(-) diff --git a/node/src/command.rs b/node/src/command.rs index 74f53e7a9..78670753e 100644 --- a/node/src/command.rs +++ b/node/src/command.rs @@ -20,7 +20,6 @@ use std::net::SocketAddr; // crates.io use codec::Encode; -use log::info; // cumulus use cumulus_primitives_core::ParaId; // darwinia @@ -41,7 +40,7 @@ use sc_cli::{ }; use sc_service::{ config::{BasePath, PrometheusConfig}, - DatabaseSource, TaskManager, + DatabaseSource, PartialComponents, TaskManager, }; use sp_core::hexdisplay::HexDisplay; use sp_runtime::traits::{AccountIdConversion, Block as BlockT}; @@ -53,10 +52,9 @@ macro_rules! construct_async_run { let $components = service::new_partial::< RuntimeApi, DarwiniaRuntimeExecutor, - _ >( &$config, - crate::service::parachain_build_import_queue, + &$cli.eth_args.build_eth_rpc_config() )?; let task_manager = $components.task_manager; { $( $code )* }.map(|v| (v, task_manager)) @@ -283,6 +281,7 @@ pub fn run() -> Result<()> { match &cli.subcommand { Some(Subcommand::BuildSpec(cmd)) => { let runner = cli.create_runner(cmd)?; + runner.sync_run(|config| cmd.run(config.chain_spec, config.network)) }, Some(Subcommand::CheckBlock(cmd)) => { @@ -346,6 +345,7 @@ pub fn run() -> Result<()> { }, Some(Subcommand::ExportGenesisState(cmd)) => { let runner = cli.create_runner(cmd)?; + runner.sync_run(|_config| { let spec = cli.load_spec(&cmd.shared_params.chain.clone().unwrap_or_default())?; let state_version = Cli::native_runtime_version(&spec).state_version(); @@ -354,23 +354,27 @@ pub fn run() -> Result<()> { }, Some(Subcommand::ExportGenesisWasm(cmd)) => { let runner = cli.create_runner(cmd)?; + runner.sync_run(|_config| { let spec = cli.load_spec(&cmd.shared_params.chain.clone().unwrap_or_default())?; cmd.run(&*spec) }) }, - // TODO: https://github.com/darwinia-network/darwinia-2.0/issues/35 Some(Subcommand::FrontierDb(cmd)) => { let runner = cli.create_runner(cmd)?; - runner.sync_run(|_config| { - // let PartialComponents { client, other, .. } = service::new_partial(&config, - // &cli)?; let frontier_backend = other.2; - // cmd.run::<_, Block>(client, frontier_backend) - todo!(); + + runner.sync_run(|config| { + let PartialComponents { client, other: (frontier_backend, ..), .. } = + service::new_partial::( + &config, + &cli.eth_args.build_eth_rpc_config(), + )?; + cmd.run::<_, dc_primitives::Block>(client, frontier_backend) }) }, Some(Subcommand::Benchmark(cmd)) => { let runner = cli.create_runner(cmd)?; + // Switch on the concrete benchmark sub-command- match cmd { BenchmarkCmd::Pallet(cmd) => @@ -382,9 +386,9 @@ pub fn run() -> Result<()> { .into()) }, BenchmarkCmd::Block(cmd) => runner.sync_run(|config| { - let partials = service::new_partial::( + let partials = service::new_partial::( &config, - crate::service::parachain_build_import_queue, + &cli.eth_args.build_eth_rpc_config(), )?; cmd.run(partials.client) }), @@ -416,7 +420,6 @@ pub fn run() -> Result<()> { Some(Subcommand::TryRuntime(cmd)) => { if cfg!(feature = "try-runtime") { let runner = cli.create_runner(cmd)?; - // grab the task manager. let registry = &runner.config().prometheus_config.as_ref().map(|cfg| &cfg.registry); let task_manager = @@ -443,38 +446,31 @@ pub fn run() -> Result<()> { } else { None }; - let para_id = chain_spec::Extensions::try_get(&*config.chain_spec) .map(|e| e.para_id) .ok_or("Could not find parachain ID in chain-spec.")?; - let polkadot_cli = RelayChainCli::new( &config, [RelayChainCli::executable_name()].iter().chain(cli.relay_chain_args.iter()), ); - let id = ParaId::from(para_id); - let parachain_account = AccountIdConversion::::into_account_truncating(&id); - let state_version = Cli::native_runtime_version(&config.chain_spec).state_version(); let block: Block = cumulus_client_cli::generate_genesis_block(&*config.chain_spec, state_version) .map_err(|e| format!("{:?}", e))?; let genesis_state = format!("0x{:?}", HexDisplay::from(&block.header().encode())); - let tokio_handle = config.tokio_handle.clone(); let polkadot_config = SubstrateCli::create_configuration(&polkadot_cli, &polkadot_cli, tokio_handle) .map_err(|err| format!("Relay chain argument error: {}", err))?; - let eth_rpc_config = cli.eth_args.build_eth_rpc_config(); - info!("Parachain id: {:?}", id); - info!("Parachain Account: {}", parachain_account); - info!("Parachain genesis state: {}", genesis_state); - info!("Is collating: {}", if config.role.is_authority() { "yes" } else { "no" }); + log::info!("Parachain id: {:?}", id); + log::info!("Parachain Account: {}", parachain_account); + log::info!("Parachain genesis state: {}", genesis_state); + log::info!("Is collating: {}", if config.role.is_authority() { "yes" } else { "no" }); crate::service::start_parachain_node( config, @@ -482,7 +478,7 @@ pub fn run() -> Result<()> { collator_options, id, hwbench, - eth_rpc_config, + ð_rpc_config, ) .await .map(|r| r.0) diff --git a/node/src/service.rs b/node/src/service.rs index 09b975f45..a885556c3 100644 --- a/node/src/service.rs +++ b/node/src/service.rs @@ -25,10 +25,13 @@ use std::{ time::Duration, }; // darwinia -use crate::{cli::EthRpcConfig, frontier_service}; +use crate::frontier_service; +use darwinia_runtime::AuraId; use dc_primitives::*; // substrate use sc_network_common::service::NetworkBlock; +use sp_core::Pair; +use sp_runtime::app_crypto::AppKey; type FullBackend = sc_service::TFullBackend; type FullClient = @@ -40,6 +43,7 @@ pub trait RuntimeApiCollection: + sp_api::ApiExt> + sp_api::Metadata + sp_block_builder::BlockBuilder + + sp_consensus_aura::AuraApi::Pair as Pair>::Public> + sp_offchain::OffchainWorkerApi + sp_session::SessionKeys + sp_transaction_pool::runtime_api::TaggedTransactionQueue @@ -54,6 +58,7 @@ impl RuntimeApiCollection for Api where + sp_api::ApiExt> + sp_api::Metadata + sp_block_builder::BlockBuilder + + sp_consensus_aura::AuraApi::Pair as Pair>::Public> + sp_offchain::OffchainWorkerApi + sp_session::SessionKeys + sp_transaction_pool::runtime_api::TaggedTransactionQueue @@ -83,9 +88,9 @@ impl sc_executor::NativeExecutionDispatch for DarwiniaRuntimeExecutor { /// Use this macro if you don't actually need the full service, but just the builder in order to /// be able to perform chain operations. #[allow(clippy::type_complexity)] -pub fn new_partial( +pub fn new_partial( config: &sc_service::Configuration, - build_import_queue: BIQ, + eth_rpc_config: &crate::cli::EthRpcConfig, ) -> Result< sc_service::PartialComponents< FullClient, @@ -93,7 +98,14 @@ pub fn new_partial( (), sc_consensus::DefaultImportQueue>, sc_transaction_pool::FullPool>, - (Option, Option), + ( + Arc>, + Option, + fc_rpc_core::types::FeeHistoryCache, + fc_rpc_core::types::FeeHistoryCacheLimit, + Option, + Option, + ), >, sc_service::Error, > @@ -103,17 +115,7 @@ where + Sync + sp_api::ConstructRuntimeApi>, RuntimeApi::RuntimeApi: RuntimeApiCollection, - sc_client_api::StateBackendFor: sp_api::StateBackend, Executor: 'static + sc_executor::NativeExecutionDispatch, - BIQ: FnOnce( - Arc>, - &sc_service::Configuration, - Option, - &sc_service::TaskManager, - ) -> Result< - sc_consensus::DefaultImportQueue>, - sc_service::Error, - >, { let telemetry = config .telemetry_endpoints @@ -150,12 +152,21 @@ where task_manager.spawn_essential_handle(), client.clone(), ); - let import_queue = build_import_queue( + let import_queue = parachain_build_import_queue( client.clone(), config, telemetry.as_ref().map(|telemetry| telemetry.handle()), &task_manager, )?; + // Frontier stuffs. + let frontier_backend = Arc::new(fc_db::Backend::open( + Arc::clone(&client), + &config.database, + &frontier_service::db_config_dir(config), + )?); + let filter_pool = Some(Arc::new(Mutex::new(BTreeMap::new()))); + let fee_history_cache = Arc::new(Mutex::new(BTreeMap::new())); + let fee_history_cache_limit = eth_rpc_config.fee_history_limit; Ok(sc_service::PartialComponents { backend, @@ -165,7 +176,14 @@ where task_manager, transaction_pool, select_chain: (), - other: (telemetry, telemetry_worker_handle), + other: ( + frontier_backend, + filter_pool, + fee_history_cache, + fee_history_cache_limit, + telemetry, + telemetry_worker_handle, + ), }) } @@ -208,16 +226,15 @@ async fn build_relay_chain_interface( /// This is the actual implementation that is abstract over the executor and the runtime api. #[allow(clippy::too_many_arguments)] #[sc_tracing::logging::prefix_logs_with("Parachain")] -async fn start_node_impl( +async fn start_node_impl( parachain_config: sc_service::Configuration, polkadot_config: sc_service::Configuration, collator_options: cumulus_client_cli::CollatorOptions, id: cumulus_primitives_core::ParaId, _rpc_ext_builder: RB, - build_import_queue: BIQ, build_consensus: BIC, hwbench: Option, - eth_rpc_config: EthRpcConfig, + eth_rpc_config: &crate::cli::EthRpcConfig, ) -> sc_service::error::Result<(sc_service::TaskManager, Arc>)> where RuntimeApi: 'static @@ -232,16 +249,6 @@ where + Fn( Arc>, ) -> Result, sc_service::Error>, - BIQ: 'static - + FnOnce( - Arc>, - &sc_service::Configuration, - Option, - &sc_service::TaskManager, - ) -> Result< - sc_consensus::DefaultImportQueue>, - sc_service::Error, - >, BIC: FnOnce( Arc>, Option<&substrate_prometheus_endpoint::Registry>, @@ -258,13 +265,24 @@ where >, { let parachain_config = cumulus_client_service::prepare_node_config(parachain_config); - - let params = new_partial::(¶chain_config, build_import_queue)?; - let (mut telemetry, telemetry_worker_handle) = params.other; - - let client = params.client.clone(); - let backend = params.backend.clone(); - let mut task_manager = params.task_manager; + let sc_service::PartialComponents { + backend, + client, + import_queue, + keystore_container, + mut task_manager, + transaction_pool, + select_chain: _, + other: + ( + frontier_backend, + filter_pool, + fee_history_cache, + fee_history_cache_limit, + mut telemetry, + telemetry_worker_handle, + ), + } = new_partial::(¶chain_config, eth_rpc_config)?; let (relay_chain_interface, collator_key) = build_relay_chain_interface( polkadot_config, @@ -288,28 +306,8 @@ where let force_authoring = parachain_config.force_authoring; let validator = parachain_config.role.is_authority(); let prometheus_registry = parachain_config.prometheus_registry().cloned(); + let import_queue = cumulus_client_service::SharedImportQueue::new(import_queue); - let transaction_pool = params.transaction_pool.clone(); - let frontier_backend = Arc::new(fc_db::Backend::open( - Arc::clone(&client), - ¶chain_config.database, - &frontier_service::db_config_dir(¶chain_config), - )?); - let filter_pool: Option = - Some(Arc::new(Mutex::new(BTreeMap::new()))); - let fee_history_cache: fc_rpc_core::types::FeeHistoryCache = - Arc::new(Mutex::new(BTreeMap::new())); - let fee_history_cache_limit: fc_rpc_core::types::FeeHistoryCacheLimit = - eth_rpc_config.fee_history_limit; - let import_queue = cumulus_client_service::SharedImportQueue::new(params.import_queue); - let overrides = frontier_service::overrides_handle(client.clone()); - let block_data_cache = Arc::new(fc_rpc::EthBlockDataCacheTask::new( - task_manager.spawn_handle(), - overrides.clone(), - eth_rpc_config.eth_log_block_cache, - eth_rpc_config.eth_statuses_cache, - prometheus_registry.clone(), - )); let (network, system_rpc_tx, tx_handler_controller, start_network) = sc_service::build_network(sc_service::BuildNetworkParams { config: ¶chain_config, @@ -322,7 +320,14 @@ where })), warp_sync: None, })?; - + let overrides = frontier_service::overrides_handle(client.clone()); + let block_data_cache = Arc::new(fc_rpc::EthBlockDataCacheTask::new( + task_manager.spawn_handle(), + overrides.clone(), + eth_rpc_config.eth_log_block_cache, + eth_rpc_config.eth_statuses_cache, + prometheus_registry.clone(), + )); let rpc_builder = { let client = client.clone(); let pool = transaction_pool.clone(); @@ -361,7 +366,7 @@ where transaction_pool: transaction_pool.clone(), task_manager: &mut task_manager, config: parachain_config, - keystore: params.keystore_container.sync_keystore(), + keystore: keystore_container.sync_keystore(), backend: backend.clone(), network: network.clone(), system_rpc_tx, @@ -409,7 +414,7 @@ where relay_chain_interface.clone(), transaction_pool, network, - params.keystore_container.sync_keystore(), + keystore_container.sync_keystore(), force_authoring, )?; @@ -451,29 +456,23 @@ where } /// Build the import queue for the parachain runtime. -#[allow(clippy::type_complexity)] -pub fn parachain_build_import_queue( - client: Arc< - sc_service::TFullClient< - Block, - darwinia_runtime::RuntimeApi, - sc_executor::NativeElseWasmExecutor, - >, - >, +pub fn parachain_build_import_queue( + client: Arc>, config: &sc_service::Configuration, telemetry: Option, task_manager: &sc_service::TaskManager, ) -> Result< - sc_consensus::DefaultImportQueue< - Block, - sc_service::TFullClient< - Block, - darwinia_runtime::RuntimeApi, - sc_executor::NativeElseWasmExecutor, - >, - >, + sc_consensus::DefaultImportQueue>, sc_service::Error, -> { +> +where + RuntimeApi: 'static + + Send + + Sync + + sp_api::ConstructRuntimeApi>, + RuntimeApi::RuntimeApi: RuntimeApiCollection, + Executor: 'static + sc_executor::NativeExecutionDispatch, +{ let slot_duration = cumulus_client_consensus_aura::slot_duration(&*client)?; cumulus_client_consensus_aura::import_queue::< @@ -511,7 +510,7 @@ pub async fn start_parachain_node( collator_options: cumulus_client_cli::CollatorOptions, id: cumulus_primitives_core::ParaId, hwbench: Option, - eth_rpc_config: EthRpcConfig, + eth_rpc_config: &crate::cli::EthRpcConfig, ) -> sc_service::error::Result<( sc_service::TaskManager, Arc< @@ -522,13 +521,12 @@ pub async fn start_parachain_node( >, >, )> { - start_node_impl::( + start_node_impl::( parachain_config, polkadot_config, collator_options, id, |_| Ok(jsonrpsee::RpcModule::new(())), - parachain_build_import_queue, |client, prometheus_registry, telemetry, From 46c600207ab3203650667a90864f4bf4c6291675 Mon Sep 17 00:00:00 2001 From: bear Date: Thu, 17 Nov 2022 17:22:53 +0800 Subject: [PATCH 009/189] Use zero existential deposit (#48) * Update ED * Update `candidacy_bond` --- node/src/chain_spec.rs | 4 ++-- node/src/command.rs | 5 ++++- runtime/darwinia/src/lib.rs | 4 ++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/node/src/chain_spec.rs b/node/src/chain_spec.rs index af56095d3..f18ffff66 100644 --- a/node/src/chain_spec.rs +++ b/node/src/chain_spec.rs @@ -25,7 +25,7 @@ use serde::{Deserialize, Serialize}; // cumulus use cumulus_primitives_core::ParaId; // darwinia -use darwinia_runtime::{AuraId, DarwiniaPrecompiles, EvmConfig, Runtime, EXISTENTIAL_DEPOSIT}; +use darwinia_runtime::{AuraId, DarwiniaPrecompiles, EvmConfig, Runtime}; use dc_primitives::*; // frontier use fp_evm::GenesisAccount; @@ -226,7 +226,7 @@ fn testnet_genesis( parachain_info: darwinia_runtime::ParachainInfoConfig { parachain_id: id }, collator_selection: darwinia_runtime::CollatorSelectionConfig { invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(), - candidacy_bond: EXISTENTIAL_DEPOSIT * 16, + candidacy_bond: UNIT, ..Default::default() }, session: darwinia_runtime::SessionConfig { diff --git a/node/src/command.rs b/node/src/command.rs index 78670753e..21f65d236 100644 --- a/node/src/command.rs +++ b/node/src/command.rs @@ -470,7 +470,10 @@ pub fn run() -> Result<()> { log::info!("Parachain id: {:?}", id); log::info!("Parachain Account: {}", parachain_account); log::info!("Parachain genesis state: {}", genesis_state); - log::info!("Is collating: {}", if config.role.is_authority() { "yes" } else { "no" }); + log::info!( + "Is collating: {}", + if config.role.is_authority() { "yes" } else { "no" } + ); crate::service::start_parachain_node( config, diff --git a/runtime/darwinia/src/lib.rs b/runtime/darwinia/src/lib.rs index 6e974c5ae..5ae9ae430 100644 --- a/runtime/darwinia/src/lib.rs +++ b/runtime/darwinia/src/lib.rs @@ -209,8 +209,8 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { state_version: 1, }; -/// The existential deposit. Set to 1/10 of the Connected Relay Chain. -pub const EXISTENTIAL_DEPOSIT: Balance = MILLIUNIT; +/// The existential deposit. +pub const EXISTENTIAL_DEPOSIT: Balance = 0; /// The version information used to identify this runtime when compiled natively. #[cfg(feature = "std")] From 000911952232d55e4803c88c42a9e756b0dbd75a Mon Sep 17 00:00:00 2001 From: Guantong <04637@163.com> Date: Mon, 21 Nov 2022 13:12:45 +0800 Subject: [PATCH 010/189] Add messages-substrate deps (#49) * add messages-substrate deps * fix ci * add messages-substrate deps * fix ci * update messages-substrate deps * update cargo.lock * Format Co-authored-by: Xavier Lau --- Cargo.lock | 256 ++++++++++++++++++++++++++++++++++++ runtime/darwinia/Cargo.toml | 28 ++++ 2 files changed, 284 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index 0ac9c35cb..0b887893c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -689,6 +689,155 @@ dependencies = [ "thiserror", ] +[[package]] +name = "bp-header-chain" +version = "0.1.0" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.30#9f1f451245784a0d2f4c943610c838bb1b7c8ac0" +dependencies = [ + "bp-runtime", + "finality-grandpa", + "frame-support", + "parity-scale-codec", + "scale-info", + "serde", + "sp-core", + "sp-finality-grandpa", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "bp-message-dispatch" +version = "0.1.0" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.30#9f1f451245784a0d2f4c943610c838bb1b7c8ac0" +dependencies = [ + "bp-runtime", + "frame-support", + "parity-scale-codec", + "scale-info", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "bp-messages" +version = "0.1.0" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.30#9f1f451245784a0d2f4c943610c838bb1b7c8ac0" +dependencies = [ + "bitvec", + "bp-runtime", + "frame-support", + "frame-system", + "impl-trait-for-tuples", + "parity-scale-codec", + "scale-info", + "serde", + "sp-core", + "sp-std", +] + +[[package]] +name = "bp-parachains" +version = "0.1.0" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.30#9f1f451245784a0d2f4c943610c838bb1b7c8ac0" +dependencies = [ + "bp-polkadot-core", + "bp-runtime", + "frame-support", + "parity-scale-codec", + "scale-info", + "sp-core", +] + +[[package]] +name = "bp-polkadot-core" +version = "0.1.0" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.30#9f1f451245784a0d2f4c943610c838bb1b7c8ac0" +dependencies = [ + "bp-messages", + "bp-runtime", + "frame-support", + "frame-system", + "parity-scale-codec", + "parity-util-mem", + "scale-info", + "serde", + "sp-api", + "sp-core", + "sp-runtime", + "sp-std", + "sp-version", +] + +[[package]] +name = "bp-runtime" +version = "0.1.0" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.30#9f1f451245784a0d2f4c943610c838bb1b7c8ac0" +dependencies = [ + "frame-support", + "frame-system", + "hash-db", + "num-traits", + "parity-scale-codec", + "scale-info", + "serde", + "sp-core", + "sp-io", + "sp-runtime", + "sp-state-machine", + "sp-std", + "sp-trie", + "trie-db", +] + +[[package]] +name = "bp-test-utils" +version = "0.1.0" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.30#9f1f451245784a0d2f4c943610c838bb1b7c8ac0" +dependencies = [ + "bp-header-chain", + "ed25519-dalek", + "finality-grandpa", + "parity-scale-codec", + "sp-application-crypto", + "sp-finality-grandpa", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "bridge-runtime-common" +version = "0.1.0" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.30#9f1f451245784a0d2f4c943610c838bb1b7c8ac0" +dependencies = [ + "bp-message-dispatch", + "bp-messages", + "bp-parachains", + "bp-polkadot-core", + "bp-runtime", + "frame-support", + "frame-system", + "hash-db", + "num-traits", + "pallet-balances", + "pallet-bridge-dispatch", + "pallet-bridge-grandpa", + "pallet-bridge-messages", + "pallet-bridge-parachains", + "pallet-fee-market", + "pallet-transaction-payment", + "parity-scale-codec", + "scale-info", + "sp-api", + "sp-core", + "sp-io", + "sp-runtime", + "sp-state-machine", + "sp-std", + "sp-trie", + "sp-version", +] + [[package]] name = "bs58" version = "0.4.0" @@ -1948,6 +2097,11 @@ name = "darwinia-runtime" version = "6.0.0" dependencies = [ "array-bytes", + "bp-message-dispatch", + "bp-messages", + "bp-polkadot-core", + "bp-runtime", + "bridge-runtime-common", "cumulus-pallet-aura-ext", "cumulus-pallet-dmp-queue", "cumulus-pallet-parachain-system", @@ -1973,6 +2127,9 @@ dependencies = [ "pallet-authorship", "pallet-balances", "pallet-base-fee", + "pallet-bridge-dispatch", + "pallet-bridge-grandpa", + "pallet-bridge-messages", "pallet-collator-selection", "pallet-ethereum", "pallet-evm", @@ -1980,6 +2137,7 @@ dependencies = [ "pallet-evm-precompile-bn128", "pallet-evm-precompile-modexp", "pallet-evm-precompile-simple", + "pallet-fee-market", "pallet-session", "pallet-sudo", "pallet-timestamp", @@ -5672,6 +5830,85 @@ dependencies = [ "sp-std", ] +[[package]] +name = "pallet-bridge-dispatch" +version = "0.1.0" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.30#9f1f451245784a0d2f4c943610c838bb1b7c8ac0" +dependencies = [ + "bp-message-dispatch", + "bp-runtime", + "frame-support", + "frame-system", + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "pallet-bridge-grandpa" +version = "0.1.0" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.30#9f1f451245784a0d2f4c943610c838bb1b7c8ac0" +dependencies = [ + "bp-header-chain", + "bp-runtime", + "bp-test-utils", + "finality-grandpa", + "frame-benchmarking", + "frame-support", + "frame-system", + "num-traits", + "parity-scale-codec", + "scale-info", + "serde", + "sp-finality-grandpa", + "sp-runtime", + "sp-std", + "sp-trie", +] + +[[package]] +name = "pallet-bridge-messages" +version = "0.1.0" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.30#9f1f451245784a0d2f4c943610c838bb1b7c8ac0" +dependencies = [ + "bitvec", + "bp-message-dispatch", + "bp-messages", + "bp-runtime", + "frame-benchmarking", + "frame-support", + "frame-system", + "num-traits", + "parity-scale-codec", + "scale-info", + "serde", + "sp-core", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "pallet-bridge-parachains" +version = "0.1.0" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.30#9f1f451245784a0d2f4c943610c838bb1b7c8ac0" +dependencies = [ + "bp-parachains", + "bp-polkadot-core", + "bp-runtime", + "frame-support", + "frame-system", + "pallet-bridge-grandpa", + "parity-scale-codec", + "scale-info", + "serde", + "sp-core", + "sp-runtime", + "sp-std", + "sp-trie", +] + [[package]] name = "pallet-child-bounties" version = "4.0.0-dev" @@ -5909,6 +6146,25 @@ dependencies = [ "sp-std", ] +[[package]] +name = "pallet-fee-market" +version = "0.1.0" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.30#9f1f451245784a0d2f4c943610c838bb1b7c8ac0" +dependencies = [ + "bp-messages", + "bp-runtime", + "frame-benchmarking", + "frame-support", + "frame-system", + "pallet-timestamp", + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", +] + [[package]] name = "pallet-gilt" version = "4.0.0-dev" diff --git a/runtime/darwinia/Cargo.toml b/runtime/darwinia/Cargo.toml index 1c1f0e72a..4d1a3e711 100644 --- a/runtime/darwinia/Cargo.toml +++ b/runtime/darwinia/Cargo.toml @@ -38,6 +38,17 @@ cumulus-pallet-session-benchmarking = { optional = true, default-features = fals darwinia-common-runtime = { default-features = false, path = "../common" } dc-primitives = { default-features = false, path = "../../core/primitives" } +# darwinia-messages-substrate +bp-message-dispatch = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } +bp-messages = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } +bp-polkadot-core = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } +bp-runtime = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } +bridge-runtime-common = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } +pallet-bridge-dispatch = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } +pallet-bridge-grandpa = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } +pallet-bridge-messages = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } +pallet-fee-market = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } + # frontier fp-evm = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } fp-rpc = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } @@ -113,6 +124,17 @@ std = [ "darwinia-common-runtime/std", "dc-primitives/std", + # darwinia-messages-substrate + "bp-message-dispatch/std", + "bp-messages/std", + "bp-runtime/std", + "bp-polkadot-core/std", + "bridge-runtime-common/std", + "pallet-bridge-dispatch/std", + "pallet-bridge-grandpa/std", + "pallet-bridge-messages/std", + "pallet-fee-market/std", + # frontier "fp-evm/std", "fp-rpc/std", @@ -176,6 +198,12 @@ runtime-benchmarks = [ # cumulus optional "cumulus-pallet-session-benchmarking/runtime-benchmarks", + # darwinia-messages-substrate + "bridge-runtime-common/runtime-benchmarks", + "pallet-bridge-grandpa/runtime-benchmarks", + "pallet-bridge-messages/runtime-benchmarks", + "pallet-fee-market/runtime-benchmarks", + # frontier "pallet-ethereum/runtime-benchmarks", "pallet-evm/runtime-benchmarks", From 28db256e2571de8b53ed308e7a92762367a67ad3 Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Mon, 21 Nov 2022 13:42:23 +0800 Subject: [PATCH 011/189] Process system and balances state (#39) * Process state part.1 * More detail * Take storages * Take KV * Merge balances * Extract balance lock * Format * Flatten account * Preprocess storage key * Fix properties * Add shell config * Modularize processor * Calculate total issuance * Recover nonce --- .gitignore | 2 +- Cargo.lock | 198 ++++--- node/src/chain_spec.rs | 70 ++- node/src/command.rs | 1 + tool/state-processor/Cargo.lock | 628 ++++++++++++++++++++++ tool/state-processor/Cargo.toml | 24 + tool/state-processor/src/balances/mod.rs | 37 ++ tool/state-processor/src/main.rs | 192 +++++++ tool/state-processor/src/system/mod.rs | 200 +++++++ tool/state-processor/src/type_registry.rs | 34 ++ 10 files changed, 1304 insertions(+), 82 deletions(-) create mode 100644 tool/state-processor/Cargo.lock create mode 100644 tool/state-processor/Cargo.toml create mode 100644 tool/state-processor/src/balances/mod.rs create mode 100644 tool/state-processor/src/main.rs create mode 100644 tool/state-processor/src/system/mod.rs create mode 100644 tool/state-processor/src/type_registry.rs diff --git a/.gitignore b/.gitignore index fa143606b..a9a20e83c 100644 --- a/.gitignore +++ b/.gitignore @@ -7,7 +7,7 @@ # Package Manager ## cargo -/target +target ## npm node_modules diff --git a/Cargo.lock b/Cargo.lock index 0b887893c..de80273b5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -123,9 +123,9 @@ dependencies = [ [[package]] name = "array-bytes" -version = "4.1.0" +version = "4.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a913633b0c922e6b745072795f50d90ebea78ba31a57e2ac8c2fc7b50950949" +checksum = "f52f63c5c1316a16a4b35eaac8b76a98248961a533f061684cb2a7cb0eafb6c6" [[package]] name = "arrayref" @@ -182,22 +182,22 @@ version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e14485364214912d3b19cc3435dde4df66065127f05fa0d75c712f36f12c2f28" dependencies = [ - "concurrent-queue", + "concurrent-queue 1.2.4", "event-listener", "futures-core", ] [[package]] name = "async-executor" -version = "1.4.1" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "871f9bb5e0a22eeb7e8cf16641feb87c9dc67032ccf8ff49e772eb9941d3a965" +checksum = "17adb73da160dfb475c183343c8cccd80721ea5a605d3eb57125f0a7b7a92d0b" dependencies = [ + "async-lock", "async-task", - "concurrent-queue", + "concurrent-queue 2.0.0", "fastrand", "futures-lite", - "once_cell", "slab", ] @@ -224,7 +224,7 @@ checksum = "e8121296a9f05be7f34aa4196b1747243b3b62e048bb7906f644f3fbfc490cf7" dependencies = [ "async-lock", "autocfg", - "concurrent-queue", + "concurrent-queue 1.2.4", "futures-lite", "libc", "log", @@ -574,9 +574,9 @@ dependencies = [ [[package]] name = "blake2" -version = "0.10.4" +version = "0.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9cf849ee05b2ee5fba5e36f97ff8ec2533916700fc0758d40d92136a42f3388" +checksum = "b12e5fd123190ce1c2e559308a94c9bacad77907d4c6005d9e58fe1a0689e55e" dependencies = [ "digest 0.10.5", ] @@ -942,9 +942,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.75" +version = "1.0.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41ca34107f97baef6cfb231b32f36115781856b8f8208e8c580e0bcaea374842" +checksum = "76a284da2e6fe2092f2353e51713435363112dfd60030e22add80be333fb928f" dependencies = [ "jobserver", ] @@ -1012,9 +1012,9 @@ dependencies = [ [[package]] name = "chrono" -version = "0.4.22" +version = "0.4.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfd4d1b31faaa3a89d7934dbded3111da0d2ef28e3ebccdb4f0179f5929d1ef1" +checksum = "16b0a3d9ed01224b22057780a37bb8c5dbfe1be8ba48678e7bf57ec4b385411f" dependencies = [ "iana-time-zone", "js-sys", @@ -1167,6 +1167,15 @@ dependencies = [ "cache-padded", ] +[[package]] +name = "concurrent-queue" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd7bef69dc86e3c610e4e7aed41035e2a7ed12e72dd7530f61327a6579a4390b" +dependencies = [ + "crossbeam-utils", +] + [[package]] name = "const-oid" version = "0.7.1" @@ -1230,18 +1239,18 @@ dependencies = [ [[package]] name = "cranelift-bforest" -version = "0.88.1" +version = "0.88.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44409ccf2d0f663920cab563d2b79fcd6b2e9a2bcc6e929fef76c8f82ad6c17a" +checksum = "52056f6d0584484b57fa6c1a65c1fcb15f3780d8b6a758426d9e3084169b2ddd" dependencies = [ "cranelift-entity", ] [[package]] name = "cranelift-codegen" -version = "0.88.1" +version = "0.88.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98de2018ad96eb97f621f7d6b900a0cc661aec8d02ea4a50e56ecb48e5a2fcaf" +checksum = "18fed94c8770dc25d01154c3ffa64ed0b3ba9d583736f305fed7beebe5d9cf74" dependencies = [ "arrayvec 0.7.2", "bumpalo", @@ -1259,33 +1268,33 @@ dependencies = [ [[package]] name = "cranelift-codegen-meta" -version = "0.88.1" +version = "0.88.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5287ce36e6c4758fbaf298bd1a8697ad97a4f2375a3d1b61142ea538db4877e5" +checksum = "1c451b81faf237d11c7e4f3165eeb6bac61112762c5cfe7b4c0fb7241474358f" dependencies = [ "cranelift-codegen-shared", ] [[package]] name = "cranelift-codegen-shared" -version = "0.88.1" +version = "0.88.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2855c24219e2f08827f3f4ffb2da92e134ae8d8ecc185b11ec8f9878cf5f588e" +checksum = "e7c940133198426d26128f08be2b40b0bd117b84771fd36798969c4d712d81fc" [[package]] name = "cranelift-entity" -version = "0.88.1" +version = "0.88.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b65673279d75d34bf11af9660ae2dbd1c22e6d28f163f5c72f4e1dc56d56103" +checksum = "87a0f1b2fdc18776956370cf8d9b009ded3f855350c480c1c52142510961f352" dependencies = [ "serde", ] [[package]] name = "cranelift-frontend" -version = "0.88.1" +version = "0.88.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ed2b3d7a4751163f6c4a349205ab1b7d9c00eecf19dcea48592ef1f7688eefc" +checksum = "34897538b36b216cc8dd324e73263596d51b8cf610da6498322838b2546baf8a" dependencies = [ "cranelift-codegen", "log", @@ -1295,15 +1304,15 @@ dependencies = [ [[package]] name = "cranelift-isle" -version = "0.88.1" +version = "0.88.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3be64cecea9d90105fc6a2ba2d003e98c867c1d6c4c86cc878f97ad9fb916293" +checksum = "1b2629a569fae540f16a76b70afcc87ad7decb38dc28fa6c648ac73b51e78470" [[package]] name = "cranelift-native" -version = "0.88.1" +version = "0.88.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4a03a6ac1b063e416ca4b93f6247978c991475e8271465340caa6f92f3c16a4" +checksum = "20937dab4e14d3e225c5adfc9c7106bafd4ac669bdb43027b911ff794c6fb318" dependencies = [ "cranelift-codegen", "libc", @@ -1312,9 +1321,9 @@ dependencies = [ [[package]] name = "cranelift-wasm" -version = "0.88.1" +version = "0.88.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c699873f7b30bc5f20dd03a796b4183e073a46616c91704792ec35e45d13f913" +checksum = "80fc2288957a94fd342a015811479de1837850924166d1f1856d8406e6f3609b" dependencies = [ "cranelift-codegen", "cranelift-entity", @@ -3760,9 +3769,9 @@ dependencies = [ [[package]] name = "hyper-rustls" -version = "0.23.0" +version = "0.23.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d87c48c02e0dc5e3b849a2041db3029fd066650f8f717c07bf8ed78ccb895cac" +checksum = "59df7c4e19c950e6e0e868dcc0a300b09a9b88e9ec55bd879ca819087a77355d" dependencies = [ "http", "hyper", @@ -3934,6 +3943,16 @@ version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "59ce5ef949d49ee85593fc4d3f3f95ad61657076395cbbce23e2121fc5542074" +[[package]] +name = "io-lifetimes" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7d367024b3f3414d8e01f437f704f41a9f64ab36f9067fa73e526ad4c763c87" +dependencies = [ + "libc", + "windows-sys 0.42.0", +] + [[package]] name = "ip_network" version = "0.4.1" @@ -3942,9 +3961,9 @@ checksum = "aa2f047c0a98b2f299aa5d6d7088443570faae494e9ae1305e48be000c9e0eb1" [[package]] name = "ipconfig" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "723519edce41262b05d4143ceb95050e4c614f483e78e9fd9e39a8275a84ad98" +checksum = "bd302af1b90f2463a98fa5ad469fc212c8e3175a41c3068601bfa2727591c5be" dependencies = [ "socket2", "widestring", @@ -4149,9 +4168,12 @@ dependencies = [ [[package]] name = "keccak" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9b7d56ba4a8344d6be9729995e6b06f928af29998cdf79fe390cbf6b1fee838" +checksum = "3afef3b6eff9ce9d8ff9b3601125eec7f0c8cbac7abd14f355d053fa56c98768" +dependencies = [ + "cpufeatures", +] [[package]] name = "kusama-runtime" @@ -4350,9 +4372,9 @@ dependencies = [ [[package]] name = "libm" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "292a948cd991e376cf75541fe5b97a1081d713c618b4f1b9500f8844e49eb565" +checksum = "348108ab3fba42ec82ff6e9564fc4ca0247bdccdc68dd8af9764bbc79c3c8ffb" [[package]] name = "libp2p" @@ -4983,6 +5005,12 @@ version = "0.0.46" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d4d2456c373231a208ad294c33dc5bff30051eafd954cd4caae83a712b12854d" +[[package]] +name = "linux-raw-sys" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb68f22743a3fb35785f1e7f844ca5a3de2dde5bd0c0ef5b372065814699b121" + [[package]] name = "lock_api" version = "0.4.9" @@ -5097,18 +5125,18 @@ checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" [[package]] name = "memfd" -version = "0.6.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "480b5a5de855d11ff13195950bdc8b98b5e942ef47afc447f6615cdcc4e15d80" +checksum = "b20a59d985586e4a5aef64564ac77299f8586d8be6cf9106a5a40207e8908efb" dependencies = [ - "rustix", + "rustix 0.36.1", ] [[package]] name = "memmap2" -version = "0.5.7" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95af15f345b17af2efc8ead6080fb8bc376f8cec1b35277b935637595fe77498" +checksum = "4b182332558b18d807c4ce1ca8ca983b34c3ee32765e47b3f0f69b90355cc1dc" dependencies = [ "libc", ] @@ -5639,9 +5667,9 @@ dependencies = [ [[package]] name = "os_str_bytes" -version = "6.3.1" +version = "6.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3baf96e39c5359d2eb0dd6ccb42c62b91d9678aa68160d261b9e0ccbf9e9dea9" +checksum = "7b5bf27447411e9ee3ff51186bf7a08e16c341efdde93f4d823e8844429bed7e" [[package]] name = "owning_ref" @@ -8990,9 +9018,23 @@ checksum = "727a1a6d65f786ec22df8a81ca3121107f235970dc1705ed681d3e6e8b9cd5f9" dependencies = [ "bitflags", "errno", - "io-lifetimes", + "io-lifetimes 0.7.5", + "libc", + "linux-raw-sys 0.0.46", + "windows-sys 0.42.0", +] + +[[package]] +name = "rustix" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "812a2ec2043c4d6bc6482f5be2ab8244613cac2493d128d36c0759e52a626ab3" +dependencies = [ + "bitflags", + "errno", + "io-lifetimes 1.0.1", "libc", - "linux-raw-sys", + "linux-raw-sys 0.1.2", "windows-sys 0.42.0", ] @@ -9491,7 +9533,7 @@ dependencies = [ "once_cell", "parity-scale-codec", "parity-wasm 0.45.0", - "rustix", + "rustix 0.35.13", "sc-allocator", "sc-executor-common", "sp-runtime-interface", @@ -11296,9 +11338,9 @@ dependencies = [ [[package]] name = "ss58-registry" -version = "1.33.0" +version = "1.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ab7554f8a8b6f8d71cd5a8e6536ef116e2ce0504cf97ebf16311d58065dc8a6" +checksum = "37a9821878e1f13aba383aa40a86fb1b33c7265774ec91e32563cb1dd1577496" dependencies = [ "Inflector", "num-format", @@ -12381,9 +12423,9 @@ dependencies = [ [[package]] name = "wasmtime" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1f511c4917c83d04da68333921107db75747c4e11a2f654a8e909cc5e0520dc" +checksum = "4ad5af6ba38311282f2a21670d96e78266e8c8e2f38cbcd52c254df6ccbc7731" dependencies = [ "anyhow", "bincode", @@ -12409,18 +12451,18 @@ dependencies = [ [[package]] name = "wasmtime-asm-macros" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39bf3debfe744bf19dd3732990ce6f8c0ced7439e2370ba4e1d8f5a3660a3178" +checksum = "45de63ddfc8b9223d1adc8f7b2ee5f35d1f6d112833934ad7ea66e4f4339e597" dependencies = [ "cfg-if 1.0.0", ] [[package]] name = "wasmtime-cache" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ece42fa4676a263f7558cdaaf5a71c2592bebcbac22a0580e33cf3406c103da2" +checksum = "bcd849399d17d2270141cfe47fa0d91ee52d5f8ea9b98cf7ddde0d53e5f79882" dependencies = [ "anyhow", "base64", @@ -12428,7 +12470,7 @@ dependencies = [ "directories-next", "file-per-thread-logger", "log", - "rustix", + "rustix 0.35.13", "serde", "sha2 0.9.9", "toml", @@ -12438,9 +12480,9 @@ dependencies = [ [[package]] name = "wasmtime-cranelift" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "058217e28644b012bdcdf0e445f58d496d78c2e0b6a6dd93558e701591dad705" +checksum = "4bd91339b742ff20bfed4532a27b73c86b5bcbfedd6bea2dcdf2d64471e1b5c6" dependencies = [ "anyhow", "cranelift-codegen", @@ -12459,9 +12501,9 @@ dependencies = [ [[package]] name = "wasmtime-environ" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7af06848df28b7661471d9a80d30a973e0f401f2e3ed5396ad7e225ed217047" +checksum = "ebb881c61f4f627b5d45c54e629724974f8a8890d455bcbe634330cc27309644" dependencies = [ "anyhow", "cranelift-entity", @@ -12478,9 +12520,9 @@ dependencies = [ [[package]] name = "wasmtime-jit" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9028fb63a54185b3c192b7500ef8039c7bb8d7f62bfc9e7c258483a33a3d13bb" +checksum = "1985c628011fe26adf5e23a5301bdc79b245e0e338f14bb58b39e4e25e4d8681" dependencies = [ "addr2line", "anyhow", @@ -12491,7 +12533,7 @@ dependencies = [ "log", "object", "rustc-demangle", - "rustix", + "rustix 0.35.13", "serde", "target-lexicon", "thiserror", @@ -12503,20 +12545,20 @@ dependencies = [ [[package]] name = "wasmtime-jit-debug" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25e82d4ef93296785de7efca92f7679dc67fe68a13b625a5ecc8d7503b377a37" +checksum = "f671b588486f5ccec8c5a3dba6b4c07eac2e66ab8c60e6f4e53717c77f709731" dependencies = [ "object", "once_cell", - "rustix", + "rustix 0.35.13", ] [[package]] name = "wasmtime-runtime" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f0e9bea7d517d114fe66b930b2124ee086516ee93eeebfd97f75f366c5b0553" +checksum = "ee8f92ad4b61736339c29361da85769ebc200f184361959d1792832e592a1afd" dependencies = [ "anyhow", "cc", @@ -12529,7 +12571,7 @@ dependencies = [ "memoffset", "paste", "rand 0.8.5", - "rustix", + "rustix 0.35.13", "thiserror", "wasmtime-asm-macros", "wasmtime-environ", @@ -12539,9 +12581,9 @@ dependencies = [ [[package]] name = "wasmtime-types" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69b83e93ed41b8fdc936244cfd5e455480cf1eca1fd60c78a0040038b4ce5075" +checksum = "d23d61cb4c46e837b431196dd06abb11731541021916d03476a178b54dc07aeb" dependencies = [ "cranelift-entity", "serde", @@ -12882,18 +12924,18 @@ checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5" [[package]] name = "winreg" -version = "0.7.0" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0120db82e8a1e0b9fb3345a539c478767c0048d842860994d96113d5b667bd69" +checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d" dependencies = [ "winapi", ] [[package]] name = "wyz" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30b31594f29d27036c383b53b59ed3476874d518f0efb151b27a4c275141390e" +checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" dependencies = [ "tap", ] diff --git a/node/src/chain_spec.rs b/node/src/chain_spec.rs index f18ffff66..c4195e3ad 100644 --- a/node/src/chain_spec.rs +++ b/node/src/chain_spec.rs @@ -96,7 +96,7 @@ pub fn session_keys(keys: AuraId) -> darwinia_runtime::SessionKeys { pub fn development_config() -> ChainSpec { // Give your base currency a unit name and decimal places let mut properties = sc_chain_spec::Properties::new(); - properties.insert("tokenSymbol".into(), "UNIT".into()); + properties.insert("tokenSymbol".into(), "RING".into()); properties.insert("tokenDecimals".into(), 18.into()); properties.insert("ss58Format".into(), 18.into()); @@ -140,7 +140,7 @@ pub fn development_config() -> ChainSpec { None, None, None, - None, + Some(properties), Extensions { relay_chain: "rococo-local".into(), // You MUST set this to the correct network! para_id: 1000, @@ -151,7 +151,7 @@ pub fn development_config() -> ChainSpec { pub fn local_testnet_config() -> ChainSpec { // Give your base currency a unit name and decimal places let mut properties = sc_chain_spec::Properties::new(); - properties.insert("tokenSymbol".into(), "UNIT".into()); + properties.insert("tokenSymbol".into(), "RING".into()); properties.insert("tokenDecimals".into(), 18.into()); properties.insert("ss58Format".into(), 18.into()); @@ -209,6 +209,70 @@ pub fn local_testnet_config() -> ChainSpec { ) } +pub fn shell_config() -> ChainSpec { + // Give your base currency a unit name and decimal places + let mut properties = sc_chain_spec::Properties::new(); + properties.insert("tokenSymbol".into(), "RING".into()); + properties.insert("tokenDecimals".into(), 18.into()); + properties.insert("ss58Format".into(), 18.into()); + + ChainSpec::from_genesis( + // Name + "Darwinia", + // ID + "darwinia", + ChainType::Live, + move || { + darwinia_runtime::GenesisConfig { + system: darwinia_runtime::SystemConfig { + code: darwinia_runtime::WASM_BINARY + .expect("WASM binary was not build, please build it!") + .to_vec(), + }, + balances: Default::default(), + parachain_info: darwinia_runtime::ParachainInfoConfig { parachain_id: 2046.into() }, + collator_selection: darwinia_runtime::CollatorSelectionConfig { + invulnerables: vec![get_account_id_from_seed::("Alice")], + ..Default::default() + }, + session: darwinia_runtime::SessionConfig { + keys: vec![( + get_account_id_from_seed::("Alice"), + get_account_id_from_seed::("Alice"), + session_keys(get_collator_keys_from_seed("Alice")), + )], + }, + // no need to pass anything to aura, in fact it will panic if we do. Session will + // take care of this. + aura: Default::default(), + aura_ext: Default::default(), + parachain_system: Default::default(), + polkadot_xcm: darwinia_runtime::PolkadotXcmConfig { + safe_xcm_version: Some(SAFE_XCM_VERSION), + }, + ethereum: Default::default(), + evm: Default::default(), + base_fee: Default::default(), + } + }, + // Bootnodes + Vec::new(), + // Telemetry + None, + // Protocol ID + Some("darwinia"), + // Fork ID + None, + // Properties + Some(properties), + // Extensions + Extensions { + relay_chain: "polkadot".into(), // You MUST set this to the correct network! + para_id: 2046, + }, + ) +} + fn testnet_genesis( invulnerables: Vec<(AccountId, AuraId)>, endowed_accounts: Vec, diff --git a/node/src/command.rs b/node/src/command.rs index 21f65d236..eb3a59152 100644 --- a/node/src/command.rs +++ b/node/src/command.rs @@ -495,6 +495,7 @@ fn load_spec(id: &str) -> std::result::Result, String> { Ok(match id { "dev" => Box::new(chain_spec::development_config()), "" | "local" => Box::new(chain_spec::local_testnet_config()), + "shell" => Box::new(chain_spec::shell_config()), path => Box::new(chain_spec::ChainSpec::from_json_file(std::path::PathBuf::from(path))?), }) } diff --git a/tool/state-processor/Cargo.lock b/tool/state-processor/Cargo.lock new file mode 100644 index 000000000..ba158446d --- /dev/null +++ b/tool/state-processor/Cargo.lock @@ -0,0 +1,628 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "aho-corasick" +version = "0.7.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4f55bd91a0978cbfd91c457a164bab8b4001c833b7f323132c0a4e1922dd44e" +dependencies = [ + "memchr", +] + +[[package]] +name = "anyhow" +version = "1.0.66" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "216261ddc8289130e551ddcd5ce8a064710c0d064a4d2895c67151c92b5443f6" + +[[package]] +name = "array-bytes" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a913633b0c922e6b745072795f50d90ebea78ba31a57e2ac8c2fc7b50950949" + +[[package]] +name = "arrayvec" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd9fd44efafa8690358b7408d253adf110036b88f55672a933f01d616ad9b1b9" +dependencies = [ + "nodrop", +] + +[[package]] +name = "arrayvec" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" + +[[package]] +name = "atty" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" +dependencies = [ + "hermit-abi", + "libc", + "winapi", +] + +[[package]] +name = "bitvec" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c" +dependencies = [ + "funty", + "radium", + "tap", + "wyz", +] + +[[package]] +name = "blake2-rfc" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d6d530bdd2d52966a6d03b7a964add7ae1a288d25214066fd4b600f0f796400" +dependencies = [ + "arrayvec 0.4.12", + "constant_time_eq", +] + +[[package]] +name = "block-buffer" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cce20737498f97b993470a6e536b8523f0af7892a4f928cceb1ac5e52ebe7e" +dependencies = [ + "generic-array", +] + +[[package]] +name = "byte-slice-cast" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c" + +[[package]] +name = "byteorder" +version = "1.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "constant_time_eq" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" + +[[package]] +name = "cpufeatures" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28d997bd5e24a5928dd43e46dc529867e207907fe0b239c3477d924f7f2ca320" +dependencies = [ + "libc", +] + +[[package]] +name = "crunchy" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "digest" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adfbc57365a37acbd2ebf2b64d7e69bb766e2fea813521ed536f5d0520dcf86c" +dependencies = [ + "block-buffer", + "crypto-common", +] + +[[package]] +name = "env_logger" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36" +dependencies = [ + "atty", + "humantime", + "log", + "regex", + "termcolor", +] + +[[package]] +name = "funty" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" + +[[package]] +name = "fxhash" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" +dependencies = [ + "byteorder", +] + +[[package]] +name = "generic-array" +version = "0.14.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bff49e947297f3312447abdca79f45f4738097cc82b06e72054d2223f601f1b9" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "hermit-abi" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" +dependencies = [ + "libc", +] + +[[package]] +name = "humantime" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df004cfca50ef23c36850aaaa59ad52cc70d0e90243c3c7737a4dd32dc7a3c4f" +dependencies = [ + "quick-error", +] + +[[package]] +name = "impl-trait-for-tuples" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11d7a9f6330b71fea57921c9b61c47ee6e84f72d394754eff6163ae67e7395eb" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "itoa" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4217ad341ebadf8d8e724e264f13e593e0648f5b3e94b3896a5df283be015ecc" + +[[package]] +name = "libc" +version = "0.2.137" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc7fcc620a3bff7cdd7a365be3376c97191aeaccc2a603e600951e452615bf89" + +[[package]] +name = "log" +version = "0.4.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "memchr" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" + +[[package]] +name = "nodrop" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" + +[[package]] +name = "once_cell" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860" + +[[package]] +name = "parity-scale-codec" +version = "3.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "366e44391a8af4cfd6002ef6ba072bae071a96aafca98d7d448a34c5dca38b6a" +dependencies = [ + "arrayvec 0.7.2", + "bitvec", + "byte-slice-cast", + "impl-trait-for-tuples", + "parity-scale-codec-derive", + "serde", +] + +[[package]] +name = "parity-scale-codec-derive" +version = "3.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9299338969a3d2f491d65f140b00ddec470858402f888af98e8642fb5e8965cd" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "ppv-lite86" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" + +[[package]] +name = "pretty_env_logger" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "926d36b9553851b8b0005f1275891b392ee4d2d833852c417ed025477350fb9d" +dependencies = [ + "env_logger", + "log", +] + +[[package]] +name = "proc-macro-crate" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eda0fc3b0fb7c975631757e14d9049da17374063edb6ebbcbc54d880d4fe94e9" +dependencies = [ + "once_cell", + "thiserror", + "toml", +] + +[[package]] +name = "proc-macro2" +version = "1.0.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ea3d908b0e36316caf9e9e2c4625cdde190a7e6f440d794667ed17a1855e725" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quick-error" +version = "1.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" + +[[package]] +name = "quote" +version = "1.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "radium" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha", + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom", +] + +[[package]] +name = "regex" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e076559ef8e241f2ae3479e36f97bd5741c0330689e217ad51ce2c76808b868a" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.6.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" + +[[package]] +name = "ryu" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09" + +[[package]] +name = "serde" +version = "1.0.147" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d193d69bae983fc11a79df82342761dfbf28a99fc8d203dca4c3c1b590948965" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.147" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f1d362ca8fc9c3e3a7484440752472d68a6caa98f1ab81d99b5dfe517cec852" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce777b7b150d76b9cf60d28b55f5847135a003f7d7350c6be7a773508ce7d45" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "sha2" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "state-processor" +version = "0.0.0" +dependencies = [ + "anyhow", + "array-bytes", + "fxhash", + "log", + "parity-scale-codec", + "pretty_env_logger", + "serde", + "serde_json", + "subhasher", + "subspector", + "substorager", +] + +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[package]] +name = "subhasher" +version = "0.9.0-rc16" +source = "git+https://github.com/hack-ink/subalfred#de1ed2b16b0b2c3ceeb61b1f9168401bc0ace51d" +dependencies = [ + "blake2-rfc", + "byteorder", + "sha2", + "tiny-keccak", + "twox-hash", +] + +[[package]] +name = "subspector" +version = "0.9.0-rc16" +source = "git+https://github.com/hack-ink/subalfred#de1ed2b16b0b2c3ceeb61b1f9168401bc0ace51d" +dependencies = [ + "fxhash", + "serde", + "serde_json", +] + +[[package]] +name = "substorager" +version = "0.9.0-rc16" +source = "git+https://github.com/hack-ink/subalfred#de1ed2b16b0b2c3ceeb61b1f9168401bc0ace51d" +dependencies = [ + "array-bytes", + "subhasher", +] + +[[package]] +name = "syn" +version = "1.0.103" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a864042229133ada95abf3b54fdc62ef5ccabe9515b64717bcb9a1919e59445d" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "tap" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" + +[[package]] +name = "termcolor" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "thiserror" +version = "1.0.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10deb33631e3c9018b9baf9dcbbc4f737320d2b576bac10f6aefa048fa407e3e" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "982d17546b47146b28f7c22e3d08465f6b8903d0ea13c1660d9d84a6e7adcdbb" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tiny-keccak" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" +dependencies = [ + "crunchy", +] + +[[package]] +name = "toml" +version = "0.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7" +dependencies = [ + "serde", +] + +[[package]] +name = "twox-hash" +version = "1.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" +dependencies = [ + "cfg-if", + "rand", + "static_assertions", +] + +[[package]] +name = "typenum" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" + +[[package]] +name = "unicode-ident" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ceab39d59e4c9499d4e5a8ee0e2735b891bb7308ac83dfb4e80cad195c9f6f3" + +[[package]] +name = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-util" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +dependencies = [ + "winapi", +] + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "wyz" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30b31594f29d27036c383b53b59ed3476874d518f0efb151b27a4c275141390e" +dependencies = [ + "tap", +] diff --git a/tool/state-processor/Cargo.toml b/tool/state-processor/Cargo.toml new file mode 100644 index 000000000..829a5f9e8 --- /dev/null +++ b/tool/state-processor/Cargo.toml @@ -0,0 +1,24 @@ +[package] +authors = ["Xavier Lau "] +edition = "2021" +license = "GPL-3.0" +name = "state-processor" +version = "0.0.0" + +[dependencies] +# crates.io +anyhow = { version = "1.0" } +array-bytes = { version = "4.1" } +fxhash = { version = "0.2" } +log = { version = "0.4" } +parity-scale-codec = { version = "3.2", features = ["derive"] } +pretty_env_logger = { version = "0.4" } +serde = { version = "1.0" } +serde_json = { version = "1.0" } +# hack-ink +subhasher = { git = "https://github.com/hack-ink/subalfred" } +subspector = { git = "https://github.com/hack-ink/subalfred" } +substorager = { git = "https://github.com/hack-ink/subalfred" } + +[workspace] +exclude = [] diff --git a/tool/state-processor/src/balances/mod.rs b/tool/state-processor/src/balances/mod.rs new file mode 100644 index 000000000..ec9d4dbc5 --- /dev/null +++ b/tool/state-processor/src/balances/mod.rs @@ -0,0 +1,37 @@ +// darwinia +use crate::*; + +impl Processor { + pub fn process_balances( + &mut self, + ring_locks: &mut Map>, + kton_locks: &mut Map>, + ) -> &mut Self { + log::info!("take solo balance locks"); + self.solo_state + .take::, _>( + b"Balances", + b"Locks", + ring_locks, + get_blake2_128_concat_suffix, + ) + .take::, _>( + b"Kton", + b"Locks", + kton_locks, + get_blake2_128_concat_suffix, + ); + + // --- + // Currently, there are only fee-market locks. + // I suggest shutting down the fee-market before merging. + // So, we could ignore the para balance locks migration. + // --- + + log::info!("adjust solo balance lock decimals"); + ring_locks.iter_mut().for_each(|(_, v)| v.iter_mut().for_each(|l| l.amount *= GWEI)); + kton_locks.iter_mut().for_each(|(_, v)| v.iter_mut().for_each(|l| l.amount *= GWEI)); + + self + } +} diff --git a/tool/state-processor/src/main.rs b/tool/state-processor/src/main.rs new file mode 100644 index 000000000..2268700de --- /dev/null +++ b/tool/state-processor/src/main.rs @@ -0,0 +1,192 @@ +mod balances; +mod system; + +mod type_registry; +use type_registry::*; + +// std +use std::{ + env, + fs::File, + io::{Read, Write}, +}; +// crates.io +use anyhow::Result; +use fxhash::FxHashMap; +use parity_scale_codec::{Decode, Encode}; +use serde::de::DeserializeOwned; +// hack-ink +use subspector::ChainSpec; + +type Map = FxHashMap; + +fn main() -> Result<()> { + env::set_var("RUST_LOG", "state_processor"); + pretty_env_logger::init(); + + Processor::new()?.process()?; + + Ok(()) +} + +struct Processor { + solo_state: State, + para_state: State, + shell_chain_spec: ChainSpec, +} +impl Processor { + fn new() -> Result { + Ok(Self { + solo_state: State::from_file("test-data/solo.json")?, + para_state: State::from_file("test-data/para.json")?, + shell_chain_spec: from_file("test-data/shell.json")?, + }) + } + + fn process(mut self) -> Result<()> { + self.process_system(); + + self.save() + } + + fn save(self) -> Result<()> { + log::info!("save processed chain spec"); + + let mut f = File::create("test-data/processed.json")?; + let v = serde_json::to_vec(&self.shell_chain_spec)?; + + f.write_all(&v)?; + + Ok(()) + } +} + +struct State(Map); +impl State { + fn from_file(path: &str) -> Result { + Ok(Self(from_file::(path)?.genesis.raw.top)) + } + + #[allow(unused)] + fn prune(&mut self, pallet: &[u8], items: Option<&[&[u8]]>) -> &mut Self { + // Prune specific storages. + if let Some(items) = items { + for item in items { + let k = item_key(pallet, item); + + self.0.remove(&k).or_else(|| { + log::warn!( + "`{}::{}: {k}` not found", + String::from_utf8_lossy(pallet), + String::from_utf8_lossy(item) + ); + + None + }); + } + } + // Prune entire pallet. + else { + let prefix = pallet_key(pallet); + let mut pruned = false; + + self.0.retain(|full_key, _| { + if full_key.starts_with(&prefix) { + pruned = true; + + false + } else { + true + } + }); + + if !pruned { + log::warn!("`{}: {prefix}` not found", String::from_utf8_lossy(pallet)); + } + } + + self + } + + fn take( + &mut self, + pallet: &[u8], + item: &[u8], + buffer: &mut Map, + preprocess_key: F, + ) -> &mut Self + where + D: Decode, + F: Fn(&str, &str) -> String, + { + let item_key = item_key(pallet, item); + + self.0.retain(|full_key, v| { + if full_key.starts_with(&item_key) { + match decode(v) { + Ok(v) => { + buffer.insert(preprocess_key(full_key, &item_key), v); + }, + Err(e) => log::warn!("failed to decode `{full_key}:{v}`, due to `{e}`"), + } + + false + } else { + true + } + }); + + self + } +} + +fn from_file(path: &str) -> Result +where + D: DeserializeOwned, +{ + log::info!("load data from {path:?}"); + + let mut f = File::open(path)?; + let mut v = Vec::new(); + + f.read_to_end(&mut v)?; + + Ok(serde_json::from_slice(&v)?) +} + +fn pallet_key(pallet: &[u8]) -> String { + let prefix = subhasher::twox128(pallet); + + array_bytes::bytes2hex("0x", &prefix) +} + +fn item_key(pallet: &[u8], item: &[u8]) -> String { + let k = substorager::storage_key(pallet, item); + + array_bytes::bytes2hex("0x", &k.0) +} + +fn encode_value(v: V) -> String +where + V: Encode, +{ + array_bytes::bytes2hex("0x", &v.encode()) +} + +fn decode(hex: &str) -> Result +where + D: Decode, +{ + let v = array_bytes::hex2bytes(hex).map_err(|e| anyhow::anyhow!("{e:?}"))?; + + Ok(D::decode(&mut &*v)?) +} + +fn get_blake2_128_concat_suffix(full_key: &str, item_key: &str) -> String { + full_key.trim_start_matches(item_key).into() +} + +#[allow(unused)] +fn get_concat_suffix(full_key: &str, _: &str) -> String { + format!("0x{}", &full_key[full_key.len() - 64..]) +} diff --git a/tool/state-processor/src/system/mod.rs b/tool/state-processor/src/system/mod.rs new file mode 100644 index 000000000..66977d038 --- /dev/null +++ b/tool/state-processor/src/system/mod.rs @@ -0,0 +1,200 @@ +// darwinia +use crate::*; + +#[derive(Debug)] +pub struct AccountAll { + pub key: String, + pub nonce: u32, + pub consumers: u32, + pub providers: u32, + pub sufficients: u32, + pub ring: u128, + pub ring_reserved: u128, + pub ring_locks: Vec, + pub kton: u128, + pub kton_reserved: u128, + pub kton_locks: Vec, +} + +impl Processor { + // System storage items. + // https://github.com/paritytech/substrate/blob/polkadot-v0.9.16/frame/system/src/lib.rs#L545-L639 + // Balances storage items. + // https://github.com/paritytech/substrate/blob/polkadot-v0.9.16/frame/balances/src/lib.rs#L486-L535 + pub fn process_system(&mut self) -> &mut Self { + let mut accounts = Map::default(); + let mut solo_account_infos = Map::default(); + let mut solo_ring_locks = Map::default(); + let mut solo_kton_locks = Map::default(); + let mut para_account_infos = Map::default(); + let mut remaining_ring = Map::default(); + let mut remaining_kton = Map::default(); + let mut ring_total_issuance = 0; + + log::info!("take solo and remaining balances"); + self.solo_state + .take::( + b"System", + b"Account", + &mut solo_account_infos, + get_blake2_128_concat_suffix, + ) + .take::( + b"Ethereum", + b"RemainingRingBalance", + &mut remaining_ring, + get_blake2_128_concat_suffix, + ) + .take::( + b"Ethereum", + b"RemainingKtonBalance", + &mut remaining_kton, + get_blake2_128_concat_suffix, + ); + + log::info!("take solo and para balance locks"); + self.process_balances(&mut solo_ring_locks, &mut solo_kton_locks); + + log::info!("take para balances"); + self.para_state.take::( + b"System", + b"Account", + &mut para_account_infos, + get_blake2_128_concat_suffix, + ); + + log::info!("adjust solo balance decimals"); + solo_account_infos.iter_mut().for_each(|(_, v)| { + v.data.free *= GWEI; + v.data.reserved *= GWEI; + v.data.free_kton_or_misc_frozen *= GWEI; + v.data.reserved_kton_or_fee_frozen *= GWEI; + }); + + log::info!("merge solo and remaining balances"); + remaining_ring.into_iter().for_each(|(k, v)| { + if let Some(a) = solo_account_infos.get_mut(&k) { + a.data.free += v; + } else { + log::warn!("`RemainingRingBalance({k})` not found"); + } + }); + remaining_kton.into_iter().for_each(|(k, v)| { + if let Some(a) = solo_account_infos.get_mut(&k) { + a.data.free_kton_or_misc_frozen += v; + } else { + log::warn!("`RemainingKtonBalance({k})` not found"); + } + }); + + log::info!("build accounts"); + log::info!("calculate ring total issuance"); + solo_account_infos.into_iter().for_each(|(k, v)| { + let ring_locks = solo_ring_locks.remove(&k).unwrap_or_default(); + let kton_locks = solo_kton_locks.remove(&k).unwrap_or_default(); + + ring_total_issuance += v.data.free; + ring_total_issuance += v.data.reserved; + + accounts.insert( + k.clone(), + AccountAll { + key: k, + nonce: v.nonce, + // --- + // TODO: check if we could ignore para's. + consumers: v.consumers, + providers: v.providers, + sufficients: v.sufficients, + // --- + ring: v.data.free, + ring_reserved: v.data.reserved, + ring_locks, + kton: v.data.free_kton_or_misc_frozen, + kton_reserved: v.data.reserved_kton_or_fee_frozen, + kton_locks, + }, + ); + }); + para_account_infos.into_iter().for_each(|(k, v)| { + ring_total_issuance += v.data.free; + ring_total_issuance += v.data.reserved; + + accounts + .entry(k.clone()) + .and_modify(|a| { + a.nonce = v.nonce.max(a.nonce); + a.ring += v.data.free; + a.ring_reserved += v.data.reserved; + }) + .or_insert(AccountAll { + key: k, + nonce: v.nonce, + consumers: v.consumers, + providers: v.providers, + sufficients: v.sufficients, + ring: v.data.free, + ring_reserved: v.data.reserved, + ring_locks: Vec::new(), + kton: 0, + kton_reserved: 0, + kton_locks: Vec::new(), + }); + }); + + log::info!("check solo remaining locks"); + solo_ring_locks.into_iter().for_each(|(k, _)| log::warn!("ring_locks' owner({k}) dropped")); + solo_kton_locks.into_iter().for_each(|(k, _)| log::warn!("kton_locks' owner({k}) dropped")); + + let state = &mut self.shell_chain_spec.genesis.raw.top; + + log::info!("set `Balances::TotalIssuance`"); + state.insert(item_key(b"Balances", b"TotalIssuance"), encode_value(ring_total_issuance)); + + log::info!("update ring misc frozen and fee frozen"); + log::info!("set `System::Account`"); + log::info!("set `Balances::Locks`"); + accounts.into_iter().for_each(|(k, v)| { + let mut a = AccountInfo { + nonce: v.nonce, + consumers: v.consumers, + providers: v.providers, + sufficients: v.sufficients, + data: AccountData { + free: v.ring, + reserved: v.ring_reserved, + free_kton_or_misc_frozen: 0, + reserved_kton_or_fee_frozen: 0, + }, + }; + + // https://github.com/paritytech/substrate/blob/polkadot-v0.9.16/frame/balances/src/lib.rs#L945-L952 + // Update ring misc frozen and fee frozen. + for l in v.ring_locks.iter() { + if l.reasons == Reasons::All || l.reasons == Reasons::Misc { + a.data.free_kton_or_misc_frozen = a.data.free_kton_or_misc_frozen.max(l.amount); + } + if l.reasons == Reasons::All || l.reasons == Reasons::Fee { + a.data.reserved_kton_or_fee_frozen = + a.data.reserved_kton_or_fee_frozen.max(l.amount); + } + } + // --- + // TODO: migrate kton locks. + // --- + + // Set `System::Account`. + state.insert(format!("{}{k}", item_key(b"System", b"Account")), encode_value(a)); + // Set `Balances::Locks`. + // Skip empty locks. + if !v.ring_locks.is_empty() { + state.insert( + format!("{}{k}", item_key(b"Balances", b"Locks")), + encode_value(v.ring_locks), + ); + } + }); + + self + } +} diff --git a/tool/state-processor/src/type_registry.rs b/tool/state-processor/src/type_registry.rs new file mode 100644 index 000000000..4379e9d5d --- /dev/null +++ b/tool/state-processor/src/type_registry.rs @@ -0,0 +1,34 @@ +// crates.io +use parity_scale_codec::{Decode, Encode}; + +pub const GWEI: u128 = 1_000_000_000; + +#[derive(Debug, Encode, Decode)] +pub struct AccountInfo { + pub nonce: u32, + pub consumers: u32, + pub providers: u32, + pub sufficients: u32, + pub data: AccountData, +} +#[derive(Debug, Encode, Decode)] +pub struct AccountData { + pub free: u128, + pub reserved: u128, + pub free_kton_or_misc_frozen: u128, + pub reserved_kton_or_fee_frozen: u128, +} + +#[derive(Debug, Encode, Decode)] +pub struct BalanceLock { + pub id: [u8; 8], + pub amount: u128, + pub reasons: Reasons, +} +#[allow(clippy::unnecessary_cast)] +#[derive(Debug, PartialEq, Eq, Encode, Decode)] +pub enum Reasons { + Fee = 0, + Misc = 1, + All = 2, +} From 4b40193e8789fe389adf55560914640371f967a6 Mon Sep 17 00:00:00 2001 From: bear Date: Tue, 22 Nov 2022 13:11:20 +0800 Subject: [PATCH 012/189] Add darwinia's precompiles (#50) --- Cargo.lock | 273 ++++++++++++++++++++++--- Cargo.toml | 1 + precompiles/bls12-381/Cargo.toml | 50 +++++ precompiles/bls12-381/src/lib.rs | 60 ++++++ precompiles/state-storage/Cargo.toml | 48 +++++ precompiles/state-storage/src/lib.rs | 72 +++++++ precompiles/state-storage/src/mock.rs | 265 ++++++++++++++++++++++++ precompiles/state-storage/src/tests.rs | 90 ++++++++ runtime/darwinia/Cargo.toml | 33 +-- runtime/darwinia/src/pallets/evm.rs | 28 ++- 10 files changed, 876 insertions(+), 44 deletions(-) create mode 100644 precompiles/bls12-381/Cargo.toml create mode 100644 precompiles/bls12-381/src/lib.rs create mode 100644 precompiles/state-storage/Cargo.toml create mode 100644 precompiles/state-storage/src/lib.rs create mode 100644 precompiles/state-storage/src/mock.rs create mode 100644 precompiles/state-storage/src/tests.rs diff --git a/Cargo.lock b/Cargo.lock index de80273b5..58f41e74b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -62,6 +62,15 @@ dependencies = [ "subtle", ] +[[package]] +name = "affix" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50e7ea84d3fa2009f355f8429a0b418a96849135a4188fadf384f59127d5d4bc" +dependencies = [ + "convert_case 0.5.0", +] + [[package]] name = "ahash" version = "0.7.6" @@ -88,6 +97,11 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fbf688625d06217d5b1bb0ea9d9c44a1635fd0ee3534466388d18203174f4d11" +[[package]] +name = "amcl" +version = "0.3.0" +source = "git+https://github.com/darwinia-network/milagro_bls#076d5fb697b304534b26cb8b7fe488b9a7e70a99" + [[package]] name = "android_system_properties" version = "0.1.5" @@ -633,7 +647,7 @@ version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" dependencies = [ - "block-padding", + "block-padding 0.1.5", "byte-tools", "byteorder", "generic-array 0.12.4", @@ -645,6 +659,7 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" dependencies = [ + "block-padding 0.2.1", "generic-array 0.14.6", ] @@ -666,6 +681,12 @@ dependencies = [ "byte-tools", ] +[[package]] +name = "block-padding" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae" + [[package]] name = "blocking" version = "1.2.0" @@ -850,7 +871,9 @@ version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ba3569f383e8f1598449f1a423e72e99569137b47740b1da11ef19af3d5c3223" dependencies = [ + "lazy_static", "memchr", + "regex-automata", ] [[package]] @@ -940,6 +963,12 @@ dependencies = [ "serde_json", ] +[[package]] +name = "case" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd6c0e7b807d60291f42f33f58480c0bfafe28ed08286446f45e463728cf9c1c" + [[package]] name = "cc" version = "1.0.76" @@ -1176,6 +1205,19 @@ dependencies = [ "crossbeam-utils", ] +[[package]] +name = "console" +version = "0.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c050367d967ced717c04b65d8c619d863ef9292ce0c5760028655a2fb298718c" +dependencies = [ + "encode_unicode", + "lazy_static", + "libc", + "terminal_size", + "winapi", +] + [[package]] name = "const-oid" version = "0.7.1" @@ -1194,6 +1236,12 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" +[[package]] +name = "convert_case" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb4a24b1aaf0fd0ce8b45161144d6f42cd91677fd5940fd431183eb023b3a2b8" + [[package]] name = "core-foundation" version = "0.9.3" @@ -2101,6 +2149,45 @@ dependencies = [ "xcm-executor", ] +[[package]] +name = "darwinia-precompile-bls12-381" +version = "6.0.0" +dependencies = [ + "fp-evm", + "frame-support", + "frame-system", + "milagro_bls", + "pallet-balances", + "pallet-evm", + "pallet-timestamp", + "parity-scale-codec", + "precompile-utils", + "scale-info", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "darwinia-precompile-state-storage" +version = "6.0.0" +dependencies = [ + "fp-evm", + "frame-support", + "frame-system", + "pallet-balances", + "pallet-evm", + "pallet-timestamp", + "parity-scale-codec", + "precompile-utils", + "scale-info", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", +] + [[package]] name = "darwinia-runtime" version = "6.0.0" @@ -2121,6 +2208,8 @@ dependencies = [ "cumulus-primitives-timestamp", "cumulus-primitives-utility", "darwinia-common-runtime", + "darwinia-precompile-bls12-381", + "darwinia-precompile-state-storage", "dc-primitives", "fp-evm", "fp-rpc", @@ -2144,6 +2233,7 @@ dependencies = [ "pallet-evm", "pallet-evm-precompile-blake2", "pallet-evm-precompile-bn128", + "pallet-evm-precompile-dispatch", "pallet-evm-precompile-modexp", "pallet-evm-precompile-simple", "pallet-fee-market", @@ -2237,7 +2327,7 @@ version = "0.99.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" dependencies = [ - "convert_case", + "convert_case 0.4.0", "proc-macro2", "quote", "rustc_version", @@ -2436,6 +2526,12 @@ dependencies = [ "zeroize", ] +[[package]] +name = "encode_unicode" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" + [[package]] name = "enum-as-inner" version = "0.4.0" @@ -2549,7 +2645,7 @@ dependencies = [ "rlp-derive", "scale-info", "serde", - "sha3", + "sha3 0.10.6", "triehash", ] @@ -2593,7 +2689,7 @@ dependencies = [ "rlp", "scale-info", "serde", - "sha3", + "sha3 0.10.6", ] [[package]] @@ -2630,7 +2726,7 @@ dependencies = [ "environmental", "evm-core", "primitive-types", - "sha3", + "sha3 0.10.6", ] [[package]] @@ -2716,7 +2812,7 @@ dependencies = [ [[package]] name = "fc-cli" version = "1.0.0-dev" -source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.30#ce45aff1903e058f4cf6e660f2c9202847a15b25" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.30#1bd889c001b2a4735777160354cb57b8c17cf756" dependencies = [ "clap", "ethereum-types", @@ -2735,7 +2831,7 @@ dependencies = [ [[package]] name = "fc-consensus" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.30#ce45aff1903e058f4cf6e660f2c9202847a15b25" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.30#1bd889c001b2a4735777160354cb57b8c17cf756" dependencies = [ "async-trait", "fc-db", @@ -2754,7 +2850,7 @@ dependencies = [ [[package]] name = "fc-db" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.30#ce45aff1903e058f4cf6e660f2c9202847a15b25" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.30#1bd889c001b2a4735777160354cb57b8c17cf756" dependencies = [ "fp-storage", "kvdb-rocksdb", @@ -2772,7 +2868,7 @@ dependencies = [ [[package]] name = "fc-mapping-sync" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.30#ce45aff1903e058f4cf6e660f2c9202847a15b25" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.30#1bd889c001b2a4735777160354cb57b8c17cf756" dependencies = [ "fc-db", "fp-consensus", @@ -2789,7 +2885,7 @@ dependencies = [ [[package]] name = "fc-rpc" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.30#ce45aff1903e058f4cf6e660f2c9202847a15b25" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.30#1bd889c001b2a4735777160354cb57b8c17cf756" dependencies = [ "ethereum", "ethereum-types", @@ -2832,7 +2928,7 @@ dependencies = [ [[package]] name = "fc-rpc-core" version = "1.1.0-dev" -source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.30#ce45aff1903e058f4cf6e660f2c9202847a15b25" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.30#1bd889c001b2a4735777160354cb57b8c17cf756" dependencies = [ "ethereum", "ethereum-types", @@ -2955,7 +3051,7 @@ dependencies = [ [[package]] name = "fp-consensus" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.30#ce45aff1903e058f4cf6e660f2c9202847a15b25" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.30#1bd889c001b2a4735777160354cb57b8c17cf756" dependencies = [ "ethereum", "parity-scale-codec", @@ -2967,7 +3063,7 @@ dependencies = [ [[package]] name = "fp-ethereum" version = "1.0.0-dev" -source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.30#ce45aff1903e058f4cf6e660f2c9202847a15b25" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.30#1bd889c001b2a4735777160354cb57b8c17cf756" dependencies = [ "ethereum", "ethereum-types", @@ -2982,7 +3078,7 @@ dependencies = [ [[package]] name = "fp-evm" version = "3.0.0-dev" -source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.30#ce45aff1903e058f4cf6e660f2c9202847a15b25" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.30#1bd889c001b2a4735777160354cb57b8c17cf756" dependencies = [ "evm", "frame-support", @@ -2995,7 +3091,7 @@ dependencies = [ [[package]] name = "fp-rpc" version = "3.0.0-dev" -source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.30#ce45aff1903e058f4cf6e660f2c9202847a15b25" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.30#1bd889c001b2a4735777160354cb57b8c17cf756" dependencies = [ "ethereum", "ethereum-types", @@ -3012,7 +3108,7 @@ dependencies = [ [[package]] name = "fp-self-contained" version = "1.0.0-dev" -source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.30#ce45aff1903e058f4cf6e660f2c9202847a15b25" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.30#1bd889c001b2a4735777160354cb57b8c17cf756" dependencies = [ "ethereum", "frame-support", @@ -3026,7 +3122,7 @@ dependencies = [ [[package]] name = "fp-storage" version = "2.0.0" -source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.30#ce45aff1903e058f4cf6e660f2c9202847a15b25" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.30#1bd889c001b2a4735777160354cb57b8c17cf756" dependencies = [ "parity-scale-codec", "serde", @@ -4716,7 +4812,7 @@ dependencies = [ "pin-project", "rand 0.8.5", "salsa20", - "sha3", + "sha3 0.10.6", ] [[package]] @@ -5199,6 +5295,16 @@ dependencies = [ "thrift", ] +[[package]] +name = "milagro_bls" +version = "1.5.0" +source = "git+https://github.com/darwinia-network/milagro_bls#076d5fb697b304534b26cb8b7fe488b9a7e70a99" +dependencies = [ + "amcl", + "rand 0.8.5", + "zeroize", +] + [[package]] name = "minimal-lexical" version = "0.2.1" @@ -5268,7 +5374,7 @@ dependencies = [ "digest 0.10.5", "multihash-derive", "sha2 0.10.6", - "sha3", + "sha3 0.10.6", "unsigned-varint", ] @@ -5789,7 +5895,7 @@ dependencies = [ [[package]] name = "pallet-base-fee" version = "1.0.0" -source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.30#ce45aff1903e058f4cf6e660f2c9202847a15b25" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.30#1bd889c001b2a4735777160354cb57b8c17cf756" dependencies = [ "fp-evm", "frame-support", @@ -6067,7 +6173,7 @@ dependencies = [ [[package]] name = "pallet-ethereum" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.30#ce45aff1903e058f4cf6e660f2c9202847a15b25" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.30#1bd889c001b2a4735777160354cb57b8c17cf756" dependencies = [ "ethereum", "ethereum-types", @@ -6094,7 +6200,7 @@ dependencies = [ [[package]] name = "pallet-evm" version = "6.0.0-dev" -source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.30#ce45aff1903e058f4cf6e660f2c9202847a15b25" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.30#1bd889c001b2a4735777160354cb57b8c17cf756" dependencies = [ "environmental", "evm", @@ -6119,7 +6225,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-blake2" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.30#ce45aff1903e058f4cf6e660f2c9202847a15b25" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.30#1bd889c001b2a4735777160354cb57b8c17cf756" dependencies = [ "fp-evm", ] @@ -6127,17 +6233,27 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-bn128" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.30#ce45aff1903e058f4cf6e660f2c9202847a15b25" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.30#1bd889c001b2a4735777160354cb57b8c17cf756" dependencies = [ "fp-evm", "sp-core", "substrate-bn", ] +[[package]] +name = "pallet-evm-precompile-dispatch" +version = "2.0.0-dev" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.30#1bd889c001b2a4735777160354cb57b8c17cf756" +dependencies = [ + "fp-evm", + "frame-support", + "pallet-evm", +] + [[package]] name = "pallet-evm-precompile-modexp" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.30#ce45aff1903e058f4cf6e660f2c9202847a15b25" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.30#1bd889c001b2a4735777160354cb57b8c17cf756" dependencies = [ "fp-evm", "num", @@ -6146,7 +6262,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-simple" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.30#ce45aff1903e058f4cf6e660f2c9202847a15b25" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.30#1bd889c001b2a4735777160354cb57b8c17cf756" dependencies = [ "fp-evm", "ripemd", @@ -8255,6 +8371,46 @@ version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" +[[package]] +name = "precompile-utils" +version = "0.1.0" +source = "git+https://github.com/darwinia-network/moonbeam.git?branch=polkadot-v0.9.30#38c37cc41b9a97482292717aec58b305d5f627f4" +dependencies = [ + "affix", + "evm", + "fp-evm", + "frame-support", + "frame-system", + "hex", + "impl-trait-for-tuples", + "log", + "num_enum", + "pallet-evm", + "parity-scale-codec", + "paste", + "precompile-utils-macro", + "sha3 0.9.1", + "similar-asserts", + "sp-core", + "sp-io", + "sp-std", + "xcm", +] + +[[package]] +name = "precompile-utils-macro" +version = "0.1.0" +source = "git+https://github.com/darwinia-network/moonbeam.git?branch=polkadot-v0.9.30#38c37cc41b9a97482292717aec58b305d5f627f4" +dependencies = [ + "case", + "num_enum", + "prettyplease", + "proc-macro2", + "quote", + "sha3 0.8.2", + "syn", +] + [[package]] name = "prettyplease" version = "0.1.21" @@ -10430,6 +10586,31 @@ dependencies = [ "digest 0.10.5", ] +[[package]] +name = "sha3" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd26bc0e7a2e3a7c959bc494caf58b72ee0c71d67704e9520f736ca7e4853ecf" +dependencies = [ + "block-buffer 0.7.3", + "byte-tools", + "digest 0.8.1", + "keccak", + "opaque-debug 0.2.3", +] + +[[package]] +name = "sha3" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f81199417d4e5de3f04b1e871023acea7389672c4135918f05aa9cbf2f2fa809" +dependencies = [ + "block-buffer 0.9.0", + "digest 0.9.0", + "keccak", + "opaque-debug 0.3.0", +] + [[package]] name = "sha3" version = "0.10.6" @@ -10496,6 +10677,26 @@ dependencies = [ "paste", ] +[[package]] +name = "similar" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "420acb44afdae038210c99e69aae24109f32f15500aa708e81d46c9f29d55fcf" +dependencies = [ + "bstr", + "unicode-segmentation", +] + +[[package]] +name = "similar-asserts" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbf644ad016b75129f01a34a355dcb8d66a5bc803e417c7a77cc5d5ee9fa0f18" +dependencies = [ + "console", + "similar", +] + [[package]] name = "slab" version = "0.4.7" @@ -10842,7 +11043,7 @@ dependencies = [ "byteorder", "digest 0.10.5", "sha2 0.10.6", - "sha3", + "sha3 0.10.6", "sp-std", "twox-hash", ] @@ -11648,6 +11849,16 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "terminal_size" +version = "0.1.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "633c1a546cee861a1a6d0dc69ebeca693bf4296661ba7852b9d21d159e0506df" +dependencies = [ + "libc", + "winapi", +] + [[package]] name = "textwrap" version = "0.16.0" @@ -12088,7 +12299,7 @@ version = "1.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" dependencies = [ - "cfg-if 1.0.0", + "cfg-if 0.1.10", "digest 0.10.5", "rand 0.8.5", "static_assertions", @@ -12148,6 +12359,12 @@ dependencies = [ "tinyvec", ] +[[package]] +name = "unicode-segmentation" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fdbf052a0783de01e944a6ce7a8cb939e295b1e7be835a1112c3b9a7f047a5a" + [[package]] name = "unicode-width" version = "0.1.10" diff --git a/Cargo.toml b/Cargo.toml index 696505b18..52ec33ac4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,4 +6,5 @@ members = [ "core/*", "node", "runtime/*", + "precompiles/*" ] diff --git a/precompiles/bls12-381/Cargo.toml b/precompiles/bls12-381/Cargo.toml new file mode 100644 index 000000000..9c0ad018d --- /dev/null +++ b/precompiles/bls12-381/Cargo.toml @@ -0,0 +1,50 @@ +[package] +authors = ["Darwinia Network "] +description = "State storage precompiles for EVM pallet." +edition = "2021" +homepage = "https://darwinia.network" +license = "GPL-3.0" +name = "darwinia-precompile-bls12-381" +readme = "README.md" +repository = "https://github.com/darwinia-network/darwinia" +version = "6.0.0" + +[dependencies] +# crates.io +milagro_bls = { default-features = false, git = "https://github.com/darwinia-network/milagro_bls" } +# frontier +fp-evm = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +pallet-evm = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +# moonbeam +precompile-utils = {default-features = false, git = "https://github.com/darwinia-network/moonbeam.git", branch = "polkadot-v0.9.30" } +# paritytech +frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } + +[dev-dependencies] +# crates.io +codec = { package = "parity-scale-codec", version = "3.2" } +scale-info = { version = "2.3", features = ["derive"] } +# moonbeam +precompile-utils = { git = "https://github.com/darwinia-network/moonbeam.git", branch = "polkadot-v0.9.30", features = [ "testing" ] } +# paritytech +frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } + +[features] +default = ["std"] + +std = [ + # frontier + "fp-evm/std", + "pallet-evm/std", + # moonbeam + "precompile-utils/std", + # paritytech + # "frame-support/std", + "sp-std/std" +] \ No newline at end of file diff --git a/precompiles/bls12-381/src/lib.rs b/precompiles/bls12-381/src/lib.rs new file mode 100644 index 000000000..79eebe79e --- /dev/null +++ b/precompiles/bls12-381/src/lib.rs @@ -0,0 +1,60 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +#![cfg_attr(not(feature = "std"), no_std)] + +// std +use core::marker::PhantomData; +// crates.io +use milagro_bls::{AggregatePublicKey, AggregateSignature, PublicKey, Signature}; +// moonbeam +use precompile_utils::prelude::*; +// substrate +use sp_std::vec::Vec; + +pub(crate) const VERIFY_ESTIMATED_COST: u64 = 100_000; + +pub struct BLS12381(PhantomData); + +#[precompile_utils::precompile] +impl BLS12381 { + #[precompile::public("fast_aggregate_verify(bytes[],bytes,bytes)")] + #[precompile::view] + fn state_storage_at( + handle: &mut impl PrecompileHandle, + pubkeys: Vec, + message: UnboundedBytes, + signature: UnboundedBytes, + ) -> EvmResult { + handle.record_cost(VERIFY_ESTIMATED_COST)?; + + let sig = + Signature::from_bytes(signature.as_bytes()).map_err(|_| revert("Invalid signature"))?; + let agg_sig = AggregateSignature::from_signature(&sig); + + let public_keys: Result, _> = + pubkeys.into_iter().map(|k| PublicKey::from_bytes(k.as_bytes())).collect(); + let Ok(keys) = public_keys else { + return Err(revert("Invalid pubkeys")); + }; + + let agg_pub_key = + AggregatePublicKey::into_aggregate(&keys).map_err(|_| revert("Invalid aggregate"))?; + Ok(agg_sig.fast_aggregate_verify_pre_aggregated(message.as_bytes(), &agg_pub_key)) + } +} diff --git a/precompiles/state-storage/Cargo.toml b/precompiles/state-storage/Cargo.toml new file mode 100644 index 000000000..9552d8018 --- /dev/null +++ b/precompiles/state-storage/Cargo.toml @@ -0,0 +1,48 @@ +[package] +authors = ["Darwinia Network "] +description = "State storage precompiles for EVM pallet." +edition = "2021" +homepage = "https://darwinia.network" +license = "GPL-3.0" +name = "darwinia-precompile-state-storage" +readme = "README.md" +repository = "https://github.com/darwinia-network/darwinia" +version = "6.0.0" + +[dependencies] +# frontier +fp-evm = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +pallet-evm = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +# moonbeam +precompile-utils = {default-features = false, git = "https://github.com/darwinia-network/moonbeam.git", branch = "polkadot-v0.9.30" } +# paritytech +frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } + +[dev-dependencies] +# crates.io +codec = { package = "parity-scale-codec", version = "3.2" } +scale-info = { version = "2.3", features = ["derive"] } +# moonbeam +precompile-utils = { git = "https://github.com/darwinia-network/moonbeam.git", branch = "polkadot-v0.9.30", features = [ "testing" ] } +# paritytech +frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } + +[features] +default = ["std"] + +std = [ + # frontier + "fp-evm/std", + "pallet-evm/std", + # moonbeam + "precompile-utils/std", + # paritytech + # "frame-support/std", + "sp-std/std" +] diff --git a/precompiles/state-storage/src/lib.rs b/precompiles/state-storage/src/lib.rs new file mode 100644 index 000000000..1e0ccf7e1 --- /dev/null +++ b/precompiles/state-storage/src/lib.rs @@ -0,0 +1,72 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +#![cfg_attr(not(feature = "std"), no_std)] + +#[cfg(test)] +mod mock; +#[cfg(test)] +mod tests; + +// std +use core::marker::PhantomData; +// moonbeam +use precompile_utils::prelude::*; +// substrate +use frame_support::{StorageHasher, Twox128}; + +const PALLET_PREFIX_LENGTH: usize = 16; + +pub trait StorageFilterT { + fn allow(prefix: &[u8]) -> bool; +} + +pub struct StateStorage { + _marker: PhantomData<(Runtime, Filter)>, +} + +pub struct EthereumStorageFilter; +impl StorageFilterT for EthereumStorageFilter { + fn allow(prefix: &[u8]) -> bool { + prefix != Twox128::hash(b"EVM") && prefix != Twox128::hash(b"Ethereum") + } +} + +#[precompile_utils::precompile] +impl StateStorage +where + Runtime: pallet_evm::Config, + Filter: StorageFilterT, +{ + #[precompile::public("state_storage(bytes)")] + #[precompile::view] + fn state_storage_at( + handle: &mut impl PrecompileHandle, + key: UnboundedBytes, + ) -> EvmResult { + handle.record_cost(RuntimeHelper::::db_read_gas_cost())?; + + let bytes = key.as_bytes(); + if bytes.len() < PALLET_PREFIX_LENGTH || !Filter::allow(&bytes[0..PALLET_PREFIX_LENGTH]) { + return Err(revert("Read restriction")); + } + + let output = frame_support::storage::unhashed::get_raw(&bytes); + Ok(output.unwrap_or_default().as_slice().into()) + } +} diff --git a/precompiles/state-storage/src/mock.rs b/precompiles/state-storage/src/mock.rs new file mode 100644 index 000000000..df8fd8995 --- /dev/null +++ b/precompiles/state-storage/src/mock.rs @@ -0,0 +1,265 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Test utilities + +// crates.io +use codec::{Decode, Encode, MaxEncodedLen}; +// frontier +use fp_evm::{Precompile, PrecompileSet}; +use pallet_evm::AddressMapping; +// parity +use frame_support::{ + pallet_prelude::Weight, + traits::{ConstU32, Everything}, + StorageHasher, Twox128, +}; +use sp_core::{H160, H256, U256}; +use sp_runtime::{ + testing::Header, + traits::{BlakeTwo256, IdentityLookup}, + AccountId32, +}; +use sp_std::{marker::PhantomData, prelude::*}; +// darwinia +use crate::*; + +pub type Block = frame_system::mocking::MockBlock; +pub type Balance = u64; +pub type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; + +#[derive( + Eq, + PartialEq, + Ord, + PartialOrd, + Clone, + Encode, + Decode, + Debug, + MaxEncodedLen, + scale_info::TypeInfo, +)] +pub enum Account { + Alice, + Bob, + Charlie, + Bogus, + Precompile, +} + +impl Default for Account { + fn default() -> Self { + Self::Bogus + } +} + +impl Into for Account { + fn into(self) -> H160 { + match self { + Account::Alice => H160::repeat_byte(0xAA), + Account::Bob => H160::repeat_byte(0xBB), + Account::Charlie => H160::repeat_byte(0xCC), + Account::Bogus => H160::repeat_byte(0xDD), + Account::Precompile => H160::from_low_u64_be(1), + } + } +} + +frame_support::parameter_types! { + pub const BlockHashCount: u64 = 250; +} +impl frame_system::Config for TestRuntime { + type AccountData = pallet_balances::AccountData; + type AccountId = AccountId32; + type BaseCallFilter = Everything; + type BlockHashCount = (); + type BlockLength = (); + type BlockNumber = u64; + type BlockWeights = (); + type DbWeight = (); + type Hash = H256; + type Hashing = BlakeTwo256; + type Header = Header; + type Index = u64; + type Lookup = IdentityLookup; + type MaxConsumers = ConstU32<16>; + type OnKilledAccount = (); + type OnNewAccount = (); + type OnSetCode = (); + type PalletInfo = PalletInfo; + type RuntimeCall = RuntimeCall; + type RuntimeEvent = RuntimeEvent; + type RuntimeOrigin = RuntimeOrigin; + type SS58Prefix = (); + type SystemWeightInfo = (); + type Version = (); +} + +frame_support::parameter_types! { + pub const MaxLocks: u32 = 10; + pub const ExistentialDeposit: u64 = 0; +} +impl pallet_balances::Config for TestRuntime { + type AccountStore = System; + type Balance = Balance; + type DustRemoval = (); + type ExistentialDeposit = ExistentialDeposit; + type MaxLocks = MaxLocks; + type MaxReserves = (); + type ReserveIdentifier = [u8; 8]; + type RuntimeEvent = RuntimeEvent; + type WeightInfo = (); +} + +frame_support::parameter_types! { + pub const MinimumPeriod: u64 = 6000 / 2; +} +impl pallet_timestamp::Config for TestRuntime { + type MinimumPeriod = MinimumPeriod; + type Moment = u64; + type OnTimestampSet = (); + type WeightInfo = (); +} + +pub struct StorageFilter; +impl StorageFilterT for StorageFilter { + fn allow(prefix: &[u8]) -> bool { + prefix != Twox128::hash(b"EVM") + } +} + +pub struct TestPrecompiles(PhantomData); +impl TestPrecompiles +where + R: pallet_evm::Config, +{ + pub fn new() -> Self { + Self(Default::default()) + } + + pub fn used_addresses() -> [H160; 1] { + [addr(1)] + } +} +impl PrecompileSet for TestPrecompiles +where + StateStorage: Precompile, + R: pallet_evm::Config, +{ + fn execute(&self, handle: &mut impl PrecompileHandle) -> Option> { + match handle.code_address() { + a if a == addr(1) => Some(StateStorage::::execute(handle)), + _ => None, + } + } + + fn is_precompile(&self, address: H160) -> bool { + Self::used_addresses().contains(&address) + } +} +fn addr(a: u64) -> H160 { + H160::from_low_u64_be(a) +} + +pub struct HashedAddressMapping; +impl AddressMapping for HashedAddressMapping { + fn into_account_id(address: H160) -> AccountId32 { + let mut data = [0u8; 32]; + data[0..20].copy_from_slice(&address[..]); + AccountId32::from(Into::<[u8; 32]>::into(data)) + } +} + +frame_support::parameter_types! { + pub const TransactionByteFee: u64 = 1; + pub const ChainId: u64 = 42; + pub const BlockGasLimit: U256 = U256::MAX; + pub const WeightPerGas: Weight = Weight::from_ref_time(20_000); + pub PrecompilesValue: TestPrecompiles = TestPrecompiles::<_>::new(); +} + +pub type PCall = StateStorageCall; + +impl pallet_evm::Config for TestRuntime { + type AddressMapping = HashedAddressMapping; + type BlockGasLimit = BlockGasLimit; + type BlockHashMapping = pallet_evm::SubstrateBlockHashMapping; + type CallOrigin = pallet_evm::EnsureAddressRoot; + type ChainId = ChainId; + type Currency = Balances; + type FeeCalculator = (); + type FindAuthor = (); + type GasWeightMapping = pallet_evm::FixedGasWeightMapping; + type OnChargeTransaction = (); + type PrecompilesType = TestPrecompiles; + type PrecompilesValue = PrecompilesValue; + type Runner = pallet_evm::runner::stack::Runner; + type RuntimeEvent = RuntimeEvent; + type WeightPerGas = WeightPerGas; + type WithdrawOrigin = pallet_evm::EnsureAddressNever; +} + +frame_support::construct_runtime! { + pub enum TestRuntime where + Block = Block, + NodeBlock = Block, + UncheckedExtrinsic = UncheckedExtrinsic, + { + System: frame_system::{Pallet, Call, Config, Storage, Event}, + Timestamp: pallet_timestamp::{Pallet, Call, Storage}, + Balances: pallet_balances::{Pallet, Call, Storage, Config, Event}, + EVM: pallet_evm::{Pallet, Call, Storage, Config, Event}, + } +} + +#[derive(Default)] +pub(crate) struct ExtBuilder { + // endowed accounts with balances + balances: Vec<(AccountId32, Balance)>, +} + +impl ExtBuilder { + pub(crate) fn with_balances(mut self, balances: Vec<(H160, Balance)>) -> Self { + let balances = balances + .iter() + .map(|(account, amount)| { + ( + ::AddressMapping::into_account_id(*account), + *amount, + ) + }) + .collect(); + self.balances = balances; + self + } + + pub(crate) fn build(self) -> sp_io::TestExternalities { + let mut t = frame_system::GenesisConfig::default() + .build_storage::() + .expect("Frame system builds valid default genesis config"); + + pallet_balances::GenesisConfig:: { balances: self.balances } + .assimilate_storage(&mut t) + .expect("Pallet balances storage can be assimilated"); + + let mut ext = sp_io::TestExternalities::new(t); + ext.execute_with(|| System::set_block_number(1)); + ext + } +} diff --git a/precompiles/state-storage/src/tests.rs b/precompiles/state-storage/src/tests.rs new file mode 100644 index 000000000..b73a2b2a2 --- /dev/null +++ b/precompiles/state-storage/src/tests.rs @@ -0,0 +1,90 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::mock::{ + Account::{Alice, Precompile}, + ExtBuilder, PCall, PrecompilesValue, System, TestPrecompiles, TestRuntime, +}; +// moonbeam +use precompile_utils::{ + prelude::{RuntimeHelper, UnboundedBytes}, + testing::{PrecompileTesterExt, PrecompilesModifierTester}, + EvmDataWriter, +}; +// substrate +use frame_support::{StorageHasher, Twox128}; + +fn precompiles() -> TestPrecompiles { + PrecompilesValue::get() +} + +#[test] +fn selectors() { + assert!(PCall::state_storage_at_selectors().contains(&0x78943fb7)); +} + +#[test] +fn modifier() { + ExtBuilder::default().build().execute_with(|| { + let mut tester = PrecompilesModifierTester::new(PrecompilesValue::get(), Alice, Precompile); + tester.test_view_modifier(PCall::state_storage_at_selectors()); + }); +} + +#[test] +fn no_selector_exists_but_length_is_right() { + ExtBuilder::default().build().execute_with(|| { + precompiles() + .prepare_test(Alice, Precompile, vec![1u8, 2u8, 3u8, 4u8]) + .execute_reverts(|output| output == b"Unknown selector"); + }); +} + +#[test] +fn test_state_storage() { + ExtBuilder::default().with_balances(vec![(Alice.into(), 100)]).build().execute_with(|| { + System::set_block_number(5); + + let mut key = vec![0u8; 32]; + key[0..16].copy_from_slice(&Twox128::hash(b"System")); + key[16..32].copy_from_slice(&Twox128::hash(b"Number")); + + precompiles() + .prepare_test(Alice, Precompile, PCall::state_storage_at { key: key.into() }) + .expect_cost(RuntimeHelper::::db_read_gas_cost()) + .expect_no_logs() + .execute_returns( + EvmDataWriter::new().write(UnboundedBytes::from(&5u64.to_le_bytes())).build(), + ); + }); +} + +#[test] +fn test_storage_filter() { + ExtBuilder::default().with_balances(vec![(Alice.into(), 100)]).build().execute_with(|| { + let mut key = vec![0u8; 32]; + key[0..16].copy_from_slice(&Twox128::hash(b"EVM")); + key[16..32].copy_from_slice(&Twox128::hash(b"AccountCodes")); + + precompiles() + .prepare_test(Alice, Precompile, PCall::state_storage_at { key: key.into() }) + .expect_no_logs() + .execute_reverts(|output| output == b"Read restriction"); + }); +} diff --git a/runtime/darwinia/Cargo.toml b/runtime/darwinia/Cargo.toml index 4d1a3e711..da5cf00d8 100644 --- a/runtime/darwinia/Cargo.toml +++ b/runtime/darwinia/Cargo.toml @@ -35,8 +35,10 @@ parachain-info = { default-features = false, git = "https://git cumulus-pallet-session-benchmarking = { optional = true, default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } # darwinia -darwinia-common-runtime = { default-features = false, path = "../common" } -dc-primitives = { default-features = false, path = "../../core/primitives" } +darwinia-common-runtime = { default-features = false, path = "../common" } +darwinia-precompile-bls12-381 = { default-features = false, path = "../../precompiles/bls12-381" } +darwinia-precompile-state-storage = { default-features = false, path = "../../precompiles/state-storage" } +dc-primitives = { default-features = false, path = "../../core/primitives" } # darwinia-messages-substrate bp-message-dispatch = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } @@ -50,16 +52,18 @@ pallet-bridge-messages = { default-features = false, git = "https://github.com/d pallet-fee-market = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } # frontier -fp-evm = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } -fp-rpc = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } -fp-self-contained = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } -pallet-base-fee = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } -pallet-ethereum = { default-features = false, features = ["forbid-evm-reentrancy"], git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } -pallet-evm = { default-features = false, features = ["forbid-evm-reentrancy"], git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } -pallet-evm-precompile-blake2 = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } -pallet-evm-precompile-bn128 = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } -pallet-evm-precompile-modexp = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } -pallet-evm-precompile-simple = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +fp-evm = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +fp-rpc = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +fp-self-contained = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +pallet-base-fee = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +pallet-ethereum = { default-features = false, features = ["forbid-evm-reentrancy"], git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +pallet-evm = { default-features = false, features = ["forbid-evm-reentrancy"], git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +pallet-evm-precompile-blake2 = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +pallet-evm-precompile-bn128 = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +pallet-evm-precompile-dispatch = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +pallet-evm-precompile-modexp = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +pallet-evm-precompile-simple = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } + # polkadot pallet-xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" } @@ -122,6 +126,8 @@ std = [ # darwinia "darwinia-common-runtime/std", + "darwinia-precompile-bls12-381/std", + "darwinia-precompile-state-storage/std", "dc-primitives/std", # darwinia-messages-substrate @@ -144,6 +150,7 @@ std = [ "pallet-evm/std", "pallet-evm-precompile-blake2/std", "pallet-evm-precompile-bn128/std", + "pallet-evm-precompile-dispatch/std", "pallet-evm-precompile-modexp/std", "pallet-evm-precompile-simple/std", @@ -237,7 +244,9 @@ try-runtime = [ "parachain-info/try-runtime", # frontier + "pallet-base-fee/try-runtime", "pallet-ethereum/try-runtime", + "pallet-evm/try-runtime", # polkadot "pallet-xcm/try-runtime", diff --git a/runtime/darwinia/src/pallets/evm.rs b/runtime/darwinia/src/pallets/evm.rs index 1e5ade093..b1d73060b 100644 --- a/runtime/darwinia/src/pallets/evm.rs +++ b/runtime/darwinia/src/pallets/evm.rs @@ -18,6 +18,8 @@ // darwinia use crate::*; +use darwinia_precompile_bls12_381::BLS12381; +use darwinia_precompile_state_storage::{EthereumStorageFilter, StateStorage}; use dc_primitives::EVM_ADDR_PREFIX; // frontier use pallet_ethereum::EthereumBlockHashMapping; @@ -27,6 +29,7 @@ use pallet_evm::{ }; use pallet_evm_precompile_blake2::Blake2F; use pallet_evm_precompile_bn128::{Bn128Add, Bn128Mul, Bn128Pairing}; +use pallet_evm_precompile_dispatch::Dispatch; use pallet_evm_precompile_modexp::Modexp; use pallet_evm_precompile_simple::{ECRecover, Identity, Ripemd160, Sha256}; // substrate @@ -69,7 +72,6 @@ impl FeeCalculator for FixedGasPrice { (U256::from(GWEI), Weight::zero()) } } - pub struct ConcatAddressMapping; impl AddressMapping for ConcatAddressMapping where @@ -98,8 +100,21 @@ where Self(Default::default()) } - pub fn used_addresses() -> [H160; 9] { - [addr(1), addr(2), addr(3), addr(4), addr(5), addr(6), addr(7), addr(8), addr(9)] + pub fn used_addresses() -> [H160; 12] { + [ + addr(1), + addr(2), + addr(3), + addr(4), + addr(5), + addr(6), + addr(7), + addr(8), + addr(9), + addr(1024), + addr(1025), + addr(2048), + ] } } impl PrecompileSet for DarwiniaPrecompiles @@ -118,7 +133,12 @@ where a if a == addr(7) => Some(Bn128Mul::execute(handle)), a if a == addr(8) => Some(Bn128Pairing::execute(handle)), a if a == addr(9) => Some(Blake2F::execute(handle)), - // Non-Frontier specific nor Ethereum precompiles: + // Darwinia precompiles: 1024+ for stable precompiles. + a if a == addr(1024) => + Some(>::execute(handle)), + a if a == addr(1025) => Some(>::execute(handle)), + // Darwinia precompiles: 2048+ for experimental precompiles. + a if a == addr(2048) => Some(>::execute(handle)), _ => None, } } From c8416318763e98e684490c465a4384dc829a5848 Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Tue, 22 Nov 2022 14:43:01 +0800 Subject: [PATCH 013/189] Use `H160` as `AccountId` (#55) * Configure `H160` for runtime * Configure `H160` genesis Signed-off-by: Xavier Lau * Docs * Improve code * Add missing features * Format and enable missing features for #50 * Format * Fix evm config * Revert the rename Signed-off-by: Xavier Lau Co-authored-by: bear --- Cargo.lock | 166 +++++++++++++++++-- Cargo.toml | 2 +- core/primitives/Cargo.toml | 9 +- core/primitives/src/lib.rs | 7 +- node/Cargo.toml | 13 +- node/src/chain_spec.rs | 159 +++++++++--------- precompiles/bls12-381/Cargo.toml | 22 ++- precompiles/state-storage/Cargo.toml | 19 ++- precompiles/state-storage/src/lib.rs | 17 +- precompiles/state-storage/src/mock.rs | 34 +--- runtime/darwinia/Cargo.toml | 9 + runtime/darwinia/src/lib.rs | 38 ++++- runtime/darwinia/src/pallets/evm.rs | 31 ++-- runtime/darwinia/src/pallets/polkadot_xcm.rs | 15 +- runtime/darwinia/src/pallets/session.rs | 6 + runtime/darwinia/src/pallets/system.rs | 2 +- 16 files changed, 352 insertions(+), 197 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 58f41e74b..e599396fd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -12,6 +12,27 @@ dependencies = [ "regex", ] +[[package]] +name = "account" +version = "0.1.1" +source = "git+https://github.com/darwinia-network/moonbeam?branch=polkadot-v0.9.30#38c37cc41b9a97482292717aec58b305d5f627f4" +dependencies = [ + "blake2-rfc", + "hex", + "impl-serde", + "libsecp256k1 0.6.0", + "log", + "parity-scale-codec", + "scale-info", + "serde", + "sha3 0.9.1", + "sp-core", + "sp-io", + "sp-runtime", + "sp-runtime-interface", + "sp-std", +] + [[package]] name = "addr2line" version = "0.17.0" @@ -433,6 +454,12 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6107fe1be6682a68940da878d9e9f5e90ca5745b3dec9fd1bb393c8777d4f581" +[[package]] +name = "base64" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff" + [[package]] name = "base64" version = "0.13.1" @@ -2068,6 +2095,7 @@ dependencies = [ name = "darwinia" version = "6.0.0" dependencies = [ + "array-bytes", "clap", "cumulus-client-cli", "cumulus-client-collator", @@ -2265,6 +2293,7 @@ dependencies = [ "xcm", "xcm-builder", "xcm-executor", + "xcm-primitives", ] [[package]] @@ -2297,6 +2326,7 @@ dependencies = [ name = "dc-primitives" version = "6.0.0" dependencies = [ + "account", "sp-core", "sp-runtime", ] @@ -2899,7 +2929,7 @@ dependencies = [ "futures", "hex", "jsonrpsee", - "libsecp256k1", + "libsecp256k1 0.7.1", "log", "lru 0.8.1", "parity-scale-codec", @@ -4550,7 +4580,7 @@ dependencies = [ "futures-timer", "instant", "lazy_static", - "libsecp256k1", + "libsecp256k1 0.7.1", "log", "multiaddr", "multihash", @@ -4621,7 +4651,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "74b4b888cfbeb1f5551acd3aa1366e01bf88ede26cc3c4645d0d2d004d5ca7b0" dependencies = [ "asynchronous-codec", - "base64", + "base64 0.13.1", "byteorder", "bytes", "fnv", @@ -5002,6 +5032,25 @@ dependencies = [ "tikv-jemalloc-sys", ] +[[package]] +name = "libsecp256k1" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9d220bc1feda2ac231cb78c3d26f27676b8cf82c96971f7aeef3d0cf2797c73" +dependencies = [ + "arrayref", + "base64 0.12.3", + "digest 0.9.0", + "hmac-drbg", + "libsecp256k1-core 0.2.2", + "libsecp256k1-gen-ecmult 0.2.1", + "libsecp256k1-gen-genmult 0.2.1", + "rand 0.7.3", + "serde", + "sha2 0.9.9", + "typenum", +] + [[package]] name = "libsecp256k1" version = "0.7.1" @@ -5009,18 +5058,29 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95b09eff1b35ed3b33b877ced3a691fc7a481919c7e29c53c906226fcf55e2a1" dependencies = [ "arrayref", - "base64", + "base64 0.13.1", "digest 0.9.0", "hmac-drbg", - "libsecp256k1-core", - "libsecp256k1-gen-ecmult", - "libsecp256k1-gen-genmult", + "libsecp256k1-core 0.3.0", + "libsecp256k1-gen-ecmult 0.3.0", + "libsecp256k1-gen-genmult 0.3.0", "rand 0.8.5", "serde", "sha2 0.9.9", "typenum", ] +[[package]] +name = "libsecp256k1-core" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0f6ab710cec28cef759c5f18671a27dae2a5f952cdaaee1d8e2908cb2478a80" +dependencies = [ + "crunchy", + "digest 0.9.0", + "subtle", +] + [[package]] name = "libsecp256k1-core" version = "0.3.0" @@ -5032,13 +5092,31 @@ dependencies = [ "subtle", ] +[[package]] +name = "libsecp256k1-gen-ecmult" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccab96b584d38fac86a83f07e659f0deafd0253dc096dab5a36d53efe653c5c3" +dependencies = [ + "libsecp256k1-core 0.2.2", +] + [[package]] name = "libsecp256k1-gen-ecmult" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3038c808c55c87e8a172643a7d87187fc6c4174468159cb3090659d55bcb4809" dependencies = [ - "libsecp256k1-core", + "libsecp256k1-core 0.3.0", +] + +[[package]] +name = "libsecp256k1-gen-genmult" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67abfe149395e3aa1c48a2beb32b068e2334402df8181f818d3aee2b304c4f5d" +dependencies = [ + "libsecp256k1-core 0.2.2", ] [[package]] @@ -5047,7 +5125,7 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3db8d6ba2cec9eacc40e6e8ccc98931840301f1006e95647ceb2dd5c3aa06f7c" dependencies = [ - "libsecp256k1-core", + "libsecp256k1-core 0.3.0", ] [[package]] @@ -5771,6 +5849,36 @@ dependencies = [ "num-traits", ] +[[package]] +name = "orml-traits" +version = "0.4.1-dev" +source = "git+https://github.com/open-web3-stack/open-runtime-module-library?branch=polkadot-v0.9.30#ae13a54dbc1a654df0e2d5e9dc18582b62716365" +dependencies = [ + "frame-support", + "impl-trait-for-tuples", + "num-traits", + "orml-utilities", + "parity-scale-codec", + "scale-info", + "sp-io", + "sp-runtime", + "sp-std", + "xcm", +] + +[[package]] +name = "orml-utilities" +version = "0.4.1-dev" +source = "git+https://github.com/open-web3-stack/open-runtime-module-library?branch=polkadot-v0.9.30#ae13a54dbc1a654df0e2d5e9dc18582b62716365" +dependencies = [ + "frame-support", + "parity-scale-codec", + "scale-info", + "sp-io", + "sp-runtime", + "sp-std", +] + [[package]] name = "os_str_bytes" version = "6.4.0" @@ -8089,7 +8197,7 @@ dependencies = [ "frame-support", "frame-system", "impl-trait-for-tuples", - "libsecp256k1", + "libsecp256k1 0.7.1", "log", "pallet-authorship", "pallet-babe", @@ -8374,7 +8482,7 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "precompile-utils" version = "0.1.0" -source = "git+https://github.com/darwinia-network/moonbeam.git?branch=polkadot-v0.9.30#38c37cc41b9a97482292717aec58b305d5f627f4" +source = "git+https://github.com/darwinia-network/moonbeam?branch=polkadot-v0.9.30#38c37cc41b9a97482292717aec58b305d5f627f4" dependencies = [ "affix", "evm", @@ -8400,7 +8508,7 @@ dependencies = [ [[package]] name = "precompile-utils-macro" version = "0.1.0" -source = "git+https://github.com/darwinia-network/moonbeam.git?branch=polkadot-v0.9.30#38c37cc41b9a97482292717aec58b305d5f627f4" +source = "git+https://github.com/darwinia-network/moonbeam?branch=polkadot-v0.9.30#38c37cc41b9a97482292717aec58b305d5f627f4" dependencies = [ "case", "num_enum", @@ -9224,7 +9332,7 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0864aeff53f8c05aa08d86e5ef839d3dfcf07aeba2db32f12db0ef716e87bd55" dependencies = [ - "base64", + "base64 0.13.1", ] [[package]] @@ -10778,7 +10886,7 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41d1c5305e39e09653383c2c7244f2f78b3bcae37cf50c64cb4789c9f5096ec2" dependencies = [ - "base64", + "base64 0.13.1", "bytes", "flate2", "futures", @@ -11005,7 +11113,7 @@ dependencies = [ "hash256-std-hasher", "impl-serde", "lazy_static", - "libsecp256k1", + "libsecp256k1 0.7.1", "log", "merlin", "num-traits", @@ -11129,7 +11237,7 @@ dependencies = [ "bytes", "futures", "hash-db", - "libsecp256k1", + "libsecp256k1 0.7.1", "log", "parity-scale-codec", "parking_lot 0.12.1", @@ -12682,7 +12790,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bcd849399d17d2270141cfe47fa0d91ee52d5f8ea9b98cf7ddde0d53e5f79882" dependencies = [ "anyhow", - "base64", + "base64 0.13.1", "bincode", "directories-next", "file-per-thread-logger", @@ -13220,6 +13328,30 @@ dependencies = [ "xcm", ] +[[package]] +name = "xcm-primitives" +version = "0.1.0" +source = "git+https://github.com/darwinia-network/moonbeam?branch=polkadot-v0.9.30#38c37cc41b9a97482292717aec58b305d5f627f4" +dependencies = [ + "ethereum", + "ethereum-types", + "frame-support", + "frame-system", + "hex", + "log", + "orml-traits", + "parity-scale-codec", + "scale-info", + "serde", + "sha3 0.8.2", + "sp-io", + "sp-runtime", + "sp-std", + "xcm", + "xcm-builder", + "xcm-executor", +] + [[package]] name = "xcm-procedural" version = "0.9.30" diff --git a/Cargo.toml b/Cargo.toml index 52ec33ac4..17c5b7891 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,6 +5,6 @@ panic = "unwind" members = [ "core/*", "node", + "precompiles/*", "runtime/*", - "precompiles/*" ] diff --git a/core/primitives/Cargo.toml b/core/primitives/Cargo.toml index e080680fd..542d0b0d9 100644 --- a/core/primitives/Cargo.toml +++ b/core/primitives/Cargo.toml @@ -10,12 +10,19 @@ repository = "https://github.com/darwinia-network/darwinia" version = "6.0.0" [dependencies] -sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +# moonbeam +account = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.30" } +# substrate +sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } + [features] default = ["std"] std = [ + # moonbeam + "account/std", + # substrate "sp-core/std", "sp-runtime/std", ] diff --git a/core/primitives/src/lib.rs b/core/primitives/src/lib.rs index 8670ad098..411a8f719 100644 --- a/core/primitives/src/lib.rs +++ b/core/primitives/src/lib.rs @@ -28,7 +28,7 @@ #![deny(missing_docs)] /// Alias to 512-bit hash when used in the context of a transaction signature on the chain. -pub type Signature = sp_runtime::MultiSignature; +pub type Signature = account::EthereumSignature; /// Some way of identifying an account on the chain. /// We intentionally make it equivalent to the public key of our transaction signing scheme. @@ -50,7 +50,7 @@ pub type Hash = sp_core::H256; pub type BlockNumber = u32; /// The address format for describing accounts. -pub type Address = sp_runtime::MultiAddress; +pub type Address = AccountId; /// Hashing type pub type Hashing = sp_runtime::traits::BlakeTwo256; @@ -97,6 +97,3 @@ pub const MWEI: Balance = 1_000 * KWEI; pub const KWEI: Balance = 1_000 * WEI; /// 1 wei — 1 pub const WEI: Balance = 1; - -/// Darwinia EVM addresses specific prefix. -pub const EVM_ADDR_PREFIX: &[u8] = b"dvm:"; diff --git a/node/Cargo.toml b/node/Cargo.toml index b30e2a29c..97b1a66bf 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -14,12 +14,13 @@ substrate-build-script-utils = { git = "https://github.com/paritytech/substrate" [dependencies] # crates.io -clap = { version = "3.2", features = ["derive"] } -codec = { package = "parity-scale-codec", version = "3.2" } -futures = { version = "0.3" } -jsonrpsee = { version = "0.15", features = ["server"] } -log = { version = "0.4" } -serde = { version = "1.0", features = ["derive"] } +array-bytes = { version = "4.2" } +clap = { version = "3.2", features = ["derive"] } +codec = { package = "parity-scale-codec", version = "3.2" } +futures = { version = "0.3" } +jsonrpsee = { version = "0.15", features = ["server"] } +log = { version = "0.4" } +serde = { version = "1.0", features = ["derive"] } # cumulus cumulus-client-cli = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.30" } diff --git a/node/src/chain_spec.rs b/node/src/chain_spec.rs index c4195e3ad..3c4384aed 100644 --- a/node/src/chain_spec.rs +++ b/node/src/chain_spec.rs @@ -32,12 +32,28 @@ use fp_evm::GenesisAccount; // substrate use sc_chain_spec::{ChainSpecExtension, ChainSpecGroup}; use sc_service::ChainType; -use sp_core::{sr25519, Pair, Public, H160, U256}; -use sp_runtime::traits::{IdentifyAccount, Verify}; +use sp_core::{Pair, Public, H160}; /// Specialized `ChainSpec` for the normal parachain runtime. pub type ChainSpec = sc_service::GenericChainSpec; +// These are are testnet-only keys. +// address = "0x75a1807b6aff253070b96ed9e43c0c5c17c7e1d4" +// public-key = "0x036ae37e38766cd9be397dfd42486d8aeb46c30d4b0526d12dc9f5eb6a8e4c09f5" +// secret-seed = "0x63c24046f3b744c8cd8f74e91d9e3603577035f3119ac1389db0f461e591375d" +#[allow(unused)] +const COLLATOR_A: &str = "0x75a1807b6aff253070b96ed9e43c0c5c17c7e1d4"; +// address = "0x5f69def84585715b92d397b1e92d4bf26d48d6b7" +// public-key = "0x03f6230f7fd8bd24a3814753c5bdd0417d5e00149e15b4bac130887e925c6a53a0" +// secret-seed = "0xee92a5c93339cb59bdad8c088c1b3adbae7ec94110681d871ab3beb8ac6530b2" +#[allow(unused)] +const COLLATOR_B: &str = "0x5f69def84585715b92d397b1e92d4bf26d48d6b7"; +// address = "0xa4e3cf11462254ed4b7ce00079eb11ca2a8b5393" +// public-key = "0x0218893313cc713836d57c60daedd28ee0b0823a167469af37e16f970fdb5305ef" +// secret-seed = "0x68ade89c684eb715ad047d9a54f8a07457840194091622736d742503d148966a" +#[allow(unused)] +const COLLATOR_C: &str = "0xa4e3cf11462254ed4b7ce00079eb11ca2a8b5393"; + /// The default XCM version to set in genesis config. const SAFE_XCM_VERSION: u32 = xcm::prelude::XCM_VERSION; @@ -69,8 +85,6 @@ impl Extensions { } } -type AccountPublic = ::Signer; - /// Generate collator keys from seed. /// /// This function's return type must always match the session keys of the chain in tuple format. @@ -78,14 +92,6 @@ pub fn get_collator_keys_from_seed(seed: &str) -> AuraId { get_from_seed::(seed) } -/// Helper function to generate an account ID from seed -pub fn get_account_id_from_seed(seed: &str) -> AccountId -where - AccountPublic: From<::Public>, -{ - AccountPublic::from(get_from_seed::(seed)).into_account() -} - /// Generate the session keys from individual elements. /// /// The input must be a tuple of individual keys (a single arg for now since we have just one key). @@ -111,27 +117,19 @@ pub fn development_config() -> ChainSpec { // initial collators. vec![ ( - get_account_id_from_seed::("Alice"), + array_bytes::hex_n_into_unchecked(COLLATOR_A), + // Make `--alice` available for testnet. get_collator_keys_from_seed("Alice"), ), ( - get_account_id_from_seed::("Bob"), + array_bytes::hex_n_into_unchecked(COLLATOR_B), + // Make `--bob` available for testnet. get_collator_keys_from_seed("Bob"), ), ], vec![ - get_account_id_from_seed::("Alice"), - get_account_id_from_seed::("Bob"), - get_account_id_from_seed::("Charlie"), - get_account_id_from_seed::("Dave"), - get_account_id_from_seed::("Eve"), - get_account_id_from_seed::("Ferdie"), - get_account_id_from_seed::("Alice//stash"), - get_account_id_from_seed::("Bob//stash"), - get_account_id_from_seed::("Charlie//stash"), - get_account_id_from_seed::("Dave//stash"), - get_account_id_from_seed::("Eve//stash"), - get_account_id_from_seed::("Ferdie//stash"), + array_bytes::hex_n_into_unchecked(COLLATOR_A), + array_bytes::hex_n_into_unchecked(COLLATOR_B), ], 1000.into(), ) @@ -166,27 +164,19 @@ pub fn local_testnet_config() -> ChainSpec { // initial collators. vec![ ( - get_account_id_from_seed::("Alice"), + array_bytes::hex_n_into_unchecked(COLLATOR_A), + // Make `--alice` available for testnet. get_collator_keys_from_seed("Alice"), ), ( - get_account_id_from_seed::("Bob"), + array_bytes::hex_n_into_unchecked(COLLATOR_B), + // Make `--bob` available for testnet. get_collator_keys_from_seed("Bob"), ), ], vec![ - get_account_id_from_seed::("Alice"), - get_account_id_from_seed::("Bob"), - get_account_id_from_seed::("Charlie"), - get_account_id_from_seed::("Dave"), - get_account_id_from_seed::("Eve"), - get_account_id_from_seed::("Ferdie"), - get_account_id_from_seed::("Alice//stash"), - get_account_id_from_seed::("Bob//stash"), - get_account_id_from_seed::("Charlie//stash"), - get_account_id_from_seed::("Dave//stash"), - get_account_id_from_seed::("Eve//stash"), - get_account_id_from_seed::("Ferdie//stash"), + array_bytes::hex_n_into_unchecked(COLLATOR_A), + array_bytes::hex_n_into_unchecked(COLLATOR_B), ], 1000.into(), ) @@ -231,14 +221,16 @@ pub fn shell_config() -> ChainSpec { }, balances: Default::default(), parachain_info: darwinia_runtime::ParachainInfoConfig { parachain_id: 2046.into() }, + // TODO: update this before final release collator_selection: darwinia_runtime::CollatorSelectionConfig { - invulnerables: vec![get_account_id_from_seed::("Alice")], + invulnerables: vec![array_bytes::hex_n_into_unchecked(COLLATOR_A)], ..Default::default() }, + // TODO: update this before final release session: darwinia_runtime::SessionConfig { keys: vec![( - get_account_id_from_seed::("Alice"), - get_account_id_from_seed::("Alice"), + array_bytes::hex_n_into_unchecked(COLLATOR_A), + array_bytes::hex_n_into_unchecked(COLLATOR_A), session_keys(get_collator_keys_from_seed("Alice")), )], }, @@ -280,9 +272,7 @@ fn testnet_genesis( ) -> darwinia_runtime::GenesisConfig { darwinia_runtime::GenesisConfig { system: darwinia_runtime::SystemConfig { - code: darwinia_runtime::WASM_BINARY - .expect("WASM binary was not build, please build it!") - .to_vec(), + code: darwinia_runtime::WASM_BINARY.unwrap().to_vec(), }, balances: darwinia_runtime::BalancesConfig { balances: endowed_accounts.iter().cloned().map(|k| (k, 1 << 60)).collect(), @@ -298,7 +288,7 @@ fn testnet_genesis( .into_iter() .map(|(acc, aura)| { ( - acc.clone(), // account id + acc, // account id acc, // validator id session_keys(aura), // session keys ) @@ -316,43 +306,44 @@ fn testnet_genesis( ethereum: Default::default(), evm: EvmConfig { accounts: { - let mut map = BTreeMap::new(); - map.insert( - // Testing account. - H160::from_str("0x6be02d1d3665660d22ff9624b7be0551ee1ac91b") - .expect("internal `H160` is valid; qed"), - GenesisAccount { - balance: U256::from_str("0xffffffffffffffffffffffffffffffff") - .expect("internal `U256` is valid; qed"), - code: Default::default(), - nonce: Default::default(), - storage: Default::default(), - }, - ); - map.insert( - // Benchmarking account. - H160::from_str("1000000000000000000000000000000000000001") - .expect("internal `H160` is valid; qed"), - GenesisAccount { - nonce: U256::from(1), - balance: U256::from(1_000_000_000_000_000_000_000_000_u128), - storage: Default::default(), - code: vec![0x00], - }, - ); - - for precompile in DarwiniaPrecompiles::::used_addresses() { - map.insert( - precompile, - GenesisAccount { - nonce: Default::default(), - balance: Default::default(), - storage: Default::default(), - code: REVERT_BYTECODE.to_vec(), - }, - ); - } - map + BTreeMap::from_iter( + DarwiniaPrecompiles::::used_addresses() + .iter() + .map(|p| { + ( + p.to_owned(), + GenesisAccount { + nonce: Default::default(), + balance: Default::default(), + storage: Default::default(), + code: REVERT_BYTECODE.to_vec(), + }, + ) + }) + .chain([ + // Testing account. + ( + H160::from_str("0x6be02d1d3665660d22ff9624b7be0551ee1ac91b") + .unwrap(), + GenesisAccount { + balance: (10_000_000 * UNIT).into(), + code: Default::default(), + nonce: Default::default(), + storage: Default::default(), + }, + ), + // Benchmarking account. + ( + H160::from_str("1000000000000000000000000000000000000001").unwrap(), + GenesisAccount { + nonce: 1.into(), + balance: (10_000_000 * UNIT).into(), + storage: Default::default(), + code: vec![0x00], + }, + ), + ]), + ) }, }, base_fee: Default::default(), diff --git a/precompiles/bls12-381/Cargo.toml b/precompiles/bls12-381/Cargo.toml index 9c0ad018d..396855bfb 100644 --- a/precompiles/bls12-381/Cargo.toml +++ b/precompiles/bls12-381/Cargo.toml @@ -12,21 +12,26 @@ version = "6.0.0" [dependencies] # crates.io milagro_bls = { default-features = false, git = "https://github.com/darwinia-network/milagro_bls" } + # frontier fp-evm = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } pallet-evm = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } + # moonbeam -precompile-utils = {default-features = false, git = "https://github.com/darwinia-network/moonbeam.git", branch = "polkadot-v0.9.30" } +precompile-utils = { default-features = false, git = "https://github.com/darwinia-network/moonbeam.git", branch = "polkadot-v0.9.30" } + # paritytech frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } [dev-dependencies] # crates.io -codec = { package = "parity-scale-codec", version = "3.2" } -scale-info = { version = "2.3", features = ["derive"] } +codec = { package = "parity-scale-codec", version = "3.2" } +scale-info = { version = "2.3", features = ["derive"] } + # moonbeam -precompile-utils = { git = "https://github.com/darwinia-network/moonbeam.git", branch = "polkadot-v0.9.30", features = [ "testing" ] } +precompile-utils = { git = "https://github.com/darwinia-network/moonbeam.git", branch = "polkadot-v0.9.30", features = ["testing"] } + # paritytech frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } @@ -37,14 +42,15 @@ sp-runtime = { git = "https://github.com/paritytech/substrate", branch = " [features] default = ["std"] - std = [ # frontier "fp-evm/std", "pallet-evm/std", + # moonbeam "precompile-utils/std", + # paritytech - # "frame-support/std", - "sp-std/std" -] \ No newline at end of file + "frame-support/std", + "sp-std/std", +] diff --git a/precompiles/state-storage/Cargo.toml b/precompiles/state-storage/Cargo.toml index 9552d8018..edd52a2b8 100644 --- a/precompiles/state-storage/Cargo.toml +++ b/precompiles/state-storage/Cargo.toml @@ -13,18 +13,22 @@ version = "6.0.0" # frontier fp-evm = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } pallet-evm = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } + # moonbeam -precompile-utils = {default-features = false, git = "https://github.com/darwinia-network/moonbeam.git", branch = "polkadot-v0.9.30" } +precompile-utils = { default-features = false, git = "https://github.com/darwinia-network/moonbeam.git", branch = "polkadot-v0.9.30" } + # paritytech frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } [dev-dependencies] # crates.io -codec = { package = "parity-scale-codec", version = "3.2" } -scale-info = { version = "2.3", features = ["derive"] } +codec = { package = "parity-scale-codec", version = "3.2" } +scale-info = { version = "2.3", features = ["derive"] } + # moonbeam -precompile-utils = { git = "https://github.com/darwinia-network/moonbeam.git", branch = "polkadot-v0.9.30", features = [ "testing" ] } +precompile-utils = { git = "https://github.com/darwinia-network/moonbeam.git", branch = "polkadot-v0.9.30", features = ["testing"] } + # paritytech frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } @@ -35,14 +39,15 @@ sp-runtime = { git = "https://github.com/paritytech/substrate", branch = " [features] default = ["std"] - std = [ # frontier "fp-evm/std", "pallet-evm/std", + # moonbeam "precompile-utils/std", + # paritytech - # "frame-support/std", - "sp-std/std" + "frame-support/std", + "sp-std/std", ] diff --git a/precompiles/state-storage/src/lib.rs b/precompiles/state-storage/src/lib.rs index 1e0ccf7e1..22c564b5e 100644 --- a/precompiles/state-storage/src/lib.rs +++ b/precompiles/state-storage/src/lib.rs @@ -39,14 +39,6 @@ pub trait StorageFilterT { pub struct StateStorage { _marker: PhantomData<(Runtime, Filter)>, } - -pub struct EthereumStorageFilter; -impl StorageFilterT for EthereumStorageFilter { - fn allow(prefix: &[u8]) -> bool { - prefix != Twox128::hash(b"EVM") && prefix != Twox128::hash(b"Ethereum") - } -} - #[precompile_utils::precompile] impl StateStorage where @@ -66,7 +58,14 @@ where return Err(revert("Read restriction")); } - let output = frame_support::storage::unhashed::get_raw(&bytes); + let output = frame_support::storage::unhashed::get_raw(bytes); Ok(output.unwrap_or_default().as_slice().into()) } } + +pub struct EthereumStorageFilter; +impl StorageFilterT for EthereumStorageFilter { + fn allow(prefix: &[u8]) -> bool { + prefix != Twox128::hash(b"EVM") && prefix != Twox128::hash(b"Ethereum") + } +} diff --git a/precompiles/state-storage/src/mock.rs b/precompiles/state-storage/src/mock.rs index df8fd8995..cc8f2ad0f 100644 --- a/precompiles/state-storage/src/mock.rs +++ b/precompiles/state-storage/src/mock.rs @@ -22,7 +22,7 @@ use codec::{Decode, Encode, MaxEncodedLen}; // frontier use fp_evm::{Precompile, PrecompileSet}; -use pallet_evm::AddressMapping; +use pallet_evm::IdentityAddressMapping; // parity use frame_support::{ pallet_prelude::Weight, @@ -33,7 +33,6 @@ use sp_core::{H160, H256, U256}; use sp_runtime::{ testing::Header, traits::{BlakeTwo256, IdentityLookup}, - AccountId32, }; use sp_std::{marker::PhantomData, prelude::*}; // darwinia @@ -41,6 +40,7 @@ use crate::*; pub type Block = frame_system::mocking::MockBlock; pub type Balance = u64; +pub type AccountId = H160; pub type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; #[derive( @@ -86,7 +86,7 @@ frame_support::parameter_types! { } impl frame_system::Config for TestRuntime { type AccountData = pallet_balances::AccountData; - type AccountId = AccountId32; + type AccountId = AccountId; type BaseCallFilter = Everything; type BlockHashCount = (); type BlockLength = (); @@ -177,15 +177,6 @@ fn addr(a: u64) -> H160 { H160::from_low_u64_be(a) } -pub struct HashedAddressMapping; -impl AddressMapping for HashedAddressMapping { - fn into_account_id(address: H160) -> AccountId32 { - let mut data = [0u8; 32]; - data[0..20].copy_from_slice(&address[..]); - AccountId32::from(Into::<[u8; 32]>::into(data)) - } -} - frame_support::parameter_types! { pub const TransactionByteFee: u64 = 1; pub const ChainId: u64 = 42; @@ -197,10 +188,10 @@ frame_support::parameter_types! { pub type PCall = StateStorageCall; impl pallet_evm::Config for TestRuntime { - type AddressMapping = HashedAddressMapping; + type AddressMapping = IdentityAddressMapping; type BlockGasLimit = BlockGasLimit; type BlockHashMapping = pallet_evm::SubstrateBlockHashMapping; - type CallOrigin = pallet_evm::EnsureAddressRoot; + type CallOrigin = pallet_evm::EnsureAddressRoot; type ChainId = ChainId; type Currency = Balances; type FeeCalculator = (); @@ -212,7 +203,7 @@ impl pallet_evm::Config for TestRuntime { type Runner = pallet_evm::runner::stack::Runner; type RuntimeEvent = RuntimeEvent; type WeightPerGas = WeightPerGas; - type WithdrawOrigin = pallet_evm::EnsureAddressNever; + type WithdrawOrigin = pallet_evm::EnsureAddressNever; } frame_support::construct_runtime! { @@ -231,20 +222,11 @@ frame_support::construct_runtime! { #[derive(Default)] pub(crate) struct ExtBuilder { // endowed accounts with balances - balances: Vec<(AccountId32, Balance)>, + balances: Vec<(AccountId, Balance)>, } impl ExtBuilder { - pub(crate) fn with_balances(mut self, balances: Vec<(H160, Balance)>) -> Self { - let balances = balances - .iter() - .map(|(account, amount)| { - ( - ::AddressMapping::into_account_id(*account), - *amount, - ) - }) - .collect(); + pub(crate) fn with_balances(mut self, balances: Vec<(AccountId, Balance)>) -> Self { self.balances = balances; self } diff --git a/runtime/darwinia/Cargo.toml b/runtime/darwinia/Cargo.toml index da5cf00d8..f5bd2feac 100644 --- a/runtime/darwinia/Cargo.toml +++ b/runtime/darwinia/Cargo.toml @@ -65,6 +65,9 @@ pallet-evm-precompile-modexp = { default-features = false, git = "https://gith pallet-evm-precompile-simple = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +# moonbeam +xcm-primitives = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.30" } + # polkadot pallet-xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" } polkadot-parachain = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" } @@ -154,6 +157,9 @@ std = [ "pallet-evm-precompile-modexp/std", "pallet-evm-precompile-simple/std", + # moonbeam + "xcm-primitives/std", + # polkadot "pallet-xcm/std", "polkadot-parachain/std", @@ -215,6 +221,9 @@ runtime-benchmarks = [ "pallet-ethereum/runtime-benchmarks", "pallet-evm/runtime-benchmarks", + # moonbeam + "xcm-primitives/runtime-benchmarks", + # polkadot "pallet-xcm/runtime-benchmarks", "polkadot-parachain/runtime-benchmarks", diff --git a/runtime/darwinia/src/lib.rs b/runtime/darwinia/src/lib.rs index 5ae9ae430..3ae10d639 100644 --- a/runtime/darwinia/src/lib.rs +++ b/runtime/darwinia/src/lib.rs @@ -100,6 +100,38 @@ pub type Executive = frame_executive::Executive< AllPalletsWithSystem, >; +// TODO: move to impl.rs +pub struct DealWithFees(sp_std::marker::PhantomData); +impl frame_support::traits::OnUnbalanced> + for DealWithFees +where + R: pallet_balances::Config, /* R: pallet_balances::Config + pallet_treasury::Config, + * pallet_treasury::Pallet: + * OnUnbalanced>, */ +{ + // this seems to be called for substrate-based transactions + fn on_unbalanceds( + mut fees_then_tips: impl Iterator>, + ) { + if let Some(fees) = fees_then_tips.next() { + // for fees, 80% are burned, 20% to the treasury + // let (_, to_treasury) = fees.ration(80, 20); + // Balances pallet automatically burns dropped Negative Imbalances by decreasing + // total_supply accordingly + // as OnUnbalanced<_>>::on_unbalanced(to_treasury); + } + } + + // this is called from pallet_evm for Ethereum-based transactions + // (technically, it calls on_unbalanced, which calls this when non-zero) + fn on_nonzero_unbalanced(amount: pallet_balances::NegativeImbalance) { + // Balances pallet automatically burns dropped Negative Imbalances by decreasing + // total_supply accordingly + // let (_, to_treasury) = amount.ration(80, 20); + // as OnUnbalanced<_>>::on_unbalanced(to_treasury); + } +} + impl fp_self_contained::SelfContainedCall for RuntimeCall { type SignedInfo = H160; @@ -190,12 +222,6 @@ impl WeightToFeePolynomial for WeightToFee { } } -sp_runtime::impl_opaque_keys! { - pub struct SessionKeys { - pub aura: Aura, - } -} - /// Runtime version. #[sp_version::runtime_version] pub const VERSION: RuntimeVersion = RuntimeVersion { diff --git a/runtime/darwinia/src/pallets/evm.rs b/runtime/darwinia/src/pallets/evm.rs index b1d73060b..f90c3b082 100644 --- a/runtime/darwinia/src/pallets/evm.rs +++ b/runtime/darwinia/src/pallets/evm.rs @@ -20,12 +20,11 @@ use crate::*; use darwinia_precompile_bls12_381::BLS12381; use darwinia_precompile_state_storage::{EthereumStorageFilter, StateStorage}; -use dc_primitives::EVM_ADDR_PREFIX; // frontier use pallet_ethereum::EthereumBlockHashMapping; use pallet_evm::{ - AddressMapping, EnsureAddressTruncated, FeeCalculator, FixedGasWeightMapping, Precompile, - PrecompileHandle, PrecompileResult, PrecompileSet, + AddressMapping, EnsureAddressNever, EnsureAddressRoot, FeeCalculator, FixedGasWeightMapping, + Precompile, PrecompileHandle, PrecompileResult, PrecompileSet, }; use pallet_evm_precompile_blake2::Blake2F; use pallet_evm_precompile_bn128::{Bn128Add, Bn128Mul, Bn128Pairing}; @@ -72,21 +71,15 @@ impl FeeCalculator for FixedGasPrice { (U256::from(GWEI), Weight::zero()) } } -pub struct ConcatAddressMapping; -impl AddressMapping for ConcatAddressMapping + +// TODO: Integrate to the upstream repo +pub struct FromH160; +impl AddressMapping for FromH160 where - AccountId: From<[u8; 32]>, + T: From, { - fn into_account_id(address: H160) -> AccountId { - let check_sum = |account_id: &[u8; 32]| -> u8 { - account_id[1..31].iter().fold(account_id[0], |sum, &byte| sum ^ byte) - }; - - let mut raw_account = [0u8; 32]; - raw_account[0..4].copy_from_slice(EVM_ADDR_PREFIX); - raw_account[11..31].copy_from_slice(&address[..]); - raw_account[31] = check_sum(&raw_account); - raw_account.into() + fn into_account_id(address: H160) -> T { + address.into() } } @@ -149,10 +142,10 @@ where } impl pallet_evm::Config for Runtime { - type AddressMapping = ConcatAddressMapping; + type AddressMapping = FromH160; type BlockGasLimit = BlockGasLimit; type BlockHashMapping = EthereumBlockHashMapping; - type CallOrigin = EnsureAddressTruncated; + type CallOrigin = EnsureAddressRoot; type ChainId = ChainId; type Currency = Balances; type FeeCalculator = FixedGasPrice; @@ -164,7 +157,7 @@ impl pallet_evm::Config for Runtime { type Runner = pallet_evm::runner::stack::Runner; type RuntimeEvent = RuntimeEvent; type WeightPerGas = WeightPerGas; - type WithdrawOrigin = EnsureAddressTruncated; + type WithdrawOrigin = EnsureAddressNever; } fn addr(a: u64) -> H160 { diff --git a/runtime/darwinia/src/pallets/polkadot_xcm.rs b/runtime/darwinia/src/pallets/polkadot_xcm.rs index 93cccefb5..8fdb7b611 100644 --- a/runtime/darwinia/src/pallets/polkadot_xcm.rs +++ b/runtime/darwinia/src/pallets/polkadot_xcm.rs @@ -19,10 +19,11 @@ // darwinia use crate::*; use darwinia_common_runtime::xcm_barrier::*; +// moonbeam +use xcm_primitives::*; // polkadot use pallet_xcm::XcmPassthrough; use polkadot_parachain::primitives::Sibling; -use polkadot_runtime_common::impls::ToAuthor; use xcm::latest::prelude::*; use xcm_builder::*; use xcm_executor::XcmExecutor; @@ -55,8 +56,8 @@ pub type LocationToAccountId = ( ParentIsPreset, // Sibling parachain origins convert to AccountId via the `ParaId::into`. SiblingParachainConvertsVia, - // Straight up local `AccountId32` origins just alias directly to `AccountId`. - AccountId32Aliases, + // Straight up local `AccountId20` origins just alias directly to `AccountId`. + AccountKey20Aliases, ); /// This is the type we use to convert an (incoming) XCM origin into a local `Origin` instance, /// ready for dispatching a transaction with Xcm's `Transact`. There is an `OriginKind` which can @@ -74,7 +75,7 @@ pub type XcmOriginToTransactDispatchOrigin = ( SiblingParachainAsNative, // Native signed account converter; this just converts an `AccountId32` origin into a normal // `RuntimeOrigin::Signed` origin of the same 32-byte value. - SignedAccountId32AsNative, + SignedAccountKey20AsNative, // Xcm origins can be represented natively under the Xcm pallet's Xcm origin. XcmPassthrough, ); @@ -117,18 +118,18 @@ impl xcm_executor::Config for XcmConfig { type RuntimeCall = RuntimeCall; type SubscriptionService = PolkadotXcm; type Trader = - UsingComponents>; + UsingComponents>; type Weigher = FixedWeightBounds; type XcmSender = XcmRouter; } /// No local origins on this chain are allowed to dispatch XCM sends/executions. -pub type LocalOriginToLocation = SignedToAccountId32; +pub type LocalOriginToLocation = SignedToAccountId20; /// The means for routing XCM messages which are not for local execution into the right message /// queues. pub type XcmRouter = ( // Two routers - use UMP to communicate with the relay chain: - cumulus_primitives_utility::ParentAsUmp, + cumulus_primitives_utility::ParentAsUmp, // ..and XCMP to communicate with the sibling chains. XcmpQueue, ); diff --git a/runtime/darwinia/src/pallets/session.rs b/runtime/darwinia/src/pallets/session.rs index 2ec09faa7..81f96d7a8 100644 --- a/runtime/darwinia/src/pallets/session.rs +++ b/runtime/darwinia/src/pallets/session.rs @@ -19,6 +19,12 @@ // darwinia use crate::*; +sp_runtime::impl_opaque_keys! { + pub struct SessionKeys { + pub aura: Aura, + } +} + frame_support::parameter_types! { pub const Period: u32 = 6 * HOURS; pub const Offset: u32 = 0; diff --git a/runtime/darwinia/src/pallets/system.rs b/runtime/darwinia/src/pallets/system.rs index 66958fff3..ccdfd2c16 100644 --- a/runtime/darwinia/src/pallets/system.rs +++ b/runtime/darwinia/src/pallets/system.rs @@ -83,7 +83,7 @@ impl frame_system::Config for Runtime { /// The index type for storing how many extrinsics an account has signed. type Index = Index; /// The lookup mechanism to get account ID from whatever is passed in dispatchers. - type Lookup = sp_runtime::traits::AccountIdLookup; + type Lookup = sp_runtime::traits::IdentityLookup; type MaxConsumers = frame_support::traits::ConstU32<16>; /// What to do if an account is fully reaped from the system. type OnKilledAccount = (); From 86e289985af40f395536812721b74deca62b3a46 Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Tue, 22 Nov 2022 15:41:53 +0800 Subject: [PATCH 014/189] Testnet preparation (#57) * More testing tokens * Update runtime version * Correct name --- node/src/chain_spec.rs | 2 +- runtime/darwinia/src/lib.rs | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/node/src/chain_spec.rs b/node/src/chain_spec.rs index 3c4384aed..98ca7ebee 100644 --- a/node/src/chain_spec.rs +++ b/node/src/chain_spec.rs @@ -275,7 +275,7 @@ fn testnet_genesis( code: darwinia_runtime::WASM_BINARY.unwrap().to_vec(), }, balances: darwinia_runtime::BalancesConfig { - balances: endowed_accounts.iter().cloned().map(|k| (k, 1 << 60)).collect(), + balances: endowed_accounts.iter().cloned().map(|k| (k, 100_000_000 * UNIT)).collect(), }, parachain_info: darwinia_runtime::ParachainInfoConfig { parachain_id: id }, collator_selection: darwinia_runtime::CollatorSelectionConfig { diff --git a/runtime/darwinia/src/lib.rs b/runtime/darwinia/src/lib.rs index 3ae10d639..5cb582220 100644 --- a/runtime/darwinia/src/lib.rs +++ b/runtime/darwinia/src/lib.rs @@ -225,14 +225,14 @@ impl WeightToFeePolynomial for WeightToFee { /// Runtime version. #[sp_version::runtime_version] pub const VERSION: RuntimeVersion = RuntimeVersion { - spec_name: sp_runtime::create_runtime_str!("Darwinia"), - impl_name: sp_runtime::create_runtime_str!("Darwinia"), - authoring_version: 1, - spec_version: 1, + spec_name: sp_runtime::create_runtime_str!("Darwinia2"), + impl_name: sp_runtime::create_runtime_str!("DarwiniaOfficialRust"), + authoring_version: 0, + spec_version: 6_0_0_0, impl_version: 0, apis: RUNTIME_API_VERSIONS, - transaction_version: 1, - state_version: 1, + transaction_version: 0, + state_version: 0, }; /// The existential deposit. From 15d93e0626da4c3bafb0bcea7d4d6e4f91ff8b23 Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Wed, 23 Nov 2022 13:31:19 +0800 Subject: [PATCH 015/189] Adjust genesis accounts (#59) * Adjust genesis accounts * Docs * Typo --- node/src/chain_spec.rs | 69 +++++++++++++++++++++--------------------- 1 file changed, 34 insertions(+), 35 deletions(-) diff --git a/node/src/chain_spec.rs b/node/src/chain_spec.rs index 98ca7ebee..d3a97fde4 100644 --- a/node/src/chain_spec.rs +++ b/node/src/chain_spec.rs @@ -37,31 +37,22 @@ use sp_core::{Pair, Public, H160}; /// Specialized `ChainSpec` for the normal parachain runtime. pub type ChainSpec = sc_service::GenericChainSpec; -// These are are testnet-only keys. -// address = "0x75a1807b6aff253070b96ed9e43c0c5c17c7e1d4" -// public-key = "0x036ae37e38766cd9be397dfd42486d8aeb46c30d4b0526d12dc9f5eb6a8e4c09f5" -// secret-seed = "0x63c24046f3b744c8cd8f74e91d9e3603577035f3119ac1389db0f461e591375d" -#[allow(unused)] -const COLLATOR_A: &str = "0x75a1807b6aff253070b96ed9e43c0c5c17c7e1d4"; -// address = "0x5f69def84585715b92d397b1e92d4bf26d48d6b7" -// public-key = "0x03f6230f7fd8bd24a3814753c5bdd0417d5e00149e15b4bac130887e925c6a53a0" -// secret-seed = "0xee92a5c93339cb59bdad8c088c1b3adbae7ec94110681d871ab3beb8ac6530b2" -#[allow(unused)] -const COLLATOR_B: &str = "0x5f69def84585715b92d397b1e92d4bf26d48d6b7"; -// address = "0xa4e3cf11462254ed4b7ce00079eb11ca2a8b5393" -// public-key = "0x0218893313cc713836d57c60daedd28ee0b0823a167469af37e16f970fdb5305ef" -// secret-seed = "0x68ade89c684eb715ad047d9a54f8a07457840194091622736d742503d148966a" -#[allow(unused)] -const COLLATOR_C: &str = "0xa4e3cf11462254ed4b7ce00079eb11ca2a8b5393"; - -/// The default XCM version to set in genesis config. -const SAFE_XCM_VERSION: u32 = xcm::prelude::XCM_VERSION; - /// This is the simplest bytecode to revert without returning any data. /// We will pre-deploy it under all of our precompiles to ensure they can be called from within /// contracts. (PUSH1 0x00 PUSH1 0x00 REVERT) pub const REVERT_BYTECODE: [u8; 5] = [0x60, 0x00, 0x60, 0x00, 0xFD]; +// These are are testnet-only keys. +const ALITH: &str = "0xf24FF3a9CF04c71Dbc94D0b566f7A27B94566cac"; +const BALTATHAR: &str = "0x3Cd0A705a2DC65e5b1E1205896BaA2be8A07c6e0"; +const CHARLETH: &str = "0x798d4Ba9baf0064Ec19eB4F0a1a45785ae9D6DFc"; +const DOROTHY: &str = "0x773539d4Ac0e786233D90A233654ccEE26a613D9"; +const ETHAN: &str = "0xFf64d3F6efE2317EE2807d223a0Bdc4c0c49dfDB"; +const FAITH: &str = "0xC0F0f4ab324C46e55D02D0033343B4Be8A55532d"; + +/// The default XCM version to set in genesis config. +const SAFE_XCM_VERSION: u32 = xcm::prelude::XCM_VERSION; + /// Helper function to generate a crypto pair from seed pub fn get_from_seed(seed: &str) -> ::Public { TPublic::Pair::from_string(&format!("//{}", seed), None) @@ -116,20 +107,24 @@ pub fn development_config() -> ChainSpec { testnet_genesis( // initial collators. vec![ + // Bind the `Alice` to `Alith` to make `--alice` available for testnet. ( - array_bytes::hex_n_into_unchecked(COLLATOR_A), - // Make `--alice` available for testnet. + array_bytes::hex_n_into_unchecked(ALITH), get_collator_keys_from_seed("Alice"), ), + // Bind the `Bob` to `Balthar` to make `--bob` available for testnet. ( - array_bytes::hex_n_into_unchecked(COLLATOR_B), - // Make `--bob` available for testnet. + array_bytes::hex_n_into_unchecked(BALTATHAR), get_collator_keys_from_seed("Bob"), ), ], vec![ - array_bytes::hex_n_into_unchecked(COLLATOR_A), - array_bytes::hex_n_into_unchecked(COLLATOR_B), + array_bytes::hex_n_into_unchecked(ALITH), + array_bytes::hex_n_into_unchecked(BALTATHAR), + array_bytes::hex_n_into_unchecked(CHARLETH), + array_bytes::hex_n_into_unchecked(DOROTHY), + array_bytes::hex_n_into_unchecked(ETHAN), + array_bytes::hex_n_into_unchecked(FAITH), ], 1000.into(), ) @@ -163,20 +158,24 @@ pub fn local_testnet_config() -> ChainSpec { testnet_genesis( // initial collators. vec![ + // Bind the `Alice` to `Alith` to make `--alice` available for testnet. ( - array_bytes::hex_n_into_unchecked(COLLATOR_A), - // Make `--alice` available for testnet. + array_bytes::hex_n_into_unchecked(ALITH), get_collator_keys_from_seed("Alice"), ), + // Bind the `Bob` to `Balthar` to make `--bob` available for testnet. ( - array_bytes::hex_n_into_unchecked(COLLATOR_B), - // Make `--bob` available for testnet. + array_bytes::hex_n_into_unchecked(BALTATHAR), get_collator_keys_from_seed("Bob"), ), ], vec![ - array_bytes::hex_n_into_unchecked(COLLATOR_A), - array_bytes::hex_n_into_unchecked(COLLATOR_B), + array_bytes::hex_n_into_unchecked(ALITH), + array_bytes::hex_n_into_unchecked(BALTATHAR), + array_bytes::hex_n_into_unchecked(CHARLETH), + array_bytes::hex_n_into_unchecked(DOROTHY), + array_bytes::hex_n_into_unchecked(ETHAN), + array_bytes::hex_n_into_unchecked(FAITH), ], 1000.into(), ) @@ -223,14 +222,14 @@ pub fn shell_config() -> ChainSpec { parachain_info: darwinia_runtime::ParachainInfoConfig { parachain_id: 2046.into() }, // TODO: update this before final release collator_selection: darwinia_runtime::CollatorSelectionConfig { - invulnerables: vec![array_bytes::hex_n_into_unchecked(COLLATOR_A)], + invulnerables: vec![array_bytes::hex_n_into_unchecked(ALITH)], ..Default::default() }, // TODO: update this before final release session: darwinia_runtime::SessionConfig { keys: vec![( - array_bytes::hex_n_into_unchecked(COLLATOR_A), - array_bytes::hex_n_into_unchecked(COLLATOR_A), + array_bytes::hex_n_into_unchecked(ALITH), + array_bytes::hex_n_into_unchecked(ALITH), session_keys(get_collator_keys_from_seed("Alice")), )], }, From 3571868c5071f7b385e2b80e7fa89dcb326417b2 Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Wed, 23 Nov 2022 18:01:54 +0800 Subject: [PATCH 016/189] Adjust runtime and add pallets (#60) * Adjust runtime and add sudo * Adjust parameter types and add vesting * Fix compile * Add utility * Add collective, elections-phragmen, identity and treasury * Add preimage and scheduler * Add democracy and membership * Add multisig and proxy * License * License * Set balances's index to 5 * Code cleaning --- Cargo.lock | 17 +++ node/src/chain_spec.rs | 55 +++++++- runtime/common/Cargo.toml | 14 +- runtime/common/src/gov_origin.rs | 41 ++++++ runtime/common/src/lib.rs | 1 + runtime/darwinia/Cargo.toml | 60 ++++++++- runtime/darwinia/src/lib.rs | 122 +++++++++++------- runtime/darwinia/src/pallets/aura.rs | 2 +- runtime/darwinia/src/pallets/authorship.rs | 6 +- runtime/darwinia/src/pallets/balances.rs | 14 +- runtime/darwinia/src/pallets/collective.rs | 50 +++++++ runtime/darwinia/src/pallets/democracy.rs | 64 +++++++++ .../src/pallets/elections_phragmen.rs | 49 +++++++ runtime/darwinia/src/pallets/evm.rs | 3 +- runtime/darwinia/src/pallets/identity.rs | 39 ++++++ runtime/darwinia/src/pallets/membership.rs | 33 +++++ runtime/darwinia/src/pallets/mod.rs | 81 ++++++++---- runtime/darwinia/src/pallets/multisig.rs | 32 +++++ runtime/darwinia/src/pallets/preimage.rs | 30 +++++ runtime/darwinia/src/pallets/proxy.rs | 86 ++++++++++++ runtime/darwinia/src/pallets/scheduler.rs | 64 +++++++++ runtime/darwinia/src/pallets/session.rs | 1 - runtime/darwinia/src/pallets/sudo.rs | 25 ++++ runtime/darwinia/src/pallets/system.rs | 6 +- runtime/darwinia/src/pallets/timestamp.rs | 6 +- runtime/darwinia/src/pallets/tips.rs | 35 +++++ .../src/pallets/transaction_payment.rs | 11 +- runtime/darwinia/src/pallets/treasury.rs | 47 +++++++ runtime/darwinia/src/pallets/utility.rs | 27 ++++ runtime/darwinia/src/pallets/vesting.rs | 32 +++++ 30 files changed, 933 insertions(+), 120 deletions(-) create mode 100644 runtime/common/src/gov_origin.rs create mode 100644 runtime/darwinia/src/pallets/collective.rs create mode 100644 runtime/darwinia/src/pallets/democracy.rs create mode 100644 runtime/darwinia/src/pallets/elections_phragmen.rs create mode 100644 runtime/darwinia/src/pallets/identity.rs create mode 100644 runtime/darwinia/src/pallets/membership.rs create mode 100644 runtime/darwinia/src/pallets/multisig.rs create mode 100644 runtime/darwinia/src/pallets/preimage.rs create mode 100644 runtime/darwinia/src/pallets/proxy.rs create mode 100644 runtime/darwinia/src/pallets/scheduler.rs create mode 100644 runtime/darwinia/src/pallets/sudo.rs create mode 100644 runtime/darwinia/src/pallets/tips.rs create mode 100644 runtime/darwinia/src/pallets/treasury.rs create mode 100644 runtime/darwinia/src/pallets/utility.rs create mode 100644 runtime/darwinia/src/pallets/vesting.rs diff --git a/Cargo.lock b/Cargo.lock index e599396fd..aa48d8383 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2172,7 +2172,10 @@ dependencies = [ name = "darwinia-common-runtime" version = "6.0.0" dependencies = [ + "dc-primitives", "frame-support", + "frame-system", + "pallet-collective", "xcm", "xcm-executor", ] @@ -2257,6 +2260,9 @@ dependencies = [ "pallet-bridge-grandpa", "pallet-bridge-messages", "pallet-collator-selection", + "pallet-collective", + "pallet-democracy", + "pallet-elections-phragmen", "pallet-ethereum", "pallet-evm", "pallet-evm-precompile-blake2", @@ -2265,11 +2271,21 @@ dependencies = [ "pallet-evm-precompile-modexp", "pallet-evm-precompile-simple", "pallet-fee-market", + "pallet-identity", + "pallet-membership", + "pallet-multisig", + "pallet-preimage", + "pallet-proxy", + "pallet-scheduler", "pallet-session", "pallet-sudo", "pallet-timestamp", + "pallet-tips", "pallet-transaction-payment", "pallet-transaction-payment-rpc-runtime-api", + "pallet-treasury", + "pallet-utility", + "pallet-vesting", "pallet-xcm", "parachain-info", "parity-scale-codec", @@ -2289,6 +2305,7 @@ dependencies = [ "sp-std", "sp-transaction-pool", "sp-version", + "static_assertions", "substrate-wasm-builder", "xcm", "xcm-builder", diff --git a/node/src/chain_spec.rs b/node/src/chain_spec.rs index d3a97fde4..35adac52e 100644 --- a/node/src/chain_spec.rs +++ b/node/src/chain_spec.rs @@ -205,6 +205,7 @@ pub fn shell_config() -> ChainSpec { properties.insert("tokenDecimals".into(), 18.into()); properties.insert("ss58Format".into(), 18.into()); + // TODO: update this before final release ChainSpec::from_genesis( // Name "Darwinia", @@ -213,19 +214,24 @@ pub fn shell_config() -> ChainSpec { ChainType::Live, move || { darwinia_runtime::GenesisConfig { + // System stuff. system: darwinia_runtime::SystemConfig { code: darwinia_runtime::WASM_BINARY .expect("WASM binary was not build, please build it!") .to_vec(), }, - balances: Default::default(), + parachain_system: Default::default(), parachain_info: darwinia_runtime::ParachainInfoConfig { parachain_id: 2046.into() }, - // TODO: update this before final release + + // Monetary stuff. + balances: Default::default(), + transaction_payment: Default::default(), + + // Consensus stuff. collator_selection: darwinia_runtime::CollatorSelectionConfig { invulnerables: vec![array_bytes::hex_n_into_unchecked(ALITH)], ..Default::default() }, - // TODO: update this before final release session: darwinia_runtime::SessionConfig { keys: vec![( array_bytes::hex_n_into_unchecked(ALITH), @@ -237,10 +243,25 @@ pub fn shell_config() -> ChainSpec { // take care of this. aura: Default::default(), aura_ext: Default::default(), - parachain_system: Default::default(), + + // Governance stuff. + democracy: Default::default(), + council: Default::default(), + technical_committee: Default::default(), + phragmen_election: Default::default(), + technical_membership: Default::default(), + treasury: Default::default(), + + // Utility stuff. + sudo: Default::default(), + vesting: Default::default(), + + // XCM stuff. polkadot_xcm: darwinia_runtime::PolkadotXcmConfig { safe_xcm_version: Some(SAFE_XCM_VERSION), }, + + // EVM stuff. ethereum: Default::default(), evm: Default::default(), base_fee: Default::default(), @@ -270,13 +291,20 @@ fn testnet_genesis( id: ParaId, ) -> darwinia_runtime::GenesisConfig { darwinia_runtime::GenesisConfig { + // System stuff. system: darwinia_runtime::SystemConfig { code: darwinia_runtime::WASM_BINARY.unwrap().to_vec(), }, + parachain_system: Default::default(), + parachain_info: darwinia_runtime::ParachainInfoConfig { parachain_id: id }, + + // Monetary stuff. balances: darwinia_runtime::BalancesConfig { balances: endowed_accounts.iter().cloned().map(|k| (k, 100_000_000 * UNIT)).collect(), }, - parachain_info: darwinia_runtime::ParachainInfoConfig { parachain_id: id }, + transaction_payment: Default::default(), + + // Consensus stuff. collator_selection: darwinia_runtime::CollatorSelectionConfig { invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(), candidacy_bond: UNIT, @@ -298,10 +326,25 @@ fn testnet_genesis( // of this. aura: Default::default(), aura_ext: Default::default(), - parachain_system: Default::default(), + + // Governance stuff. + democracy: Default::default(), + council: Default::default(), + technical_committee: Default::default(), + phragmen_election: Default::default(), + technical_membership: Default::default(), + treasury: Default::default(), + + // Utility stuff. + sudo: Default::default(), + vesting: Default::default(), + + // XCM stuff. polkadot_xcm: darwinia_runtime::PolkadotXcmConfig { safe_xcm_version: Some(SAFE_XCM_VERSION), }, + + // EVM stuff. ethereum: Default::default(), evm: EvmConfig { accounts: { diff --git a/runtime/common/Cargo.toml b/runtime/common/Cargo.toml index 7dfcf0437..3f22addc0 100644 --- a/runtime/common/Cargo.toml +++ b/runtime/common/Cargo.toml @@ -10,18 +10,30 @@ repository = "https://github.com/darwinia-network/darwinia" version = "6.0.0" [dependencies] +# darwinia +dc-primitives = { default-features = false, path = "../../core/primitives" } + # polkadot xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" } xcm-executor = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" } + # substrate -frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-collective = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } [features] default = ["std"] std = [ + # darwinia + "dc-primitives/std", + # polkadot "xcm/std", "xcm-executor/std", + # substrate "frame-support/std", + "frame-system/std", + "pallet-collective/std", ] diff --git a/runtime/common/src/gov_origin.rs b/runtime/common/src/gov_origin.rs new file mode 100644 index 000000000..814c1e921 --- /dev/null +++ b/runtime/common/src/gov_origin.rs @@ -0,0 +1,41 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// paritytech +use frame_support::traits::EitherOfDiverse; +use frame_system::EnsureRoot; +use pallet_collective::{EnsureProportionAtLeast, EnsureProportionMoreThan}; +// darwinia +use dc_primitives::AccountId; + +pub type Root = EnsureRoot; + +pub type RootOrAtLeastHalf = + EitherOfDiverse>; + +pub type RootOrMoreThanHalf = + EitherOfDiverse>; + +pub type RootOrAtLeastTwoThird = + EitherOfDiverse>; + +pub type RootOrAtLeastThreeFifth = + EitherOfDiverse>; + +pub type RootOrAll = + EitherOfDiverse>; diff --git a/runtime/common/src/lib.rs b/runtime/common/src/lib.rs index 94bf9ed80..1b95b603d 100644 --- a/runtime/common/src/lib.rs +++ b/runtime/common/src/lib.rs @@ -18,4 +18,5 @@ #![cfg_attr(not(feature = "std"), no_std)] +pub mod gov_origin; pub mod xcm_barrier; diff --git a/runtime/darwinia/Cargo.toml b/runtime/darwinia/Cargo.toml index f5bd2feac..14d83bcce 100644 --- a/runtime/darwinia/Cargo.toml +++ b/runtime/darwinia/Cargo.toml @@ -14,9 +14,10 @@ substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", bran [dependencies] # crates.io -codec = { package = "parity-scale-codec", version = "3.2", default-features = false, features = ["derive"] } -scale-info = { version = "2.3", default-features = false, features = ["derive"] } -smallvec = { version = "1.10" } +codec = { package = "parity-scale-codec", version = "3.2", default-features = false, features = ["derive"] } +scale-info = { version = "2.3", default-features = false, features = ["derive"] } +smallvec = { version = "1.10" } +static_assertions = { version = "1.1" } # crates.io optional array-bytes = { version = "4.1", optional = true } @@ -64,7 +65,6 @@ pallet-evm-precompile-dispatch = { default-features = false, git = "https://gith pallet-evm-precompile-modexp = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } pallet-evm-precompile-simple = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } - # moonbeam xcm-primitives = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.30" } @@ -84,11 +84,24 @@ frame-system-rpc-runtime-api = { default-features = false, git = " pallet-aura = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } pallet-authorship = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } pallet-balances = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-collective = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-democracy = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-elections-phragmen = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-identity = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-membership = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-multisig = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-preimage = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-proxy = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-scheduler = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } pallet-session = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } pallet-sudo = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } pallet-timestamp = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-tips = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } pallet-transaction-payment = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } pallet-transaction-payment-rpc-runtime-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-treasury = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-utility = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-vesting = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } sp-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } sp-block-builder = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } sp-consensus-aura = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } @@ -176,11 +189,24 @@ std = [ "pallet-aura/std", "pallet-authorship/std", "pallet-balances/std", + "pallet-collective/std", + "pallet-democracy/std", + "pallet-elections-phragmen/std", + "pallet-membership/std", + "pallet-identity/std", + "pallet-multisig/std", + "pallet-preimage/std", + "pallet-proxy/std", + "pallet-scheduler/std", "pallet-session/std", "pallet-sudo/std", "pallet-timestamp/std", + "pallet-tips/std", "pallet-transaction-payment-rpc-runtime-api/std", "pallet-transaction-payment/std", + "pallet-treasury/std", + "pallet-utility/std", + "pallet-vesting/std", "sp-api/std", "sp-block-builder/std", "sp-consensus-aura/std", @@ -235,7 +261,20 @@ runtime-benchmarks = [ "frame-support/runtime-benchmarks", "frame-system/runtime-benchmarks", "pallet-balances/runtime-benchmarks", + "pallet-collective/runtime-benchmarks", + "pallet-democracy/runtime-benchmarks", + "pallet-elections-phragmen/runtime-benchmarks", + "pallet-membership/runtime-benchmarks", + "pallet-identity/runtime-benchmarks", + "pallet-multisig/runtime-benchmarks", + "pallet-preimage/runtime-benchmarks", + "pallet-proxy/runtime-benchmarks", + "pallet-scheduler/runtime-benchmarks", "pallet-timestamp/runtime-benchmarks", + "pallet-tips/runtime-benchmarks", + "pallet-treasury/runtime-benchmarks", + "pallet-utility/runtime-benchmarks", + "pallet-vesting/runtime-benchmarks", "sp-runtime/runtime-benchmarks", # substrate optional "frame-benchmarking/runtime-benchmarks", @@ -268,10 +307,23 @@ try-runtime = [ "pallet-aura/try-runtime", "pallet-authorship/try-runtime", "pallet-balances/try-runtime", + "pallet-collective/try-runtime", + "pallet-democracy/try-runtime", + "pallet-elections-phragmen/try-runtime", + "pallet-membership/try-runtime", + "pallet-identity/try-runtime", + "pallet-multisig/try-runtime", + "pallet-preimage/try-runtime", + "pallet-proxy/try-runtime", + "pallet-scheduler/try-runtime", "pallet-session/try-runtime", "pallet-sudo/try-runtime", "pallet-timestamp/try-runtime", + "pallet-tips/try-runtime", "pallet-transaction-payment/try-runtime", + "pallet-treasury/try-runtime", + "pallet-utility/try-runtime", + "pallet-vesting/try-runtime", # substrate optional "frame-try-runtime", ] diff --git a/runtime/darwinia/src/lib.rs b/runtime/darwinia/src/lib.rs index 5cb582220..7534c1f23 100644 --- a/runtime/darwinia/src/lib.rs +++ b/runtime/darwinia/src/lib.rs @@ -31,8 +31,6 @@ mod weights; pub use sp_consensus_aura::sr25519::AuthorityId as AuraId; -// crates.io -use smallvec::smallvec; // cumulus use cumulus_pallet_parachain_system::RelayNumberStrictlyIncreases; // darwinia @@ -43,6 +41,7 @@ use xcm_executor::XcmExecutor; // substrate use frame_support::{ dispatch::DispatchClass, + traits::{Imbalance, OnUnbalanced}, weights::{ ConstantMultiplier, Weight, WeightToFeeCoefficient, WeightToFeeCoefficients, WeightToFeePolynomial, @@ -100,14 +99,38 @@ pub type Executive = frame_executive::Executive< AllPalletsWithSystem, >; +/// Darwinia proposal base fee. +pub const DARWINIA_PROPOSAL_REQUIREMENT: Balance = 5000 * UNIT; + +/// Runtime version. +#[sp_version::runtime_version] +pub const VERSION: RuntimeVersion = RuntimeVersion { + spec_name: sp_runtime::create_runtime_str!("Darwinia2"), + impl_name: sp_runtime::create_runtime_str!("DarwiniaOfficialRust"), + authoring_version: 0, + spec_version: 6_0_0_0, + impl_version: 0, + apis: RUNTIME_API_VERSIONS, + transaction_version: 0, + state_version: 0, +}; + +/// Deposit calculator for Darwinia. +/// 100 UNIT for the base fee, 102.4 UNIT/MB. +pub const fn darwinia_deposit(items: u32, bytes: u32) -> Balance { + // First try. + items as Balance * 100 * UNIT + (bytes as Balance) * 100 * MICROUNIT + // items as Balance * 100 * UNIT + (bytes as Balance) * 100 * MILLIUNIT +} + // TODO: move to impl.rs pub struct DealWithFees(sp_std::marker::PhantomData); impl frame_support::traits::OnUnbalanced> for DealWithFees where - R: pallet_balances::Config, /* R: pallet_balances::Config + pallet_treasury::Config, - * pallet_treasury::Pallet: - * OnUnbalanced>, */ + R: pallet_balances::Config, + R: pallet_balances::Config + pallet_treasury::Config, + pallet_treasury::Pallet: OnUnbalanced>, { // this seems to be called for substrate-based transactions fn on_unbalanceds( @@ -115,10 +138,11 @@ where ) { if let Some(fees) = fees_then_tips.next() { // for fees, 80% are burned, 20% to the treasury - // let (_, to_treasury) = fees.ration(80, 20); + let (_, to_treasury) = fees.ration(80, 20); + // Balances pallet automatically burns dropped Negative Imbalances by decreasing // total_supply accordingly - // as OnUnbalanced<_>>::on_unbalanced(to_treasury); + as OnUnbalanced<_>>::on_unbalanced(to_treasury); } } @@ -127,8 +151,9 @@ where fn on_nonzero_unbalanced(amount: pallet_balances::NegativeImbalance) { // Balances pallet automatically burns dropped Negative Imbalances by decreasing // total_supply accordingly - // let (_, to_treasury) = amount.ration(80, 20); - // as OnUnbalanced<_>>::on_unbalanced(to_treasury); + let (_, to_treasury) = amount.ration(80, 20); + + as OnUnbalanced<_>>::on_unbalanced(to_treasury); } } @@ -213,7 +238,7 @@ impl WeightToFeePolynomial for WeightToFee { // here, we map to 1/10 of that, or 1/10 MILLIUNIT let p = MILLIUNIT / 10; let q = 100 * Balance::from(weights::ExtrinsicBaseWeight::get().ref_time()); - smallvec![WeightToFeeCoefficient { + smallvec::smallvec![WeightToFeeCoefficient { degree: 1, negative: false, coeff_frac: Perbill::from_rational(p % q, q), @@ -222,22 +247,6 @@ impl WeightToFeePolynomial for WeightToFee { } } -/// Runtime version. -#[sp_version::runtime_version] -pub const VERSION: RuntimeVersion = RuntimeVersion { - spec_name: sp_runtime::create_runtime_str!("Darwinia2"), - impl_name: sp_runtime::create_runtime_str!("DarwiniaOfficialRust"), - authoring_version: 0, - spec_version: 6_0_0_0, - impl_version: 0, - apis: RUNTIME_API_VERSIONS, - transaction_version: 0, - state_version: 0, -}; - -/// The existential deposit. -pub const EXISTENTIAL_DEPOSIT: Balance = 0; - /// The version information used to identify this runtime when compiled natively. #[cfg(feature = "std")] pub fn native_version() -> NativeVersion { @@ -252,34 +261,53 @@ frame_support::construct_runtime! { UncheckedExtrinsic = UncheckedExtrinsic, { // System stuff. - System: frame_system::{Pallet, Call, Config, Storage, Event} = 0, - ParachainSystem: cumulus_pallet_parachain_system::{ - Pallet, Call, Config, Storage, Inherent, Event, ValidateUnsigned, - } = 1, - Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent} = 2, - ParachainInfo: parachain_info::{Pallet, Storage, Config} = 3, + System: frame_system = 0, + ParachainSystem: cumulus_pallet_parachain_system = 1, + Timestamp: pallet_timestamp = 2, + ParachainInfo: parachain_info = 3, // Monetary stuff. - Balances: pallet_balances::{Pallet, Call, Storage, Config, Event} = 4, - TransactionPayment: pallet_transaction_payment::{Pallet, Storage, Event} = 5, + // Leave 4 here. + // To keep balances consistent with the existing XCM configurations. + Balances: pallet_balances = 5, + TransactionPayment: pallet_transaction_payment = 6, // Consensus stuff. - Authorship: pallet_authorship::{Pallet, Call, Storage} = 6, - CollatorSelection: pallet_collator_selection::{Pallet, Call, Storage, Event, Config} = 7, - Session: pallet_session::{Pallet, Call, Storage, Event, Config} = 8, - Aura: pallet_aura::{Pallet, Storage, Config} = 9, - AuraExt: cumulus_pallet_aura_ext::{Pallet, Storage, Config} = 10, + Authorship: pallet_authorship = 7, + CollatorSelection: pallet_collator_selection = 8, + Session: pallet_session = 9, + Aura: pallet_aura = 10, + AuraExt: cumulus_pallet_aura_ext = 11, + + // Governance stuff. + Democracy: pallet_democracy = 12, + Council: pallet_collective:: = 13, + TechnicalCommittee: pallet_collective:: = 14, + PhragmenElection: pallet_elections_phragmen = 15, + TechnicalMembership: pallet_membership:: = 16, + Treasury: pallet_treasury = 17, + Tips: pallet_tips = 18, + + // Utility stuff. + Sudo: pallet_sudo = 19, + Vesting: pallet_vesting = 20, + Utility: pallet_utility = 21, + Identity: pallet_identity = 22, + Scheduler: pallet_scheduler = 23, + Preimage: pallet_preimage = 24, + Proxy: pallet_proxy = 25, + Multisig: pallet_multisig = 26, // XCM stuff. - XcmpQueue: cumulus_pallet_xcmp_queue::{Pallet, Call, Storage, Event} = 11, - PolkadotXcm: pallet_xcm::{Pallet, Call, Event, Origin, Config} = 12, - CumulusXcm: cumulus_pallet_xcm::{Pallet, Event, Origin} = 13, - DmpQueue: cumulus_pallet_dmp_queue::{Pallet, Call, Storage, Event} = 14, + XcmpQueue: cumulus_pallet_xcmp_queue = 27, + PolkadotXcm: pallet_xcm = 28, + CumulusXcm: cumulus_pallet_xcm = 29, + DmpQueue: cumulus_pallet_dmp_queue = 30, // EVM stuff. - Ethereum: pallet_ethereum::{Pallet, Call, Storage, Config, Event, Origin} = 15, - Evm: pallet_evm::{Pallet, Call, Storage, Config, Event} = 16, - BaseFee: pallet_base_fee::{Pallet, Call, Storage, Config, Event} = 17, + Ethereum: pallet_ethereum = 31, + Evm: pallet_evm = 32, + BaseFee: pallet_base_fee = 33, } } @@ -419,7 +447,7 @@ sp_api::impl_runtime_apis! { impl fp_rpc::EthereumRuntimeRPCApi for Runtime { fn chain_id() -> u64 { - ::ChainId::get() + <::ChainId as frame_support::traits::Get>::get() } fn account_basic(address: H160) -> pallet_evm::Account { diff --git a/runtime/darwinia/src/pallets/aura.rs b/runtime/darwinia/src/pallets/aura.rs index c45e11180..a185eb060 100644 --- a/runtime/darwinia/src/pallets/aura.rs +++ b/runtime/darwinia/src/pallets/aura.rs @@ -22,5 +22,5 @@ use crate::*; impl pallet_aura::Config for Runtime { type AuthorityId = AuraId; type DisabledValidators = (); - type MaxAuthorities = MaxAuthorities; + type MaxAuthorities = ConstU32<100_000>; } diff --git a/runtime/darwinia/src/pallets/authorship.rs b/runtime/darwinia/src/pallets/authorship.rs index 6b9c3be86..eb48e3bdb 100644 --- a/runtime/darwinia/src/pallets/authorship.rs +++ b/runtime/darwinia/src/pallets/authorship.rs @@ -19,13 +19,9 @@ // darwinia use crate::*; -frame_support::parameter_types! { - pub const UncleGenerations: u32 = 0; -} - impl pallet_authorship::Config for Runtime { type EventHandler = (CollatorSelection,); type FilterUncle = (); type FindAuthor = pallet_session::FindAccountFromAuthorIndex; - type UncleGenerations = UncleGenerations; + type UncleGenerations = ConstU32<0>; } diff --git a/runtime/darwinia/src/pallets/balances.rs b/runtime/darwinia/src/pallets/balances.rs index 1518b1c53..2dbd63977 100644 --- a/runtime/darwinia/src/pallets/balances.rs +++ b/runtime/darwinia/src/pallets/balances.rs @@ -19,22 +19,14 @@ // darwinia use crate::*; -frame_support::parameter_types! { - pub const ExistentialDeposit: Balance = EXISTENTIAL_DEPOSIT; - pub const MaxLocks: u32 = 50; - pub const MaxReserves: u32 = 50; -} - impl pallet_balances::Config for Runtime { type AccountStore = System; - /// The type for recording an account's balance. type Balance = Balance; type DustRemoval = (); - type ExistentialDeposit = ExistentialDeposit; - type MaxLocks = MaxLocks; - type MaxReserves = MaxReserves; + type ExistentialDeposit = ConstU128<0>; + type MaxLocks = ConstU32<50>; + type MaxReserves = ConstU32<50>; type ReserveIdentifier = [u8; 8]; - /// The ubiquitous event type. type RuntimeEvent = RuntimeEvent; type WeightInfo = weights::pallet_balances::WeightInfo; } diff --git a/runtime/darwinia/src/pallets/collective.rs b/runtime/darwinia/src/pallets/collective.rs new file mode 100644 index 000000000..6d4a215a7 --- /dev/null +++ b/runtime/darwinia/src/pallets/collective.rs @@ -0,0 +1,50 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +pub use pallet_collective::{Instance1 as CouncilCollective, Instance2 as TechnicalCollective}; + +// darwinia +use crate::*; + +pub const COLLECTIVE_DESIRED_MEMBERS: u32 = 7; +pub const COLLECTIVE_MAX_MEMBERS: u32 = 100; +pub const COLLECTIVE_MAX_PROPOSALS: u32 = 100; + +// Make sure that there are no more than `COLLECTIVE_MAX_MEMBERS` members elected via phragmen. +static_assertions::const_assert!(COLLECTIVE_DESIRED_MEMBERS <= COLLECTIVE_MAX_MEMBERS); + +impl pallet_collective::Config for Runtime { + type DefaultVote = pallet_collective::PrimeDefaultVote; + type MaxMembers = ConstU32; + type MaxProposals = ConstU32<100>; + type MotionDuration = ConstU32<{ 3 * DAYS }>; + type Proposal = RuntimeCall; + type RuntimeEvent = RuntimeEvent; + type RuntimeOrigin = RuntimeOrigin; + type WeightInfo = (); +} +impl pallet_collective::Config for Runtime { + type DefaultVote = pallet_collective::PrimeDefaultVote; + type MaxMembers = ConstU32; + type MaxProposals = ConstU32<100>; + type MotionDuration = ConstU32<{ 3 * DAYS }>; + type Proposal = RuntimeCall; + type RuntimeEvent = RuntimeEvent; + type RuntimeOrigin = RuntimeOrigin; + type WeightInfo = (); +} diff --git a/runtime/darwinia/src/pallets/democracy.rs b/runtime/darwinia/src/pallets/democracy.rs new file mode 100644 index 000000000..a54d9d4f4 --- /dev/null +++ b/runtime/darwinia/src/pallets/democracy.rs @@ -0,0 +1,64 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +const ENACTMENT_PERIOD: u32 = 28 * DAYS; + +impl pallet_democracy::Config for Runtime { + type BlacklistOrigin = Root; + // To cancel a proposal before it has been passed, the technical committee must be unanimous or + // Root must agree. + type CancelProposalOrigin = RootOrAll; + // To cancel a proposal which has been passed, 2/3 of the council must agree to it. + type CancellationOrigin = RootOrAtLeastTwoThird; + type CooloffPeriod = ConstU32<{ 7 * DAYS }>; + type Currency = Balances; + type EnactmentPeriod = ConstU32; + /// A unanimous council can have the next scheduled referendum be a straight default-carries + /// (NTB) vote. + type ExternalDefaultOrigin = RootOrAll; + /// A majority can have the next scheduled referendum be a straight majority-carries vote. + type ExternalMajorityOrigin = RootOrAtLeastHalf; + /// A straight majority of the council can decide what their next motion is. + type ExternalOrigin = RootOrAtLeastHalf; + /// Two thirds of the technical committee can have an ExternalMajority/ExternalDefault vote + /// be tabled immediately and with a shorter voting/enactment period. + type FastTrackOrigin = RootOrAtLeastTwoThird; + type FastTrackVotingPeriod = ConstU32<{ 3 * HOURS }>; + type InstantAllowed = ConstBool; + type InstantOrigin = RootOrAll; + type LaunchPeriod = ConstU32<{ 28 * DAYS }>; + type MaxProposals = ConstU32<100>; + type MaxVotes = ConstU32<100>; + type MinimumDeposit = ConstU128; + type OperationalPreimageOrigin = pallet_collective::EnsureMember; + type PalletsOrigin = OriginCaller; + type PreimageByteDeposit = ConstU128<{ darwinia_deposit(0, 1) }>; + type Proposal = RuntimeCall; + type RuntimeEvent = RuntimeEvent; + type Scheduler = Scheduler; + type Slash = Treasury; + // Any single technical committee member may veto a coming council proposal, however they can + // only do it once and it lasts only for the cool-off period. + type VetoOrigin = pallet_collective::EnsureMember; + type VoteLockingPeriod = ConstU32; + type VotingPeriod = ConstU32<{ 28 * DAYS }>; + type WeightInfo = (); +} diff --git a/runtime/darwinia/src/pallets/elections_phragmen.rs b/runtime/darwinia/src/pallets/elections_phragmen.rs new file mode 100644 index 000000000..f637a0b98 --- /dev/null +++ b/runtime/darwinia/src/pallets/elections_phragmen.rs @@ -0,0 +1,49 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +const MAX_CANDIDATES: u32 = 30; + +frame_support::parameter_types! { + pub const PhragmenElectionPalletId: frame_support::traits::LockIdentifier = *b"phrelect"; +} + +impl pallet_elections_phragmen::Config for Runtime { + type CandidacyBond = ConstU128<{ 100 * MILLIUNIT }>; + type ChangeMembers = Council; + type Currency = Balances; + type CurrencyToVote = frame_support::traits::U128CurrencyToVote; + type DesiredMembers = ConstU32; + type DesiredRunnersUp = ConstU32<7>; + type InitializeMembers = Council; + type KickedMember = Treasury; + type LoserCandidate = Treasury; + type MaxCandidates = ConstU32; + type MaxVoters = ConstU32<{ 10 * MAX_CANDIDATES }>; + type PalletId = PhragmenElectionPalletId; + type RuntimeEvent = RuntimeEvent; + // Daily council elections. + type TermDuration = ConstU32<{ 7 * DAYS }>; + // 1 storage item created, key size is 32 bytes, value size is 16+16. + type VotingBondBase = ConstU128<{ darwinia_deposit(1, 64) }>; + // Additional data per vote is 32 bytes (account id). + type VotingBondFactor = ConstU128<{ darwinia_deposit(0, 32) }>; + type WeightInfo = (); +} diff --git a/runtime/darwinia/src/pallets/evm.rs b/runtime/darwinia/src/pallets/evm.rs index f90c3b082..23a3c27bd 100644 --- a/runtime/darwinia/src/pallets/evm.rs +++ b/runtime/darwinia/src/pallets/evm.rs @@ -42,7 +42,6 @@ frame_support::parameter_types! { pub BlockGasLimit: U256 = U256::from(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT.ref_time() / WEIGHT_PER_GAS); pub PrecompilesValue: DarwiniaPrecompiles = DarwiniaPrecompiles::<_>::new(); pub WeightPerGas: Weight = Weight::from_ref_time(WEIGHT_PER_GAS); - pub const ChainId: u64 = 43; } pub struct FindAuthorTruncated(PhantomData); @@ -146,7 +145,7 @@ impl pallet_evm::Config for Runtime { type BlockGasLimit = BlockGasLimit; type BlockHashMapping = EthereumBlockHashMapping; type CallOrigin = EnsureAddressRoot; - type ChainId = ChainId; + type ChainId = ConstU64<43>; type Currency = Balances; type FeeCalculator = FixedGasPrice; type FindAuthor = FindAuthorTruncated; diff --git a/runtime/darwinia/src/pallets/identity.rs b/runtime/darwinia/src/pallets/identity.rs new file mode 100644 index 000000000..9dcbc049c --- /dev/null +++ b/runtime/darwinia/src/pallets/identity.rs @@ -0,0 +1,39 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +impl pallet_identity::Config for Runtime { + // Minimum 100 bytes/UNIT deposited (1 MILLIUNIT/byte). + // 258 bytes on-chain. + type BasicDeposit = ConstU128<{ darwinia_deposit(1, 258) }>; + type Currency = Balances; + type RuntimeEvent = RuntimeEvent; + // 66 bytes on-chain. + type FieldDeposit = ConstU128<{ darwinia_deposit(0, 66) }>; + type ForceOrigin = RootOrMoreThanHalf; + type MaxAdditionalFields = ConstU32<100>; + type MaxRegistrars = ConstU32<20>; + type MaxSubAccounts = ConstU32<100>; + type RegistrarOrigin = RootOrMoreThanHalf; + type Slashed = Treasury; + // 53 bytes on-chain. + type SubAccountDeposit = ConstU128<{ darwinia_deposit(1, 53) }>; + type WeightInfo = (); +} diff --git a/runtime/darwinia/src/pallets/membership.rs b/runtime/darwinia/src/pallets/membership.rs new file mode 100644 index 000000000..2e5c3e9dc --- /dev/null +++ b/runtime/darwinia/src/pallets/membership.rs @@ -0,0 +1,33 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +impl pallet_membership::Config for Runtime { + type AddOrigin = RootOrMoreThanHalf; + type MaxMembers = ConstU32; + type MembershipChanged = TechnicalCommittee; + type MembershipInitialized = TechnicalCommittee; + type PrimeOrigin = RootOrMoreThanHalf; + type RemoveOrigin = RootOrMoreThanHalf; + type ResetOrigin = RootOrMoreThanHalf; + type RuntimeEvent = RuntimeEvent; + type SwapOrigin = RootOrMoreThanHalf; + type WeightInfo = (); +} diff --git a/runtime/darwinia/src/pallets/mod.rs b/runtime/darwinia/src/pallets/mod.rs index 61551bda4..3df9e4ccb 100644 --- a/runtime/darwinia/src/pallets/mod.rs +++ b/runtime/darwinia/src/pallets/mod.rs @@ -16,53 +16,84 @@ // You should have received a copy of the GNU General Public License // along with Darwinia. If not, see . +mod shared_imports { + // darwinia + pub use darwinia_common_runtime::gov_origin::*; + // substrate + pub use sp_runtime::traits::{ConstBool, ConstU128, ConstU16, ConstU32, ConstU64, ConstU8}; +} +pub use shared_imports::*; + +// System stuffs. mod system; pub use system::*; +mod parachain_system; + mod timestamp; -pub use timestamp::*; -mod authorship; -pub use authorship::*; +mod parachain_info_; +// Monetary stuff. mod balances; -pub use balances::*; mod transaction_payment; -pub use transaction_payment::*; -mod parachain_system; -pub use parachain_system::*; +// Consensus stuff. +mod authorship; -mod parachain_info_; -pub use parachain_info_::*; +mod collator_selection; + +mod session; +pub use session::*; + +mod aura; mod aura_ext; -pub use aura_ext::*; -mod xcmp_queue; -pub use xcmp_queue::*; +// Governance stuff. +mod democracy; -mod dmp_queue; -pub use dmp_queue::*; +mod collective; +pub use collective::*; -mod session; -pub use session::*; +mod elections_phragmen; -mod aura; -pub use aura::*; +mod membership; -mod collator_selection; -pub use collator_selection::*; +mod treasury; +mod tips; + +// Utility stuff. +mod sudo; + +mod vesting; + +mod utility; + +mod identity; + +mod scheduler; + +mod preimage; + +mod proxy; + +mod multisig; + +// XCM stuff. +mod xcmp_queue; + +mod polkadot_xcm; +pub use polkadot_xcm::*; + +mod dmp_queue; + +// EVM stuff. mod ethereum; -pub use ethereum::*; mod evm; pub use evm::*; mod base_fee; -pub use base_fee::*; - -mod polkadot_xcm; -pub use polkadot_xcm::*; diff --git a/runtime/darwinia/src/pallets/multisig.rs b/runtime/darwinia/src/pallets/multisig.rs new file mode 100644 index 000000000..64e7d4023 --- /dev/null +++ b/runtime/darwinia/src/pallets/multisig.rs @@ -0,0 +1,32 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +impl pallet_multisig::Config for Runtime { + type Currency = Balances; + // One storage item; key size is 32; value is size 4+4+16+32 bytes = 56 bytes. + type DepositBase = ConstU128<{ darwinia_deposit(1, 88) }>; + // Additional storage item size of 32 bytes. + type DepositFactor = ConstU128<{ darwinia_deposit(0, 32) }>; + type RuntimeEvent = RuntimeEvent; + type MaxSignatories = ConstU16<100>; + type RuntimeCall = RuntimeCall; + type WeightInfo = (); +} diff --git a/runtime/darwinia/src/pallets/preimage.rs b/runtime/darwinia/src/pallets/preimage.rs new file mode 100644 index 000000000..69fff06fc --- /dev/null +++ b/runtime/darwinia/src/pallets/preimage.rs @@ -0,0 +1,30 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +impl pallet_preimage::Config for Runtime { + type BaseDeposit = ConstU128<{ 500 * UNIT }>; + type ByteDeposit = ConstU128<{ darwinia_deposit(0, 1) }>; + type Currency = Balances; + type ManagerOrigin = Root; + type MaxSize = ConstU32<{ 4096 * 1024 }>; + type RuntimeEvent = RuntimeEvent; + type WeightInfo = (); +} diff --git a/runtime/darwinia/src/pallets/proxy.rs b/runtime/darwinia/src/pallets/proxy.rs new file mode 100644 index 000000000..172ea4e89 --- /dev/null +++ b/runtime/darwinia/src/pallets/proxy.rs @@ -0,0 +1,86 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +/// The type used to represent the kinds of proxying allowed. +#[derive( + Copy, + Clone, + Eq, + PartialEq, + Ord, + PartialOrd, + codec::Encode, + codec::Decode, + codec::MaxEncodedLen, + scale_info::TypeInfo, + sp_runtime::RuntimeDebug, +)] +pub enum ProxyType { + Any, + NonTransfer, + Governance, + IdentityJudgement, + EthereumBridge, +} +impl Default for ProxyType { + fn default() -> Self { + Self::Any + } +} +impl frame_support::traits::InstanceFilter for ProxyType { + // TODO: configure filter + fn filter(&self, _c: &RuntimeCall) -> bool { + match self { + ProxyType::Any => true, + ProxyType::NonTransfer => true, + ProxyType::Governance => true, + ProxyType::IdentityJudgement => true, + ProxyType::EthereumBridge => true, + } + } + + fn is_superset(&self, o: &Self) -> bool { + match (self, o) { + (x, y) if x == y => true, + (ProxyType::Any, _) => true, + (_, ProxyType::Any) => false, + (ProxyType::NonTransfer, _) => true, + _ => false, + } + } +} + +impl pallet_proxy::Config for Runtime { + type AnnouncementDepositBase = ConstU128<{ darwinia_deposit(1, 8) }>; + type AnnouncementDepositFactor = ConstU128<{ darwinia_deposit(0, 66) }>; + type CallHasher = Hashing; + type Currency = Balances; + type MaxPending = ConstU32<32>; + type MaxProxies = ConstU32<32>; + // One storage item; key size 32, value size 8; . + type ProxyDepositBase = ConstU128<{ darwinia_deposit(1, 8) }>; + // Additional storage item size of 33 bytes. + type ProxyDepositFactor = ConstU128<{ darwinia_deposit(0, 33) }>; + type ProxyType = ProxyType; + type RuntimeCall = RuntimeCall; + type RuntimeEvent = RuntimeEvent; + type WeightInfo = (); +} diff --git a/runtime/darwinia/src/pallets/scheduler.rs b/runtime/darwinia/src/pallets/scheduler.rs new file mode 100644 index 000000000..17aded6e8 --- /dev/null +++ b/runtime/darwinia/src/pallets/scheduler.rs @@ -0,0 +1,64 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +/// Used the compare the privilege of an origin inside the scheduler. +pub struct OriginPrivilegeCmp; +impl frame_support::traits::PrivilegeCmp for OriginPrivilegeCmp { + fn cmp_privilege(left: &OriginCaller, right: &OriginCaller) -> Option { + if left == right { + return Some(core::cmp::Ordering::Equal); + } + + match (left, right) { + // Root is greater than anything. + (OriginCaller::system(frame_system::RawOrigin::Root), _) => + Some(core::cmp::Ordering::Greater), + // Check which one has more yes votes. + ( + OriginCaller::Council(pallet_collective::RawOrigin::Members(l_yes_votes, l_count)), + OriginCaller::Council(pallet_collective::RawOrigin::Members(r_yes_votes, r_count)), + ) => Some((l_yes_votes * r_count).cmp(&(r_yes_votes * l_count))), + // For every other origin we don't care, as they are not used for `ScheduleOrigin`. + _ => None, + } + } +} + +frame_support::parameter_types! { + pub MaximumSchedulerWeight: frame_support::weights::Weight = sp_runtime::Perbill::from_percent(80) + * RuntimeBlockWeights::get().max_block; + // Retry a scheduled item every 10 blocks (1 minute) until the preimage exists. + pub const NoPreimagePostponement: Option = Some(10); +} + +impl pallet_scheduler::Config for Runtime { + type MaxScheduledPerBlock = ConstU32<50>; + type MaximumWeight = MaximumSchedulerWeight; + type NoPreimagePostponement = NoPreimagePostponement; + type OriginPrivilegeCmp = OriginPrivilegeCmp; + type PalletsOrigin = OriginCaller; + type PreimageProvider = Preimage; + type RuntimeCall = RuntimeCall; + type RuntimeEvent = RuntimeEvent; + type RuntimeOrigin = RuntimeOrigin; + type ScheduleOrigin = Root; + type WeightInfo = (); +} diff --git a/runtime/darwinia/src/pallets/session.rs b/runtime/darwinia/src/pallets/session.rs index 81f96d7a8..7725500ed 100644 --- a/runtime/darwinia/src/pallets/session.rs +++ b/runtime/darwinia/src/pallets/session.rs @@ -28,7 +28,6 @@ sp_runtime::impl_opaque_keys! { frame_support::parameter_types! { pub const Period: u32 = 6 * HOURS; pub const Offset: u32 = 0; - pub const MaxAuthorities: u32 = 100_000; } impl pallet_session::Config for Runtime { diff --git a/runtime/darwinia/src/pallets/sudo.rs b/runtime/darwinia/src/pallets/sudo.rs new file mode 100644 index 000000000..e66cda23f --- /dev/null +++ b/runtime/darwinia/src/pallets/sudo.rs @@ -0,0 +1,25 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +impl pallet_sudo::Config for Runtime { + type RuntimeCall = RuntimeCall; + type RuntimeEvent = RuntimeEvent; +} diff --git a/runtime/darwinia/src/pallets/system.rs b/runtime/darwinia/src/pallets/system.rs index ccdfd2c16..bb07e9fea 100644 --- a/runtime/darwinia/src/pallets/system.rs +++ b/runtime/darwinia/src/pallets/system.rs @@ -32,7 +32,6 @@ pub const MAXIMUM_BLOCK_WEIGHT: Weight = frame_support::weights::constants::WEIGHT_PER_SECOND.saturating_div(2); frame_support::parameter_types! { - pub const BlockHashCount: BlockNumber = 2400; pub const Version: sp_version::RuntimeVersion = VERSION; pub RuntimeBlockLength: frame_system::limits::BlockLength = frame_system::limits::BlockLength::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO); @@ -54,7 +53,6 @@ frame_support::parameter_types! { }) .avg_block_initialization(AVERAGE_ON_INITIALIZE_RATIO) .build_or_panic(); - pub const SS58Prefix: u8 = 42; } impl frame_system::Config for Runtime { @@ -65,7 +63,7 @@ impl frame_system::Config for Runtime { /// The basic call filter to use in dispatchable. type BaseCallFilter = frame_support::traits::Everything; /// Maximum number of block number to block hash mappings to keep (oldest pruned first). - type BlockHashCount = BlockHashCount; + type BlockHashCount = ConstU32<2400>; /// The maximum length of a block (in bytes). type BlockLength = RuntimeBlockLength; /// The index type for blocks. @@ -100,7 +98,7 @@ impl frame_system::Config for Runtime { /// The ubiquitous origin type. type RuntimeOrigin = RuntimeOrigin; /// This is used as an identifier of the chain. 42 is the generic substrate prefix. - type SS58Prefix = SS58Prefix; + type SS58Prefix = ConstU16<18>; /// Weight information for the extrinsics of this pallet. type SystemWeightInfo = weights::frame_system::WeightInfo; /// Runtime version. diff --git a/runtime/darwinia/src/pallets/timestamp.rs b/runtime/darwinia/src/pallets/timestamp.rs index 721751b06..9bf543250 100644 --- a/runtime/darwinia/src/pallets/timestamp.rs +++ b/runtime/darwinia/src/pallets/timestamp.rs @@ -19,12 +19,8 @@ // darwinia use crate::*; -frame_support::parameter_types! { - pub const MinimumPeriod: u64 = SLOT_DURATION / 2; -} - impl pallet_timestamp::Config for Runtime { - type MinimumPeriod = MinimumPeriod; + type MinimumPeriod = ConstU64<{ SLOT_DURATION / 2 }>; /// A timestamp: milliseconds since the unix epoch. type Moment = u64; type OnTimestampSet = (); diff --git a/runtime/darwinia/src/pallets/tips.rs b/runtime/darwinia/src/pallets/tips.rs new file mode 100644 index 000000000..83f8cfb89 --- /dev/null +++ b/runtime/darwinia/src/pallets/tips.rs @@ -0,0 +1,35 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +frame_support::parameter_types! { + pub const TipFindersFee: sp_runtime::Percent = sp_runtime::Percent::from_percent(20); +} + +impl pallet_tips::Config for Runtime { + type DataDepositPerByte = ConstU128<{ darwinia_deposit(0, 1) }>; + type MaximumReasonLength = ConstU32<16384>; + type RuntimeEvent = RuntimeEvent; + type TipCountdown = ConstU32; + type TipFindersFee = TipFindersFee; + type TipReportDepositBase = ConstU128<{ 100 * UNIT }>; + type Tippers = PhragmenElection; + type WeightInfo = (); +} diff --git a/runtime/darwinia/src/pallets/transaction_payment.rs b/runtime/darwinia/src/pallets/transaction_payment.rs index e79ae8264..691273b7b 100644 --- a/runtime/darwinia/src/pallets/transaction_payment.rs +++ b/runtime/darwinia/src/pallets/transaction_payment.rs @@ -19,17 +19,12 @@ // darwinia use crate::*; -frame_support::parameter_types! { - /// Relay Chain `TransactionByteFee` / 10 - pub const TransactionByteFee: Balance = 10 * MICROUNIT; - pub const OperationalFeeMultiplier: u8 = 5; -} - impl pallet_transaction_payment::Config for Runtime { type FeeMultiplierUpdate = polkadot_runtime_common::SlowAdjustingFeeUpdate; - type LengthToFee = ConstantMultiplier; + // Relay Chain `TransactionByteFee` / 10 + type LengthToFee = ConstantMultiplier>; type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter; - type OperationalFeeMultiplier = OperationalFeeMultiplier; + type OperationalFeeMultiplier = sp_runtime::traits::ConstU8<5>; type RuntimeEvent = RuntimeEvent; type WeightToFee = WeightToFee; } diff --git a/runtime/darwinia/src/pallets/treasury.rs b/runtime/darwinia/src/pallets/treasury.rs new file mode 100644 index 000000000..901df24b5 --- /dev/null +++ b/runtime/darwinia/src/pallets/treasury.rs @@ -0,0 +1,47 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +frame_support::parameter_types! { + pub const TreasuryPalletId: frame_support::PalletId = frame_support::PalletId(*b"da/trsry"); + pub const ProposalBond: sp_runtime::Permill = sp_runtime::Permill::from_percent(5); + pub const Burn: sp_runtime::Permill = sp_runtime::Permill::from_percent(1); +} + +// In order to use `Tips`, which bounded by `pallet_treasury::Config` rather +// `pallet_treasury::Config` Still use `DefaultInstance` here instead `Instance1` +impl pallet_treasury::Config for Runtime { + type ApproveOrigin = RootOrAtLeastThreeFifth; + type Burn = Burn; + type BurnDestination = (); + type Currency = Balances; + type MaxApprovals = ConstU32<100>; + type OnSlash = Treasury; + type PalletId = TreasuryPalletId; + type ProposalBond = ProposalBond; + type ProposalBondMaximum = (); + type ProposalBondMinimum = ConstU128; + type RejectOrigin = RootOrMoreThanHalf; + type RuntimeEvent = RuntimeEvent; + type SpendFunds = (); + type SpendOrigin = frame_support::traits::NeverEnsureOrigin; + type SpendPeriod = ConstU32<{ 24 * DAYS }>; + type WeightInfo = (); +} diff --git a/runtime/darwinia/src/pallets/utility.rs b/runtime/darwinia/src/pallets/utility.rs new file mode 100644 index 000000000..8bcc96517 --- /dev/null +++ b/runtime/darwinia/src/pallets/utility.rs @@ -0,0 +1,27 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +impl pallet_utility::Config for Runtime { + type PalletsOrigin = OriginCaller; + type RuntimeCall = RuntimeCall; + type RuntimeEvent = RuntimeEvent; + type WeightInfo = (); +} diff --git a/runtime/darwinia/src/pallets/vesting.rs b/runtime/darwinia/src/pallets/vesting.rs new file mode 100644 index 000000000..406b6956f --- /dev/null +++ b/runtime/darwinia/src/pallets/vesting.rs @@ -0,0 +1,32 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +impl pallet_vesting::Config for Runtime { + type BlockNumberToBalance = sp_runtime::traits::ConvertInto; + type Currency = Balances; + type MinVestedTransfer = ConstU128; + type RuntimeEvent = RuntimeEvent; + type WeightInfo = (); + + // `VestingInfo` encode length is 36bytes. 28 schedules gets encoded as 1009 bytes, which is the + // highest number of schedules that encodes less than 2^10. + const MAX_VESTING_SCHEDULES: u32 = 28; +} From e5be30581378cfeffcb02287cab84d1181c35c8d Mon Sep 17 00:00:00 2001 From: Guantong <04637@163.com> Date: Fri, 25 Nov 2022 21:52:39 +0800 Subject: [PATCH 017/189] Crab & Pangolin Runtime (#56) --- .github/workflows/checks.yml | 20 +- Cargo.lock | 191 +++++ node/Cargo.toml | 3 + node/src/chain_spec/crab.rs | 345 ++++++++ .../{chain_spec.rs => chain_spec/darwinia.rs} | 68 +- node/src/chain_spec/mod.rs | 79 ++ node/src/chain_spec/pangolin.rs | 349 ++++++++ node/src/command.rs | 254 ++++-- node/src/service/executors.rs | 71 ++ node/src/{service.rs => service/mod.rs} | 46 +- runtime/crab/Cargo.toml | 329 ++++++++ runtime/crab/build.rs | 24 + runtime/crab/src/lib.rs | 752 ++++++++++++++++++ runtime/crab/src/pallets/aura.rs | 26 + runtime/crab/src/pallets/aura_ext.rs | 22 + runtime/crab/src/pallets/authorship.rs | 27 + runtime/crab/src/pallets/balances.rs | 32 + runtime/crab/src/pallets/base_fee.rs | 47 ++ .../crab/src/pallets/collator_selection.rs | 47 ++ runtime/crab/src/pallets/collective.rs | 50 ++ runtime/crab/src/pallets/democracy.rs | 64 ++ runtime/crab/src/pallets/dmp_queue.rs | 26 + .../crab/src/pallets/elections_phragmen.rs | 49 ++ runtime/crab/src/pallets/ethereum.rs | 25 + runtime/crab/src/pallets/evm.rs | 164 ++++ runtime/crab/src/pallets/identity.rs | 39 + runtime/crab/src/pallets/membership.rs | 33 + runtime/crab/src/pallets/mod.rs | 99 +++ runtime/crab/src/pallets/multisig.rs | 32 + runtime/crab/src/pallets/parachain_info_.rs | 22 + runtime/crab/src/pallets/parachain_system.rs | 37 + runtime/crab/src/pallets/polkadot_xcm.rs | 169 ++++ runtime/crab/src/pallets/preimage.rs | 30 + runtime/crab/src/pallets/proxy.rs | 86 ++ runtime/crab/src/pallets/scheduler.rs | 64 ++ runtime/crab/src/pallets/session.rs | 45 ++ runtime/crab/src/pallets/sudo.rs | 25 + runtime/crab/src/pallets/system.rs | 106 +++ runtime/crab/src/pallets/timestamp.rs | 28 + runtime/crab/src/pallets/tips.rs | 35 + .../crab/src/pallets/transaction_payment.rs | 30 + runtime/crab/src/pallets/treasury.rs | 47 ++ runtime/crab/src/pallets/utility.rs | 27 + runtime/crab/src/pallets/vesting.rs | 32 + runtime/crab/src/pallets/xcmp_queue.rs | 31 + runtime/crab/src/weights/block_weights.rs | 52 ++ .../src/weights/cumulus_pallet_xcmp_queue.rs | 67 ++ runtime/crab/src/weights/extrinsic_weights.rs | 52 ++ runtime/crab/src/weights/frame_system.rs | 88 ++ runtime/crab/src/weights/mod.rs | 40 + runtime/crab/src/weights/pallet_balances.rs | 97 +++ .../src/weights/pallet_collator_selection.rs | 111 +++ runtime/crab/src/weights/pallet_session.rs | 69 ++ runtime/crab/src/weights/pallet_timestamp.rs | 64 ++ runtime/crab/src/weights/paritydb_weights.rs | 63 ++ runtime/crab/src/weights/rocksdb_weights.rs | 63 ++ runtime/darwinia/src/pallets/dmp_queue.rs | 2 +- runtime/darwinia/src/pallets/identity.rs | 2 +- runtime/darwinia/src/pallets/multisig.rs | 2 +- runtime/darwinia/src/pallets/polkadot_xcm.rs | 34 +- runtime/darwinia/src/pallets/xcmp_queue.rs | 2 +- runtime/pangolin/Cargo.toml | 329 ++++++++ runtime/pangolin/build.rs | 24 + runtime/pangolin/src/lib.rs | 752 ++++++++++++++++++ runtime/pangolin/src/pallets/aura.rs | 26 + runtime/pangolin/src/pallets/aura_ext.rs | 22 + runtime/pangolin/src/pallets/authorship.rs | 27 + runtime/pangolin/src/pallets/balances.rs | 32 + runtime/pangolin/src/pallets/base_fee.rs | 47 ++ .../src/pallets/collator_selection.rs | 47 ++ runtime/pangolin/src/pallets/collective.rs | 50 ++ runtime/pangolin/src/pallets/democracy.rs | 64 ++ runtime/pangolin/src/pallets/dmp_queue.rs | 26 + .../src/pallets/elections_phragmen.rs | 49 ++ runtime/pangolin/src/pallets/ethereum.rs | 25 + runtime/pangolin/src/pallets/evm.rs | 164 ++++ runtime/pangolin/src/pallets/identity.rs | 39 + runtime/pangolin/src/pallets/membership.rs | 33 + runtime/pangolin/src/pallets/mod.rs | 99 +++ runtime/pangolin/src/pallets/multisig.rs | 32 + .../pangolin/src/pallets/parachain_info_.rs | 22 + .../pangolin/src/pallets/parachain_system.rs | 37 + runtime/pangolin/src/pallets/polkadot_xcm.rs | 169 ++++ runtime/pangolin/src/pallets/preimage.rs | 30 + runtime/pangolin/src/pallets/proxy.rs | 86 ++ runtime/pangolin/src/pallets/scheduler.rs | 64 ++ runtime/pangolin/src/pallets/session.rs | 45 ++ runtime/pangolin/src/pallets/sudo.rs | 25 + runtime/pangolin/src/pallets/system.rs | 106 +++ runtime/pangolin/src/pallets/timestamp.rs | 28 + runtime/pangolin/src/pallets/tips.rs | 35 + .../src/pallets/transaction_payment.rs | 30 + runtime/pangolin/src/pallets/treasury.rs | 47 ++ runtime/pangolin/src/pallets/utility.rs | 27 + runtime/pangolin/src/pallets/vesting.rs | 32 + runtime/pangolin/src/pallets/xcmp_queue.rs | 31 + runtime/pangolin/src/weights/block_weights.rs | 52 ++ .../src/weights/cumulus_pallet_xcmp_queue.rs | 67 ++ .../pangolin/src/weights/extrinsic_weights.rs | 52 ++ runtime/pangolin/src/weights/frame_system.rs | 88 ++ runtime/pangolin/src/weights/mod.rs | 40 + .../pangolin/src/weights/pallet_balances.rs | 97 +++ .../src/weights/pallet_collator_selection.rs | 111 +++ .../pangolin/src/weights/pallet_session.rs | 69 ++ .../pangolin/src/weights/pallet_timestamp.rs | 64 ++ .../pangolin/src/weights/paritydb_weights.rs | 63 ++ .../pangolin/src/weights/rocksdb_weights.rs | 63 ++ 107 files changed, 8259 insertions(+), 143 deletions(-) create mode 100644 node/src/chain_spec/crab.rs rename node/src/{chain_spec.rs => chain_spec/darwinia.rs} (82%) create mode 100644 node/src/chain_spec/mod.rs create mode 100644 node/src/chain_spec/pangolin.rs create mode 100644 node/src/service/executors.rs rename node/src/{service.rs => service/mod.rs} (95%) create mode 100644 runtime/crab/Cargo.toml create mode 100644 runtime/crab/build.rs create mode 100644 runtime/crab/src/lib.rs create mode 100644 runtime/crab/src/pallets/aura.rs create mode 100644 runtime/crab/src/pallets/aura_ext.rs create mode 100644 runtime/crab/src/pallets/authorship.rs create mode 100644 runtime/crab/src/pallets/balances.rs create mode 100644 runtime/crab/src/pallets/base_fee.rs create mode 100644 runtime/crab/src/pallets/collator_selection.rs create mode 100644 runtime/crab/src/pallets/collective.rs create mode 100644 runtime/crab/src/pallets/democracy.rs create mode 100644 runtime/crab/src/pallets/dmp_queue.rs create mode 100644 runtime/crab/src/pallets/elections_phragmen.rs create mode 100644 runtime/crab/src/pallets/ethereum.rs create mode 100644 runtime/crab/src/pallets/evm.rs create mode 100644 runtime/crab/src/pallets/identity.rs create mode 100644 runtime/crab/src/pallets/membership.rs create mode 100644 runtime/crab/src/pallets/mod.rs create mode 100644 runtime/crab/src/pallets/multisig.rs create mode 100644 runtime/crab/src/pallets/parachain_info_.rs create mode 100644 runtime/crab/src/pallets/parachain_system.rs create mode 100644 runtime/crab/src/pallets/polkadot_xcm.rs create mode 100644 runtime/crab/src/pallets/preimage.rs create mode 100644 runtime/crab/src/pallets/proxy.rs create mode 100644 runtime/crab/src/pallets/scheduler.rs create mode 100644 runtime/crab/src/pallets/session.rs create mode 100644 runtime/crab/src/pallets/sudo.rs create mode 100644 runtime/crab/src/pallets/system.rs create mode 100644 runtime/crab/src/pallets/timestamp.rs create mode 100644 runtime/crab/src/pallets/tips.rs create mode 100644 runtime/crab/src/pallets/transaction_payment.rs create mode 100644 runtime/crab/src/pallets/treasury.rs create mode 100644 runtime/crab/src/pallets/utility.rs create mode 100644 runtime/crab/src/pallets/vesting.rs create mode 100644 runtime/crab/src/pallets/xcmp_queue.rs create mode 100644 runtime/crab/src/weights/block_weights.rs create mode 100644 runtime/crab/src/weights/cumulus_pallet_xcmp_queue.rs create mode 100644 runtime/crab/src/weights/extrinsic_weights.rs create mode 100644 runtime/crab/src/weights/frame_system.rs create mode 100644 runtime/crab/src/weights/mod.rs create mode 100644 runtime/crab/src/weights/pallet_balances.rs create mode 100644 runtime/crab/src/weights/pallet_collator_selection.rs create mode 100644 runtime/crab/src/weights/pallet_session.rs create mode 100644 runtime/crab/src/weights/pallet_timestamp.rs create mode 100644 runtime/crab/src/weights/paritydb_weights.rs create mode 100644 runtime/crab/src/weights/rocksdb_weights.rs create mode 100644 runtime/pangolin/Cargo.toml create mode 100644 runtime/pangolin/build.rs create mode 100644 runtime/pangolin/src/lib.rs create mode 100644 runtime/pangolin/src/pallets/aura.rs create mode 100644 runtime/pangolin/src/pallets/aura_ext.rs create mode 100644 runtime/pangolin/src/pallets/authorship.rs create mode 100644 runtime/pangolin/src/pallets/balances.rs create mode 100644 runtime/pangolin/src/pallets/base_fee.rs create mode 100644 runtime/pangolin/src/pallets/collator_selection.rs create mode 100644 runtime/pangolin/src/pallets/collective.rs create mode 100644 runtime/pangolin/src/pallets/democracy.rs create mode 100644 runtime/pangolin/src/pallets/dmp_queue.rs create mode 100644 runtime/pangolin/src/pallets/elections_phragmen.rs create mode 100644 runtime/pangolin/src/pallets/ethereum.rs create mode 100644 runtime/pangolin/src/pallets/evm.rs create mode 100644 runtime/pangolin/src/pallets/identity.rs create mode 100644 runtime/pangolin/src/pallets/membership.rs create mode 100644 runtime/pangolin/src/pallets/mod.rs create mode 100644 runtime/pangolin/src/pallets/multisig.rs create mode 100644 runtime/pangolin/src/pallets/parachain_info_.rs create mode 100644 runtime/pangolin/src/pallets/parachain_system.rs create mode 100644 runtime/pangolin/src/pallets/polkadot_xcm.rs create mode 100644 runtime/pangolin/src/pallets/preimage.rs create mode 100644 runtime/pangolin/src/pallets/proxy.rs create mode 100644 runtime/pangolin/src/pallets/scheduler.rs create mode 100644 runtime/pangolin/src/pallets/session.rs create mode 100644 runtime/pangolin/src/pallets/sudo.rs create mode 100644 runtime/pangolin/src/pallets/system.rs create mode 100644 runtime/pangolin/src/pallets/timestamp.rs create mode 100644 runtime/pangolin/src/pallets/tips.rs create mode 100644 runtime/pangolin/src/pallets/transaction_payment.rs create mode 100644 runtime/pangolin/src/pallets/treasury.rs create mode 100644 runtime/pangolin/src/pallets/utility.rs create mode 100644 runtime/pangolin/src/pallets/vesting.rs create mode 100644 runtime/pangolin/src/pallets/xcmp_queue.rs create mode 100644 runtime/pangolin/src/weights/block_weights.rs create mode 100644 runtime/pangolin/src/weights/cumulus_pallet_xcmp_queue.rs create mode 100644 runtime/pangolin/src/weights/extrinsic_weights.rs create mode 100644 runtime/pangolin/src/weights/frame_system.rs create mode 100644 runtime/pangolin/src/weights/mod.rs create mode 100644 runtime/pangolin/src/weights/pallet_balances.rs create mode 100644 runtime/pangolin/src/weights/pallet_collator_selection.rs create mode 100644 runtime/pangolin/src/weights/pallet_session.rs create mode 100644 runtime/pangolin/src/weights/pallet_timestamp.rs create mode 100644 runtime/pangolin/src/weights/paritydb_weights.rs create mode 100644 runtime/pangolin/src/weights/rocksdb_weights.rs diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 9f9f77119..0890187b8 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -135,10 +135,26 @@ jobs: run: | tar xf darwinia.tar.zst -I pzstd sudo mv darwinia /usr/bin + - id: check-crab-runtime-version + name: Check Crab runtime version + run: | + OUTPUT=$(subalfred check runtime --executable darwinia --chain crab-local --live https://rpc.polkadot.io --property version) + OUTPUT="${OUTPUT//'%'/'%25'}​" + OUTPUT="${OUTPUT//$'\n'/'%0A'}" + OUTPUT="${OUTPUT//$'\r'/'%0D'}" + echo "::set-output name=check-crab-runtime-version::$OUTPUT" + - id: check-crab-runtime-storage + name: Check Crab runtime storage + run: | + OUTPUT=$(subalfred check runtime --executable darwinia --chain crab-local --live https://rpc.polkadot.io --property storage) + OUTPUT="${OUTPUT//'%'/'%25'}​" + OUTPUT="${OUTPUT//$'\n'/'%0A'}" + OUTPUT="${OUTPUT//$'\r'/'%0D'}" + echo "::set-output name=check-crab-runtime-storage::$OUTPUT" - id: check-darwinia-runtime-version name: Check Darwinia runtime version run: | - OUTPUT=$(subalfred check runtime --executable darwinia --chain local --live https://rpc.polkadot.io --property version) + OUTPUT=$(subalfred check runtime --executable darwinia --chain darwinia-local --live https://rpc.polkadot.io --property version) OUTPUT="${OUTPUT//'%'/'%25'}​" OUTPUT="${OUTPUT//$'\n'/'%0A'}" OUTPUT="${OUTPUT//$'\r'/'%0D'}" @@ -146,7 +162,7 @@ jobs: - id: check-darwinia-runtime-storage name: Check Darwinia runtime storage run: | - OUTPUT=$(subalfred check runtime --executable darwinia --chain local --live https://rpc.polkadot.io --property storage) + OUTPUT=$(subalfred check runtime --executable darwinia --chain darwinia-local --live https://rpc.polkadot.io --property storage) OUTPUT="${OUTPUT//'%'/'%25'}​" OUTPUT="${OUTPUT//$'\n'/'%0A'}" OUTPUT="${OUTPUT//$'\r'/'%0D'}" diff --git a/Cargo.lock b/Cargo.lock index aa48d8383..751919053 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1312,6 +1312,100 @@ dependencies = [ "libc", ] +[[package]] +name = "crab-runtime" +version = "6.0.0" +dependencies = [ + "array-bytes", + "bp-message-dispatch", + "bp-messages", + "bp-polkadot-core", + "bp-runtime", + "bridge-runtime-common", + "cumulus-pallet-aura-ext", + "cumulus-pallet-dmp-queue", + "cumulus-pallet-parachain-system", + "cumulus-pallet-session-benchmarking", + "cumulus-pallet-xcm", + "cumulus-pallet-xcmp-queue", + "cumulus-primitives-core", + "cumulus-primitives-timestamp", + "cumulus-primitives-utility", + "darwinia-common-runtime", + "darwinia-precompile-bls12-381", + "darwinia-precompile-state-storage", + "dc-primitives", + "fp-evm", + "fp-rpc", + "fp-self-contained", + "frame-benchmarking", + "frame-executive", + "frame-support", + "frame-system", + "frame-system-benchmarking", + "frame-system-rpc-runtime-api", + "frame-try-runtime", + "pallet-aura", + "pallet-authorship", + "pallet-balances", + "pallet-base-fee", + "pallet-bridge-dispatch", + "pallet-bridge-grandpa", + "pallet-bridge-messages", + "pallet-collator-selection", + "pallet-collective", + "pallet-democracy", + "pallet-elections-phragmen", + "pallet-ethereum", + "pallet-evm", + "pallet-evm-precompile-blake2", + "pallet-evm-precompile-bn128", + "pallet-evm-precompile-dispatch", + "pallet-evm-precompile-modexp", + "pallet-evm-precompile-simple", + "pallet-fee-market", + "pallet-identity", + "pallet-membership", + "pallet-multisig", + "pallet-preimage", + "pallet-proxy", + "pallet-scheduler", + "pallet-session", + "pallet-sudo", + "pallet-timestamp", + "pallet-tips", + "pallet-transaction-payment", + "pallet-transaction-payment-rpc-runtime-api", + "pallet-treasury", + "pallet-utility", + "pallet-vesting", + "pallet-xcm", + "parachain-info", + "parity-scale-codec", + "polkadot-parachain", + "polkadot-runtime-common", + "scale-info", + "smallvec", + "sp-api", + "sp-block-builder", + "sp-consensus-aura", + "sp-core", + "sp-inherents", + "sp-io", + "sp-offchain", + "sp-runtime", + "sp-session", + "sp-std", + "sp-transaction-pool", + "sp-version", + "static_assertions", + "substrate-wasm-builder", + "xcm", + "xcm-builder", + "xcm-executor", + "xcm-primitives", +] + [[package]] name = "cranelift-bforest" version = "0.88.2" @@ -2097,6 +2191,7 @@ version = "6.0.0" dependencies = [ "array-bytes", "clap", + "crab-runtime", "cumulus-client-cli", "cumulus-client-collator", "cumulus-client-consensus-aura", @@ -2125,6 +2220,7 @@ dependencies = [ "jsonrpsee", "log", "pallet-transaction-payment-rpc", + "pangolin-runtime", "parity-scale-codec", "polkadot-cli", "polkadot-parachain", @@ -2155,6 +2251,7 @@ dependencies = [ "sp-consensus-aura", "sp-core", "sp-inherents", + "sp-io", "sp-keystore", "sp-offchain", "sp-runtime", @@ -7009,6 +7106,100 @@ dependencies = [ "xcm-executor", ] +[[package]] +name = "pangolin-runtime" +version = "6.0.0" +dependencies = [ + "array-bytes", + "bp-message-dispatch", + "bp-messages", + "bp-polkadot-core", + "bp-runtime", + "bridge-runtime-common", + "cumulus-pallet-aura-ext", + "cumulus-pallet-dmp-queue", + "cumulus-pallet-parachain-system", + "cumulus-pallet-session-benchmarking", + "cumulus-pallet-xcm", + "cumulus-pallet-xcmp-queue", + "cumulus-primitives-core", + "cumulus-primitives-timestamp", + "cumulus-primitives-utility", + "darwinia-common-runtime", + "darwinia-precompile-bls12-381", + "darwinia-precompile-state-storage", + "dc-primitives", + "fp-evm", + "fp-rpc", + "fp-self-contained", + "frame-benchmarking", + "frame-executive", + "frame-support", + "frame-system", + "frame-system-benchmarking", + "frame-system-rpc-runtime-api", + "frame-try-runtime", + "pallet-aura", + "pallet-authorship", + "pallet-balances", + "pallet-base-fee", + "pallet-bridge-dispatch", + "pallet-bridge-grandpa", + "pallet-bridge-messages", + "pallet-collator-selection", + "pallet-collective", + "pallet-democracy", + "pallet-elections-phragmen", + "pallet-ethereum", + "pallet-evm", + "pallet-evm-precompile-blake2", + "pallet-evm-precompile-bn128", + "pallet-evm-precompile-dispatch", + "pallet-evm-precompile-modexp", + "pallet-evm-precompile-simple", + "pallet-fee-market", + "pallet-identity", + "pallet-membership", + "pallet-multisig", + "pallet-preimage", + "pallet-proxy", + "pallet-scheduler", + "pallet-session", + "pallet-sudo", + "pallet-timestamp", + "pallet-tips", + "pallet-transaction-payment", + "pallet-transaction-payment-rpc-runtime-api", + "pallet-treasury", + "pallet-utility", + "pallet-vesting", + "pallet-xcm", + "parachain-info", + "parity-scale-codec", + "polkadot-parachain", + "polkadot-runtime-common", + "scale-info", + "smallvec", + "sp-api", + "sp-block-builder", + "sp-consensus-aura", + "sp-core", + "sp-inherents", + "sp-io", + "sp-offchain", + "sp-runtime", + "sp-session", + "sp-std", + "sp-transaction-pool", + "sp-version", + "static_assertions", + "substrate-wasm-builder", + "xcm", + "xcm-builder", + "xcm-executor", + "xcm-primitives", +] + [[package]] name = "parachain-info" version = "0.1.0" diff --git a/node/Cargo.toml b/node/Cargo.toml index 97b1a66bf..5f539fbe9 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -36,8 +36,10 @@ cumulus-relay-chain-interface = { git = "https://github.com/paritytech cumulus-relay-chain-rpc-interface = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.30" } # darwinia +crab-runtime = { path = "../runtime/crab" } darwinia-runtime = { path = "../runtime/darwinia" } dc-primitives = { path = "../core/primitives" } +pangolin-runtime = { path = "../runtime/pangolin" } # frontier fc-cli = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } @@ -85,6 +87,7 @@ sp-consensus = { git = "https://github.com/paritytech/substrat sp-consensus-aura = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } sp-inherents = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } sp-offchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } diff --git a/node/src/chain_spec/crab.rs b/node/src/chain_spec/crab.rs new file mode 100644 index 000000000..a4b3987af --- /dev/null +++ b/node/src/chain_spec/crab.rs @@ -0,0 +1,345 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +#![allow(clippy::derive_partial_eq_without_eq)] + +// std +use std::{collections::BTreeMap, str::FromStr}; +// cumulus +use cumulus_primitives_core::ParaId; +// darwinia +use super::*; +use crab_runtime::{AuraId, CrabPrecompiles, EvmConfig, Runtime}; +use dc_primitives::*; +// frontier +use fp_evm::GenesisAccount; +// substrate +use sc_service::ChainType; +use sp_core::H160; + +/// Specialized `ChainSpec` for the normal parachain runtime. +pub type ChainSpec = sc_service::GenericChainSpec; + +/// Generate the session keys from individual elements. +/// +/// The input must be a tuple of individual keys (a single arg for now since we have just one key). +pub fn session_keys(keys: AuraId) -> crab_runtime::SessionKeys { + crab_runtime::SessionKeys { aura: keys } +} + +pub fn development_config() -> ChainSpec { + // Give your base currency a unit name and decimal places + let mut properties = sc_chain_spec::Properties::new(); + properties.insert("tokenSymbol".into(), "CRAB".into()); + properties.insert("tokenDecimals".into(), 18.into()); + properties.insert("ss58Format".into(), 42.into()); + + ChainSpec::from_genesis( + // Name + "Crab2 Development", + // ID + "crab-dev", + ChainType::Development, + move || { + testnet_genesis( + // initial collators. + vec![ + // Bind the `Alice` to `Alith` to make `--alice` available for testnet. + ( + array_bytes::hex_n_into_unchecked(ALITH), + get_collator_keys_from_seed("Alice"), + ), + // Bind the `Bob` to `Balthar` to make `--bob` available for testnet. + ( + array_bytes::hex_n_into_unchecked(BALTATHAR), + get_collator_keys_from_seed("Bob"), + ), + ], + vec![ + array_bytes::hex_n_into_unchecked(ALITH), + array_bytes::hex_n_into_unchecked(BALTATHAR), + array_bytes::hex_n_into_unchecked(CHARLETH), + array_bytes::hex_n_into_unchecked(DOROTHY), + array_bytes::hex_n_into_unchecked(ETHAN), + array_bytes::hex_n_into_unchecked(FAITH), + ], + 1000.into(), + ) + }, + Vec::new(), + None, + None, + None, + Some(properties), + Extensions { + relay_chain: "rococo-local".into(), // You MUST set this to the correct network! + para_id: 1000, + }, + ) +} + +pub fn local_testnet_config() -> ChainSpec { + // Give your base currency a unit name and decimal places + let mut properties = sc_chain_spec::Properties::new(); + properties.insert("tokenSymbol".into(), "CRAB".into()); + properties.insert("tokenDecimals".into(), 18.into()); + properties.insert("ss58Format".into(), 42.into()); + + ChainSpec::from_genesis( + // Name + "Crab2 Local Testnet", + // ID + "crab_local_testnet", + ChainType::Local, + move || { + testnet_genesis( + // initial collators. + vec![ + // Bind the `Alice` to `Alith` to make `--alice` available for testnet. + ( + array_bytes::hex_n_into_unchecked(ALITH), + get_collator_keys_from_seed("Alice"), + ), + // Bind the `Bob` to `Balthar` to make `--bob` available for testnet. + ( + array_bytes::hex_n_into_unchecked(BALTATHAR), + get_collator_keys_from_seed("Bob"), + ), + ], + vec![ + array_bytes::hex_n_into_unchecked(ALITH), + array_bytes::hex_n_into_unchecked(BALTATHAR), + array_bytes::hex_n_into_unchecked(CHARLETH), + array_bytes::hex_n_into_unchecked(DOROTHY), + array_bytes::hex_n_into_unchecked(ETHAN), + array_bytes::hex_n_into_unchecked(FAITH), + ], + 1000.into(), + ) + }, + // Bootnodes + Vec::new(), + // Telemetry + None, + // Protocol ID + Some("crab"), + // Fork ID + None, + // Properties + Some(properties), + // Extensions + Extensions { + relay_chain: "rococo-local".into(), // You MUST set this to the correct network! + para_id: 1000, + }, + ) +} + +pub fn config() -> ChainSpec { + // Give your base currency a unit name and decimal places + let mut properties = sc_chain_spec::Properties::new(); + properties.insert("tokenSymbol".into(), "CRAB".into()); + properties.insert("tokenDecimals".into(), 18.into()); + properties.insert("ss58Format".into(), 42.into()); + + // TODO: update this before final release + ChainSpec::from_genesis( + // Name + "Crab2", + // ID + "crab", + ChainType::Live, + move || { + crab_runtime::GenesisConfig { + // System stuff. + system: crab_runtime::SystemConfig { + code: crab_runtime::WASM_BINARY + .expect("WASM binary was not build, please build it!") + .to_vec(), + }, + parachain_system: Default::default(), + parachain_info: crab_runtime::ParachainInfoConfig { parachain_id: 2105.into() }, + + // Monetary stuff. + balances: Default::default(), + transaction_payment: Default::default(), + + // Consensus stuff. + collator_selection: crab_runtime::CollatorSelectionConfig { + invulnerables: vec![array_bytes::hex_n_into_unchecked(ALITH)], + ..Default::default() + }, + session: crab_runtime::SessionConfig { + keys: vec![( + array_bytes::hex_n_into_unchecked(ALITH), + array_bytes::hex_n_into_unchecked(ALITH), + session_keys(get_collator_keys_from_seed("Alice")), + )], + }, + // no need to pass anything to aura, in fact it will panic if we do. Session will + // take care of this. + aura: Default::default(), + aura_ext: Default::default(), + + // Governance stuff. + democracy: Default::default(), + council: Default::default(), + technical_committee: Default::default(), + phragmen_election: Default::default(), + technical_membership: Default::default(), + treasury: Default::default(), + + // Utility stuff. + sudo: Default::default(), + vesting: Default::default(), + + // XCM stuff. + polkadot_xcm: crab_runtime::PolkadotXcmConfig { + safe_xcm_version: Some(SAFE_XCM_VERSION), + }, + + // EVM stuff. + ethereum: Default::default(), + evm: Default::default(), + base_fee: Default::default(), + } + }, + // Bootnodes + Vec::new(), + // Telemetry + None, + // Protocol ID + Some("crab"), + // Fork ID + None, + // Properties + Some(properties), + // Extensions + Extensions { + relay_chain: "kusama".into(), // You MUST set this to the correct network! + para_id: 2105, + }, + ) +} + +fn testnet_genesis( + invulnerables: Vec<(AccountId, AuraId)>, + endowed_accounts: Vec, + id: ParaId, +) -> crab_runtime::GenesisConfig { + crab_runtime::GenesisConfig { + // System stuff. + system: crab_runtime::SystemConfig { code: crab_runtime::WASM_BINARY.unwrap().to_vec() }, + parachain_system: Default::default(), + parachain_info: crab_runtime::ParachainInfoConfig { parachain_id: id }, + + // Monetary stuff. + balances: crab_runtime::BalancesConfig { + balances: endowed_accounts.iter().cloned().map(|k| (k, 100_000_000 * UNIT)).collect(), + }, + transaction_payment: Default::default(), + + // Consensus stuff. + collator_selection: crab_runtime::CollatorSelectionConfig { + invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(), + candidacy_bond: UNIT, + ..Default::default() + }, + session: crab_runtime::SessionConfig { + keys: invulnerables + .into_iter() + .map(|(acc, aura)| { + ( + acc, // account id + acc, // validator id + session_keys(aura), // session keys + ) + }) + .collect(), + }, + // no need to pass anything to aura, in fact it will panic if we do. Session will take care + // of this. + aura: Default::default(), + aura_ext: Default::default(), + + // Governance stuff. + democracy: Default::default(), + council: Default::default(), + technical_committee: Default::default(), + phragmen_election: Default::default(), + technical_membership: Default::default(), + treasury: Default::default(), + + // Utility stuff. + sudo: Default::default(), + vesting: Default::default(), + + // XCM stuff. + polkadot_xcm: crab_runtime::PolkadotXcmConfig { safe_xcm_version: Some(SAFE_XCM_VERSION) }, + + // EVM stuff. + ethereum: Default::default(), + evm: EvmConfig { + accounts: { + BTreeMap::from_iter( + CrabPrecompiles::::used_addresses() + .iter() + .map(|p| { + ( + p.to_owned(), + GenesisAccount { + nonce: Default::default(), + balance: Default::default(), + storage: Default::default(), + code: REVERT_BYTECODE.to_vec(), + }, + ) + }) + .chain([ + // Testing account. + ( + H160::from_str("0x6be02d1d3665660d22ff9624b7be0551ee1ac91b") + .unwrap(), + GenesisAccount { + balance: (10_000_000 * UNIT).into(), + code: Default::default(), + nonce: Default::default(), + storage: Default::default(), + }, + ), + // Benchmarking account. + ( + H160::from_str("1000000000000000000000000000000000000001").unwrap(), + GenesisAccount { + nonce: 1.into(), + balance: (10_000_000 * UNIT).into(), + storage: Default::default(), + code: vec![0x00], + }, + ), + ]), + ) + }, + }, + base_fee: Default::default(), + } +} + +pub fn genesis_config() -> ChainSpec { + unimplemented!("TODO") +} diff --git a/node/src/chain_spec.rs b/node/src/chain_spec/darwinia.rs similarity index 82% rename from node/src/chain_spec.rs rename to node/src/chain_spec/darwinia.rs index 35adac52e..3486ebaad 100644 --- a/node/src/chain_spec.rs +++ b/node/src/chain_spec/darwinia.rs @@ -20,69 +20,21 @@ // std use std::{collections::BTreeMap, str::FromStr}; -// crates.io -use serde::{Deserialize, Serialize}; // cumulus use cumulus_primitives_core::ParaId; // darwinia +use super::*; use darwinia_runtime::{AuraId, DarwiniaPrecompiles, EvmConfig, Runtime}; use dc_primitives::*; // frontier use fp_evm::GenesisAccount; // substrate -use sc_chain_spec::{ChainSpecExtension, ChainSpecGroup}; use sc_service::ChainType; -use sp_core::{Pair, Public, H160}; +use sp_core::H160; /// Specialized `ChainSpec` for the normal parachain runtime. pub type ChainSpec = sc_service::GenericChainSpec; -/// This is the simplest bytecode to revert without returning any data. -/// We will pre-deploy it under all of our precompiles to ensure they can be called from within -/// contracts. (PUSH1 0x00 PUSH1 0x00 REVERT) -pub const REVERT_BYTECODE: [u8; 5] = [0x60, 0x00, 0x60, 0x00, 0xFD]; - -// These are are testnet-only keys. -const ALITH: &str = "0xf24FF3a9CF04c71Dbc94D0b566f7A27B94566cac"; -const BALTATHAR: &str = "0x3Cd0A705a2DC65e5b1E1205896BaA2be8A07c6e0"; -const CHARLETH: &str = "0x798d4Ba9baf0064Ec19eB4F0a1a45785ae9D6DFc"; -const DOROTHY: &str = "0x773539d4Ac0e786233D90A233654ccEE26a613D9"; -const ETHAN: &str = "0xFf64d3F6efE2317EE2807d223a0Bdc4c0c49dfDB"; -const FAITH: &str = "0xC0F0f4ab324C46e55D02D0033343B4Be8A55532d"; - -/// The default XCM version to set in genesis config. -const SAFE_XCM_VERSION: u32 = xcm::prelude::XCM_VERSION; - -/// Helper function to generate a crypto pair from seed -pub fn get_from_seed(seed: &str) -> ::Public { - TPublic::Pair::from_string(&format!("//{}", seed), None) - .expect("static values are valid; qed") - .public() -} - -/// The extensions for the [`ChainSpec`]. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, ChainSpecGroup, ChainSpecExtension)] -#[serde(deny_unknown_fields)] -pub struct Extensions { - /// The relay chain of the Parachain. - pub relay_chain: String, - /// The id of the Parachain. - pub para_id: u32, -} -impl Extensions { - /// Try to get the extension from the given `ChainSpec`. - pub fn try_get(chain_spec: &dyn sc_service::ChainSpec) -> Option<&Self> { - sc_chain_spec::get_extension(chain_spec.extensions()) - } -} - -/// Generate collator keys from seed. -/// -/// This function's return type must always match the session keys of the chain in tuple format. -pub fn get_collator_keys_from_seed(seed: &str) -> AuraId { - get_from_seed::(seed) -} - /// Generate the session keys from individual elements. /// /// The input must be a tuple of individual keys (a single arg for now since we have just one key). @@ -99,9 +51,9 @@ pub fn development_config() -> ChainSpec { ChainSpec::from_genesis( // Name - "Development", + "Darwinia2 Development", // ID - "dev", + "darwinia-dev", ChainType::Development, move || { testnet_genesis( @@ -150,9 +102,9 @@ pub fn local_testnet_config() -> ChainSpec { ChainSpec::from_genesis( // Name - "Local Testnet", + "Darwinia2 Local Testnet", // ID - "local_testnet", + "darwinia_local_testnet", ChainType::Local, move || { testnet_genesis( @@ -198,7 +150,7 @@ pub fn local_testnet_config() -> ChainSpec { ) } -pub fn shell_config() -> ChainSpec { +pub fn config() -> ChainSpec { // Give your base currency a unit name and decimal places let mut properties = sc_chain_spec::Properties::new(); properties.insert("tokenSymbol".into(), "RING".into()); @@ -208,7 +160,7 @@ pub fn shell_config() -> ChainSpec { // TODO: update this before final release ChainSpec::from_genesis( // Name - "Darwinia", + "Darwinia2", // ID "darwinia", ChainType::Live, @@ -391,3 +343,7 @@ fn testnet_genesis( base_fee: Default::default(), } } + +pub fn genesis_config() -> ChainSpec { + unimplemented!("TODO") +} diff --git a/node/src/chain_spec/mod.rs b/node/src/chain_spec/mod.rs new file mode 100644 index 000000000..86e6947df --- /dev/null +++ b/node/src/chain_spec/mod.rs @@ -0,0 +1,79 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +pub mod darwinia; +pub use darwinia::{self as darwinia_chain_spec, ChainSpec as DarwiniaChainSpec}; + +pub mod crab; +pub use crab::{self as crab_chain_spec, ChainSpec as CrabChainSpec}; + +pub mod pangolin; +pub use pangolin::{self as pangolin_chain_spec, ChainSpec as PangolinChainSpec}; + +// crates.io +use serde::{Deserialize, Serialize}; +// substrate +use sc_chain_spec::{ChainSpecExtension, ChainSpecGroup}; +use sp_consensus_aura::sr25519::AuthorityId as AuraId; +use sp_core::{Pair, Public}; + +/// This is the simplest bytecode to revert without returning any data. +/// We will pre-deploy it under all of our precompiles to ensure they can be called from within +/// contracts. (PUSH1 0x00 PUSH1 0x00 REVERT) +pub const REVERT_BYTECODE: [u8; 5] = [0x60, 0x00, 0x60, 0x00, 0xFD]; + +// These are are testnet-only keys. +const ALITH: &str = "0xf24FF3a9CF04c71Dbc94D0b566f7A27B94566cac"; +const BALTATHAR: &str = "0x3Cd0A705a2DC65e5b1E1205896BaA2be8A07c6e0"; +const CHARLETH: &str = "0x798d4Ba9baf0064Ec19eB4F0a1a45785ae9D6DFc"; +const DOROTHY: &str = "0x773539d4Ac0e786233D90A233654ccEE26a613D9"; +const ETHAN: &str = "0xFf64d3F6efE2317EE2807d223a0Bdc4c0c49dfDB"; +const FAITH: &str = "0xC0F0f4ab324C46e55D02D0033343B4Be8A55532d"; + +/// The default XCM version to set in genesis config. +const SAFE_XCM_VERSION: u32 = xcm::prelude::XCM_VERSION; + +/// The extensions for the [`ChainSpec`]. +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, ChainSpecGroup, ChainSpecExtension)] +#[serde(deny_unknown_fields)] +pub struct Extensions { + /// The relay chain of the Parachain. + pub relay_chain: String, + /// The id of the Parachain. + pub para_id: u32, +} +impl Extensions { + /// Try to get the extension from the given `ChainSpec`. + pub fn try_get(chain_spec: &dyn sc_service::ChainSpec) -> Option<&Self> { + sc_chain_spec::get_extension(chain_spec.extensions()) + } +} + +/// Helper function to generate a crypto pair from seed +pub fn get_from_seed(seed: &str) -> ::Public { + TPublic::Pair::from_string(&format!("//{}", seed), None) + .expect("static values are valid; qed") + .public() +} + +/// Generate collator keys from seed. +/// +/// This function's return type must always match the session keys of the chain in tuple format. +pub fn get_collator_keys_from_seed(seed: &str) -> AuraId { + get_from_seed::(seed) +} diff --git a/node/src/chain_spec/pangolin.rs b/node/src/chain_spec/pangolin.rs new file mode 100644 index 000000000..3ba5e9213 --- /dev/null +++ b/node/src/chain_spec/pangolin.rs @@ -0,0 +1,349 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +#![allow(clippy::derive_partial_eq_without_eq)] + +// std +use std::{collections::BTreeMap, str::FromStr}; +// cumulus +use cumulus_primitives_core::ParaId; +// darwinia +use super::*; +use dc_primitives::*; +use pangolin_runtime::{AuraId, EvmConfig, PangolinPrecompiles, Runtime}; +// frontier +use fp_evm::GenesisAccount; +// substrate +use sc_service::ChainType; +use sp_core::H160; + +/// Specialized `ChainSpec` for the normal parachain runtime. +pub type ChainSpec = sc_service::GenericChainSpec; + +/// Generate the session keys from individual elements. +/// +/// The input must be a tuple of individual keys (a single arg for now since we have just one key). +pub fn session_keys(keys: AuraId) -> pangolin_runtime::SessionKeys { + pangolin_runtime::SessionKeys { aura: keys } +} + +pub fn development_config() -> ChainSpec { + // Give your base currency a unit name and decimal places + let mut properties = sc_chain_spec::Properties::new(); + properties.insert("tokenSymbol".into(), "PRING".into()); + properties.insert("tokenDecimals".into(), 18.into()); + properties.insert("ss58Format".into(), 42.into()); + + ChainSpec::from_genesis( + // Name + "Pangolin2 Development", + // ID + "pangolin-dev", + ChainType::Development, + move || { + testnet_genesis( + // initial collators. + vec![ + // Bind the `Alice` to `Alith` to make `--alice` available for testnet. + ( + array_bytes::hex_n_into_unchecked(ALITH), + get_collator_keys_from_seed("Alice"), + ), + // Bind the `Bob` to `Balthar` to make `--bob` available for testnet. + ( + array_bytes::hex_n_into_unchecked(BALTATHAR), + get_collator_keys_from_seed("Bob"), + ), + ], + vec![ + array_bytes::hex_n_into_unchecked(ALITH), + array_bytes::hex_n_into_unchecked(BALTATHAR), + array_bytes::hex_n_into_unchecked(CHARLETH), + array_bytes::hex_n_into_unchecked(DOROTHY), + array_bytes::hex_n_into_unchecked(ETHAN), + array_bytes::hex_n_into_unchecked(FAITH), + ], + 1000.into(), + ) + }, + Vec::new(), + None, + None, + None, + Some(properties), + Extensions { + relay_chain: "rococo-local".into(), // You MUST set this to the correct network! + para_id: 1000, + }, + ) +} + +pub fn local_testnet_config() -> ChainSpec { + // Give your base currency a unit name and decimal places + let mut properties = sc_chain_spec::Properties::new(); + properties.insert("tokenSymbol".into(), "PRING".into()); + properties.insert("tokenDecimals".into(), 18.into()); + properties.insert("ss58Format".into(), 42.into()); + + ChainSpec::from_genesis( + // Name + "Pangolin2 Local Testnet", + // ID + "pangolin_local_testnet", + ChainType::Local, + move || { + testnet_genesis( + // initial collators. + vec![ + // Bind the `Alice` to `Alith` to make `--alice` available for testnet. + ( + array_bytes::hex_n_into_unchecked(ALITH), + get_collator_keys_from_seed("Alice"), + ), + // Bind the `Bob` to `Balthar` to make `--bob` available for testnet. + ( + array_bytes::hex_n_into_unchecked(BALTATHAR), + get_collator_keys_from_seed("Bob"), + ), + ], + vec![ + array_bytes::hex_n_into_unchecked(ALITH), + array_bytes::hex_n_into_unchecked(BALTATHAR), + array_bytes::hex_n_into_unchecked(CHARLETH), + array_bytes::hex_n_into_unchecked(DOROTHY), + array_bytes::hex_n_into_unchecked(ETHAN), + array_bytes::hex_n_into_unchecked(FAITH), + ], + 1000.into(), + ) + }, + // Bootnodes + Vec::new(), + // Telemetry + None, + // Protocol ID + Some("crab"), + // Fork ID + None, + // Properties + Some(properties), + // Extensions + Extensions { + relay_chain: "rococo-local".into(), // You MUST set this to the correct network! + para_id: 1000, + }, + ) +} + +pub fn config() -> ChainSpec { + // Give your base currency a unit name and decimal places + let mut properties = sc_chain_spec::Properties::new(); + properties.insert("tokenSymbol".into(), "PRING".into()); + properties.insert("tokenDecimals".into(), 18.into()); + properties.insert("ss58Format".into(), 42.into()); + + // TODO: update this before final release + ChainSpec::from_genesis( + // Name + "Pangolin2", + // ID + "pangolin", + ChainType::Live, + move || { + pangolin_runtime::GenesisConfig { + // System stuff. + system: pangolin_runtime::SystemConfig { + code: pangolin_runtime::WASM_BINARY + .expect("WASM binary was not build, please build it!") + .to_vec(), + }, + parachain_system: Default::default(), + parachain_info: pangolin_runtime::ParachainInfoConfig { parachain_id: 2105.into() }, + + // Monetary stuff. + balances: Default::default(), + transaction_payment: Default::default(), + + // Consensus stuff. + collator_selection: pangolin_runtime::CollatorSelectionConfig { + invulnerables: vec![array_bytes::hex_n_into_unchecked(ALITH)], + ..Default::default() + }, + session: pangolin_runtime::SessionConfig { + keys: vec![( + array_bytes::hex_n_into_unchecked(ALITH), + array_bytes::hex_n_into_unchecked(ALITH), + session_keys(get_collator_keys_from_seed("Alice")), + )], + }, + // no need to pass anything to aura, in fact it will panic if we do. Session will + // take care of this. + aura: Default::default(), + aura_ext: Default::default(), + + // Governance stuff. + democracy: Default::default(), + council: Default::default(), + technical_committee: Default::default(), + phragmen_election: Default::default(), + technical_membership: Default::default(), + treasury: Default::default(), + + // Utility stuff. + sudo: Default::default(), + vesting: Default::default(), + + // XCM stuff. + polkadot_xcm: pangolin_runtime::PolkadotXcmConfig { + safe_xcm_version: Some(SAFE_XCM_VERSION), + }, + + // EVM stuff. + ethereum: Default::default(), + evm: Default::default(), + base_fee: Default::default(), + } + }, + // Bootnodes + Vec::new(), + // Telemetry + None, + // Protocol ID + Some("pangolin"), + // Fork ID + None, + // Properties + Some(properties), + // Extensions + Extensions { + relay_chain: "rococo".into(), // You MUST set this to the correct network! + para_id: 2105, + }, + ) +} + +fn testnet_genesis( + invulnerables: Vec<(AccountId, AuraId)>, + endowed_accounts: Vec, + id: ParaId, +) -> pangolin_runtime::GenesisConfig { + pangolin_runtime::GenesisConfig { + // System stuff. + system: pangolin_runtime::SystemConfig { + code: pangolin_runtime::WASM_BINARY.unwrap().to_vec(), + }, + parachain_system: Default::default(), + parachain_info: pangolin_runtime::ParachainInfoConfig { parachain_id: id }, + + // Monetary stuff. + balances: pangolin_runtime::BalancesConfig { + balances: endowed_accounts.iter().cloned().map(|k| (k, 100_000_000 * UNIT)).collect(), + }, + transaction_payment: Default::default(), + + // Consensus stuff. + collator_selection: pangolin_runtime::CollatorSelectionConfig { + invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(), + candidacy_bond: UNIT, + ..Default::default() + }, + session: pangolin_runtime::SessionConfig { + keys: invulnerables + .into_iter() + .map(|(acc, aura)| { + ( + acc, // account id + acc, // validator id + session_keys(aura), // session keys + ) + }) + .collect(), + }, + // no need to pass anything to aura, in fact it will panic if we do. Session will take care + // of this. + aura: Default::default(), + aura_ext: Default::default(), + + // Governance stuff. + democracy: Default::default(), + council: Default::default(), + technical_committee: Default::default(), + phragmen_election: Default::default(), + technical_membership: Default::default(), + treasury: Default::default(), + + // Utility stuff. + sudo: Default::default(), + vesting: Default::default(), + + // XCM stuff. + polkadot_xcm: pangolin_runtime::PolkadotXcmConfig { + safe_xcm_version: Some(SAFE_XCM_VERSION), + }, + + // EVM stuff. + ethereum: Default::default(), + evm: EvmConfig { + accounts: { + BTreeMap::from_iter( + PangolinPrecompiles::::used_addresses() + .iter() + .map(|p| { + ( + p.to_owned(), + GenesisAccount { + nonce: Default::default(), + balance: Default::default(), + storage: Default::default(), + code: REVERT_BYTECODE.to_vec(), + }, + ) + }) + .chain([ + // Testing account. + ( + H160::from_str("0x6be02d1d3665660d22ff9624b7be0551ee1ac91b") + .unwrap(), + GenesisAccount { + balance: (10_000_000 * UNIT).into(), + code: Default::default(), + nonce: Default::default(), + storage: Default::default(), + }, + ), + // Benchmarking account. + ( + H160::from_str("1000000000000000000000000000000000000001").unwrap(), + GenesisAccount { + nonce: 1.into(), + balance: (10_000_000 * UNIT).into(), + storage: Default::default(), + code: vec![0x00], + }, + ), + ]), + ) + }, + }, + base_fee: Default::default(), + } +} + +pub fn genesis_config() -> ChainSpec { + unimplemented!("TODO") +} diff --git a/node/src/command.rs b/node/src/command.rs index eb3a59152..d5a58fd48 100644 --- a/node/src/command.rs +++ b/node/src/command.rs @@ -17,19 +17,19 @@ // along with Darwinia. If not, see . // std -use std::net::SocketAddr; +use std::{env, net::SocketAddr, path::PathBuf}; // crates.io use codec::Encode; // cumulus use cumulus_primitives_core::ParaId; // darwinia use crate::{ - chain_spec, + chain_spec::*, cli::{Cli, RelayChainCli, Subcommand}, frontier_service, - service::{self, DarwiniaRuntimeExecutor}, + service::{self, *}, }; -use darwinia_runtime::{Block, RuntimeApi}; +use dc_primitives::Block; // frontier use fc_db::frontier_database_dir; // substrate @@ -42,26 +42,9 @@ use sc_service::{ config::{BasePath, PrometheusConfig}, DatabaseSource, PartialComponents, TaskManager, }; -use sp_core::hexdisplay::HexDisplay; +use sp_core::{crypto::Ss58AddressFormatRegistry, hexdisplay::HexDisplay}; use sp_runtime::traits::{AccountIdConversion, Block as BlockT}; -macro_rules! construct_async_run { - (|$components:ident, $cli:ident, $cmd:ident, $config:ident| $( $code:tt )* ) => {{ - let runner = $cli.create_runner($cmd)?; - runner.async_run(|$config| { - let $components = service::new_partial::< - RuntimeApi, - DarwiniaRuntimeExecutor, - >( - &$config, - &$cli.eth_args.build_eth_rpc_config() - )?; - let task_manager = $components.task_manager; - { $( $code )* }.map(|v| (v, task_manager)) - }) - }} -} - impl SubstrateCli for Cli { fn impl_name() -> String { "Darwinia".into() @@ -97,8 +80,14 @@ impl SubstrateCli for Cli { load_spec(id) } - fn native_runtime_version(_: &Box) -> &'static RuntimeVersion { - &darwinia_runtime::VERSION + fn native_runtime_version(spec: &Box) -> &'static RuntimeVersion { + if spec.is_crab() { + &crab_runtime::VERSION + } else if spec.is_pangolin() { + &pangolin_runtime::VERSION + } else { + &darwinia_runtime::VERSION + } } } @@ -126,11 +115,11 @@ impl SubstrateCli for RelayChainCli { } fn support_url() -> String { - "https://github.com/paritytech/cumulus/issues/new".into() + "https://github.com/darwinia-network/darwinia/issues/new".into() } fn copyright_start_year() -> i32 { - 2020 + 2018 } fn load_spec(&self, id: &str) -> std::result::Result, String> { @@ -276,6 +265,78 @@ impl CliConfiguration for RelayChainCli { /// Parse command line arguments into service configuration. pub fn run() -> Result<()> { + /// Creates partial components for the runtimes that are supported by the benchmarks. + macro_rules! construct_benchmark_partials { + ($config:expr, $cli:ident, |$partials:ident| $code:expr) => { + if $config.chain_spec.is_crab() { + let $partials = new_partial::( + &$config, + &$cli.eth_args.build_eth_rpc_config(), + )?; + $code + } else if $config.chain_spec.is_pangolin() { + let $partials = new_partial::( + &$config, + &$cli.eth_args.build_eth_rpc_config(), + )?; + $code + } else { + let $partials = new_partial::( + &$config, + &$cli.eth_args.build_eth_rpc_config(), + )?; + $code + } + }; + } + + macro_rules! construct_async_run { + (|$components:ident, $cli:ident, $cmd:ident, $config:ident| $( $code:tt )* ) => {{ + let runner = $cli.create_runner($cmd)?; + let chain_spec = &runner.config().chain_spec; + + set_default_ss58_version(chain_spec); + + if chain_spec.is_crab() { + runner.async_run(|$config| { + let $components = service::new_partial::< + CrabRuntimeApi, + CrabRuntimeExecutor, + >( + &$config, + &$cli.eth_args.build_eth_rpc_config() + )?; + let task_manager = $components.task_manager; + { $( $code )* }.map(|v| (v, task_manager)) + }) + } else if chain_spec.is_pangolin() { + runner.async_run(|$config| { + let $components = service::new_partial::< + PangolinRuntimeApi, + PangolinRuntimeExecutor, + >( + &$config, + &$cli.eth_args.build_eth_rpc_config() + )?; + let task_manager = $components.task_manager; + { $( $code )* }.map(|v| (v, task_manager)) + }) + } else { + runner.async_run(|$config| { + let $components = service::new_partial::< + DarwiniaRuntimeApi, + DarwiniaRuntimeExecutor, + >( + &$config, + &$cli.eth_args.build_eth_rpc_config() + )?; + let task_manager = $components.task_manager; + { $( $code )* }.map(|v| (v, task_manager)) + }) + } + }} + } + let cli = Cli::from_args(); match &cli.subcommand { @@ -364,12 +425,28 @@ pub fn run() -> Result<()> { let runner = cli.create_runner(cmd)?; runner.sync_run(|config| { - let PartialComponents { client, other: (frontier_backend, ..), .. } = - service::new_partial::( - &config, - &cli.eth_args.build_eth_rpc_config(), - )?; - cmd.run::<_, dc_primitives::Block>(client, frontier_backend) + if config.chain_spec.is_crab() { + let PartialComponents { client, other: (frontier_backend, ..), .. } = + service::new_partial::( + &config, + &cli.eth_args.build_eth_rpc_config(), + )?; + cmd.run::<_, dc_primitives::Block>(client, frontier_backend) + } else if config.chain_spec.is_pangolin() { + let PartialComponents { client, other: (frontier_backend, ..), .. } = + service::new_partial::( + &config, + &cli.eth_args.build_eth_rpc_config(), + )?; + cmd.run::<_, dc_primitives::Block>(client, frontier_backend) + } else { + let PartialComponents { client, other: (frontier_backend, ..), .. } = + service::new_partial::( + &config, + &cli.eth_args.build_eth_rpc_config(), + )?; + cmd.run::<_, dc_primitives::Block>(client, frontier_backend) + } }) }, Some(Subcommand::Benchmark(cmd)) => { @@ -379,18 +456,22 @@ pub fn run() -> Result<()> { match cmd { BenchmarkCmd::Pallet(cmd) => if cfg!(feature = "runtime-benchmarks") { - runner.sync_run(|config| cmd.run::(config)) + runner.sync_run(|config| { + if config.chain_spec.is_crab() { + cmd.run::(config) + } else if config.chain_spec.is_pangolin() { + cmd.run::(config) + } else { + cmd.run::(config) + } + }) } else { Err("Benchmarking wasn't enabled when building the node. \ You can enable it with `--features runtime-benchmarks`." .into()) }, BenchmarkCmd::Block(cmd) => runner.sync_run(|config| { - let partials = service::new_partial::( - &config, - &cli.eth_args.build_eth_rpc_config(), - )?; - cmd.run(partials.client) + construct_benchmark_partials!(config, cli, |partials| cmd.run(partials.client)) }), #[cfg(not(feature = "runtime-benchmarks"))] BenchmarkCmd::Storage(_) => Err(sc_cli::Error::Input( @@ -400,14 +481,12 @@ pub fn run() -> Result<()> { )), #[cfg(feature = "runtime-benchmarks")] BenchmarkCmd::Storage(cmd) => runner.sync_run(|config| { - let partials = service::new_partial::( - &config, - crate::service::parachain_build_import_queue, - )?; - let db = partials.backend.expose_db(); - let storage = partials.backend.expose_storage(); + construct_benchmark_partials!(config, cli, |partials| { + let db = partials.backend.expose_db(); + let storage = partials.backend.expose_storage(); - cmd.run(config, partials.client.clone(), db, storage) + cmd.run(config, partials.client.clone(), db, storage) + }) }), BenchmarkCmd::Machine(cmd) => runner.sync_run(|config| cmd.run(&config, SUBSTRATE_REFERENCE_HARDWARE.clone())), @@ -420,15 +499,28 @@ pub fn run() -> Result<()> { Some(Subcommand::TryRuntime(cmd)) => { if cfg!(feature = "try-runtime") { let runner = cli.create_runner(cmd)?; + let chain_spec = &runner.config().chain_spec; + + set_default_ss58_version(chain_spec); // grab the task manager. let registry = &runner.config().prometheus_config.as_ref().map(|cfg| &cfg.registry); let task_manager = TaskManager::new(runner.config().tokio_handle.clone(), *registry) .map_err(|e| format!("Error: {:?}", e))?; - runner.async_run(|config| { - Ok((cmd.run::(config), task_manager)) - }) + if chain_spec.is_crab() { + runner.async_run(|config| { + Ok((cmd.run::(config), task_manager)) + }) + } else if chain_spec.is_pangolin() { + runner.async_run(|config| { + Ok((cmd.run::(config), task_manager)) + }) + } else { + runner.async_run(|config| { + Ok((cmd.run::(config), task_manager)) + }) + } } else { Err("Try-runtime must be enabled by `--features try-runtime`.".into()) } @@ -438,6 +530,7 @@ pub fn run() -> Result<()> { let collator_options = cli.run.collator_options(); runner.run_node_until_exit(|config| async move { + let chain_spec = &config.chain_spec; let hwbench = if !cli.no_hardware_benchmarks { config.database.path().map(|database_path| { let _ = std::fs::create_dir_all(database_path); @@ -446,7 +539,10 @@ pub fn run() -> Result<()> { } else { None }; - let para_id = chain_spec::Extensions::try_get(&*config.chain_spec) + + set_default_ss58_version(chain_spec); + + let para_id = Extensions::try_get(&*config.chain_spec) .map(|e| e.para_id) .ok_or("Could not find parachain ID in chain-spec.")?; let polkadot_cli = RelayChainCli::new( @@ -492,10 +588,60 @@ pub fn run() -> Result<()> { } fn load_spec(id: &str) -> std::result::Result, String> { - Ok(match id { - "dev" => Box::new(chain_spec::development_config()), - "" | "local" => Box::new(chain_spec::local_testnet_config()), - "shell" => Box::new(chain_spec::shell_config()), - path => Box::new(chain_spec::ChainSpec::from_json_file(std::path::PathBuf::from(path))?), + let id = if id.is_empty() { + let n = get_exec_name().unwrap_or_default(); + ["darwinia", "crab", "pangolin"] + .iter() + .cloned() + .find(|&chain| n.starts_with(chain)) + .unwrap_or("darwinia") + } else { + id + }; + + Ok(match id.to_lowercase().as_ref() { + "darwinia" => Box::new(darwinia_chain_spec::config()), + "darwinia-genesis" => Box::new(darwinia_chain_spec::genesis_config()), + "darwinia-dev" => Box::new(darwinia_chain_spec::development_config()), + "darwinia-local" => Box::new(darwinia_chain_spec::local_testnet_config()), + "crab" => Box::new(crab_chain_spec::config()), + "crab-genesis" => Box::new(crab_chain_spec::genesis_config()), + "crab-dev" => Box::new(crab_chain_spec::development_config()), + "crab-local" => Box::new(crab_chain_spec::local_testnet_config()), + "pangolin" => Box::new(pangolin_chain_spec::config()), + "pangolin-genesis" => Box::new(pangolin_chain_spec::genesis_config()), + "pangolin-dev" => Box::new(pangolin_chain_spec::development_config()), + "pangolin-local" => Box::new(pangolin_chain_spec::local_testnet_config()), + _ => { + let path = PathBuf::from(id); + let chain_spec = + Box::new(DarwiniaChainSpec::from_json_file(path.clone())?) as Box; + + if chain_spec.is_crab() { + Box::new(CrabChainSpec::from_json_file(path)?) + } else if chain_spec.is_pangolin() { + Box::new(PangolinChainSpec::from_json_file(path)?) + } else { + chain_spec + } + }, }) } + +fn get_exec_name() -> Option { + env::current_exe() + .ok() + .and_then(|pb| pb.file_name().map(|s| s.to_os_string())) + .and_then(|s| s.into_string().ok()) +} + +fn set_default_ss58_version(chain_spec: &dyn IdentifyVariant) { + let ss58_version = if chain_spec.is_crab() || chain_spec.is_pangolin() { + Ss58AddressFormatRegistry::SubstrateAccount + } else { + Ss58AddressFormatRegistry::DarwiniaAccount + } + .into(); + + sp_core::crypto::set_default_ss58_version(ss58_version); +} diff --git a/node/src/service/executors.rs b/node/src/service/executors.rs new file mode 100644 index 000000000..d11a4cded --- /dev/null +++ b/node/src/service/executors.rs @@ -0,0 +1,71 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// substrate +use sc_executor::{NativeExecutionDispatch, NativeVersion}; + +/// Darwinia native executor instance. +pub struct DarwiniaRuntimeExecutor; +impl NativeExecutionDispatch for DarwiniaRuntimeExecutor { + #[cfg(feature = "runtime-benchmarks")] + type ExtendHostFunctions = frame_benchmarking::benchmarking::HostFunctions; + #[cfg(not(feature = "runtime-benchmarks"))] + type ExtendHostFunctions = (); + + fn dispatch(method: &str, data: &[u8]) -> Option> { + darwinia_runtime::api::dispatch(method, data) + } + + fn native_version() -> NativeVersion { + darwinia_runtime::native_version() + } +} + +/// Crab native executor instance. +pub struct CrabRuntimeExecutor; +impl NativeExecutionDispatch for CrabRuntimeExecutor { + #[cfg(feature = "runtime-benchmarks")] + type ExtendHostFunctions = frame_benchmarking::benchmarking::HostFunctions; + #[cfg(not(feature = "runtime-benchmarks"))] + type ExtendHostFunctions = (); + + fn dispatch(method: &str, data: &[u8]) -> Option> { + crab_runtime::api::dispatch(method, data) + } + + fn native_version() -> NativeVersion { + crab_runtime::native_version() + } +} + +/// Pangolin native executor instance. +pub struct PangolinRuntimeExecutor; +impl NativeExecutionDispatch for PangolinRuntimeExecutor { + #[cfg(feature = "runtime-benchmarks")] + type ExtendHostFunctions = frame_benchmarking::benchmarking::HostFunctions; + #[cfg(not(feature = "runtime-benchmarks"))] + type ExtendHostFunctions = (); + + fn dispatch(method: &str, data: &[u8]) -> Option> { + pangolin_runtime::api::dispatch(method, data) + } + + fn native_version() -> NativeVersion { + pangolin_runtime::native_version() + } +} diff --git a/node/src/service.rs b/node/src/service/mod.rs similarity index 95% rename from node/src/service.rs rename to node/src/service/mod.rs index a885556c3..bf351bbe3 100644 --- a/node/src/service.rs +++ b/node/src/service/mod.rs @@ -18,6 +18,13 @@ //! Service and service factory implementation. Specialized wrapper over substrate service. +pub mod executors; +pub use executors::*; + +pub use crab_runtime::RuntimeApi as CrabRuntimeApi; +pub use darwinia_runtime::RuntimeApi as DarwiniaRuntimeApi; +pub use pangolin_runtime::RuntimeApi as PangolinRuntimeApi; + // std use std::{ collections::BTreeMap, @@ -37,6 +44,31 @@ type FullBackend = sc_service::TFullBackend; type FullClient = sc_service::TFullClient>; +/// Can be called for a `Configuration` to check if it is a configuration for the `Crab` network. +pub trait IdentifyVariant { + /// Returns if this is a configuration for the `Crab` network. + fn is_crab(&self) -> bool; + + /// Returns if this is a configuration for the `Pangolin` network. + fn is_pangolin(&self) -> bool; + + /// Returns true if this configuration is for a development network. + fn is_dev(&self) -> bool; +} +impl IdentifyVariant for Box { + fn is_crab(&self) -> bool { + self.id().starts_with("crab") + } + + fn is_pangolin(&self) -> bool { + self.id().starts_with("pangolin") + } + + fn is_dev(&self) -> bool { + self.id().ends_with("dev") + } +} + /// A set of APIs that darwinia-like runtimes must implement. pub trait RuntimeApiCollection: cumulus_primitives_core::CollectCollationInfo @@ -69,20 +101,6 @@ impl RuntimeApiCollection for Api where { } -/// Native executor instance. -pub struct DarwiniaRuntimeExecutor; -impl sc_executor::NativeExecutionDispatch for DarwiniaRuntimeExecutor { - type ExtendHostFunctions = frame_benchmarking::benchmarking::HostFunctions; - - fn dispatch(method: &str, data: &[u8]) -> Option> { - darwinia_runtime::api::dispatch(method, data) - } - - fn native_version() -> sc_executor::NativeVersion { - darwinia_runtime::native_version() - } -} - /// Starts a `ServiceBuilder` for a full service. /// /// Use this macro if you don't actually need the full service, but just the builder in order to diff --git a/runtime/crab/Cargo.toml b/runtime/crab/Cargo.toml new file mode 100644 index 000000000..b02e73ba3 --- /dev/null +++ b/runtime/crab/Cargo.toml @@ -0,0 +1,329 @@ +[package] +authors = ["Darwinia Network "] +description = "Crab runtime." +edition = "2021" +homepage = "https://darwinia.network" +license = "GPL-3.0" +name = "crab-runtime" +readme = "README.md" +repository = "https://github.com/darwinia-network/darwinia" +version = "6.0.0" + +[build-dependencies] +substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } + +[dependencies] +# crates.io +codec = { package = "parity-scale-codec", version = "3.2", default-features = false, features = ["derive"] } +scale-info = { version = "2.3", default-features = false, features = ["derive"] } +smallvec = { version = "1.10" } +static_assertions = { version = "1.1" } +# crates.io optional +array-bytes = { version = "4.1", optional = true } + +# cumulus +cumulus-pallet-aura-ext = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } +cumulus-pallet-dmp-queue = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } +cumulus-pallet-parachain-system = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } +cumulus-pallet-xcm = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } +cumulus-pallet-xcmp-queue = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } +cumulus-primitives-core = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } +cumulus-primitives-timestamp = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } +cumulus-primitives-utility = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } +pallet-collator-selection = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } +parachain-info = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } +# cumulus optional +cumulus-pallet-session-benchmarking = { optional = true, default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } + +# darwinia +darwinia-common-runtime = { default-features = false, path = "../common" } +darwinia-precompile-bls12-381 = { default-features = false, path = "../../precompiles/bls12-381" } +darwinia-precompile-state-storage = { default-features = false, path = "../../precompiles/state-storage" } +dc-primitives = { default-features = false, path = "../../core/primitives" } + +# darwinia-messages-substrate +bp-message-dispatch = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } +bp-messages = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } +bp-polkadot-core = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } +bp-runtime = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } +bridge-runtime-common = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } +pallet-bridge-dispatch = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } +pallet-bridge-grandpa = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } +pallet-bridge-messages = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } +pallet-fee-market = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } + +# frontier +fp-evm = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +fp-rpc = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +fp-self-contained = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +pallet-base-fee = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +pallet-ethereum = { default-features = false, features = ["forbid-evm-reentrancy"], git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +pallet-evm = { default-features = false, features = ["forbid-evm-reentrancy"], git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +pallet-evm-precompile-blake2 = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +pallet-evm-precompile-bn128 = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +pallet-evm-precompile-dispatch = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +pallet-evm-precompile-modexp = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +pallet-evm-precompile-simple = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } + +# moonbeam +xcm-primitives = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.30" } + +# polkadot +pallet-xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" } +polkadot-parachain = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" } +polkadot-runtime-common = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" } +xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" } +xcm-builder = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" } +xcm-executor = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" } + +# substrate +frame-executive = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +frame-system-rpc-runtime-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-aura = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-authorship = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-balances = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-collective = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-democracy = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-elections-phragmen = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-identity = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-membership = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-multisig = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-preimage = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-proxy = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-scheduler = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-session = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-sudo = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-timestamp = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-tips = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-transaction-payment = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-transaction-payment-rpc-runtime-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-treasury = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-utility = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-vesting = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-block-builder = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-consensus-aura = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-inherents = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-io = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-offchain = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-session = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-transaction-pool = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-version = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +# substrate optional +frame-benchmarking = { optional = true, default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +frame-system-benchmarking = { optional = true, default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +frame-try-runtime = { optional = true, default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } + +[features] +default = ["std"] +std = [ + # crates.io + "codec/std", + "scale-info/std", + + # cumulus + "cumulus-pallet-aura-ext/std", + "cumulus-pallet-dmp-queue/std", + "cumulus-pallet-parachain-system/std", + "cumulus-pallet-xcm/std", + "cumulus-pallet-xcmp-queue/std", + "cumulus-primitives-core/std", + "cumulus-primitives-timestamp/std", + "cumulus-primitives-utility/std", + "pallet-collator-selection/std", + "parachain-info/std", + # cumulus optional + "cumulus-pallet-session-benchmarking?/std", + + # darwinia + "darwinia-common-runtime/std", + "darwinia-precompile-bls12-381/std", + "darwinia-precompile-state-storage/std", + "dc-primitives/std", + + # darwinia-messages-substrate + "bp-message-dispatch/std", + "bp-messages/std", + "bp-runtime/std", + "bp-polkadot-core/std", + "bridge-runtime-common/std", + "pallet-bridge-dispatch/std", + "pallet-bridge-grandpa/std", + "pallet-bridge-messages/std", + "pallet-fee-market/std", + + # frontier + "fp-evm/std", + "fp-rpc/std", + "fp-self-contained/std", + "pallet-base-fee/std", + "pallet-ethereum/std", + "pallet-evm/std", + "pallet-evm-precompile-blake2/std", + "pallet-evm-precompile-bn128/std", + "pallet-evm-precompile-dispatch/std", + "pallet-evm-precompile-modexp/std", + "pallet-evm-precompile-simple/std", + + # moonbeam + "xcm-primitives/std", + + # polkadot + "pallet-xcm/std", + "polkadot-parachain/std", + "polkadot-runtime-common/std", + "xcm/std", + "xcm-builder/std", + "xcm-executor/std", + + # substrate + "frame-executive/std", + "frame-support/std", + "frame-system/std", + "frame-system-rpc-runtime-api/std", + "pallet-aura/std", + "pallet-authorship/std", + "pallet-balances/std", + "pallet-collective/std", + "pallet-democracy/std", + "pallet-elections-phragmen/std", + "pallet-membership/std", + "pallet-identity/std", + "pallet-multisig/std", + "pallet-preimage/std", + "pallet-proxy/std", + "pallet-scheduler/std", + "pallet-session/std", + "pallet-sudo/std", + "pallet-timestamp/std", + "pallet-tips/std", + "pallet-transaction-payment-rpc-runtime-api/std", + "pallet-transaction-payment/std", + "pallet-treasury/std", + "pallet-utility/std", + "pallet-vesting/std", + "sp-api/std", + "sp-block-builder/std", + "sp-consensus-aura/std", + "sp-core/std", + "sp-inherents/std", + "sp-io/std", + "sp-offchain/std", + "sp-runtime/std", + "sp-session/std", + "sp-std/std", + "sp-transaction-pool/std", + "sp-version/std", + # substrate optional + "frame-benchmarking?/std", + "frame-system-benchmarking?/std", + "frame-try-runtime?/std", + +] + +runtime-benchmarks = [ + # crates.io + "array-bytes", + + # cumulus + "pallet-collator-selection/runtime-benchmarks", + "cumulus-pallet-parachain-system/runtime-benchmarks", + "cumulus-pallet-xcmp-queue/runtime-benchmarks", + # cumulus optional + "cumulus-pallet-session-benchmarking/runtime-benchmarks", + + # darwinia-messages-substrate + "bridge-runtime-common/runtime-benchmarks", + "pallet-bridge-grandpa/runtime-benchmarks", + "pallet-bridge-messages/runtime-benchmarks", + "pallet-fee-market/runtime-benchmarks", + + # frontier + "pallet-ethereum/runtime-benchmarks", + "pallet-evm/runtime-benchmarks", + + # moonbeam + "xcm-primitives/runtime-benchmarks", + + # polkadot + "pallet-xcm/runtime-benchmarks", + "polkadot-parachain/runtime-benchmarks", + "polkadot-runtime-common/runtime-benchmarks", + "xcm-builder/runtime-benchmarks", + "xcm-executor/runtime-benchmarks", + + # substrate + "frame-support/runtime-benchmarks", + "frame-system/runtime-benchmarks", + "pallet-balances/runtime-benchmarks", + "pallet-collective/runtime-benchmarks", + "pallet-democracy/runtime-benchmarks", + "pallet-elections-phragmen/runtime-benchmarks", + "pallet-membership/runtime-benchmarks", + "pallet-identity/runtime-benchmarks", + "pallet-multisig/runtime-benchmarks", + "pallet-preimage/runtime-benchmarks", + "pallet-proxy/runtime-benchmarks", + "pallet-scheduler/runtime-benchmarks", + "pallet-timestamp/runtime-benchmarks", + "pallet-tips/runtime-benchmarks", + "pallet-treasury/runtime-benchmarks", + "pallet-utility/runtime-benchmarks", + "pallet-vesting/runtime-benchmarks", + "sp-runtime/runtime-benchmarks", + # substrate optional + "frame-benchmarking/runtime-benchmarks", + "frame-system-benchmarking/runtime-benchmarks", +] + +try-runtime = [ + # cumulus + "cumulus-pallet-aura-ext/try-runtime", + "cumulus-pallet-dmp-queue/try-runtime", + "cumulus-pallet-parachain-system/try-runtime", + "cumulus-pallet-xcm/try-runtime", + "cumulus-pallet-xcmp-queue/try-runtime", + "pallet-collator-selection/try-runtime", + "parachain-info/try-runtime", + + # frontier + "pallet-base-fee/try-runtime", + "pallet-ethereum/try-runtime", + "pallet-evm/try-runtime", + + # polkadot + "pallet-xcm/try-runtime", + "polkadot-runtime-common/try-runtime", + + # substrate + "frame-executive/try-runtime", + "frame-support/try-runtime", + "frame-system/try-runtime", + "pallet-aura/try-runtime", + "pallet-authorship/try-runtime", + "pallet-balances/try-runtime", + "pallet-collective/try-runtime", + "pallet-democracy/try-runtime", + "pallet-elections-phragmen/try-runtime", + "pallet-membership/try-runtime", + "pallet-identity/try-runtime", + "pallet-multisig/try-runtime", + "pallet-preimage/try-runtime", + "pallet-proxy/try-runtime", + "pallet-scheduler/try-runtime", + "pallet-session/try-runtime", + "pallet-sudo/try-runtime", + "pallet-timestamp/try-runtime", + "pallet-tips/try-runtime", + "pallet-transaction-payment/try-runtime", + "pallet-treasury/try-runtime", + "pallet-utility/try-runtime", + "pallet-vesting/try-runtime", + # substrate optional + "frame-try-runtime", +] diff --git a/runtime/crab/build.rs b/runtime/crab/build.rs new file mode 100644 index 000000000..e5513c875 --- /dev/null +++ b/runtime/crab/build.rs @@ -0,0 +1,24 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// crates.io +use substrate_wasm_builder::WasmBuilder; + +fn main() { + WasmBuilder::new().with_current_project().export_heap_base().import_memory().build() +} diff --git a/runtime/crab/src/lib.rs b/runtime/crab/src/lib.rs new file mode 100644 index 000000000..83b3b1a08 --- /dev/null +++ b/runtime/crab/src/lib.rs @@ -0,0 +1,752 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Darwinia runtime. + +#![cfg_attr(not(feature = "std"), no_std)] +#![recursion_limit = "256"] + +#[cfg(feature = "std")] +include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); + +mod pallets; +pub use pallets::*; + +mod weights; + +pub use sp_consensus_aura::sr25519::AuthorityId as AuraId; + +// cumulus +use cumulus_pallet_parachain_system::RelayNumberStrictlyIncreases; +// darwinia +use dc_primitives::*; +// polkadot +use xcm::latest::prelude::BodyId; +use xcm_executor::XcmExecutor; +// substrate +use frame_support::{ + dispatch::DispatchClass, + traits::{Imbalance, OnUnbalanced}, + weights::{ + ConstantMultiplier, Weight, WeightToFeeCoefficient, WeightToFeeCoefficients, + WeightToFeePolynomial, + }, + PalletId, +}; +use frame_system::EnsureRoot; +use sp_core::{crypto::KeyTypeId, OpaqueMetadata, H160, H256, U256}; +#[cfg(any(feature = "std", test))] +pub use sp_runtime::BuildStorage; +use sp_runtime::{ + generic, + traits::Block as BlockT, + transaction_validity::{TransactionSource, TransactionValidity}, + ApplyExtrinsicResult, +}; +pub use sp_runtime::{MultiAddress, Perbill, Permill}; +use sp_std::prelude::*; +#[cfg(feature = "std")] +use sp_version::NativeVersion; +use sp_version::RuntimeVersion; + +/// Block type as expected by this runtime. +pub type Block = generic::Block; + +/// A Block signed with a Justification +pub type SignedBlock = generic::SignedBlock; + +/// The SignedExtension to the basic transaction logic. +pub type SignedExtra = ( + frame_system::CheckNonZeroSender, + frame_system::CheckSpecVersion, + frame_system::CheckTxVersion, + frame_system::CheckGenesis, + frame_system::CheckEra, + frame_system::CheckNonce, + frame_system::CheckWeight, + pallet_transaction_payment::ChargeTransactionPayment, +); + +/// Unchecked extrinsic type as expected by this runtime. +pub type UncheckedExtrinsic = + fp_self_contained::UncheckedExtrinsic; + +/// Extrinsic type that has already been checked. +pub type CheckedExtrinsic = + fp_self_contained::CheckedExtrinsic; + +/// Executive: handles dispatch to the various modules. +pub type Executive = frame_executive::Executive< + Runtime, + Block, + frame_system::ChainContext, + Runtime, + AllPalletsWithSystem, +>; + +/// Darwinia proposal base fee. +pub const DARWINIA_PROPOSAL_REQUIREMENT: Balance = 5000 * UNIT; + +/// Runtime version. +#[sp_version::runtime_version] +pub const VERSION: RuntimeVersion = RuntimeVersion { + spec_name: sp_runtime::create_runtime_str!("Crab2"), + impl_name: sp_runtime::create_runtime_str!("DarwiniaOfficialRust"), + authoring_version: 0, + spec_version: 6_0_0_0, + impl_version: 0, + apis: RUNTIME_API_VERSIONS, + transaction_version: 0, + state_version: 0, +}; + +/// Deposit calculator for Darwinia. +/// 100 UNIT for the base fee, 102.4 UNIT/MB. +pub const fn darwinia_deposit(items: u32, bytes: u32) -> Balance { + // First try. + items as Balance * 100 * UNIT + (bytes as Balance) * 100 * MICROUNIT + // items as Balance * 100 * UNIT + (bytes as Balance) * 100 * MILLIUNIT +} + +// TODO: move to impl.rs +pub struct DealWithFees(sp_std::marker::PhantomData); +impl frame_support::traits::OnUnbalanced> + for DealWithFees +where + R: pallet_balances::Config, + R: pallet_balances::Config + pallet_treasury::Config, + pallet_treasury::Pallet: OnUnbalanced>, +{ + // this seems to be called for substrate-based transactions + fn on_unbalanceds( + mut fees_then_tips: impl Iterator>, + ) { + if let Some(fees) = fees_then_tips.next() { + // for fees, 80% are burned, 20% to the treasury + let (_, to_treasury) = fees.ration(80, 20); + + // Balances pallet automatically burns dropped Negative Imbalances by decreasing + // total_supply accordingly + as OnUnbalanced<_>>::on_unbalanced(to_treasury); + } + } + + // this is called from pallet_evm for Ethereum-based transactions + // (technically, it calls on_unbalanced, which calls this when non-zero) + fn on_nonzero_unbalanced(amount: pallet_balances::NegativeImbalance) { + // Balances pallet automatically burns dropped Negative Imbalances by decreasing + // total_supply accordingly + let (_, to_treasury) = amount.ration(80, 20); + + as OnUnbalanced<_>>::on_unbalanced(to_treasury); + } +} + +impl fp_self_contained::SelfContainedCall for RuntimeCall { + type SignedInfo = H160; + + fn is_self_contained(&self) -> bool { + match self { + RuntimeCall::Ethereum(call) => call.is_self_contained(), + _ => false, + } + } + + fn check_self_contained( + &self, + ) -> Option> + { + match self { + RuntimeCall::Ethereum(call) => call.check_self_contained(), + _ => None, + } + } + + fn validate_self_contained( + &self, + info: &Self::SignedInfo, + dispatch_info: &sp_runtime::traits::DispatchInfoOf, + len: usize, + ) -> Option { + match self { + RuntimeCall::Ethereum(call) => call.validate_self_contained(info, dispatch_info, len), + _ => None, + } + } + + fn pre_dispatch_self_contained( + &self, + info: &Self::SignedInfo, + dispatch_info: &sp_runtime::traits::DispatchInfoOf, + len: usize, + ) -> Option> { + match self { + RuntimeCall::Ethereum(call) => + call.pre_dispatch_self_contained(info, dispatch_info, len), + _ => None, + } + } + + fn apply_self_contained( + self, + info: Self::SignedInfo, + ) -> Option>> { + // substrate + use sp_runtime::traits::Dispatchable; + + match self { + call @ RuntimeCall::Ethereum(pallet_ethereum::Call::transact { .. }) => + Some(call.dispatch(RuntimeOrigin::from( + pallet_ethereum::RawOrigin::EthereumTransaction(info), + ))), + _ => None, + } + } +} + +/// Handles converting a weight scalar to a fee value, based on the scale and granularity of the +/// node's balance type. +/// +/// This should typically create a mapping between the following ranges: +/// - `[0, MAXIMUM_BLOCK_WEIGHT]` +/// - `[Balance::min, Balance::max]` +/// +/// Yet, it can be used for any other sort of change to weight-fee. Some examples being: +/// - Setting it to `0` will essentially disable the weight fee. +/// - Setting it to `1` will cause the literal `#[weight = x]` values to be charged. +pub struct WeightToFee; +impl WeightToFeePolynomial for WeightToFee { + type Balance = Balance; + + fn polynomial() -> WeightToFeeCoefficients { + // in Rococo, extrinsic base weight (smallest non-zero weight) is mapped to 1 MILLIUNIT: + // here, we map to 1/10 of that, or 1/10 MILLIUNIT + let p = MILLIUNIT / 10; + let q = 100 * Balance::from(weights::ExtrinsicBaseWeight::get().ref_time()); + smallvec::smallvec![WeightToFeeCoefficient { + degree: 1, + negative: false, + coeff_frac: Perbill::from_rational(p % q, q), + coeff_integer: p / q, + }] + } +} + +/// The version information used to identify this runtime when compiled natively. +#[cfg(feature = "std")] +pub fn native_version() -> NativeVersion { + NativeVersion { runtime_version: VERSION, can_author_with: Default::default() } +} + +// Create the runtime by composing the FRAME pallets that were previously configured. +frame_support::construct_runtime! { + pub enum Runtime where + Block = Block, + NodeBlock = dc_primitives::Block, + UncheckedExtrinsic = UncheckedExtrinsic, + { + // System stuff. + System: frame_system = 0, + ParachainSystem: cumulus_pallet_parachain_system = 1, + Timestamp: pallet_timestamp = 2, + ParachainInfo: parachain_info = 3, + + // Monetary stuff. + // Leave 4 here. + // To keep balances consistent with the existing XCM configurations. + Balances: pallet_balances = 5, + TransactionPayment: pallet_transaction_payment = 6, + + // Consensus stuff. + Authorship: pallet_authorship = 7, + CollatorSelection: pallet_collator_selection = 8, + Session: pallet_session = 9, + Aura: pallet_aura = 10, + AuraExt: cumulus_pallet_aura_ext = 11, + + // Governance stuff. + Democracy: pallet_democracy = 12, + Council: pallet_collective:: = 13, + TechnicalCommittee: pallet_collective:: = 14, + PhragmenElection: pallet_elections_phragmen = 15, + TechnicalMembership: pallet_membership:: = 16, + Treasury: pallet_treasury = 17, + Tips: pallet_tips = 18, + + // Utility stuff. + Sudo: pallet_sudo = 19, + Vesting: pallet_vesting = 20, + Utility: pallet_utility = 21, + Identity: pallet_identity = 22, + Scheduler: pallet_scheduler = 23, + Preimage: pallet_preimage = 24, + Proxy: pallet_proxy = 25, + Multisig: pallet_multisig = 26, + + // XCM stuff. + XcmpQueue: cumulus_pallet_xcmp_queue = 27, + PolkadotXcm: pallet_xcm = 28, + CumulusXcm: cumulus_pallet_xcm = 29, + DmpQueue: cumulus_pallet_dmp_queue = 30, + + // EVM stuff. + Ethereum: pallet_ethereum = 31, + Evm: pallet_evm = 32, + BaseFee: pallet_base_fee = 33, + } +} + +#[cfg(feature = "runtime-benchmarks")] +frame_benchmarking::define_benchmarks! { + [frame_system, SystemBench::] + [pallet_balances, Balances] + [pallet_session, SessionBench::] + [pallet_timestamp, Timestamp] + [pallet_collator_selection, CollatorSelection] + [cumulus_pallet_xcmp_queue, XcmpQueue] +} + +sp_api::impl_runtime_apis! { + impl sp_consensus_aura::AuraApi for Runtime { + fn slot_duration() -> sp_consensus_aura::SlotDuration { + sp_consensus_aura::SlotDuration::from_millis(Aura::slot_duration()) + } + + fn authorities() -> Vec { + Aura::authorities().into_inner() + } + } + + impl sp_api::Core for Runtime { + fn version() -> RuntimeVersion { + VERSION + } + + fn execute_block(block: Block) { + Executive::execute_block(block) + } + + fn initialize_block(header: &::Header) { + Executive::initialize_block(header) + } + } + + impl sp_api::Metadata for Runtime { + fn metadata() -> OpaqueMetadata { + OpaqueMetadata::new(Runtime::metadata().into()) + } + } + + impl sp_block_builder::BlockBuilder for Runtime { + fn apply_extrinsic(extrinsic: ::Extrinsic) -> ApplyExtrinsicResult { + Executive::apply_extrinsic(extrinsic) + } + + fn finalize_block() -> ::Header { + Executive::finalize_block() + } + + fn inherent_extrinsics(data: sp_inherents::InherentData) -> Vec<::Extrinsic> { + data.create_extrinsics() + } + + fn check_inherents( + block: Block, + data: sp_inherents::InherentData, + ) -> sp_inherents::CheckInherentsResult { + data.check_extrinsics(&block) + } + } + + impl sp_transaction_pool::runtime_api::TaggedTransactionQueue for Runtime { + fn validate_transaction( + source: TransactionSource, + tx: ::Extrinsic, + block_hash: ::Hash, + ) -> TransactionValidity { + Executive::validate_transaction(source, tx, block_hash) + } + } + + impl sp_offchain::OffchainWorkerApi for Runtime { + fn offchain_worker(header: &::Header) { + Executive::offchain_worker(header) + } + } + + impl sp_session::SessionKeys for Runtime { + fn generate_session_keys(seed: Option>) -> Vec { + SessionKeys::generate(seed) + } + + fn decode_session_keys( + encoded: Vec, + ) -> Option, KeyTypeId)>> { + SessionKeys::decode_into_raw_public_keys(&encoded) + } + } + + impl frame_system_rpc_runtime_api::AccountNonceApi for Runtime { + fn account_nonce(account: AccountId) -> Nonce { + System::account_nonce(account) + } + } + + impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi for Runtime { + fn query_info( + uxt: ::Extrinsic, + len: u32, + ) -> pallet_transaction_payment_rpc_runtime_api::RuntimeDispatchInfo { + TransactionPayment::query_info(uxt, len) + } + fn query_fee_details( + uxt: ::Extrinsic, + len: u32, + ) -> pallet_transaction_payment::FeeDetails { + TransactionPayment::query_fee_details(uxt, len) + } + } + + impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentCallApi + for Runtime + { + fn query_call_info( + call: RuntimeCall, + len: u32, + ) -> pallet_transaction_payment::RuntimeDispatchInfo { + TransactionPayment::query_call_info(call, len) + } + fn query_call_fee_details( + call: RuntimeCall, + len: u32, + ) -> pallet_transaction_payment::FeeDetails { + TransactionPayment::query_call_fee_details(call, len) + } + } + + impl cumulus_primitives_core::CollectCollationInfo for Runtime { + fn collect_collation_info(header: &::Header) -> cumulus_primitives_core::CollationInfo { + ParachainSystem::collect_collation_info(header) + } + } + + impl fp_rpc::EthereumRuntimeRPCApi for Runtime { + fn chain_id() -> u64 { + <::ChainId as frame_support::traits::Get>::get() + } + + fn account_basic(address: H160) -> pallet_evm::Account { + let (account, _) = Evm::account_basic(&address); + + account + } + + fn gas_price() -> U256 { + // frontier + use pallet_evm::FeeCalculator; + + let (gas_price, _) = ::FeeCalculator::min_gas_price(); + + gas_price + } + + fn account_code_at(address: H160) -> Vec { + Evm::account_codes(address) + } + + fn author() -> H160 { + >::find_author() + } + + fn storage_at(address: H160, index: U256) -> H256 { + let mut tmp = [0u8; 32]; + + index.to_big_endian(&mut tmp); + + Evm::account_storages(address, H256::from_slice(&tmp[..])) + } + + fn call( + from: H160, + to: H160, + data: Vec, + value: U256, + gas_limit: U256, + max_fee_per_gas: Option, + max_priority_fee_per_gas: Option, + nonce: Option, + estimate: bool, + access_list: Option)>>, + ) -> Result { + // frontier + use pallet_evm::Runner; + // substrate + use sp_runtime::traits::UniqueSaturatedInto; + + let config = if estimate { + let mut config = ::config().clone(); + config.estimate = true; + Some(config) + } else { + None + }; + + let is_transactional = false; + let validate = true; + #[allow(clippy::or_fun_call)] + let evm_config = config.as_ref().unwrap_or(::config()); + ::Runner::call( + from, + to, + data, + value, + gas_limit.unique_saturated_into(), + max_fee_per_gas, + max_priority_fee_per_gas, + nonce, + access_list.unwrap_or_default(), + is_transactional, + validate, + evm_config, + ).map_err(|err| err.error.into()) + } + + fn create( + from: H160, + data: Vec, + value: U256, + gas_limit: U256, + max_fee_per_gas: Option, + max_priority_fee_per_gas: Option, + nonce: Option, + estimate: bool, + access_list: Option)>>, + ) -> Result { + // frontier + use pallet_evm::Runner; + // substrate + use sp_runtime::traits::UniqueSaturatedInto; + + let config = if estimate { + let mut config = ::config().clone(); + config.estimate = true; + Some(config) + } else { + None + }; + + let is_transactional = false; + let validate = true; + #[allow(clippy::or_fun_call)] + let evm_config = config.as_ref().unwrap_or(::config()); + ::Runner::create( + from, + data, + value, + gas_limit.unique_saturated_into(), + max_fee_per_gas, + max_priority_fee_per_gas, + nonce, + access_list.unwrap_or_default(), + is_transactional, + validate, + evm_config, + ).map_err(|err| err.error.into()) + } + + fn current_transaction_statuses() -> Option> { + Ethereum::current_transaction_statuses() + } + + fn current_block() -> Option { + Ethereum::current_block() + } + + fn current_receipts() -> Option> { + Ethereum::current_receipts() + } + + fn current_all() -> ( + Option, + Option>, + Option> + ) { + ( + Ethereum::current_block(), + Ethereum::current_receipts(), + Ethereum::current_transaction_statuses() + ) + } + + fn extrinsic_filter( + xts: Vec<::Extrinsic>, + ) -> Vec { + xts.into_iter().filter_map(|xt| match xt.0.function { + RuntimeCall::Ethereum( + pallet_ethereum::Call::::transact { transaction } + ) => Some(transaction), + _ => None + }).collect::>() + } + + fn elasticity() -> Option { + Some(BaseFee::elasticity()) + } + } + + impl fp_rpc::ConvertTransactionRuntimeApi for Runtime { + fn convert_transaction( + transaction: pallet_ethereum::Transaction + ) -> ::Extrinsic { + UncheckedExtrinsic::new_unsigned( + pallet_ethereum::Call::::transact { transaction }.into(), + ) + } + } + + #[cfg(feature = "runtime-benchmarks")] + impl frame_benchmarking::Benchmark for Runtime { + fn benchmark_metadata(extra: bool) -> ( + Vec, + Vec, + ) { + // substrate + use frame_benchmarking::*; + use frame_support::traits::StorageInfoTrait; + use frame_system_benchmarking::Pallet as SystemBench; + use cumulus_pallet_session_benchmarking::Pallet as SessionBench; + + let mut list = Vec::::new(); + + list_benchmarks!(list, extra); + + let storage_info = AllPalletsWithSystem::storage_info(); + + (list, storage_info) + } + + fn dispatch_benchmark( + config: frame_benchmarking::BenchmarkConfig + ) -> Result, sp_runtime::RuntimeString> { + // substrate + use frame_benchmarking::*; + + use frame_system_benchmarking::Pallet as SystemBench; + impl frame_system_benchmarking::Config for Runtime {} + + use cumulus_pallet_session_benchmarking::Pallet as SessionBench; + impl cumulus_pallet_session_benchmarking::Config for Runtime {} + + let whitelist: Vec = vec![ + // Block Number + array_bytes::hex_into_unchecked("26aa394eea5630e07c48ae0c9558cef702a5c1b19ab7a04f536c519aca4983ac"), + // Total Issuance + array_bytes::hex_into_unchecked("c2261276cc9d1f8598ea4b6a74b15c2f57c875e4cff74148e4628f264b974c80"), + // Execution Phase + array_bytes::hex_into_unchecked("26aa394eea5630e07c48ae0c9558cef7ff553b5a9862a516939d82b3d3d8661a"), + // Event Count + array_bytes::hex_into_unchecked("26aa394eea5630e07c48ae0c9558cef70a98fdbe9ce6c55837576c60c7af3850"), + // System Events + array_bytes::hex_into_unchecked("26aa394eea5630e07c48ae0c9558cef780d41e5e16056765bc8461851072c9d7"), + ]; + + let mut batches = Vec::::new(); + let params = (&config, &whitelist); + + add_benchmarks!(params, batches); + + if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) } + + Ok(batches) + } + } + + #[cfg(feature = "try-runtime")] + impl frame_try_runtime::TryRuntime for Runtime { + fn on_runtime_upgrade() -> (Weight, Weight) { + // substrate + use frame_support::log; + + log::info!("try-runtime::on_runtime_upgrade"); + + let weight = Executive::try_runtime_upgrade().unwrap(); + + (weight, RuntimeBlockWeights::get().max_block) + } + + fn execute_block(block: Block, state_root_check: bool, select: frame_try_runtime::TryStateSelect) -> Weight { + // substrate + use frame_support::log; + + log::info!( + "try-runtime: executing block #{} ({:?}) / root checks: {:?} / sanity-checks: {:?}", + block.header.number, + block.header.hash(), + state_root_check, + select, + ); + + Executive::try_execute_block(block, state_root_check, select).expect("try_execute_block failed") + } + } +} + +struct CheckInherents; +impl cumulus_pallet_parachain_system::CheckInherents for CheckInherents { + fn check_inherents( + block: &Block, + relay_state_proof: &cumulus_pallet_parachain_system::RelayChainStateProof, + ) -> sp_inherents::CheckInherentsResult { + let relay_chain_slot = relay_state_proof + .read_slot() + .expect("Could not read the relay chain slot from the proof"); + + let inherent_data = + cumulus_primitives_timestamp::InherentDataProvider::from_relay_chain_slot_and_duration( + relay_chain_slot, + sp_std::time::Duration::from_secs(6), + ) + .create_inherent_data() + .expect("Could not create the timestamp inherent data"); + + inherent_data.check_extrinsics(block) + } +} +cumulus_pallet_parachain_system::register_validate_block! { + Runtime = Runtime, + BlockExecutor = cumulus_pallet_aura_ext::BlockExecutor::, + CheckInherents = CheckInherents, +} + +#[cfg(test)] +mod tests { + // darwinia + use super::{Runtime, WeightPerGas}; + // substrate + use frame_support::dispatch::DispatchClass; + + #[test] + fn configured_base_extrinsic_weight_is_evm_compatible() { + let min_ethereum_transaction_weight = WeightPerGas::get() * 21_000; + let base_extrinsic = ::BlockWeights::get() + .get(DispatchClass::Normal) + .base_extrinsic; + + assert!(base_extrinsic.ref_time() <= min_ethereum_transaction_weight.ref_time()); + } +} diff --git a/runtime/crab/src/pallets/aura.rs b/runtime/crab/src/pallets/aura.rs new file mode 100644 index 000000000..a185eb060 --- /dev/null +++ b/runtime/crab/src/pallets/aura.rs @@ -0,0 +1,26 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +impl pallet_aura::Config for Runtime { + type AuthorityId = AuraId; + type DisabledValidators = (); + type MaxAuthorities = ConstU32<100_000>; +} diff --git a/runtime/crab/src/pallets/aura_ext.rs b/runtime/crab/src/pallets/aura_ext.rs new file mode 100644 index 000000000..77c924dab --- /dev/null +++ b/runtime/crab/src/pallets/aura_ext.rs @@ -0,0 +1,22 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +impl cumulus_pallet_aura_ext::Config for Runtime {} diff --git a/runtime/crab/src/pallets/authorship.rs b/runtime/crab/src/pallets/authorship.rs new file mode 100644 index 000000000..eb48e3bdb --- /dev/null +++ b/runtime/crab/src/pallets/authorship.rs @@ -0,0 +1,27 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +impl pallet_authorship::Config for Runtime { + type EventHandler = (CollatorSelection,); + type FilterUncle = (); + type FindAuthor = pallet_session::FindAccountFromAuthorIndex; + type UncleGenerations = ConstU32<0>; +} diff --git a/runtime/crab/src/pallets/balances.rs b/runtime/crab/src/pallets/balances.rs new file mode 100644 index 000000000..2dbd63977 --- /dev/null +++ b/runtime/crab/src/pallets/balances.rs @@ -0,0 +1,32 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +impl pallet_balances::Config for Runtime { + type AccountStore = System; + type Balance = Balance; + type DustRemoval = (); + type ExistentialDeposit = ConstU128<0>; + type MaxLocks = ConstU32<50>; + type MaxReserves = ConstU32<50>; + type ReserveIdentifier = [u8; 8]; + type RuntimeEvent = RuntimeEvent; + type WeightInfo = weights::pallet_balances::WeightInfo; +} diff --git a/runtime/crab/src/pallets/base_fee.rs b/runtime/crab/src/pallets/base_fee.rs new file mode 100644 index 000000000..a7807d403 --- /dev/null +++ b/runtime/crab/src/pallets/base_fee.rs @@ -0,0 +1,47 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +frame_support::parameter_types! { + pub DefaultBaseFeePerGas: U256 = U256::from(1_000_000_000); + pub DefaultElasticity: Permill = Permill::from_parts(125_000); +} + +pub struct BaseFeeThreshold; +impl pallet_base_fee::BaseFeeThreshold for BaseFeeThreshold { + fn lower() -> Permill { + Permill::zero() + } + + fn ideal() -> Permill { + Permill::from_parts(500_000) + } + + fn upper() -> Permill { + Permill::from_parts(1_000_000) + } +} + +impl pallet_base_fee::Config for Runtime { + type DefaultBaseFeePerGas = DefaultBaseFeePerGas; + type DefaultElasticity = DefaultElasticity; + type RuntimeEvent = RuntimeEvent; + type Threshold = BaseFeeThreshold; +} diff --git a/runtime/crab/src/pallets/collator_selection.rs b/runtime/crab/src/pallets/collator_selection.rs new file mode 100644 index 000000000..610420061 --- /dev/null +++ b/runtime/crab/src/pallets/collator_selection.rs @@ -0,0 +1,47 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +// We allow root only to execute privileged collator selection operations. +pub type CollatorSelectionUpdateOrigin = EnsureRoot; +frame_support::parameter_types! { + pub const PotId: PalletId = PalletId(*b"PotStake"); + pub const MaxCandidates: u32 = 1000; + pub const MinCandidates: u32 = 5; + pub const SessionLength: BlockNumber = 6 * HOURS; + pub const MaxInvulnerables: u32 = 100; + pub const ExecutiveBody: BodyId = BodyId::Executive; +} + +impl pallet_collator_selection::Config for Runtime { + type Currency = Balances; + // should be a multiple of session or things will get inconsistent + type KickThreshold = Period; + type MaxCandidates = MaxCandidates; + type MaxInvulnerables = MaxInvulnerables; + type MinCandidates = MinCandidates; + type PotId = PotId; + type RuntimeEvent = RuntimeEvent; + type UpdateOrigin = CollatorSelectionUpdateOrigin; + type ValidatorId = ::AccountId; + type ValidatorIdOf = pallet_collator_selection::IdentityCollator; + type ValidatorRegistration = Session; + type WeightInfo = weights::pallet_collator_selection::WeightInfo; +} diff --git a/runtime/crab/src/pallets/collective.rs b/runtime/crab/src/pallets/collective.rs new file mode 100644 index 000000000..6d4a215a7 --- /dev/null +++ b/runtime/crab/src/pallets/collective.rs @@ -0,0 +1,50 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +pub use pallet_collective::{Instance1 as CouncilCollective, Instance2 as TechnicalCollective}; + +// darwinia +use crate::*; + +pub const COLLECTIVE_DESIRED_MEMBERS: u32 = 7; +pub const COLLECTIVE_MAX_MEMBERS: u32 = 100; +pub const COLLECTIVE_MAX_PROPOSALS: u32 = 100; + +// Make sure that there are no more than `COLLECTIVE_MAX_MEMBERS` members elected via phragmen. +static_assertions::const_assert!(COLLECTIVE_DESIRED_MEMBERS <= COLLECTIVE_MAX_MEMBERS); + +impl pallet_collective::Config for Runtime { + type DefaultVote = pallet_collective::PrimeDefaultVote; + type MaxMembers = ConstU32; + type MaxProposals = ConstU32<100>; + type MotionDuration = ConstU32<{ 3 * DAYS }>; + type Proposal = RuntimeCall; + type RuntimeEvent = RuntimeEvent; + type RuntimeOrigin = RuntimeOrigin; + type WeightInfo = (); +} +impl pallet_collective::Config for Runtime { + type DefaultVote = pallet_collective::PrimeDefaultVote; + type MaxMembers = ConstU32; + type MaxProposals = ConstU32<100>; + type MotionDuration = ConstU32<{ 3 * DAYS }>; + type Proposal = RuntimeCall; + type RuntimeEvent = RuntimeEvent; + type RuntimeOrigin = RuntimeOrigin; + type WeightInfo = (); +} diff --git a/runtime/crab/src/pallets/democracy.rs b/runtime/crab/src/pallets/democracy.rs new file mode 100644 index 000000000..a54d9d4f4 --- /dev/null +++ b/runtime/crab/src/pallets/democracy.rs @@ -0,0 +1,64 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +const ENACTMENT_PERIOD: u32 = 28 * DAYS; + +impl pallet_democracy::Config for Runtime { + type BlacklistOrigin = Root; + // To cancel a proposal before it has been passed, the technical committee must be unanimous or + // Root must agree. + type CancelProposalOrigin = RootOrAll; + // To cancel a proposal which has been passed, 2/3 of the council must agree to it. + type CancellationOrigin = RootOrAtLeastTwoThird; + type CooloffPeriod = ConstU32<{ 7 * DAYS }>; + type Currency = Balances; + type EnactmentPeriod = ConstU32; + /// A unanimous council can have the next scheduled referendum be a straight default-carries + /// (NTB) vote. + type ExternalDefaultOrigin = RootOrAll; + /// A majority can have the next scheduled referendum be a straight majority-carries vote. + type ExternalMajorityOrigin = RootOrAtLeastHalf; + /// A straight majority of the council can decide what their next motion is. + type ExternalOrigin = RootOrAtLeastHalf; + /// Two thirds of the technical committee can have an ExternalMajority/ExternalDefault vote + /// be tabled immediately and with a shorter voting/enactment period. + type FastTrackOrigin = RootOrAtLeastTwoThird; + type FastTrackVotingPeriod = ConstU32<{ 3 * HOURS }>; + type InstantAllowed = ConstBool; + type InstantOrigin = RootOrAll; + type LaunchPeriod = ConstU32<{ 28 * DAYS }>; + type MaxProposals = ConstU32<100>; + type MaxVotes = ConstU32<100>; + type MinimumDeposit = ConstU128; + type OperationalPreimageOrigin = pallet_collective::EnsureMember; + type PalletsOrigin = OriginCaller; + type PreimageByteDeposit = ConstU128<{ darwinia_deposit(0, 1) }>; + type Proposal = RuntimeCall; + type RuntimeEvent = RuntimeEvent; + type Scheduler = Scheduler; + type Slash = Treasury; + // Any single technical committee member may veto a coming council proposal, however they can + // only do it once and it lasts only for the cool-off period. + type VetoOrigin = pallet_collective::EnsureMember; + type VoteLockingPeriod = ConstU32; + type VotingPeriod = ConstU32<{ 28 * DAYS }>; + type WeightInfo = (); +} diff --git a/runtime/crab/src/pallets/dmp_queue.rs b/runtime/crab/src/pallets/dmp_queue.rs new file mode 100644 index 000000000..6f0829542 --- /dev/null +++ b/runtime/crab/src/pallets/dmp_queue.rs @@ -0,0 +1,26 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +impl cumulus_pallet_dmp_queue::Config for Runtime { + type ExecuteOverweightOrigin = EnsureRoot; + type RuntimeEvent = RuntimeEvent; + type XcmExecutor = XcmExecutor; +} diff --git a/runtime/crab/src/pallets/elections_phragmen.rs b/runtime/crab/src/pallets/elections_phragmen.rs new file mode 100644 index 000000000..f637a0b98 --- /dev/null +++ b/runtime/crab/src/pallets/elections_phragmen.rs @@ -0,0 +1,49 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +const MAX_CANDIDATES: u32 = 30; + +frame_support::parameter_types! { + pub const PhragmenElectionPalletId: frame_support::traits::LockIdentifier = *b"phrelect"; +} + +impl pallet_elections_phragmen::Config for Runtime { + type CandidacyBond = ConstU128<{ 100 * MILLIUNIT }>; + type ChangeMembers = Council; + type Currency = Balances; + type CurrencyToVote = frame_support::traits::U128CurrencyToVote; + type DesiredMembers = ConstU32; + type DesiredRunnersUp = ConstU32<7>; + type InitializeMembers = Council; + type KickedMember = Treasury; + type LoserCandidate = Treasury; + type MaxCandidates = ConstU32; + type MaxVoters = ConstU32<{ 10 * MAX_CANDIDATES }>; + type PalletId = PhragmenElectionPalletId; + type RuntimeEvent = RuntimeEvent; + // Daily council elections. + type TermDuration = ConstU32<{ 7 * DAYS }>; + // 1 storage item created, key size is 32 bytes, value size is 16+16. + type VotingBondBase = ConstU128<{ darwinia_deposit(1, 64) }>; + // Additional data per vote is 32 bytes (account id). + type VotingBondFactor = ConstU128<{ darwinia_deposit(0, 32) }>; + type WeightInfo = (); +} diff --git a/runtime/crab/src/pallets/ethereum.rs b/runtime/crab/src/pallets/ethereum.rs new file mode 100644 index 000000000..074feb5ba --- /dev/null +++ b/runtime/crab/src/pallets/ethereum.rs @@ -0,0 +1,25 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +impl pallet_ethereum::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type StateRoot = pallet_ethereum::IntermediateStateRoot; +} diff --git a/runtime/crab/src/pallets/evm.rs b/runtime/crab/src/pallets/evm.rs new file mode 100644 index 000000000..fc8a98c68 --- /dev/null +++ b/runtime/crab/src/pallets/evm.rs @@ -0,0 +1,164 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; +use darwinia_precompile_bls12_381::BLS12381; +use darwinia_precompile_state_storage::{EthereumStorageFilter, StateStorage}; +// frontier +use pallet_ethereum::EthereumBlockHashMapping; +use pallet_evm::{ + AddressMapping, EnsureAddressNever, EnsureAddressRoot, FeeCalculator, FixedGasWeightMapping, + Precompile, PrecompileHandle, PrecompileResult, PrecompileSet, +}; +use pallet_evm_precompile_blake2::Blake2F; +use pallet_evm_precompile_bn128::{Bn128Add, Bn128Mul, Bn128Pairing}; +use pallet_evm_precompile_dispatch::Dispatch; +use pallet_evm_precompile_modexp::Modexp; +use pallet_evm_precompile_simple::{ECRecover, Identity, Ripemd160, Sha256}; +// substrate +use frame_support::{traits::FindAuthor, ConsensusEngineId}; +use sp_core::crypto::ByteArray; +use sp_std::marker::PhantomData; + +const WEIGHT_PER_GAS: u64 = 40_000; + +frame_support::parameter_types! { + pub BlockGasLimit: U256 = U256::from(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT.ref_time() / WEIGHT_PER_GAS); + pub PrecompilesValue: CrabPrecompiles = CrabPrecompiles::<_>::new(); + pub WeightPerGas: Weight = Weight::from_ref_time(WEIGHT_PER_GAS); +} + +pub struct FindAuthorTruncated(PhantomData); +impl> FindAuthor for FindAuthorTruncated { + fn find_author<'a, I>(digests: I) -> Option + where + I: 'a + IntoIterator, + { + F::find_author(digests).and_then(|i| { + Aura::authorities().get(i as usize).and_then(|id| { + let raw = id.to_raw_vec(); + + if raw.len() >= 24 { + Some(H160::from_slice(&raw[4..24])) + } else { + None + } + }) + }) + } +} + +pub struct FixedGasPrice; +impl FeeCalculator for FixedGasPrice { + fn min_gas_price() -> (U256, Weight) { + (U256::from(GWEI), Weight::zero()) + } +} + +// TODO: Integrate to the upstream repo +pub struct FromH160; +impl AddressMapping for FromH160 +where + T: From, +{ + fn into_account_id(address: H160) -> T { + address.into() + } +} + +pub struct CrabPrecompiles(PhantomData); +impl CrabPrecompiles +where + R: pallet_evm::Config, +{ + #[allow(clippy::new_without_default)] + pub fn new() -> Self { + Self(Default::default()) + } + + pub fn used_addresses() -> [H160; 12] { + [ + addr(1), + addr(2), + addr(3), + addr(4), + addr(5), + addr(6), + addr(7), + addr(8), + addr(9), + addr(1024), + addr(1025), + addr(2048), + ] + } +} +impl PrecompileSet for CrabPrecompiles +where + R: pallet_evm::Config, +{ + fn execute(&self, handle: &mut impl PrecompileHandle) -> Option { + match handle.code_address() { + // Ethereum precompiles: + a if a == addr(1) => Some(ECRecover::execute(handle)), + a if a == addr(2) => Some(Sha256::execute(handle)), + a if a == addr(3) => Some(Ripemd160::execute(handle)), + a if a == addr(4) => Some(Identity::execute(handle)), + a if a == addr(5) => Some(Modexp::execute(handle)), + a if a == addr(6) => Some(Bn128Add::execute(handle)), + a if a == addr(7) => Some(Bn128Mul::execute(handle)), + a if a == addr(8) => Some(Bn128Pairing::execute(handle)), + a if a == addr(9) => Some(Blake2F::execute(handle)), + // Darwinia precompiles: 1024+ for stable precompiles. + a if a == addr(1024) => + Some(>::execute(handle)), + a if a == addr(1025) => Some(>::execute(handle)), + // Darwinia precompiles: 2048+ for experimental precompiles. + a if a == addr(2048) => Some(>::execute(handle)), + _ => None, + } + } + + fn is_precompile(&self, address: H160) -> bool { + Self::used_addresses().contains(&address) + } +} + +impl pallet_evm::Config for Runtime { + type AddressMapping = FromH160; + type BlockGasLimit = BlockGasLimit; + type BlockHashMapping = EthereumBlockHashMapping; + type CallOrigin = EnsureAddressRoot; + type ChainId = ConstU64<43>; + type Currency = Balances; + type FeeCalculator = FixedGasPrice; + type FindAuthor = FindAuthorTruncated; + type GasWeightMapping = FixedGasWeightMapping; + type OnChargeTransaction = (); + type PrecompilesType = CrabPrecompiles; + type PrecompilesValue = PrecompilesValue; + type Runner = pallet_evm::runner::stack::Runner; + type RuntimeEvent = RuntimeEvent; + type WeightPerGas = WeightPerGas; + type WithdrawOrigin = EnsureAddressNever; +} + +fn addr(a: u64) -> H160 { + H160::from_low_u64_be(a) +} diff --git a/runtime/crab/src/pallets/identity.rs b/runtime/crab/src/pallets/identity.rs new file mode 100644 index 000000000..6ed7cbfd7 --- /dev/null +++ b/runtime/crab/src/pallets/identity.rs @@ -0,0 +1,39 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +impl pallet_identity::Config for Runtime { + // Minimum 100 bytes/UNIT deposited (1 MILLIUNIT/byte). + // 258 bytes on-chain. + type BasicDeposit = ConstU128<{ darwinia_deposit(1, 258) }>; + type Currency = Balances; + // 66 bytes on-chain. + type FieldDeposit = ConstU128<{ darwinia_deposit(0, 66) }>; + type ForceOrigin = RootOrMoreThanHalf; + type MaxAdditionalFields = ConstU32<100>; + type MaxRegistrars = ConstU32<20>; + type MaxSubAccounts = ConstU32<100>; + type RegistrarOrigin = RootOrMoreThanHalf; + type RuntimeEvent = RuntimeEvent; + type Slashed = Treasury; + // 53 bytes on-chain. + type SubAccountDeposit = ConstU128<{ darwinia_deposit(1, 53) }>; + type WeightInfo = (); +} diff --git a/runtime/crab/src/pallets/membership.rs b/runtime/crab/src/pallets/membership.rs new file mode 100644 index 000000000..2e5c3e9dc --- /dev/null +++ b/runtime/crab/src/pallets/membership.rs @@ -0,0 +1,33 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +impl pallet_membership::Config for Runtime { + type AddOrigin = RootOrMoreThanHalf; + type MaxMembers = ConstU32; + type MembershipChanged = TechnicalCommittee; + type MembershipInitialized = TechnicalCommittee; + type PrimeOrigin = RootOrMoreThanHalf; + type RemoveOrigin = RootOrMoreThanHalf; + type ResetOrigin = RootOrMoreThanHalf; + type RuntimeEvent = RuntimeEvent; + type SwapOrigin = RootOrMoreThanHalf; + type WeightInfo = (); +} diff --git a/runtime/crab/src/pallets/mod.rs b/runtime/crab/src/pallets/mod.rs new file mode 100644 index 000000000..3df9e4ccb --- /dev/null +++ b/runtime/crab/src/pallets/mod.rs @@ -0,0 +1,99 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +mod shared_imports { + // darwinia + pub use darwinia_common_runtime::gov_origin::*; + // substrate + pub use sp_runtime::traits::{ConstBool, ConstU128, ConstU16, ConstU32, ConstU64, ConstU8}; +} +pub use shared_imports::*; + +// System stuffs. +mod system; +pub use system::*; + +mod parachain_system; + +mod timestamp; + +mod parachain_info_; + +// Monetary stuff. +mod balances; + +mod transaction_payment; + +// Consensus stuff. +mod authorship; + +mod collator_selection; + +mod session; +pub use session::*; + +mod aura; + +mod aura_ext; + +// Governance stuff. +mod democracy; + +mod collective; +pub use collective::*; + +mod elections_phragmen; + +mod membership; + +mod treasury; + +mod tips; + +// Utility stuff. +mod sudo; + +mod vesting; + +mod utility; + +mod identity; + +mod scheduler; + +mod preimage; + +mod proxy; + +mod multisig; + +// XCM stuff. +mod xcmp_queue; + +mod polkadot_xcm; +pub use polkadot_xcm::*; + +mod dmp_queue; + +// EVM stuff. +mod ethereum; + +mod evm; +pub use evm::*; + +mod base_fee; diff --git a/runtime/crab/src/pallets/multisig.rs b/runtime/crab/src/pallets/multisig.rs new file mode 100644 index 000000000..0322271ae --- /dev/null +++ b/runtime/crab/src/pallets/multisig.rs @@ -0,0 +1,32 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +impl pallet_multisig::Config for Runtime { + type Currency = Balances; + // One storage item; key size is 32; value is size 4+4+16+32 bytes = 56 bytes. + type DepositBase = ConstU128<{ darwinia_deposit(1, 88) }>; + // Additional storage item size of 32 bytes. + type DepositFactor = ConstU128<{ darwinia_deposit(0, 32) }>; + type MaxSignatories = ConstU16<100>; + type RuntimeCall = RuntimeCall; + type RuntimeEvent = RuntimeEvent; + type WeightInfo = (); +} diff --git a/runtime/crab/src/pallets/parachain_info_.rs b/runtime/crab/src/pallets/parachain_info_.rs new file mode 100644 index 000000000..ff727f636 --- /dev/null +++ b/runtime/crab/src/pallets/parachain_info_.rs @@ -0,0 +1,22 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +impl parachain_info::Config for Runtime {} diff --git a/runtime/crab/src/pallets/parachain_system.rs b/runtime/crab/src/pallets/parachain_system.rs new file mode 100644 index 000000000..a97fd540a --- /dev/null +++ b/runtime/crab/src/pallets/parachain_system.rs @@ -0,0 +1,37 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +frame_support::parameter_types! { + pub const ReservedXcmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT.saturating_div(4); + pub const ReservedDmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT.saturating_div(4); +} + +impl cumulus_pallet_parachain_system::Config for Runtime { + type CheckAssociatedRelayNumber = RelayNumberStrictlyIncreases; + type DmpMessageHandler = DmpQueue; + type OnSystemEvent = (); + type OutboundXcmpMessageSource = XcmpQueue; + type ReservedDmpWeight = ReservedDmpWeight; + type ReservedXcmpWeight = ReservedXcmpWeight; + type RuntimeEvent = RuntimeEvent; + type SelfParaId = parachain_info::Pallet; + type XcmpMessageHandler = XcmpQueue; +} diff --git a/runtime/crab/src/pallets/polkadot_xcm.rs b/runtime/crab/src/pallets/polkadot_xcm.rs new file mode 100644 index 000000000..b4f1ccc66 --- /dev/null +++ b/runtime/crab/src/pallets/polkadot_xcm.rs @@ -0,0 +1,169 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; +use darwinia_common_runtime::xcm_barrier::*; +// moonbeam +use xcm_primitives::*; +// polkadot +use pallet_xcm::XcmPassthrough; +use polkadot_parachain::primitives::Sibling; +use xcm::latest::prelude::*; +use xcm_builder::*; +use xcm_executor::XcmExecutor; +// substrate +use frame_support::traits::{Everything, Nothing, PalletInfoAccess}; + +/// Means for transacting assets on this chain. +pub type LocalAssetTransactor = CurrencyAdapter< + // Use this currency: + Balances, + // Use this currency when it is a fungible asset matching the given location or name: + IsConcrete, + // Do a simple punn to convert an AccountId32 MultiLocation into a native chain account ID: + LocationToAccountId, + // Our chain's account ID type (we can't get away without mentioning it explicitly): + AccountId, + // We don't track any teleports. + (), +>; + +frame_support::parameter_types! { + pub const RelayNetwork: NetworkId = NetworkId::Kusama; + pub RelayChainOrigin: RuntimeOrigin = cumulus_pallet_xcm::Origin::Relay.into(); +} +/// Type for specifying how a `MultiLocation` can be converted into an `AccountId`. This is used +/// when determining ownership of accounts for asset transacting and when attempting to use XCM +/// `Transact` in order to determine the dispatch Origin. +pub type LocationToAccountId = ( + // The parent (Relay-chain) origin converts to the parent `AccountId`. + ParentIsPreset, + // Sibling parachain origins convert to AccountId via the `ParaId::into`. + SiblingParachainConvertsVia, + // Straight up local `AccountId20` origins just alias directly to `AccountId`. + AccountKey20Aliases, +); +/// This is the type we use to convert an (incoming) XCM origin into a local `Origin` instance, +/// ready for dispatching a transaction with Xcm's `Transact`. There is an `OriginKind` which can +/// biases the kind of local `Origin` it will become. +pub type XcmOriginToTransactDispatchOrigin = ( + // Sovereign account converter; this attempts to derive an `AccountId` from the origin location + // using `LocationToAccountId` and then turn that into the usual `Signed` origin. Useful for + // foreign chains who want to have a local sovereign account on this chain which they control. + SovereignSignedViaLocation, + // Native converter for Relay-chain (Parent) location; will converts to a `Relay` origin when + // recognized. + RelayChainAsNative, + // Native converter for sibling Parachains; will convert to a `SiblingPara` origin when + // recognized. + SiblingParachainAsNative, + // Native signed account converter; this just converts an `AccountKey20` origin into a normal + // `RuntimeOrigin::Signed` origin of the same 20-byte value. + SignedAccountKey20AsNative, + // Xcm origins can be represented natively under the Xcm pallet's Xcm origin. + XcmPassthrough, +); + +pub type Barrier = DenyThenTry< + DenyReserveTransferToRelayChain, + ( + TakeWeightCredit, + AllowTopLevelPaidExecutionFrom, + // Parent and its exec plurality get free execution + AllowUnpaidExecutionFrom, + // Expected responses are OK. + AllowKnownQueryResponses, + // Subscriptions for version tracking are OK. + AllowSubscriptionsFrom, + ), +>; + +frame_support::parameter_types! { + pub const MaxInstructions: u32 = 100; + pub AnchoringSelfReserve: MultiLocation = MultiLocation::new( + 0, + X1(PalletInstance(::index() as u8)) + ); + // One XCM operation is 1_000_000_000 weight - almost certainly a conservative estimate. + pub Ancestry: MultiLocation = Parachain(ParachainInfo::parachain_id().into()).into(); + pub UnitWeightCost: u64 = 1_000_000_000; +} + +pub struct XcmExecutorConfig; +impl xcm_executor::Config for XcmExecutorConfig { + type AssetClaims = PolkadotXcm; + // How to withdraw and deposit an asset. + type AssetTransactor = LocalAssetTransactor; + type AssetTrap = PolkadotXcm; + type Barrier = Barrier; + type IsReserve = NativeAsset; + type IsTeleporter = (); + // Teleporting is disabled. + type LocationInverter = LocationInverter; + type OriginConverter = XcmOriginToTransactDispatchOrigin; + type ResponseHandler = PolkadotXcm; + type RuntimeCall = RuntimeCall; + type SubscriptionService = PolkadotXcm; + type Trader = UsingComponents< + WeightToFee, + AnchoringSelfReserve, + AccountId, + Balances, + DealWithFees, + >; + type Weigher = FixedWeightBounds; + type XcmSender = XcmRouter; +} + +/// No local origins on this chain are allowed to dispatch XCM sends/executions. +pub type LocalOriginToLocation = SignedToAccountId20; +/// The means for routing XCM messages which are not for local execution into the right message +/// queues. +pub type XcmRouter = ( + // Two routers - use UMP to communicate with the relay chain: + cumulus_primitives_utility::ParentAsUmp, + // ..and XCMP to communicate with the sibling chains. + XcmpQueue, +); + +impl pallet_xcm::Config for Runtime { + // ^ Override for AdvertisedXcmVersion default + type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion; + type ExecuteXcmOrigin = EnsureXcmOrigin; + type LocationInverter = LocationInverter; + type RuntimeCall = RuntimeCall; + type RuntimeEvent = RuntimeEvent; + type RuntimeOrigin = RuntimeOrigin; + type SendXcmOrigin = EnsureXcmOrigin; + type Weigher = FixedWeightBounds; + type XcmExecuteFilter = Nothing; + // ^ Disable dispatchable execute on the XCM pallet. + // Needs to be `Everything` for local testing. + type XcmExecutor = XcmExecutor; + type XcmReserveTransferFilter = Nothing; + type XcmRouter = XcmRouter; + type XcmTeleportFilter = Nothing; + + const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100; +} + +impl cumulus_pallet_xcm::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type XcmExecutor = XcmExecutor; +} diff --git a/runtime/crab/src/pallets/preimage.rs b/runtime/crab/src/pallets/preimage.rs new file mode 100644 index 000000000..69fff06fc --- /dev/null +++ b/runtime/crab/src/pallets/preimage.rs @@ -0,0 +1,30 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +impl pallet_preimage::Config for Runtime { + type BaseDeposit = ConstU128<{ 500 * UNIT }>; + type ByteDeposit = ConstU128<{ darwinia_deposit(0, 1) }>; + type Currency = Balances; + type ManagerOrigin = Root; + type MaxSize = ConstU32<{ 4096 * 1024 }>; + type RuntimeEvent = RuntimeEvent; + type WeightInfo = (); +} diff --git a/runtime/crab/src/pallets/proxy.rs b/runtime/crab/src/pallets/proxy.rs new file mode 100644 index 000000000..172ea4e89 --- /dev/null +++ b/runtime/crab/src/pallets/proxy.rs @@ -0,0 +1,86 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +/// The type used to represent the kinds of proxying allowed. +#[derive( + Copy, + Clone, + Eq, + PartialEq, + Ord, + PartialOrd, + codec::Encode, + codec::Decode, + codec::MaxEncodedLen, + scale_info::TypeInfo, + sp_runtime::RuntimeDebug, +)] +pub enum ProxyType { + Any, + NonTransfer, + Governance, + IdentityJudgement, + EthereumBridge, +} +impl Default for ProxyType { + fn default() -> Self { + Self::Any + } +} +impl frame_support::traits::InstanceFilter for ProxyType { + // TODO: configure filter + fn filter(&self, _c: &RuntimeCall) -> bool { + match self { + ProxyType::Any => true, + ProxyType::NonTransfer => true, + ProxyType::Governance => true, + ProxyType::IdentityJudgement => true, + ProxyType::EthereumBridge => true, + } + } + + fn is_superset(&self, o: &Self) -> bool { + match (self, o) { + (x, y) if x == y => true, + (ProxyType::Any, _) => true, + (_, ProxyType::Any) => false, + (ProxyType::NonTransfer, _) => true, + _ => false, + } + } +} + +impl pallet_proxy::Config for Runtime { + type AnnouncementDepositBase = ConstU128<{ darwinia_deposit(1, 8) }>; + type AnnouncementDepositFactor = ConstU128<{ darwinia_deposit(0, 66) }>; + type CallHasher = Hashing; + type Currency = Balances; + type MaxPending = ConstU32<32>; + type MaxProxies = ConstU32<32>; + // One storage item; key size 32, value size 8; . + type ProxyDepositBase = ConstU128<{ darwinia_deposit(1, 8) }>; + // Additional storage item size of 33 bytes. + type ProxyDepositFactor = ConstU128<{ darwinia_deposit(0, 33) }>; + type ProxyType = ProxyType; + type RuntimeCall = RuntimeCall; + type RuntimeEvent = RuntimeEvent; + type WeightInfo = (); +} diff --git a/runtime/crab/src/pallets/scheduler.rs b/runtime/crab/src/pallets/scheduler.rs new file mode 100644 index 000000000..17aded6e8 --- /dev/null +++ b/runtime/crab/src/pallets/scheduler.rs @@ -0,0 +1,64 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +/// Used the compare the privilege of an origin inside the scheduler. +pub struct OriginPrivilegeCmp; +impl frame_support::traits::PrivilegeCmp for OriginPrivilegeCmp { + fn cmp_privilege(left: &OriginCaller, right: &OriginCaller) -> Option { + if left == right { + return Some(core::cmp::Ordering::Equal); + } + + match (left, right) { + // Root is greater than anything. + (OriginCaller::system(frame_system::RawOrigin::Root), _) => + Some(core::cmp::Ordering::Greater), + // Check which one has more yes votes. + ( + OriginCaller::Council(pallet_collective::RawOrigin::Members(l_yes_votes, l_count)), + OriginCaller::Council(pallet_collective::RawOrigin::Members(r_yes_votes, r_count)), + ) => Some((l_yes_votes * r_count).cmp(&(r_yes_votes * l_count))), + // For every other origin we don't care, as they are not used for `ScheduleOrigin`. + _ => None, + } + } +} + +frame_support::parameter_types! { + pub MaximumSchedulerWeight: frame_support::weights::Weight = sp_runtime::Perbill::from_percent(80) + * RuntimeBlockWeights::get().max_block; + // Retry a scheduled item every 10 blocks (1 minute) until the preimage exists. + pub const NoPreimagePostponement: Option = Some(10); +} + +impl pallet_scheduler::Config for Runtime { + type MaxScheduledPerBlock = ConstU32<50>; + type MaximumWeight = MaximumSchedulerWeight; + type NoPreimagePostponement = NoPreimagePostponement; + type OriginPrivilegeCmp = OriginPrivilegeCmp; + type PalletsOrigin = OriginCaller; + type PreimageProvider = Preimage; + type RuntimeCall = RuntimeCall; + type RuntimeEvent = RuntimeEvent; + type RuntimeOrigin = RuntimeOrigin; + type ScheduleOrigin = Root; + type WeightInfo = (); +} diff --git a/runtime/crab/src/pallets/session.rs b/runtime/crab/src/pallets/session.rs new file mode 100644 index 000000000..7725500ed --- /dev/null +++ b/runtime/crab/src/pallets/session.rs @@ -0,0 +1,45 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +sp_runtime::impl_opaque_keys! { + pub struct SessionKeys { + pub aura: Aura, + } +} + +frame_support::parameter_types! { + pub const Period: u32 = 6 * HOURS; + pub const Offset: u32 = 0; +} + +impl pallet_session::Config for Runtime { + type Keys = SessionKeys; + type NextSessionRotation = pallet_session::PeriodicSessions; + type RuntimeEvent = RuntimeEvent; + // Essentially just Aura, but lets be pedantic. + type SessionHandler = ::KeyTypeIdProviders; + type SessionManager = CollatorSelection; + type ShouldEndSession = pallet_session::PeriodicSessions; + type ValidatorId = ::AccountId; + // we don't have stash and controller, thus we don't need the convert as well. + type ValidatorIdOf = pallet_collator_selection::IdentityCollator; + type WeightInfo = weights::pallet_session::WeightInfo; +} diff --git a/runtime/crab/src/pallets/sudo.rs b/runtime/crab/src/pallets/sudo.rs new file mode 100644 index 000000000..e66cda23f --- /dev/null +++ b/runtime/crab/src/pallets/sudo.rs @@ -0,0 +1,25 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +impl pallet_sudo::Config for Runtime { + type RuntimeCall = RuntimeCall; + type RuntimeEvent = RuntimeEvent; +} diff --git a/runtime/crab/src/pallets/system.rs b/runtime/crab/src/pallets/system.rs new file mode 100644 index 000000000..bb07e9fea --- /dev/null +++ b/runtime/crab/src/pallets/system.rs @@ -0,0 +1,106 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +/// We assume that ~5% of the block weight is consumed by `on_initialize` handlers. This is +/// used to limit the maximal weight of a single extrinsic. +const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(5); + +/// We allow `Normal` extrinsics to fill up the block up to 75%, the rest can be used by +/// `Operational` extrinsics. +pub const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75); + +/// We allow for 0.5 of a second of compute with a 12 second average block time. +pub const MAXIMUM_BLOCK_WEIGHT: Weight = + frame_support::weights::constants::WEIGHT_PER_SECOND.saturating_div(2); + +frame_support::parameter_types! { + pub const Version: sp_version::RuntimeVersion = VERSION; + pub RuntimeBlockLength: frame_system::limits::BlockLength = + frame_system::limits::BlockLength::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO); + pub RuntimeBlockWeights: frame_system::limits::BlockWeights = frame_system::limits::BlockWeights::builder() + .base_block(weights::BlockExecutionWeight::get()) + .for_class(DispatchClass::all(), |weights| { + weights.base_extrinsic = weights::ExtrinsicBaseWeight::get(); + }) + .for_class(DispatchClass::Normal, |weights| { + weights.max_total = Some(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT); + }) + .for_class(DispatchClass::Operational, |weights| { + weights.max_total = Some(MAXIMUM_BLOCK_WEIGHT); + // Operational transactions have some extra reserved space, so that they + // are included even if block reached `MAXIMUM_BLOCK_WEIGHT`. + weights.reserved = Some( + MAXIMUM_BLOCK_WEIGHT - NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT + ); + }) + .avg_block_initialization(AVERAGE_ON_INITIALIZE_RATIO) + .build_or_panic(); +} + +impl frame_system::Config for Runtime { + /// The data to be stored in an account. + type AccountData = pallet_balances::AccountData; + /// The identifier used to distinguish between accounts. + type AccountId = AccountId; + /// The basic call filter to use in dispatchable. + type BaseCallFilter = frame_support::traits::Everything; + /// Maximum number of block number to block hash mappings to keep (oldest pruned first). + type BlockHashCount = ConstU32<2400>; + /// The maximum length of a block (in bytes). + type BlockLength = RuntimeBlockLength; + /// The index type for blocks. + type BlockNumber = BlockNumber; + /// Block & extrinsics weights: base values and limits. + type BlockWeights = RuntimeBlockWeights; + /// The weight of database operations that the runtime can invoke. + type DbWeight = weights::RocksDbWeight; + /// The type for hashing blocks and tries. + type Hash = Hash; + /// The hashing algorithm used. + type Hashing = Hashing; + /// The header type. + type Header = generic::Header; + /// The index type for storing how many extrinsics an account has signed. + type Index = Index; + /// The lookup mechanism to get account ID from whatever is passed in dispatchers. + type Lookup = sp_runtime::traits::IdentityLookup; + type MaxConsumers = frame_support::traits::ConstU32<16>; + /// What to do if an account is fully reaped from the system. + type OnKilledAccount = (); + /// What to do if a new account is created. + type OnNewAccount = (); + /// The action to take on a Runtime Upgrade + type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode; + /// Converts a module to an index of this module in the runtime. + type PalletInfo = PalletInfo; + /// The aggregated dispatch type that is available for extrinsics. + type RuntimeCall = RuntimeCall; + /// The ubiquitous event type. + type RuntimeEvent = RuntimeEvent; + /// The ubiquitous origin type. + type RuntimeOrigin = RuntimeOrigin; + /// This is used as an identifier of the chain. 42 is the generic substrate prefix. + type SS58Prefix = ConstU16<18>; + /// Weight information for the extrinsics of this pallet. + type SystemWeightInfo = weights::frame_system::WeightInfo; + /// Runtime version. + type Version = Version; +} diff --git a/runtime/crab/src/pallets/timestamp.rs b/runtime/crab/src/pallets/timestamp.rs new file mode 100644 index 000000000..9bf543250 --- /dev/null +++ b/runtime/crab/src/pallets/timestamp.rs @@ -0,0 +1,28 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +impl pallet_timestamp::Config for Runtime { + type MinimumPeriod = ConstU64<{ SLOT_DURATION / 2 }>; + /// A timestamp: milliseconds since the unix epoch. + type Moment = u64; + type OnTimestampSet = (); + type WeightInfo = weights::pallet_timestamp::WeightInfo; +} diff --git a/runtime/crab/src/pallets/tips.rs b/runtime/crab/src/pallets/tips.rs new file mode 100644 index 000000000..83f8cfb89 --- /dev/null +++ b/runtime/crab/src/pallets/tips.rs @@ -0,0 +1,35 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +frame_support::parameter_types! { + pub const TipFindersFee: sp_runtime::Percent = sp_runtime::Percent::from_percent(20); +} + +impl pallet_tips::Config for Runtime { + type DataDepositPerByte = ConstU128<{ darwinia_deposit(0, 1) }>; + type MaximumReasonLength = ConstU32<16384>; + type RuntimeEvent = RuntimeEvent; + type TipCountdown = ConstU32; + type TipFindersFee = TipFindersFee; + type TipReportDepositBase = ConstU128<{ 100 * UNIT }>; + type Tippers = PhragmenElection; + type WeightInfo = (); +} diff --git a/runtime/crab/src/pallets/transaction_payment.rs b/runtime/crab/src/pallets/transaction_payment.rs new file mode 100644 index 000000000..691273b7b --- /dev/null +++ b/runtime/crab/src/pallets/transaction_payment.rs @@ -0,0 +1,30 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +impl pallet_transaction_payment::Config for Runtime { + type FeeMultiplierUpdate = polkadot_runtime_common::SlowAdjustingFeeUpdate; + // Relay Chain `TransactionByteFee` / 10 + type LengthToFee = ConstantMultiplier>; + type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter; + type OperationalFeeMultiplier = sp_runtime::traits::ConstU8<5>; + type RuntimeEvent = RuntimeEvent; + type WeightToFee = WeightToFee; +} diff --git a/runtime/crab/src/pallets/treasury.rs b/runtime/crab/src/pallets/treasury.rs new file mode 100644 index 000000000..901df24b5 --- /dev/null +++ b/runtime/crab/src/pallets/treasury.rs @@ -0,0 +1,47 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +frame_support::parameter_types! { + pub const TreasuryPalletId: frame_support::PalletId = frame_support::PalletId(*b"da/trsry"); + pub const ProposalBond: sp_runtime::Permill = sp_runtime::Permill::from_percent(5); + pub const Burn: sp_runtime::Permill = sp_runtime::Permill::from_percent(1); +} + +// In order to use `Tips`, which bounded by `pallet_treasury::Config` rather +// `pallet_treasury::Config` Still use `DefaultInstance` here instead `Instance1` +impl pallet_treasury::Config for Runtime { + type ApproveOrigin = RootOrAtLeastThreeFifth; + type Burn = Burn; + type BurnDestination = (); + type Currency = Balances; + type MaxApprovals = ConstU32<100>; + type OnSlash = Treasury; + type PalletId = TreasuryPalletId; + type ProposalBond = ProposalBond; + type ProposalBondMaximum = (); + type ProposalBondMinimum = ConstU128; + type RejectOrigin = RootOrMoreThanHalf; + type RuntimeEvent = RuntimeEvent; + type SpendFunds = (); + type SpendOrigin = frame_support::traits::NeverEnsureOrigin; + type SpendPeriod = ConstU32<{ 24 * DAYS }>; + type WeightInfo = (); +} diff --git a/runtime/crab/src/pallets/utility.rs b/runtime/crab/src/pallets/utility.rs new file mode 100644 index 000000000..8bcc96517 --- /dev/null +++ b/runtime/crab/src/pallets/utility.rs @@ -0,0 +1,27 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +impl pallet_utility::Config for Runtime { + type PalletsOrigin = OriginCaller; + type RuntimeCall = RuntimeCall; + type RuntimeEvent = RuntimeEvent; + type WeightInfo = (); +} diff --git a/runtime/crab/src/pallets/vesting.rs b/runtime/crab/src/pallets/vesting.rs new file mode 100644 index 000000000..406b6956f --- /dev/null +++ b/runtime/crab/src/pallets/vesting.rs @@ -0,0 +1,32 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +impl pallet_vesting::Config for Runtime { + type BlockNumberToBalance = sp_runtime::traits::ConvertInto; + type Currency = Balances; + type MinVestedTransfer = ConstU128; + type RuntimeEvent = RuntimeEvent; + type WeightInfo = (); + + // `VestingInfo` encode length is 36bytes. 28 schedules gets encoded as 1009 bytes, which is the + // highest number of schedules that encodes less than 2^10. + const MAX_VESTING_SCHEDULES: u32 = 28; +} diff --git a/runtime/crab/src/pallets/xcmp_queue.rs b/runtime/crab/src/pallets/xcmp_queue.rs new file mode 100644 index 000000000..24be8be1a --- /dev/null +++ b/runtime/crab/src/pallets/xcmp_queue.rs @@ -0,0 +1,31 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +impl cumulus_pallet_xcmp_queue::Config for Runtime { + type ChannelInfo = ParachainSystem; + type ControllerOrigin = EnsureRoot; + type ControllerOriginConverter = XcmOriginToTransactDispatchOrigin; + type ExecuteOverweightOrigin = EnsureRoot; + type RuntimeEvent = RuntimeEvent; + type VersionWrapper = (); + type WeightInfo = weights::cumulus_pallet_xcmp_queue::WeightInfo; + type XcmExecutor = XcmExecutor; +} diff --git a/runtime/crab/src/weights/block_weights.rs b/runtime/crab/src/weights/block_weights.rs new file mode 100644 index 000000000..c00430733 --- /dev/null +++ b/runtime/crab/src/weights/block_weights.rs @@ -0,0 +1,52 @@ +// This file is part of Substrate. + +// Copyright (C) 2022 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. + +pub mod constants { + use frame_support::{ + parameter_types, + weights::{constants, Weight}, + }; + + parameter_types! { + /// Importing a block with 0 Extrinsics. + pub const BlockExecutionWeight: Weight = constants::WEIGHT_PER_NANOS.saturating_mul(5_000_000); + } + + #[cfg(test)] + mod test_weights { + use frame_support::weights::constants; + + /// Checks that the weight exists and is sane. + // NOTE: If this test fails but you are sure that the generated values are fine, + // you can delete it. + #[test] + fn sane() { + let w = super::constants::BlockExecutionWeight::get(); + + // At least 100 µs. + assert!( + w.ref_time() >= 100u64 * constants::WEIGHT_PER_MICROS.ref_time(), + "Weight should be at least 100 µs." + ); + // At most 50 ms. + assert!( + w.ref_time() <= 50u64 * constants::WEIGHT_PER_MILLIS.ref_time(), + "Weight should be at most 50 ms." + ); + } + } +} diff --git a/runtime/crab/src/weights/cumulus_pallet_xcmp_queue.rs b/runtime/crab/src/weights/cumulus_pallet_xcmp_queue.rs new file mode 100644 index 000000000..d018169e2 --- /dev/null +++ b/runtime/crab/src/weights/cumulus_pallet_xcmp_queue.rs @@ -0,0 +1,67 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `cumulus_pallet_xcmp_queue` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2022-11-09, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `inv.cafe`, CPU: `AMD Ryzen 9 5950X 16-Core Processor` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("local"), DB CACHE: 1024 + +// Executed Command: +// target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --chain +// local +// --output +// runtime/src/weights +// --extrinsic +// * +// --pallet +// cumulus-pallet-xcmp-queue + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `cumulus_pallet_xcmp_queue`. +pub struct WeightInfo(PhantomData); +impl cumulus_pallet_xcmp_queue::WeightInfo for WeightInfo { + // Storage: XcmpQueue QueueConfig (r:1 w:1) + fn set_config_with_u32() -> Weight { + Weight::from_ref_time(13_340_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: XcmpQueue QueueConfig (r:1 w:1) + fn set_config_with_weight() -> Weight { + Weight::from_ref_time(12_610_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } +} diff --git a/runtime/crab/src/weights/extrinsic_weights.rs b/runtime/crab/src/weights/extrinsic_weights.rs new file mode 100644 index 000000000..3ce6b73d5 --- /dev/null +++ b/runtime/crab/src/weights/extrinsic_weights.rs @@ -0,0 +1,52 @@ +// This file is part of Substrate. + +// Copyright (C) 2022 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. + +pub mod constants { + use frame_support::{ + parameter_types, + weights::{constants, Weight}, + }; + + parameter_types! { + /// Executing a NO-OP `System::remarks` Extrinsic. + pub const ExtrinsicBaseWeight: Weight = constants::WEIGHT_PER_NANOS.saturating_mul(125_000); + } + + #[cfg(test)] + mod test_weights { + use frame_support::weights::constants; + + /// Checks that the weight exists and is sane. + // NOTE: If this test fails but you are sure that the generated values are fine, + // you can delete it. + #[test] + fn sane() { + let w = super::constants::ExtrinsicBaseWeight::get(); + + // At least 10 µs. + assert!( + w.ref_time() >= 10u64 * constants::WEIGHT_PER_MICROS.ref_time(), + "Weight should be at least 10 µs." + ); + // At most 1 ms. + assert!( + w.ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(), + "Weight should be at most 1 ms." + ); + } + } +} diff --git a/runtime/crab/src/weights/frame_system.rs b/runtime/crab/src/weights/frame_system.rs new file mode 100644 index 000000000..b074be2fc --- /dev/null +++ b/runtime/crab/src/weights/frame_system.rs @@ -0,0 +1,88 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `frame_system` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2022-11-09, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `inv.cafe`, CPU: `AMD Ryzen 9 5950X 16-Core Processor` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("local"), DB CACHE: 1024 + +// Executed Command: +// target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --chain +// local +// --output +// runtime/src/weights +// --extrinsic +// * +// --pallet +// frame-system + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `frame_system`. +pub struct WeightInfo(PhantomData); +impl frame_system::WeightInfo for WeightInfo { + /// The range of component `b` is `[0, 3932160]`. + fn remark(_b: u32, ) -> Weight { + Weight::from_ref_time(1_074_555_000 as u64) + } + /// The range of component `b` is `[0, 3932160]`. + fn remark_with_event(_b: u32, ) -> Weight { + Weight::from_ref_time(4_724_488_000 as u64) + } + // Storage: System Digest (r:1 w:1) + // Storage: unknown [0x3a686561707061676573] (r:0 w:1) + fn set_heap_pages() -> Weight { + Weight::from_ref_time(14_110_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) + } + // Storage: Skipped Metadata (r:0 w:0) + /// The range of component `i` is `[1, 1000]`. + fn set_storage(_i: u32, ) -> Weight { + Weight::from_ref_time(655_299_000 as u64) + .saturating_add(T::DbWeight::get().writes(1000 as u64)) + } + // Storage: Skipped Metadata (r:0 w:0) + /// The range of component `i` is `[1, 1000]`. + fn kill_storage(_i: u32, ) -> Weight { + Weight::from_ref_time(555_697_000 as u64) + .saturating_add(T::DbWeight::get().writes(1000 as u64)) + } + // Storage: Skipped Metadata (r:0 w:0) + /// The range of component `p` is `[1, 1000]`. + fn kill_prefix(_p: u32, ) -> Weight { + Weight::from_ref_time(1_089_395_000 as u64) + .saturating_add(T::DbWeight::get().writes(1000 as u64)) + } +} diff --git a/runtime/crab/src/weights/mod.rs b/runtime/crab/src/weights/mod.rs new file mode 100644 index 000000000..74dbfcbbd --- /dev/null +++ b/runtime/crab/src/weights/mod.rs @@ -0,0 +1,40 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Expose the auto generated weight files. + +#![allow(clippy::unnecessary_cast)] + +pub mod block_weights; +pub use block_weights::constants::BlockExecutionWeight; + +pub mod extrinsic_weights; +pub use extrinsic_weights::constants::ExtrinsicBaseWeight; + +pub mod paritydb_weights; +pub use paritydb_weights::constants::ParityDbWeight; + +pub mod rocksdb_weights; +pub use rocksdb_weights::constants::RocksDbWeight; + +pub mod cumulus_pallet_xcmp_queue; +pub mod frame_system; +pub mod pallet_balances; +pub mod pallet_collator_selection; +pub mod pallet_session; +pub mod pallet_timestamp; diff --git a/runtime/crab/src/weights/pallet_balances.rs b/runtime/crab/src/weights/pallet_balances.rs new file mode 100644 index 000000000..830c7c8cb --- /dev/null +++ b/runtime/crab/src/weights/pallet_balances.rs @@ -0,0 +1,97 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `pallet_balances` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2022-11-09, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `inv.cafe`, CPU: `AMD Ryzen 9 5950X 16-Core Processor` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("local"), DB CACHE: 1024 + +// Executed Command: +// target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --chain +// local +// --output +// runtime/src/weights +// --extrinsic +// * +// --pallet +// pallet-balances + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_balances`. +pub struct WeightInfo(PhantomData); +impl pallet_balances::WeightInfo for WeightInfo { + // Storage: System Account (r:1 w:1) + fn transfer() -> Weight { + Weight::from_ref_time(57_141_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: System Account (r:1 w:1) + fn transfer_keep_alive() -> Weight { + Weight::from_ref_time(43_271_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: System Account (r:1 w:1) + fn set_balance_creating() -> Weight { + Weight::from_ref_time(29_941_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: System Account (r:1 w:1) + fn set_balance_killing() -> Weight { + Weight::from_ref_time(34_490_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: System Account (r:2 w:2) + fn force_transfer() -> Weight { + Weight::from_ref_time(54_911_000 as u64) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) + } + // Storage: System Account (r:1 w:1) + fn transfer_all() -> Weight { + Weight::from_ref_time(49_671_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: System Account (r:1 w:1) + fn force_unreserve() -> Weight { + Weight::from_ref_time(26_120_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } +} diff --git a/runtime/crab/src/weights/pallet_collator_selection.rs b/runtime/crab/src/weights/pallet_collator_selection.rs new file mode 100644 index 000000000..affdfcef8 --- /dev/null +++ b/runtime/crab/src/weights/pallet_collator_selection.rs @@ -0,0 +1,111 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `pallet_collator_selection` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2022-11-09, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `inv.cafe`, CPU: `AMD Ryzen 9 5950X 16-Core Processor` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("local"), DB CACHE: 1024 + +// Executed Command: +// target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --chain +// local +// --output +// runtime/src/weights +// --extrinsic +// set_invulnerables,set_desired_candidates,set_candidacy_bond,leave_intent,new_session,note_author +// --pallet +// pallet-collator-selection + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_collator_selection`. +pub struct WeightInfo(PhantomData); +impl pallet_collator_selection::WeightInfo for WeightInfo { + // Storage: Session NextKeys (r:1 w:0) + // Storage: CollatorSelection Invulnerables (r:0 w:1) + /// The range of component `b` is `[1, 100]`. + fn set_invulnerables(_b: u32, ) -> Weight { + Weight::from_ref_time(317_565_000 as u64) + .saturating_add(T::DbWeight::get().reads(100 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: CollatorSelection DesiredCandidates (r:0 w:1) + fn set_desired_candidates() -> Weight { + Weight::from_ref_time(19_951_000 as u64) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: CollatorSelection CandidacyBond (r:0 w:1) + fn set_candidacy_bond() -> Weight { + Weight::from_ref_time(19_730_000 as u64) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + fn register_as_candidate(c: u32) -> Weight { + Weight::from_ref_time(71_196_000 as u64) + // Standard Error: 0 + .saturating_add(Weight::from_ref_time(198_000 as u64).saturating_mul(c as u64)) + .saturating_add(T::DbWeight::get().reads(4 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) + } + // Storage: CollatorSelection Candidates (r:1 w:1) + // Storage: CollatorSelection LastAuthoredBlock (r:0 w:1) + /// The range of component `c` is `[6, 1000]`. + fn leave_intent(_c: u32, ) -> Weight { + Weight::from_ref_time(181_302_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) + } + // Storage: System Account (r:2 w:2) + // Storage: System BlockWeight (r:1 w:1) + // Storage: CollatorSelection LastAuthoredBlock (r:0 w:1) + fn note_author() -> Weight { + Weight::from_ref_time(43_091_000 as u64) + .saturating_add(T::DbWeight::get().reads(3 as u64)) + .saturating_add(T::DbWeight::get().writes(4 as u64)) + } + // Storage: CollatorSelection Candidates (r:1 w:1) + // Storage: CollatorSelection LastAuthoredBlock (r:1000 w:1) + // Storage: System Account (r:1 w:1) + // Storage: CollatorSelection Invulnerables (r:1 w:0) + // Storage: System BlockWeight (r:1 w:1) + /// The range of component `r` is `[1, 1000]`. + /// The range of component `c` is `[1, 1000]`. + fn new_session(_r: u32, c: u32, ) -> Weight { + Weight::from_ref_time(28_111_000 as u64) + // Standard Error: 39_309 + .saturating_add(Weight::from_ref_time(3_055_761 as u64).saturating_mul(c as u64)) + .saturating_add(T::DbWeight::get().reads(4 as u64)) + .saturating_add(T::DbWeight::get().reads((1 as u64).saturating_mul(c as u64))) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } +} diff --git a/runtime/crab/src/weights/pallet_session.rs b/runtime/crab/src/weights/pallet_session.rs new file mode 100644 index 000000000..f776ff689 --- /dev/null +++ b/runtime/crab/src/weights/pallet_session.rs @@ -0,0 +1,69 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `pallet_session` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2022-11-09, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `inv.cafe`, CPU: `AMD Ryzen 9 5950X 16-Core Processor` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("local"), DB CACHE: 1024 + +// Executed Command: +// target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --chain +// local +// --output +// runtime/src/weights +// --extrinsic +// * +// --pallet +// pallet-session + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_session`. +pub struct WeightInfo(PhantomData); +impl pallet_session::WeightInfo for WeightInfo { + // Storage: Session NextKeys (r:1 w:1) + // Storage: Session KeyOwner (r:1 w:1) + fn set_keys() -> Weight { + Weight::from_ref_time(30_781_000 as u64) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) + } + // Storage: Session NextKeys (r:1 w:1) + // Storage: Session KeyOwner (r:0 w:1) + fn purge_keys() -> Weight { + Weight::from_ref_time(22_911_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) + } +} diff --git a/runtime/crab/src/weights/pallet_timestamp.rs b/runtime/crab/src/weights/pallet_timestamp.rs new file mode 100644 index 000000000..fba28a6b0 --- /dev/null +++ b/runtime/crab/src/weights/pallet_timestamp.rs @@ -0,0 +1,64 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `pallet_timestamp` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2022-11-09, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `inv.cafe`, CPU: `AMD Ryzen 9 5950X 16-Core Processor` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("local"), DB CACHE: 1024 + +// Executed Command: +// target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --chain +// local +// --output +// runtime/src/weights +// --extrinsic +// * +// --pallet +// pallet-timestamp + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_timestamp`. +pub struct WeightInfo(PhantomData); +impl pallet_timestamp::WeightInfo for WeightInfo { + // Storage: Timestamp Now (r:1 w:1) + fn set() -> Weight { + Weight::from_ref_time(13_230_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + fn on_finalize() -> Weight { + Weight::from_ref_time(5_710_000 as u64) + } +} diff --git a/runtime/crab/src/weights/paritydb_weights.rs b/runtime/crab/src/weights/paritydb_weights.rs new file mode 100644 index 000000000..dca7d3483 --- /dev/null +++ b/runtime/crab/src/weights/paritydb_weights.rs @@ -0,0 +1,63 @@ +// This file is part of Substrate. + +// Copyright (C) 2022 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. + +pub mod constants { + use frame_support::{ + parameter_types, + weights::{constants, RuntimeDbWeight}, + }; + + parameter_types! { + /// `ParityDB` can be enabled with a feature flag, but is still experimental. These weights + /// are available for brave runtime engineers who may want to try this out as default. + pub const ParityDbWeight: RuntimeDbWeight = RuntimeDbWeight { + read: 8_000 * constants::WEIGHT_PER_NANOS.ref_time(), + write: 50_000 * constants::WEIGHT_PER_NANOS.ref_time(), + }; + } + + #[cfg(test)] + mod test_db_weights { + use super::constants::ParityDbWeight as W; + use frame_support::weights::constants; + + /// Checks that all weights exist and have sane values. + // NOTE: If this test fails but you are sure that the generated values are fine, + // you can delete it. + #[test] + fn sane() { + // At least 1 µs. + assert!( + W::get().reads(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(), + "Read weight should be at least 1 µs." + ); + assert!( + W::get().writes(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(), + "Write weight should be at least 1 µs." + ); + // At most 1 ms. + assert!( + W::get().reads(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(), + "Read weight should be at most 1 ms." + ); + assert!( + W::get().writes(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(), + "Write weight should be at most 1 ms." + ); + } + } +} diff --git a/runtime/crab/src/weights/rocksdb_weights.rs b/runtime/crab/src/weights/rocksdb_weights.rs new file mode 100644 index 000000000..87867ebfe --- /dev/null +++ b/runtime/crab/src/weights/rocksdb_weights.rs @@ -0,0 +1,63 @@ +// This file is part of Substrate. + +// Copyright (C) 2022 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. + +pub mod constants { + use frame_support::{ + parameter_types, + weights::{constants, RuntimeDbWeight}, + }; + + parameter_types! { + /// By default, Substrate uses `RocksDB`, so this will be the weight used throughout + /// the runtime. + pub const RocksDbWeight: RuntimeDbWeight = RuntimeDbWeight { + read: 25_000 * constants::WEIGHT_PER_NANOS.ref_time(), + write: 100_000 * constants::WEIGHT_PER_NANOS.ref_time(), + }; + } + + #[cfg(test)] + mod test_db_weights { + use super::constants::RocksDbWeight as W; + use frame_support::weights::constants; + + /// Checks that all weights exist and have sane values. + // NOTE: If this test fails but you are sure that the generated values are fine, + // you can delete it. + #[test] + fn sane() { + // At least 1 µs. + assert!( + W::get().reads(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(), + "Read weight should be at least 1 µs." + ); + assert!( + W::get().writes(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(), + "Write weight should be at least 1 µs." + ); + // At most 1 ms. + assert!( + W::get().reads(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(), + "Read weight should be at most 1 ms." + ); + assert!( + W::get().writes(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(), + "Write weight should be at most 1 ms." + ); + } + } +} diff --git a/runtime/darwinia/src/pallets/dmp_queue.rs b/runtime/darwinia/src/pallets/dmp_queue.rs index 609488318..6f0829542 100644 --- a/runtime/darwinia/src/pallets/dmp_queue.rs +++ b/runtime/darwinia/src/pallets/dmp_queue.rs @@ -22,5 +22,5 @@ use crate::*; impl cumulus_pallet_dmp_queue::Config for Runtime { type ExecuteOverweightOrigin = EnsureRoot; type RuntimeEvent = RuntimeEvent; - type XcmExecutor = XcmExecutor; + type XcmExecutor = XcmExecutor; } diff --git a/runtime/darwinia/src/pallets/identity.rs b/runtime/darwinia/src/pallets/identity.rs index 9dcbc049c..6ed7cbfd7 100644 --- a/runtime/darwinia/src/pallets/identity.rs +++ b/runtime/darwinia/src/pallets/identity.rs @@ -24,7 +24,6 @@ impl pallet_identity::Config for Runtime { // 258 bytes on-chain. type BasicDeposit = ConstU128<{ darwinia_deposit(1, 258) }>; type Currency = Balances; - type RuntimeEvent = RuntimeEvent; // 66 bytes on-chain. type FieldDeposit = ConstU128<{ darwinia_deposit(0, 66) }>; type ForceOrigin = RootOrMoreThanHalf; @@ -32,6 +31,7 @@ impl pallet_identity::Config for Runtime { type MaxRegistrars = ConstU32<20>; type MaxSubAccounts = ConstU32<100>; type RegistrarOrigin = RootOrMoreThanHalf; + type RuntimeEvent = RuntimeEvent; type Slashed = Treasury; // 53 bytes on-chain. type SubAccountDeposit = ConstU128<{ darwinia_deposit(1, 53) }>; diff --git a/runtime/darwinia/src/pallets/multisig.rs b/runtime/darwinia/src/pallets/multisig.rs index 64e7d4023..0322271ae 100644 --- a/runtime/darwinia/src/pallets/multisig.rs +++ b/runtime/darwinia/src/pallets/multisig.rs @@ -25,8 +25,8 @@ impl pallet_multisig::Config for Runtime { type DepositBase = ConstU128<{ darwinia_deposit(1, 88) }>; // Additional storage item size of 32 bytes. type DepositFactor = ConstU128<{ darwinia_deposit(0, 32) }>; - type RuntimeEvent = RuntimeEvent; type MaxSignatories = ConstU16<100>; type RuntimeCall = RuntimeCall; + type RuntimeEvent = RuntimeEvent; type WeightInfo = (); } diff --git a/runtime/darwinia/src/pallets/polkadot_xcm.rs b/runtime/darwinia/src/pallets/polkadot_xcm.rs index 8fdb7b611..d95fff635 100644 --- a/runtime/darwinia/src/pallets/polkadot_xcm.rs +++ b/runtime/darwinia/src/pallets/polkadot_xcm.rs @@ -28,14 +28,14 @@ use xcm::latest::prelude::*; use xcm_builder::*; use xcm_executor::XcmExecutor; // substrate -use frame_support::traits::{Everything, Nothing}; +use frame_support::traits::{Everything, Nothing, PalletInfoAccess}; /// Means for transacting assets on this chain. pub type LocalAssetTransactor = CurrencyAdapter< // Use this currency: Balances, // Use this currency when it is a fungible asset matching the given location or name: - IsConcrete, + IsConcrete, // Do a simple punn to convert an AccountId32 MultiLocation into a native chain account ID: LocationToAccountId, // Our chain's account ID type (we can't get away without mentioning it explicitly): @@ -45,7 +45,7 @@ pub type LocalAssetTransactor = CurrencyAdapter< >; frame_support::parameter_types! { - pub const RelayNetwork: NetworkId = NetworkId::Any; + pub const RelayNetwork: NetworkId = NetworkId::Polkadot; pub RelayChainOrigin: RuntimeOrigin = cumulus_pallet_xcm::Origin::Relay.into(); } /// Type for specifying how a `MultiLocation` can be converted into an `AccountId`. This is used @@ -73,8 +73,8 @@ pub type XcmOriginToTransactDispatchOrigin = ( // Native converter for sibling Parachains; will convert to a `SiblingPara` origin when // recognized. SiblingParachainAsNative, - // Native signed account converter; this just converts an `AccountId32` origin into a normal - // `RuntimeOrigin::Signed` origin of the same 32-byte value. + // Native signed account converter; this just converts an `AccountKey20` origin into a normal + // `RuntimeOrigin::Signed` origin of the same 20-byte value. SignedAccountKey20AsNative, // Xcm origins can be represented natively under the Xcm pallet's Xcm origin. XcmPassthrough, @@ -95,15 +95,18 @@ pub type Barrier = DenyThenTry< >; frame_support::parameter_types! { - pub const RelayLocation: MultiLocation = MultiLocation::parent(); pub const MaxInstructions: u32 = 100; + pub AnchoringSelfReserve: MultiLocation = MultiLocation::new( + 0, + X1(PalletInstance(::index() as u8)) + ); // One XCM operation is 1_000_000_000 weight - almost certainly a conservative estimate. pub Ancestry: MultiLocation = Parachain(ParachainInfo::parachain_id().into()).into(); pub UnitWeightCost: u64 = 1_000_000_000; } -pub struct XcmConfig; -impl xcm_executor::Config for XcmConfig { +pub struct XcmExecutorConfig; +impl xcm_executor::Config for XcmExecutorConfig { type AssetClaims = PolkadotXcm; // How to withdraw and deposit an asset. type AssetTransactor = LocalAssetTransactor; @@ -117,8 +120,13 @@ impl xcm_executor::Config for XcmConfig { type ResponseHandler = PolkadotXcm; type RuntimeCall = RuntimeCall; type SubscriptionService = PolkadotXcm; - type Trader = - UsingComponents>; + type Trader = UsingComponents< + WeightToFee, + AnchoringSelfReserve, + AccountId, + Balances, + DealWithFees, + >; type Weigher = FixedWeightBounds; type XcmSender = XcmRouter; } @@ -147,15 +155,15 @@ impl pallet_xcm::Config for Runtime { type XcmExecuteFilter = Nothing; // ^ Disable dispatchable execute on the XCM pallet. // Needs to be `Everything` for local testing. - type XcmExecutor = XcmExecutor; + type XcmExecutor = XcmExecutor; type XcmReserveTransferFilter = Nothing; type XcmRouter = XcmRouter; - type XcmTeleportFilter = Everything; + type XcmTeleportFilter = Nothing; const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100; } impl cumulus_pallet_xcm::Config for Runtime { type RuntimeEvent = RuntimeEvent; - type XcmExecutor = XcmExecutor; + type XcmExecutor = XcmExecutor; } diff --git a/runtime/darwinia/src/pallets/xcmp_queue.rs b/runtime/darwinia/src/pallets/xcmp_queue.rs index 21fca8060..24be8be1a 100644 --- a/runtime/darwinia/src/pallets/xcmp_queue.rs +++ b/runtime/darwinia/src/pallets/xcmp_queue.rs @@ -27,5 +27,5 @@ impl cumulus_pallet_xcmp_queue::Config for Runtime { type RuntimeEvent = RuntimeEvent; type VersionWrapper = (); type WeightInfo = weights::cumulus_pallet_xcmp_queue::WeightInfo; - type XcmExecutor = XcmExecutor; + type XcmExecutor = XcmExecutor; } diff --git a/runtime/pangolin/Cargo.toml b/runtime/pangolin/Cargo.toml new file mode 100644 index 000000000..76bc14cf0 --- /dev/null +++ b/runtime/pangolin/Cargo.toml @@ -0,0 +1,329 @@ +[package] +authors = ["Darwinia Network "] +description = "Pangolin runtime." +edition = "2021" +homepage = "https://darwinia.network" +license = "GPL-3.0" +name = "pangolin-runtime" +readme = "README.md" +repository = "https://github.com/darwinia-network/darwinia" +version = "6.0.0" + +[build-dependencies] +substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } + +[dependencies] +# crates.io +codec = { package = "parity-scale-codec", version = "3.2", default-features = false, features = ["derive"] } +scale-info = { version = "2.3", default-features = false, features = ["derive"] } +smallvec = { version = "1.10" } +static_assertions = { version = "1.1" } +# crates.io optional +array-bytes = { version = "4.1", optional = true } + +# cumulus +cumulus-pallet-aura-ext = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } +cumulus-pallet-dmp-queue = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } +cumulus-pallet-parachain-system = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } +cumulus-pallet-xcm = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } +cumulus-pallet-xcmp-queue = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } +cumulus-primitives-core = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } +cumulus-primitives-timestamp = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } +cumulus-primitives-utility = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } +pallet-collator-selection = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } +parachain-info = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } +# cumulus optional +cumulus-pallet-session-benchmarking = { optional = true, default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } + +# darwinia +darwinia-common-runtime = { default-features = false, path = "../common" } +darwinia-precompile-bls12-381 = { default-features = false, path = "../../precompiles/bls12-381" } +darwinia-precompile-state-storage = { default-features = false, path = "../../precompiles/state-storage" } +dc-primitives = { default-features = false, path = "../../core/primitives" } + +# darwinia-messages-substrate +bp-message-dispatch = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } +bp-messages = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } +bp-polkadot-core = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } +bp-runtime = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } +bridge-runtime-common = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } +pallet-bridge-dispatch = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } +pallet-bridge-grandpa = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } +pallet-bridge-messages = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } +pallet-fee-market = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } + +# frontier +fp-evm = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +fp-rpc = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +fp-self-contained = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +pallet-base-fee = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +pallet-ethereum = { default-features = false, features = ["forbid-evm-reentrancy"], git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +pallet-evm = { default-features = false, features = ["forbid-evm-reentrancy"], git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +pallet-evm-precompile-blake2 = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +pallet-evm-precompile-bn128 = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +pallet-evm-precompile-dispatch = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +pallet-evm-precompile-modexp = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +pallet-evm-precompile-simple = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } + +# moonbeam +xcm-primitives = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.30" } + +# polkadot +pallet-xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" } +polkadot-parachain = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" } +polkadot-runtime-common = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" } +xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" } +xcm-builder = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" } +xcm-executor = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" } + +# substrate +frame-executive = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +frame-system-rpc-runtime-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-aura = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-authorship = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-balances = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-collective = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-democracy = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-elections-phragmen = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-identity = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-membership = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-multisig = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-preimage = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-proxy = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-scheduler = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-session = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-sudo = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-timestamp = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-tips = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-transaction-payment = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-transaction-payment-rpc-runtime-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-treasury = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-utility = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-vesting = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-block-builder = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-consensus-aura = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-inherents = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-io = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-offchain = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-session = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-transaction-pool = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-version = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +# substrate optional +frame-benchmarking = { optional = true, default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +frame-system-benchmarking = { optional = true, default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +frame-try-runtime = { optional = true, default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } + +[features] +default = ["std"] +std = [ + # crates.io + "codec/std", + "scale-info/std", + + # cumulus + "cumulus-pallet-aura-ext/std", + "cumulus-pallet-dmp-queue/std", + "cumulus-pallet-parachain-system/std", + "cumulus-pallet-xcm/std", + "cumulus-pallet-xcmp-queue/std", + "cumulus-primitives-core/std", + "cumulus-primitives-timestamp/std", + "cumulus-primitives-utility/std", + "pallet-collator-selection/std", + "parachain-info/std", + # cumulus optional + "cumulus-pallet-session-benchmarking?/std", + + # darwinia + "darwinia-common-runtime/std", + "darwinia-precompile-bls12-381/std", + "darwinia-precompile-state-storage/std", + "dc-primitives/std", + + # darwinia-messages-substrate + "bp-message-dispatch/std", + "bp-messages/std", + "bp-runtime/std", + "bp-polkadot-core/std", + "bridge-runtime-common/std", + "pallet-bridge-dispatch/std", + "pallet-bridge-grandpa/std", + "pallet-bridge-messages/std", + "pallet-fee-market/std", + + # frontier + "fp-evm/std", + "fp-rpc/std", + "fp-self-contained/std", + "pallet-base-fee/std", + "pallet-ethereum/std", + "pallet-evm/std", + "pallet-evm-precompile-blake2/std", + "pallet-evm-precompile-bn128/std", + "pallet-evm-precompile-dispatch/std", + "pallet-evm-precompile-modexp/std", + "pallet-evm-precompile-simple/std", + + # moonbeam + "xcm-primitives/std", + + # polkadot + "pallet-xcm/std", + "polkadot-parachain/std", + "polkadot-runtime-common/std", + "xcm/std", + "xcm-builder/std", + "xcm-executor/std", + + # substrate + "frame-executive/std", + "frame-support/std", + "frame-system/std", + "frame-system-rpc-runtime-api/std", + "pallet-aura/std", + "pallet-authorship/std", + "pallet-balances/std", + "pallet-collective/std", + "pallet-democracy/std", + "pallet-elections-phragmen/std", + "pallet-membership/std", + "pallet-identity/std", + "pallet-multisig/std", + "pallet-preimage/std", + "pallet-proxy/std", + "pallet-scheduler/std", + "pallet-session/std", + "pallet-sudo/std", + "pallet-timestamp/std", + "pallet-tips/std", + "pallet-transaction-payment-rpc-runtime-api/std", + "pallet-transaction-payment/std", + "pallet-treasury/std", + "pallet-utility/std", + "pallet-vesting/std", + "sp-api/std", + "sp-block-builder/std", + "sp-consensus-aura/std", + "sp-core/std", + "sp-inherents/std", + "sp-io/std", + "sp-offchain/std", + "sp-runtime/std", + "sp-session/std", + "sp-std/std", + "sp-transaction-pool/std", + "sp-version/std", + # substrate optional + "frame-benchmarking?/std", + "frame-system-benchmarking?/std", + "frame-try-runtime?/std", + +] + +runtime-benchmarks = [ + # crates.io + "array-bytes", + + # cumulus + "pallet-collator-selection/runtime-benchmarks", + "cumulus-pallet-parachain-system/runtime-benchmarks", + "cumulus-pallet-xcmp-queue/runtime-benchmarks", + # cumulus optional + "cumulus-pallet-session-benchmarking/runtime-benchmarks", + + # darwinia-messages-substrate + "bridge-runtime-common/runtime-benchmarks", + "pallet-bridge-grandpa/runtime-benchmarks", + "pallet-bridge-messages/runtime-benchmarks", + "pallet-fee-market/runtime-benchmarks", + + # frontier + "pallet-ethereum/runtime-benchmarks", + "pallet-evm/runtime-benchmarks", + + # moonbeam + "xcm-primitives/runtime-benchmarks", + + # polkadot + "pallet-xcm/runtime-benchmarks", + "polkadot-parachain/runtime-benchmarks", + "polkadot-runtime-common/runtime-benchmarks", + "xcm-builder/runtime-benchmarks", + "xcm-executor/runtime-benchmarks", + + # substrate + "frame-support/runtime-benchmarks", + "frame-system/runtime-benchmarks", + "pallet-balances/runtime-benchmarks", + "pallet-collective/runtime-benchmarks", + "pallet-democracy/runtime-benchmarks", + "pallet-elections-phragmen/runtime-benchmarks", + "pallet-membership/runtime-benchmarks", + "pallet-identity/runtime-benchmarks", + "pallet-multisig/runtime-benchmarks", + "pallet-preimage/runtime-benchmarks", + "pallet-proxy/runtime-benchmarks", + "pallet-scheduler/runtime-benchmarks", + "pallet-timestamp/runtime-benchmarks", + "pallet-tips/runtime-benchmarks", + "pallet-treasury/runtime-benchmarks", + "pallet-utility/runtime-benchmarks", + "pallet-vesting/runtime-benchmarks", + "sp-runtime/runtime-benchmarks", + # substrate optional + "frame-benchmarking/runtime-benchmarks", + "frame-system-benchmarking/runtime-benchmarks", +] + +try-runtime = [ + # cumulus + "cumulus-pallet-aura-ext/try-runtime", + "cumulus-pallet-dmp-queue/try-runtime", + "cumulus-pallet-parachain-system/try-runtime", + "cumulus-pallet-xcm/try-runtime", + "cumulus-pallet-xcmp-queue/try-runtime", + "pallet-collator-selection/try-runtime", + "parachain-info/try-runtime", + + # frontier + "pallet-base-fee/try-runtime", + "pallet-ethereum/try-runtime", + "pallet-evm/try-runtime", + + # polkadot + "pallet-xcm/try-runtime", + "polkadot-runtime-common/try-runtime", + + # substrate + "frame-executive/try-runtime", + "frame-support/try-runtime", + "frame-system/try-runtime", + "pallet-aura/try-runtime", + "pallet-authorship/try-runtime", + "pallet-balances/try-runtime", + "pallet-collective/try-runtime", + "pallet-democracy/try-runtime", + "pallet-elections-phragmen/try-runtime", + "pallet-membership/try-runtime", + "pallet-identity/try-runtime", + "pallet-multisig/try-runtime", + "pallet-preimage/try-runtime", + "pallet-proxy/try-runtime", + "pallet-scheduler/try-runtime", + "pallet-session/try-runtime", + "pallet-sudo/try-runtime", + "pallet-timestamp/try-runtime", + "pallet-tips/try-runtime", + "pallet-transaction-payment/try-runtime", + "pallet-treasury/try-runtime", + "pallet-utility/try-runtime", + "pallet-vesting/try-runtime", + # substrate optional + "frame-try-runtime", +] diff --git a/runtime/pangolin/build.rs b/runtime/pangolin/build.rs new file mode 100644 index 000000000..e5513c875 --- /dev/null +++ b/runtime/pangolin/build.rs @@ -0,0 +1,24 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// crates.io +use substrate_wasm_builder::WasmBuilder; + +fn main() { + WasmBuilder::new().with_current_project().export_heap_base().import_memory().build() +} diff --git a/runtime/pangolin/src/lib.rs b/runtime/pangolin/src/lib.rs new file mode 100644 index 000000000..b36dec792 --- /dev/null +++ b/runtime/pangolin/src/lib.rs @@ -0,0 +1,752 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Darwinia runtime. + +#![cfg_attr(not(feature = "std"), no_std)] +#![recursion_limit = "256"] + +#[cfg(feature = "std")] +include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); + +mod pallets; +pub use pallets::*; + +mod weights; + +pub use sp_consensus_aura::sr25519::AuthorityId as AuraId; + +// cumulus +use cumulus_pallet_parachain_system::RelayNumberStrictlyIncreases; +// darwinia +use dc_primitives::*; +// polkadot +use xcm::latest::prelude::BodyId; +use xcm_executor::XcmExecutor; +// substrate +use frame_support::{ + dispatch::DispatchClass, + traits::{Imbalance, OnUnbalanced}, + weights::{ + ConstantMultiplier, Weight, WeightToFeeCoefficient, WeightToFeeCoefficients, + WeightToFeePolynomial, + }, + PalletId, +}; +use frame_system::EnsureRoot; +use sp_core::{crypto::KeyTypeId, OpaqueMetadata, H160, H256, U256}; +#[cfg(any(feature = "std", test))] +pub use sp_runtime::BuildStorage; +use sp_runtime::{ + generic, + traits::Block as BlockT, + transaction_validity::{TransactionSource, TransactionValidity}, + ApplyExtrinsicResult, +}; +pub use sp_runtime::{MultiAddress, Perbill, Permill}; +use sp_std::prelude::*; +#[cfg(feature = "std")] +use sp_version::NativeVersion; +use sp_version::RuntimeVersion; + +/// Block type as expected by this runtime. +pub type Block = generic::Block; + +/// A Block signed with a Justification +pub type SignedBlock = generic::SignedBlock; + +/// The SignedExtension to the basic transaction logic. +pub type SignedExtra = ( + frame_system::CheckNonZeroSender, + frame_system::CheckSpecVersion, + frame_system::CheckTxVersion, + frame_system::CheckGenesis, + frame_system::CheckEra, + frame_system::CheckNonce, + frame_system::CheckWeight, + pallet_transaction_payment::ChargeTransactionPayment, +); + +/// Unchecked extrinsic type as expected by this runtime. +pub type UncheckedExtrinsic = + fp_self_contained::UncheckedExtrinsic; + +/// Extrinsic type that has already been checked. +pub type CheckedExtrinsic = + fp_self_contained::CheckedExtrinsic; + +/// Executive: handles dispatch to the various modules. +pub type Executive = frame_executive::Executive< + Runtime, + Block, + frame_system::ChainContext, + Runtime, + AllPalletsWithSystem, +>; + +/// Darwinia proposal base fee. +pub const DARWINIA_PROPOSAL_REQUIREMENT: Balance = 5000 * UNIT; + +/// Runtime version. +#[sp_version::runtime_version] +pub const VERSION: RuntimeVersion = RuntimeVersion { + spec_name: sp_runtime::create_runtime_str!("Pangolin2"), + impl_name: sp_runtime::create_runtime_str!("DarwiniaOfficialRust"), + authoring_version: 0, + spec_version: 6_0_0_0, + impl_version: 0, + apis: RUNTIME_API_VERSIONS, + transaction_version: 0, + state_version: 0, +}; + +/// Deposit calculator for Darwinia. +/// 100 UNIT for the base fee, 102.4 UNIT/MB. +pub const fn darwinia_deposit(items: u32, bytes: u32) -> Balance { + // First try. + items as Balance * 100 * UNIT + (bytes as Balance) * 100 * MICROUNIT + // items as Balance * 100 * UNIT + (bytes as Balance) * 100 * MILLIUNIT +} + +// TODO: move to impl.rs +pub struct DealWithFees(sp_std::marker::PhantomData); +impl frame_support::traits::OnUnbalanced> + for DealWithFees +where + R: pallet_balances::Config, + R: pallet_balances::Config + pallet_treasury::Config, + pallet_treasury::Pallet: OnUnbalanced>, +{ + // this seems to be called for substrate-based transactions + fn on_unbalanceds( + mut fees_then_tips: impl Iterator>, + ) { + if let Some(fees) = fees_then_tips.next() { + // for fees, 80% are burned, 20% to the treasury + let (_, to_treasury) = fees.ration(80, 20); + + // Balances pallet automatically burns dropped Negative Imbalances by decreasing + // total_supply accordingly + as OnUnbalanced<_>>::on_unbalanced(to_treasury); + } + } + + // this is called from pallet_evm for Ethereum-based transactions + // (technically, it calls on_unbalanced, which calls this when non-zero) + fn on_nonzero_unbalanced(amount: pallet_balances::NegativeImbalance) { + // Balances pallet automatically burns dropped Negative Imbalances by decreasing + // total_supply accordingly + let (_, to_treasury) = amount.ration(80, 20); + + as OnUnbalanced<_>>::on_unbalanced(to_treasury); + } +} + +impl fp_self_contained::SelfContainedCall for RuntimeCall { + type SignedInfo = H160; + + fn is_self_contained(&self) -> bool { + match self { + RuntimeCall::Ethereum(call) => call.is_self_contained(), + _ => false, + } + } + + fn check_self_contained( + &self, + ) -> Option> + { + match self { + RuntimeCall::Ethereum(call) => call.check_self_contained(), + _ => None, + } + } + + fn validate_self_contained( + &self, + info: &Self::SignedInfo, + dispatch_info: &sp_runtime::traits::DispatchInfoOf, + len: usize, + ) -> Option { + match self { + RuntimeCall::Ethereum(call) => call.validate_self_contained(info, dispatch_info, len), + _ => None, + } + } + + fn pre_dispatch_self_contained( + &self, + info: &Self::SignedInfo, + dispatch_info: &sp_runtime::traits::DispatchInfoOf, + len: usize, + ) -> Option> { + match self { + RuntimeCall::Ethereum(call) => + call.pre_dispatch_self_contained(info, dispatch_info, len), + _ => None, + } + } + + fn apply_self_contained( + self, + info: Self::SignedInfo, + ) -> Option>> { + // substrate + use sp_runtime::traits::Dispatchable; + + match self { + call @ RuntimeCall::Ethereum(pallet_ethereum::Call::transact { .. }) => + Some(call.dispatch(RuntimeOrigin::from( + pallet_ethereum::RawOrigin::EthereumTransaction(info), + ))), + _ => None, + } + } +} + +/// Handles converting a weight scalar to a fee value, based on the scale and granularity of the +/// node's balance type. +/// +/// This should typically create a mapping between the following ranges: +/// - `[0, MAXIMUM_BLOCK_WEIGHT]` +/// - `[Balance::min, Balance::max]` +/// +/// Yet, it can be used for any other sort of change to weight-fee. Some examples being: +/// - Setting it to `0` will essentially disable the weight fee. +/// - Setting it to `1` will cause the literal `#[weight = x]` values to be charged. +pub struct WeightToFee; +impl WeightToFeePolynomial for WeightToFee { + type Balance = Balance; + + fn polynomial() -> WeightToFeeCoefficients { + // in Rococo, extrinsic base weight (smallest non-zero weight) is mapped to 1 MILLIUNIT: + // here, we map to 1/10 of that, or 1/10 MILLIUNIT + let p = MILLIUNIT / 10; + let q = 100 * Balance::from(weights::ExtrinsicBaseWeight::get().ref_time()); + smallvec::smallvec![WeightToFeeCoefficient { + degree: 1, + negative: false, + coeff_frac: Perbill::from_rational(p % q, q), + coeff_integer: p / q, + }] + } +} + +/// The version information used to identify this runtime when compiled natively. +#[cfg(feature = "std")] +pub fn native_version() -> NativeVersion { + NativeVersion { runtime_version: VERSION, can_author_with: Default::default() } +} + +// Create the runtime by composing the FRAME pallets that were previously configured. +frame_support::construct_runtime! { + pub enum Runtime where + Block = Block, + NodeBlock = dc_primitives::Block, + UncheckedExtrinsic = UncheckedExtrinsic, + { + // System stuff. + System: frame_system = 0, + ParachainSystem: cumulus_pallet_parachain_system = 1, + Timestamp: pallet_timestamp = 2, + ParachainInfo: parachain_info = 3, + + // Monetary stuff. + // Leave 4 here. + // To keep balances consistent with the existing XCM configurations. + Balances: pallet_balances = 5, + TransactionPayment: pallet_transaction_payment = 6, + + // Consensus stuff. + Authorship: pallet_authorship = 7, + CollatorSelection: pallet_collator_selection = 8, + Session: pallet_session = 9, + Aura: pallet_aura = 10, + AuraExt: cumulus_pallet_aura_ext = 11, + + // Governance stuff. + Democracy: pallet_democracy = 12, + Council: pallet_collective:: = 13, + TechnicalCommittee: pallet_collective:: = 14, + PhragmenElection: pallet_elections_phragmen = 15, + TechnicalMembership: pallet_membership:: = 16, + Treasury: pallet_treasury = 17, + Tips: pallet_tips = 18, + + // Utility stuff. + Sudo: pallet_sudo = 19, + Vesting: pallet_vesting = 20, + Utility: pallet_utility = 21, + Identity: pallet_identity = 22, + Scheduler: pallet_scheduler = 23, + Preimage: pallet_preimage = 24, + Proxy: pallet_proxy = 25, + Multisig: pallet_multisig = 26, + + // XCM stuff. + XcmpQueue: cumulus_pallet_xcmp_queue = 27, + PolkadotXcm: pallet_xcm = 28, + CumulusXcm: cumulus_pallet_xcm = 29, + DmpQueue: cumulus_pallet_dmp_queue = 30, + + // EVM stuff. + Ethereum: pallet_ethereum = 31, + Evm: pallet_evm = 32, + BaseFee: pallet_base_fee = 33, + } +} + +#[cfg(feature = "runtime-benchmarks")] +frame_benchmarking::define_benchmarks! { + [frame_system, SystemBench::] + [pallet_balances, Balances] + [pallet_session, SessionBench::] + [pallet_timestamp, Timestamp] + [pallet_collator_selection, CollatorSelection] + [cumulus_pallet_xcmp_queue, XcmpQueue] +} + +sp_api::impl_runtime_apis! { + impl sp_consensus_aura::AuraApi for Runtime { + fn slot_duration() -> sp_consensus_aura::SlotDuration { + sp_consensus_aura::SlotDuration::from_millis(Aura::slot_duration()) + } + + fn authorities() -> Vec { + Aura::authorities().into_inner() + } + } + + impl sp_api::Core for Runtime { + fn version() -> RuntimeVersion { + VERSION + } + + fn execute_block(block: Block) { + Executive::execute_block(block) + } + + fn initialize_block(header: &::Header) { + Executive::initialize_block(header) + } + } + + impl sp_api::Metadata for Runtime { + fn metadata() -> OpaqueMetadata { + OpaqueMetadata::new(Runtime::metadata().into()) + } + } + + impl sp_block_builder::BlockBuilder for Runtime { + fn apply_extrinsic(extrinsic: ::Extrinsic) -> ApplyExtrinsicResult { + Executive::apply_extrinsic(extrinsic) + } + + fn finalize_block() -> ::Header { + Executive::finalize_block() + } + + fn inherent_extrinsics(data: sp_inherents::InherentData) -> Vec<::Extrinsic> { + data.create_extrinsics() + } + + fn check_inherents( + block: Block, + data: sp_inherents::InherentData, + ) -> sp_inherents::CheckInherentsResult { + data.check_extrinsics(&block) + } + } + + impl sp_transaction_pool::runtime_api::TaggedTransactionQueue for Runtime { + fn validate_transaction( + source: TransactionSource, + tx: ::Extrinsic, + block_hash: ::Hash, + ) -> TransactionValidity { + Executive::validate_transaction(source, tx, block_hash) + } + } + + impl sp_offchain::OffchainWorkerApi for Runtime { + fn offchain_worker(header: &::Header) { + Executive::offchain_worker(header) + } + } + + impl sp_session::SessionKeys for Runtime { + fn generate_session_keys(seed: Option>) -> Vec { + SessionKeys::generate(seed) + } + + fn decode_session_keys( + encoded: Vec, + ) -> Option, KeyTypeId)>> { + SessionKeys::decode_into_raw_public_keys(&encoded) + } + } + + impl frame_system_rpc_runtime_api::AccountNonceApi for Runtime { + fn account_nonce(account: AccountId) -> Nonce { + System::account_nonce(account) + } + } + + impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi for Runtime { + fn query_info( + uxt: ::Extrinsic, + len: u32, + ) -> pallet_transaction_payment_rpc_runtime_api::RuntimeDispatchInfo { + TransactionPayment::query_info(uxt, len) + } + fn query_fee_details( + uxt: ::Extrinsic, + len: u32, + ) -> pallet_transaction_payment::FeeDetails { + TransactionPayment::query_fee_details(uxt, len) + } + } + + impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentCallApi + for Runtime + { + fn query_call_info( + call: RuntimeCall, + len: u32, + ) -> pallet_transaction_payment::RuntimeDispatchInfo { + TransactionPayment::query_call_info(call, len) + } + fn query_call_fee_details( + call: RuntimeCall, + len: u32, + ) -> pallet_transaction_payment::FeeDetails { + TransactionPayment::query_call_fee_details(call, len) + } + } + + impl cumulus_primitives_core::CollectCollationInfo for Runtime { + fn collect_collation_info(header: &::Header) -> cumulus_primitives_core::CollationInfo { + ParachainSystem::collect_collation_info(header) + } + } + + impl fp_rpc::EthereumRuntimeRPCApi for Runtime { + fn chain_id() -> u64 { + <::ChainId as frame_support::traits::Get>::get() + } + + fn account_basic(address: H160) -> pallet_evm::Account { + let (account, _) = Evm::account_basic(&address); + + account + } + + fn gas_price() -> U256 { + // frontier + use pallet_evm::FeeCalculator; + + let (gas_price, _) = ::FeeCalculator::min_gas_price(); + + gas_price + } + + fn account_code_at(address: H160) -> Vec { + Evm::account_codes(address) + } + + fn author() -> H160 { + >::find_author() + } + + fn storage_at(address: H160, index: U256) -> H256 { + let mut tmp = [0u8; 32]; + + index.to_big_endian(&mut tmp); + + Evm::account_storages(address, H256::from_slice(&tmp[..])) + } + + fn call( + from: H160, + to: H160, + data: Vec, + value: U256, + gas_limit: U256, + max_fee_per_gas: Option, + max_priority_fee_per_gas: Option, + nonce: Option, + estimate: bool, + access_list: Option)>>, + ) -> Result { + // frontier + use pallet_evm::Runner; + // substrate + use sp_runtime::traits::UniqueSaturatedInto; + + let config = if estimate { + let mut config = ::config().clone(); + config.estimate = true; + Some(config) + } else { + None + }; + + let is_transactional = false; + let validate = true; + #[allow(clippy::or_fun_call)] + let evm_config = config.as_ref().unwrap_or(::config()); + ::Runner::call( + from, + to, + data, + value, + gas_limit.unique_saturated_into(), + max_fee_per_gas, + max_priority_fee_per_gas, + nonce, + access_list.unwrap_or_default(), + is_transactional, + validate, + evm_config, + ).map_err(|err| err.error.into()) + } + + fn create( + from: H160, + data: Vec, + value: U256, + gas_limit: U256, + max_fee_per_gas: Option, + max_priority_fee_per_gas: Option, + nonce: Option, + estimate: bool, + access_list: Option)>>, + ) -> Result { + // frontier + use pallet_evm::Runner; + // substrate + use sp_runtime::traits::UniqueSaturatedInto; + + let config = if estimate { + let mut config = ::config().clone(); + config.estimate = true; + Some(config) + } else { + None + }; + + let is_transactional = false; + let validate = true; + #[allow(clippy::or_fun_call)] + let evm_config = config.as_ref().unwrap_or(::config()); + ::Runner::create( + from, + data, + value, + gas_limit.unique_saturated_into(), + max_fee_per_gas, + max_priority_fee_per_gas, + nonce, + access_list.unwrap_or_default(), + is_transactional, + validate, + evm_config, + ).map_err(|err| err.error.into()) + } + + fn current_transaction_statuses() -> Option> { + Ethereum::current_transaction_statuses() + } + + fn current_block() -> Option { + Ethereum::current_block() + } + + fn current_receipts() -> Option> { + Ethereum::current_receipts() + } + + fn current_all() -> ( + Option, + Option>, + Option> + ) { + ( + Ethereum::current_block(), + Ethereum::current_receipts(), + Ethereum::current_transaction_statuses() + ) + } + + fn extrinsic_filter( + xts: Vec<::Extrinsic>, + ) -> Vec { + xts.into_iter().filter_map(|xt| match xt.0.function { + RuntimeCall::Ethereum( + pallet_ethereum::Call::::transact { transaction } + ) => Some(transaction), + _ => None + }).collect::>() + } + + fn elasticity() -> Option { + Some(BaseFee::elasticity()) + } + } + + impl fp_rpc::ConvertTransactionRuntimeApi for Runtime { + fn convert_transaction( + transaction: pallet_ethereum::Transaction + ) -> ::Extrinsic { + UncheckedExtrinsic::new_unsigned( + pallet_ethereum::Call::::transact { transaction }.into(), + ) + } + } + + #[cfg(feature = "runtime-benchmarks")] + impl frame_benchmarking::Benchmark for Runtime { + fn benchmark_metadata(extra: bool) -> ( + Vec, + Vec, + ) { + // substrate + use frame_benchmarking::*; + use frame_support::traits::StorageInfoTrait; + use frame_system_benchmarking::Pallet as SystemBench; + use cumulus_pallet_session_benchmarking::Pallet as SessionBench; + + let mut list = Vec::::new(); + + list_benchmarks!(list, extra); + + let storage_info = AllPalletsWithSystem::storage_info(); + + (list, storage_info) + } + + fn dispatch_benchmark( + config: frame_benchmarking::BenchmarkConfig + ) -> Result, sp_runtime::RuntimeString> { + // substrate + use frame_benchmarking::*; + + use frame_system_benchmarking::Pallet as SystemBench; + impl frame_system_benchmarking::Config for Runtime {} + + use cumulus_pallet_session_benchmarking::Pallet as SessionBench; + impl cumulus_pallet_session_benchmarking::Config for Runtime {} + + let whitelist: Vec = vec![ + // Block Number + array_bytes::hex_into_unchecked("26aa394eea5630e07c48ae0c9558cef702a5c1b19ab7a04f536c519aca4983ac"), + // Total Issuance + array_bytes::hex_into_unchecked("c2261276cc9d1f8598ea4b6a74b15c2f57c875e4cff74148e4628f264b974c80"), + // Execution Phase + array_bytes::hex_into_unchecked("26aa394eea5630e07c48ae0c9558cef7ff553b5a9862a516939d82b3d3d8661a"), + // Event Count + array_bytes::hex_into_unchecked("26aa394eea5630e07c48ae0c9558cef70a98fdbe9ce6c55837576c60c7af3850"), + // System Events + array_bytes::hex_into_unchecked("26aa394eea5630e07c48ae0c9558cef780d41e5e16056765bc8461851072c9d7"), + ]; + + let mut batches = Vec::::new(); + let params = (&config, &whitelist); + + add_benchmarks!(params, batches); + + if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) } + + Ok(batches) + } + } + + #[cfg(feature = "try-runtime")] + impl frame_try_runtime::TryRuntime for Runtime { + fn on_runtime_upgrade() -> (Weight, Weight) { + // substrate + use frame_support::log; + + log::info!("try-runtime::on_runtime_upgrade"); + + let weight = Executive::try_runtime_upgrade().unwrap(); + + (weight, RuntimeBlockWeights::get().max_block) + } + + fn execute_block(block: Block, state_root_check: bool, select: frame_try_runtime::TryStateSelect) -> Weight { + // substrate + use frame_support::log; + + log::info!( + "try-runtime: executing block #{} ({:?}) / root checks: {:?} / sanity-checks: {:?}", + block.header.number, + block.header.hash(), + state_root_check, + select, + ); + + Executive::try_execute_block(block, state_root_check, select).expect("try_execute_block failed") + } + } +} + +struct CheckInherents; +impl cumulus_pallet_parachain_system::CheckInherents for CheckInherents { + fn check_inherents( + block: &Block, + relay_state_proof: &cumulus_pallet_parachain_system::RelayChainStateProof, + ) -> sp_inherents::CheckInherentsResult { + let relay_chain_slot = relay_state_proof + .read_slot() + .expect("Could not read the relay chain slot from the proof"); + + let inherent_data = + cumulus_primitives_timestamp::InherentDataProvider::from_relay_chain_slot_and_duration( + relay_chain_slot, + sp_std::time::Duration::from_secs(6), + ) + .create_inherent_data() + .expect("Could not create the timestamp inherent data"); + + inherent_data.check_extrinsics(block) + } +} +cumulus_pallet_parachain_system::register_validate_block! { + Runtime = Runtime, + BlockExecutor = cumulus_pallet_aura_ext::BlockExecutor::, + CheckInherents = CheckInherents, +} + +#[cfg(test)] +mod tests { + // darwinia + use super::{Runtime, WeightPerGas}; + // substrate + use frame_support::dispatch::DispatchClass; + + #[test] + fn configured_base_extrinsic_weight_is_evm_compatible() { + let min_ethereum_transaction_weight = WeightPerGas::get() * 21_000; + let base_extrinsic = ::BlockWeights::get() + .get(DispatchClass::Normal) + .base_extrinsic; + + assert!(base_extrinsic.ref_time() <= min_ethereum_transaction_weight.ref_time()); + } +} diff --git a/runtime/pangolin/src/pallets/aura.rs b/runtime/pangolin/src/pallets/aura.rs new file mode 100644 index 000000000..a185eb060 --- /dev/null +++ b/runtime/pangolin/src/pallets/aura.rs @@ -0,0 +1,26 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +impl pallet_aura::Config for Runtime { + type AuthorityId = AuraId; + type DisabledValidators = (); + type MaxAuthorities = ConstU32<100_000>; +} diff --git a/runtime/pangolin/src/pallets/aura_ext.rs b/runtime/pangolin/src/pallets/aura_ext.rs new file mode 100644 index 000000000..77c924dab --- /dev/null +++ b/runtime/pangolin/src/pallets/aura_ext.rs @@ -0,0 +1,22 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +impl cumulus_pallet_aura_ext::Config for Runtime {} diff --git a/runtime/pangolin/src/pallets/authorship.rs b/runtime/pangolin/src/pallets/authorship.rs new file mode 100644 index 000000000..eb48e3bdb --- /dev/null +++ b/runtime/pangolin/src/pallets/authorship.rs @@ -0,0 +1,27 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +impl pallet_authorship::Config for Runtime { + type EventHandler = (CollatorSelection,); + type FilterUncle = (); + type FindAuthor = pallet_session::FindAccountFromAuthorIndex; + type UncleGenerations = ConstU32<0>; +} diff --git a/runtime/pangolin/src/pallets/balances.rs b/runtime/pangolin/src/pallets/balances.rs new file mode 100644 index 000000000..2dbd63977 --- /dev/null +++ b/runtime/pangolin/src/pallets/balances.rs @@ -0,0 +1,32 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +impl pallet_balances::Config for Runtime { + type AccountStore = System; + type Balance = Balance; + type DustRemoval = (); + type ExistentialDeposit = ConstU128<0>; + type MaxLocks = ConstU32<50>; + type MaxReserves = ConstU32<50>; + type ReserveIdentifier = [u8; 8]; + type RuntimeEvent = RuntimeEvent; + type WeightInfo = weights::pallet_balances::WeightInfo; +} diff --git a/runtime/pangolin/src/pallets/base_fee.rs b/runtime/pangolin/src/pallets/base_fee.rs new file mode 100644 index 000000000..a7807d403 --- /dev/null +++ b/runtime/pangolin/src/pallets/base_fee.rs @@ -0,0 +1,47 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +frame_support::parameter_types! { + pub DefaultBaseFeePerGas: U256 = U256::from(1_000_000_000); + pub DefaultElasticity: Permill = Permill::from_parts(125_000); +} + +pub struct BaseFeeThreshold; +impl pallet_base_fee::BaseFeeThreshold for BaseFeeThreshold { + fn lower() -> Permill { + Permill::zero() + } + + fn ideal() -> Permill { + Permill::from_parts(500_000) + } + + fn upper() -> Permill { + Permill::from_parts(1_000_000) + } +} + +impl pallet_base_fee::Config for Runtime { + type DefaultBaseFeePerGas = DefaultBaseFeePerGas; + type DefaultElasticity = DefaultElasticity; + type RuntimeEvent = RuntimeEvent; + type Threshold = BaseFeeThreshold; +} diff --git a/runtime/pangolin/src/pallets/collator_selection.rs b/runtime/pangolin/src/pallets/collator_selection.rs new file mode 100644 index 000000000..610420061 --- /dev/null +++ b/runtime/pangolin/src/pallets/collator_selection.rs @@ -0,0 +1,47 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +// We allow root only to execute privileged collator selection operations. +pub type CollatorSelectionUpdateOrigin = EnsureRoot; +frame_support::parameter_types! { + pub const PotId: PalletId = PalletId(*b"PotStake"); + pub const MaxCandidates: u32 = 1000; + pub const MinCandidates: u32 = 5; + pub const SessionLength: BlockNumber = 6 * HOURS; + pub const MaxInvulnerables: u32 = 100; + pub const ExecutiveBody: BodyId = BodyId::Executive; +} + +impl pallet_collator_selection::Config for Runtime { + type Currency = Balances; + // should be a multiple of session or things will get inconsistent + type KickThreshold = Period; + type MaxCandidates = MaxCandidates; + type MaxInvulnerables = MaxInvulnerables; + type MinCandidates = MinCandidates; + type PotId = PotId; + type RuntimeEvent = RuntimeEvent; + type UpdateOrigin = CollatorSelectionUpdateOrigin; + type ValidatorId = ::AccountId; + type ValidatorIdOf = pallet_collator_selection::IdentityCollator; + type ValidatorRegistration = Session; + type WeightInfo = weights::pallet_collator_selection::WeightInfo; +} diff --git a/runtime/pangolin/src/pallets/collective.rs b/runtime/pangolin/src/pallets/collective.rs new file mode 100644 index 000000000..6d4a215a7 --- /dev/null +++ b/runtime/pangolin/src/pallets/collective.rs @@ -0,0 +1,50 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +pub use pallet_collective::{Instance1 as CouncilCollective, Instance2 as TechnicalCollective}; + +// darwinia +use crate::*; + +pub const COLLECTIVE_DESIRED_MEMBERS: u32 = 7; +pub const COLLECTIVE_MAX_MEMBERS: u32 = 100; +pub const COLLECTIVE_MAX_PROPOSALS: u32 = 100; + +// Make sure that there are no more than `COLLECTIVE_MAX_MEMBERS` members elected via phragmen. +static_assertions::const_assert!(COLLECTIVE_DESIRED_MEMBERS <= COLLECTIVE_MAX_MEMBERS); + +impl pallet_collective::Config for Runtime { + type DefaultVote = pallet_collective::PrimeDefaultVote; + type MaxMembers = ConstU32; + type MaxProposals = ConstU32<100>; + type MotionDuration = ConstU32<{ 3 * DAYS }>; + type Proposal = RuntimeCall; + type RuntimeEvent = RuntimeEvent; + type RuntimeOrigin = RuntimeOrigin; + type WeightInfo = (); +} +impl pallet_collective::Config for Runtime { + type DefaultVote = pallet_collective::PrimeDefaultVote; + type MaxMembers = ConstU32; + type MaxProposals = ConstU32<100>; + type MotionDuration = ConstU32<{ 3 * DAYS }>; + type Proposal = RuntimeCall; + type RuntimeEvent = RuntimeEvent; + type RuntimeOrigin = RuntimeOrigin; + type WeightInfo = (); +} diff --git a/runtime/pangolin/src/pallets/democracy.rs b/runtime/pangolin/src/pallets/democracy.rs new file mode 100644 index 000000000..a54d9d4f4 --- /dev/null +++ b/runtime/pangolin/src/pallets/democracy.rs @@ -0,0 +1,64 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +const ENACTMENT_PERIOD: u32 = 28 * DAYS; + +impl pallet_democracy::Config for Runtime { + type BlacklistOrigin = Root; + // To cancel a proposal before it has been passed, the technical committee must be unanimous or + // Root must agree. + type CancelProposalOrigin = RootOrAll; + // To cancel a proposal which has been passed, 2/3 of the council must agree to it. + type CancellationOrigin = RootOrAtLeastTwoThird; + type CooloffPeriod = ConstU32<{ 7 * DAYS }>; + type Currency = Balances; + type EnactmentPeriod = ConstU32; + /// A unanimous council can have the next scheduled referendum be a straight default-carries + /// (NTB) vote. + type ExternalDefaultOrigin = RootOrAll; + /// A majority can have the next scheduled referendum be a straight majority-carries vote. + type ExternalMajorityOrigin = RootOrAtLeastHalf; + /// A straight majority of the council can decide what their next motion is. + type ExternalOrigin = RootOrAtLeastHalf; + /// Two thirds of the technical committee can have an ExternalMajority/ExternalDefault vote + /// be tabled immediately and with a shorter voting/enactment period. + type FastTrackOrigin = RootOrAtLeastTwoThird; + type FastTrackVotingPeriod = ConstU32<{ 3 * HOURS }>; + type InstantAllowed = ConstBool; + type InstantOrigin = RootOrAll; + type LaunchPeriod = ConstU32<{ 28 * DAYS }>; + type MaxProposals = ConstU32<100>; + type MaxVotes = ConstU32<100>; + type MinimumDeposit = ConstU128; + type OperationalPreimageOrigin = pallet_collective::EnsureMember; + type PalletsOrigin = OriginCaller; + type PreimageByteDeposit = ConstU128<{ darwinia_deposit(0, 1) }>; + type Proposal = RuntimeCall; + type RuntimeEvent = RuntimeEvent; + type Scheduler = Scheduler; + type Slash = Treasury; + // Any single technical committee member may veto a coming council proposal, however they can + // only do it once and it lasts only for the cool-off period. + type VetoOrigin = pallet_collective::EnsureMember; + type VoteLockingPeriod = ConstU32; + type VotingPeriod = ConstU32<{ 28 * DAYS }>; + type WeightInfo = (); +} diff --git a/runtime/pangolin/src/pallets/dmp_queue.rs b/runtime/pangolin/src/pallets/dmp_queue.rs new file mode 100644 index 000000000..6f0829542 --- /dev/null +++ b/runtime/pangolin/src/pallets/dmp_queue.rs @@ -0,0 +1,26 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +impl cumulus_pallet_dmp_queue::Config for Runtime { + type ExecuteOverweightOrigin = EnsureRoot; + type RuntimeEvent = RuntimeEvent; + type XcmExecutor = XcmExecutor; +} diff --git a/runtime/pangolin/src/pallets/elections_phragmen.rs b/runtime/pangolin/src/pallets/elections_phragmen.rs new file mode 100644 index 000000000..f637a0b98 --- /dev/null +++ b/runtime/pangolin/src/pallets/elections_phragmen.rs @@ -0,0 +1,49 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +const MAX_CANDIDATES: u32 = 30; + +frame_support::parameter_types! { + pub const PhragmenElectionPalletId: frame_support::traits::LockIdentifier = *b"phrelect"; +} + +impl pallet_elections_phragmen::Config for Runtime { + type CandidacyBond = ConstU128<{ 100 * MILLIUNIT }>; + type ChangeMembers = Council; + type Currency = Balances; + type CurrencyToVote = frame_support::traits::U128CurrencyToVote; + type DesiredMembers = ConstU32; + type DesiredRunnersUp = ConstU32<7>; + type InitializeMembers = Council; + type KickedMember = Treasury; + type LoserCandidate = Treasury; + type MaxCandidates = ConstU32; + type MaxVoters = ConstU32<{ 10 * MAX_CANDIDATES }>; + type PalletId = PhragmenElectionPalletId; + type RuntimeEvent = RuntimeEvent; + // Daily council elections. + type TermDuration = ConstU32<{ 7 * DAYS }>; + // 1 storage item created, key size is 32 bytes, value size is 16+16. + type VotingBondBase = ConstU128<{ darwinia_deposit(1, 64) }>; + // Additional data per vote is 32 bytes (account id). + type VotingBondFactor = ConstU128<{ darwinia_deposit(0, 32) }>; + type WeightInfo = (); +} diff --git a/runtime/pangolin/src/pallets/ethereum.rs b/runtime/pangolin/src/pallets/ethereum.rs new file mode 100644 index 000000000..074feb5ba --- /dev/null +++ b/runtime/pangolin/src/pallets/ethereum.rs @@ -0,0 +1,25 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +impl pallet_ethereum::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type StateRoot = pallet_ethereum::IntermediateStateRoot; +} diff --git a/runtime/pangolin/src/pallets/evm.rs b/runtime/pangolin/src/pallets/evm.rs new file mode 100644 index 000000000..d3daa9110 --- /dev/null +++ b/runtime/pangolin/src/pallets/evm.rs @@ -0,0 +1,164 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; +use darwinia_precompile_bls12_381::BLS12381; +use darwinia_precompile_state_storage::{EthereumStorageFilter, StateStorage}; +// frontier +use pallet_ethereum::EthereumBlockHashMapping; +use pallet_evm::{ + AddressMapping, EnsureAddressNever, EnsureAddressRoot, FeeCalculator, FixedGasWeightMapping, + Precompile, PrecompileHandle, PrecompileResult, PrecompileSet, +}; +use pallet_evm_precompile_blake2::Blake2F; +use pallet_evm_precompile_bn128::{Bn128Add, Bn128Mul, Bn128Pairing}; +use pallet_evm_precompile_dispatch::Dispatch; +use pallet_evm_precompile_modexp::Modexp; +use pallet_evm_precompile_simple::{ECRecover, Identity, Ripemd160, Sha256}; +// substrate +use frame_support::{traits::FindAuthor, ConsensusEngineId}; +use sp_core::crypto::ByteArray; +use sp_std::marker::PhantomData; + +const WEIGHT_PER_GAS: u64 = 40_000; + +frame_support::parameter_types! { + pub BlockGasLimit: U256 = U256::from(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT.ref_time() / WEIGHT_PER_GAS); + pub PrecompilesValue: PangolinPrecompiles = PangolinPrecompiles::<_>::new(); + pub WeightPerGas: Weight = Weight::from_ref_time(WEIGHT_PER_GAS); +} + +pub struct FindAuthorTruncated(PhantomData); +impl> FindAuthor for FindAuthorTruncated { + fn find_author<'a, I>(digests: I) -> Option + where + I: 'a + IntoIterator, + { + F::find_author(digests).and_then(|i| { + Aura::authorities().get(i as usize).and_then(|id| { + let raw = id.to_raw_vec(); + + if raw.len() >= 24 { + Some(H160::from_slice(&raw[4..24])) + } else { + None + } + }) + }) + } +} + +pub struct FixedGasPrice; +impl FeeCalculator for FixedGasPrice { + fn min_gas_price() -> (U256, Weight) { + (U256::from(GWEI), Weight::zero()) + } +} + +// TODO: Integrate to the upstream repo +pub struct FromH160; +impl AddressMapping for FromH160 +where + T: From, +{ + fn into_account_id(address: H160) -> T { + address.into() + } +} + +pub struct PangolinPrecompiles(PhantomData); +impl PangolinPrecompiles +where + R: pallet_evm::Config, +{ + #[allow(clippy::new_without_default)] + pub fn new() -> Self { + Self(Default::default()) + } + + pub fn used_addresses() -> [H160; 12] { + [ + addr(1), + addr(2), + addr(3), + addr(4), + addr(5), + addr(6), + addr(7), + addr(8), + addr(9), + addr(1024), + addr(1025), + addr(2048), + ] + } +} +impl PrecompileSet for PangolinPrecompiles +where + R: pallet_evm::Config, +{ + fn execute(&self, handle: &mut impl PrecompileHandle) -> Option { + match handle.code_address() { + // Ethereum precompiles: + a if a == addr(1) => Some(ECRecover::execute(handle)), + a if a == addr(2) => Some(Sha256::execute(handle)), + a if a == addr(3) => Some(Ripemd160::execute(handle)), + a if a == addr(4) => Some(Identity::execute(handle)), + a if a == addr(5) => Some(Modexp::execute(handle)), + a if a == addr(6) => Some(Bn128Add::execute(handle)), + a if a == addr(7) => Some(Bn128Mul::execute(handle)), + a if a == addr(8) => Some(Bn128Pairing::execute(handle)), + a if a == addr(9) => Some(Blake2F::execute(handle)), + // Darwinia precompiles: 1024+ for stable precompiles. + a if a == addr(1024) => + Some(>::execute(handle)), + a if a == addr(1025) => Some(>::execute(handle)), + // Darwinia precompiles: 2048+ for experimental precompiles. + a if a == addr(2048) => Some(>::execute(handle)), + _ => None, + } + } + + fn is_precompile(&self, address: H160) -> bool { + Self::used_addresses().contains(&address) + } +} + +impl pallet_evm::Config for Runtime { + type AddressMapping = FromH160; + type BlockGasLimit = BlockGasLimit; + type BlockHashMapping = EthereumBlockHashMapping; + type CallOrigin = EnsureAddressRoot; + type ChainId = ConstU64<43>; + type Currency = Balances; + type FeeCalculator = FixedGasPrice; + type FindAuthor = FindAuthorTruncated; + type GasWeightMapping = FixedGasWeightMapping; + type OnChargeTransaction = (); + type PrecompilesType = PangolinPrecompiles; + type PrecompilesValue = PrecompilesValue; + type Runner = pallet_evm::runner::stack::Runner; + type RuntimeEvent = RuntimeEvent; + type WeightPerGas = WeightPerGas; + type WithdrawOrigin = EnsureAddressNever; +} + +fn addr(a: u64) -> H160 { + H160::from_low_u64_be(a) +} diff --git a/runtime/pangolin/src/pallets/identity.rs b/runtime/pangolin/src/pallets/identity.rs new file mode 100644 index 000000000..6ed7cbfd7 --- /dev/null +++ b/runtime/pangolin/src/pallets/identity.rs @@ -0,0 +1,39 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +impl pallet_identity::Config for Runtime { + // Minimum 100 bytes/UNIT deposited (1 MILLIUNIT/byte). + // 258 bytes on-chain. + type BasicDeposit = ConstU128<{ darwinia_deposit(1, 258) }>; + type Currency = Balances; + // 66 bytes on-chain. + type FieldDeposit = ConstU128<{ darwinia_deposit(0, 66) }>; + type ForceOrigin = RootOrMoreThanHalf; + type MaxAdditionalFields = ConstU32<100>; + type MaxRegistrars = ConstU32<20>; + type MaxSubAccounts = ConstU32<100>; + type RegistrarOrigin = RootOrMoreThanHalf; + type RuntimeEvent = RuntimeEvent; + type Slashed = Treasury; + // 53 bytes on-chain. + type SubAccountDeposit = ConstU128<{ darwinia_deposit(1, 53) }>; + type WeightInfo = (); +} diff --git a/runtime/pangolin/src/pallets/membership.rs b/runtime/pangolin/src/pallets/membership.rs new file mode 100644 index 000000000..2e5c3e9dc --- /dev/null +++ b/runtime/pangolin/src/pallets/membership.rs @@ -0,0 +1,33 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +impl pallet_membership::Config for Runtime { + type AddOrigin = RootOrMoreThanHalf; + type MaxMembers = ConstU32; + type MembershipChanged = TechnicalCommittee; + type MembershipInitialized = TechnicalCommittee; + type PrimeOrigin = RootOrMoreThanHalf; + type RemoveOrigin = RootOrMoreThanHalf; + type ResetOrigin = RootOrMoreThanHalf; + type RuntimeEvent = RuntimeEvent; + type SwapOrigin = RootOrMoreThanHalf; + type WeightInfo = (); +} diff --git a/runtime/pangolin/src/pallets/mod.rs b/runtime/pangolin/src/pallets/mod.rs new file mode 100644 index 000000000..3df9e4ccb --- /dev/null +++ b/runtime/pangolin/src/pallets/mod.rs @@ -0,0 +1,99 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +mod shared_imports { + // darwinia + pub use darwinia_common_runtime::gov_origin::*; + // substrate + pub use sp_runtime::traits::{ConstBool, ConstU128, ConstU16, ConstU32, ConstU64, ConstU8}; +} +pub use shared_imports::*; + +// System stuffs. +mod system; +pub use system::*; + +mod parachain_system; + +mod timestamp; + +mod parachain_info_; + +// Monetary stuff. +mod balances; + +mod transaction_payment; + +// Consensus stuff. +mod authorship; + +mod collator_selection; + +mod session; +pub use session::*; + +mod aura; + +mod aura_ext; + +// Governance stuff. +mod democracy; + +mod collective; +pub use collective::*; + +mod elections_phragmen; + +mod membership; + +mod treasury; + +mod tips; + +// Utility stuff. +mod sudo; + +mod vesting; + +mod utility; + +mod identity; + +mod scheduler; + +mod preimage; + +mod proxy; + +mod multisig; + +// XCM stuff. +mod xcmp_queue; + +mod polkadot_xcm; +pub use polkadot_xcm::*; + +mod dmp_queue; + +// EVM stuff. +mod ethereum; + +mod evm; +pub use evm::*; + +mod base_fee; diff --git a/runtime/pangolin/src/pallets/multisig.rs b/runtime/pangolin/src/pallets/multisig.rs new file mode 100644 index 000000000..0322271ae --- /dev/null +++ b/runtime/pangolin/src/pallets/multisig.rs @@ -0,0 +1,32 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +impl pallet_multisig::Config for Runtime { + type Currency = Balances; + // One storage item; key size is 32; value is size 4+4+16+32 bytes = 56 bytes. + type DepositBase = ConstU128<{ darwinia_deposit(1, 88) }>; + // Additional storage item size of 32 bytes. + type DepositFactor = ConstU128<{ darwinia_deposit(0, 32) }>; + type MaxSignatories = ConstU16<100>; + type RuntimeCall = RuntimeCall; + type RuntimeEvent = RuntimeEvent; + type WeightInfo = (); +} diff --git a/runtime/pangolin/src/pallets/parachain_info_.rs b/runtime/pangolin/src/pallets/parachain_info_.rs new file mode 100644 index 000000000..ff727f636 --- /dev/null +++ b/runtime/pangolin/src/pallets/parachain_info_.rs @@ -0,0 +1,22 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +impl parachain_info::Config for Runtime {} diff --git a/runtime/pangolin/src/pallets/parachain_system.rs b/runtime/pangolin/src/pallets/parachain_system.rs new file mode 100644 index 000000000..a97fd540a --- /dev/null +++ b/runtime/pangolin/src/pallets/parachain_system.rs @@ -0,0 +1,37 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +frame_support::parameter_types! { + pub const ReservedXcmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT.saturating_div(4); + pub const ReservedDmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT.saturating_div(4); +} + +impl cumulus_pallet_parachain_system::Config for Runtime { + type CheckAssociatedRelayNumber = RelayNumberStrictlyIncreases; + type DmpMessageHandler = DmpQueue; + type OnSystemEvent = (); + type OutboundXcmpMessageSource = XcmpQueue; + type ReservedDmpWeight = ReservedDmpWeight; + type ReservedXcmpWeight = ReservedXcmpWeight; + type RuntimeEvent = RuntimeEvent; + type SelfParaId = parachain_info::Pallet; + type XcmpMessageHandler = XcmpQueue; +} diff --git a/runtime/pangolin/src/pallets/polkadot_xcm.rs b/runtime/pangolin/src/pallets/polkadot_xcm.rs new file mode 100644 index 000000000..b0e91ea36 --- /dev/null +++ b/runtime/pangolin/src/pallets/polkadot_xcm.rs @@ -0,0 +1,169 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; +use darwinia_common_runtime::xcm_barrier::*; +// moonbeam +use xcm_primitives::*; +// polkadot +use pallet_xcm::XcmPassthrough; +use polkadot_parachain::primitives::Sibling; +use xcm::latest::prelude::*; +use xcm_builder::*; +use xcm_executor::XcmExecutor; +// substrate +use frame_support::traits::{Everything, Nothing, PalletInfoAccess}; + +/// Means for transacting assets on this chain. +pub type LocalAssetTransactor = CurrencyAdapter< + // Use this currency: + Balances, + // Use this currency when it is a fungible asset matching the given location or name: + IsConcrete, + // Do a simple punn to convert an AccountId32 MultiLocation into a native chain account ID: + LocationToAccountId, + // Our chain's account ID type (we can't get away without mentioning it explicitly): + AccountId, + // We don't track any teleports. + (), +>; + +frame_support::parameter_types! { + pub const RelayNetwork: NetworkId = NetworkId::Any; + pub RelayChainOrigin: RuntimeOrigin = cumulus_pallet_xcm::Origin::Relay.into(); +} +/// Type for specifying how a `MultiLocation` can be converted into an `AccountId`. This is used +/// when determining ownership of accounts for asset transacting and when attempting to use XCM +/// `Transact` in order to determine the dispatch Origin. +pub type LocationToAccountId = ( + // The parent (Relay-chain) origin converts to the parent `AccountId`. + ParentIsPreset, + // Sibling parachain origins convert to AccountId via the `ParaId::into`. + SiblingParachainConvertsVia, + // Straight up local `AccountId20` origins just alias directly to `AccountId`. + AccountKey20Aliases, +); +/// This is the type we use to convert an (incoming) XCM origin into a local `Origin` instance, +/// ready for dispatching a transaction with Xcm's `Transact`. There is an `OriginKind` which can +/// biases the kind of local `Origin` it will become. +pub type XcmOriginToTransactDispatchOrigin = ( + // Sovereign account converter; this attempts to derive an `AccountId` from the origin location + // using `LocationToAccountId` and then turn that into the usual `Signed` origin. Useful for + // foreign chains who want to have a local sovereign account on this chain which they control. + SovereignSignedViaLocation, + // Native converter for Relay-chain (Parent) location; will converts to a `Relay` origin when + // recognized. + RelayChainAsNative, + // Native converter for sibling Parachains; will convert to a `SiblingPara` origin when + // recognized. + SiblingParachainAsNative, + // Native signed account converter; this just converts an `AccountKey20` origin into a normal + // `RuntimeOrigin::Signed` origin of the same 20-byte value. + SignedAccountKey20AsNative, + // Xcm origins can be represented natively under the Xcm pallet's Xcm origin. + XcmPassthrough, +); + +pub type Barrier = DenyThenTry< + DenyReserveTransferToRelayChain, + ( + TakeWeightCredit, + AllowTopLevelPaidExecutionFrom, + // Parent and its exec plurality get free execution + AllowUnpaidExecutionFrom, + // Expected responses are OK. + AllowKnownQueryResponses, + // Subscriptions for version tracking are OK. + AllowSubscriptionsFrom, + ), +>; + +frame_support::parameter_types! { + pub const MaxInstructions: u32 = 100; + pub AnchoringSelfReserve: MultiLocation = MultiLocation::new( + 0, + X1(PalletInstance(::index() as u8)) + ); + // One XCM operation is 1_000_000_000 weight - almost certainly a conservative estimate. + pub Ancestry: MultiLocation = Parachain(ParachainInfo::parachain_id().into()).into(); + pub UnitWeightCost: u64 = 1_000_000_000; +} + +pub struct XcmExecutorConfig; +impl xcm_executor::Config for XcmExecutorConfig { + type AssetClaims = PolkadotXcm; + // How to withdraw and deposit an asset. + type AssetTransactor = LocalAssetTransactor; + type AssetTrap = PolkadotXcm; + type Barrier = Barrier; + type IsReserve = NativeAsset; + type IsTeleporter = (); + // Teleporting is disabled. + type LocationInverter = LocationInverter; + type OriginConverter = XcmOriginToTransactDispatchOrigin; + type ResponseHandler = PolkadotXcm; + type RuntimeCall = RuntimeCall; + type SubscriptionService = PolkadotXcm; + type Trader = UsingComponents< + WeightToFee, + AnchoringSelfReserve, + AccountId, + Balances, + DealWithFees, + >; + type Weigher = FixedWeightBounds; + type XcmSender = XcmRouter; +} + +/// No local origins on this chain are allowed to dispatch XCM sends/executions. +pub type LocalOriginToLocation = SignedToAccountId20; +/// The means for routing XCM messages which are not for local execution into the right message +/// queues. +pub type XcmRouter = ( + // Two routers - use UMP to communicate with the relay chain: + cumulus_primitives_utility::ParentAsUmp, + // ..and XCMP to communicate with the sibling chains. + XcmpQueue, +); + +impl pallet_xcm::Config for Runtime { + // ^ Override for AdvertisedXcmVersion default + type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion; + type ExecuteXcmOrigin = EnsureXcmOrigin; + type LocationInverter = LocationInverter; + type RuntimeCall = RuntimeCall; + type RuntimeEvent = RuntimeEvent; + type RuntimeOrigin = RuntimeOrigin; + type SendXcmOrigin = EnsureXcmOrigin; + type Weigher = FixedWeightBounds; + type XcmExecuteFilter = Nothing; + // ^ Disable dispatchable execute on the XCM pallet. + // Needs to be `Everything` for local testing. + type XcmExecutor = XcmExecutor; + type XcmReserveTransferFilter = Nothing; + type XcmRouter = XcmRouter; + type XcmTeleportFilter = Nothing; + + const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100; +} + +impl cumulus_pallet_xcm::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type XcmExecutor = XcmExecutor; +} diff --git a/runtime/pangolin/src/pallets/preimage.rs b/runtime/pangolin/src/pallets/preimage.rs new file mode 100644 index 000000000..69fff06fc --- /dev/null +++ b/runtime/pangolin/src/pallets/preimage.rs @@ -0,0 +1,30 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +impl pallet_preimage::Config for Runtime { + type BaseDeposit = ConstU128<{ 500 * UNIT }>; + type ByteDeposit = ConstU128<{ darwinia_deposit(0, 1) }>; + type Currency = Balances; + type ManagerOrigin = Root; + type MaxSize = ConstU32<{ 4096 * 1024 }>; + type RuntimeEvent = RuntimeEvent; + type WeightInfo = (); +} diff --git a/runtime/pangolin/src/pallets/proxy.rs b/runtime/pangolin/src/pallets/proxy.rs new file mode 100644 index 000000000..172ea4e89 --- /dev/null +++ b/runtime/pangolin/src/pallets/proxy.rs @@ -0,0 +1,86 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +/// The type used to represent the kinds of proxying allowed. +#[derive( + Copy, + Clone, + Eq, + PartialEq, + Ord, + PartialOrd, + codec::Encode, + codec::Decode, + codec::MaxEncodedLen, + scale_info::TypeInfo, + sp_runtime::RuntimeDebug, +)] +pub enum ProxyType { + Any, + NonTransfer, + Governance, + IdentityJudgement, + EthereumBridge, +} +impl Default for ProxyType { + fn default() -> Self { + Self::Any + } +} +impl frame_support::traits::InstanceFilter for ProxyType { + // TODO: configure filter + fn filter(&self, _c: &RuntimeCall) -> bool { + match self { + ProxyType::Any => true, + ProxyType::NonTransfer => true, + ProxyType::Governance => true, + ProxyType::IdentityJudgement => true, + ProxyType::EthereumBridge => true, + } + } + + fn is_superset(&self, o: &Self) -> bool { + match (self, o) { + (x, y) if x == y => true, + (ProxyType::Any, _) => true, + (_, ProxyType::Any) => false, + (ProxyType::NonTransfer, _) => true, + _ => false, + } + } +} + +impl pallet_proxy::Config for Runtime { + type AnnouncementDepositBase = ConstU128<{ darwinia_deposit(1, 8) }>; + type AnnouncementDepositFactor = ConstU128<{ darwinia_deposit(0, 66) }>; + type CallHasher = Hashing; + type Currency = Balances; + type MaxPending = ConstU32<32>; + type MaxProxies = ConstU32<32>; + // One storage item; key size 32, value size 8; . + type ProxyDepositBase = ConstU128<{ darwinia_deposit(1, 8) }>; + // Additional storage item size of 33 bytes. + type ProxyDepositFactor = ConstU128<{ darwinia_deposit(0, 33) }>; + type ProxyType = ProxyType; + type RuntimeCall = RuntimeCall; + type RuntimeEvent = RuntimeEvent; + type WeightInfo = (); +} diff --git a/runtime/pangolin/src/pallets/scheduler.rs b/runtime/pangolin/src/pallets/scheduler.rs new file mode 100644 index 000000000..17aded6e8 --- /dev/null +++ b/runtime/pangolin/src/pallets/scheduler.rs @@ -0,0 +1,64 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +/// Used the compare the privilege of an origin inside the scheduler. +pub struct OriginPrivilegeCmp; +impl frame_support::traits::PrivilegeCmp for OriginPrivilegeCmp { + fn cmp_privilege(left: &OriginCaller, right: &OriginCaller) -> Option { + if left == right { + return Some(core::cmp::Ordering::Equal); + } + + match (left, right) { + // Root is greater than anything. + (OriginCaller::system(frame_system::RawOrigin::Root), _) => + Some(core::cmp::Ordering::Greater), + // Check which one has more yes votes. + ( + OriginCaller::Council(pallet_collective::RawOrigin::Members(l_yes_votes, l_count)), + OriginCaller::Council(pallet_collective::RawOrigin::Members(r_yes_votes, r_count)), + ) => Some((l_yes_votes * r_count).cmp(&(r_yes_votes * l_count))), + // For every other origin we don't care, as they are not used for `ScheduleOrigin`. + _ => None, + } + } +} + +frame_support::parameter_types! { + pub MaximumSchedulerWeight: frame_support::weights::Weight = sp_runtime::Perbill::from_percent(80) + * RuntimeBlockWeights::get().max_block; + // Retry a scheduled item every 10 blocks (1 minute) until the preimage exists. + pub const NoPreimagePostponement: Option = Some(10); +} + +impl pallet_scheduler::Config for Runtime { + type MaxScheduledPerBlock = ConstU32<50>; + type MaximumWeight = MaximumSchedulerWeight; + type NoPreimagePostponement = NoPreimagePostponement; + type OriginPrivilegeCmp = OriginPrivilegeCmp; + type PalletsOrigin = OriginCaller; + type PreimageProvider = Preimage; + type RuntimeCall = RuntimeCall; + type RuntimeEvent = RuntimeEvent; + type RuntimeOrigin = RuntimeOrigin; + type ScheduleOrigin = Root; + type WeightInfo = (); +} diff --git a/runtime/pangolin/src/pallets/session.rs b/runtime/pangolin/src/pallets/session.rs new file mode 100644 index 000000000..7725500ed --- /dev/null +++ b/runtime/pangolin/src/pallets/session.rs @@ -0,0 +1,45 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +sp_runtime::impl_opaque_keys! { + pub struct SessionKeys { + pub aura: Aura, + } +} + +frame_support::parameter_types! { + pub const Period: u32 = 6 * HOURS; + pub const Offset: u32 = 0; +} + +impl pallet_session::Config for Runtime { + type Keys = SessionKeys; + type NextSessionRotation = pallet_session::PeriodicSessions; + type RuntimeEvent = RuntimeEvent; + // Essentially just Aura, but lets be pedantic. + type SessionHandler = ::KeyTypeIdProviders; + type SessionManager = CollatorSelection; + type ShouldEndSession = pallet_session::PeriodicSessions; + type ValidatorId = ::AccountId; + // we don't have stash and controller, thus we don't need the convert as well. + type ValidatorIdOf = pallet_collator_selection::IdentityCollator; + type WeightInfo = weights::pallet_session::WeightInfo; +} diff --git a/runtime/pangolin/src/pallets/sudo.rs b/runtime/pangolin/src/pallets/sudo.rs new file mode 100644 index 000000000..e66cda23f --- /dev/null +++ b/runtime/pangolin/src/pallets/sudo.rs @@ -0,0 +1,25 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +impl pallet_sudo::Config for Runtime { + type RuntimeCall = RuntimeCall; + type RuntimeEvent = RuntimeEvent; +} diff --git a/runtime/pangolin/src/pallets/system.rs b/runtime/pangolin/src/pallets/system.rs new file mode 100644 index 000000000..bb07e9fea --- /dev/null +++ b/runtime/pangolin/src/pallets/system.rs @@ -0,0 +1,106 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +/// We assume that ~5% of the block weight is consumed by `on_initialize` handlers. This is +/// used to limit the maximal weight of a single extrinsic. +const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(5); + +/// We allow `Normal` extrinsics to fill up the block up to 75%, the rest can be used by +/// `Operational` extrinsics. +pub const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75); + +/// We allow for 0.5 of a second of compute with a 12 second average block time. +pub const MAXIMUM_BLOCK_WEIGHT: Weight = + frame_support::weights::constants::WEIGHT_PER_SECOND.saturating_div(2); + +frame_support::parameter_types! { + pub const Version: sp_version::RuntimeVersion = VERSION; + pub RuntimeBlockLength: frame_system::limits::BlockLength = + frame_system::limits::BlockLength::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO); + pub RuntimeBlockWeights: frame_system::limits::BlockWeights = frame_system::limits::BlockWeights::builder() + .base_block(weights::BlockExecutionWeight::get()) + .for_class(DispatchClass::all(), |weights| { + weights.base_extrinsic = weights::ExtrinsicBaseWeight::get(); + }) + .for_class(DispatchClass::Normal, |weights| { + weights.max_total = Some(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT); + }) + .for_class(DispatchClass::Operational, |weights| { + weights.max_total = Some(MAXIMUM_BLOCK_WEIGHT); + // Operational transactions have some extra reserved space, so that they + // are included even if block reached `MAXIMUM_BLOCK_WEIGHT`. + weights.reserved = Some( + MAXIMUM_BLOCK_WEIGHT - NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT + ); + }) + .avg_block_initialization(AVERAGE_ON_INITIALIZE_RATIO) + .build_or_panic(); +} + +impl frame_system::Config for Runtime { + /// The data to be stored in an account. + type AccountData = pallet_balances::AccountData; + /// The identifier used to distinguish between accounts. + type AccountId = AccountId; + /// The basic call filter to use in dispatchable. + type BaseCallFilter = frame_support::traits::Everything; + /// Maximum number of block number to block hash mappings to keep (oldest pruned first). + type BlockHashCount = ConstU32<2400>; + /// The maximum length of a block (in bytes). + type BlockLength = RuntimeBlockLength; + /// The index type for blocks. + type BlockNumber = BlockNumber; + /// Block & extrinsics weights: base values and limits. + type BlockWeights = RuntimeBlockWeights; + /// The weight of database operations that the runtime can invoke. + type DbWeight = weights::RocksDbWeight; + /// The type for hashing blocks and tries. + type Hash = Hash; + /// The hashing algorithm used. + type Hashing = Hashing; + /// The header type. + type Header = generic::Header; + /// The index type for storing how many extrinsics an account has signed. + type Index = Index; + /// The lookup mechanism to get account ID from whatever is passed in dispatchers. + type Lookup = sp_runtime::traits::IdentityLookup; + type MaxConsumers = frame_support::traits::ConstU32<16>; + /// What to do if an account is fully reaped from the system. + type OnKilledAccount = (); + /// What to do if a new account is created. + type OnNewAccount = (); + /// The action to take on a Runtime Upgrade + type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode; + /// Converts a module to an index of this module in the runtime. + type PalletInfo = PalletInfo; + /// The aggregated dispatch type that is available for extrinsics. + type RuntimeCall = RuntimeCall; + /// The ubiquitous event type. + type RuntimeEvent = RuntimeEvent; + /// The ubiquitous origin type. + type RuntimeOrigin = RuntimeOrigin; + /// This is used as an identifier of the chain. 42 is the generic substrate prefix. + type SS58Prefix = ConstU16<18>; + /// Weight information for the extrinsics of this pallet. + type SystemWeightInfo = weights::frame_system::WeightInfo; + /// Runtime version. + type Version = Version; +} diff --git a/runtime/pangolin/src/pallets/timestamp.rs b/runtime/pangolin/src/pallets/timestamp.rs new file mode 100644 index 000000000..9bf543250 --- /dev/null +++ b/runtime/pangolin/src/pallets/timestamp.rs @@ -0,0 +1,28 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +impl pallet_timestamp::Config for Runtime { + type MinimumPeriod = ConstU64<{ SLOT_DURATION / 2 }>; + /// A timestamp: milliseconds since the unix epoch. + type Moment = u64; + type OnTimestampSet = (); + type WeightInfo = weights::pallet_timestamp::WeightInfo; +} diff --git a/runtime/pangolin/src/pallets/tips.rs b/runtime/pangolin/src/pallets/tips.rs new file mode 100644 index 000000000..83f8cfb89 --- /dev/null +++ b/runtime/pangolin/src/pallets/tips.rs @@ -0,0 +1,35 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +frame_support::parameter_types! { + pub const TipFindersFee: sp_runtime::Percent = sp_runtime::Percent::from_percent(20); +} + +impl pallet_tips::Config for Runtime { + type DataDepositPerByte = ConstU128<{ darwinia_deposit(0, 1) }>; + type MaximumReasonLength = ConstU32<16384>; + type RuntimeEvent = RuntimeEvent; + type TipCountdown = ConstU32; + type TipFindersFee = TipFindersFee; + type TipReportDepositBase = ConstU128<{ 100 * UNIT }>; + type Tippers = PhragmenElection; + type WeightInfo = (); +} diff --git a/runtime/pangolin/src/pallets/transaction_payment.rs b/runtime/pangolin/src/pallets/transaction_payment.rs new file mode 100644 index 000000000..691273b7b --- /dev/null +++ b/runtime/pangolin/src/pallets/transaction_payment.rs @@ -0,0 +1,30 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +impl pallet_transaction_payment::Config for Runtime { + type FeeMultiplierUpdate = polkadot_runtime_common::SlowAdjustingFeeUpdate; + // Relay Chain `TransactionByteFee` / 10 + type LengthToFee = ConstantMultiplier>; + type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter; + type OperationalFeeMultiplier = sp_runtime::traits::ConstU8<5>; + type RuntimeEvent = RuntimeEvent; + type WeightToFee = WeightToFee; +} diff --git a/runtime/pangolin/src/pallets/treasury.rs b/runtime/pangolin/src/pallets/treasury.rs new file mode 100644 index 000000000..901df24b5 --- /dev/null +++ b/runtime/pangolin/src/pallets/treasury.rs @@ -0,0 +1,47 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +frame_support::parameter_types! { + pub const TreasuryPalletId: frame_support::PalletId = frame_support::PalletId(*b"da/trsry"); + pub const ProposalBond: sp_runtime::Permill = sp_runtime::Permill::from_percent(5); + pub const Burn: sp_runtime::Permill = sp_runtime::Permill::from_percent(1); +} + +// In order to use `Tips`, which bounded by `pallet_treasury::Config` rather +// `pallet_treasury::Config` Still use `DefaultInstance` here instead `Instance1` +impl pallet_treasury::Config for Runtime { + type ApproveOrigin = RootOrAtLeastThreeFifth; + type Burn = Burn; + type BurnDestination = (); + type Currency = Balances; + type MaxApprovals = ConstU32<100>; + type OnSlash = Treasury; + type PalletId = TreasuryPalletId; + type ProposalBond = ProposalBond; + type ProposalBondMaximum = (); + type ProposalBondMinimum = ConstU128; + type RejectOrigin = RootOrMoreThanHalf; + type RuntimeEvent = RuntimeEvent; + type SpendFunds = (); + type SpendOrigin = frame_support::traits::NeverEnsureOrigin; + type SpendPeriod = ConstU32<{ 24 * DAYS }>; + type WeightInfo = (); +} diff --git a/runtime/pangolin/src/pallets/utility.rs b/runtime/pangolin/src/pallets/utility.rs new file mode 100644 index 000000000..8bcc96517 --- /dev/null +++ b/runtime/pangolin/src/pallets/utility.rs @@ -0,0 +1,27 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +impl pallet_utility::Config for Runtime { + type PalletsOrigin = OriginCaller; + type RuntimeCall = RuntimeCall; + type RuntimeEvent = RuntimeEvent; + type WeightInfo = (); +} diff --git a/runtime/pangolin/src/pallets/vesting.rs b/runtime/pangolin/src/pallets/vesting.rs new file mode 100644 index 000000000..406b6956f --- /dev/null +++ b/runtime/pangolin/src/pallets/vesting.rs @@ -0,0 +1,32 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +impl pallet_vesting::Config for Runtime { + type BlockNumberToBalance = sp_runtime::traits::ConvertInto; + type Currency = Balances; + type MinVestedTransfer = ConstU128; + type RuntimeEvent = RuntimeEvent; + type WeightInfo = (); + + // `VestingInfo` encode length is 36bytes. 28 schedules gets encoded as 1009 bytes, which is the + // highest number of schedules that encodes less than 2^10. + const MAX_VESTING_SCHEDULES: u32 = 28; +} diff --git a/runtime/pangolin/src/pallets/xcmp_queue.rs b/runtime/pangolin/src/pallets/xcmp_queue.rs new file mode 100644 index 000000000..24be8be1a --- /dev/null +++ b/runtime/pangolin/src/pallets/xcmp_queue.rs @@ -0,0 +1,31 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +impl cumulus_pallet_xcmp_queue::Config for Runtime { + type ChannelInfo = ParachainSystem; + type ControllerOrigin = EnsureRoot; + type ControllerOriginConverter = XcmOriginToTransactDispatchOrigin; + type ExecuteOverweightOrigin = EnsureRoot; + type RuntimeEvent = RuntimeEvent; + type VersionWrapper = (); + type WeightInfo = weights::cumulus_pallet_xcmp_queue::WeightInfo; + type XcmExecutor = XcmExecutor; +} diff --git a/runtime/pangolin/src/weights/block_weights.rs b/runtime/pangolin/src/weights/block_weights.rs new file mode 100644 index 000000000..c00430733 --- /dev/null +++ b/runtime/pangolin/src/weights/block_weights.rs @@ -0,0 +1,52 @@ +// This file is part of Substrate. + +// Copyright (C) 2022 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. + +pub mod constants { + use frame_support::{ + parameter_types, + weights::{constants, Weight}, + }; + + parameter_types! { + /// Importing a block with 0 Extrinsics. + pub const BlockExecutionWeight: Weight = constants::WEIGHT_PER_NANOS.saturating_mul(5_000_000); + } + + #[cfg(test)] + mod test_weights { + use frame_support::weights::constants; + + /// Checks that the weight exists and is sane. + // NOTE: If this test fails but you are sure that the generated values are fine, + // you can delete it. + #[test] + fn sane() { + let w = super::constants::BlockExecutionWeight::get(); + + // At least 100 µs. + assert!( + w.ref_time() >= 100u64 * constants::WEIGHT_PER_MICROS.ref_time(), + "Weight should be at least 100 µs." + ); + // At most 50 ms. + assert!( + w.ref_time() <= 50u64 * constants::WEIGHT_PER_MILLIS.ref_time(), + "Weight should be at most 50 ms." + ); + } + } +} diff --git a/runtime/pangolin/src/weights/cumulus_pallet_xcmp_queue.rs b/runtime/pangolin/src/weights/cumulus_pallet_xcmp_queue.rs new file mode 100644 index 000000000..d018169e2 --- /dev/null +++ b/runtime/pangolin/src/weights/cumulus_pallet_xcmp_queue.rs @@ -0,0 +1,67 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `cumulus_pallet_xcmp_queue` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2022-11-09, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `inv.cafe`, CPU: `AMD Ryzen 9 5950X 16-Core Processor` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("local"), DB CACHE: 1024 + +// Executed Command: +// target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --chain +// local +// --output +// runtime/src/weights +// --extrinsic +// * +// --pallet +// cumulus-pallet-xcmp-queue + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `cumulus_pallet_xcmp_queue`. +pub struct WeightInfo(PhantomData); +impl cumulus_pallet_xcmp_queue::WeightInfo for WeightInfo { + // Storage: XcmpQueue QueueConfig (r:1 w:1) + fn set_config_with_u32() -> Weight { + Weight::from_ref_time(13_340_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: XcmpQueue QueueConfig (r:1 w:1) + fn set_config_with_weight() -> Weight { + Weight::from_ref_time(12_610_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } +} diff --git a/runtime/pangolin/src/weights/extrinsic_weights.rs b/runtime/pangolin/src/weights/extrinsic_weights.rs new file mode 100644 index 000000000..3ce6b73d5 --- /dev/null +++ b/runtime/pangolin/src/weights/extrinsic_weights.rs @@ -0,0 +1,52 @@ +// This file is part of Substrate. + +// Copyright (C) 2022 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. + +pub mod constants { + use frame_support::{ + parameter_types, + weights::{constants, Weight}, + }; + + parameter_types! { + /// Executing a NO-OP `System::remarks` Extrinsic. + pub const ExtrinsicBaseWeight: Weight = constants::WEIGHT_PER_NANOS.saturating_mul(125_000); + } + + #[cfg(test)] + mod test_weights { + use frame_support::weights::constants; + + /// Checks that the weight exists and is sane. + // NOTE: If this test fails but you are sure that the generated values are fine, + // you can delete it. + #[test] + fn sane() { + let w = super::constants::ExtrinsicBaseWeight::get(); + + // At least 10 µs. + assert!( + w.ref_time() >= 10u64 * constants::WEIGHT_PER_MICROS.ref_time(), + "Weight should be at least 10 µs." + ); + // At most 1 ms. + assert!( + w.ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(), + "Weight should be at most 1 ms." + ); + } + } +} diff --git a/runtime/pangolin/src/weights/frame_system.rs b/runtime/pangolin/src/weights/frame_system.rs new file mode 100644 index 000000000..b074be2fc --- /dev/null +++ b/runtime/pangolin/src/weights/frame_system.rs @@ -0,0 +1,88 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `frame_system` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2022-11-09, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `inv.cafe`, CPU: `AMD Ryzen 9 5950X 16-Core Processor` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("local"), DB CACHE: 1024 + +// Executed Command: +// target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --chain +// local +// --output +// runtime/src/weights +// --extrinsic +// * +// --pallet +// frame-system + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `frame_system`. +pub struct WeightInfo(PhantomData); +impl frame_system::WeightInfo for WeightInfo { + /// The range of component `b` is `[0, 3932160]`. + fn remark(_b: u32, ) -> Weight { + Weight::from_ref_time(1_074_555_000 as u64) + } + /// The range of component `b` is `[0, 3932160]`. + fn remark_with_event(_b: u32, ) -> Weight { + Weight::from_ref_time(4_724_488_000 as u64) + } + // Storage: System Digest (r:1 w:1) + // Storage: unknown [0x3a686561707061676573] (r:0 w:1) + fn set_heap_pages() -> Weight { + Weight::from_ref_time(14_110_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) + } + // Storage: Skipped Metadata (r:0 w:0) + /// The range of component `i` is `[1, 1000]`. + fn set_storage(_i: u32, ) -> Weight { + Weight::from_ref_time(655_299_000 as u64) + .saturating_add(T::DbWeight::get().writes(1000 as u64)) + } + // Storage: Skipped Metadata (r:0 w:0) + /// The range of component `i` is `[1, 1000]`. + fn kill_storage(_i: u32, ) -> Weight { + Weight::from_ref_time(555_697_000 as u64) + .saturating_add(T::DbWeight::get().writes(1000 as u64)) + } + // Storage: Skipped Metadata (r:0 w:0) + /// The range of component `p` is `[1, 1000]`. + fn kill_prefix(_p: u32, ) -> Weight { + Weight::from_ref_time(1_089_395_000 as u64) + .saturating_add(T::DbWeight::get().writes(1000 as u64)) + } +} diff --git a/runtime/pangolin/src/weights/mod.rs b/runtime/pangolin/src/weights/mod.rs new file mode 100644 index 000000000..74dbfcbbd --- /dev/null +++ b/runtime/pangolin/src/weights/mod.rs @@ -0,0 +1,40 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Expose the auto generated weight files. + +#![allow(clippy::unnecessary_cast)] + +pub mod block_weights; +pub use block_weights::constants::BlockExecutionWeight; + +pub mod extrinsic_weights; +pub use extrinsic_weights::constants::ExtrinsicBaseWeight; + +pub mod paritydb_weights; +pub use paritydb_weights::constants::ParityDbWeight; + +pub mod rocksdb_weights; +pub use rocksdb_weights::constants::RocksDbWeight; + +pub mod cumulus_pallet_xcmp_queue; +pub mod frame_system; +pub mod pallet_balances; +pub mod pallet_collator_selection; +pub mod pallet_session; +pub mod pallet_timestamp; diff --git a/runtime/pangolin/src/weights/pallet_balances.rs b/runtime/pangolin/src/weights/pallet_balances.rs new file mode 100644 index 000000000..830c7c8cb --- /dev/null +++ b/runtime/pangolin/src/weights/pallet_balances.rs @@ -0,0 +1,97 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `pallet_balances` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2022-11-09, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `inv.cafe`, CPU: `AMD Ryzen 9 5950X 16-Core Processor` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("local"), DB CACHE: 1024 + +// Executed Command: +// target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --chain +// local +// --output +// runtime/src/weights +// --extrinsic +// * +// --pallet +// pallet-balances + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_balances`. +pub struct WeightInfo(PhantomData); +impl pallet_balances::WeightInfo for WeightInfo { + // Storage: System Account (r:1 w:1) + fn transfer() -> Weight { + Weight::from_ref_time(57_141_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: System Account (r:1 w:1) + fn transfer_keep_alive() -> Weight { + Weight::from_ref_time(43_271_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: System Account (r:1 w:1) + fn set_balance_creating() -> Weight { + Weight::from_ref_time(29_941_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: System Account (r:1 w:1) + fn set_balance_killing() -> Weight { + Weight::from_ref_time(34_490_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: System Account (r:2 w:2) + fn force_transfer() -> Weight { + Weight::from_ref_time(54_911_000 as u64) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) + } + // Storage: System Account (r:1 w:1) + fn transfer_all() -> Weight { + Weight::from_ref_time(49_671_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: System Account (r:1 w:1) + fn force_unreserve() -> Weight { + Weight::from_ref_time(26_120_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } +} diff --git a/runtime/pangolin/src/weights/pallet_collator_selection.rs b/runtime/pangolin/src/weights/pallet_collator_selection.rs new file mode 100644 index 000000000..affdfcef8 --- /dev/null +++ b/runtime/pangolin/src/weights/pallet_collator_selection.rs @@ -0,0 +1,111 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `pallet_collator_selection` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2022-11-09, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `inv.cafe`, CPU: `AMD Ryzen 9 5950X 16-Core Processor` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("local"), DB CACHE: 1024 + +// Executed Command: +// target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --chain +// local +// --output +// runtime/src/weights +// --extrinsic +// set_invulnerables,set_desired_candidates,set_candidacy_bond,leave_intent,new_session,note_author +// --pallet +// pallet-collator-selection + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_collator_selection`. +pub struct WeightInfo(PhantomData); +impl pallet_collator_selection::WeightInfo for WeightInfo { + // Storage: Session NextKeys (r:1 w:0) + // Storage: CollatorSelection Invulnerables (r:0 w:1) + /// The range of component `b` is `[1, 100]`. + fn set_invulnerables(_b: u32, ) -> Weight { + Weight::from_ref_time(317_565_000 as u64) + .saturating_add(T::DbWeight::get().reads(100 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: CollatorSelection DesiredCandidates (r:0 w:1) + fn set_desired_candidates() -> Weight { + Weight::from_ref_time(19_951_000 as u64) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: CollatorSelection CandidacyBond (r:0 w:1) + fn set_candidacy_bond() -> Weight { + Weight::from_ref_time(19_730_000 as u64) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + fn register_as_candidate(c: u32) -> Weight { + Weight::from_ref_time(71_196_000 as u64) + // Standard Error: 0 + .saturating_add(Weight::from_ref_time(198_000 as u64).saturating_mul(c as u64)) + .saturating_add(T::DbWeight::get().reads(4 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) + } + // Storage: CollatorSelection Candidates (r:1 w:1) + // Storage: CollatorSelection LastAuthoredBlock (r:0 w:1) + /// The range of component `c` is `[6, 1000]`. + fn leave_intent(_c: u32, ) -> Weight { + Weight::from_ref_time(181_302_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) + } + // Storage: System Account (r:2 w:2) + // Storage: System BlockWeight (r:1 w:1) + // Storage: CollatorSelection LastAuthoredBlock (r:0 w:1) + fn note_author() -> Weight { + Weight::from_ref_time(43_091_000 as u64) + .saturating_add(T::DbWeight::get().reads(3 as u64)) + .saturating_add(T::DbWeight::get().writes(4 as u64)) + } + // Storage: CollatorSelection Candidates (r:1 w:1) + // Storage: CollatorSelection LastAuthoredBlock (r:1000 w:1) + // Storage: System Account (r:1 w:1) + // Storage: CollatorSelection Invulnerables (r:1 w:0) + // Storage: System BlockWeight (r:1 w:1) + /// The range of component `r` is `[1, 1000]`. + /// The range of component `c` is `[1, 1000]`. + fn new_session(_r: u32, c: u32, ) -> Weight { + Weight::from_ref_time(28_111_000 as u64) + // Standard Error: 39_309 + .saturating_add(Weight::from_ref_time(3_055_761 as u64).saturating_mul(c as u64)) + .saturating_add(T::DbWeight::get().reads(4 as u64)) + .saturating_add(T::DbWeight::get().reads((1 as u64).saturating_mul(c as u64))) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } +} diff --git a/runtime/pangolin/src/weights/pallet_session.rs b/runtime/pangolin/src/weights/pallet_session.rs new file mode 100644 index 000000000..f776ff689 --- /dev/null +++ b/runtime/pangolin/src/weights/pallet_session.rs @@ -0,0 +1,69 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `pallet_session` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2022-11-09, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `inv.cafe`, CPU: `AMD Ryzen 9 5950X 16-Core Processor` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("local"), DB CACHE: 1024 + +// Executed Command: +// target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --chain +// local +// --output +// runtime/src/weights +// --extrinsic +// * +// --pallet +// pallet-session + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_session`. +pub struct WeightInfo(PhantomData); +impl pallet_session::WeightInfo for WeightInfo { + // Storage: Session NextKeys (r:1 w:1) + // Storage: Session KeyOwner (r:1 w:1) + fn set_keys() -> Weight { + Weight::from_ref_time(30_781_000 as u64) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) + } + // Storage: Session NextKeys (r:1 w:1) + // Storage: Session KeyOwner (r:0 w:1) + fn purge_keys() -> Weight { + Weight::from_ref_time(22_911_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) + } +} diff --git a/runtime/pangolin/src/weights/pallet_timestamp.rs b/runtime/pangolin/src/weights/pallet_timestamp.rs new file mode 100644 index 000000000..fba28a6b0 --- /dev/null +++ b/runtime/pangolin/src/weights/pallet_timestamp.rs @@ -0,0 +1,64 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `pallet_timestamp` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2022-11-09, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `inv.cafe`, CPU: `AMD Ryzen 9 5950X 16-Core Processor` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("local"), DB CACHE: 1024 + +// Executed Command: +// target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --chain +// local +// --output +// runtime/src/weights +// --extrinsic +// * +// --pallet +// pallet-timestamp + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_timestamp`. +pub struct WeightInfo(PhantomData); +impl pallet_timestamp::WeightInfo for WeightInfo { + // Storage: Timestamp Now (r:1 w:1) + fn set() -> Weight { + Weight::from_ref_time(13_230_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + fn on_finalize() -> Weight { + Weight::from_ref_time(5_710_000 as u64) + } +} diff --git a/runtime/pangolin/src/weights/paritydb_weights.rs b/runtime/pangolin/src/weights/paritydb_weights.rs new file mode 100644 index 000000000..dca7d3483 --- /dev/null +++ b/runtime/pangolin/src/weights/paritydb_weights.rs @@ -0,0 +1,63 @@ +// This file is part of Substrate. + +// Copyright (C) 2022 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. + +pub mod constants { + use frame_support::{ + parameter_types, + weights::{constants, RuntimeDbWeight}, + }; + + parameter_types! { + /// `ParityDB` can be enabled with a feature flag, but is still experimental. These weights + /// are available for brave runtime engineers who may want to try this out as default. + pub const ParityDbWeight: RuntimeDbWeight = RuntimeDbWeight { + read: 8_000 * constants::WEIGHT_PER_NANOS.ref_time(), + write: 50_000 * constants::WEIGHT_PER_NANOS.ref_time(), + }; + } + + #[cfg(test)] + mod test_db_weights { + use super::constants::ParityDbWeight as W; + use frame_support::weights::constants; + + /// Checks that all weights exist and have sane values. + // NOTE: If this test fails but you are sure that the generated values are fine, + // you can delete it. + #[test] + fn sane() { + // At least 1 µs. + assert!( + W::get().reads(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(), + "Read weight should be at least 1 µs." + ); + assert!( + W::get().writes(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(), + "Write weight should be at least 1 µs." + ); + // At most 1 ms. + assert!( + W::get().reads(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(), + "Read weight should be at most 1 ms." + ); + assert!( + W::get().writes(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(), + "Write weight should be at most 1 ms." + ); + } + } +} diff --git a/runtime/pangolin/src/weights/rocksdb_weights.rs b/runtime/pangolin/src/weights/rocksdb_weights.rs new file mode 100644 index 000000000..87867ebfe --- /dev/null +++ b/runtime/pangolin/src/weights/rocksdb_weights.rs @@ -0,0 +1,63 @@ +// This file is part of Substrate. + +// Copyright (C) 2022 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. + +pub mod constants { + use frame_support::{ + parameter_types, + weights::{constants, RuntimeDbWeight}, + }; + + parameter_types! { + /// By default, Substrate uses `RocksDB`, so this will be the weight used throughout + /// the runtime. + pub const RocksDbWeight: RuntimeDbWeight = RuntimeDbWeight { + read: 25_000 * constants::WEIGHT_PER_NANOS.ref_time(), + write: 100_000 * constants::WEIGHT_PER_NANOS.ref_time(), + }; + } + + #[cfg(test)] + mod test_db_weights { + use super::constants::RocksDbWeight as W; + use frame_support::weights::constants; + + /// Checks that all weights exist and have sane values. + // NOTE: If this test fails but you are sure that the generated values are fine, + // you can delete it. + #[test] + fn sane() { + // At least 1 µs. + assert!( + W::get().reads(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(), + "Read weight should be at least 1 µs." + ); + assert!( + W::get().writes(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(), + "Write weight should be at least 1 µs." + ); + // At most 1 ms. + assert!( + W::get().reads(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(), + "Read weight should be at most 1 ms." + ); + assert!( + W::get().writes(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(), + "Write weight should be at most 1 ms." + ); + } + } +} From fc0ea38c2511ce2dab22aa45e5d4535b2fada013 Mon Sep 17 00:00:00 2001 From: bear Date: Tue, 29 Nov 2022 11:36:27 +0800 Subject: [PATCH 018/189] Add assets component (#69) * Add asset pallet * Add asset precompile * Add precompile interface * Impl all asset precompile interfaces * Self review * Code clean * Add mock file * Fix test compile * Add test 1 * Add test 2 * Add test 3 * Add test 4 * Finish test * Add another type * Update asset origin * Fix CI * Move out from Others * Add asset to other runtimes --- Cargo.lock | 43 +- node/src/chain_spec/crab.rs | 2 + node/src/chain_spec/darwinia.rs | 2 + node/src/chain_spec/pangolin.rs | 2 + precompiles/assets/Cargo.toml | 59 ++ precompiles/assets/src/lib.rs | 440 ++++++++++++ precompiles/assets/src/mock.rs | 285 ++++++++ precompiles/assets/src/tests.rs | 884 +++++++++++++++++++++++++ runtime/crab/Cargo.toml | 6 + runtime/crab/src/lib.rs | 1 + runtime/crab/src/pallets/assets.rs | 41 ++ runtime/crab/src/pallets/evm.rs | 20 +- runtime/crab/src/pallets/mod.rs | 3 + runtime/darwinia/Cargo.toml | 6 + runtime/darwinia/src/lib.rs | 1 + runtime/darwinia/src/pallets/assets.rs | 41 ++ runtime/darwinia/src/pallets/evm.rs | 20 +- runtime/darwinia/src/pallets/mod.rs | 3 + runtime/pangolin/Cargo.toml | 6 + runtime/pangolin/src/lib.rs | 1 + runtime/pangolin/src/pallets/assets.rs | 41 ++ runtime/pangolin/src/pallets/evm.rs | 20 +- runtime/pangolin/src/pallets/mod.rs | 3 + 23 files changed, 1920 insertions(+), 10 deletions(-) create mode 100644 precompiles/assets/Cargo.toml create mode 100644 precompiles/assets/src/lib.rs create mode 100644 precompiles/assets/src/mock.rs create mode 100644 precompiles/assets/src/tests.rs create mode 100644 runtime/crab/src/pallets/assets.rs create mode 100644 runtime/darwinia/src/pallets/assets.rs create mode 100644 runtime/pangolin/src/pallets/assets.rs diff --git a/Cargo.lock b/Cargo.lock index 751919053..f81586b72 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1332,6 +1332,7 @@ dependencies = [ "cumulus-primitives-timestamp", "cumulus-primitives-utility", "darwinia-common-runtime", + "darwinia-precompile-assets", "darwinia-precompile-bls12-381", "darwinia-precompile-state-storage", "dc-primitives", @@ -1345,6 +1346,7 @@ dependencies = [ "frame-system-benchmarking", "frame-system-rpc-runtime-api", "frame-try-runtime", + "pallet-assets", "pallet-aura", "pallet-authorship", "pallet-balances", @@ -2277,6 +2279,27 @@ dependencies = [ "xcm-executor", ] +[[package]] +name = "darwinia-precompile-assets" +version = "6.0.0" +dependencies = [ + "fp-evm", + "frame-support", + "frame-system", + "pallet-assets", + "pallet-balances", + "pallet-evm", + "pallet-timestamp", + "parity-scale-codec", + "precompile-utils", + "scale-info", + "sha3 0.8.2", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", +] + [[package]] name = "darwinia-precompile-bls12-381" version = "6.0.0" @@ -2336,6 +2359,7 @@ dependencies = [ "cumulus-primitives-timestamp", "cumulus-primitives-utility", "darwinia-common-runtime", + "darwinia-precompile-assets", "darwinia-precompile-bls12-381", "darwinia-precompile-state-storage", "dc-primitives", @@ -2349,6 +2373,7 @@ dependencies = [ "frame-system-benchmarking", "frame-system-rpc-runtime-api", "frame-try-runtime", + "pallet-assets", "pallet-aura", "pallet-authorship", "pallet-balances", @@ -6008,6 +6033,20 @@ dependencies = [ "stable_deref_trait", ] +[[package]] +name = "pallet-assets" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "parity-scale-codec", + "scale-info", + "sp-runtime", + "sp-std", +] + [[package]] name = "pallet-aura" version = "4.0.0-dev" @@ -7126,6 +7165,7 @@ dependencies = [ "cumulus-primitives-timestamp", "cumulus-primitives-utility", "darwinia-common-runtime", + "darwinia-precompile-assets", "darwinia-precompile-bls12-381", "darwinia-precompile-state-storage", "dc-primitives", @@ -7139,6 +7179,7 @@ dependencies = [ "frame-system-benchmarking", "frame-system-rpc-runtime-api", "frame-try-runtime", + "pallet-assets", "pallet-aura", "pallet-authorship", "pallet-balances", @@ -12615,7 +12656,7 @@ version = "1.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" dependencies = [ - "cfg-if 0.1.10", + "cfg-if 1.0.0", "digest 0.10.5", "rand 0.8.5", "static_assertions", diff --git a/node/src/chain_spec/crab.rs b/node/src/chain_spec/crab.rs index a4b3987af..a0f08efd9 100644 --- a/node/src/chain_spec/crab.rs +++ b/node/src/chain_spec/crab.rs @@ -176,6 +176,7 @@ pub fn config() -> ChainSpec { parachain_info: crab_runtime::ParachainInfoConfig { parachain_id: 2105.into() }, // Monetary stuff. + assets: Default::default(), balances: Default::default(), transaction_payment: Default::default(), @@ -249,6 +250,7 @@ fn testnet_genesis( parachain_info: crab_runtime::ParachainInfoConfig { parachain_id: id }, // Monetary stuff. + assets: Default::default(), balances: crab_runtime::BalancesConfig { balances: endowed_accounts.iter().cloned().map(|k| (k, 100_000_000 * UNIT)).collect(), }, diff --git a/node/src/chain_spec/darwinia.rs b/node/src/chain_spec/darwinia.rs index 3486ebaad..deac4ea87 100644 --- a/node/src/chain_spec/darwinia.rs +++ b/node/src/chain_spec/darwinia.rs @@ -176,6 +176,7 @@ pub fn config() -> ChainSpec { parachain_info: darwinia_runtime::ParachainInfoConfig { parachain_id: 2046.into() }, // Monetary stuff. + assets: Default::default(), balances: Default::default(), transaction_payment: Default::default(), @@ -251,6 +252,7 @@ fn testnet_genesis( parachain_info: darwinia_runtime::ParachainInfoConfig { parachain_id: id }, // Monetary stuff. + assets: Default::default(), balances: darwinia_runtime::BalancesConfig { balances: endowed_accounts.iter().cloned().map(|k| (k, 100_000_000 * UNIT)).collect(), }, diff --git a/node/src/chain_spec/pangolin.rs b/node/src/chain_spec/pangolin.rs index 3ba5e9213..2729d821a 100644 --- a/node/src/chain_spec/pangolin.rs +++ b/node/src/chain_spec/pangolin.rs @@ -176,6 +176,7 @@ pub fn config() -> ChainSpec { parachain_info: pangolin_runtime::ParachainInfoConfig { parachain_id: 2105.into() }, // Monetary stuff. + assets: Default::default(), balances: Default::default(), transaction_payment: Default::default(), @@ -251,6 +252,7 @@ fn testnet_genesis( parachain_info: pangolin_runtime::ParachainInfoConfig { parachain_id: id }, // Monetary stuff. + assets: Default::default(), balances: pangolin_runtime::BalancesConfig { balances: endowed_accounts.iter().cloned().map(|k| (k, 100_000_000 * UNIT)).collect(), }, diff --git a/precompiles/assets/Cargo.toml b/precompiles/assets/Cargo.toml new file mode 100644 index 000000000..ef1cbb5e1 --- /dev/null +++ b/precompiles/assets/Cargo.toml @@ -0,0 +1,59 @@ +[package] +authors = ["Darwinia Network "] +description = "Assets precompiles for EVM pallet." +edition = "2021" +homepage = "https://darwinia.network" +license = "GPL-3.0" +name = "darwinia-precompile-assets" +readme = "README.md" +repository = "https://github.com/darwinia-network/darwinia" +version = "6.0.0" + +[dependencies] +# frontier +fp-evm = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +pallet-evm = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } + +# moonbeam +precompile-utils = { default-features = false, git = "https://github.com/darwinia-network/moonbeam.git", branch = "polkadot-v0.9.30" } + +# paritytech +frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-assets = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } + +sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +[dev-dependencies] +# crates.io +codec = { package = "parity-scale-codec", version = "3.2" } +scale-info = { version = "2.3", features = ["derive"] } +sha3 = { version = "0.8" } + +# moonbeam +precompile-utils = { git = "https://github.com/darwinia-network/moonbeam.git", branch = "polkadot-v0.9.30", features = ["testing"] } + +# paritytech +pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } + +[features] +default = ["std"] +std = [ + # frontier + "fp-evm/std", + "pallet-evm/std", + + # moonbeam + "precompile-utils/std", + + # paritytech + "frame-support/std", + "frame-system/std", + "pallet-assets/std", + "sp-std/std", + "sp-core/std", +] diff --git a/precompiles/assets/src/lib.rs b/precompiles/assets/src/lib.rs new file mode 100644 index 000000000..fbdcf8b78 --- /dev/null +++ b/precompiles/assets/src/lib.rs @@ -0,0 +1,440 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +#![cfg_attr(not(feature = "std"), no_std)] + +#[cfg(test)] +mod mock; +#[cfg(test)] +mod tests; + +// std +use core::marker::PhantomData; +// substrate +use frame_support::{ + dispatch::{Dispatchable, GetDispatchInfo, PostDispatchInfo}, + sp_runtime::traits::StaticLookup, + traits::{ + fungibles::{ + approvals::Inspect as ApprovalInspect, metadata::Inspect as MetadataInspect, Inspect, + }, + OriginTrait, + }, +}; +use sp_core::{H160, U256}; +use sp_std::convert::{TryFrom, TryInto}; +// moonbeam +use precompile_utils::prelude::*; + +/// Solidity selector of the Transfer log, which is the Keccak of the Log signature. +pub const SELECTOR_LOG_TRANSFER: [u8; 32] = keccak256!("Transfer(address,address,uint256)"); + +/// Solidity selector of the Approval log, which is the Keccak of the Log signature. +pub const SELECTOR_LOG_APPROVAL: [u8; 32] = keccak256!("Approval(address,address,uint256)"); + +/// Balance of the specific assets. +type BalanceOf = ::Balance; + +/// AssetId of the specific assets. +type AssetIdOf = ::AssetId; + +/// AccountId of the runtime. +type AccountIdOf = ::AccountId; + +/// Convert from precompile AccountId to AssetId +/// +/// Note: The AssetId generation must follow our precompile AccountId rule. +pub trait AccountToAssetId { + /// Get asset id from account id + fn account_to_asset_id(account_id: AccountId) -> AssetId; +} + +pub struct ERC20Assets(PhantomData<(Runtime, AssetIdConverter)>); + +#[precompile_utils::precompile] +impl ERC20Assets +where + Runtime: pallet_assets::Config + pallet_evm::Config + frame_system::Config, + AssetIdConverter: AccountToAssetId>, + Runtime::RuntimeCall: Dispatchable + GetDispatchInfo, + Runtime::RuntimeCall: From>, + AccountIdOf: From, + <::RuntimeCall as Dispatchable>::RuntimeOrigin: OriginTrait, + ::RuntimeOrigin: From>, + BalanceOf: TryFrom + Into + EvmData, +{ + #[precompile::public("totalSupply()")] + #[precompile::view] + fn total_supply(handle: &mut impl PrecompileHandle) -> EvmResult { + handle.record_cost(RuntimeHelper::::db_read_gas_cost())?; + let asset_id = Self::asset_id(handle)?; + + Ok(pallet_assets::Pallet::::total_issuance(asset_id).into()) + } + + #[precompile::public("balanceOf(address)")] + #[precompile::view] + fn balance_of(handle: &mut impl PrecompileHandle, who: Address) -> EvmResult { + handle.record_cost(RuntimeHelper::::db_read_gas_cost())?; + let asset_id = Self::asset_id(handle)?; + + let who: H160 = who.into(); + let amount: U256 = { + let who: AccountIdOf = who.into(); + pallet_assets::Pallet::::balance(asset_id, &who).into() + }; + + Ok(amount) + } + + #[precompile::public("allowance(address,address)")] + #[precompile::view] + fn allowance( + handle: &mut impl PrecompileHandle, + owner: Address, + spender: Address, + ) -> EvmResult { + handle.record_cost(RuntimeHelper::::db_read_gas_cost())?; + let asset_id = Self::asset_id(handle)?; + + let owner: H160 = owner.into(); + let spender: H160 = spender.into(); + let amount: U256 = { + let owner: AccountIdOf = owner.into(); + let spender: AccountIdOf = spender.into(); + pallet_assets::Pallet::::allowance(asset_id, &owner, &spender).into() + }; + + Ok(amount) + } + + #[precompile::public("approve(address,uint256)")] + fn approve( + handle: &mut impl PrecompileHandle, + spender: Address, + value: U256, + ) -> EvmResult { + handle.record_cost(RuntimeHelper::::db_read_gas_cost())?; + handle.record_log_costs_manual(3, 32)?; + let asset_id = Self::asset_id(handle)?; + + let spender: H160 = spender.into(); + { + let owner: AccountIdOf = handle.context().caller.into(); + let spender: AccountIdOf = spender.into(); + let amount = Self::u256_to_amount(value).in_field("value")?; + + // If previous approval exists, we need to clean it + if pallet_assets::Pallet::::allowance(asset_id, &owner, &spender) + != 0u32.into() + { + RuntimeHelper::::try_dispatch( + handle, + Some(owner.clone()).into(), + pallet_assets::Call::::cancel_approval { + id: asset_id, + delegate: Runtime::Lookup::unlookup(spender.clone()), + }, + )?; + } + RuntimeHelper::::try_dispatch( + handle, + Some(owner).into(), + pallet_assets::Call::::approve_transfer { + id: asset_id, + delegate: Runtime::Lookup::unlookup(spender), + amount, + }, + )?; + } + + log3( + handle.context().address, + SELECTOR_LOG_APPROVAL, + handle.context().caller, + spender, + EvmDataWriter::new().write(value).build(), + ) + .record(handle)?; + + Ok(true) + } + + #[precompile::public("transfer(address,uint256)")] + fn transfer(handle: &mut impl PrecompileHandle, to: Address, value: U256) -> EvmResult { + handle.record_log_costs_manual(3, 32)?; + let asset_id = Self::asset_id(handle)?; + + let to: H160 = to.into(); + let value = Self::u256_to_amount(value).in_field("value")?; + { + let origin: AccountIdOf = handle.context().caller.into(); + let to: AccountIdOf = to.into(); + + RuntimeHelper::::try_dispatch( + handle, + Some(origin).into(), + pallet_assets::Call::::transfer { + id: asset_id, + target: Runtime::Lookup::unlookup(to), + amount: value, + }, + )?; + } + + log3( + handle.context().address, + SELECTOR_LOG_TRANSFER, + handle.context().caller, + to, + EvmDataWriter::new().write(value).build(), + ) + .record(handle)?; + + Ok(true) + } + + #[precompile::public("transferFrom(address,address,uint256)")] + fn transfer_from( + handle: &mut impl PrecompileHandle, + from: Address, + to: Address, + value: U256, + ) -> EvmResult { + handle.record_log_costs_manual(3, 32)?; + let asset_id = Self::asset_id(handle)?; + + let from: H160 = from.into(); + let to: H160 = to.into(); + let value = Self::u256_to_amount(value).in_field("value")?; + { + let caller: AccountIdOf = handle.context().caller.into(); + let from: AccountIdOf = from.clone().into(); + let to: AccountIdOf = to.into(); + + // If caller is "from", it can spend as much as it wants from its own balance. + if caller != from { + RuntimeHelper::::try_dispatch( + handle, + Some(caller).into(), + pallet_assets::Call::::transfer_approved { + id: asset_id, + owner: Runtime::Lookup::unlookup(from), + destination: Runtime::Lookup::unlookup(to), + amount: value, + }, + )?; + } else { + RuntimeHelper::::try_dispatch( + handle, + Some(from).into(), + pallet_assets::Call::::transfer { + id: asset_id, + target: Runtime::Lookup::unlookup(to), + amount: value, + }, + )?; + } + } + + log3( + handle.context().address, + SELECTOR_LOG_TRANSFER, + from, + to, + EvmDataWriter::new().write(value).build(), + ) + .record(handle)?; + + Ok(true) + } + + #[precompile::public("name()")] + #[precompile::view] + fn name(handle: &mut impl PrecompileHandle) -> EvmResult { + handle.record_cost(RuntimeHelper::::db_read_gas_cost())?; + let asset_id = Self::asset_id(handle)?; + + Ok(pallet_assets::Pallet::::name(asset_id).as_slice().into()) + } + + #[precompile::public("symbol()")] + #[precompile::view] + fn symbol(handle: &mut impl PrecompileHandle) -> EvmResult { + handle.record_cost(RuntimeHelper::::db_read_gas_cost())?; + let asset_id = Self::asset_id(handle)?; + + Ok(pallet_assets::Pallet::::symbol(asset_id).as_slice().into()) + } + + #[precompile::public("decimals()")] + #[precompile::view] + fn decimals(handle: &mut impl PrecompileHandle) -> EvmResult { + handle.record_cost(RuntimeHelper::::db_read_gas_cost())?; + let asset_id = Self::asset_id(handle)?; + + Ok(pallet_assets::Pallet::::decimals(asset_id)) + } + + #[precompile::public("mint(address,uint256)")] + fn mint(handle: &mut impl PrecompileHandle, to: Address, value: U256) -> EvmResult { + handle.record_log_costs_manual(3, 32)?; + let asset_id = Self::asset_id(handle)?; + + let to: H160 = to.into(); + let value = Self::u256_to_amount(value).in_field("value")?; + { + let origin: AccountIdOf = handle.context().caller.into(); + let to: AccountIdOf = to.clone().into(); + + RuntimeHelper::::try_dispatch( + handle, + Some(origin).into(), + pallet_assets::Call::::mint { + id: asset_id, + beneficiary: Runtime::Lookup::unlookup(to), + amount: value, + }, + )?; + } + + log3( + handle.context().address, + SELECTOR_LOG_TRANSFER, + H160::default(), + to, + EvmDataWriter::new().write(value).build(), + ) + .record(handle)?; + + Ok(true) + } + + #[precompile::public("burn(address,uint256)")] + fn burn(handle: &mut impl PrecompileHandle, from: Address, value: U256) -> EvmResult { + handle.record_log_costs_manual(3, 32)?; + let asset_id = Self::asset_id(handle)?; + + let from: H160 = from.into(); + let value = Self::u256_to_amount(value).in_field("value")?; + { + let origin: AccountIdOf = handle.context().caller.into(); + let from: AccountIdOf = from.clone().into(); + + RuntimeHelper::::try_dispatch( + handle, + Some(origin).into(), + pallet_assets::Call::::burn { + id: asset_id, + who: Runtime::Lookup::unlookup(from), + amount: value, + }, + )?; + } + + log3( + handle.context().address, + SELECTOR_LOG_TRANSFER, + from, + H160::default(), + EvmDataWriter::new().write(value).build(), + ) + .record(handle)?; + + Ok(true) + } + + #[precompile::public("transfer_ownership(address)")] + fn transfer_ownership(handle: &mut impl PrecompileHandle, owner: Address) -> EvmResult { + let asset_id = Self::asset_id(handle)?; + + let owner: H160 = owner.into(); + { + let origin: AccountIdOf = handle.context().caller.into(); + let owner: AccountIdOf = owner.into(); + + RuntimeHelper::::try_dispatch( + handle, + Some(origin).into(), + pallet_assets::Call::::transfer_ownership { + id: asset_id, + owner: Runtime::Lookup::unlookup(owner), + }, + )?; + } + + Ok(true) + } + + #[precompile::public("freeze(address)")] + fn freeze(handle: &mut impl PrecompileHandle, account: Address) -> EvmResult { + let asset_id = Self::asset_id(handle)?; + + let account: H160 = account.into(); + { + let origin: AccountIdOf = handle.context().caller.into(); + let account: AccountIdOf = account.into(); + + RuntimeHelper::::try_dispatch( + handle, + Some(origin).into(), + pallet_assets::Call::::freeze { + id: asset_id, + who: Runtime::Lookup::unlookup(account), + }, + )?; + } + + Ok(true) + } + + #[precompile::public("thaw(address)")] + fn thaw(handle: &mut impl PrecompileHandle, account: Address) -> EvmResult { + let asset_id = Self::asset_id(handle)?; + + let account: H160 = account.into(); + { + let origin: AccountIdOf = handle.context().caller.into(); + let account: AccountIdOf = account.into(); + + RuntimeHelper::::try_dispatch( + handle, + Some(origin).into(), + pallet_assets::Call::::thaw { + id: asset_id, + who: Runtime::Lookup::unlookup(account), + }, + )?; + } + + Ok(true) + } + + fn asset_id(handle: &mut impl PrecompileHandle) -> EvmResult> { + let asset_id = AssetIdConverter::account_to_asset_id(handle.code_address().into()); + + if pallet_assets::Pallet::::maybe_total_supply(asset_id).is_some() { + return Ok(asset_id); + } + Err(revert("The asset not exist!")) + } + + fn u256_to_amount(value: U256) -> MayRevert> { + value.try_into().map_err(|_| RevertReason::value_is_too_large("balance type").into()) + } +} diff --git a/precompiles/assets/src/mock.rs b/precompiles/assets/src/mock.rs new file mode 100644 index 000000000..bece04086 --- /dev/null +++ b/precompiles/assets/src/mock.rs @@ -0,0 +1,285 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Test utilities + +// crates.io +use codec::{Decode, Encode, MaxEncodedLen}; +// frontier +use fp_evm::{Precompile, PrecompileSet}; +use pallet_evm::IdentityAddressMapping; +// parity +use frame_support::{ + pallet_prelude::Weight, + traits::{ConstU32, Everything}, +}; +use frame_system::EnsureRoot; +use sp_core::{H160, H256, U256}; +use sp_runtime::{ + testing::Header, + traits::{BlakeTwo256, IdentityLookup}, +}; +use sp_std::{marker::PhantomData, prelude::*}; +// darwinia +use crate::*; + +pub type Block = frame_system::mocking::MockBlock; +pub type Balance = u128; +pub type AssetId = u64; +pub type AccountId = H160; +pub type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; + +pub const TEST_ID: AssetId = 1026; + +#[derive( + Eq, + PartialEq, + Ord, + PartialOrd, + Clone, + Encode, + Decode, + Debug, + MaxEncodedLen, + scale_info::TypeInfo, +)] +pub enum Account { + Alice, + Bob, + Charlie, + Bogus, + Precompile, +} + +impl Default for Account { + fn default() -> Self { + Self::Bogus + } +} + +impl Into for Account { + fn into(self) -> H160 { + match self { + Account::Alice => H160::repeat_byte(0xAA), + Account::Bob => H160::repeat_byte(0xBB), + Account::Charlie => H160::repeat_byte(0xCC), + Account::Bogus => H160::repeat_byte(0xDD), + Account::Precompile => H160::from_low_u64_be(TEST_ID), + } + } +} + +impl From for H256 { + fn from(x: Account) -> H256 { + let x: H160 = x.into(); + x.into() + } +} + +frame_support::parameter_types! { + pub const BlockHashCount: u64 = 250; +} +impl frame_system::Config for TestRuntime { + type AccountData = pallet_balances::AccountData; + type AccountId = AccountId; + type BaseCallFilter = Everything; + type BlockHashCount = (); + type BlockLength = (); + type BlockNumber = u64; + type BlockWeights = (); + type DbWeight = (); + type Hash = H256; + type Hashing = BlakeTwo256; + type Header = Header; + type Index = u64; + type Lookup = IdentityLookup; + type MaxConsumers = ConstU32<16>; + type OnKilledAccount = (); + type OnNewAccount = (); + type OnSetCode = (); + type PalletInfo = PalletInfo; + type RuntimeCall = RuntimeCall; + type RuntimeEvent = RuntimeEvent; + type RuntimeOrigin = RuntimeOrigin; + type SS58Prefix = (); + type SystemWeightInfo = (); + type Version = (); +} + +frame_support::parameter_types! { + pub const MaxLocks: u32 = 10; + pub const ExistentialDeposit: u64 = 0; +} +impl pallet_balances::Config for TestRuntime { + type AccountStore = System; + type Balance = Balance; + type DustRemoval = (); + type ExistentialDeposit = ExistentialDeposit; + type MaxLocks = MaxLocks; + type MaxReserves = (); + type ReserveIdentifier = [u8; 8]; + type RuntimeEvent = RuntimeEvent; + type WeightInfo = (); +} + +frame_support::parameter_types! { + pub const MinimumPeriod: u64 = 6000 / 2; +} +impl pallet_timestamp::Config for TestRuntime { + type MinimumPeriod = MinimumPeriod; + type Moment = u64; + type OnTimestampSet = (); + type WeightInfo = (); +} +pub struct TestPrecompiles(PhantomData); +impl TestPrecompiles +where + R: pallet_evm::Config, +{ + pub fn new() -> Self { + Self(Default::default()) + } + + pub fn used_addresses() -> [H160; 1] { + [addr(TEST_ID)] + } +} + +impl PrecompileSet for TestPrecompiles +where + R: pallet_evm::Config, + ERC20Assets: Precompile, +{ + fn execute(&self, handle: &mut impl PrecompileHandle) -> Option> { + match handle.code_address() { + a if a == addr(TEST_ID) => Some(>::execute(handle)), + _ => None, + } + } + + fn is_precompile(&self, address: H160) -> bool { + Self::used_addresses().contains(&address) + } +} +fn addr(a: u64) -> H160 { + H160::from_low_u64_be(a) +} + +pub struct AssetIdConverter; +impl AccountToAssetId for AssetIdConverter { + fn account_to_asset_id(account_id: AccountId) -> AssetId { + let addr: H160 = account_id.into(); + addr.to_low_u64_be() + } +} + +frame_support::parameter_types! { + pub const TransactionByteFee: u64 = 1; + pub const ChainId: u64 = 42; + pub const BlockGasLimit: U256 = U256::MAX; + pub const WeightPerGas: Weight = Weight::from_ref_time(20_000); + pub PrecompilesValue: TestPrecompiles = TestPrecompiles::<_>::new(); +} + +pub type InternalCall = ERC20AssetsCall; + +impl pallet_evm::Config for TestRuntime { + type AddressMapping = IdentityAddressMapping; + type BlockGasLimit = BlockGasLimit; + type BlockHashMapping = pallet_evm::SubstrateBlockHashMapping; + type CallOrigin = pallet_evm::EnsureAddressRoot; + type ChainId = ChainId; + type Currency = Balances; + type FeeCalculator = (); + type FindAuthor = (); + type GasWeightMapping = pallet_evm::FixedGasWeightMapping; + type OnChargeTransaction = (); + type PrecompilesType = TestPrecompiles; + type PrecompilesValue = PrecompilesValue; + type Runner = pallet_evm::runner::stack::Runner; + type RuntimeEvent = RuntimeEvent; + type WeightPerGas = WeightPerGas; + type WithdrawOrigin = pallet_evm::EnsureAddressNever; +} + +frame_support::parameter_types! { + pub const AssetDeposit: Balance = 0; + pub const ApprovalDeposit: Balance = 0; + pub const AssetsStringLimit: u32 = 50; + pub const MetadataDepositBase: Balance = 0; + pub const MetadataDepositPerByte: Balance = 0; + pub const AssetAccountDeposit: Balance = 0; +} + +impl pallet_assets::Config for TestRuntime { + type ApprovalDeposit = ApprovalDeposit; + type AssetAccountDeposit = AssetAccountDeposit; + type AssetDeposit = AssetDeposit; + type AssetId = AssetId; + type Balance = Balance; + type Currency = Balances; + type Extra = (); + type ForceOrigin = EnsureRoot; + type Freezer = (); + type MetadataDepositBase = MetadataDepositBase; + type MetadataDepositPerByte = MetadataDepositPerByte; + type RuntimeEvent = RuntimeEvent; + type StringLimit = AssetsStringLimit; + type WeightInfo = (); +} + +frame_support::construct_runtime! { + pub enum TestRuntime where + Block = Block, + NodeBlock = Block, + UncheckedExtrinsic = UncheckedExtrinsic, + { + System: frame_system::{Pallet, Call, Config, Storage, Event}, + Timestamp: pallet_timestamp::{Pallet, Call, Storage}, + Balances: pallet_balances::{Pallet, Call, Storage, Config, Event}, + EVM: pallet_evm::{Pallet, Call, Storage, Config, Event}, + Assets: pallet_assets::{Pallet, Call, Storage, Event} + } +} + +#[derive(Default)] +pub(crate) struct ExtBuilder { + // endowed accounts with balances + balances: Vec<(AccountId, Balance)>, +} + +impl ExtBuilder { + pub(crate) fn with_balances(mut self, balances: Vec<(AccountId, Balance)>) -> Self { + self.balances = balances; + self + } + + pub(crate) fn build(self) -> sp_io::TestExternalities { + let mut t = frame_system::GenesisConfig::default() + .build_storage::() + .expect("Frame system builds valid default genesis config"); + + pallet_balances::GenesisConfig:: { balances: self.balances } + .assimilate_storage(&mut t) + .expect("Pallet balances storage can be assimilated"); + + let mut ext = sp_io::TestExternalities::new(t); + ext.execute_with(|| System::set_block_number(1)); + ext + } +} diff --git a/precompiles/assets/src/tests.rs b/precompiles/assets/src/tests.rs new file mode 100644 index 000000000..5317d5896 --- /dev/null +++ b/precompiles/assets/src/tests.rs @@ -0,0 +1,884 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// crates.io +use sha3::{Digest, Keccak256}; +// darwinia +use crate::{ + log3, + mock::{ + Account::{Alice, Bob, Charlie, Precompile}, + Assets, ExtBuilder, InternalCall, PrecompilesValue, RuntimeOrigin, TestPrecompiles, + TestRuntime, TEST_ID, + }, + SELECTOR_LOG_APPROVAL, SELECTOR_LOG_TRANSFER, +}; +// moonbeam +use precompile_utils::{ + prelude::{Address, UnboundedBytes}, + testing::{PrecompileTesterExt, PrecompilesModifierTester}, + EvmDataWriter, +}; +// substrate +use frame_support::assert_ok; +use sp_core::{H256, U256}; +use sp_std::str::from_utf8; + +fn precompiles() -> TestPrecompiles { + PrecompilesValue::get() +} + +#[test] +fn selectors() { + assert!(InternalCall::balance_of_selectors().contains(&0x70a08231)); + assert!(InternalCall::total_supply_selectors().contains(&0x18160ddd)); + assert!(InternalCall::approve_selectors().contains(&0x095ea7b3)); + assert!(InternalCall::allowance_selectors().contains(&0xdd62ed3e)); + assert!(InternalCall::transfer_selectors().contains(&0xa9059cbb)); + assert!(InternalCall::transfer_from_selectors().contains(&0x23b872dd)); + assert!(InternalCall::name_selectors().contains(&0x06fdde03)); + assert!(InternalCall::symbol_selectors().contains(&0x95d89b41)); + assert!(InternalCall::decimals_selectors().contains(&0x313ce567)); + + assert!(InternalCall::mint_selectors().contains(&0x40c10f19)); + assert!(InternalCall::burn_selectors().contains(&0x9dc29fac)); + assert!(InternalCall::freeze_selectors().contains(&0x8d1fdf2f)); + assert!(InternalCall::thaw_selectors().contains(&0x5ea20216)); + assert!(InternalCall::transfer_ownership_selectors().contains(&0xf0350c04)); + + assert_eq!( + crate::SELECTOR_LOG_TRANSFER, + &Keccak256::digest(b"Transfer(address,address,uint256)")[..] + ); + + assert_eq!( + crate::SELECTOR_LOG_APPROVAL, + &Keccak256::digest(b"Approval(address,address,uint256)")[..] + ); +} + +#[test] +fn selector_less_than_four_bytes() { + ExtBuilder::default().build().execute_with(|| { + assert_ok!(Assets::force_create(RuntimeOrigin::root(), TEST_ID, Alice.into(), true, 1)); + // This selector is only three bytes long when four are required. + precompiles() + .prepare_test(Alice, Precompile, vec![1u8, 2u8, 3u8]) + .execute_reverts(|output| output == b"Tried to read selector out of bounds"); + }); +} + +#[test] +fn no_selector_exists_but_length_is_right() { + ExtBuilder::default().build().execute_with(|| { + assert_ok!(Assets::force_create(RuntimeOrigin::root(), TEST_ID, Alice.into(), true, 1)); + + precompiles() + .prepare_test(Alice, Precompile, vec![1u8, 2u8, 3u8, 4u8]) + .execute_reverts(|output| output == b"Unknown selector"); + }); +} + +#[test] +fn modifiers() { + ExtBuilder::default().with_balances(vec![(Alice.into(), 1000)]).build().execute_with(|| { + assert_ok!(Assets::force_create(RuntimeOrigin::root(), TEST_ID, Alice.into(), true, 1)); + let mut tester = PrecompilesModifierTester::new(precompiles(), Alice, Precompile); + + tester.test_view_modifier(InternalCall::balance_of_selectors()); + tester.test_view_modifier(InternalCall::total_supply_selectors()); + tester.test_default_modifier(InternalCall::approve_selectors()); + tester.test_view_modifier(InternalCall::allowance_selectors()); + tester.test_default_modifier(InternalCall::transfer_selectors()); + tester.test_default_modifier(InternalCall::transfer_from_selectors()); + tester.test_view_modifier(InternalCall::name_selectors()); + tester.test_view_modifier(InternalCall::symbol_selectors()); + tester.test_view_modifier(InternalCall::decimals_selectors()); + + tester.test_default_modifier(InternalCall::mint_selectors()); + tester.test_default_modifier(InternalCall::burn_selectors()); + tester.test_default_modifier(InternalCall::freeze_selectors()); + tester.test_default_modifier(InternalCall::thaw_selectors()); + tester.test_default_modifier(InternalCall::transfer_ownership_selectors()); + }); +} + +#[test] +fn get_total_supply() { + ExtBuilder::default() + .with_balances(vec![(Alice.into(), 1000), (Bob.into(), 2500)]) + .build() + .execute_with(|| { + assert_ok!(Assets::force_create(RuntimeOrigin::root(), TEST_ID, Alice.into(), true, 1)); + assert_ok!(Assets::mint( + RuntimeOrigin::signed(Alice.into()), + TEST_ID, + Alice.into(), + 1000 + )); + + precompiles() + .prepare_test(Alice, Precompile, InternalCall::total_supply {}) + .expect_no_logs() + .execute_returns_encoded(U256::from(1000u64)); + }); +} + +#[test] +fn get_balances_known_user() { + ExtBuilder::default().with_balances(vec![(Alice.into(), 1000)]).build().execute_with(|| { + assert_ok!(Assets::force_create(RuntimeOrigin::root(), TEST_ID, Alice.into(), true, 1)); + assert_ok!(Assets::mint(RuntimeOrigin::signed(Alice.into()), TEST_ID, Alice.into(), 1000)); + + precompiles() + .prepare_test( + Alice, + Precompile, + InternalCall::balance_of { who: Address(Alice.into()) }, + ) + .expect_no_logs() + .execute_returns_encoded(U256::from(1000u64)); + }); +} + +#[test] +fn get_balances_unknown_user() { + ExtBuilder::default().with_balances(vec![(Alice.into(), 1000)]).build().execute_with(|| { + assert_ok!(Assets::force_create(RuntimeOrigin::root(), TEST_ID, Alice.into(), true, 1)); + assert_ok!(Assets::mint(RuntimeOrigin::signed(Alice.into()), TEST_ID, Alice.into(), 1000)); + + precompiles() + .prepare_test(Alice, Precompile, InternalCall::balance_of { who: Address(Bob.into()) }) + .expect_no_logs() + .execute_returns_encoded(U256::from(0u64)); + }); +} + +#[test] +fn approve() { + ExtBuilder::default().with_balances(vec![(Alice.into(), 1000)]).build().execute_with(|| { + assert_ok!(Assets::force_create(RuntimeOrigin::root(), TEST_ID, Alice.into(), true, 1)); + assert_ok!(Assets::mint(RuntimeOrigin::signed(Alice.into()), TEST_ID, Alice.into(), 1000)); + + precompiles() + .prepare_test( + Alice, + Precompile, + InternalCall::approve { spender: Address(Bob.into()), value: 500.into() }, + ) + .expect_log(log3( + Precompile, + SELECTOR_LOG_APPROVAL, + H256::from(Alice), + H256::from(Bob), + EvmDataWriter::new().write(U256::from(500)).build(), + )) + .execute_returns_encoded(true); + }); +} + +#[test] +fn approve_overflow() { + ExtBuilder::default().with_balances(vec![(Alice.into(), 1000)]).build().execute_with(|| { + assert_ok!(Assets::force_create(RuntimeOrigin::root(), TEST_ID, Alice.into(), true, 1)); + assert_ok!(Assets::mint(RuntimeOrigin::signed(Alice.into()), TEST_ID, Alice.into(), 1000)); + + precompiles() + .prepare_test( + Alice, + Precompile, + InternalCall::approve { spender: Address(Bob.into()), value: U256::MAX }, + ) + .execute_reverts(|e| e == b"value: Value is too large for balance type"); + }); +} + +#[test] +fn check_allowance_existing() { + ExtBuilder::default().with_balances(vec![(Alice.into(), 1000)]).build().execute_with(|| { + assert_ok!(Assets::force_create(RuntimeOrigin::root(), TEST_ID, Alice.into(), true, 1)); + assert_ok!(Assets::mint(RuntimeOrigin::signed(Alice.into()), TEST_ID, Alice.into(), 1000)); + + precompiles() + .prepare_test( + Alice, + Precompile, + InternalCall::approve { spender: Address(Bob.into()), value: 500.into() }, + ) + .execute_some(); + + precompiles() + .prepare_test( + Alice, + Precompile, + InternalCall::allowance { + owner: Address(Alice.into()), + spender: Address(Bob.into()), + }, + ) + .expect_cost(0) + .expect_no_logs() + .execute_returns_encoded(U256::from(500u64)); + }); +} + +#[test] +fn check_allowance_not_existing() { + ExtBuilder::default().with_balances(vec![(Alice.into(), 1000)]).build().execute_with(|| { + assert_ok!(Assets::force_create(RuntimeOrigin::root(), TEST_ID, Alice.into(), true, 1)); + + precompiles() + .prepare_test( + Alice, + Precompile, + InternalCall::allowance { + owner: Address(Alice.into()), + spender: Address(Bob.into()), + }, + ) + .expect_cost(0) + .expect_no_logs() + .execute_returns_encoded(U256::from(0u64)); + }); +} + +#[test] +fn transfer() { + ExtBuilder::default().with_balances(vec![(Alice.into(), 1000)]).build().execute_with(|| { + assert_ok!(Assets::force_create(RuntimeOrigin::root(), TEST_ID, Alice.into(), true, 1)); + assert_ok!(Assets::mint(RuntimeOrigin::signed(Alice.into()), TEST_ID, Alice.into(), 1000)); + + precompiles() + .prepare_test( + Alice, + Precompile, + InternalCall::transfer { to: Address(Bob.into()), value: 400.into() }, + ) + .expect_log(log3( + Precompile, + SELECTOR_LOG_TRANSFER, + H256::from(Alice), + H256::from(Bob), + EvmDataWriter::new().write(U256::from(400)).build(), + )) + .execute_returns_encoded(true); + + precompiles() + .prepare_test(Bob, Precompile, InternalCall::balance_of { who: Address(Bob.into()) }) + .expect_no_logs() + .execute_returns_encoded(U256::from(400)); + + precompiles() + .prepare_test( + Alice, + Precompile, + InternalCall::balance_of { who: Address(Alice.into()) }, + ) + .expect_cost(0) + .expect_no_logs() + .execute_returns_encoded(U256::from(600)); + }); +} + +#[test] +fn transfer_not_enough_founds() { + ExtBuilder::default().with_balances(vec![(Alice.into(), 1000)]).build().execute_with(|| { + assert_ok!(Assets::force_create(RuntimeOrigin::root(), TEST_ID, Alice.into(), true, 1)); + assert_ok!(Assets::mint(RuntimeOrigin::signed(Alice.into()), TEST_ID, Alice.into(), 1)); + + precompiles() + .prepare_test( + Alice, + Precompile, + InternalCall::transfer { to: Address(Charlie.into()), value: 50.into() }, + ) + .execute_reverts(|output| { + from_utf8(&output).unwrap().contains("Dispatched call failed with error: ") + && from_utf8(&output).unwrap().contains("BalanceLow") + }); + }); +} + +#[test] +fn transfer_from() { + ExtBuilder::default().with_balances(vec![(Alice.into(), 1000)]).build().execute_with(|| { + assert_ok!(Assets::force_create(RuntimeOrigin::root(), TEST_ID, Alice.into(), true, 1)); + assert_ok!(Assets::mint(RuntimeOrigin::signed(Alice.into()), TEST_ID, Alice.into(), 1000)); + + precompiles() + .prepare_test( + Alice, + Precompile, + InternalCall::approve { spender: Address(Bob.into()), value: 500.into() }, + ) + .execute_some(); + + precompiles() + .prepare_test( + Bob, // Bob is the one sending transferFrom! + Precompile, + InternalCall::transfer_from { + from: Address(Alice.into()), + to: Address(Charlie.into()), + value: 400.into(), + }, + ) + .expect_log(log3( + Precompile, + SELECTOR_LOG_TRANSFER, + H256::from(Alice), + H256::from(Charlie), + EvmDataWriter::new().write(U256::from(400)).build(), + )) + .execute_returns_encoded(true); + + precompiles() + .prepare_test( + Alice, + Precompile, + InternalCall::balance_of { who: Address(Alice.into()) }, + ) + .expect_cost(0) // TODO: Test db read/write costs + .expect_no_logs() + .execute_returns_encoded(U256::from(600)); + + precompiles() + .prepare_test(Bob, Precompile, InternalCall::balance_of { who: Address(Bob.into()) }) + .expect_no_logs() + .execute_returns_encoded(U256::from(0)); + + precompiles() + .prepare_test( + Charlie, + Precompile, + InternalCall::balance_of { who: Address(Charlie.into()) }, + ) + .expect_no_logs() + .execute_returns_encoded(U256::from(400)); + + precompiles() + .prepare_test( + Alice, + Precompile, + InternalCall::allowance { + owner: Address(Alice.into()), + spender: Address(Bob.into()), + }, + ) + .expect_cost(0) + .expect_no_logs() + .execute_returns_encoded(U256::from(100u64)); + }); +} + +#[test] +fn transfer_from_non_incremental_approval() { + ExtBuilder::default().with_balances(vec![(Alice.into(), 1000)]).build().execute_with(|| { + assert_ok!(Assets::force_create(RuntimeOrigin::root(), TEST_ID, Alice.into(), true, 1)); + assert_ok!(Assets::mint(RuntimeOrigin::signed(Alice.into()), TEST_ID, Alice.into(), 1000)); + + // We first approve 500 + precompiles() + .prepare_test( + Alice, + Precompile, + InternalCall::approve { spender: Address(Bob.into()), value: 500.into() }, + ) + .expect_log(log3( + Precompile, + SELECTOR_LOG_APPROVAL, + H256::from(Alice), + H256::from(Bob), + EvmDataWriter::new().write(U256::from(500)).build(), + )) + .execute_returns_encoded(true); + + // We then approve 300. Non-incremental, so this is + // the approved new value + // Additionally, the gas used in this approval is higher because we + // need to clear the previous one + precompiles() + .prepare_test( + Alice, + Precompile, + InternalCall::approve { spender: Address(Bob.into()), value: 300.into() }, + ) + .expect_log(log3( + Precompile, + SELECTOR_LOG_APPROVAL, + H256::from(Alice), + H256::from(Bob), + EvmDataWriter::new().write(U256::from(300)).build(), + )) + .execute_returns_encoded(true); + + // This should fail, as now the new approved quantity is 300 + precompiles() + .prepare_test( + Bob, // Bob is the one sending transferFrom! + Precompile, + InternalCall::transfer_from { + from: Address(Alice.into()), + to: Address(Bob.into()), + value: 500.into(), + }, + ) + .execute_reverts(|output| { + output == b"Dispatched call failed with error: Module(ModuleError { index: 4, error: [10, 0, 0, 0], \ + message: Some(\"Unapproved\") })" + }); + }); +} + +#[test] +fn transfer_from_above_allowance() { + ExtBuilder::default().with_balances(vec![(Alice.into(), 1000)]).build().execute_with(|| { + assert_ok!(Assets::force_create(RuntimeOrigin::root(), TEST_ID, Alice.into(), true, 1)); + assert_ok!(Assets::mint(RuntimeOrigin::signed(Alice.into()), TEST_ID, Alice.into(), 1000)); + + precompiles() + .prepare_test( + Alice, + Precompile, + InternalCall::approve { spender: Address(Bob.into()), value: 300.into() }, + ) + .execute_some(); + + precompiles() + .prepare_test( + Bob, // Bob is the one sending transferFrom! + Precompile, + InternalCall::transfer_from { + from: Address(Alice.into()), + to: Address(Bob.into()), + value: 400.into(), + }, + ) + .execute_reverts(|output| { + output + == b"Dispatched call failed with error: Module(ModuleError { index: 4, error: [10, 0, 0, 0], \ + message: Some(\"Unapproved\") })" + }); + }); +} + +#[test] +fn transfer_from_self() { + ExtBuilder::default().with_balances(vec![(Alice.into(), 1000)]).build().execute_with(|| { + assert_ok!(Assets::force_create(RuntimeOrigin::root(), TEST_ID, Alice.into(), true, 1)); + assert_ok!(Assets::mint(RuntimeOrigin::signed(Alice.into()), TEST_ID, Alice.into(), 1000)); + + precompiles() + .prepare_test( + Alice, // Alice sending transferFrom herself, no need for allowance. + Precompile, + InternalCall::transfer_from { + from: Address(Alice.into()), + to: Address(Bob.into()), + value: 400.into(), + }, + ) + .expect_log(log3( + Precompile, + SELECTOR_LOG_TRANSFER, + H256::from(Alice), + H256::from(Bob), + EvmDataWriter::new().write(U256::from(400)).build(), + )) + .execute_returns_encoded(true); + + precompiles() + .prepare_test( + Alice, + Precompile, + InternalCall::balance_of { who: Address(Alice.into()) }, + ) + .expect_cost(0) + .expect_no_logs() + .execute_returns_encoded(U256::from(600)); + + precompiles() + .prepare_test(Alice, Precompile, InternalCall::balance_of { who: Address(Bob.into()) }) + .expect_cost(0) // TODO: Test db read/write costs + .expect_no_logs() + .execute_returns_encoded(U256::from(400)); + }); +} + +#[test] +fn get_metadata() { + ExtBuilder::default() + .with_balances(vec![(Alice.into(), 1000), (Bob.into(), 2500)]) + .build() + .execute_with(|| { + assert_ok!(Assets::force_create(RuntimeOrigin::root(), TEST_ID, Alice.into(), true, 1)); + assert_ok!(Assets::force_set_metadata( + RuntimeOrigin::root(), + TEST_ID, + b"TestToken".to_vec(), + b"Test".to_vec(), + 12, + false + )); + + precompiles() + .prepare_test(Alice, Precompile, InternalCall::name {}) + .expect_cost(0) + .expect_no_logs() + .execute_returns( + EvmDataWriter::new().write::("TestToken".into()).build(), + ); + + precompiles() + .prepare_test(Alice, Precompile, InternalCall::symbol {}) + .expect_cost(0) + .expect_no_logs() + .execute_returns( + EvmDataWriter::new().write::("Test".into()).build(), + ); + + precompiles() + .prepare_test(Alice, Precompile, InternalCall::decimals {}) + .expect_cost(0) + .expect_no_logs() + .execute_returns_encoded(12u8); + }); +} + +#[test] +fn mint() { + ExtBuilder::default() + .with_balances(vec![(Alice.into(), 1000), (Bob.into(), 2500)]) + .build() + .execute_with(|| { + assert_ok!(Assets::force_create(RuntimeOrigin::root(), TEST_ID, Alice.into(), true, 1)); + + precompiles() + .prepare_test( + Alice, + Precompile, + InternalCall::mint { to: Address(Bob.into()), value: 400.into() }, + ) + .expect_log(log3( + Precompile, + SELECTOR_LOG_TRANSFER, + H256::default(), + H256::from(Bob), + EvmDataWriter::new().write(U256::from(400)).build(), + )) + .execute_returns_encoded(true); + + precompiles() + .prepare_test( + Bob, + Precompile, + InternalCall::balance_of { who: Address(Bob.into()) }, + ) + .expect_cost(0) // TODO: Test db read/write costs + .expect_no_logs() + .execute_returns_encoded(U256::from(400)); + }); +} + +#[test] +fn burn() { + ExtBuilder::default() + .with_balances(vec![(Alice.into(), 1000), (Bob.into(), 2500)]) + .build() + .execute_with(|| { + assert_ok!(Assets::force_create(RuntimeOrigin::root(), TEST_ID, Alice.into(), true, 1)); + assert_ok!(Assets::mint( + RuntimeOrigin::signed(Alice.into()), + TEST_ID, + Alice.into(), + 1000 + )); + + precompiles() + .prepare_test( + Alice, + Precompile, + InternalCall::burn { from: Address(Alice.into()), value: 400.into() }, + ) + .expect_log(log3( + Precompile, + SELECTOR_LOG_TRANSFER, + H256::from(Alice), + H256::default(), + EvmDataWriter::new().write(U256::from(400)).build(), + )) + .execute_returns_encoded(true); + + precompiles() + .prepare_test( + Alice, + Precompile, + InternalCall::balance_of { who: Address(Alice.into()) }, + ) + .expect_no_logs() + .execute_returns_encoded(U256::from(600)); + }); +} + +#[test] +fn freeze() { + ExtBuilder::default() + .with_balances(vec![(Alice.into(), 1000), (Bob.into(), 2500)]) + .build() + .execute_with(|| { + assert_ok!(Assets::force_create(RuntimeOrigin::root(), TEST_ID, Alice.into(), true, 1)); + assert_ok!(Assets::mint( + RuntimeOrigin::signed(Alice.into()), + TEST_ID, + Bob.into(), + 1000 + )); + + precompiles() + .prepare_test( + Alice, + Precompile, + InternalCall::freeze { account: Address(Bob.into()) }, + ) + .expect_no_logs() + .execute_returns_encoded(true); + + precompiles() + .prepare_test( + Bob, + Precompile, + InternalCall::transfer { to: Address(Alice.into()), value: 400.into() }, + ) + .execute_reverts(|output| { + from_utf8(&output).unwrap().contains("Dispatched call failed with error: ") + && from_utf8(&output).unwrap().contains("Frozen") + }); + }); +} + +#[test] +fn thaw() { + ExtBuilder::default() + .with_balances(vec![(Alice.into(), 1000), (Bob.into(), 2500)]) + .build() + .execute_with(|| { + assert_ok!(Assets::force_create(RuntimeOrigin::root(), TEST_ID, Alice.into(), true, 1)); + assert_ok!(Assets::mint( + RuntimeOrigin::signed(Alice.into()), + TEST_ID, + Bob.into(), + 1000 + )); + + precompiles() + .prepare_test( + Alice, + Precompile, + InternalCall::freeze { account: Address(Bob.into()) }, + ) + .expect_no_logs() + .execute_returns_encoded(true); + + precompiles() + .prepare_test( + Alice, + Precompile, + InternalCall::thaw { account: Address(Bob.into()) }, + ) + .expect_no_logs() + .execute_returns_encoded(true); + + precompiles() + .prepare_test( + Bob, + Precompile, + InternalCall::transfer { to: Address(Alice.into()), value: 400.into() }, + ) + .expect_log(log3( + Precompile, + SELECTOR_LOG_TRANSFER, + H256::from(Bob), + H256::from(Alice), + EvmDataWriter::new().write(U256::from(400)).build(), + )) + .execute_returns_encoded(true); + }); +} + +#[test] +fn transfer_ownership() { + ExtBuilder::default() + .with_balances(vec![(Alice.into(), 1000), (Bob.into(), 2500)]) + .build() + .execute_with(|| { + assert_ok!(Assets::force_create(RuntimeOrigin::root(), TEST_ID, Alice.into(), true, 1)); + assert_ok!(Assets::force_set_metadata( + RuntimeOrigin::root(), + TEST_ID, + b"TestToken".to_vec(), + b"Test".to_vec(), + 12, + false + )); + + precompiles() + .prepare_test( + Alice, + Precompile, + InternalCall::transfer_ownership { owner: Address(Bob.into()) }, + ) + .expect_no_logs() + .execute_returns_encoded(true); + + // Now Bob should be able to change ownership, and not Alice + precompiles() + .prepare_test( + Alice, + Precompile, + InternalCall::transfer_ownership { owner: Address(Bob.into()) }, + ) + .execute_reverts(|output| { + from_utf8(&output).unwrap().contains("Dispatched call failed with error: ") + && from_utf8(&output).unwrap().contains("NoPermission") + }); + + precompiles() + .prepare_test( + Bob, + Precompile, + InternalCall::transfer_ownership { owner: Address(Alice.into()) }, + ) + .expect_no_logs() + .execute_returns_encoded(true); + }); +} + +#[test] +fn transfer_amount_overflow() { + ExtBuilder::default().with_balances(vec![(Alice.into(), 1000)]).build().execute_with(|| { + assert_ok!(Assets::force_create(RuntimeOrigin::root(), TEST_ID, Alice.into(), true, 1)); + assert_ok!(Assets::mint(RuntimeOrigin::signed(Alice.into()), TEST_ID, Alice.into(), 1000)); + + precompiles() + .prepare_test( + Alice, + Precompile, + InternalCall::transfer { + to: Address(Bob.into()), + value: U256::from(u128::MAX) + 1, + }, + ) + .expect_no_logs() + .execute_reverts(|e| e == b"value: Value is too large for balance type"); + + precompiles() + .prepare_test(Bob, Precompile, InternalCall::balance_of { who: Address(Bob.into()) }) + .expect_cost(0) + .expect_no_logs() + .execute_returns_encoded(U256::from(0)); + + precompiles() + .prepare_test( + Alice, + Precompile, + InternalCall::balance_of { who: Address(Alice.into()) }, + ) + .expect_cost(0) + .expect_no_logs() + .execute_returns_encoded(U256::from(1000)); + }); +} + +#[test] +fn mint_overflow() { + ExtBuilder::default() + .with_balances(vec![(Alice.into(), 1000), (Bob.into(), 2500)]) + .build() + .execute_with(|| { + assert_ok!(Assets::force_create(RuntimeOrigin::root(), TEST_ID, Alice.into(), true, 1)); + + precompiles() + .prepare_test( + Alice, + Precompile, + InternalCall::mint { + to: Address(Bob.into()), + value: U256::from(u128::MAX) + 1, + }, + ) + .expect_no_logs() + .execute_reverts(|e| e == b"value: Value is too large for balance type"); + }); +} + +#[test] +fn transfer_from_overflow() { + ExtBuilder::default().with_balances(vec![(Alice.into(), 1000)]).build().execute_with(|| { + assert_ok!(Assets::force_create(RuntimeOrigin::root(), TEST_ID, Alice.into(), true, 1)); + assert_ok!(Assets::mint(RuntimeOrigin::signed(Alice.into()), TEST_ID, Alice.into(), 1000)); + + precompiles() + .prepare_test( + Alice, + Precompile, + InternalCall::approve { spender: Address(Bob.into()), value: 500.into() }, + ) + .execute_some(); + + precompiles() + .prepare_test( + Bob, // Bob is the one sending transferFrom! + Precompile, + InternalCall::transfer_from { + from: Address(Alice.into()), + to: Address(Charlie.into()), + value: U256::from(u128::MAX) + 1, + }, + ) + .expect_no_logs() + .execute_reverts(|e| e == b"value: Value is too large for balance type"); + }); +} + +#[test] +fn burn_overflow() { + ExtBuilder::default() + .with_balances(vec![(Alice.into(), 1000), (Bob.into(), 2500)]) + .build() + .execute_with(|| { + assert_ok!(Assets::force_create(RuntimeOrigin::root(), TEST_ID, Alice.into(), true, 1)); + assert_ok!(Assets::mint( + RuntimeOrigin::signed(Alice.into()), + TEST_ID, + Alice.into(), + 1000 + )); + + precompiles() + .prepare_test( + Alice, + Precompile, + InternalCall::burn { + from: Address(Alice.into()), + value: U256::from(u128::MAX) + 1, + }, + ) + .expect_no_logs() + .execute_reverts(|e| e == b"value: Value is too large for balance type"); + }); +} diff --git a/runtime/crab/Cargo.toml b/runtime/crab/Cargo.toml index b02e73ba3..307e2945c 100644 --- a/runtime/crab/Cargo.toml +++ b/runtime/crab/Cargo.toml @@ -37,6 +37,7 @@ cumulus-pallet-session-benchmarking = { optional = true, default-features = fals # darwinia darwinia-common-runtime = { default-features = false, path = "../common" } +darwinia-precompile-assets = { default-features = false, path = "../../precompiles/assets" } darwinia-precompile-bls12-381 = { default-features = false, path = "../../precompiles/bls12-381" } darwinia-precompile-state-storage = { default-features = false, path = "../../precompiles/state-storage" } dc-primitives = { default-features = false, path = "../../core/primitives" } @@ -81,6 +82,7 @@ frame-executive = { default-features = false, git = " frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } frame-system-rpc-runtime-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-assets = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } pallet-aura = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } pallet-authorship = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } pallet-balances = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } @@ -142,6 +144,7 @@ std = [ # darwinia "darwinia-common-runtime/std", + "darwinia-precompile-assets/std", "darwinia-precompile-bls12-381/std", "darwinia-precompile-state-storage/std", "dc-primitives/std", @@ -186,6 +189,7 @@ std = [ "frame-support/std", "frame-system/std", "frame-system-rpc-runtime-api/std", + "pallet-assets/std", "pallet-aura/std", "pallet-authorship/std", "pallet-balances/std", @@ -260,6 +264,7 @@ runtime-benchmarks = [ # substrate "frame-support/runtime-benchmarks", "frame-system/runtime-benchmarks", + "pallet-assets/runtime-benchmarks", "pallet-balances/runtime-benchmarks", "pallet-collective/runtime-benchmarks", "pallet-democracy/runtime-benchmarks", @@ -304,6 +309,7 @@ try-runtime = [ "frame-executive/try-runtime", "frame-support/try-runtime", "frame-system/try-runtime", + "pallet-assets/try-runtime", "pallet-aura/try-runtime", "pallet-authorship/try-runtime", "pallet-balances/try-runtime", diff --git a/runtime/crab/src/lib.rs b/runtime/crab/src/lib.rs index 83b3b1a08..138b77e77 100644 --- a/runtime/crab/src/lib.rs +++ b/runtime/crab/src/lib.rs @@ -269,6 +269,7 @@ frame_support::construct_runtime! { // Monetary stuff. // Leave 4 here. // To keep balances consistent with the existing XCM configurations. + Assets: pallet_assets = 34, Balances: pallet_balances = 5, TransactionPayment: pallet_transaction_payment = 6, diff --git a/runtime/crab/src/pallets/assets.rs b/runtime/crab/src/pallets/assets.rs new file mode 100644 index 000000000..1e59c1fec --- /dev/null +++ b/runtime/crab/src/pallets/assets.rs @@ -0,0 +1,41 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +pub type AssetId = u64; + +impl pallet_assets::Config for Runtime { + type ApprovalDeposit = ConstU128<0>; + type AssetAccountDeposit = ConstU128<0>; + type AssetDeposit = ConstU128<0>; + type AssetId = AssetId; + type Balance = u128; + type Currency = Balances; + type Extra = (); + // TODO: Restrict the create asset origin. https://github.com/paritytech/substrate/pull/12586 + // type CreateOrigin = EnsureRoot; + type ForceOrigin = EnsureRoot; + type Freezer = (); + type MetadataDepositBase = ConstU128<0>; + type MetadataDepositPerByte = ConstU128<0>; + type RuntimeEvent = RuntimeEvent; + type StringLimit = ConstU32<50>; + type WeightInfo = (); +} diff --git a/runtime/crab/src/pallets/evm.rs b/runtime/crab/src/pallets/evm.rs index fc8a98c68..c2f351188 100644 --- a/runtime/crab/src/pallets/evm.rs +++ b/runtime/crab/src/pallets/evm.rs @@ -18,6 +18,7 @@ // darwinia use crate::*; +use darwinia_precompile_assets::{AccountToAssetId, ERC20Assets}; use darwinia_precompile_bls12_381::BLS12381; use darwinia_precompile_state_storage::{EthereumStorageFilter, StateStorage}; // frontier @@ -82,6 +83,14 @@ where } } +pub struct AssetIdConverter; +impl AccountToAssetId for AssetIdConverter { + fn account_to_asset_id(account_id: AccountId) -> AssetId { + let addr: H160 = account_id.into(); + addr.to_low_u64_be() + } +} + pub struct CrabPrecompiles(PhantomData); impl CrabPrecompiles where @@ -92,7 +101,7 @@ where Self(Default::default()) } - pub fn used_addresses() -> [H160; 12] { + pub fn used_addresses() -> [H160; 13] { [ addr(1), addr(2), @@ -105,6 +114,7 @@ where addr(9), addr(1024), addr(1025), + addr(1026), // For KTON asset addr(2048), ] } @@ -125,11 +135,15 @@ where a if a == addr(7) => Some(Bn128Mul::execute(handle)), a if a == addr(8) => Some(Bn128Pairing::execute(handle)), a if a == addr(9) => Some(Blake2F::execute(handle)), - // Darwinia precompiles: 1024+ for stable precompiles. + // Darwinia precompiles: [1024, 2048) for stable precompiles. a if a == addr(1024) => Some(>::execute(handle)), a if a == addr(1025) => Some(>::execute(handle)), - // Darwinia precompiles: 2048+ for experimental precompiles. + // [1026, 1536) reserved for assets precompiles. + a if (1026..1536).contains(&AssetIdConverter::account_to_asset_id(a.into())) => + Some(>::execute(handle)), + // [1536, 2048) reserved for other stable precompiles. + // [2048..) reserved for the experimental precompiles. a if a == addr(2048) => Some(>::execute(handle)), _ => None, } diff --git a/runtime/crab/src/pallets/mod.rs b/runtime/crab/src/pallets/mod.rs index 3df9e4ccb..3442d4ded 100644 --- a/runtime/crab/src/pallets/mod.rs +++ b/runtime/crab/src/pallets/mod.rs @@ -35,6 +35,9 @@ mod timestamp; mod parachain_info_; // Monetary stuff. +mod assets; +pub use assets::*; + mod balances; mod transaction_payment; diff --git a/runtime/darwinia/Cargo.toml b/runtime/darwinia/Cargo.toml index 14d83bcce..658f294a6 100644 --- a/runtime/darwinia/Cargo.toml +++ b/runtime/darwinia/Cargo.toml @@ -37,6 +37,7 @@ cumulus-pallet-session-benchmarking = { optional = true, default-features = fals # darwinia darwinia-common-runtime = { default-features = false, path = "../common" } +darwinia-precompile-assets = { default-features = false, path = "../../precompiles/assets" } darwinia-precompile-bls12-381 = { default-features = false, path = "../../precompiles/bls12-381" } darwinia-precompile-state-storage = { default-features = false, path = "../../precompiles/state-storage" } dc-primitives = { default-features = false, path = "../../core/primitives" } @@ -81,6 +82,7 @@ frame-executive = { default-features = false, git = " frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } frame-system-rpc-runtime-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-assets = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } pallet-aura = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } pallet-authorship = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } pallet-balances = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } @@ -142,6 +144,7 @@ std = [ # darwinia "darwinia-common-runtime/std", + "darwinia-precompile-assets/std", "darwinia-precompile-bls12-381/std", "darwinia-precompile-state-storage/std", "dc-primitives/std", @@ -186,6 +189,7 @@ std = [ "frame-support/std", "frame-system/std", "frame-system-rpc-runtime-api/std", + "pallet-assets/std", "pallet-aura/std", "pallet-authorship/std", "pallet-balances/std", @@ -260,6 +264,7 @@ runtime-benchmarks = [ # substrate "frame-support/runtime-benchmarks", "frame-system/runtime-benchmarks", + "pallet-assets/runtime-benchmarks", "pallet-balances/runtime-benchmarks", "pallet-collective/runtime-benchmarks", "pallet-democracy/runtime-benchmarks", @@ -304,6 +309,7 @@ try-runtime = [ "frame-executive/try-runtime", "frame-support/try-runtime", "frame-system/try-runtime", + "pallet-assets/try-runtime", "pallet-aura/try-runtime", "pallet-authorship/try-runtime", "pallet-balances/try-runtime", diff --git a/runtime/darwinia/src/lib.rs b/runtime/darwinia/src/lib.rs index 7534c1f23..81ad46221 100644 --- a/runtime/darwinia/src/lib.rs +++ b/runtime/darwinia/src/lib.rs @@ -269,6 +269,7 @@ frame_support::construct_runtime! { // Monetary stuff. // Leave 4 here. // To keep balances consistent with the existing XCM configurations. + Assets: pallet_assets = 34, Balances: pallet_balances = 5, TransactionPayment: pallet_transaction_payment = 6, diff --git a/runtime/darwinia/src/pallets/assets.rs b/runtime/darwinia/src/pallets/assets.rs new file mode 100644 index 000000000..1e59c1fec --- /dev/null +++ b/runtime/darwinia/src/pallets/assets.rs @@ -0,0 +1,41 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +pub type AssetId = u64; + +impl pallet_assets::Config for Runtime { + type ApprovalDeposit = ConstU128<0>; + type AssetAccountDeposit = ConstU128<0>; + type AssetDeposit = ConstU128<0>; + type AssetId = AssetId; + type Balance = u128; + type Currency = Balances; + type Extra = (); + // TODO: Restrict the create asset origin. https://github.com/paritytech/substrate/pull/12586 + // type CreateOrigin = EnsureRoot; + type ForceOrigin = EnsureRoot; + type Freezer = (); + type MetadataDepositBase = ConstU128<0>; + type MetadataDepositPerByte = ConstU128<0>; + type RuntimeEvent = RuntimeEvent; + type StringLimit = ConstU32<50>; + type WeightInfo = (); +} diff --git a/runtime/darwinia/src/pallets/evm.rs b/runtime/darwinia/src/pallets/evm.rs index 23a3c27bd..a2d8de9be 100644 --- a/runtime/darwinia/src/pallets/evm.rs +++ b/runtime/darwinia/src/pallets/evm.rs @@ -18,6 +18,7 @@ // darwinia use crate::*; +use darwinia_precompile_assets::{AccountToAssetId, ERC20Assets}; use darwinia_precompile_bls12_381::BLS12381; use darwinia_precompile_state_storage::{EthereumStorageFilter, StateStorage}; // frontier @@ -82,6 +83,14 @@ where } } +pub struct AssetIdConverter; +impl AccountToAssetId for AssetIdConverter { + fn account_to_asset_id(account_id: AccountId) -> AssetId { + let addr: H160 = account_id.into(); + addr.to_low_u64_be() + } +} + pub struct DarwiniaPrecompiles(PhantomData); impl DarwiniaPrecompiles where @@ -92,7 +101,7 @@ where Self(Default::default()) } - pub fn used_addresses() -> [H160; 12] { + pub fn used_addresses() -> [H160; 13] { [ addr(1), addr(2), @@ -105,6 +114,7 @@ where addr(9), addr(1024), addr(1025), + addr(1026), // For KTON asset addr(2048), ] } @@ -125,11 +135,15 @@ where a if a == addr(7) => Some(Bn128Mul::execute(handle)), a if a == addr(8) => Some(Bn128Pairing::execute(handle)), a if a == addr(9) => Some(Blake2F::execute(handle)), - // Darwinia precompiles: 1024+ for stable precompiles. + // Darwinia precompiles: [1024, 2048) for stable precompiles. a if a == addr(1024) => Some(>::execute(handle)), a if a == addr(1025) => Some(>::execute(handle)), - // Darwinia precompiles: 2048+ for experimental precompiles. + // [1026, 1536) reserved for assets precompiles. + a if (1026..1536).contains(&AssetIdConverter::account_to_asset_id(a.into())) => + Some(>::execute(handle)), + // [1536, 2048) reserved for other stable precompiles. + // [2048..) reserved for the experimental precompiles. a if a == addr(2048) => Some(>::execute(handle)), _ => None, } diff --git a/runtime/darwinia/src/pallets/mod.rs b/runtime/darwinia/src/pallets/mod.rs index 3df9e4ccb..3442d4ded 100644 --- a/runtime/darwinia/src/pallets/mod.rs +++ b/runtime/darwinia/src/pallets/mod.rs @@ -35,6 +35,9 @@ mod timestamp; mod parachain_info_; // Monetary stuff. +mod assets; +pub use assets::*; + mod balances; mod transaction_payment; diff --git a/runtime/pangolin/Cargo.toml b/runtime/pangolin/Cargo.toml index 76bc14cf0..a2c8db8b4 100644 --- a/runtime/pangolin/Cargo.toml +++ b/runtime/pangolin/Cargo.toml @@ -37,6 +37,7 @@ cumulus-pallet-session-benchmarking = { optional = true, default-features = fals # darwinia darwinia-common-runtime = { default-features = false, path = "../common" } +darwinia-precompile-assets = { default-features = false, path = "../../precompiles/assets" } darwinia-precompile-bls12-381 = { default-features = false, path = "../../precompiles/bls12-381" } darwinia-precompile-state-storage = { default-features = false, path = "../../precompiles/state-storage" } dc-primitives = { default-features = false, path = "../../core/primitives" } @@ -81,6 +82,7 @@ frame-executive = { default-features = false, git = " frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } frame-system-rpc-runtime-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-assets = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } pallet-aura = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } pallet-authorship = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } pallet-balances = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } @@ -142,6 +144,7 @@ std = [ # darwinia "darwinia-common-runtime/std", + "darwinia-precompile-assets/std", "darwinia-precompile-bls12-381/std", "darwinia-precompile-state-storage/std", "dc-primitives/std", @@ -186,6 +189,7 @@ std = [ "frame-support/std", "frame-system/std", "frame-system-rpc-runtime-api/std", + "pallet-assets/std", "pallet-aura/std", "pallet-authorship/std", "pallet-balances/std", @@ -260,6 +264,7 @@ runtime-benchmarks = [ # substrate "frame-support/runtime-benchmarks", "frame-system/runtime-benchmarks", + "pallet-assets/runtime-benchmarks", "pallet-balances/runtime-benchmarks", "pallet-collective/runtime-benchmarks", "pallet-democracy/runtime-benchmarks", @@ -304,6 +309,7 @@ try-runtime = [ "frame-executive/try-runtime", "frame-support/try-runtime", "frame-system/try-runtime", + "pallet-assets/try-runtime", "pallet-aura/try-runtime", "pallet-authorship/try-runtime", "pallet-balances/try-runtime", diff --git a/runtime/pangolin/src/lib.rs b/runtime/pangolin/src/lib.rs index b36dec792..219e0d039 100644 --- a/runtime/pangolin/src/lib.rs +++ b/runtime/pangolin/src/lib.rs @@ -269,6 +269,7 @@ frame_support::construct_runtime! { // Monetary stuff. // Leave 4 here. // To keep balances consistent with the existing XCM configurations. + Assets: pallet_assets = 34, Balances: pallet_balances = 5, TransactionPayment: pallet_transaction_payment = 6, diff --git a/runtime/pangolin/src/pallets/assets.rs b/runtime/pangolin/src/pallets/assets.rs new file mode 100644 index 000000000..1e59c1fec --- /dev/null +++ b/runtime/pangolin/src/pallets/assets.rs @@ -0,0 +1,41 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +pub type AssetId = u64; + +impl pallet_assets::Config for Runtime { + type ApprovalDeposit = ConstU128<0>; + type AssetAccountDeposit = ConstU128<0>; + type AssetDeposit = ConstU128<0>; + type AssetId = AssetId; + type Balance = u128; + type Currency = Balances; + type Extra = (); + // TODO: Restrict the create asset origin. https://github.com/paritytech/substrate/pull/12586 + // type CreateOrigin = EnsureRoot; + type ForceOrigin = EnsureRoot; + type Freezer = (); + type MetadataDepositBase = ConstU128<0>; + type MetadataDepositPerByte = ConstU128<0>; + type RuntimeEvent = RuntimeEvent; + type StringLimit = ConstU32<50>; + type WeightInfo = (); +} diff --git a/runtime/pangolin/src/pallets/evm.rs b/runtime/pangolin/src/pallets/evm.rs index d3daa9110..3d732e102 100644 --- a/runtime/pangolin/src/pallets/evm.rs +++ b/runtime/pangolin/src/pallets/evm.rs @@ -18,6 +18,7 @@ // darwinia use crate::*; +use darwinia_precompile_assets::{AccountToAssetId, ERC20Assets}; use darwinia_precompile_bls12_381::BLS12381; use darwinia_precompile_state_storage::{EthereumStorageFilter, StateStorage}; // frontier @@ -82,6 +83,14 @@ where } } +pub struct AssetIdConverter; +impl AccountToAssetId for AssetIdConverter { + fn account_to_asset_id(account_id: AccountId) -> AssetId { + let addr: H160 = account_id.into(); + addr.to_low_u64_be() + } +} + pub struct PangolinPrecompiles(PhantomData); impl PangolinPrecompiles where @@ -92,7 +101,7 @@ where Self(Default::default()) } - pub fn used_addresses() -> [H160; 12] { + pub fn used_addresses() -> [H160; 13] { [ addr(1), addr(2), @@ -105,6 +114,7 @@ where addr(9), addr(1024), addr(1025), + addr(1026), // For KTON asset addr(2048), ] } @@ -125,11 +135,15 @@ where a if a == addr(7) => Some(Bn128Mul::execute(handle)), a if a == addr(8) => Some(Bn128Pairing::execute(handle)), a if a == addr(9) => Some(Blake2F::execute(handle)), - // Darwinia precompiles: 1024+ for stable precompiles. + // Darwinia precompiles: [1024, 2048) for stable precompiles. a if a == addr(1024) => Some(>::execute(handle)), a if a == addr(1025) => Some(>::execute(handle)), - // Darwinia precompiles: 2048+ for experimental precompiles. + // [1026, 1536) reserved for assets precompiles. + a if (1026..1536).contains(&AssetIdConverter::account_to_asset_id(a.into())) => + Some(>::execute(handle)), + // [1536, 2048) reserved for other stable precompiles. + // [2048..) reserved for the experimental precompiles. a if a == addr(2048) => Some(>::execute(handle)), _ => None, } diff --git a/runtime/pangolin/src/pallets/mod.rs b/runtime/pangolin/src/pallets/mod.rs index 3df9e4ccb..dc7dbb37c 100644 --- a/runtime/pangolin/src/pallets/mod.rs +++ b/runtime/pangolin/src/pallets/mod.rs @@ -25,6 +25,9 @@ mod shared_imports { pub use shared_imports::*; // System stuffs. +mod assets; +pub use assets::*; + mod system; pub use system::*; From f12766bc0c9524e36ff56f00c67fb00c20dc8b32 Mon Sep 17 00:00:00 2001 From: Guantong <04637@163.com> Date: Wed, 30 Nov 2022 17:33:06 +0800 Subject: [PATCH 019/189] Bridge related pallets (#70) * Copy from Crab Parachain * Replace Crab Parachain > Darwinia * bridge pallets, many errors need to fix  Conflicts:  Cargo.lock  runtime/common/Cargo.toml  runtime/darwinia/src/pallets/mod.rs * Add fee_market  Conflicts:  runtime/common/Cargo.toml * Update deps * Update deps * Add bridge related pallets to darwinia * Add bridge related pallets to crab * format * Update deps * review * comment Co-authored-by: bear --- Cargo.lock | 52 +++-- node/src/chain_spec/crab.rs | 10 + node/src/chain_spec/darwinia.rs | 10 + runtime/common/Cargo.toml | 3 + runtime/common/src/lib.rs | 4 + runtime/crab/src/bridges_message/darwinia.rs | 178 ++++++++++++++++++ runtime/crab/src/bridges_message/mod.rs | 20 ++ runtime/crab/src/lib.rs | 10 + runtime/crab/src/pallets/bridge_dispatch.rs | 45 +++++ runtime/crab/src/pallets/bridge_grandpa.rs | 41 ++++ runtime/crab/src/pallets/bridge_messages.rs | 73 +++++++ runtime/crab/src/pallets/fee_market.rs | 70 +++++++ runtime/crab/src/pallets/mod.rs | 13 ++ runtime/darwinia/src/bridges_message/crab.rs | 170 +++++++++++++++++ runtime/darwinia/src/bridges_message/mod.rs | 20 ++ runtime/darwinia/src/lib.rs | 10 + .../darwinia/src/pallets/bridge_dispatch.rs | 47 +++++ .../darwinia/src/pallets/bridge_grandpa.rs | 41 ++++ .../darwinia/src/pallets/bridge_messages.rs | 72 +++++++ runtime/darwinia/src/pallets/fee_market.rs | 70 +++++++ runtime/darwinia/src/pallets/mod.rs | 13 ++ 21 files changed, 955 insertions(+), 17 deletions(-) create mode 100644 runtime/crab/src/bridges_message/darwinia.rs create mode 100644 runtime/crab/src/bridges_message/mod.rs create mode 100644 runtime/crab/src/pallets/bridge_dispatch.rs create mode 100644 runtime/crab/src/pallets/bridge_grandpa.rs create mode 100644 runtime/crab/src/pallets/bridge_messages.rs create mode 100644 runtime/crab/src/pallets/fee_market.rs create mode 100644 runtime/darwinia/src/bridges_message/crab.rs create mode 100644 runtime/darwinia/src/bridges_message/mod.rs create mode 100644 runtime/darwinia/src/pallets/bridge_dispatch.rs create mode 100644 runtime/darwinia/src/pallets/bridge_grandpa.rs create mode 100644 runtime/darwinia/src/pallets/bridge_messages.rs create mode 100644 runtime/darwinia/src/pallets/fee_market.rs diff --git a/Cargo.lock b/Cargo.lock index f81586b72..c6892f3f6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -15,7 +15,7 @@ dependencies = [ [[package]] name = "account" version = "0.1.1" -source = "git+https://github.com/darwinia-network/moonbeam?branch=polkadot-v0.9.30#38c37cc41b9a97482292717aec58b305d5f627f4" +source = "git+https://github.com/darwinia-network/moonbeam?branch=polkadot-v0.9.30#9d31c6120bb0f317053da9cac7fe7cd2a44f844c" dependencies = [ "blake2-rfc", "hex", @@ -737,10 +737,27 @@ dependencies = [ "thiserror", ] +[[package]] +name = "bp-darwinia-core" +version = "0.1.0" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.30#eb71a8eea2679c8fe6cd04c7c98421a631f63838" +dependencies = [ + "account", + "bp-messages", + "bp-runtime", + "frame-support", + "frame-system", + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-runtime", + "sp-std", +] + [[package]] name = "bp-header-chain" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.30#9f1f451245784a0d2f4c943610c838bb1b7c8ac0" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.30#eb71a8eea2679c8fe6cd04c7c98421a631f63838" dependencies = [ "bp-runtime", "finality-grandpa", @@ -757,7 +774,7 @@ dependencies = [ [[package]] name = "bp-message-dispatch" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.30#9f1f451245784a0d2f4c943610c838bb1b7c8ac0" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.30#eb71a8eea2679c8fe6cd04c7c98421a631f63838" dependencies = [ "bp-runtime", "frame-support", @@ -770,7 +787,7 @@ dependencies = [ [[package]] name = "bp-messages" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.30#9f1f451245784a0d2f4c943610c838bb1b7c8ac0" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.30#eb71a8eea2679c8fe6cd04c7c98421a631f63838" dependencies = [ "bitvec", "bp-runtime", @@ -787,7 +804,7 @@ dependencies = [ [[package]] name = "bp-parachains" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.30#9f1f451245784a0d2f4c943610c838bb1b7c8ac0" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.30#eb71a8eea2679c8fe6cd04c7c98421a631f63838" dependencies = [ "bp-polkadot-core", "bp-runtime", @@ -800,7 +817,7 @@ dependencies = [ [[package]] name = "bp-polkadot-core" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.30#9f1f451245784a0d2f4c943610c838bb1b7c8ac0" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.30#eb71a8eea2679c8fe6cd04c7c98421a631f63838" dependencies = [ "bp-messages", "bp-runtime", @@ -820,7 +837,7 @@ dependencies = [ [[package]] name = "bp-runtime" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.30#9f1f451245784a0d2f4c943610c838bb1b7c8ac0" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.30#eb71a8eea2679c8fe6cd04c7c98421a631f63838" dependencies = [ "frame-support", "frame-system", @@ -841,7 +858,7 @@ dependencies = [ [[package]] name = "bp-test-utils" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.30#9f1f451245784a0d2f4c943610c838bb1b7c8ac0" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.30#eb71a8eea2679c8fe6cd04c7c98421a631f63838" dependencies = [ "bp-header-chain", "ed25519-dalek", @@ -856,7 +873,7 @@ dependencies = [ [[package]] name = "bridge-runtime-common" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.30#9f1f451245784a0d2f4c943610c838bb1b7c8ac0" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.30#eb71a8eea2679c8fe6cd04c7c98421a631f63838" dependencies = [ "bp-message-dispatch", "bp-messages", @@ -2271,6 +2288,7 @@ dependencies = [ name = "darwinia-common-runtime" version = "6.0.0" dependencies = [ + "bp-darwinia-core", "dc-primitives", "frame-support", "frame-system", @@ -6228,7 +6246,7 @@ dependencies = [ [[package]] name = "pallet-bridge-dispatch" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.30#9f1f451245784a0d2f4c943610c838bb1b7c8ac0" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.30#eb71a8eea2679c8fe6cd04c7c98421a631f63838" dependencies = [ "bp-message-dispatch", "bp-runtime", @@ -6244,7 +6262,7 @@ dependencies = [ [[package]] name = "pallet-bridge-grandpa" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.30#9f1f451245784a0d2f4c943610c838bb1b7c8ac0" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.30#eb71a8eea2679c8fe6cd04c7c98421a631f63838" dependencies = [ "bp-header-chain", "bp-runtime", @@ -6266,7 +6284,7 @@ dependencies = [ [[package]] name = "pallet-bridge-messages" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.30#9f1f451245784a0d2f4c943610c838bb1b7c8ac0" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.30#eb71a8eea2679c8fe6cd04c7c98421a631f63838" dependencies = [ "bitvec", "bp-message-dispatch", @@ -6287,7 +6305,7 @@ dependencies = [ [[package]] name = "pallet-bridge-parachains" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.30#9f1f451245784a0d2f4c943610c838bb1b7c8ac0" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.30#eb71a8eea2679c8fe6cd04c7c98421a631f63838" dependencies = [ "bp-parachains", "bp-polkadot-core", @@ -6554,7 +6572,7 @@ dependencies = [ [[package]] name = "pallet-fee-market" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.30#9f1f451245784a0d2f4c943610c838bb1b7c8ac0" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.30#eb71a8eea2679c8fe6cd04c7c98421a631f63838" dependencies = [ "bp-messages", "bp-runtime", @@ -8731,7 +8749,7 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "precompile-utils" version = "0.1.0" -source = "git+https://github.com/darwinia-network/moonbeam?branch=polkadot-v0.9.30#38c37cc41b9a97482292717aec58b305d5f627f4" +source = "git+https://github.com/darwinia-network/moonbeam?branch=polkadot-v0.9.30#9d31c6120bb0f317053da9cac7fe7cd2a44f844c" dependencies = [ "affix", "evm", @@ -8757,7 +8775,7 @@ dependencies = [ [[package]] name = "precompile-utils-macro" version = "0.1.0" -source = "git+https://github.com/darwinia-network/moonbeam?branch=polkadot-v0.9.30#38c37cc41b9a97482292717aec58b305d5f627f4" +source = "git+https://github.com/darwinia-network/moonbeam?branch=polkadot-v0.9.30#9d31c6120bb0f317053da9cac7fe7cd2a44f844c" dependencies = [ "case", "num_enum", @@ -13580,7 +13598,7 @@ dependencies = [ [[package]] name = "xcm-primitives" version = "0.1.0" -source = "git+https://github.com/darwinia-network/moonbeam?branch=polkadot-v0.9.30#38c37cc41b9a97482292717aec58b305d5f627f4" +source = "git+https://github.com/darwinia-network/moonbeam?branch=polkadot-v0.9.30#9d31c6120bb0f317053da9cac7fe7cd2a44f844c" dependencies = [ "ethereum", "ethereum-types", diff --git a/node/src/chain_spec/crab.rs b/node/src/chain_spec/crab.rs index a0f08efd9..534e7d155 100644 --- a/node/src/chain_spec/crab.rs +++ b/node/src/chain_spec/crab.rs @@ -218,6 +218,11 @@ pub fn config() -> ChainSpec { ethereum: Default::default(), evm: Default::default(), base_fee: Default::default(), + + // S2S stuff + bridge_darwinia_grandpa: Default::default(), + bridge_darwinia_messages: Default::default(), + darwinia_fee_market: Default::default(), } }, // Bootnodes @@ -339,6 +344,11 @@ fn testnet_genesis( }, }, base_fee: Default::default(), + + // S2S stuff + bridge_darwinia_grandpa: Default::default(), + bridge_darwinia_messages: Default::default(), + darwinia_fee_market: Default::default(), } } diff --git a/node/src/chain_spec/darwinia.rs b/node/src/chain_spec/darwinia.rs index deac4ea87..b8c78bb91 100644 --- a/node/src/chain_spec/darwinia.rs +++ b/node/src/chain_spec/darwinia.rs @@ -218,6 +218,11 @@ pub fn config() -> ChainSpec { ethereum: Default::default(), evm: Default::default(), base_fee: Default::default(), + + // S2S stuff + bridge_crab_grandpa: Default::default(), + bridge_crab_messages: Default::default(), + crab_fee_market: Default::default(), } }, // Bootnodes @@ -343,6 +348,11 @@ fn testnet_genesis( }, }, base_fee: Default::default(), + + // S2S stuff + bridge_crab_grandpa: Default::default(), + bridge_crab_messages: Default::default(), + crab_fee_market: Default::default(), } } diff --git a/runtime/common/Cargo.toml b/runtime/common/Cargo.toml index 3f22addc0..eded93bf3 100644 --- a/runtime/common/Cargo.toml +++ b/runtime/common/Cargo.toml @@ -13,6 +13,9 @@ version = "6.0.0" # darwinia dc-primitives = { default-features = false, path = "../../core/primitives" } +# darwinia-messages-substrate +bp-darwinia-core = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } + # polkadot xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" } xcm-executor = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" } diff --git a/runtime/common/src/lib.rs b/runtime/common/src/lib.rs index 1b95b603d..7b0c65c68 100644 --- a/runtime/common/src/lib.rs +++ b/runtime/common/src/lib.rs @@ -20,3 +20,7 @@ pub mod gov_origin; pub mod xcm_barrier; + +pub use bp_darwinia_core as bp_crab; +pub use bp_darwinia_core as bp_darwinia; +pub use bp_darwinia_core as bp_pangolin; diff --git a/runtime/crab/src/bridges_message/darwinia.rs b/runtime/crab/src/bridges_message/darwinia.rs new file mode 100644 index 000000000..e9883b2e4 --- /dev/null +++ b/runtime/crab/src/bridges_message/darwinia.rs @@ -0,0 +1,178 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// crates.io +use codec::{Decode, Encode}; +use scale_info::TypeInfo; +// paritytech +use frame_support::{weights::Weight, RuntimeDebug}; +use sp_runtime::{FixedPointNumber, FixedU128}; +// darwinia +use crate::*; +use bp_messages::{source_chain::*, target_chain::*, *}; +use bp_runtime::*; +use bridge_runtime_common::{ + lanes::*, + messages::{source::*, target::*, *}, +}; +use darwinia_common_runtime::*; + +/// Message delivery proof for Crab -> Darwinia messages. +pub type ToDarwiniaMessagesDeliveryProof = FromBridgedChainMessagesDeliveryProof; +/// Message proof for Darwinia -> Crab messages. +pub type FromDarwiniaMessagesProof = FromBridgedChainMessagesProof; + +/// Message payload for Crab -> Darwinia messages. +pub type ToDarwiniaMessagePayload = FromThisChainMessagePayload; +/// Message payload for Darwinia -> Crab messages. +pub type FromDarwiniaMessagePayload = FromBridgedChainMessagePayload; + +/// Message verifier for Crab -> Darwinia messages. +pub type ToDarwiniaMessageVerifier = + FromThisChainMessageVerifier; + +/// Encoded Darwinia Call as it comes from Darwinia. +pub type FromDarwiniaEncodedCall = FromBridgedChainEncodedMessageCall; + +/// Call-dispatch based message dispatch for Darwinia -> Crab messages. +pub type FromDarwiniaMessageDispatch = FromBridgedChainMessageDispatch< + WithDarwiniaMessageBridge, + Runtime, + Balances, + WithDarwiniaDispatch, +>; + +pub const INITIAL_DARWINIA_TO_CRAB_CONVERSION_RATE: FixedU128 = + FixedU128::from_inner(FixedU128::DIV); + +frame_support::parameter_types! { + /// Crab to Darwinia conversion rate. Initially we treate both tokens as equal. + pub storage DarwiniaToCrabConversionRate: FixedU128 = INITIAL_DARWINIA_TO_CRAB_CONVERSION_RATE; +} + +#[derive(Clone, PartialEq, Eq, Encode, Decode, RuntimeDebug, TypeInfo)] +pub enum CrabToDarwiniaParameter { + /// The conversion formula we use is: `DarwiniaTokens = CrabTokens * + /// conversion_rate`. + DarwiniaToCrabConversionRate(FixedU128), +} +impl Parameter for CrabToDarwiniaParameter { + fn save(&self) { + match *self { + CrabToDarwiniaParameter::DarwiniaToCrabConversionRate(ref conversion_rate) => + DarwiniaToCrabConversionRate::set(conversion_rate), + } + } +} + +pub type ToDarwiniaMaximalOutboundPayloadSize = + bridge_runtime_common::messages::source::FromThisChainMaximalOutboundPayloadSize< + WithDarwiniaMessageBridge, + >; + +/// Darwinia <-> Crab message bridge. +#[derive(Clone, Copy, RuntimeDebug)] +pub struct WithDarwiniaMessageBridge; +impl MessageBridge for WithDarwiniaMessageBridge { + type BridgedChain = Darwinia; + type ThisChain = Crab; + + const BRIDGED_CHAIN_ID: bp_runtime::ChainId = DARWINIA_CHAIN_ID; + const BRIDGED_MESSAGES_PALLET_NAME: &'static str = + bridge_runtime_common::pallets::WITH_CRAB_MESSAGES_PALLET_NAME; + const RELAYER_FEE_PERCENT: u32 = 10; + const THIS_CHAIN_ID: bp_runtime::ChainId = CRAB_CHAIN_ID; +} + +#[derive(Clone, Copy, RuntimeDebug)] +pub struct Crab; +impl ChainWithMessages for Crab { + type AccountId = bp_crab::AccountId; + type Balance = bp_crab::Balance; + type Hash = bp_crab::Hash; + type Signature = bp_crab::Signature; + type Signer = bp_crab::AccountPublic; +} +impl ThisChainWithMessages for Crab { + type RuntimeCall = RuntimeCall; + type RuntimeOrigin = RuntimeOrigin; + + fn is_message_accepted(_send_origin: &Self::RuntimeOrigin, lane: &LaneId) -> bool { + *lane == DARWINIA_CRAB_LANE + } + + fn maximal_pending_messages_at_outbound_lane() -> MessageNonce { + MessageNonce::MAX + } +} + +#[derive(Clone, Copy, RuntimeDebug)] +pub struct Darwinia; +impl ChainWithMessages for Darwinia { + type AccountId = bp_darwinia::AccountId; + type Balance = bp_darwinia::Balance; + type Hash = bp_darwinia::Hash; + type Signature = bp_darwinia::Signature; + type Signer = bp_darwinia::AccountPublic; +} +impl BridgedChainWithMessages for Darwinia { + fn maximal_extrinsic_size() -> u32 { + bp_darwinia::DarwiniaLike::max_extrinsic_size() + } + + fn verify_dispatch_weight(_message_payload: &[u8], payload_weight: &Weight) -> bool { + let upper_limit = target::maximal_incoming_message_dispatch_weight( + bp_darwinia::DarwiniaLike::max_extrinsic_weight(), + ); + payload_weight.all_lte(upper_limit) + } +} +impl TargetHeaderChain::AccountId> + for Darwinia +{ + type Error = &'static str; + type MessagesDeliveryProof = ToDarwiniaMessagesDeliveryProof; + + fn verify_message(payload: &ToDarwiniaMessagePayload) -> Result<(), Self::Error> { + source::verify_chain_message::(payload) + } + + fn verify_messages_delivery_proof( + proof: Self::MessagesDeliveryProof, + ) -> Result<(LaneId, InboundLaneData), Self::Error> { + source::verify_messages_delivery_proof::< + WithDarwiniaMessageBridge, + Runtime, + WithDarwiniaGrandpa, + >(proof) + } +} +impl SourceHeaderChain<::Balance> for Darwinia { + type Error = &'static str; + type MessagesProof = FromDarwiniaMessagesProof; + + fn verify_messages_proof( + proof: Self::MessagesProof, + messages_count: u32, + ) -> Result::Balance>>, Self::Error> { + target::verify_messages_proof::( + proof, + messages_count, + ) + } +} diff --git a/runtime/crab/src/bridges_message/mod.rs b/runtime/crab/src/bridges_message/mod.rs new file mode 100644 index 000000000..f3c0116ff --- /dev/null +++ b/runtime/crab/src/bridges_message/mod.rs @@ -0,0 +1,20 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +pub mod darwinia; +pub use darwinia as bm_darwinia; diff --git a/runtime/crab/src/lib.rs b/runtime/crab/src/lib.rs index 138b77e77..93d3c69fa 100644 --- a/runtime/crab/src/lib.rs +++ b/runtime/crab/src/lib.rs @@ -27,8 +27,12 @@ include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); mod pallets; pub use pallets::*; +mod bridges_message; +pub use bridges_message::*; + mod weights; +pub use darwinia_common_runtime::*; pub use sp_consensus_aura::sr25519::AuthorityId as AuraId; // cumulus @@ -309,6 +313,12 @@ frame_support::construct_runtime! { Ethereum: pallet_ethereum = 31, Evm: pallet_evm = 32, BaseFee: pallet_base_fee = 33, + + // S2S stuff + BridgeDarwiniaGrandpa: pallet_bridge_grandpa:: = 35, + BridgeDarwiniaMessages: pallet_bridge_messages:: = 36, + BridgeDarwiniaDispatch: pallet_bridge_dispatch:: = 37, + DarwiniaFeeMarket: pallet_fee_market:: = 38 } } diff --git a/runtime/crab/src/pallets/bridge_dispatch.rs b/runtime/crab/src/pallets/bridge_dispatch.rs new file mode 100644 index 000000000..d5a919a78 --- /dev/null +++ b/runtime/crab/src/pallets/bridge_dispatch.rs @@ -0,0 +1,45 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +pub use pallet_bridge_dispatch::Instance1 as WithDarwiniaDispatch; + +// darwinia +use crate::*; +use bp_message_dispatch::{Everything, IntoDispatchOrigin as IntoDispatchOriginT}; +use bp_messages::{LaneId, MessageNonce}; +use pallet_bridge_dispatch::Config; + +pub struct IntoDispatchOrigin; +impl IntoDispatchOriginT for IntoDispatchOrigin { + fn into_dispatch_origin(id: &bp_crab::AccountId, _: &RuntimeCall) -> RuntimeOrigin { + frame_system::RawOrigin::Signed(id.clone()).into() + } +} + +impl Config for Runtime { + type AccountIdConverter = bp_crab::AccountIdConverter; + type BridgeMessageId = (LaneId, MessageNonce); + type CallValidator = Everything; + type EncodedCall = bm_darwinia::FromDarwiniaEncodedCall; + type IntoDispatchOrigin = IntoDispatchOrigin; + type RuntimeCall = RuntimeCall; + type RuntimeEvent = RuntimeEvent; + type SourceChainAccountId = bp_darwinia::AccountId; + type TargetChainAccountPublic = bp_crab::AccountPublic; + type TargetChainSignature = bp_crab::Signature; +} diff --git a/runtime/crab/src/pallets/bridge_grandpa.rs b/runtime/crab/src/pallets/bridge_grandpa.rs new file mode 100644 index 000000000..3ce65f20b --- /dev/null +++ b/runtime/crab/src/pallets/bridge_grandpa.rs @@ -0,0 +1,41 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +pub use pallet_bridge_grandpa::Instance1 as WithDarwiniaGrandpa; + +// darwinia +use crate::*; +use pallet_bridge_grandpa::Config; + +frame_support::parameter_types! { + // This is a pretty unscientific cap. + // + // Note that once this is hit the pallet will essentially throttle incoming requests down to one + // call per block. + pub const MaxRequests: u32 = 50; + pub const DarwiniaHeadersToKeep: u32 = 500; +} + +impl Config for Runtime { + type BridgedChain = bp_darwinia::DarwiniaLike; + type HeadersToKeep = DarwiniaHeadersToKeep; + type MaxBridgedAuthorities = (); + type MaxBridgedHeaderSize = (); + type MaxRequests = MaxRequests; + type WeightInfo = (); +} diff --git a/runtime/crab/src/pallets/bridge_messages.rs b/runtime/crab/src/pallets/bridge_messages.rs new file mode 100644 index 000000000..bd260b878 --- /dev/null +++ b/runtime/crab/src/pallets/bridge_messages.rs @@ -0,0 +1,73 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +use pallet_bridge_messages::Instance1 as WithDarwiniaMessages; + +// darwinia +use crate::{bm_darwinia::ToDarwiniaMaximalOutboundPayloadSize, *}; +use bp_messages::{source_chain::SenderOrigin, MessageNonce}; +use bp_runtime::{ChainId, DARWINIA_CHAIN_ID}; +use pallet_bridge_messages::Config; +use pallet_fee_market::s2s::{ + FeeMarketMessageAcceptedHandler, FeeMarketMessageConfirmedHandler, FeeMarketPayment, +}; + +impl SenderOrigin for RuntimeOrigin { + fn linked_account(&self) -> Option { + match self.caller { + OriginCaller::system(frame_system::RawOrigin::Signed(ref submitter)) => + Some(submitter.clone()), + _ => None, + } + } +} + +frame_support::parameter_types! { + pub const MaxMessagesToPruneAtOnce: MessageNonce = 8; + pub const BridgedChainId: ChainId = DARWINIA_CHAIN_ID; + pub const MaxUnconfirmedMessagesAtInboundLane: MessageNonce = + bp_darwinia::MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX; + pub const MaxUnrewardedRelayerEntriesAtInboundLane: MessageNonce = + bp_darwinia::MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX; + pub RootAccountForPayments: Option = None; +} + +impl Config for Runtime { + type AccountIdConverter = bp_crab::AccountIdConverter; + type BridgedChainId = BridgedChainId; + type InboundMessageFee = bp_darwinia::Balance; + type InboundPayload = bm_darwinia::FromDarwiniaMessagePayload; + type InboundRelayer = bp_darwinia::AccountId; + type LaneMessageVerifier = bm_darwinia::ToDarwiniaMessageVerifier; + type MaxMessagesToPruneAtOnce = MaxMessagesToPruneAtOnce; + type MaxUnconfirmedMessagesAtInboundLane = MaxUnconfirmedMessagesAtInboundLane; + type MaxUnrewardedRelayerEntriesAtInboundLane = MaxUnrewardedRelayerEntriesAtInboundLane; + type MaximalOutboundPayloadSize = ToDarwiniaMaximalOutboundPayloadSize; + type MessageDeliveryAndDispatchPayment = + FeeMarketPayment; + type MessageDispatch = bm_darwinia::FromDarwiniaMessageDispatch; + type OnDeliveryConfirmed = FeeMarketMessageConfirmedHandler; + type OnMessageAccepted = FeeMarketMessageAcceptedHandler; + type OutboundMessageFee = bp_crab::Balance; + type OutboundPayload = bm_darwinia::ToDarwiniaMessagePayload; + type Parameter = bm_darwinia::CrabToDarwiniaParameter; + type RuntimeEvent = RuntimeEvent; + type SourceHeaderChain = bm_darwinia::Darwinia; + type TargetHeaderChain = bm_darwinia::Darwinia; + type WeightInfo = (); +} diff --git a/runtime/crab/src/pallets/fee_market.rs b/runtime/crab/src/pallets/fee_market.rs new file mode 100644 index 000000000..a9d93df1b --- /dev/null +++ b/runtime/crab/src/pallets/fee_market.rs @@ -0,0 +1,70 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +pub use pallet_fee_market::Instance1 as WithDarwiniaFeeMarket; + +// --- core --- +use core::cmp; +// --- substrate --- +use frame_support::{traits::LockIdentifier, PalletId}; +use sp_runtime::{traits::UniqueSaturatedInto, Permill}; +// --- darwinia --- +use crate::*; +use pallet_fee_market::{BalanceOf, Config, Slasher}; + +pub struct FeeMarketSlasher; +impl, I: 'static> Slasher for FeeMarketSlasher { + fn calc_amount(locked_collateral: BalanceOf, timeout: T::BlockNumber) -> BalanceOf { + let slash_each_block = 2 * UNIT; + let slash_value = UniqueSaturatedInto::::unique_saturated_into(timeout) + .saturating_mul(UniqueSaturatedInto::::unique_saturated_into(slash_each_block)) + .unique_saturated_into(); + + cmp::min(locked_collateral, slash_value) + } +} + +frame_support::parameter_types! { + pub const TreasuryPalletId: PalletId = PalletId(*b"da/trsry"); + pub const FeeMarketLockId: LockIdentifier = *b"da/feecr"; + + pub const MinimumRelayFee: Balance = 15 * UNIT; + pub const CollateralPerOrder: Balance = 50 * UNIT; + pub const Slot: BlockNumber = 600; + + pub const DutyRelayersRewardRatio: Permill = Permill::from_percent(60); + pub const MessageRelayersRewardRatio: Permill = Permill::from_percent(80); + pub const ConfirmRelayersRewardRatio: Permill = Permill::from_percent(20); + pub const AssignedRelayerSlashRatio: Permill = Permill::from_percent(20); +} + +impl Config for Runtime { + type AssignedRelayerSlashRatio = AssignedRelayerSlashRatio; + type CollateralPerOrder = CollateralPerOrder; + type ConfirmRelayersRewardRatio = ConfirmRelayersRewardRatio; + type Currency = Balances; + type DutyRelayersRewardRatio = DutyRelayersRewardRatio; + type LockId = FeeMarketLockId; + type MessageRelayersRewardRatio = MessageRelayersRewardRatio; + type MinimumRelayFee = MinimumRelayFee; + type RuntimeEvent = RuntimeEvent; + type Slasher = FeeMarketSlasher; + type Slot = Slot; + type TreasuryPalletId = TreasuryPalletId; + type WeightInfo = (); +} diff --git a/runtime/crab/src/pallets/mod.rs b/runtime/crab/src/pallets/mod.rs index 3442d4ded..6db8976d6 100644 --- a/runtime/crab/src/pallets/mod.rs +++ b/runtime/crab/src/pallets/mod.rs @@ -100,3 +100,16 @@ mod evm; pub use evm::*; mod base_fee; + +// S2S stuff +mod bridge_dispatch; +pub use bridge_dispatch::*; + +mod bridge_grandpa; +pub use bridge_grandpa::*; + +mod bridge_messages; +pub use bridge_messages::*; + +mod fee_market; +pub use fee_market::*; diff --git a/runtime/darwinia/src/bridges_message/crab.rs b/runtime/darwinia/src/bridges_message/crab.rs new file mode 100644 index 000000000..dde6a12f8 --- /dev/null +++ b/runtime/darwinia/src/bridges_message/crab.rs @@ -0,0 +1,170 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// crates.io +use codec::{Decode, Encode}; +use scale_info::TypeInfo; +// paritytech +use frame_support::{weights::Weight, RuntimeDebug}; +use sp_runtime::{FixedPointNumber, FixedU128}; +// darwinia +use crate::*; +use bp_messages::{source_chain::*, target_chain::*, *}; +use bp_runtime::*; +use bridge_runtime_common::{ + lanes::*, + messages::{source::*, target::*, *}, +}; +use darwinia_common_runtime::*; + +/// Message delivery proof for Darwinia -> Crab messages. +pub type ToCrabMessagesDeliveryProof = FromBridgedChainMessagesDeliveryProof; +/// Message proof for Crab -> Darwinia messages. +pub type FromCrabMessagesProof = FromBridgedChainMessagesProof; + +/// Message payload for Darwinia -> Crab messages. +pub type ToCrabMessagePayload = FromThisChainMessagePayload; +/// Message payload for Crab -> Darwinia messages. +pub type FromCrabMessagePayload = FromBridgedChainMessagePayload; + +/// Message verifier for Darwinia -> Crab messages. +pub type ToCrabMessageVerifier = + FromThisChainMessageVerifier; + +/// Encoded Crab Call as it comes from Crab. +pub type FromCrabEncodedCall = FromBridgedChainEncodedMessageCall; + +/// Call-dispatch based message dispatch for Crab -> Darwinia messages. +pub type FromCrabMessageDispatch = + FromBridgedChainMessageDispatch; + +pub const INITIAL_CRAB_TO_DARWINIA_CONVERSION_RATE: FixedU128 = + FixedU128::from_inner(FixedU128::DIV); + +frame_support::parameter_types! { + /// Darwinia to Crab conversion rate. Initially we treate both tokens as equal. + pub storage CrabToDarwiniaConversionRate: FixedU128 = INITIAL_CRAB_TO_DARWINIA_CONVERSION_RATE; +} + +#[derive(Clone, PartialEq, Eq, Encode, Decode, RuntimeDebug, TypeInfo)] +pub enum DarwiniaToCrabParameter { + /// The conversion formula we use is: `CrabTokens = DarwiniaTokens * + /// conversion_rate`. + CrabToDarwiniaConversionRate(FixedU128), +} +impl Parameter for DarwiniaToCrabParameter { + fn save(&self) { + match *self { + DarwiniaToCrabParameter::CrabToDarwiniaConversionRate(ref conversion_rate) => + CrabToDarwiniaConversionRate::set(conversion_rate), + } + } +} + +pub type ToCrabMaximalOutboundPayloadSize = + bridge_runtime_common::messages::source::FromThisChainMaximalOutboundPayloadSize< + WithCrabMessageBridge, + >; + +/// Crab <-> Darwinia message bridge. +#[derive(Clone, Copy, RuntimeDebug)] +pub struct WithCrabMessageBridge; +impl MessageBridge for WithCrabMessageBridge { + type BridgedChain = Crab; + type ThisChain = Darwinia; + + const BRIDGED_CHAIN_ID: bp_runtime::ChainId = CRAB_CHAIN_ID; + const BRIDGED_MESSAGES_PALLET_NAME: &'static str = + bridge_runtime_common::pallets::WITH_DARWINIA_MESSAGES_PALLET_NAME; + const RELAYER_FEE_PERCENT: u32 = 10; + const THIS_CHAIN_ID: bp_runtime::ChainId = DARWINIA_CHAIN_ID; +} + +#[derive(Clone, Copy, RuntimeDebug)] +pub struct Darwinia; +impl ChainWithMessages for Darwinia { + type AccountId = bp_darwinia::AccountId; + type Balance = bp_darwinia::Balance; + type Hash = bp_darwinia::Hash; + type Signature = bp_darwinia::Signature; + type Signer = bp_darwinia::AccountPublic; +} +impl ThisChainWithMessages for Darwinia { + type RuntimeCall = RuntimeCall; + type RuntimeOrigin = RuntimeOrigin; + + fn is_message_accepted(_send_origin: &Self::RuntimeOrigin, lane: &LaneId) -> bool { + *lane == DARWINIA_CRAB_LANE + } + + fn maximal_pending_messages_at_outbound_lane() -> MessageNonce { + MessageNonce::MAX + } +} + +#[derive(Clone, Copy, RuntimeDebug)] +pub struct Crab; +impl ChainWithMessages for Crab { + type AccountId = bp_crab::AccountId; + type Balance = bp_crab::Balance; + type Hash = bp_crab::Hash; + type Signature = bp_crab::Signature; + type Signer = bp_crab::AccountPublic; +} +impl BridgedChainWithMessages for Crab { + fn maximal_extrinsic_size() -> u32 { + bp_crab::DarwiniaLike::max_extrinsic_size() + } + + fn verify_dispatch_weight(_message_payload: &[u8], payload_weight: &Weight) -> bool { + let upper_limit = target::maximal_incoming_message_dispatch_weight( + bp_crab::DarwiniaLike::max_extrinsic_weight(), + ); + payload_weight.all_lte(upper_limit) + } +} +impl TargetHeaderChain::AccountId> for Crab { + type Error = &'static str; + type MessagesDeliveryProof = ToCrabMessagesDeliveryProof; + + fn verify_message(payload: &ToCrabMessagePayload) -> Result<(), Self::Error> { + source::verify_chain_message::(payload) + } + + fn verify_messages_delivery_proof( + proof: Self::MessagesDeliveryProof, + ) -> Result<(LaneId, InboundLaneData), Self::Error> { + source::verify_messages_delivery_proof::( + proof, + ) + } +} +impl SourceHeaderChain<::Balance> for Crab { + type Error = &'static str; + type MessagesProof = FromCrabMessagesProof; + + fn verify_messages_proof( + proof: Self::MessagesProof, + messages_count: u32, + ) -> Result::Balance>>, Self::Error> { + target::verify_messages_proof::( + proof, + messages_count, + ) + } +} diff --git a/runtime/darwinia/src/bridges_message/mod.rs b/runtime/darwinia/src/bridges_message/mod.rs new file mode 100644 index 000000000..fd58eaf04 --- /dev/null +++ b/runtime/darwinia/src/bridges_message/mod.rs @@ -0,0 +1,20 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +pub mod crab; +pub use crab as bm_crab; diff --git a/runtime/darwinia/src/lib.rs b/runtime/darwinia/src/lib.rs index 81ad46221..a6ef11a7d 100644 --- a/runtime/darwinia/src/lib.rs +++ b/runtime/darwinia/src/lib.rs @@ -27,8 +27,12 @@ include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); mod pallets; pub use pallets::*; +mod bridges_message; +pub use bridges_message::*; + mod weights; +pub use darwinia_common_runtime::*; pub use sp_consensus_aura::sr25519::AuthorityId as AuraId; // cumulus @@ -309,6 +313,12 @@ frame_support::construct_runtime! { Ethereum: pallet_ethereum = 31, Evm: pallet_evm = 32, BaseFee: pallet_base_fee = 33, + + // S2S stuff + BridgeCrabGrandpa: pallet_bridge_grandpa:: = 35, + BridgeCrabMessages: pallet_bridge_messages:: = 36, + BridgeCrabDispatch: pallet_bridge_dispatch:: = 37, + CrabFeeMarket: pallet_fee_market:: = 38 } } diff --git a/runtime/darwinia/src/pallets/bridge_dispatch.rs b/runtime/darwinia/src/pallets/bridge_dispatch.rs new file mode 100644 index 000000000..696eb8679 --- /dev/null +++ b/runtime/darwinia/src/pallets/bridge_dispatch.rs @@ -0,0 +1,47 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +pub use pallet_bridge_dispatch::Instance1 as WithCrabDispatch; + +// darwinia +use crate::*; +use bp_message_dispatch::{Everything, IntoDispatchOrigin as IntoDispatchOriginT}; +use bp_messages::{LaneId, MessageNonce}; +use pallet_bridge_dispatch::Config; + +pub struct IntoDispatchOrigin; +impl IntoDispatchOriginT + for IntoDispatchOrigin +{ + fn into_dispatch_origin(id: &bp_darwinia::AccountId, _: &RuntimeCall) -> RuntimeOrigin { + frame_system::RawOrigin::Signed(id.clone()).into() + } +} + +impl Config for Runtime { + type AccountIdConverter = bp_darwinia::AccountIdConverter; + type BridgeMessageId = (LaneId, MessageNonce); + type CallValidator = Everything; + type EncodedCall = bm_crab::FromCrabEncodedCall; + type IntoDispatchOrigin = IntoDispatchOrigin; + type RuntimeCall = RuntimeCall; + type RuntimeEvent = RuntimeEvent; + type SourceChainAccountId = bp_crab::AccountId; + type TargetChainAccountPublic = bp_darwinia::AccountPublic; + type TargetChainSignature = bp_darwinia::Signature; +} diff --git a/runtime/darwinia/src/pallets/bridge_grandpa.rs b/runtime/darwinia/src/pallets/bridge_grandpa.rs new file mode 100644 index 000000000..b2180fa6f --- /dev/null +++ b/runtime/darwinia/src/pallets/bridge_grandpa.rs @@ -0,0 +1,41 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +pub use pallet_bridge_grandpa::Instance1 as WithCrabGrandpa; + +// darwinia +use crate::*; +use pallet_bridge_grandpa::Config; + +frame_support::parameter_types! { + // This is a pretty unscientific cap. + // + // Note that once this is hit the pallet will essentially throttle incoming requests down to one + // call per block. + pub const MaxRequests: u32 = 50; + pub const CrabHeadersToKeep: u32 = 500; +} + +impl Config for Runtime { + type BridgedChain = bp_crab::DarwiniaLike; + type HeadersToKeep = CrabHeadersToKeep; + type MaxBridgedAuthorities = (); + type MaxBridgedHeaderSize = (); + type MaxRequests = MaxRequests; + type WeightInfo = (); +} diff --git a/runtime/darwinia/src/pallets/bridge_messages.rs b/runtime/darwinia/src/pallets/bridge_messages.rs new file mode 100644 index 000000000..544f5a894 --- /dev/null +++ b/runtime/darwinia/src/pallets/bridge_messages.rs @@ -0,0 +1,72 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +use pallet_bridge_messages::Instance1 as WithCrabMessages; + +// darwinia +use crate::{bm_crab::ToCrabMaximalOutboundPayloadSize, *}; +use bp_messages::{source_chain::SenderOrigin, MessageNonce}; +use bp_runtime::{ChainId, CRAB_CHAIN_ID}; +use pallet_bridge_messages::Config; +use pallet_fee_market::s2s::{ + FeeMarketMessageAcceptedHandler, FeeMarketMessageConfirmedHandler, FeeMarketPayment, +}; + +impl SenderOrigin for RuntimeOrigin { + fn linked_account(&self) -> Option { + match self.caller { + OriginCaller::system(frame_system::RawOrigin::Signed(ref submitter)) => + Some(submitter.clone()), + _ => None, + } + } +} + +frame_support::parameter_types! { + pub const MaxMessagesToPruneAtOnce: MessageNonce = 8; + pub const BridgedChainId: ChainId = CRAB_CHAIN_ID; + pub const MaxUnconfirmedMessagesAtInboundLane: MessageNonce = + bp_darwinia::MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX; + pub const MaxUnrewardedRelayerEntriesAtInboundLane: MessageNonce = + bp_darwinia::MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX; + pub RootAccountForPayments: Option = None; +} + +impl Config for Runtime { + type AccountIdConverter = bp_darwinia::AccountIdConverter; + type BridgedChainId = BridgedChainId; + type InboundMessageFee = bp_crab::Balance; + type InboundPayload = bm_crab::FromCrabMessagePayload; + type InboundRelayer = bp_crab::AccountId; + type LaneMessageVerifier = bm_crab::ToCrabMessageVerifier; + type MaxMessagesToPruneAtOnce = MaxMessagesToPruneAtOnce; + type MaxUnconfirmedMessagesAtInboundLane = MaxUnconfirmedMessagesAtInboundLane; + type MaxUnrewardedRelayerEntriesAtInboundLane = MaxUnrewardedRelayerEntriesAtInboundLane; + type MaximalOutboundPayloadSize = ToCrabMaximalOutboundPayloadSize; + type MessageDeliveryAndDispatchPayment = FeeMarketPayment; + type MessageDispatch = bm_crab::FromCrabMessageDispatch; + type OnDeliveryConfirmed = FeeMarketMessageConfirmedHandler; + type OnMessageAccepted = FeeMarketMessageAcceptedHandler; + type OutboundMessageFee = bp_darwinia::Balance; + type OutboundPayload = bm_crab::ToCrabMessagePayload; + type Parameter = bm_crab::DarwiniaToCrabParameter; + type RuntimeEvent = RuntimeEvent; + type SourceHeaderChain = bm_crab::Crab; + type TargetHeaderChain = bm_crab::Crab; + type WeightInfo = (); +} diff --git a/runtime/darwinia/src/pallets/fee_market.rs b/runtime/darwinia/src/pallets/fee_market.rs new file mode 100644 index 000000000..67b134938 --- /dev/null +++ b/runtime/darwinia/src/pallets/fee_market.rs @@ -0,0 +1,70 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +pub use pallet_fee_market::Instance1 as WithCrabFeeMarket; + +// --- core --- +use core::cmp; +// --- substrate --- +use frame_support::{traits::LockIdentifier, PalletId}; +use sp_runtime::{traits::UniqueSaturatedInto, Permill}; +// --- darwinia --- +use crate::*; +use pallet_fee_market::{BalanceOf, Config, Slasher}; + +pub struct FeeMarketSlasher; +impl, I: 'static> Slasher for FeeMarketSlasher { + fn calc_amount(locked_collateral: BalanceOf, timeout: T::BlockNumber) -> BalanceOf { + let slash_each_block = 2 * UNIT; + let slash_value = UniqueSaturatedInto::::unique_saturated_into(timeout) + .saturating_mul(UniqueSaturatedInto::::unique_saturated_into(slash_each_block)) + .unique_saturated_into(); + + cmp::min(locked_collateral, slash_value) + } +} + +frame_support::parameter_types! { + pub const TreasuryPalletId: PalletId = PalletId(*b"da/trsry"); + pub const FeeMarketLockId: LockIdentifier = *b"da/feecr"; + + pub const MinimumRelayFee: Balance = 15 * UNIT; + pub const CollateralPerOrder: Balance = 50 * UNIT; + pub const Slot: BlockNumber = 600; + + pub const DutyRelayersRewardRatio: Permill = Permill::from_percent(60); + pub const MessageRelayersRewardRatio: Permill = Permill::from_percent(80); + pub const ConfirmRelayersRewardRatio: Permill = Permill::from_percent(20); + pub const AssignedRelayerSlashRatio: Permill = Permill::from_percent(20); +} + +impl Config for Runtime { + type AssignedRelayerSlashRatio = AssignedRelayerSlashRatio; + type CollateralPerOrder = CollateralPerOrder; + type ConfirmRelayersRewardRatio = ConfirmRelayersRewardRatio; + type Currency = Balances; + type DutyRelayersRewardRatio = DutyRelayersRewardRatio; + type LockId = FeeMarketLockId; + type MessageRelayersRewardRatio = MessageRelayersRewardRatio; + type MinimumRelayFee = MinimumRelayFee; + type RuntimeEvent = RuntimeEvent; + type Slasher = FeeMarketSlasher; + type Slot = Slot; + type TreasuryPalletId = TreasuryPalletId; + type WeightInfo = (); +} diff --git a/runtime/darwinia/src/pallets/mod.rs b/runtime/darwinia/src/pallets/mod.rs index 3442d4ded..6db8976d6 100644 --- a/runtime/darwinia/src/pallets/mod.rs +++ b/runtime/darwinia/src/pallets/mod.rs @@ -100,3 +100,16 @@ mod evm; pub use evm::*; mod base_fee; + +// S2S stuff +mod bridge_dispatch; +pub use bridge_dispatch::*; + +mod bridge_grandpa; +pub use bridge_grandpa::*; + +mod bridge_messages; +pub use bridge_messages::*; + +mod fee_market; +pub use fee_market::*; From e68b0518c043c15eb9b78c9fd675545d26e5c90d Mon Sep 17 00:00:00 2001 From: Guantong <04637@163.com> Date: Wed, 30 Nov 2022 17:33:27 +0800 Subject: [PATCH 020/189] Fix #72 (#79) --- core/primitives/src/lib.rs | 3 +++ runtime/crab/src/pallets/polkadot_xcm.rs | 2 +- runtime/darwinia/src/pallets/polkadot_xcm.rs | 2 +- runtime/pangolin/src/pallets/polkadot_xcm.rs | 2 +- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/core/primitives/src/lib.rs b/core/primitives/src/lib.rs index 411a8f719..c927ec585 100644 --- a/core/primitives/src/lib.rs +++ b/core/primitives/src/lib.rs @@ -97,3 +97,6 @@ pub const MWEI: Balance = 1_000 * KWEI; pub const KWEI: Balance = 1_000 * WEI; /// 1 wei — 1 pub const WEI: Balance = 1; + +/// Base balance required for the XCM unit weight +pub const BASE_WEIGHT_FEE: Balance = GWEI; diff --git a/runtime/crab/src/pallets/polkadot_xcm.rs b/runtime/crab/src/pallets/polkadot_xcm.rs index b4f1ccc66..15fa2c0b0 100644 --- a/runtime/crab/src/pallets/polkadot_xcm.rs +++ b/runtime/crab/src/pallets/polkadot_xcm.rs @@ -121,7 +121,7 @@ impl xcm_executor::Config for XcmExecutorConfig { type RuntimeCall = RuntimeCall; type SubscriptionService = PolkadotXcm; type Trader = UsingComponents< - WeightToFee, + ConstantMultiplier>, AnchoringSelfReserve, AccountId, Balances, diff --git a/runtime/darwinia/src/pallets/polkadot_xcm.rs b/runtime/darwinia/src/pallets/polkadot_xcm.rs index d95fff635..308f7a10f 100644 --- a/runtime/darwinia/src/pallets/polkadot_xcm.rs +++ b/runtime/darwinia/src/pallets/polkadot_xcm.rs @@ -121,7 +121,7 @@ impl xcm_executor::Config for XcmExecutorConfig { type RuntimeCall = RuntimeCall; type SubscriptionService = PolkadotXcm; type Trader = UsingComponents< - WeightToFee, + ConstantMultiplier>, AnchoringSelfReserve, AccountId, Balances, diff --git a/runtime/pangolin/src/pallets/polkadot_xcm.rs b/runtime/pangolin/src/pallets/polkadot_xcm.rs index b0e91ea36..08fe7222f 100644 --- a/runtime/pangolin/src/pallets/polkadot_xcm.rs +++ b/runtime/pangolin/src/pallets/polkadot_xcm.rs @@ -121,7 +121,7 @@ impl xcm_executor::Config for XcmExecutorConfig { type RuntimeCall = RuntimeCall; type SubscriptionService = PolkadotXcm; type Trader = UsingComponents< - WeightToFee, + ConstantMultiplier>, AnchoringSelfReserve, AccountId, Balances, From 7845ccdbcdedc99c27739d20c20473dd5ff56190 Mon Sep 17 00:00:00 2001 From: bear Date: Wed, 30 Nov 2022 19:15:52 +0800 Subject: [PATCH 021/189] Add `message-transact` back (#74) --- Cargo.lock | 52 +++ Cargo.toml | 1 + pallets/message-transact/Cargo.toml | 73 ++++ pallets/message-transact/src/lib.rs | 201 ++++++++++ pallets/message-transact/src/mock.rs | 369 ++++++++++++++++++ pallets/message-transact/src/tests/eip1559.rs | 249 ++++++++++++ pallets/message-transact/src/tests/eip2930.rs | 248 ++++++++++++ pallets/message-transact/src/tests/legacy.rs | 245 ++++++++++++ pallets/message-transact/src/tests/mod.rs | 257 ++++++++++++ precompiles/state-storage/src/mock.rs | 2 +- runtime/crab/Cargo.toml | 2 + runtime/crab/src/lib.rs | 1 + runtime/crab/src/pallets/bridge_dispatch.rs | 68 +++- runtime/crab/src/pallets/message_transact.rs | 25 ++ runtime/crab/src/pallets/mod.rs | 2 + runtime/darwinia/Cargo.toml | 2 + runtime/darwinia/src/lib.rs | 1 + .../darwinia/src/pallets/bridge_dispatch.rs | 70 +++- .../darwinia/src/pallets/message_transact.rs | 25 ++ runtime/darwinia/src/pallets/mod.rs | 2 + runtime/pangolin/Cargo.toml | 2 + runtime/pangolin/src/lib.rs | 1 + .../pangolin/src/pallets/message_transact.rs | 25 ++ runtime/pangolin/src/pallets/mod.rs | 2 + 24 files changed, 1912 insertions(+), 13 deletions(-) create mode 100644 pallets/message-transact/Cargo.toml create mode 100644 pallets/message-transact/src/lib.rs create mode 100644 pallets/message-transact/src/mock.rs create mode 100644 pallets/message-transact/src/tests/eip1559.rs create mode 100644 pallets/message-transact/src/tests/eip2930.rs create mode 100644 pallets/message-transact/src/tests/legacy.rs create mode 100644 pallets/message-transact/src/tests/mod.rs create mode 100644 runtime/crab/src/pallets/message_transact.rs create mode 100644 runtime/darwinia/src/pallets/message_transact.rs create mode 100644 runtime/pangolin/src/pallets/message_transact.rs diff --git a/Cargo.lock b/Cargo.lock index c6892f3f6..7ac303fd8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1349,6 +1349,7 @@ dependencies = [ "cumulus-primitives-timestamp", "cumulus-primitives-utility", "darwinia-common-runtime", + "darwinia-message-transact", "darwinia-precompile-assets", "darwinia-precompile-bls12-381", "darwinia-precompile-state-storage", @@ -2297,6 +2298,36 @@ dependencies = [ "xcm-executor", ] +[[package]] +name = "darwinia-message-transact" +version = "6.0.0" +dependencies = [ + "array-bytes", + "bp-message-dispatch", + "bp-runtime", + "ethereum", + "fp-ethereum", + "fp-evm", + "fp-self-contained", + "frame-support", + "frame-system", + "libsecp256k1 0.5.0", + "pallet-balances", + "pallet-bridge-dispatch", + "pallet-ethereum", + "pallet-evm", + "pallet-timestamp", + "parity-scale-codec", + "precompile-utils", + "rlp", + "scale-info", + "sha3 0.9.1", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", +] + [[package]] name = "darwinia-precompile-assets" version = "6.0.0" @@ -2377,6 +2408,7 @@ dependencies = [ "cumulus-primitives-timestamp", "cumulus-primitives-utility", "darwinia-common-runtime", + "darwinia-message-transact", "darwinia-precompile-assets", "darwinia-precompile-bls12-381", "darwinia-precompile-state-storage", @@ -5189,6 +5221,25 @@ dependencies = [ "tikv-jemalloc-sys", ] +[[package]] +name = "libsecp256k1" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd1137239ab33b41aa9637a88a28249e5e70c40a42ccc92db7f12cc356c1fcd7" +dependencies = [ + "arrayref", + "base64 0.12.3", + "digest 0.9.0", + "hmac-drbg", + "libsecp256k1-core 0.2.2", + "libsecp256k1-gen-ecmult 0.2.1", + "libsecp256k1-gen-genmult 0.2.1", + "rand 0.7.3", + "serde", + "sha2 0.9.9", + "typenum", +] + [[package]] name = "libsecp256k1" version = "0.6.0" @@ -7183,6 +7234,7 @@ dependencies = [ "cumulus-primitives-timestamp", "cumulus-primitives-utility", "darwinia-common-runtime", + "darwinia-message-transact", "darwinia-precompile-assets", "darwinia-precompile-bls12-381", "darwinia-precompile-state-storage", diff --git a/Cargo.toml b/Cargo.toml index 17c5b7891..e63373346 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,6 +5,7 @@ panic = "unwind" members = [ "core/*", "node", + "pallets/*", "precompiles/*", "runtime/*", ] diff --git a/pallets/message-transact/Cargo.toml b/pallets/message-transact/Cargo.toml new file mode 100644 index 000000000..a8bc117f1 --- /dev/null +++ b/pallets/message-transact/Cargo.toml @@ -0,0 +1,73 @@ +[package] +authors = ["Darwinia Network "] +description = "State storage precompiles for EVM pallet." +edition = "2021" +homepage = "https://darwinia.network" +license = "GPL-3.0" +name = "darwinia-message-transact" +readme = "README.md" +repository = "https://github.com/darwinia-network/darwinia" +version = "6.0.0" + +[dependencies] +# crates.io +codec = { default-features = false, package = "parity-scale-codec", version = "3.2.1", features = ["derive"] } +ethereum = { default-features = false, version = "0.12.0", features = ["with-codec"] } +scale-info = { default-features = false, version = "2.3.0", features = ["derive"] } + +# frontier +fp-ethereum = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +fp-evm = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +pallet-evm = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } + +# paritytech +frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } + +[dev-dependencies] +array-bytes = { version = "4.1" } +libsecp256k1 = { version = "0.5", features = ["static-context", "hmac"] } +rlp = { version = "0.5" } +sha3 = { version = "0.9" } + +# darwinia +pallet-bridge-dispatch = { git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } +bp-message-dispatch = { git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } +bp-runtime = { git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } + +# frontier +fp-self-contained = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } + +# moonbeam +precompile-utils = { git = "https://github.com/darwinia-network/moonbeam.git", branch = "polkadot-v0.9.30", features = ["testing"] } + +# substrate +pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-ethereum = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } + +[features] +default = ["std"] +std = [ + # crates.io + "codec/std", + "ethereum/std", + "scale-info/std", + + # frontier + "fp-evm/std", + "fp-ethereum/std", + "pallet-evm/std", + "pallet-ethereum/std", + + # paritytech + "frame-support/std", + "frame-system/std", + "sp-core/std", + "sp-runtime/std", + "sp-std/std", +] diff --git a/pallets/message-transact/src/lib.rs b/pallets/message-transact/src/lib.rs new file mode 100644 index 000000000..b6c097fe4 --- /dev/null +++ b/pallets/message-transact/src/lib.rs @@ -0,0 +1,201 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +#![cfg_attr(not(feature = "std"), no_std)] + +#[cfg(test)] +mod mock; +#[cfg(test)] +mod tests; + +// crates.io +use codec::{Decode, Encode, MaxEncodedLen}; +use ethereum::TransactionV2 as Transaction; +use frame_support::sp_runtime::traits::UniqueSaturatedInto; +use scale_info::TypeInfo; +// frontier +use fp_ethereum::{TransactionData, ValidatedTransaction}; +use fp_evm::{CheckEvmTransaction, CheckEvmTransactionConfig, InvalidEvmTransactionError}; +use pallet_evm::{FeeCalculator, GasWeightMapping}; +// substrate +use frame_support::{traits::EnsureOrigin, PalletError, RuntimeDebug}; +use sp_core::{H160, U256}; + +pub use pallet::*; + +#[derive(Clone, Eq, PartialEq, RuntimeDebug, Encode, Decode, MaxEncodedLen, TypeInfo)] +pub enum LcmpEthOrigin { + MessageTransact(H160), +} + +pub fn ensure_message_transact(o: OuterOrigin) -> Result +where + OuterOrigin: Into>, +{ + match o.into() { + Ok(LcmpEthOrigin::MessageTransact(n)) => Ok(n), + _ => Err("bad origin: expected to be an Lcmp Ethereum transaction"), + } +} + +pub struct EnsureLcmpEthOrigin; +impl> + From> EnsureOrigin + for EnsureLcmpEthOrigin +{ + type Success = H160; + + fn try_origin(o: O) -> Result { + o.into().map(|o| match o { + LcmpEthOrigin::MessageTransact(id) => id, + }) + } + + #[cfg(feature = "runtime-benchmarks")] + fn successful_origin() -> O { + O::from(LcmpEthOrigin::MessageTransact(Default::default())) + } +} + +#[frame_support::pallet] +pub mod pallet { + use super::*; + use frame_support::pallet_prelude::*; + use frame_system::pallet_prelude::*; + + #[pallet::pallet] + pub struct Pallet(PhantomData); + + #[pallet::origin] + pub type Origin = LcmpEthOrigin; + + #[pallet::config] + pub trait Config: frame_system::Config + pallet_evm::Config { + /// Handler for applying an already validated transaction + type ValidatedTransaction: ValidatedTransaction; + /// Origin for message transact + type LcmpEthOrigin: EnsureOrigin; + } + + #[pallet::error] + pub enum Error { + /// Evm validation errors. + MessageTransactError(EvmTxErrorWrapper), + } + + #[pallet::call] + impl Pallet + where + OriginFor: Into>>, + { + /// This call can only be called by the lcmp message layer and is not available to normal + /// users. + #[pallet::weight({ + let without_base_extrinsic_weight = true; + ::GasWeightMapping::gas_to_weight({ + let transaction_data: TransactionData = transaction.into(); + transaction_data.gas_limit.unique_saturated_into() + }, without_base_extrinsic_weight) + })] + pub fn message_transact( + origin: OriginFor, + transaction: Transaction, + ) -> DispatchResultWithPostInfo { + let source = ensure_message_transact(origin)?; + let (who, _) = pallet_evm::Pallet::::account_basic(&source); + let base_fee = T::FeeCalculator::min_gas_price().0; + + let mut transaction_mut = transaction; + match transaction_mut { + Transaction::Legacy(ref mut tx) => { + tx.nonce = who.nonce; + tx.gas_price = base_fee; + }, + Transaction::EIP2930(ref mut tx) => { + tx.nonce = who.nonce; + tx.gas_price = base_fee; + }, + Transaction::EIP1559(ref mut tx) => { + tx.nonce = who.nonce; + tx.max_fee_per_gas = base_fee; + tx.max_priority_fee_per_gas = U256::zero(); + }, + }; + + let transaction_data: TransactionData = (&transaction_mut).into(); + let _ = CheckEvmTransaction::::new( + CheckEvmTransactionConfig { + evm_config: T::config(), + block_gas_limit: T::BlockGasLimit::get(), + base_fee, + chain_id: T::ChainId::get(), + is_transactional: true, + }, + transaction_data.clone().into(), + ) + .validate_in_block_for(&who) + .and_then(|v| v.with_chain_id()) + .and_then(|v| v.with_base_fee()) + .and_then(|v| v.with_balance_for(&who)) + .map_err(|e| >::MessageTransactError(e))?; + + T::ValidatedTransaction::apply(source, transaction_mut) + } + } +} + +#[derive(Encode, Decode, TypeInfo, PalletError)] +pub enum EvmTxErrorWrapper { + GasLimitTooLow, + GasLimitTooHigh, + GasPriceTooLow, + PriorityFeeTooHigh, + BalanceTooLow, + TxNonceTooLow, + TxNonceTooHigh, + InvalidPaymentInput, + InvalidChainId, +} + +impl From for EvmTxErrorWrapper { + fn from(validation_error: InvalidEvmTransactionError) -> Self { + match validation_error { + InvalidEvmTransactionError::GasLimitTooLow => EvmTxErrorWrapper::GasLimitTooLow, + InvalidEvmTransactionError::GasLimitTooHigh => EvmTxErrorWrapper::GasLimitTooHigh, + InvalidEvmTransactionError::GasPriceTooLow => EvmTxErrorWrapper::GasPriceTooLow, + InvalidEvmTransactionError::PriorityFeeTooHigh => EvmTxErrorWrapper::PriorityFeeTooHigh, + InvalidEvmTransactionError::BalanceTooLow => EvmTxErrorWrapper::BalanceTooLow, + InvalidEvmTransactionError::TxNonceTooLow => EvmTxErrorWrapper::TxNonceTooLow, + InvalidEvmTransactionError::TxNonceTooHigh => EvmTxErrorWrapper::TxNonceTooHigh, + InvalidEvmTransactionError::InvalidPaymentInput => + EvmTxErrorWrapper::InvalidPaymentInput, + InvalidEvmTransactionError::InvalidChainId => EvmTxErrorWrapper::InvalidChainId, + } + } +} + +/// Calculates the fee for a relayer to submit an LCMP Evm transaction. +/// +/// The gas_price of an LCMP Evm transaction is always the min_gas_price(), which is a fixed value. +/// Therefore, only the gas_limit and value of the transaction should be considered in the +/// calculation of the fee, and the gas_price of the transaction itself can be ignored. +pub fn total_payment(tx_data: TransactionData) -> U256 { + let base_fee = ::FeeCalculator::min_gas_price().0; + let fee = base_fee.saturating_mul(tx_data.gas_limit); + + tx_data.value.saturating_add(fee) +} diff --git a/pallets/message-transact/src/mock.rs b/pallets/message-transact/src/mock.rs new file mode 100644 index 000000000..6bdd4cde4 --- /dev/null +++ b/pallets/message-transact/src/mock.rs @@ -0,0 +1,369 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Test utilities + +// crates.io +use codec::{Decode, Encode}; +use sha3::{Digest, Keccak256}; +// frontier +use pallet_ethereum::IntermediateStateRoot; +use pallet_evm::IdentityAddressMapping; +// substrate +use frame_support::{ + dispatch::RawOrigin, + ensure, + pallet_prelude::Weight, + traits::{ConstU32, Everything}, +}; +use sp_core::{H256, U256}; +use sp_runtime::{ + testing::Header, + traits::{BlakeTwo256, DispatchInfoOf, IdentifyAccount, IdentityLookup, Verify}, + transaction_validity::{InvalidTransaction, TransactionValidity, TransactionValidityError}, +}; +use sp_std::prelude::*; +// darwinia +use crate::*; +use bp_message_dispatch::{CallValidate, IntoDispatchOrigin as IntoDispatchOriginT}; + +pub type Block = frame_system::mocking::MockBlock; +pub type Balance = u64; +pub type AccountId = H160; +pub type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; + +frame_support::parameter_types! { + pub const BlockHashCount: u64 = 250; +} +impl frame_system::Config for TestRuntime { + type AccountData = pallet_balances::AccountData; + type AccountId = AccountId; + type BaseCallFilter = Everything; + type BlockHashCount = (); + type BlockLength = (); + type BlockNumber = u64; + type BlockWeights = (); + type DbWeight = (); + type Hash = H256; + type Hashing = BlakeTwo256; + type Header = Header; + type Index = u64; + type Lookup = IdentityLookup; + type MaxConsumers = ConstU32<16>; + type OnKilledAccount = (); + type OnNewAccount = (); + type OnSetCode = (); + type PalletInfo = PalletInfo; + type RuntimeCall = RuntimeCall; + type RuntimeEvent = RuntimeEvent; + type RuntimeOrigin = RuntimeOrigin; + type SS58Prefix = (); + type SystemWeightInfo = (); + type Version = (); +} + +frame_support::parameter_types! { + pub const MaxLocks: u32 = 10; + pub const ExistentialDeposit: u64 = 0; +} +impl pallet_balances::Config for TestRuntime { + type AccountStore = System; + type Balance = Balance; + type DustRemoval = (); + type ExistentialDeposit = ExistentialDeposit; + type MaxLocks = MaxLocks; + type MaxReserves = (); + type ReserveIdentifier = [u8; 8]; + type RuntimeEvent = RuntimeEvent; + type WeightInfo = (); +} + +frame_support::parameter_types! { + pub const MinimumPeriod: u64 = 6000 / 2; +} +impl pallet_timestamp::Config for TestRuntime { + type MinimumPeriod = MinimumPeriod; + type Moment = u64; + type OnTimestampSet = (); + type WeightInfo = (); +} + +frame_support::parameter_types! { + pub const TransactionByteFee: u64 = 1; + pub const ChainId: u64 = 42; + pub const BlockGasLimit: U256 = U256::MAX; + pub const WeightPerGas: Weight = Weight::from_ref_time(20_000); +} + +pub struct FixedGasPrice; +impl FeeCalculator for FixedGasPrice { + fn min_gas_price() -> (U256, Weight) { + (U256::from(5), Weight::zero()) + } +} + +impl pallet_evm::Config for TestRuntime { + type AddressMapping = IdentityAddressMapping; + type BlockGasLimit = BlockGasLimit; + type BlockHashMapping = pallet_evm::SubstrateBlockHashMapping; + type CallOrigin = pallet_evm::EnsureAddressRoot; + type ChainId = ChainId; + type Currency = Balances; + type FeeCalculator = FixedGasPrice; + type FindAuthor = (); + type GasWeightMapping = pallet_evm::FixedGasWeightMapping; + type OnChargeTransaction = (); + type PrecompilesType = (); + type PrecompilesValue = (); + type Runner = pallet_evm::runner::stack::Runner; + type RuntimeEvent = RuntimeEvent; + type WeightPerGas = WeightPerGas; + type WithdrawOrigin = pallet_evm::EnsureAddressNever; +} + +impl pallet_ethereum::Config for TestRuntime { + type RuntimeEvent = RuntimeEvent; + type StateRoot = IntermediateStateRoot; +} + +pub struct MockAccountIdConverter; +impl sp_runtime::traits::Convert for MockAccountIdConverter { + fn convert(hash: H256) -> AccountId { + hash.into() + } +} + +#[derive(Decode, Encode, Clone)] +pub struct MockEncodedCall(pub Vec); +impl From for Result { + fn from(call: MockEncodedCall) -> Result { + RuntimeCall::decode(&mut &call.0[..]).map_err(drop) + } +} + +pub struct MockCallValidator; +impl CallValidate for MockCallValidator { + fn check_receiving_before_dispatch( + relayer_account: &AccountId, + call: &RuntimeCall, + ) -> Result<(), &'static str> { + match call { + RuntimeCall::MessageTransact(crate::Call::message_transact { transaction: tx }) => { + let total_payment = crate::total_payment::(tx.into()); + let relayer = pallet_evm::Pallet::::account_basic(&relayer_account).0; + + ensure!(relayer.balance >= total_payment, "Insufficient balance"); + Ok(()) + }, + _ => Ok(()), + } + } + + fn call_validate( + relayer_account: &AccountId, + origin: &RuntimeOrigin, + call: &RuntimeCall, + ) -> Result<(), TransactionValidityError> { + match call { + RuntimeCall::MessageTransact(crate::Call::message_transact { transaction: tx }) => + match origin.caller { + OriginCaller::MessageTransact(LcmpEthOrigin::MessageTransact(id)) => { + let total_payment = crate::total_payment::(tx.into()); + pallet_balances::Pallet::::transfer( + RawOrigin::Signed(*relayer_account).into(), + id, + total_payment.as_u64(), + ) + .map_err(|_| { + TransactionValidityError::Invalid(InvalidTransaction::Payment) + })?; + + Ok(()) + }, + _ => Err(TransactionValidityError::Invalid(InvalidTransaction::BadSigner)), + }, + _ => Ok(()), + } + } +} +pub struct MockIntoDispatchOrigin; +impl IntoDispatchOriginT for MockIntoDispatchOrigin { + fn into_dispatch_origin(id: &AccountId, call: &RuntimeCall) -> RuntimeOrigin { + match call { + RuntimeCall::MessageTransact(crate::Call::message_transact { .. }) => + crate::LcmpEthOrigin::MessageTransact(*id).into(), + _ => frame_system::RawOrigin::Signed(*id).into(), + } + } +} +#[derive(Debug, Encode, Decode, Clone, PartialEq, Eq, TypeInfo)] +pub struct MockAccountPublic(AccountId); +impl IdentifyAccount for MockAccountPublic { + type AccountId = AccountId; + + fn into_account(self) -> AccountId { + self.0 + } +} +#[derive(Debug, Encode, Decode, Clone, PartialEq, Eq, TypeInfo)] +pub struct MockSignature(AccountId); +impl Verify for MockSignature { + type Signer = MockAccountPublic; + + fn verify>(&self, _msg: L, signer: &AccountId) -> bool { + self.0 == *signer + } +} + +pub(crate) type MockBridgeMessageId = [u8; 4]; + +impl pallet_bridge_dispatch::Config for TestRuntime { + type AccountIdConverter = MockAccountIdConverter; + type BridgeMessageId = MockBridgeMessageId; + type CallValidator = MockCallValidator; + type EncodedCall = MockEncodedCall; + type IntoDispatchOrigin = MockIntoDispatchOrigin; + type RuntimeCall = RuntimeCall; + type RuntimeEvent = RuntimeEvent; + type SourceChainAccountId = AccountId; + type TargetChainAccountPublic = MockAccountPublic; + type TargetChainSignature = MockSignature; +} + +impl crate::Config for TestRuntime { + type LcmpEthOrigin = crate::EnsureLcmpEthOrigin; + type ValidatedTransaction = pallet_ethereum::ValidatedTransaction; +} + +frame_support::construct_runtime! { + pub enum TestRuntime where + Block = Block, + NodeBlock = Block, + UncheckedExtrinsic = UncheckedExtrinsic, + { + System: frame_system::{Pallet, Call, Config, Storage, Event}, + Timestamp: pallet_timestamp::{Pallet, Call, Storage}, + Balances: pallet_balances::{Pallet, Call, Storage, Config, Event}, + EVM: pallet_evm::{Pallet, Call, Storage, Config, Event}, + Ethereum: pallet_ethereum::{Pallet, Call, Storage, Event, Origin}, + MessageTransact: crate::{Pallet, Call, Origin}, + Dispatch: pallet_bridge_dispatch::{Pallet, Call, Event}, + } +} + +impl fp_self_contained::SelfContainedCall for RuntimeCall { + type SignedInfo = H160; + + fn is_self_contained(&self) -> bool { + match self { + RuntimeCall::Ethereum(call) => call.is_self_contained(), + _ => false, + } + } + + fn check_self_contained(&self) -> Option> { + match self { + RuntimeCall::Ethereum(call) => call.check_self_contained(), + _ => None, + } + } + + fn validate_self_contained( + &self, + info: &Self::SignedInfo, + dispatch_info: &DispatchInfoOf, + len: usize, + ) -> Option { + match self { + RuntimeCall::Ethereum(call) => call.validate_self_contained(info, dispatch_info, len), + _ => None, + } + } + + fn pre_dispatch_self_contained( + &self, + info: &Self::SignedInfo, + dispatch_info: &DispatchInfoOf, + len: usize, + ) -> Option> { + match self { + RuntimeCall::Ethereum(call) => + call.pre_dispatch_self_contained(info, dispatch_info, len), + _ => None, + } + } + + fn apply_self_contained( + self, + info: Self::SignedInfo, + ) -> Option>> { + use sp_runtime::traits::Dispatchable as _; + match self { + call @ RuntimeCall::Ethereum(pallet_ethereum::Call::transact { .. }) => + Some(call.dispatch(RuntimeOrigin::from( + pallet_ethereum::RawOrigin::EthereumTransaction(info), + ))), + _ => None, + } + } +} + +pub(crate) struct AccountInfo { + pub address: H160, + pub private_key: H256, +} + +pub(crate) fn address_build(seed: u8) -> AccountInfo { + let raw_private_key = [seed + 1; 32]; + let secret_key = libsecp256k1::SecretKey::parse_slice(&raw_private_key).unwrap(); + let raw_public_key = &libsecp256k1::PublicKey::from_secret_key(&secret_key).serialize()[1..65]; + let raw_address = { + let mut s = [0; 20]; + s.copy_from_slice(&Keccak256::digest(raw_public_key)[12..]); + s + }; + + AccountInfo { private_key: raw_private_key.into(), address: raw_address.into() } +} + +#[derive(Default)] +pub(crate) struct ExtBuilder { + // endowed accounts with balances + balances: Vec<(AccountId, Balance)>, +} + +impl ExtBuilder { + pub(crate) fn with_balances(mut self, balances: Vec<(AccountId, Balance)>) -> Self { + self.balances = balances; + self + } + + pub(crate) fn build(self) -> sp_io::TestExternalities { + let mut t = frame_system::GenesisConfig::default() + .build_storage::() + .expect("Frame system builds valid default genesis config"); + + pallet_balances::GenesisConfig:: { balances: self.balances } + .assimilate_storage(&mut t) + .expect("Pallet balances storage can be assimilated"); + + let mut ext = sp_io::TestExternalities::new(t); + ext.execute_with(|| System::set_block_number(1)); + ext + } +} diff --git a/pallets/message-transact/src/tests/eip1559.rs b/pallets/message-transact/src/tests/eip1559.rs new file mode 100644 index 000000000..f13e65a02 --- /dev/null +++ b/pallets/message-transact/src/tests/eip1559.rs @@ -0,0 +1,249 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// crates +use array_bytes::hex2bytes; +// darwinia +use crate::{mock::*, tests::*}; +// frontier +use fp_evm::FeeCalculator; +// substrate +use frame_support::pallet_prelude::Weight; +use sp_core::U256; +use sp_runtime::transaction_validity::{InvalidTransaction, TransactionValidityError}; + +pub fn eip1559_erc20_creation_unsigned_transaction() -> EIP1559UnsignedTransaction { + EIP1559UnsignedTransaction { + nonce: U256::zero(), + max_priority_fee_per_gas: U256::from(1), + max_fee_per_gas: U256::from(1), + gas_limit: U256::from(1_000_000), + action: ethereum::TransactionAction::Create, + value: U256::zero(), + input: hex2bytes(ERC20_CONTRACT_BYTECODE).unwrap(), + } +} + +#[test] +fn test_dispatch_eip1559_transaction_works() { + let alice = address_build(1); + let relayer_account = address_build(2); + + ExtBuilder::default() + .with_balances(vec![ + (alice.address, 1_000_000_000_000), + (relayer_account.address, 1_000_000_000_000), + ]) + .build() + .execute_with(|| { + let mock_message_id = [0; 4]; + let unsigned_tx = eip1559_erc20_creation_unsigned_transaction(); + let t = unsigned_tx.sign(&alice.private_key, None); + let call = + RuntimeCall::MessageTransact(crate::Call::message_transact { transaction: t }); + let message = prepare_message(call); + + let result = Dispatch::dispatch( + SOURCE_CHAIN_ID, + TARGET_CHAIN_ID, + &relayer_account.address, + mock_message_id, + Ok(message), + |_, _| Ok(()), + ); + + assert!(result.dispatch_result); + System::assert_has_event(RuntimeEvent::Dispatch( + pallet_bridge_dispatch::Event::MessageDispatched( + SOURCE_CHAIN_ID, + mock_message_id, + Ok(()), + ), + )); + }); +} + +#[test] +fn test_dispatch_eip1559_transaction_weight_mismatch() { + let alice = address_build(1); + let relayer_account = address_build(2); + + ExtBuilder::default() + .with_balances(vec![ + (alice.address, 1_000_000_000_000), + (relayer_account.address, 1_000_000_000_000), + ]) + .build() + .execute_with(|| { + let mock_message_id = [0; 4]; + let mut unsigned_tx = eip1559_erc20_creation_unsigned_transaction(); + // 62500001 * 16000 > 1_000_000_000_000 + unsigned_tx.gas_limit = U256::from(62500001); + let t = unsigned_tx.sign(&alice.private_key, None); + let call = + RuntimeCall::MessageTransact(crate::Call::message_transact { transaction: t }); + let message = prepare_message(call); + + let result = Dispatch::dispatch( + SOURCE_CHAIN_ID, + TARGET_CHAIN_ID, + &relayer_account.address, + mock_message_id, + Ok(message), + |_, _| Ok(()), + ); + + assert!(!result.dispatch_result); + System::assert_has_event(RuntimeEvent::Dispatch( + pallet_bridge_dispatch::Event::MessageWeightMismatch( + SOURCE_CHAIN_ID, + mock_message_id, + Weight::from_ref_time(1249913722000), + Weight::from_ref_time(1000000000000), + ), + )); + }); +} + +#[test] +fn test_dispatch_eip1559_transaction_with_autoset_nonce() { + let alice = address_build(1); + let relayer = address_build(2); + + ExtBuilder::default() + .with_balances(vec![ + (alice.address, 1_000_000_000_000), + (relayer.address, 1_000_000_000_000), + ]) + .build() + .execute_with(|| { + let mock_message_id = [0; 4]; + let mut unsigned_tx = eip1559_erc20_creation_unsigned_transaction(); + unsigned_tx.nonce = U256::MAX; + let t = unsigned_tx.sign(&alice.private_key, None); + let call = + RuntimeCall::MessageTransact(crate::Call::message_transact { transaction: t }); + let message = prepare_message(call); + + let result = Dispatch::dispatch( + SOURCE_CHAIN_ID, + TARGET_CHAIN_ID, + &relayer.address, + mock_message_id, + Ok(message), + |_, _| Ok(()), + ); + + assert!(result.dispatch_result); + }); +} + +#[test] +fn test_dispatch_eip1559_transaction_with_autoset_gas_price() { + let alice = address_build(1); + let relayer = address_build(2); + + ExtBuilder::default() + .with_balances(vec![ + (alice.address, 1_000_000_000_000), + (relayer.address, 1_000_000_000_000), + ]) + .build() + .execute_with(|| { + let mock_message_id = [0; 4]; + let mut unsigned_tx = eip1559_erc20_creation_unsigned_transaction(); + unsigned_tx.max_fee_per_gas = + ::FeeCalculator::min_gas_price().0 - 1; + let t = unsigned_tx.sign(&alice.private_key, None); + let call = + RuntimeCall::MessageTransact(crate::Call::message_transact { transaction: t }); + let message = prepare_message(call); + + let result = Dispatch::dispatch( + SOURCE_CHAIN_ID, + TARGET_CHAIN_ID, + &relayer.address, + mock_message_id, + Ok(message), + |_, _| Ok(()), + ); + + assert!(result.dispatch_result); + }); +} + +#[test] +fn test_dispatch_eip1559_transaction_with_insufficient_relayer_balance() { + let alice = address_build(1); + let relayer1 = address_build(2); + let relayer2 = address_build(3); + + ExtBuilder::default() + .with_balances(vec![ + (alice.address, 1_000_000_000_000), + (relayer1.address, 1_000), + (relayer2.address, 1_000_000_000_000), + ]) + .build() + .execute_with(|| { + let mock_message_id = [0; 4]; + let unsigned_tx = eip1559_erc20_creation_unsigned_transaction(); + let t = unsigned_tx.sign(&alice.private_key, None); + let call = + RuntimeCall::MessageTransact(crate::Call::message_transact { transaction: t }); + let message = prepare_message(call); + + // Failed in pre-dispatch balance check + let before_dispatch = + pallet_evm::Pallet::::account_basic(&relayer1.address).0.balance; + let result = Dispatch::dispatch( + SOURCE_CHAIN_ID, + TARGET_CHAIN_ID, + &relayer1.address, + mock_message_id, + Ok(message.clone()), + |_, _| Ok(()), + ); + assert!(!result.dispatch_result); + System::assert_has_event(RuntimeEvent::Dispatch( + pallet_bridge_dispatch::Event::MessageCallValidateFailed( + SOURCE_CHAIN_ID, + mock_message_id, + TransactionValidityError::Invalid(InvalidTransaction::Payment), + ), + )); + let after_dispatch = + pallet_evm::Pallet::::account_basic(&relayer1.address).0.balance; + assert_eq!(before_dispatch, after_dispatch); + + let before_dispatch = + pallet_evm::Pallet::::account_basic(&relayer2.address).0.balance; + let result = Dispatch::dispatch( + SOURCE_CHAIN_ID, + TARGET_CHAIN_ID, + &relayer2.address, + mock_message_id, + Ok(message), + |_, _| Ok(()), + ); + assert!(result.dispatch_result); + let after_dispatch = + pallet_evm::Pallet::::account_basic(&relayer2.address).0.balance; + assert!(before_dispatch > after_dispatch); + }); +} diff --git a/pallets/message-transact/src/tests/eip2930.rs b/pallets/message-transact/src/tests/eip2930.rs new file mode 100644 index 000000000..6cc99aafa --- /dev/null +++ b/pallets/message-transact/src/tests/eip2930.rs @@ -0,0 +1,248 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// crates.io +use array_bytes::hex2bytes; +// darwinia +use crate::{mock::*, tests::*}; +// frontier +use fp_evm::FeeCalculator; +// substrate +use frame_support::pallet_prelude::Weight; +use sp_core::U256; +use sp_runtime::transaction_validity::{InvalidTransaction, TransactionValidityError}; + +fn eip2930_erc20_creation_unsigned_transaction() -> EIP2930UnsignedTransaction { + EIP2930UnsignedTransaction { + nonce: U256::zero(), + gas_price: U256::from(1), + gas_limit: U256::from(1_000_000), + action: ethereum::TransactionAction::Create, + value: U256::zero(), + input: hex2bytes(ERC20_CONTRACT_BYTECODE).unwrap(), + } +} + +#[test] +fn test_dispatch_eip2930_transaction_works() { + let alice = address_build(1); + let relayer_account = address_build(2); + + ExtBuilder::default() + .with_balances(vec![ + (alice.address, 1_000_000_000_000), + (relayer_account.address, 1_000_000_000_000), + ]) + .build() + .execute_with(|| { + let mock_message_id = [0; 4]; + let unsigned_tx = eip2930_erc20_creation_unsigned_transaction(); + let t = unsigned_tx.sign(&alice.private_key, None); + let call = + RuntimeCall::MessageTransact(crate::Call::message_transact { transaction: t }); + let message = prepare_message(call); + + let result = Dispatch::dispatch( + SOURCE_CHAIN_ID, + TARGET_CHAIN_ID, + &relayer_account.address, + mock_message_id, + Ok(message), + |_, _| Ok(()), + ); + + assert!(result.dispatch_result); + System::assert_has_event(RuntimeEvent::Dispatch( + pallet_bridge_dispatch::Event::MessageDispatched( + SOURCE_CHAIN_ID, + mock_message_id, + Ok(()), + ), + )); + }); +} + +#[test] +fn test_dispatch_eip2930_transaction_weight_mismatch() { + let alice = address_build(1); + let relayer_account = address_build(2); + + ExtBuilder::default() + .with_balances(vec![ + (alice.address, 1_000_000_000_000), + (relayer_account.address, 1_000_000_000_000), + ]) + .build() + .execute_with(|| { + let mock_message_id = [0; 4]; + let mut unsigned_tx = eip2930_erc20_creation_unsigned_transaction(); + // 62500001 * 16000 > 1_000_000_000_000 + unsigned_tx.gas_limit = U256::from(62500001); + let t = unsigned_tx.sign(&alice.private_key, None); + let call = + RuntimeCall::MessageTransact(crate::Call::message_transact { transaction: t }); + let message = prepare_message(call); + + let result = Dispatch::dispatch( + SOURCE_CHAIN_ID, + TARGET_CHAIN_ID, + &relayer_account.address, + mock_message_id, + Ok(message), + |_, _| Ok(()), + ); + + assert!(!result.dispatch_result); + System::assert_has_event(RuntimeEvent::Dispatch( + pallet_bridge_dispatch::Event::MessageWeightMismatch( + SOURCE_CHAIN_ID, + mock_message_id, + Weight::from_ref_time(1249913722000), + Weight::from_ref_time(1000000000000), + ), + )); + }); +} + +#[test] +fn test_dispatch_eip2930_transaction_with_autoset_nonce() { + let alice = address_build(1); + let relayer = address_build(2); + + ExtBuilder::default() + .with_balances(vec![ + (alice.address, 1_000_000_000_000), + (relayer.address, 1_000_000_000_000), + ]) + .build() + .execute_with(|| { + let mock_message_id = [0; 4]; + let mut unsigned_tx = eip2930_erc20_creation_unsigned_transaction(); + unsigned_tx.nonce = U256::MAX; + let t = unsigned_tx.sign(&alice.private_key, None); + let call = + RuntimeCall::MessageTransact(crate::Call::message_transact { transaction: t }); + let message = prepare_message(call); + + let result = Dispatch::dispatch( + SOURCE_CHAIN_ID, + TARGET_CHAIN_ID, + &relayer.address, + mock_message_id, + Ok(message), + |_, _| Ok(()), + ); + + assert!(result.dispatch_result); + }); +} + +#[test] +fn test_dispatch_eip2930_transaction_with_autoset_gas_price() { + let alice = address_build(1); + let relayer = address_build(2); + + ExtBuilder::default() + .with_balances(vec![ + (alice.address, 1_000_000_000_000), + (relayer.address, 1_000_000_000_000), + ]) + .build() + .execute_with(|| { + let mock_message_id = [0; 4]; + let mut unsigned_tx = eip2930_erc20_creation_unsigned_transaction(); + unsigned_tx.gas_price = + ::FeeCalculator::min_gas_price().0 - 1; + let t = unsigned_tx.sign(&alice.private_key, None); + let call = + RuntimeCall::MessageTransact(crate::Call::message_transact { transaction: t }); + let message = prepare_message(call); + + let result = Dispatch::dispatch( + SOURCE_CHAIN_ID, + TARGET_CHAIN_ID, + &relayer.address, + mock_message_id, + Ok(message), + |_, _| Ok(()), + ); + + assert!(result.dispatch_result); + }); +} + +#[test] +fn test_dispatch_eip2930_transaction_with_insufficient_relayer_balance() { + let alice = address_build(1); + let relayer1 = address_build(2); + let relayer2 = address_build(3); + + ExtBuilder::default() + .with_balances(vec![ + (alice.address, 1_000_000_000_000), + (relayer1.address, 1_000), + (relayer2.address, 1_000_000_000_000), + ]) + .build() + .execute_with(|| { + let mock_message_id = [0; 4]; + let unsigned_tx = eip2930_erc20_creation_unsigned_transaction(); + let t = unsigned_tx.sign(&alice.private_key, None); + let call = + RuntimeCall::MessageTransact(crate::Call::message_transact { transaction: t }); + let message = prepare_message(call); + + // Failed in pre-dispatch balance check + let before_dispatch = + pallet_evm::Pallet::::account_basic(&relayer1.address).0.balance; + let result = Dispatch::dispatch( + SOURCE_CHAIN_ID, + TARGET_CHAIN_ID, + &relayer1.address, + mock_message_id, + Ok(message.clone()), + |_, _| Ok(()), + ); + assert!(!result.dispatch_result); + System::assert_has_event(RuntimeEvent::Dispatch( + pallet_bridge_dispatch::Event::MessageCallValidateFailed( + SOURCE_CHAIN_ID, + mock_message_id, + TransactionValidityError::Invalid(InvalidTransaction::Payment), + ), + )); + let after_dispatch = + pallet_evm::Pallet::::account_basic(&relayer1.address).0.balance; + assert_eq!(before_dispatch, after_dispatch); + + let before_dispatch = + pallet_evm::Pallet::::account_basic(&relayer2.address).0.balance; + let result = Dispatch::dispatch( + SOURCE_CHAIN_ID, + TARGET_CHAIN_ID, + &relayer2.address, + mock_message_id, + Ok(message), + |_, _| Ok(()), + ); + assert!(result.dispatch_result); + let after_dispatch = + pallet_evm::Pallet::::account_basic(&relayer2.address).0.balance; + assert!(before_dispatch > after_dispatch); + }); +} diff --git a/pallets/message-transact/src/tests/legacy.rs b/pallets/message-transact/src/tests/legacy.rs new file mode 100644 index 000000000..2dd375e43 --- /dev/null +++ b/pallets/message-transact/src/tests/legacy.rs @@ -0,0 +1,245 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// crates.io +use array_bytes::hex2bytes; +// darwinia +use crate::{mock::*, tests::*}; +// frontier +use fp_evm::FeeCalculator; +// substrate +use frame_support::pallet_prelude::Weight; +use sp_core::U256; +use sp_runtime::transaction_validity::{InvalidTransaction, TransactionValidityError}; + +pub fn legacy_erc20_creation_unsigned_transaction() -> LegacyUnsignedTransaction { + LegacyUnsignedTransaction { + nonce: U256::zero(), + gas_price: U256::from(1), + gas_limit: U256::from(1_000_000), + action: ethereum::TransactionAction::Create, + value: U256::zero(), + input: hex2bytes(ERC20_CONTRACT_BYTECODE).unwrap(), + } +} + +#[test] +fn test_dispatch_legacy_transaction_works() { + let alice = address_build(1); + let relayer = address_build(2); + + ExtBuilder::default() + .with_balances(vec![ + (alice.address, 1_000_000_000_000), + (relayer.address, 1_000_000_000_000), + ]) + .build() + .execute_with(|| { + let mock_message_id = [0; 4]; + let t = legacy_erc20_creation_unsigned_transaction().sign(&alice.private_key); + let call = + RuntimeCall::MessageTransact(crate::Call::message_transact { transaction: t }); + let message = prepare_message(call); + + let result = Dispatch::dispatch( + SOURCE_CHAIN_ID, + TARGET_CHAIN_ID, + &relayer.address, + mock_message_id, + Ok(message), + |_, _| Ok(()), + ); + assert!(result.dispatch_result); + System::assert_has_event(RuntimeEvent::Dispatch( + pallet_bridge_dispatch::Event::MessageDispatched( + SOURCE_CHAIN_ID, + mock_message_id, + Ok(()), + ), + )); + }); +} + +#[test] +fn test_dispatch_legacy_transaction_weight_mismatch() { + let alice = address_build(1); + let relayer = address_build(2); + + ExtBuilder::default() + .with_balances(vec![ + (alice.address, 1_000_000_000_000), + (relayer.address, 1_000_000_000_000), + ]) + .build() + .execute_with(|| { + let mock_message_id = [0; 4]; + let mut unsigned_tx = legacy_erc20_creation_unsigned_transaction(); + unsigned_tx.gas_limit = U256::from(62500001); + let t = unsigned_tx.sign(&alice.private_key); + let call = + RuntimeCall::MessageTransact(crate::Call::message_transact { transaction: t }); + let message = prepare_message(call); + + let result = Dispatch::dispatch( + SOURCE_CHAIN_ID, + TARGET_CHAIN_ID, + &relayer.address, + mock_message_id, + Ok(message), + |_, _| Ok(()), + ); + + assert!(!result.dispatch_result); + System::assert_has_event(RuntimeEvent::Dispatch( + pallet_bridge_dispatch::Event::MessageWeightMismatch( + SOURCE_CHAIN_ID, + mock_message_id, + Weight::from_ref_time(1249913722000), + Weight::from_ref_time(1000000000000), + ), + )); + }); +} + +#[test] +fn test_dispatch_legacy_transaction_with_autoset_nonce() { + let alice = address_build(1); + let relayer = address_build(2); + + ExtBuilder::default() + .with_balances(vec![ + (alice.address, 1_000_000_000_000), + (relayer.address, 1_000_000_000_000), + ]) + .build() + .execute_with(|| { + let mock_message_id = [0; 4]; + let mut unsigned_tx = legacy_erc20_creation_unsigned_transaction(); + unsigned_tx.nonce = U256::MAX; + let t = unsigned_tx.sign(&alice.private_key); + let call = + RuntimeCall::MessageTransact(crate::Call::message_transact { transaction: t }); + let message = prepare_message(call); + + let result = Dispatch::dispatch( + SOURCE_CHAIN_ID, + TARGET_CHAIN_ID, + &relayer.address, + mock_message_id, + Ok(message), + |_, _| Ok(()), + ); + + assert!(result.dispatch_result); + }); +} + +#[test] +fn test_dispatch_legacy_transaction_with_autoset_gas_price() { + let alice = address_build(1); + let relayer = address_build(2); + + ExtBuilder::default() + .with_balances(vec![ + (alice.address, 1_000_000_000_000), + (relayer.address, 1_000_000_000_000), + ]) + .build() + .execute_with(|| { + let mock_message_id = [0; 4]; + let mut unsigned_tx = legacy_erc20_creation_unsigned_transaction(); + unsigned_tx.gas_price = + ::FeeCalculator::min_gas_price().0 - 1; + let t = unsigned_tx.sign(&alice.private_key); + let call = + RuntimeCall::MessageTransact(crate::Call::message_transact { transaction: t }); + let message = prepare_message(call); + + let result = Dispatch::dispatch( + SOURCE_CHAIN_ID, + TARGET_CHAIN_ID, + &relayer.address, + mock_message_id, + Ok(message), + |_, _| Ok(()), + ); + + assert!(result.dispatch_result); + }); +} + +#[test] +fn test_dispatch_legacy_transaction_with_insufficient_relayer_balance() { + let alice = address_build(1); + let relayer1 = address_build(2); + let relayer2 = address_build(3); + + ExtBuilder::default() + .with_balances(vec![ + (alice.address, 1_000_000_000_000), + (relayer1.address, 1_000), + (relayer2.address, 1_000_000_000_000), + ]) + .build() + .execute_with(|| { + let mock_message_id = [0; 4]; + let unsigned_tx = legacy_erc20_creation_unsigned_transaction(); + let t = unsigned_tx.sign(&alice.private_key); + let call = + RuntimeCall::MessageTransact(crate::Call::message_transact { transaction: t }); + let message = prepare_message(call); + + // Failed in pre-dispatch balance check + let before_dispatch = + pallet_evm::Pallet::::account_basic(&relayer1.address).0.balance; + let result = Dispatch::dispatch( + SOURCE_CHAIN_ID, + TARGET_CHAIN_ID, + &relayer1.address, + mock_message_id, + Ok(message.clone()), + |_, _| Ok(()), + ); + assert!(!result.dispatch_result); + System::assert_has_event(RuntimeEvent::Dispatch( + pallet_bridge_dispatch::Event::MessageCallValidateFailed( + SOURCE_CHAIN_ID, + mock_message_id, + TransactionValidityError::Invalid(InvalidTransaction::Payment), + ), + )); + let after_dispatch = + pallet_evm::Pallet::::account_basic(&relayer1.address).0.balance; + assert_eq!(before_dispatch, after_dispatch); + + let before_dispatch = + pallet_evm::Pallet::::account_basic(&relayer2.address).0.balance; + let result = Dispatch::dispatch( + SOURCE_CHAIN_ID, + TARGET_CHAIN_ID, + &relayer2.address, + mock_message_id, + Ok(message), + |_, _| Ok(()), + ); + assert!(result.dispatch_result); + let after_dispatch = + pallet_evm::Pallet::::account_basic(&relayer2.address).0.balance; + assert!(before_dispatch > after_dispatch); + }); +} diff --git a/pallets/message-transact/src/tests/mod.rs b/pallets/message-transact/src/tests/mod.rs new file mode 100644 index 000000000..96480153c --- /dev/null +++ b/pallets/message-transact/src/tests/mod.rs @@ -0,0 +1,257 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +mod eip1559; +mod eip2930; +mod legacy; + +// crates.io +use codec::Encode; +use ethereum::{TransactionAction, TransactionSignature}; +use rlp::RlpStream; +use sha3::{Digest, Keccak256}; +// frontier +use fp_ethereum::Transaction; +// darwinia +use crate::mock::*; +use bp_message_dispatch::{CallOrigin, MessageDispatch, MessagePayload, SpecVersion}; +use bp_runtime::messages::DispatchFeePayment; +// substrate +use frame_support::pallet_prelude::Weight; +use sp_core::{H256, U256}; + +pub(crate) const TEST_SPEC_VERSION: SpecVersion = 0; +pub(crate) type SubChainId = [u8; 4]; +pub(crate) const SOURCE_CHAIN_ID: SubChainId = *b"srce"; +pub(crate) const TARGET_CHAIN_ID: SubChainId = *b"trgt"; +pub(crate) const TEST_WEIGHT: Weight = Weight::from_ref_time(1_000_000_000_000); + +// This ERC-20 contract mints the maximum amount of tokens to the contract creator. +// pragma solidity ^0.5.0; +// import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.5.1/contracts/token/ERC20/ERC20.sol"; +// contract MyToken is ERC20 { +// constructor() public { _mint(msg.sender, 2**256 - 1); } +// } +pub const ERC20_CONTRACT_BYTECODE: &str = "608060405234801561001057600080fd5b50610041337fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff61004660201b60201c565b610291565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156100e9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f45524332303a206d696e7420746f20746865207a65726f20616464726573730081525060200191505060405180910390fd5b6101028160025461020960201b610c7c1790919060201c565b60028190555061015d816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461020960201b610c7c1790919060201c565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b600080828401905083811015610287576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b610e3a806102a06000396000f3fe608060405234801561001057600080fd5b50600436106100885760003560e01c806370a082311161005b57806370a08231146101fd578063a457c2d714610255578063a9059cbb146102bb578063dd62ed3e1461032157610088565b8063095ea7b31461008d57806318160ddd146100f357806323b872dd146101115780633950935114610197575b600080fd5b6100d9600480360360408110156100a357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610399565b604051808215151515815260200191505060405180910390f35b6100fb6103b7565b6040518082815260200191505060405180910390f35b61017d6004803603606081101561012757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506103c1565b604051808215151515815260200191505060405180910390f35b6101e3600480360360408110156101ad57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061049a565b604051808215151515815260200191505060405180910390f35b61023f6004803603602081101561021357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061054d565b6040518082815260200191505060405180910390f35b6102a16004803603604081101561026b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610595565b604051808215151515815260200191505060405180910390f35b610307600480360360408110156102d157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610662565b604051808215151515815260200191505060405180910390f35b6103836004803603604081101561033757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610680565b6040518082815260200191505060405180910390f35b60006103ad6103a6610707565b848461070f565b6001905092915050565b6000600254905090565b60006103ce848484610906565b61048f846103da610707565b61048a85604051806060016040528060288152602001610d7060289139600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610440610707565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610bbc9092919063ffffffff16565b61070f565b600190509392505050565b60006105436104a7610707565b8461053e85600160006104b8610707565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610c7c90919063ffffffff16565b61070f565b6001905092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60006106586105a2610707565b8461065385604051806060016040528060258152602001610de160259139600160006105cc610707565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610bbc9092919063ffffffff16565b61070f565b6001905092915050565b600061067661066f610707565b8484610906565b6001905092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610795576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180610dbd6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561081b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180610d286022913960400191505060405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561098c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180610d986025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a12576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180610d056023913960400191505060405180910390fd5b610a7d81604051806060016040528060268152602001610d4a602691396000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610bbc9092919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610b10816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610c7c90919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290610c69576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610c2e578082015181840152602081019050610c13565b50505050905090810190601f168015610c5b5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015610cfa576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b809150509291505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa265627a7a72315820c7a5ffabf642bda14700b2de42f8c57b36621af020441df825de45fd2b3e1c5c64736f6c63430005100032"; + +fn prepare_message( + call: RuntimeCall, +) -> as MessageDispatch< + AccountId, + ::BridgeMessageId, +>>::Message { + MessagePayload { + spec_version: TEST_SPEC_VERSION, + weight: TEST_WEIGHT, + origin: CallOrigin::SourceAccount(AccountId::from_low_u64_be(1)), + dispatch_fee_payment: DispatchFeePayment::AtSourceChain, + call: MockEncodedCall(call.encode()), + } +} + +pub struct LegacyUnsignedTransaction { + pub nonce: U256, + pub gas_price: U256, + pub gas_limit: U256, + pub action: TransactionAction, + pub value: U256, + pub input: Vec, +} +impl LegacyUnsignedTransaction { + fn signing_rlp_append(&self, s: &mut RlpStream) { + s.begin_list(9); + s.append(&self.nonce); + s.append(&self.gas_price); + s.append(&self.gas_limit); + s.append(&self.action); + s.append(&self.value); + s.append(&self.input); + s.append(&ChainId::get()); + s.append(&0u8); + s.append(&0u8); + } + + fn signing_hash(&self) -> H256 { + let mut stream = RlpStream::new(); + self.signing_rlp_append(&mut stream); + H256::from_slice(&Keccak256::digest(&stream.out()).as_slice()) + } + + pub fn sign(&self, key: &H256) -> Transaction { + self.sign_with_chain_id(key, ChainId::get()) + } + + pub fn sign_with_chain_id(&self, key: &H256, chain_id: u64) -> Transaction { + let hash = self.signing_hash(); + let msg = libsecp256k1::Message::parse(hash.as_fixed_bytes()); + let s = libsecp256k1::sign(&msg, &libsecp256k1::SecretKey::parse_slice(&key[..]).unwrap()); + let sig = s.0.serialize(); + + let sig = TransactionSignature::new( + s.1.serialize() as u64 % 2 + chain_id * 2 + 35, + H256::from_slice(&sig[0..32]), + H256::from_slice(&sig[32..64]), + ) + .unwrap(); + + Transaction::Legacy(ethereum::LegacyTransaction { + nonce: self.nonce, + gas_price: self.gas_price, + gas_limit: self.gas_limit, + action: self.action, + value: self.value, + input: self.input.clone(), + signature: sig, + }) + } +} + +pub struct EIP2930UnsignedTransaction { + pub nonce: U256, + pub gas_price: U256, + pub gas_limit: U256, + pub action: TransactionAction, + pub value: U256, + pub input: Vec, +} + +impl EIP2930UnsignedTransaction { + pub fn sign(&self, secret: &H256, chain_id: Option) -> Transaction { + let secret = { + let mut sk: [u8; 32] = [0u8; 32]; + sk.copy_from_slice(&secret[0..]); + libsecp256k1::SecretKey::parse(&sk).unwrap() + }; + let chain_id = chain_id.unwrap_or(ChainId::get()); + let msg = ethereum::EIP2930TransactionMessage { + chain_id, + nonce: self.nonce, + gas_price: self.gas_price, + gas_limit: self.gas_limit, + action: self.action, + value: self.value, + input: self.input.clone(), + access_list: vec![], + }; + let signing_message = libsecp256k1::Message::parse_slice(&msg.hash()[..]).unwrap(); + + let (signature, recid) = libsecp256k1::sign(&signing_message, &secret); + let rs = signature.serialize(); + let r = H256::from_slice(&rs[0..32]); + let s = H256::from_slice(&rs[32..64]); + Transaction::EIP2930(ethereum::EIP2930Transaction { + chain_id: msg.chain_id, + nonce: msg.nonce, + gas_price: msg.gas_price, + gas_limit: msg.gas_limit, + action: msg.action, + value: msg.value, + input: msg.input.clone(), + access_list: msg.access_list, + odd_y_parity: recid.serialize() != 0, + r, + + s, + }) + } +} + +pub struct EIP1559UnsignedTransaction { + pub nonce: U256, + pub max_priority_fee_per_gas: U256, + pub max_fee_per_gas: U256, + pub gas_limit: U256, + pub action: TransactionAction, + pub value: U256, + pub input: Vec, +} + +impl EIP1559UnsignedTransaction { + pub fn sign(&self, secret: &H256, chain_id: Option) -> Transaction { + let secret = { + let mut sk: [u8; 32] = [0u8; 32]; + sk.copy_from_slice(&secret[0..]); + libsecp256k1::SecretKey::parse(&sk).unwrap() + }; + let chain_id = chain_id.unwrap_or(ChainId::get()); + let msg = ethereum::EIP1559TransactionMessage { + chain_id, + nonce: self.nonce, + max_priority_fee_per_gas: self.max_priority_fee_per_gas, + max_fee_per_gas: self.max_fee_per_gas, + gas_limit: self.gas_limit, + action: self.action, + value: self.value, + input: self.input.clone(), + access_list: vec![], + }; + let signing_message = libsecp256k1::Message::parse_slice(&msg.hash()[..]).unwrap(); + + let (signature, recid) = libsecp256k1::sign(&signing_message, &secret); + let rs = signature.serialize(); + let r = H256::from_slice(&rs[0..32]); + let s = H256::from_slice(&rs[32..64]); + Transaction::EIP1559(ethereum::EIP1559Transaction { + chain_id: msg.chain_id, + nonce: msg.nonce, + max_priority_fee_per_gas: msg.max_priority_fee_per_gas, + max_fee_per_gas: msg.max_fee_per_gas, + gas_limit: msg.gas_limit, + action: msg.action, + value: msg.value, + input: msg.input.clone(), + access_list: msg.access_list, + odd_y_parity: recid.serialize() != 0, + r, + s, + }) + } +} + +#[test] +fn test_dispatch_basic_system_call_works() { + let relayer_account = address_build(1); + + ExtBuilder::default() + .with_balances(vec![(relayer_account.address, 1000)]) + .build() + .execute_with(|| { + let mock_message_id = [0; 4]; + let call = RuntimeCall::System(frame_system::Call::remark { remark: vec![] }); + let message = prepare_message(call); + System::set_block_number(1); + let result = Dispatch::dispatch( + SOURCE_CHAIN_ID, + TARGET_CHAIN_ID, + &relayer_account.address, + mock_message_id, + Ok(message), + |_, _| Ok(()), + ); + assert!(!result.dispatch_fee_paid_during_dispatch); + assert!(result.dispatch_result); + + System::assert_has_event(RuntimeEvent::Dispatch( + pallet_bridge_dispatch::Event::MessageDispatched( + SOURCE_CHAIN_ID, + mock_message_id, + Ok(()), + ), + )); + }); +} diff --git a/precompiles/state-storage/src/mock.rs b/precompiles/state-storage/src/mock.rs index cc8f2ad0f..5d24429ee 100644 --- a/precompiles/state-storage/src/mock.rs +++ b/precompiles/state-storage/src/mock.rs @@ -23,7 +23,7 @@ use codec::{Decode, Encode, MaxEncodedLen}; // frontier use fp_evm::{Precompile, PrecompileSet}; use pallet_evm::IdentityAddressMapping; -// parity +// substrate use frame_support::{ pallet_prelude::Weight, traits::{ConstU32, Everything}, diff --git a/runtime/crab/Cargo.toml b/runtime/crab/Cargo.toml index 307e2945c..68f73e061 100644 --- a/runtime/crab/Cargo.toml +++ b/runtime/crab/Cargo.toml @@ -37,6 +37,7 @@ cumulus-pallet-session-benchmarking = { optional = true, default-features = fals # darwinia darwinia-common-runtime = { default-features = false, path = "../common" } +darwinia-message-transact = { default-features = false, path = "../../pallets/message-transact" } darwinia-precompile-assets = { default-features = false, path = "../../precompiles/assets" } darwinia-precompile-bls12-381 = { default-features = false, path = "../../precompiles/bls12-381" } darwinia-precompile-state-storage = { default-features = false, path = "../../precompiles/state-storage" } @@ -144,6 +145,7 @@ std = [ # darwinia "darwinia-common-runtime/std", + "darwinia-message-transact/std", "darwinia-precompile-assets/std", "darwinia-precompile-bls12-381/std", "darwinia-precompile-state-storage/std", diff --git a/runtime/crab/src/lib.rs b/runtime/crab/src/lib.rs index 93d3c69fa..d9ff10911 100644 --- a/runtime/crab/src/lib.rs +++ b/runtime/crab/src/lib.rs @@ -313,6 +313,7 @@ frame_support::construct_runtime! { Ethereum: pallet_ethereum = 31, Evm: pallet_evm = 32, BaseFee: pallet_base_fee = 33, + MessageTransact: darwinia_message_transact = 39, // S2S stuff BridgeDarwiniaGrandpa: pallet_bridge_grandpa:: = 35, diff --git a/runtime/crab/src/pallets/bridge_dispatch.rs b/runtime/crab/src/pallets/bridge_dispatch.rs index d5a919a78..963e98b74 100644 --- a/runtime/crab/src/pallets/bridge_dispatch.rs +++ b/runtime/crab/src/pallets/bridge_dispatch.rs @@ -20,21 +20,79 @@ pub use pallet_bridge_dispatch::Instance1 as WithDarwiniaDispatch; // darwinia use crate::*; -use bp_message_dispatch::{Everything, IntoDispatchOrigin as IntoDispatchOriginT}; +use bp_message_dispatch::{CallValidate, IntoDispatchOrigin as IntoDispatchOriginT}; use bp_messages::{LaneId, MessageNonce}; +use darwinia_message_transact::{total_payment, Call as MessageTransactCall, LcmpEthOrigin}; use pallet_bridge_dispatch::Config; +// substrate +use frame_support::ensure; +use frame_system::RawOrigin; +use sp_runtime::transaction_validity::{InvalidTransaction, TransactionValidityError}; + +pub struct CallValidator; +impl CallValidate for CallValidator { + fn check_receiving_before_dispatch( + relayer_account: &AccountId, + call: &RuntimeCall, + ) -> Result<(), &'static str> { + match call { + RuntimeCall::MessageTransact(MessageTransactCall::message_transact { + transaction: tx, + }) => { + let total_payment = total_payment::(tx.into()); + let relayer = + pallet_evm::Pallet::::account_basic(&H160(relayer_account.0)).0; + + ensure!(relayer.balance >= total_payment, "Insufficient balance"); + Ok(()) + }, + _ => Ok(()), + } + } + + fn call_validate( + relayer_account: &AccountId, + origin: &RuntimeOrigin, + call: &RuntimeCall, + ) -> Result<(), TransactionValidityError> { + match call { + RuntimeCall::MessageTransact(MessageTransactCall::message_transact { + transaction: tx, + }) => match origin.caller { + OriginCaller::MessageTransact(LcmpEthOrigin::MessageTransact(id)) => { + let total_payment = total_payment::(tx.into()); + pallet_balances::Pallet::::transfer( + RawOrigin::Signed(*relayer_account).into(), + id.into(), + total_payment.as_u128(), + ) + .map_err(|_| TransactionValidityError::Invalid(InvalidTransaction::Payment))?; + + Ok(()) + }, + _ => Err(TransactionValidityError::Invalid(InvalidTransaction::BadSigner)), + }, + _ => Ok(()), + } + } +} pub struct IntoDispatchOrigin; -impl IntoDispatchOriginT for IntoDispatchOrigin { - fn into_dispatch_origin(id: &bp_crab::AccountId, _: &RuntimeCall) -> RuntimeOrigin { - frame_system::RawOrigin::Signed(id.clone()).into() +impl IntoDispatchOriginT for IntoDispatchOrigin { + fn into_dispatch_origin(id: &AccountId, call: &RuntimeCall) -> RuntimeOrigin { + match call { + RuntimeCall::MessageTransact(darwinia_message_transact::Call::message_transact { + .. + }) => darwinia_message_transact::LcmpEthOrigin::MessageTransact(H160(id.0)).into(), + _ => frame_system::RawOrigin::Signed(id.clone()).into(), + } } } impl Config for Runtime { type AccountIdConverter = bp_crab::AccountIdConverter; type BridgeMessageId = (LaneId, MessageNonce); - type CallValidator = Everything; + type CallValidator = CallValidator; type EncodedCall = bm_darwinia::FromDarwiniaEncodedCall; type IntoDispatchOrigin = IntoDispatchOrigin; type RuntimeCall = RuntimeCall; diff --git a/runtime/crab/src/pallets/message_transact.rs b/runtime/crab/src/pallets/message_transact.rs new file mode 100644 index 000000000..3ab8d65fa --- /dev/null +++ b/runtime/crab/src/pallets/message_transact.rs @@ -0,0 +1,25 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +impl darwinia_message_transact::Config for Runtime { + type LcmpEthOrigin = darwinia_message_transact::EnsureLcmpEthOrigin; + type ValidatedTransaction = pallet_ethereum::ValidatedTransaction; +} diff --git a/runtime/crab/src/pallets/mod.rs b/runtime/crab/src/pallets/mod.rs index 6db8976d6..1df2a00f4 100644 --- a/runtime/crab/src/pallets/mod.rs +++ b/runtime/crab/src/pallets/mod.rs @@ -101,6 +101,8 @@ pub use evm::*; mod base_fee; +mod message_transact; + // S2S stuff mod bridge_dispatch; pub use bridge_dispatch::*; diff --git a/runtime/darwinia/Cargo.toml b/runtime/darwinia/Cargo.toml index 658f294a6..7d2958e03 100644 --- a/runtime/darwinia/Cargo.toml +++ b/runtime/darwinia/Cargo.toml @@ -37,6 +37,7 @@ cumulus-pallet-session-benchmarking = { optional = true, default-features = fals # darwinia darwinia-common-runtime = { default-features = false, path = "../common" } +darwinia-message-transact = { default-features = false, path = "../../pallets/message-transact" } darwinia-precompile-assets = { default-features = false, path = "../../precompiles/assets" } darwinia-precompile-bls12-381 = { default-features = false, path = "../../precompiles/bls12-381" } darwinia-precompile-state-storage = { default-features = false, path = "../../precompiles/state-storage" } @@ -144,6 +145,7 @@ std = [ # darwinia "darwinia-common-runtime/std", + "darwinia-message-transact/std", "darwinia-precompile-assets/std", "darwinia-precompile-bls12-381/std", "darwinia-precompile-state-storage/std", diff --git a/runtime/darwinia/src/lib.rs b/runtime/darwinia/src/lib.rs index a6ef11a7d..15ecc0e06 100644 --- a/runtime/darwinia/src/lib.rs +++ b/runtime/darwinia/src/lib.rs @@ -313,6 +313,7 @@ frame_support::construct_runtime! { Ethereum: pallet_ethereum = 31, Evm: pallet_evm = 32, BaseFee: pallet_base_fee = 33, + MessageTransact: darwinia_message_transact = 39, // S2S stuff BridgeCrabGrandpa: pallet_bridge_grandpa:: = 35, diff --git a/runtime/darwinia/src/pallets/bridge_dispatch.rs b/runtime/darwinia/src/pallets/bridge_dispatch.rs index 696eb8679..361c23f64 100644 --- a/runtime/darwinia/src/pallets/bridge_dispatch.rs +++ b/runtime/darwinia/src/pallets/bridge_dispatch.rs @@ -20,23 +20,79 @@ pub use pallet_bridge_dispatch::Instance1 as WithCrabDispatch; // darwinia use crate::*; -use bp_message_dispatch::{Everything, IntoDispatchOrigin as IntoDispatchOriginT}; +use bp_message_dispatch::{CallValidate, IntoDispatchOrigin as IntoDispatchOriginT}; use bp_messages::{LaneId, MessageNonce}; +use darwinia_message_transact::{total_payment, Call as MessageTransactCall, LcmpEthOrigin}; use pallet_bridge_dispatch::Config; +// substrate +use frame_support::ensure; +use frame_system::RawOrigin; +use sp_runtime::transaction_validity::{InvalidTransaction, TransactionValidityError}; + +pub struct CallValidator; +impl CallValidate for CallValidator { + fn check_receiving_before_dispatch( + relayer_account: &AccountId, + call: &RuntimeCall, + ) -> Result<(), &'static str> { + match call { + RuntimeCall::MessageTransact(MessageTransactCall::message_transact { + transaction: tx, + }) => { + let total_payment = total_payment::(tx.into()); + let relayer = + pallet_evm::Pallet::::account_basic(&H160(relayer_account.0)).0; + + ensure!(relayer.balance >= total_payment, "Insufficient balance"); + Ok(()) + }, + _ => Ok(()), + } + } + + fn call_validate( + relayer_account: &AccountId, + origin: &RuntimeOrigin, + call: &RuntimeCall, + ) -> Result<(), TransactionValidityError> { + match call { + RuntimeCall::MessageTransact(MessageTransactCall::message_transact { + transaction: tx, + }) => match origin.caller { + OriginCaller::MessageTransact(LcmpEthOrigin::MessageTransact(id)) => { + let total_payment = total_payment::(tx.into()); + pallet_balances::Pallet::::transfer( + RawOrigin::Signed(*relayer_account).into(), + id.into(), + total_payment.as_u128(), + ) + .map_err(|_| TransactionValidityError::Invalid(InvalidTransaction::Payment))?; + + Ok(()) + }, + _ => Err(TransactionValidityError::Invalid(InvalidTransaction::BadSigner)), + }, + _ => Ok(()), + } + } +} pub struct IntoDispatchOrigin; -impl IntoDispatchOriginT - for IntoDispatchOrigin -{ - fn into_dispatch_origin(id: &bp_darwinia::AccountId, _: &RuntimeCall) -> RuntimeOrigin { - frame_system::RawOrigin::Signed(id.clone()).into() +impl IntoDispatchOriginT for IntoDispatchOrigin { + fn into_dispatch_origin(id: &AccountId, call: &RuntimeCall) -> RuntimeOrigin { + match call { + RuntimeCall::MessageTransact(darwinia_message_transact::Call::message_transact { + .. + }) => darwinia_message_transact::LcmpEthOrigin::MessageTransact(H160(id.0)).into(), + _ => frame_system::RawOrigin::Signed(id.clone()).into(), + } } } impl Config for Runtime { type AccountIdConverter = bp_darwinia::AccountIdConverter; type BridgeMessageId = (LaneId, MessageNonce); - type CallValidator = Everything; + type CallValidator = CallValidator; type EncodedCall = bm_crab::FromCrabEncodedCall; type IntoDispatchOrigin = IntoDispatchOrigin; type RuntimeCall = RuntimeCall; diff --git a/runtime/darwinia/src/pallets/message_transact.rs b/runtime/darwinia/src/pallets/message_transact.rs new file mode 100644 index 000000000..3ab8d65fa --- /dev/null +++ b/runtime/darwinia/src/pallets/message_transact.rs @@ -0,0 +1,25 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +impl darwinia_message_transact::Config for Runtime { + type LcmpEthOrigin = darwinia_message_transact::EnsureLcmpEthOrigin; + type ValidatedTransaction = pallet_ethereum::ValidatedTransaction; +} diff --git a/runtime/darwinia/src/pallets/mod.rs b/runtime/darwinia/src/pallets/mod.rs index 6db8976d6..1df2a00f4 100644 --- a/runtime/darwinia/src/pallets/mod.rs +++ b/runtime/darwinia/src/pallets/mod.rs @@ -101,6 +101,8 @@ pub use evm::*; mod base_fee; +mod message_transact; + // S2S stuff mod bridge_dispatch; pub use bridge_dispatch::*; diff --git a/runtime/pangolin/Cargo.toml b/runtime/pangolin/Cargo.toml index a2c8db8b4..f4e4c58a8 100644 --- a/runtime/pangolin/Cargo.toml +++ b/runtime/pangolin/Cargo.toml @@ -37,6 +37,7 @@ cumulus-pallet-session-benchmarking = { optional = true, default-features = fals # darwinia darwinia-common-runtime = { default-features = false, path = "../common" } +darwinia-message-transact = { default-features = false, path = "../../pallets/message-transact" } darwinia-precompile-assets = { default-features = false, path = "../../precompiles/assets" } darwinia-precompile-bls12-381 = { default-features = false, path = "../../precompiles/bls12-381" } darwinia-precompile-state-storage = { default-features = false, path = "../../precompiles/state-storage" } @@ -144,6 +145,7 @@ std = [ # darwinia "darwinia-common-runtime/std", + "darwinia-message-transact/std", "darwinia-precompile-assets/std", "darwinia-precompile-bls12-381/std", "darwinia-precompile-state-storage/std", diff --git a/runtime/pangolin/src/lib.rs b/runtime/pangolin/src/lib.rs index 219e0d039..cf5aea755 100644 --- a/runtime/pangolin/src/lib.rs +++ b/runtime/pangolin/src/lib.rs @@ -309,6 +309,7 @@ frame_support::construct_runtime! { Ethereum: pallet_ethereum = 31, Evm: pallet_evm = 32, BaseFee: pallet_base_fee = 33, + MessageTransact: darwinia_message_transact = 35, } } diff --git a/runtime/pangolin/src/pallets/message_transact.rs b/runtime/pangolin/src/pallets/message_transact.rs new file mode 100644 index 000000000..3ab8d65fa --- /dev/null +++ b/runtime/pangolin/src/pallets/message_transact.rs @@ -0,0 +1,25 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +impl darwinia_message_transact::Config for Runtime { + type LcmpEthOrigin = darwinia_message_transact::EnsureLcmpEthOrigin; + type ValidatedTransaction = pallet_ethereum::ValidatedTransaction; +} diff --git a/runtime/pangolin/src/pallets/mod.rs b/runtime/pangolin/src/pallets/mod.rs index dc7dbb37c..ea7d4188f 100644 --- a/runtime/pangolin/src/pallets/mod.rs +++ b/runtime/pangolin/src/pallets/mod.rs @@ -100,3 +100,5 @@ mod evm; pub use evm::*; mod base_fee; + +mod message_transact; From 15ae8064787113532f644fa14351c24239ffb343 Mon Sep 17 00:00:00 2001 From: bear Date: Fri, 2 Dec 2022 16:35:01 +0800 Subject: [PATCH 022/189] Update chain id (#85) --- Cargo.lock | 6 +++--- runtime/crab/Cargo.toml | 6 +++--- runtime/crab/src/pallets/evm.rs | 12 ++++++++++-- runtime/darwinia/Cargo.toml | 6 +++--- runtime/darwinia/src/pallets/evm.rs | 12 ++++++++++-- runtime/pangolin/Cargo.toml | 6 +++--- runtime/pangolin/src/pallets/evm.rs | 10 +++++++++- 7 files changed, 41 insertions(+), 17 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7ac303fd8..6ab026ba8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1354,7 +1354,6 @@ dependencies = [ "darwinia-precompile-bls12-381", "darwinia-precompile-state-storage", "dc-primitives", - "fp-evm", "fp-rpc", "fp-self-contained", "frame-benchmarking", @@ -1404,6 +1403,7 @@ dependencies = [ "parity-scale-codec", "polkadot-parachain", "polkadot-runtime-common", + "precompile-utils", "scale-info", "smallvec", "sp-api", @@ -2413,7 +2413,6 @@ dependencies = [ "darwinia-precompile-bls12-381", "darwinia-precompile-state-storage", "dc-primitives", - "fp-evm", "fp-rpc", "fp-self-contained", "frame-benchmarking", @@ -2463,6 +2462,7 @@ dependencies = [ "parity-scale-codec", "polkadot-parachain", "polkadot-runtime-common", + "precompile-utils", "scale-info", "smallvec", "sp-api", @@ -7239,7 +7239,6 @@ dependencies = [ "darwinia-precompile-bls12-381", "darwinia-precompile-state-storage", "dc-primitives", - "fp-evm", "fp-rpc", "fp-self-contained", "frame-benchmarking", @@ -7289,6 +7288,7 @@ dependencies = [ "parity-scale-codec", "polkadot-parachain", "polkadot-runtime-common", + "precompile-utils", "scale-info", "smallvec", "sp-api", diff --git a/runtime/crab/Cargo.toml b/runtime/crab/Cargo.toml index 68f73e061..82407bfcd 100644 --- a/runtime/crab/Cargo.toml +++ b/runtime/crab/Cargo.toml @@ -55,7 +55,6 @@ pallet-bridge-messages = { default-features = false, git = "https://github.com/d pallet-fee-market = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } # frontier -fp-evm = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } fp-rpc = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } fp-self-contained = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } pallet-base-fee = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } @@ -68,7 +67,8 @@ pallet-evm-precompile-modexp = { default-features = false, git = "https://gith pallet-evm-precompile-simple = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } # moonbeam -xcm-primitives = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.30" } +precompile-utils = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.30"} +xcm-primitives = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.30" } # polkadot pallet-xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" } @@ -163,7 +163,6 @@ std = [ "pallet-fee-market/std", # frontier - "fp-evm/std", "fp-rpc/std", "fp-self-contained/std", "pallet-base-fee/std", @@ -176,6 +175,7 @@ std = [ "pallet-evm-precompile-simple/std", # moonbeam + "precompile-utils/std", "xcm-primitives/std", # polkadot diff --git a/runtime/crab/src/pallets/evm.rs b/runtime/crab/src/pallets/evm.rs index c2f351188..e6c048dd8 100644 --- a/runtime/crab/src/pallets/evm.rs +++ b/runtime/crab/src/pallets/evm.rs @@ -32,6 +32,8 @@ use pallet_evm_precompile_bn128::{Bn128Add, Bn128Mul, Bn128Pairing}; use pallet_evm_precompile_dispatch::Dispatch; use pallet_evm_precompile_modexp::Modexp; use pallet_evm_precompile_simple::{ECRecover, Identity, Ripemd160, Sha256}; +// moonbeam +use precompile_utils::prelude::*; // substrate use frame_support::{traits::FindAuthor, ConsensusEngineId}; use sp_core::crypto::ByteArray; @@ -124,7 +126,13 @@ where R: pallet_evm::Config, { fn execute(&self, handle: &mut impl PrecompileHandle) -> Option { - match handle.code_address() { + let (code_address, caller) = (handle.code_address(), handle.context().caller); + // Filter known precompile addresses except Ethereum officials + if self.is_precompile(code_address) && code_address > addr(9) && code_address != caller { + return Some(Err(revert("cannot be called with DELEGATECALL or CALLCODE"))); + }; + + match code_address { // Ethereum precompiles: a if a == addr(1) => Some(ECRecover::execute(handle)), a if a == addr(2) => Some(Sha256::execute(handle)), @@ -159,7 +167,7 @@ impl pallet_evm::Config for Runtime { type BlockGasLimit = BlockGasLimit; type BlockHashMapping = EthereumBlockHashMapping; type CallOrigin = EnsureAddressRoot; - type ChainId = ConstU64<43>; + type ChainId = ConstU64<44>; type Currency = Balances; type FeeCalculator = FixedGasPrice; type FindAuthor = FindAuthorTruncated; diff --git a/runtime/darwinia/Cargo.toml b/runtime/darwinia/Cargo.toml index 7d2958e03..01f3a8982 100644 --- a/runtime/darwinia/Cargo.toml +++ b/runtime/darwinia/Cargo.toml @@ -55,7 +55,6 @@ pallet-bridge-messages = { default-features = false, git = "https://github.com/d pallet-fee-market = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } # frontier -fp-evm = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } fp-rpc = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } fp-self-contained = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } pallet-base-fee = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } @@ -68,7 +67,8 @@ pallet-evm-precompile-modexp = { default-features = false, git = "https://gith pallet-evm-precompile-simple = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } # moonbeam -xcm-primitives = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.30" } +precompile-utils = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.30"} +xcm-primitives = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.30" } # polkadot pallet-xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" } @@ -163,7 +163,6 @@ std = [ "pallet-fee-market/std", # frontier - "fp-evm/std", "fp-rpc/std", "fp-self-contained/std", "pallet-base-fee/std", @@ -176,6 +175,7 @@ std = [ "pallet-evm-precompile-simple/std", # moonbeam + "precompile-utils/std", "xcm-primitives/std", # polkadot diff --git a/runtime/darwinia/src/pallets/evm.rs b/runtime/darwinia/src/pallets/evm.rs index a2d8de9be..e8bef3236 100644 --- a/runtime/darwinia/src/pallets/evm.rs +++ b/runtime/darwinia/src/pallets/evm.rs @@ -32,6 +32,8 @@ use pallet_evm_precompile_bn128::{Bn128Add, Bn128Mul, Bn128Pairing}; use pallet_evm_precompile_dispatch::Dispatch; use pallet_evm_precompile_modexp::Modexp; use pallet_evm_precompile_simple::{ECRecover, Identity, Ripemd160, Sha256}; +// moonbeam +use precompile_utils::prelude::*; // substrate use frame_support::{traits::FindAuthor, ConsensusEngineId}; use sp_core::crypto::ByteArray; @@ -124,7 +126,13 @@ where R: pallet_evm::Config, { fn execute(&self, handle: &mut impl PrecompileHandle) -> Option { - match handle.code_address() { + let (code_address, caller) = (handle.code_address(), handle.context().caller); + // Filter known precompile addresses except Ethereum officials + if self.is_precompile(code_address) && code_address > addr(9) && code_address != caller { + return Some(Err(revert("cannot be called with DELEGATECALL or CALLCODE"))); + }; + + match code_address { // Ethereum precompiles: a if a == addr(1) => Some(ECRecover::execute(handle)), a if a == addr(2) => Some(Sha256::execute(handle)), @@ -159,7 +167,7 @@ impl pallet_evm::Config for Runtime { type BlockGasLimit = BlockGasLimit; type BlockHashMapping = EthereumBlockHashMapping; type CallOrigin = EnsureAddressRoot; - type ChainId = ConstU64<43>; + type ChainId = ConstU64<46>; type Currency = Balances; type FeeCalculator = FixedGasPrice; type FindAuthor = FindAuthorTruncated; diff --git a/runtime/pangolin/Cargo.toml b/runtime/pangolin/Cargo.toml index f4e4c58a8..ab98468f7 100644 --- a/runtime/pangolin/Cargo.toml +++ b/runtime/pangolin/Cargo.toml @@ -55,7 +55,6 @@ pallet-bridge-messages = { default-features = false, git = "https://github.com/d pallet-fee-market = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } # frontier -fp-evm = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } fp-rpc = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } fp-self-contained = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } pallet-base-fee = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } @@ -68,7 +67,8 @@ pallet-evm-precompile-modexp = { default-features = false, git = "https://gith pallet-evm-precompile-simple = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } # moonbeam -xcm-primitives = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.30" } +precompile-utils = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.30"} +xcm-primitives = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.30" } # polkadot pallet-xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" } @@ -163,7 +163,6 @@ std = [ "pallet-fee-market/std", # frontier - "fp-evm/std", "fp-rpc/std", "fp-self-contained/std", "pallet-base-fee/std", @@ -176,6 +175,7 @@ std = [ "pallet-evm-precompile-simple/std", # moonbeam + "precompile-utils/std", "xcm-primitives/std", # polkadot diff --git a/runtime/pangolin/src/pallets/evm.rs b/runtime/pangolin/src/pallets/evm.rs index 3d732e102..215e63681 100644 --- a/runtime/pangolin/src/pallets/evm.rs +++ b/runtime/pangolin/src/pallets/evm.rs @@ -32,6 +32,8 @@ use pallet_evm_precompile_bn128::{Bn128Add, Bn128Mul, Bn128Pairing}; use pallet_evm_precompile_dispatch::Dispatch; use pallet_evm_precompile_modexp::Modexp; use pallet_evm_precompile_simple::{ECRecover, Identity, Ripemd160, Sha256}; +// moonbeam +use precompile_utils::prelude::*; // substrate use frame_support::{traits::FindAuthor, ConsensusEngineId}; use sp_core::crypto::ByteArray; @@ -124,7 +126,13 @@ where R: pallet_evm::Config, { fn execute(&self, handle: &mut impl PrecompileHandle) -> Option { - match handle.code_address() { + let (code_address, caller) = (handle.code_address(), handle.context().caller); + // Filter known precompile addresses except Ethereum officials + if self.is_precompile(code_address) && code_address > addr(9) && code_address != caller { + return Some(Err(revert("cannot be called with DELEGATECALL or CALLCODE"))); + }; + + match code_address { // Ethereum precompiles: a if a == addr(1) => Some(ECRecover::execute(handle)), a if a == addr(2) => Some(Sha256::execute(handle)), From 124031d2c3e1d59d1e6979eb7aa68b40813ca871 Mon Sep 17 00:00:00 2001 From: Guantong <04637@163.com> Date: Mon, 5 Dec 2022 18:46:20 +0800 Subject: [PATCH 023/189] Update parachain IDs (#89) * Change paraId 1000 > 2105 * Darwinia paraId 2046 --- node/src/chain_spec/crab.rs | 8 ++++---- node/src/chain_spec/darwinia.rs | 8 ++++---- node/src/chain_spec/pangolin.rs | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/node/src/chain_spec/crab.rs b/node/src/chain_spec/crab.rs index 534e7d155..fd18fed0f 100644 --- a/node/src/chain_spec/crab.rs +++ b/node/src/chain_spec/crab.rs @@ -78,7 +78,7 @@ pub fn development_config() -> ChainSpec { array_bytes::hex_n_into_unchecked(ETHAN), array_bytes::hex_n_into_unchecked(FAITH), ], - 1000.into(), + 2105.into(), ) }, Vec::new(), @@ -88,7 +88,7 @@ pub fn development_config() -> ChainSpec { Some(properties), Extensions { relay_chain: "rococo-local".into(), // You MUST set this to the correct network! - para_id: 1000, + para_id: 2105, }, ) } @@ -129,7 +129,7 @@ pub fn local_testnet_config() -> ChainSpec { array_bytes::hex_n_into_unchecked(ETHAN), array_bytes::hex_n_into_unchecked(FAITH), ], - 1000.into(), + 2105.into(), ) }, // Bootnodes @@ -145,7 +145,7 @@ pub fn local_testnet_config() -> ChainSpec { // Extensions Extensions { relay_chain: "rococo-local".into(), // You MUST set this to the correct network! - para_id: 1000, + para_id: 2105, }, ) } diff --git a/node/src/chain_spec/darwinia.rs b/node/src/chain_spec/darwinia.rs index b8c78bb91..eeff35a07 100644 --- a/node/src/chain_spec/darwinia.rs +++ b/node/src/chain_spec/darwinia.rs @@ -78,7 +78,7 @@ pub fn development_config() -> ChainSpec { array_bytes::hex_n_into_unchecked(ETHAN), array_bytes::hex_n_into_unchecked(FAITH), ], - 1000.into(), + 2046.into(), ) }, Vec::new(), @@ -88,7 +88,7 @@ pub fn development_config() -> ChainSpec { Some(properties), Extensions { relay_chain: "rococo-local".into(), // You MUST set this to the correct network! - para_id: 1000, + para_id: 2046, }, ) } @@ -129,7 +129,7 @@ pub fn local_testnet_config() -> ChainSpec { array_bytes::hex_n_into_unchecked(ETHAN), array_bytes::hex_n_into_unchecked(FAITH), ], - 1000.into(), + 2046.into(), ) }, // Bootnodes @@ -145,7 +145,7 @@ pub fn local_testnet_config() -> ChainSpec { // Extensions Extensions { relay_chain: "rococo-local".into(), // You MUST set this to the correct network! - para_id: 1000, + para_id: 2046, }, ) } diff --git a/node/src/chain_spec/pangolin.rs b/node/src/chain_spec/pangolin.rs index 2729d821a..5d6a389a3 100644 --- a/node/src/chain_spec/pangolin.rs +++ b/node/src/chain_spec/pangolin.rs @@ -78,7 +78,7 @@ pub fn development_config() -> ChainSpec { array_bytes::hex_n_into_unchecked(ETHAN), array_bytes::hex_n_into_unchecked(FAITH), ], - 1000.into(), + 2105.into(), ) }, Vec::new(), @@ -88,7 +88,7 @@ pub fn development_config() -> ChainSpec { Some(properties), Extensions { relay_chain: "rococo-local".into(), // You MUST set this to the correct network! - para_id: 1000, + para_id: 2105, }, ) } @@ -129,7 +129,7 @@ pub fn local_testnet_config() -> ChainSpec { array_bytes::hex_n_into_unchecked(ETHAN), array_bytes::hex_n_into_unchecked(FAITH), ], - 1000.into(), + 2105.into(), ) }, // Bootnodes @@ -145,7 +145,7 @@ pub fn local_testnet_config() -> ChainSpec { // Extensions Extensions { relay_chain: "rococo-local".into(), // You MUST set this to the correct network! - para_id: 1000, + para_id: 2105, }, ) } From dc9c57f1c9f7b048daed88b0ecf5a8d9e88756f4 Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Tue, 6 Dec 2022 10:39:26 +0800 Subject: [PATCH 024/189] Correct block time (#93) --- core/primitives/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/primitives/src/lib.rs b/core/primitives/src/lib.rs index c927ec585..15e271618 100644 --- a/core/primitives/src/lib.rs +++ b/core/primitives/src/lib.rs @@ -67,7 +67,7 @@ pub type Block = sp_runtime::generic::Block /// up by `pallet_aura` to implement `fn slot_duration()`. /// /// Change this to adjust the block time. -pub const MILLISECS_PER_BLOCK: u64 = 6_000; +pub const MILLISECS_PER_BLOCK: u64 = 12_000; // NOTE: Currently it is not possible to change the slot duration after the chain has started. // Attempting to do so will brick block production. From b8a195cdbcd50f7805816d268ae73c85f56fb264 Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Tue, 6 Dec 2022 13:47:35 +0800 Subject: [PATCH 025/189] Add parachain staking (#68) --- .github/workflows/checks.yml | 8 +- Cargo.lock | 182 +++- Cargo.toml | 4 +- core/inflation/Cargo.toml | 33 + core/inflation/src/lib.rs | 90 ++ core/inflation/src/test.rs | 70 ++ core/primitives/Cargo.toml | 4 + core/primitives/src/lib.rs | 24 +- core/types/Cargo.toml | 10 + core/types/src/lib.rs | 47 + node/Cargo.toml | 4 +- node/src/chain_spec/crab.rs | 4 +- node/src/chain_spec/darwinia.rs | 153 ++- node/src/chain_spec/mod.rs | 35 +- node/src/chain_spec/pangolin.rs | 4 +- node/src/command.rs | 2 +- pallet/deposit/Cargo.toml | 55 ++ pallet/deposit/src/lib.rs | 295 ++++++ pallet/deposit/src/weights.rs | 4 + pallet/deposit/tests/mock.rs | 140 +++ pallet/deposit/tests/tests.rs | 274 ++++++ .../message-transact/Cargo.toml | 0 .../message-transact/src/lib.rs | 2 +- .../message-transact/src/mock.rs | 0 .../message-transact/src/tests/eip1559.rs | 0 .../message-transact/src/tests/eip2930.rs | 0 .../message-transact/src/tests/legacy.rs | 0 .../message-transact/src/tests/mod.rs | 0 pallet/staking/Cargo.toml | 65 ++ pallet/staking/src/lib.rs | 918 ++++++++++++++++++ pallet/staking/src/weights.rs | 4 + pallet/staking/tests/mock.rs | 311 ++++++ pallet/staking/tests/tests.rs | 488 ++++++++++ {precompiles => precompile}/assets/Cargo.toml | 0 {precompiles => precompile}/assets/src/lib.rs | 6 +- .../assets/src/mock.rs | 0 .../assets/src/tests.rs | 0 .../bls12-381/Cargo.toml | 6 +- .../bls12-381/src/lib.rs | 0 .../state-storage/Cargo.toml | 6 +- .../state-storage/src/lib.rs | 0 .../state-storage/src/mock.rs | 0 .../state-storage/src/tests.rs | 0 runtime/common/src/gov_origin.rs | 6 +- runtime/common/src/lib.rs | 4 +- .../src/{xcm_barrier.rs => xcm_configs.rs} | 7 +- runtime/crab/Cargo.toml | 8 +- runtime/crab/src/lib.rs | 2 +- runtime/crab/src/pallets/assets.rs | 4 +- runtime/crab/src/pallets/bridge_dispatch.rs | 2 +- runtime/crab/src/pallets/bridge_messages.rs | 2 +- runtime/crab/src/pallets/mod.rs | 5 +- runtime/crab/src/pallets/polkadot_xcm.rs | 4 +- runtime/darwinia/Cargo.toml | 19 +- runtime/darwinia/src/lib.rs | 7 +- runtime/darwinia/src/pallets/assets.rs | 4 +- runtime/darwinia/src/pallets/authorship.rs | 2 +- .../darwinia/src/pallets/bridge_dispatch.rs | 2 +- .../darwinia/src/pallets/bridge_messages.rs | 2 +- .../src/pallets/collator_selection.rs | 47 - runtime/darwinia/src/pallets/deposit.rs | 38 + runtime/darwinia/src/pallets/mod.rs | 9 +- runtime/darwinia/src/pallets/polkadot_xcm.rs | 4 +- runtime/darwinia/src/pallets/session.rs | 14 +- runtime/darwinia/src/pallets/staking.rs | 75 ++ runtime/darwinia/src/weights/mod.rs | 1 - .../src/weights/pallet_collator_selection.rs | 111 --- runtime/pangolin/Cargo.toml | 8 +- runtime/pangolin/src/lib.rs | 2 +- runtime/pangolin/src/pallets/assets.rs | 4 +- runtime/pangolin/src/pallets/mod.rs | 1 - runtime/pangolin/src/pallets/polkadot_xcm.rs | 4 +- 72 files changed, 3262 insertions(+), 384 deletions(-) create mode 100644 core/inflation/Cargo.toml create mode 100644 core/inflation/src/lib.rs create mode 100644 core/inflation/src/test.rs create mode 100644 core/types/Cargo.toml create mode 100644 core/types/src/lib.rs create mode 100644 pallet/deposit/Cargo.toml create mode 100644 pallet/deposit/src/lib.rs create mode 100644 pallet/deposit/src/weights.rs create mode 100644 pallet/deposit/tests/mock.rs create mode 100644 pallet/deposit/tests/tests.rs rename {pallets => pallet}/message-transact/Cargo.toml (100%) rename {pallets => pallet}/message-transact/src/lib.rs (99%) rename {pallets => pallet}/message-transact/src/mock.rs (100%) rename {pallets => pallet}/message-transact/src/tests/eip1559.rs (100%) rename {pallets => pallet}/message-transact/src/tests/eip2930.rs (100%) rename {pallets => pallet}/message-transact/src/tests/legacy.rs (100%) rename {pallets => pallet}/message-transact/src/tests/mod.rs (100%) create mode 100644 pallet/staking/Cargo.toml create mode 100644 pallet/staking/src/lib.rs create mode 100644 pallet/staking/src/weights.rs create mode 100644 pallet/staking/tests/mock.rs create mode 100644 pallet/staking/tests/tests.rs rename {precompiles => precompile}/assets/Cargo.toml (100%) rename {precompiles => precompile}/assets/src/lib.rs (98%) rename {precompiles => precompile}/assets/src/mock.rs (100%) rename {precompiles => precompile}/assets/src/tests.rs (100%) rename {precompiles => precompile}/bls12-381/Cargo.toml (98%) rename {precompiles => precompile}/bls12-381/src/lib.rs (100%) rename {precompiles => precompile}/state-storage/Cargo.toml (98%) rename {precompiles => precompile}/state-storage/src/lib.rs (100%) rename {precompiles => precompile}/state-storage/src/mock.rs (100%) rename {precompiles => precompile}/state-storage/src/tests.rs (100%) rename runtime/common/src/{xcm_barrier.rs => xcm_configs.rs} (94%) delete mode 100644 runtime/darwinia/src/pallets/collator_selection.rs create mode 100644 runtime/darwinia/src/pallets/deposit.rs create mode 100644 runtime/darwinia/src/pallets/staking.rs delete mode 100644 runtime/darwinia/src/weights/pallet_collator_selection.rs diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 0890187b8..1b889092a 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -138,7 +138,7 @@ jobs: - id: check-crab-runtime-version name: Check Crab runtime version run: | - OUTPUT=$(subalfred check runtime --executable darwinia --chain crab-local --live https://rpc.polkadot.io --property version) + OUTPUT=$(subalfred check runtime --executable darwinia --chain crab-dev --live https://rpc.polkadot.io --property version) OUTPUT="${OUTPUT//'%'/'%25'}​" OUTPUT="${OUTPUT//$'\n'/'%0A'}" OUTPUT="${OUTPUT//$'\r'/'%0D'}" @@ -146,7 +146,7 @@ jobs: - id: check-crab-runtime-storage name: Check Crab runtime storage run: | - OUTPUT=$(subalfred check runtime --executable darwinia --chain crab-local --live https://rpc.polkadot.io --property storage) + OUTPUT=$(subalfred check runtime --executable darwinia --chain crab-dev --live https://rpc.polkadot.io --property storage) OUTPUT="${OUTPUT//'%'/'%25'}​" OUTPUT="${OUTPUT//$'\n'/'%0A'}" OUTPUT="${OUTPUT//$'\r'/'%0D'}" @@ -154,7 +154,7 @@ jobs: - id: check-darwinia-runtime-version name: Check Darwinia runtime version run: | - OUTPUT=$(subalfred check runtime --executable darwinia --chain darwinia-local --live https://rpc.polkadot.io --property version) + OUTPUT=$(subalfred check runtime --executable darwinia --chain darwinia-dev --live https://rpc.polkadot.io --property version) OUTPUT="${OUTPUT//'%'/'%25'}​" OUTPUT="${OUTPUT//$'\n'/'%0A'}" OUTPUT="${OUTPUT//$'\r'/'%0D'}" @@ -162,7 +162,7 @@ jobs: - id: check-darwinia-runtime-storage name: Check Darwinia runtime storage run: | - OUTPUT=$(subalfred check runtime --executable darwinia --chain darwinia-local --live https://rpc.polkadot.io --property storage) + OUTPUT=$(subalfred check runtime --executable darwinia --chain darwinia-dev --live https://rpc.polkadot.io --property storage) OUTPUT="${OUTPUT//'%'/'%25'}​" OUTPUT="${OUTPUT//$'\n'/'%0A'}" OUTPUT="${OUTPUT//$'\r'/'%0D'}" diff --git a/Cargo.lock b/Cargo.lock index 6ab026ba8..97b00e628 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1611,7 +1611,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ "generic-array 0.14.6", - "typenum", + "typenum 1.15.0", ] [[package]] @@ -2298,6 +2298,26 @@ dependencies = [ "xcm-executor", ] +[[package]] +name = "darwinia-deposit" +version = "6.0.0" +dependencies = [ + "darwinia-staking", + "dc-inflation", + "dc-types", + "frame-support", + "frame-system", + "pallet-assets", + "pallet-balances", + "pallet-timestamp", + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", +] + [[package]] name = "darwinia-message-transact" version = "6.0.0" @@ -2408,10 +2428,12 @@ dependencies = [ "cumulus-primitives-timestamp", "cumulus-primitives-utility", "darwinia-common-runtime", + "darwinia-deposit", "darwinia-message-transact", "darwinia-precompile-assets", "darwinia-precompile-bls12-381", "darwinia-precompile-state-storage", + "darwinia-staking", "dc-primitives", "fp-rpc", "fp-self-contained", @@ -2430,7 +2452,6 @@ dependencies = [ "pallet-bridge-dispatch", "pallet-bridge-grandpa", "pallet-bridge-messages", - "pallet-collator-selection", "pallet-collective", "pallet-democracy", "pallet-elections-phragmen", @@ -2485,6 +2506,29 @@ dependencies = [ "xcm-primitives", ] +[[package]] +name = "darwinia-staking" +version = "6.0.0" +dependencies = [ + "darwinia-deposit", + "dc-inflation", + "dc-types", + "frame-support", + "frame-system", + "pallet-assets", + "pallet-authorship", + "pallet-balances", + "pallet-session", + "pallet-timestamp", + "parity-scale-codec", + "pretty_env_logger", + "scale-info", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", +] + [[package]] name = "data-encoding" version = "2.3.2" @@ -2511,15 +2555,30 @@ dependencies = [ "syn", ] +[[package]] +name = "dc-inflation" +version = "6.0.0" +dependencies = [ + "dc-types", + "primitive-types 0.12.1", + "sp-arithmetic", + "substrate-fixed", +] + [[package]] name = "dc-primitives" version = "6.0.0" dependencies = [ "account", + "dc-types", "sp-core", "sp-runtime", ] +[[package]] +name = "dc-types" +version = "6.0.0" + [[package]] name = "der" version = "0.5.1" @@ -2794,6 +2853,19 @@ dependencies = [ "syn", ] +[[package]] +name = "env_logger" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36" +dependencies = [ + "atty", + "humantime 1.3.0", + "log", + "regex", + "termcolor", +] + [[package]] name = "env_logger" version = "0.9.3" @@ -2801,7 +2873,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a12e6657c4c97ebab115a42dcee77225f7f482cdd841cf7088c657a42e9e00e7" dependencies = [ "atty", - "humantime", + "humantime 2.1.0", "log", "regex", "termcolor", @@ -2841,7 +2913,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "11da94e443c60508eb62cf256243a64da87304c2802ac2528847f79d750007ef" dependencies = [ "crunchy", - "fixed-hash", + "fixed-hash 0.7.0", "impl-codec", "impl-rlp", "impl-serde", @@ -2875,11 +2947,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b2827b94c556145446fcce834ca86b7abf0c39a805883fe20e72c5bfdb5a0dc6" dependencies = [ "ethbloom", - "fixed-hash", + "fixed-hash 0.7.0", "impl-codec", "impl-rlp", "impl-serde", - "primitive-types", + "primitive-types 0.11.1", "scale-info", "uint", ] @@ -2904,7 +2976,7 @@ dependencies = [ "evm-runtime", "log", "parity-scale-codec", - "primitive-types", + "primitive-types 0.11.1", "rlp", "scale-info", "serde", @@ -2918,7 +2990,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c5fb3a449a544a67c879d2f74e1c3d9022de3ec31c9a20817015816f687aa2af" dependencies = [ "parity-scale-codec", - "primitive-types", + "primitive-types 0.11.1", "scale-info", "serde", ] @@ -2932,7 +3004,7 @@ dependencies = [ "environmental", "evm-core", "evm-runtime", - "primitive-types", + "primitive-types 0.11.1", ] [[package]] @@ -2944,7 +3016,7 @@ dependencies = [ "auto_impl", "environmental", "evm-core", - "primitive-types", + "primitive-types 0.11.1", "sha3 0.10.6", ] @@ -3183,7 +3255,7 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "21e16290574b39ee41c71aeb90ae960c504ebaf1e2a1c87bd52aa56ed6e1a02f" dependencies = [ - "env_logger", + "env_logger 0.9.3", "log", ] @@ -3227,6 +3299,18 @@ dependencies = [ "static_assertions", ] +[[package]] +name = "fixed-hash" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "835c052cb0c08c1acf6ffd71c022172e18723949c8282f2b9f27efbc51e64534" +dependencies = [ + "byteorder", + "rand 0.8.5", + "rustc-hex", + "static_assertions", +] + [[package]] name = "fixedbitset" version = "0.4.2" @@ -3776,7 +3860,7 @@ version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ffdf9f34f1447443d37393cc6c2b8313aebddcd96906caf34e54c68d8e57d7bd" dependencies = [ - "typenum", + "typenum 1.15.0", ] [[package]] @@ -3785,7 +3869,7 @@ version = "0.14.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bff49e947297f3312447abdca79f45f4738097cc82b06e72054d2223f601f1b9" dependencies = [ - "typenum", + "typenum 1.15.0", "version_check", ] @@ -4052,6 +4136,15 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" +[[package]] +name = "humantime" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df004cfca50ef23c36850aaaa59ad52cc70d0e90243c3c7737a4dd32dc7a3c4f" +dependencies = [ + "quick-error", +] + [[package]] name = "humantime" version = "2.1.0" @@ -5237,7 +5330,7 @@ dependencies = [ "rand 0.7.3", "serde", "sha2 0.9.9", - "typenum", + "typenum 1.15.0", ] [[package]] @@ -5256,7 +5349,7 @@ dependencies = [ "rand 0.7.3", "serde", "sha2 0.9.9", - "typenum", + "typenum 1.15.0", ] [[package]] @@ -5275,7 +5368,7 @@ dependencies = [ "rand 0.8.5", "serde", "sha2 0.9.9", - "typenum", + "typenum 1.15.0", ] [[package]] @@ -5713,7 +5806,7 @@ dependencies = [ "rand 0.8.5", "rand_distr", "simba", - "typenum", + "typenum 1.15.0", ] [[package]] @@ -6542,7 +6635,7 @@ dependencies = [ "log", "pallet-timestamp", "parity-scale-codec", - "primitive-types", + "primitive-types 0.11.1", "rlp", "scale-info", "serde", @@ -7389,7 +7482,7 @@ dependencies = [ "lru 0.7.8", "parity-util-mem-derive", "parking_lot 0.12.1", - "primitive-types", + "primitive-types 0.11.1", "smallvec", "winapi", ] @@ -8343,7 +8436,7 @@ name = "polkadot-performance-test" version = "0.9.30" source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" dependencies = [ - "env_logger", + "env_logger 0.9.3", "kusama-runtime", "log", "polkadot-erasure-coding", @@ -8838,6 +8931,16 @@ dependencies = [ "syn", ] +[[package]] +name = "pretty_env_logger" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "926d36b9553851b8b0005f1275891b392ee4d2d833852c417ed025477350fb9d" +dependencies = [ + "env_logger 0.7.1", + "log", +] + [[package]] name = "prettyplease" version = "0.1.21" @@ -8854,7 +8957,7 @@ version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e28720988bff275df1f51b171e1b2a18c30d194c4d2b61defdacecd625a5d94a" dependencies = [ - "fixed-hash", + "fixed-hash 0.7.0", "impl-codec", "impl-rlp", "impl-serde", @@ -8862,6 +8965,17 @@ dependencies = [ "uint", ] +[[package]] +name = "primitive-types" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f3486ccba82358b11a77516035647c34ba167dfa53312630de83b12bd4f3d66" +dependencies = [ + "fixed-hash 0.8.0", + "impl-codec", + "uint", +] + [[package]] name = "prioritized-metered-channel" version = "0.2.0" @@ -9348,7 +9462,7 @@ name = "remote-externalities" version = "0.10.0-dev" source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ - "env_logger", + "env_logger 0.9.3", "jsonrpsee", "log", "parity-scale-codec", @@ -11439,7 +11553,7 @@ dependencies = [ "parity-scale-codec", "parity-util-mem", "parking_lot 0.12.1", - "primitive-types", + "primitive-types 0.11.1", "rand 0.7.3", "regex", "scale-info", @@ -11701,7 +11815,7 @@ dependencies = [ "bytes", "impl-trait-for-tuples", "parity-scale-codec", - "primitive-types", + "primitive-types 0.11.1", "sp-externalities", "sp-runtime-interface-proc-macro", "sp-std", @@ -12119,6 +12233,17 @@ dependencies = [ "platforms", ] +[[package]] +name = "substrate-fixed" +version = "0.5.9" +source = "git+https://github.com/encointer/substrate-fixed#a4fb461aae6205ffc55bed51254a40c52be04e5d" +dependencies = [ + "parity-scale-codec", + "scale-info", + "serde", + "typenum 1.16.0", +] + [[package]] name = "substrate-frame-rpc-system" version = "4.0.0-dev" @@ -12738,6 +12863,15 @@ version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" +[[package]] +name = "typenum" +version = "1.16.0" +source = "git+https://github.com/encointer/typenum?tag=v1.16.0#4c8dddaa8bdd13130149e43b4085ad14e960617f" +dependencies = [ + "parity-scale-codec", + "scale-info", +] + [[package]] name = "ucd-trie" version = "0.1.5" diff --git a/Cargo.toml b/Cargo.toml index e63373346..69296e149 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,7 +5,7 @@ panic = "unwind" members = [ "core/*", "node", - "pallets/*", - "precompiles/*", + "pallet/*", + "precompile/*", "runtime/*", ] diff --git a/core/inflation/Cargo.toml b/core/inflation/Cargo.toml new file mode 100644 index 000000000..d0eccec37 --- /dev/null +++ b/core/inflation/Cargo.toml @@ -0,0 +1,33 @@ +[package] +authors = ["Darwinia Network "] +description = "Darwinia economic inflation mechanism implementation." +edition = "2021" +homepage = "https://darwinia.network" +license = "GPL-3.0" +name = "dc-inflation" +readme = "README.md" +repository = "https://github.com/darwinia-network/darwinia" +version = "6.0.0" + +[dependencies] +# crates.io +primitive-types = { version = "0.12", default-features = false } + +# darwinia +dc-types = { path = "../types" } + +# github +substrate-fixed = { default-features = false, git = "https://github.com/encointer/substrate-fixed" } + +[dev-dependencies] +sp-arithmetic = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } + +[features] +default = ["std"] +std = [ + # crates.io + "primitive-types/std", + + # github + "substrate-fixed/std", +] diff --git a/core/inflation/src/lib.rs b/core/inflation/src/lib.rs new file mode 100644 index 000000000..bc7858955 --- /dev/null +++ b/core/inflation/src/lib.rs @@ -0,0 +1,90 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Darwinia economic inflation mechanism implementation. + +#![cfg_attr(not(feature = "std"), no_std)] +#![deny(missing_docs)] + +#[cfg(test)] +mod test; + +// crates.io +use primitive_types::U256; +// darwinia +use dc_types::{Balance, Moment, UNIT}; +// github +use substrate_fixed::{ + transcendental, + types::{I95F33, U94F34}, +}; + +/// Inflation's upper limit. +pub const TOTAL_SUPPLY: Balance = 10_000_000_000 * UNIT; + +/// Milliseconds per year. +pub const MILLISECS_PER_YEAR: Balance = (366 * 24 * 60 * 60) * 1000; + +/// Compute the inflation of a period. +/// +/// Use `U94F34` here, because `2^94 > TOTAL_SUPPLY * 10^9`. +pub fn in_period(unminted: Balance, period: Moment, elapsed: Moment) -> Option { + let unminted_per_millisecs = U94F34::from_num(unminted) / MILLISECS_PER_YEAR; + let x = (unminted_per_millisecs * period).floor().to_num(); + let years = (elapsed / MILLISECS_PER_YEAR + 1) as _; + + inflate(x, years) +} + +// Compute the inflation. +// +// Formula: +// ``` +// x * (1 - (99 / 100) ^ sqrt(years)); +// ``` +// +// Use `I95F33` here, because `2^94 > TOTAL_SUPPLY * 10^9`. +fn inflate(x: Balance, years: u8) -> Option { + let sqrt = transcendental::sqrt::(years.into()).ok()?; + let ninety_nine = I95F33::from_num(99_u8) / 100_i128; + let pow = transcendental::pow::(ninety_nine, sqrt).ok()?; + let ratio = I95F33::from_num(1_u8) - pow; + let inflation = I95F33::from_num(x) * ratio; + + Some(inflation.floor().to_num()) +} + +/// Compute the reward of a deposit. +/// +/// Reference(s): +/// - +pub fn deposit_interest(amount: Balance, months: u8) -> Balance { + let amount = U256::from(amount); + let months = U256::from(months); + let n = U256::from(67_u8).pow(months); + let d = U256::from(66_u8).pow(months); + let quot = n / d; + let rem = n % d; + let precision = U256::from(1_000_u16); + + // The result of `((quot - 1) * precision + rem * precision / d)` is `197` when months is `12`. + // + // The default interest is `1_000`. + // So, we directly use `1_970_000` here instead `interest * 197 * 10^7`. + (amount * (precision * (quot - 1_u8) + precision * rem / d) / 1_970_000_u32).as_u128() +} diff --git a/core/inflation/src/test.rs b/core/inflation/src/test.rs new file mode 100644 index 000000000..30ae1e7f9 --- /dev/null +++ b/core/inflation/src/test.rs @@ -0,0 +1,70 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +#[test] +fn inflate_should_work() { + let max = 10_000_000_000_u128 * UNIT; + let init = 2_000_000_000_u128 * UNIT; + let rates = [ + 4_f64, 5.37, 6.15, 6.56, 6.74, 6.76, 6.66, 6.5, 6.28, 6.04, 5.79, 5.52, 5.26, 4.99, 4.74, + 4.49, 4.25, 4.03, 3.81, 3.6, 3.4, 3.21, 3.04, 2.87, 2.71, 2.55, 2.41, 2.27, 2.14, 2.02, + 1.91, 1.8, 1.69, 1.59, 1.5, 1.41, 1.33, 1.25, 1.17, 1.1, 1.04, 0.97, 0.91, 0.86, 0.8, 0.75, + 0.71, 0.66, 0.62, 0.58, 0.54, 0.51, 0.47, 0.44, 0.41, 0.38, 0.36, 0.33, 0.31, 0.29, 0.27, + 0.25, 0.23, 0.21, 0.2, 0.18, 0.17, 0.16, 0.15, 0.14, 0.13, 0.12, 0.11, 0.1, 0.09, 0.08, + 0.08, 0.07, 0.07, 0.06, 0.06, 0.05, 0.05, 0.04, 0.04, 0.04, 0.03, 0.03, 0.03, 0.03, 0.02, + 0.02, 0.02, 0.02, 0.02, 0.01, 0.01, 0.01, 0.01, 0.01, + ]; + let mut unminted = max - init; + + for (&rate, years) in rates.iter().zip(1..) { + let inflation = + in_period(unminted, MILLISECS_PER_YEAR, (years - 1) as u128 * MILLISECS_PER_YEAR) + .unwrap(); + + sp_arithmetic::assert_eq_error_rate!( + inflation as f64 / (max - unminted) as f64, + rate / 100_f64, + 0.0001_f64 + ); + + unminted -= inflation; + } +} + +#[test] +fn deposit_interest_should_work() { + let precision = 10_000_f64; + + for (&expect_interest, months) in [ + 0.0761_f64, 0.1522, 0.2335, 0.3096, 0.3959, 0.4771, 0.5634, 0.6446, 0.7309, 0.8223, 0.9086, + 1.0000, 1.0913, 1.1878, 1.2842, 1.3807, 1.4771, 1.5736, 1.6751, 1.7766, 1.8832, 1.9898, + 2.0964, 2.2030, 2.3147, 2.4263, 2.5380, 2.6548, 2.7715, 2.8934, 3.0101, 3.1370, 3.2588, + 3.3857, 3.5126, 3.6446, + ] + .iter() + .zip(1_u8..) + { + let interest = deposit_interest(10_000_u128 * UNIT, months) as f64 / UNIT as f64; + let interest = (interest * precision).floor() / precision; + + assert_eq!(interest, expect_interest); + } +} diff --git a/core/primitives/Cargo.toml b/core/primitives/Cargo.toml index 542d0b0d9..2218521a5 100644 --- a/core/primitives/Cargo.toml +++ b/core/primitives/Cargo.toml @@ -10,8 +10,12 @@ repository = "https://github.com/darwinia-network/darwinia" version = "6.0.0" [dependencies] +# darwinia +dc-types = { path = "../types" } + # moonbeam account = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.30" } + # substrate sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } diff --git a/core/primitives/src/lib.rs b/core/primitives/src/lib.rs index 15e271618..6590dcf2e 100644 --- a/core/primitives/src/lib.rs +++ b/core/primitives/src/lib.rs @@ -27,6 +27,8 @@ #![cfg_attr(not(feature = "std"), no_std)] #![deny(missing_docs)] +pub use dc_types::*; + /// Alias to 512-bit hash when used in the context of a transaction signature on the chain. pub type Signature = account::EthereumSignature; @@ -34,9 +36,6 @@ pub type Signature = account::EthereumSignature; /// We intentionally make it equivalent to the public key of our transaction signing scheme. pub type AccountId = <::Signer as sp_runtime::traits::IdentifyAccount>::AccountId; -/// Balance of an account. -pub type Balance = u128; - /// Index of a transaction in the chain. pub type Index = u32; @@ -81,22 +80,3 @@ pub const MINUTES: BlockNumber = 60_000 / (MILLISECS_PER_BLOCK as BlockNumber); pub const HOURS: BlockNumber = MINUTES * 60; /// 14,400 blocks. pub const DAYS: BlockNumber = HOURS * 24; - -// Unit = the base number of indivisible units for balances -/// 1e18 wei — 1,000,000,000,000,000,000 -pub const UNIT: Balance = 1_000 * MILLIUNIT; -/// 1e15 wei — 1,000,000,000,000,000 -pub const MILLIUNIT: Balance = 1_000 * MICROUNIT; -/// 1e12 wei — 1,000,000,000,000 -pub const MICROUNIT: Balance = 1_000 * GWEI; -/// 1e9 wei — 1,000,000,000 -pub const GWEI: Balance = 1_000 * MWEI; -/// 1e6 wei — 1,000,000 -pub const MWEI: Balance = 1_000 * KWEI; -/// 1e3 wei — 1,000 -pub const KWEI: Balance = 1_000 * WEI; -/// 1 wei — 1 -pub const WEI: Balance = 1; - -/// Base balance required for the XCM unit weight -pub const BASE_WEIGHT_FEE: Balance = GWEI; diff --git a/core/types/Cargo.toml b/core/types/Cargo.toml new file mode 100644 index 000000000..ddacce0de --- /dev/null +++ b/core/types/Cargo.toml @@ -0,0 +1,10 @@ +[package] +authors = ["Darwinia Network "] +description = "Darwinia core types." +edition = "2021" +homepage = "https://darwinia.network" +license = "GPL-3.0" +name = "dc-types" +readme = "README.md" +repository = "https://github.com/darwinia-network/darwinia" +version = "6.0.0" diff --git a/core/types/src/lib.rs b/core/types/src/lib.rs new file mode 100644 index 000000000..195d2e2d0 --- /dev/null +++ b/core/types/src/lib.rs @@ -0,0 +1,47 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Darwinia core types. + +#![no_std] +#![deny(missing_docs)] + +/// Balance type. +pub type Balance = u128; + +/// Time type. +pub type Moment = u128; + +/// Asset identifier type. +pub type AssetId = u64; + +// Unit = the base number of indivisible units for balances +/// 1e18 wei — 1,000,000,000,000,000,000 +pub const UNIT: Balance = 1_000 * MILLIUNIT; +/// 1e15 wei — 1,000,000,000,000,000 +pub const MILLIUNIT: Balance = 1_000 * MICROUNIT; +/// 1e12 wei — 1,000,000,000,000 +pub const MICROUNIT: Balance = 1_000 * GWEI; +/// 1e9 wei — 1,000,000,000 +pub const GWEI: Balance = 1_000 * MWEI; +/// 1e6 wei — 1,000,000 +pub const MWEI: Balance = 1_000 * KWEI; +/// 1e3 wei — 1,000 +pub const KWEI: Balance = 1_000 * WEI; +/// 1 wei — 1 +pub const WEI: Balance = 1; diff --git a/node/Cargo.toml b/node/Cargo.toml index 5f539fbe9..1580c18a2 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -36,7 +36,7 @@ cumulus-relay-chain-interface = { git = "https://github.com/paritytech cumulus-relay-chain-rpc-interface = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.30" } # darwinia -crab-runtime = { path = "../runtime/crab" } +crab-runtime = { path = "../runtime/crab" } darwinia-runtime = { path = "../runtime/darwinia" } dc-primitives = { path = "../core/primitives" } pangolin-runtime = { path = "../runtime/pangolin" } @@ -99,7 +99,7 @@ substrate-prometheus-endpoint = { git = "https://github.com/paritytech/substrat try-runtime-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } [features] -default = [] +default = ["darwinia-runtime/production"] runtime-benchmarks = [ # darwinia diff --git a/node/src/chain_spec/crab.rs b/node/src/chain_spec/crab.rs index fd18fed0f..0a29118ee 100644 --- a/node/src/chain_spec/crab.rs +++ b/node/src/chain_spec/crab.rs @@ -176,9 +176,9 @@ pub fn config() -> ChainSpec { parachain_info: crab_runtime::ParachainInfoConfig { parachain_id: 2105.into() }, // Monetary stuff. - assets: Default::default(), balances: Default::default(), transaction_payment: Default::default(), + assets: Default::default(), // Consensus stuff. collator_selection: crab_runtime::CollatorSelectionConfig { @@ -255,11 +255,11 @@ fn testnet_genesis( parachain_info: crab_runtime::ParachainInfoConfig { parachain_id: id }, // Monetary stuff. - assets: Default::default(), balances: crab_runtime::BalancesConfig { balances: endowed_accounts.iter().cloned().map(|k| (k, 100_000_000 * UNIT)).collect(), }, transaction_payment: Default::default(), + assets: Default::default(), // Consensus stuff. collator_selection: crab_runtime::CollatorSelectionConfig { diff --git a/node/src/chain_spec/darwinia.rs b/node/src/chain_spec/darwinia.rs index eeff35a07..11ec40a55 100644 --- a/node/src/chain_spec/darwinia.rs +++ b/node/src/chain_spec/darwinia.rs @@ -19,45 +19,49 @@ #![allow(clippy::derive_partial_eq_without_eq)] // std -use std::{collections::BTreeMap, str::FromStr}; +use std::{ + collections::BTreeMap, + str::FromStr, + time::{SystemTime, UNIX_EPOCH}, +}; // cumulus use cumulus_primitives_core::ParaId; // darwinia use super::*; -use darwinia_runtime::{AuraId, DarwiniaPrecompiles, EvmConfig, Runtime}; +use darwinia_runtime::*; use dc_primitives::*; // frontier use fp_evm::GenesisAccount; // substrate +use sc_chain_spec::Properties; use sc_service::ChainType; use sp_core::H160; /// Specialized `ChainSpec` for the normal parachain runtime. -pub type ChainSpec = sc_service::GenericChainSpec; +pub type ChainSpec = sc_service::GenericChainSpec; -/// Generate the session keys from individual elements. -/// -/// The input must be a tuple of individual keys (a single arg for now since we have just one key). -pub fn session_keys(keys: AuraId) -> darwinia_runtime::SessionKeys { - darwinia_runtime::SessionKeys { aura: keys } +fn properties() -> Properties { + super::properties("RING") } -pub fn development_config() -> ChainSpec { - // Give your base currency a unit name and decimal places - let mut properties = sc_chain_spec::Properties::new(); - properties.insert("tokenSymbol".into(), "RING".into()); - properties.insert("tokenDecimals".into(), 18.into()); - properties.insert("ss58Format".into(), 18.into()); +// TODO: maybe a more general one +// Generate the session keys from individual elements. +// +// The input must be a tuple of individual keys (a single arg for now since we have just one key). +fn session_keys(keys: AuraId) -> SessionKeys { + SessionKeys { aura: keys } +} +pub fn development_config() -> ChainSpec { ChainSpec::from_genesis( // Name "Darwinia2 Development", // ID - "darwinia-dev", + "darwinia2-development", ChainType::Development, move || { testnet_genesis( - // initial collators. + // Initial collators. vec![ // Bind the `Alice` to `Alith` to make `--alice` available for testnet. ( @@ -69,6 +73,11 @@ pub fn development_config() -> ChainSpec { array_bytes::hex_n_into_unchecked(BALTATHAR), get_collator_keys_from_seed("Bob"), ), + // Bind the `Charlie` to `CHARLETH` to make `--charlie` available for testnet. + ( + array_bytes::hex_n_into_unchecked(CHARLETH), + get_collator_keys_from_seed("Charlie"), + ), ], vec![ array_bytes::hex_n_into_unchecked(ALITH), @@ -85,7 +94,7 @@ pub fn development_config() -> ChainSpec { None, None, None, - Some(properties), + Some(properties()), Extensions { relay_chain: "rococo-local".into(), // You MUST set this to the correct network! para_id: 2046, @@ -93,22 +102,16 @@ pub fn development_config() -> ChainSpec { ) } -pub fn local_testnet_config() -> ChainSpec { - // Give your base currency a unit name and decimal places - let mut properties = sc_chain_spec::Properties::new(); - properties.insert("tokenSymbol".into(), "RING".into()); - properties.insert("tokenDecimals".into(), 18.into()); - properties.insert("ss58Format".into(), 18.into()); - +pub fn local_config() -> ChainSpec { ChainSpec::from_genesis( // Name - "Darwinia2 Local Testnet", + "Darwinia2 Local", // ID - "darwinia_local_testnet", + "darwinia2-local", ChainType::Local, move || { testnet_genesis( - // initial collators. + // Initial collators. vec![ // Bind the `Alice` to `Alith` to make `--alice` available for testnet. ( @@ -120,6 +123,11 @@ pub fn local_testnet_config() -> ChainSpec { array_bytes::hex_n_into_unchecked(BALTATHAR), get_collator_keys_from_seed("Bob"), ), + // Bind the `Charlie` to `CHARLETH` to make `--charlie` available for testnet. + ( + array_bytes::hex_n_into_unchecked(CHARLETH), + get_collator_keys_from_seed("Charlie"), + ), ], vec![ array_bytes::hex_n_into_unchecked(ALITH), @@ -132,17 +140,11 @@ pub fn local_testnet_config() -> ChainSpec { 2046.into(), ) }, - // Bootnodes Vec::new(), - // Telemetry None, - // Protocol ID - Some("darwinia"), - // Fork ID None, - // Properties - Some(properties), - // Extensions + None, + Some(properties()), Extensions { relay_chain: "rococo-local".into(), // You MUST set this to the correct network! para_id: 2046, @@ -150,50 +152,44 @@ pub fn local_testnet_config() -> ChainSpec { ) } -pub fn config() -> ChainSpec { - // Give your base currency a unit name and decimal places - let mut properties = sc_chain_spec::Properties::new(); - properties.insert("tokenSymbol".into(), "RING".into()); - properties.insert("tokenDecimals".into(), 18.into()); - properties.insert("ss58Format".into(), 18.into()); - +pub fn genesis_config() -> ChainSpec { // TODO: update this before final release ChainSpec::from_genesis( // Name "Darwinia2", // ID - "darwinia", + "darwinia2", ChainType::Live, move || { - darwinia_runtime::GenesisConfig { + GenesisConfig { // System stuff. - system: darwinia_runtime::SystemConfig { - code: darwinia_runtime::WASM_BINARY + system: SystemConfig { + code: WASM_BINARY .expect("WASM binary was not build, please build it!") .to_vec(), }, parachain_system: Default::default(), - parachain_info: darwinia_runtime::ParachainInfoConfig { parachain_id: 2046.into() }, + parachain_info: ParachainInfoConfig { parachain_id: 2046.into() }, // Monetary stuff. - assets: Default::default(), balances: Default::default(), transaction_payment: Default::default(), + assets: Default::default(), // Consensus stuff. - collator_selection: darwinia_runtime::CollatorSelectionConfig { - invulnerables: vec![array_bytes::hex_n_into_unchecked(ALITH)], - ..Default::default() + staking: StakingConfig { + now: SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_millis(), + elapsed_time: 0, + collator_count: 3, + collators: Vec::new(), }, - session: darwinia_runtime::SessionConfig { + session: SessionConfig { keys: vec![( array_bytes::hex_n_into_unchecked(ALITH), array_bytes::hex_n_into_unchecked(ALITH), session_keys(get_collator_keys_from_seed("Alice")), )], }, - // no need to pass anything to aura, in fact it will panic if we do. Session will - // take care of this. aura: Default::default(), aura_ext: Default::default(), @@ -210,9 +206,7 @@ pub fn config() -> ChainSpec { vesting: Default::default(), // XCM stuff. - polkadot_xcm: darwinia_runtime::PolkadotXcmConfig { - safe_xcm_version: Some(SAFE_XCM_VERSION), - }, + polkadot_xcm: PolkadotXcmConfig { safe_xcm_version: Some(SAFE_XCM_VERSION) }, // EVM stuff. ethereum: Default::default(), @@ -234,7 +228,7 @@ pub fn config() -> ChainSpec { // Fork ID None, // Properties - Some(properties), + Some(properties()), // Extensions Extensions { relay_chain: "polkadot".into(), // You MUST set this to the correct network! @@ -243,34 +237,37 @@ pub fn config() -> ChainSpec { ) } +pub fn config() -> ChainSpec { + unimplemented!("TODO") +} + fn testnet_genesis( - invulnerables: Vec<(AccountId, AuraId)>, + collators: Vec<(AccountId, AuraId)>, endowed_accounts: Vec, id: ParaId, -) -> darwinia_runtime::GenesisConfig { - darwinia_runtime::GenesisConfig { +) -> GenesisConfig { + GenesisConfig { // System stuff. - system: darwinia_runtime::SystemConfig { - code: darwinia_runtime::WASM_BINARY.unwrap().to_vec(), - }, + system: SystemConfig { code: WASM_BINARY.unwrap().to_vec() }, parachain_system: Default::default(), - parachain_info: darwinia_runtime::ParachainInfoConfig { parachain_id: id }, + parachain_info: ParachainInfoConfig { parachain_id: id }, // Monetary stuff. - assets: Default::default(), - balances: darwinia_runtime::BalancesConfig { + balances: BalancesConfig { balances: endowed_accounts.iter().cloned().map(|k| (k, 100_000_000 * UNIT)).collect(), }, transaction_payment: Default::default(), + assets: Default::default(), // Consensus stuff. - collator_selection: darwinia_runtime::CollatorSelectionConfig { - invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(), - candidacy_bond: UNIT, - ..Default::default() + staking: StakingConfig { + now: SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_millis(), + elapsed_time: 0, + collator_count: collators.len() as _, + collators: collators.iter().map(|(a, _)| (a.to_owned(), UNIT)).collect(), }, - session: darwinia_runtime::SessionConfig { - keys: invulnerables + session: SessionConfig { + keys: collators .into_iter() .map(|(acc, aura)| { ( @@ -281,8 +278,6 @@ fn testnet_genesis( }) .collect(), }, - // no need to pass anything to aura, in fact it will panic if we do. Session will take care - // of this. aura: Default::default(), aura_ext: Default::default(), @@ -299,9 +294,7 @@ fn testnet_genesis( vesting: Default::default(), // XCM stuff. - polkadot_xcm: darwinia_runtime::PolkadotXcmConfig { - safe_xcm_version: Some(SAFE_XCM_VERSION), - }, + polkadot_xcm: PolkadotXcmConfig { safe_xcm_version: Some(SAFE_XCM_VERSION) }, // EVM stuff. ethereum: Default::default(), @@ -355,7 +348,3 @@ fn testnet_genesis( crab_fee_market: Default::default(), } } - -pub fn genesis_config() -> ChainSpec { - unimplemented!("TODO") -} diff --git a/node/src/chain_spec/mod.rs b/node/src/chain_spec/mod.rs index 86e6947df..9ec06988b 100644 --- a/node/src/chain_spec/mod.rs +++ b/node/src/chain_spec/mod.rs @@ -16,6 +16,8 @@ // You should have received a copy of the GNU General Public License // along with Darwinia. If not, see . +#![allow(clippy::derive_partial_eq_without_eq)] + pub mod darwinia; pub use darwinia::{self as darwinia_chain_spec, ChainSpec as DarwiniaChainSpec}; @@ -28,14 +30,14 @@ pub use pangolin::{self as pangolin_chain_spec, ChainSpec as PangolinChainSpec}; // crates.io use serde::{Deserialize, Serialize}; // substrate -use sc_chain_spec::{ChainSpecExtension, ChainSpecGroup}; +use sc_chain_spec::{ChainSpecExtension, ChainSpecGroup, Properties}; use sp_consensus_aura::sr25519::AuthorityId as AuraId; use sp_core::{Pair, Public}; -/// This is the simplest bytecode to revert without returning any data. -/// We will pre-deploy it under all of our precompiles to ensure they can be called from within -/// contracts. (PUSH1 0x00 PUSH1 0x00 REVERT) -pub const REVERT_BYTECODE: [u8; 5] = [0x60, 0x00, 0x60, 0x00, 0xFD]; +// This is the simplest bytecode to revert without returning any data. +// We will pre-deploy it under all of our precompiles to ensure they can be called from within +// contracts. (PUSH1 0x00 PUSH1 0x00 REVERT) +const REVERT_BYTECODE: [u8; 5] = [0x60, 0x00, 0x60, 0x00, 0xFD]; // These are are testnet-only keys. const ALITH: &str = "0xf24FF3a9CF04c71Dbc94D0b566f7A27B94566cac"; @@ -64,16 +66,21 @@ impl Extensions { } } -/// Helper function to generate a crypto pair from seed -pub fn get_from_seed(seed: &str) -> ::Public { - TPublic::Pair::from_string(&format!("//{}", seed), None) - .expect("static values are valid; qed") - .public() +fn properties(token_symbol: &str) -> Properties { + let mut properties = Properties::new(); + + properties.insert("tokenSymbol".into(), token_symbol.into()); + properties.insert("tokenDecimals".into(), 18.into()); + properties.insert("ss58Format".into(), 18.into()); + + properties } -/// Generate collator keys from seed. -/// -/// This function's return type must always match the session keys of the chain in tuple format. -pub fn get_collator_keys_from_seed(seed: &str) -> AuraId { +fn get_collator_keys_from_seed(seed: &str) -> AuraId { get_from_seed::(seed) } +fn get_from_seed(seed: &str) -> ::Public { + TPublic::Pair::from_string(&format!("//{}", seed), None) + .expect("static values are valid; qed") + .public() +} diff --git a/node/src/chain_spec/pangolin.rs b/node/src/chain_spec/pangolin.rs index 5d6a389a3..491d54170 100644 --- a/node/src/chain_spec/pangolin.rs +++ b/node/src/chain_spec/pangolin.rs @@ -176,9 +176,9 @@ pub fn config() -> ChainSpec { parachain_info: pangolin_runtime::ParachainInfoConfig { parachain_id: 2105.into() }, // Monetary stuff. - assets: Default::default(), balances: Default::default(), transaction_payment: Default::default(), + assets: Default::default(), // Consensus stuff. collator_selection: pangolin_runtime::CollatorSelectionConfig { @@ -252,11 +252,11 @@ fn testnet_genesis( parachain_info: pangolin_runtime::ParachainInfoConfig { parachain_id: id }, // Monetary stuff. - assets: Default::default(), balances: pangolin_runtime::BalancesConfig { balances: endowed_accounts.iter().cloned().map(|k| (k, 100_000_000 * UNIT)).collect(), }, transaction_payment: Default::default(), + assets: Default::default(), // Consensus stuff. collator_selection: pangolin_runtime::CollatorSelectionConfig { diff --git a/node/src/command.rs b/node/src/command.rs index d5a58fd48..1cf8b0783 100644 --- a/node/src/command.rs +++ b/node/src/command.rs @@ -603,7 +603,7 @@ fn load_spec(id: &str) -> std::result::Result, String> { "darwinia" => Box::new(darwinia_chain_spec::config()), "darwinia-genesis" => Box::new(darwinia_chain_spec::genesis_config()), "darwinia-dev" => Box::new(darwinia_chain_spec::development_config()), - "darwinia-local" => Box::new(darwinia_chain_spec::local_testnet_config()), + "darwinia-local" => Box::new(darwinia_chain_spec::local_config()), "crab" => Box::new(crab_chain_spec::config()), "crab-genesis" => Box::new(crab_chain_spec::genesis_config()), "crab-dev" => Box::new(crab_chain_spec::development_config()), diff --git a/pallet/deposit/Cargo.toml b/pallet/deposit/Cargo.toml new file mode 100644 index 000000000..05bfb25e7 --- /dev/null +++ b/pallet/deposit/Cargo.toml @@ -0,0 +1,55 @@ +[package] +authors = ["Darwinia Network "] +description = "Darwinia deposit mechanism implementation." +edition = "2021" +homepage = "https://darwinia.network" +license = "GPL-3.0" +name = "darwinia-deposit" +readme = "README.md" +repository = "https://github.com/darwinia-network/darwinia" +version = "6.0.0" + +[dependencies] +# crates.io +codec = { package = "parity-scale-codec", version = "3.2", default-features = false, features = ["derive"] } +scale-info = { version = "2.3", default-features = false } + +# darwinia +darwinia-staking = { default-features = false, path = "../staking" } +dc-inflation = { default-features = false, path = "../../core/inflation" } +dc-types = { path = "../../core/types" } + +# subtrate +frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } + +[dev-dependencies] +# substrate +pallet-assets = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } + +[features] +default = ["std"] +std = [ + # crates.io + "codec/std", + "scale-info/std", + + # darwinia + "darwinia-staking/std", + "dc-inflation/std", + + # subtrate + "frame-support/std", + "frame-system/std", + "sp-core/std", + "sp-runtime/std", + "sp-std/std", +] + +# TODO: runtime-benchmarks, try-runtime diff --git a/pallet/deposit/src/lib.rs b/pallet/deposit/src/lib.rs new file mode 100644 index 000000000..d280bd2aa --- /dev/null +++ b/pallet/deposit/src/lib.rs @@ -0,0 +1,295 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia is distributed in_use 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 Darwinia. If not, see . + +//! # Darwinia deposit pallet +//! +//! This is a completely specialized deposit pallet designed only for Darwinia parachain. +//! So, this pallet will eliminate the generic parameters as much as possible. + +#![cfg_attr(not(feature = "std"), no_std)] +#![deny(missing_docs)] + +mod weights; +pub use weights::WeightInfo; + +// core +use core::{ + cmp::Ordering::{Equal, Greater, Less}, + ops::ControlFlow::{Break, Continue}, +}; +// darwinia +use dc_inflation::MILLISECS_PER_YEAR; +use dc_types::{Balance, Moment}; +// substrate +use frame_support::{ + pallet_prelude::*, + traits::{ + Currency, + ExistenceRequirement::{AllowDeath, KeepAlive}, + UnixTime, + }, + PalletId, +}; +use frame_system::pallet_prelude::*; +use sp_runtime::traits::AccountIdConversion; + +/// Deposit identifier. +/// +/// It's not a global-unique identifier. +/// It's only used for distinguishing the deposits under a specific account. +pub type DepositId = u8; + +/// Milliseconds per month. +pub const MILLISECS_PER_MONTH: Moment = MILLISECS_PER_YEAR / 12; + +/// Asset's minting API. +pub trait Minting { + /// Account type. + type AccountId; + + /// Mint API. + fn mint(beneficiary: &Self::AccountId, amount: Balance) -> DispatchResult; +} + +/// Deposit. +#[derive(PartialEq, Eq, Encode, Decode, MaxEncodedLen, TypeInfo, RuntimeDebug)] +pub struct Deposit { + /// Deposit ID. + pub id: DepositId, + /// Deposited RING. + pub value: Balance, + /// Expired timestamp. + pub expired_time: Moment, + /// Deposit state. + pub in_use: bool, +} + +#[frame_support::pallet] +pub mod pallet { + // darwinia + use crate::*; + + #[pallet::config] + pub trait Config: frame_system::Config { + /// Override the [`frame_system::Config::RuntimeEvent`]. + type RuntimeEvent: From> + IsType<::RuntimeEvent>; + + /// Unix time getter. + type UnixTime: UnixTime; + + /// RING asset. + type Ring: Currency; + + /// KTON asset. + type Kton: Minting; + + /// Minimum amount to lock at least. + #[pallet::constant] + type MinLockingAmount: Get; + + /// Maximum deposit count. + /// + /// In currently design, this should not be greater than `u8::MAX`. + #[pallet::constant] + type MaxDeposits: Get; + } + + #[pallet::event] + // TODO: event? + // #[pallet::generate_deposit(pub(super) fn deposit_event)] + pub enum Event {} + + #[pallet::error] + pub enum Error { + /// Lock at least for a specific amount. + LockAtLeastSome, + /// Lock at least for one month. + LockAtLeastOneMonth, + /// Lock at most for thirty-six months. + LockAtMostThirtySixMonths, + /// Exceed maximum deposit count. + ExceedMaxDeposits, + /// Deposit not found. + DepositNotFound, + /// Deposit is in use. + DepositInUse, + /// Deposit is not in use. + DepositNotInUse, + } + + /// All deposits. + /// + /// The items must be sorted by the id. + #[pallet::storage] + #[pallet::getter(fn deposit_of)] + pub type Deposits = StorageMap< + _, + Blake2_128Concat, + T::AccountId, + BoundedVec, + ValueQuery, + >; + + #[pallet::pallet] + #[pallet::generate_store(pub(super) trait Store)] + pub struct Pallet(PhantomData); + #[pallet::call] + impl Pallet { + /// Lock the RING for some KTON profit/interest. + #[pallet::weight(0)] + pub fn lock(origin: OriginFor, amount: Balance, months: u8) -> DispatchResult { + let who = ensure_signed(origin)?; + + if amount < T::MinLockingAmount::get() { + Err(>::LockAtLeastSome)?; + } + if months == 0 { + Err(>::LockAtLeastOneMonth)?; + } + if months > 36 { + Err(>::LockAtMostThirtySixMonths)?; + } + if >::decode_len(&who).unwrap_or_default() as u32 >= T::MaxDeposits::get() { + Err(>::ExceedMaxDeposits)?; + } + + >::try_mutate(&who, |ds| { + // Keep the list sorted in increasing order. + // And find the missing id. + let id = match ds.iter().map(|d| d.id).try_fold(0, |i, id| match i.cmp(&id) { + Less => Break(i), + Equal => Continue(i + 1), + Greater => Break(i - 1), + }) { + Continue(c) => c, + Break(b) => b, + }; + + ds.try_insert( + id as _, + Deposit { + id, + value: amount, + expired_time: T::UnixTime::now().as_millis() + + MILLISECS_PER_MONTH * months as Moment, + in_use: false, + }, + ) + .map_err(|_| >::ExceedMaxDeposits) + })?; + T::Ring::transfer(&who, &Self::account_id(), amount, KeepAlive)?; + T::Kton::mint(&who, dc_inflation::deposit_interest(amount, months))?; + + // TODO: account ref + // TODO: event? + + Ok(()) + } + + /// Claim the expired-locked RING. + #[pallet::weight(0)] + pub fn claim(origin: OriginFor) -> DispatchResult { + let who = ensure_signed(origin)?; + let now = T::UnixTime::now().as_millis(); + let mut claimed = 0; + + >::mutate(&who, |ds| { + ds.retain(|d| { + if d.expired_time <= now && !d.in_use { + claimed += d.value; + + false + } else { + true + } + }); + }); + T::Ring::transfer(&Self::account_id(), &who, claimed, AllowDeath)?; + + // TODO: account ref + // TODO: event? + + Ok(()) + } + + // TODO: claim_with_penalty + } + impl Pallet + where + T: Config, + { + /// The account of the deposit pot. + pub fn account_id() -> T::AccountId { + PalletId(*b"dar/depo").into_account_truncating() + } + } +} +pub use pallet::*; + +impl darwinia_staking::Stake for Pallet +where + T: Config, +{ + type AccountId = T::AccountId; + type Item = DepositId; + + fn stake(who: &Self::AccountId, item: Self::Item) -> DispatchResult { + >::try_mutate(who, |ds| { + let Some(d) = ds.iter_mut().find(|d| d.id == item) else { + return Err(>::DepositNotFound)?; + }; + + if d.in_use { + Err(>::DepositInUse)? + } else { + d.in_use = true; + + Ok(()) + } + }) + } + + fn unstake(who: &Self::AccountId, item: Self::Item) -> DispatchResult { + >::try_mutate(who, |ds| { + let Some(d) = ds.iter_mut().find(|d| d.id == item) else { + return Err(>::DepositNotFound)?; + }; + + if d.in_use { + d.in_use = false; + + Ok(()) + } else { + Err(>::DepositNotInUse)? + } + }) + } +} +impl darwinia_staking::StakeExt for Pallet +where + T: Config, +{ + type Amount = Balance; + + fn amount(who: &Self::AccountId, item: Self::Item) -> Self::Amount { + >::get(who) + .into_iter() + .find_map(|d| if d.id == item { Some(d.value) } else { None }) + .unwrap_or_default() + } +} diff --git a/pallet/deposit/src/weights.rs b/pallet/deposit/src/weights.rs new file mode 100644 index 000000000..18be72e2c --- /dev/null +++ b/pallet/deposit/src/weights.rs @@ -0,0 +1,4 @@ +#![allow(missing_docs)] + +pub trait WeightInfo {} +impl WeightInfo for () {} diff --git a/pallet/deposit/tests/mock.rs b/pallet/deposit/tests/mock.rs new file mode 100644 index 000000000..6e5675cad --- /dev/null +++ b/pallet/deposit/tests/mock.rs @@ -0,0 +1,140 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use dc_types::{AssetId, Balance, Moment, UNIT}; + +impl frame_system::Config for Runtime { + type AccountData = pallet_balances::AccountData; + type AccountId = u32; + type BaseCallFilter = frame_support::traits::Everything; + type BlockHashCount = (); + type BlockLength = (); + type BlockNumber = u64; + type BlockWeights = (); + type DbWeight = (); + type Hash = sp_core::H256; + type Hashing = sp_runtime::traits::BlakeTwo256; + type Header = sp_runtime::testing::Header; + type Index = u64; + type Lookup = sp_runtime::traits::IdentityLookup; + type MaxConsumers = frame_support::traits::ConstU32<16>; + type OnKilledAccount = (); + type OnNewAccount = (); + type OnSetCode = (); + type PalletInfo = PalletInfo; + type RuntimeCall = RuntimeCall; + type RuntimeEvent = RuntimeEvent; + type RuntimeOrigin = RuntimeOrigin; + type SS58Prefix = (); + type SystemWeightInfo = (); + type Version = (); +} + +impl pallet_timestamp::Config for Runtime { + type MinimumPeriod = (); + type Moment = Moment; + type OnTimestampSet = (); + type WeightInfo = (); +} + +impl pallet_balances::Config for Runtime { + type AccountStore = System; + type Balance = Balance; + type DustRemoval = (); + type ExistentialDeposit = frame_support::traits::ConstU128<0>; + type MaxLocks = (); + type MaxReserves = (); + type ReserveIdentifier = [u8; 8]; + type RuntimeEvent = RuntimeEvent; + type WeightInfo = (); +} + +impl pallet_assets::Config for Runtime { + type ApprovalDeposit = (); + type AssetAccountDeposit = (); + type AssetDeposit = (); + type AssetId = AssetId; + type Balance = Balance; + type Currency = Balances; + type Extra = (); + type ForceOrigin = frame_system::EnsureRoot; + type Freezer = (); + type MetadataDepositBase = (); + type MetadataDepositPerByte = (); + type RuntimeEvent = RuntimeEvent; + type StringLimit = frame_support::traits::ConstU32<4>; + type WeightInfo = (); +} + +pub enum KtonMinting {} +impl darwinia_deposit::Minting for KtonMinting { + type AccountId = u32; + + fn mint(beneficiary: &Self::AccountId, amount: Balance) -> sp_runtime::DispatchResult { + Assets::mint(RuntimeOrigin::signed(0), 0, *beneficiary, amount) + } +} +impl darwinia_deposit::Config for Runtime { + type Kton = KtonMinting; + type MaxDeposits = frame_support::traits::ConstU32<16>; + type MinLockingAmount = frame_support::traits::ConstU128; + type Ring = Balances; + type RuntimeEvent = RuntimeEvent; + type UnixTime = Timestamp; +} + +frame_support::construct_runtime!( + pub enum Runtime where + Block = frame_system::mocking::MockBlock, + NodeBlock = frame_system::mocking::MockBlock, + UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic, + { + System: frame_system, + Timestamp: pallet_timestamp, + Balances: pallet_balances, + Assets: pallet_assets, + Deposit: darwinia_deposit, + } +); + +pub fn efflux(milli_secs: Moment) { + Timestamp::set_timestamp(Timestamp::now() + milli_secs); +} + +pub fn new_test_ext() -> sp_io::TestExternalities { + // substrate + use frame_support::traits::GenesisBuild; + + let mut storage = frame_system::GenesisConfig::default().build_storage::().unwrap(); + + pallet_balances::GenesisConfig:: { + balances: (1..=2).map(|i| (i, (i as Balance) * 1_000 * UNIT)).collect(), + } + .assimilate_storage(&mut storage) + .unwrap(); + pallet_assets::GenesisConfig:: { + assets: vec![(0, 0, true, 1)], + metadata: vec![(0, b"KTON".to_vec(), b"KTON".to_vec(), 18)], + ..Default::default() + } + .assimilate_storage(&mut storage) + .unwrap(); + + storage.into() +} diff --git a/pallet/deposit/tests/tests.rs b/pallet/deposit/tests/tests.rs new file mode 100644 index 000000000..75a37d38c --- /dev/null +++ b/pallet/deposit/tests/tests.rs @@ -0,0 +1,274 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +mod mock; +use mock::{Deposit, *}; + +// darwinia +use darwinia_deposit::{Deposit as DepositS, *}; +use darwinia_staking::Stake; +use dc_types::{Moment, UNIT}; +// substrate +use frame_support::{assert_noop, assert_ok, traits::Get}; + +#[test] +fn lock_should_work() { + new_test_ext().execute_with(|| { + assert_eq!(Balances::free_balance(&Deposit::account_id()), 0); + assert_eq!(Balances::free_balance(&1), 1_000 * UNIT); + assert_ok!(Deposit::lock(RuntimeOrigin::signed(1), 10 * UNIT, 1)); + assert_eq!(Balances::free_balance(&Deposit::account_id()), 10 * UNIT); + assert_eq!(Balances::free_balance(&1), 990 * UNIT); + }); +} + +#[test] +fn deposit_interest_should_work() { + new_test_ext().execute_with(|| { + assert_eq!(Assets::balance(0, 1), 0); + assert_ok!(Deposit::lock(RuntimeOrigin::signed(1), UNIT, 1)); + assert_eq!(Assets::balance(0, 1), 7_614_213_197_969); + + assert_eq!(Assets::balance(0, 2), 0); + assert_ok!(Deposit::lock(RuntimeOrigin::signed(2), 1000 * UNIT, 36)); + assert_eq!(Assets::balance(0, 2), 364_467_005_076_142_131); + }); +} + +#[test] +fn unique_identity_should_work() { + new_test_ext().execute_with(|| { + assert!(Deposit::deposit_of(&1).is_empty()); + assert_ok!(Deposit::lock(RuntimeOrigin::signed(1), UNIT, 1)); + assert_ok!(Deposit::lock(RuntimeOrigin::signed(1), 2 * UNIT, 2)); + assert_ok!(Deposit::lock(RuntimeOrigin::signed(1), 3 * UNIT, 1)); + assert_ok!(Deposit::lock(RuntimeOrigin::signed(1), 4 * UNIT, 2)); + assert_ok!(Deposit::lock(RuntimeOrigin::signed(1), 5 * UNIT, 1)); + assert_eq!( + Deposit::deposit_of(&1).as_slice(), + &[ + DepositS { id: 0, value: UNIT, expired_time: MILLISECS_PER_MONTH, in_use: false }, + DepositS { + id: 1, + value: 2 * UNIT, + expired_time: 2 * MILLISECS_PER_MONTH, + in_use: false + }, + DepositS { + id: 2, + value: 3 * UNIT, + expired_time: MILLISECS_PER_MONTH, + in_use: false + }, + DepositS { + id: 3, + value: 4 * UNIT, + expired_time: 2 * MILLISECS_PER_MONTH, + in_use: false + }, + DepositS { + id: 4, + value: 5 * UNIT, + expired_time: MILLISECS_PER_MONTH, + in_use: false + } + ] + ); + + efflux(MILLISECS_PER_MONTH); + assert_ok!(Deposit::claim(RuntimeOrigin::signed(1))); + + assert_ok!(Deposit::lock(RuntimeOrigin::signed(1), 6 * UNIT, 1)); + assert_eq!( + Deposit::deposit_of(&1).as_slice(), + &[ + DepositS { + id: 0, + value: 6 * UNIT, + expired_time: 2 * MILLISECS_PER_MONTH, + in_use: false + }, + DepositS { + id: 1, + value: 2 * UNIT, + expired_time: 2 * MILLISECS_PER_MONTH, + in_use: false + }, + DepositS { + id: 3, + value: 4 * UNIT, + expired_time: 2 * MILLISECS_PER_MONTH, + in_use: false + }, + ] + ); + + assert_ok!(Deposit::lock(RuntimeOrigin::signed(1), 7 * UNIT, 1)); + assert_eq!( + Deposit::deposit_of(&1).as_slice(), + &[ + DepositS { + id: 0, + value: 6 * UNIT, + expired_time: 2 * MILLISECS_PER_MONTH, + in_use: false + }, + DepositS { + id: 1, + value: 2 * UNIT, + expired_time: 2 * MILLISECS_PER_MONTH, + in_use: false + }, + DepositS { + id: 2, + value: 7 * UNIT, + expired_time: 2 * MILLISECS_PER_MONTH, + in_use: false + }, + DepositS { + id: 3, + value: 4 * UNIT, + expired_time: 2 * MILLISECS_PER_MONTH, + in_use: false + }, + ] + ); + + assert_ok!(Deposit::lock(RuntimeOrigin::signed(1), 8 * UNIT, 1)); + assert_eq!( + Deposit::deposit_of(&1).as_slice(), + &[ + DepositS { + id: 0, + value: 6 * UNIT, + expired_time: 2 * MILLISECS_PER_MONTH, + in_use: false + }, + DepositS { + id: 1, + value: 2 * UNIT, + expired_time: 2 * MILLISECS_PER_MONTH, + in_use: false + }, + DepositS { + id: 2, + value: 7 * UNIT, + expired_time: 2 * MILLISECS_PER_MONTH, + in_use: false + }, + DepositS { + id: 3, + value: 4 * UNIT, + expired_time: 2 * MILLISECS_PER_MONTH, + in_use: false + }, + DepositS { + id: 4, + value: 8 * UNIT, + expired_time: 2 * MILLISECS_PER_MONTH, + in_use: false + }, + ] + ); + }); +} + +#[test] +fn expire_time_should_work() { + new_test_ext().execute_with(|| { + (1..=8).for_each(|_| { + assert_ok!(Deposit::lock(RuntimeOrigin::signed(1), UNIT, 1)); + efflux(MILLISECS_PER_MONTH); + }); + assert_eq!( + Deposit::deposit_of(&1).as_slice(), + (1..=8) + .map(|i| DepositS { + id: i - 1, + value: UNIT, + expired_time: i as Moment * MILLISECS_PER_MONTH, + in_use: false + }) + .collect::>() + .as_slice() + ); + }); +} + +#[test] +fn lock_should_fail() { + new_test_ext().execute_with(|| { + assert_noop!( + Deposit::lock(RuntimeOrigin::signed(1), 0, 0), + >::LockAtLeastSome + ); + + assert_noop!( + Deposit::lock(RuntimeOrigin::signed(1), UNIT, 0), + >::LockAtLeastOneMonth + ); + + assert_noop!( + Deposit::lock(RuntimeOrigin::signed(1), UNIT, 37), + >::LockAtMostThirtySixMonths + ); + + (0..<::MaxDeposits as Get<_>>::get()).for_each(|_| { + assert_ok!(Deposit::lock(RuntimeOrigin::signed(1), UNIT, 1)); + }); + assert_noop!( + Deposit::lock(RuntimeOrigin::signed(1), UNIT, 1), + >::ExceedMaxDeposits + ); + + assert_noop!( + Deposit::lock(RuntimeOrigin::signed(2), 2_001 * UNIT, 1), + >::InsufficientBalance + ); + }); +} + +#[test] +fn claim_should_work() { + new_test_ext().execute_with(|| { + assert!(Deposit::deposit_of(&1).is_empty()); + assert_ok!(Deposit::claim(RuntimeOrigin::signed(1))); + assert!(Deposit::deposit_of(&1).is_empty()); + + assert_ok!(Deposit::lock(RuntimeOrigin::signed(1), UNIT, 1)); + assert!(!Deposit::deposit_of(&1).is_empty()); + + efflux(MILLISECS_PER_MONTH - 1); + assert_ok!(Deposit::claim(RuntimeOrigin::signed(1))); + assert!(!Deposit::deposit_of(&1).is_empty()); + + efflux(MILLISECS_PER_MONTH); + assert_ok!(Deposit::claim(RuntimeOrigin::signed(1))); + assert!(Deposit::deposit_of(&1).is_empty()); + + assert_ok!(Deposit::lock(RuntimeOrigin::signed(1), UNIT, 1)); + assert_ok!(Deposit::stake(&1, 0)); + efflux(2 * MILLISECS_PER_MONTH); + assert_ok!(Deposit::claim(RuntimeOrigin::signed(1))); + assert!(!Deposit::deposit_of(&1).is_empty()); + + assert_ok!(Deposit::unstake(&1, 0)); + assert_ok!(Deposit::claim(RuntimeOrigin::signed(1))); + assert!(Deposit::deposit_of(&1).is_empty()); + }); +} diff --git a/pallets/message-transact/Cargo.toml b/pallet/message-transact/Cargo.toml similarity index 100% rename from pallets/message-transact/Cargo.toml rename to pallet/message-transact/Cargo.toml diff --git a/pallets/message-transact/src/lib.rs b/pallet/message-transact/src/lib.rs similarity index 99% rename from pallets/message-transact/src/lib.rs rename to pallet/message-transact/src/lib.rs index b6c097fe4..7cb0c5db6 100644 --- a/pallets/message-transact/src/lib.rs +++ b/pallet/message-transact/src/lib.rs @@ -145,7 +145,7 @@ pub mod pallet { chain_id: T::ChainId::get(), is_transactional: true, }, - transaction_data.clone().into(), + transaction_data.into(), ) .validate_in_block_for(&who) .and_then(|v| v.with_chain_id()) diff --git a/pallets/message-transact/src/mock.rs b/pallet/message-transact/src/mock.rs similarity index 100% rename from pallets/message-transact/src/mock.rs rename to pallet/message-transact/src/mock.rs diff --git a/pallets/message-transact/src/tests/eip1559.rs b/pallet/message-transact/src/tests/eip1559.rs similarity index 100% rename from pallets/message-transact/src/tests/eip1559.rs rename to pallet/message-transact/src/tests/eip1559.rs diff --git a/pallets/message-transact/src/tests/eip2930.rs b/pallet/message-transact/src/tests/eip2930.rs similarity index 100% rename from pallets/message-transact/src/tests/eip2930.rs rename to pallet/message-transact/src/tests/eip2930.rs diff --git a/pallets/message-transact/src/tests/legacy.rs b/pallet/message-transact/src/tests/legacy.rs similarity index 100% rename from pallets/message-transact/src/tests/legacy.rs rename to pallet/message-transact/src/tests/legacy.rs diff --git a/pallets/message-transact/src/tests/mod.rs b/pallet/message-transact/src/tests/mod.rs similarity index 100% rename from pallets/message-transact/src/tests/mod.rs rename to pallet/message-transact/src/tests/mod.rs diff --git a/pallet/staking/Cargo.toml b/pallet/staking/Cargo.toml new file mode 100644 index 000000000..244939b9f --- /dev/null +++ b/pallet/staking/Cargo.toml @@ -0,0 +1,65 @@ +[package] +authors = ["Darwinia Network "] +description = "Darwinia parachain staking." +edition = "2021" +homepage = "https://darwinia.network" +license = "GPL-3.0" +name = "darwinia-staking" +readme = "README.md" +repository = "https://github.com/darwinia-network/darwinia" +version = "6.0.0" + +[dependencies] +# crates.io +codec = { package = "parity-scale-codec", version = "3.2", default-features = false, features = ["derive"] } +scale-info = { version = "2.3", default-features = false } + +# darwinia +dc-inflation = { default-features = false, path = "../../core/inflation" } +dc-types = { path = "../../core/types" } + +# subtrate +frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-authorship = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-session = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } + +[dev-dependencies] +# crates.io +pretty_env_logger = { version = "0.4" } + +# darwinia +darwinia-deposit = { path = "../deposit" } + +# substrate +pallet-assets = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-session = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } + +[features] +default = ["std"] +std = [ + # crates.io + "codec/std", + "scale-info/std", + + # darwinia + "dc-inflation/std", + + # subtrate + "frame-support/std", + "frame-system/std", + "pallet-authorship/std", + "pallet-balances/std", + "pallet-session/std", + "sp-core/std", + "sp-runtime/std", + "sp-std/std", +] + +# TODO: runtime-benchmarks, try-runtime diff --git a/pallet/staking/src/lib.rs b/pallet/staking/src/lib.rs new file mode 100644 index 000000000..b61ded027 --- /dev/null +++ b/pallet/staking/src/lib.rs @@ -0,0 +1,918 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! # Darwinia parachain staking pallet +//! +//! This is a completely specialized stake pallet designed only for Darwinia parachain. +//! So, this pallet will eliminate the generic parameters as much as possible. +//! +//! ## Overview +//! +//! ### Acceptable stakes: +//! - RING: Darwinia's native token +//! - KTON: Darwinia's commitment token +//! - Deposit: Locking RINGs' ticket + +// TODO: weight +// TODO: nomination upper limit + +#![cfg_attr(not(feature = "std"), no_std)] +#![deny(missing_docs)] + +mod weights; +pub use weights::WeightInfo; + +// core +use core::fmt::Debug; +// crates.io +use codec::FullCodec; +// darwinia +use dc_inflation::TOTAL_SUPPLY; +use dc_types::{Balance, Moment}; +// substrate +use frame_support::{ + log, + pallet_prelude::*, + traits::{Currency, OnUnbalanced, UnixTime}, + EqNoBound, PalletId, PartialEqNoBound, +}; +use frame_system::{pallet_prelude::*, RawOrigin}; +use sp_runtime::{ + traits::{AccountIdConversion, Convert}, + Perbill, Perquintill, +}; +use sp_std::{collections::btree_map::BTreeMap, prelude::*}; + +type RewardPoint = u32; +type Power = u32; + +type DepositId = <::Deposit as Stake>::Item; +type NegativeImbalance = <::RingCurrency as Currency< + ::AccountId, +>>::NegativeImbalance; + +/// Stake trait that stake items must be implemented. +pub trait Stake { + /// Account type. + type AccountId; + /// Stake item type. + /// + /// Basically, it's just a num type. + type Item: Clone + Copy + Debug + PartialEq + FullCodec + MaxEncodedLen + TypeInfo; + + /// Add stakes to the staking pool. + /// + /// This will transfer the stakes to a pallet/contact account. + fn stake(who: &Self::AccountId, item: Self::Item) -> DispatchResult; + + /// Withdraw stakes from the staking pool. + /// + /// This will transfer the stakes back to the staker's account. + fn unstake(who: &Self::AccountId, item: Self::Item) -> DispatchResult; +} +/// Extended stake trait. +/// +/// Provide a way to access the deposit RING amount. +pub trait StakeExt: Stake { + /// Amount type. + type Amount; + + /// Get the staked amount. + fn amount(who: &Self::AccountId, item: Self::Item) -> Self::Amount; +} + +/// A convertor from collators id. Since this pallet does not have stash/controller, this is +/// just identity. +pub struct IdentityCollator; +impl Convert> for IdentityCollator { + fn convert(t: T) -> Option { + Some(t) + } +} + +/// Staking ledger. +#[derive(PartialEqNoBound, EqNoBound, Encode, Decode, MaxEncodedLen, TypeInfo, RuntimeDebug)] +#[scale_info(skip_type_params(T))] +pub struct Ledger +where + T: Config, +{ + /// Staker. + pub account: T::AccountId, + /// Staked RING. + pub staked_ring: Balance, + /// Staked KTON. + pub staked_kton: Balance, + /// Staked deposits. + pub staked_deposits: BoundedVec, T::MaxDeposits>, + /// The RING in unstaking process. + pub unstaking_ring: BoundedVec<(Balance, T::BlockNumber), T::MaxUnstakings>, + /// The KTON in unstaking process. + pub unstaking_kton: BoundedVec<(Balance, T::BlockNumber), T::MaxUnstakings>, + /// The deposit in unstaking process. + pub unstaking_deposits: BoundedVec<(DepositId, T::BlockNumber), T::MaxUnstakings>, +} +impl Ledger +where + T: Config, +{ + fn is_empty(&self) -> bool { + self.staked_ring == 0 + && self.staked_kton == 0 + && self.staked_deposits.is_empty() + && self.unstaking_ring.is_empty() + && self.unstaking_kton.is_empty() + && self.unstaking_deposits.is_empty() + } +} + +/// A snapshot of the stake backing a single collator in the system. +#[derive(Encode, Decode, MaxEncodedLen, TypeInfo, RuntimeDebug)] +pub struct Exposure { + /// The total power backing this collator. + pub total: Power, + /// Collator's self stake power. + pub own: Power, + /// Nominators' stake power. + pub others: Vec>, +} +/// A snapshot of the staker's state. +#[derive(Encode, Decode, MaxEncodedLen, TypeInfo, RuntimeDebug)] +pub struct IndividualExposure { + /// Nominator. + pub who: AccountId, + /// Nominator's stake power. + pub value: Power, +} + +#[frame_support::pallet] +pub mod pallet { + // darwinia + use crate::*; + + #[pallet::config] + pub trait Config: frame_system::Config { + /// Override the [`frame_system::Config::RuntimeEvent`]. + type RuntimeEvent: From> + IsType<::RuntimeEvent>; + + /// Unix time getter. + type UnixTime: UnixTime; + + /// RING [`Currency`] interface. + /// + /// Only use for inflation. + type RingCurrency: Currency; + + /// Tokens have been minted and are unused for stakers reward. + /// + /// Usually, it's treasury. + type RewardRemainder: OnUnbalanced>; + + /// RING [`Stake`] interface. + type Ring: Stake; + + /// KTON [`Stake`] interface. + type Kton: Stake; + + /// Deposit [`StakeExt`] interface. + type Deposit: StakeExt; + + /// Minimum time to stake at least. + #[pallet::constant] + type MinStakingDuration: Get; + + /// The percentage of the total payout that is distributed to stakers. + /// + /// Usually, the rest goes to the treasury. + #[pallet::constant] + type PayoutFraction: Get; + + /// Maximum deposit count. + #[pallet::constant] + type MaxDeposits: Get; + + /// Maximum unstaking/unbonding count. + #[pallet::constant] + type MaxUnstakings: Get; + } + + #[allow(missing_docs)] + #[pallet::event] + #[pallet::generate_deposit(pub(super) fn deposit_event)] + pub enum Event { + /// An account has staked. + Staked { + staker: T::AccountId, + ring_amount: Balance, + kton_amount: Balance, + deposits: Vec>, + }, + /// An account has unstaked. + Unstaked { + staker: T::AccountId, + ring_amount: Balance, + kton_amount: Balance, + deposits: Vec>, + }, + /// A payout has been made for the staker. + Payout { staker: T::AccountId, ring_amount: Balance }, + /// A new collator set has been elected. + Elected { collators: Vec }, + } + + #[pallet::error] + pub enum Error { + /// Exceed maximum deposit count. + ExceedMaxDeposits, + /// Exceed maximum unstaking/unbonding count. + ExceedMaxUnstakings, + /// You are not a staker. + NotStaker, + /// Target is not a collator. + TargetNotCollator, + } + + /// All staking ledgers. + #[pallet::storage] + #[pallet::getter(fn ledger_of)] + pub type Ledgers = StorageMap<_, Blake2_128Concat, T::AccountId, Ledger>; + + /// Total staked RING. + /// + /// This will count RING + deposit(locking RING). + #[pallet::storage] + #[pallet::getter(fn ring_pool)] + pub type RingPool = StorageValue<_, Balance, ValueQuery>; + + /// Total staked KTON. + #[pallet::storage] + #[pallet::getter(fn kton_pool)] + pub type KtonPool = StorageValue<_, Balance, ValueQuery>; + + /// The map from (wannabe) collator to the preferences of that collator. + #[pallet::storage] + #[pallet::getter(fn collator_of)] + pub type Collators = StorageMap<_, Twox64Concat, T::AccountId, Perbill>; + + /// Stakers' exposure. + #[pallet::storage] + #[pallet::unbounded] + #[pallet::getter(fn exposure)] + pub type Exposures = + StorageMap<_, Twox64Concat, T::AccountId, Exposure>; + + /// The ideal number of active collators. + #[pallet::storage] + #[pallet::getter(fn collator_count)] + pub type CollatorCount = StorageValue<_, u32, ValueQuery>; + + /// The map from nominator to their nomination preferences, namely the collator that + /// they wish to support. + #[pallet::storage] + #[pallet::getter(fn nominator_of)] + pub type Nominators = StorageMap<_, Twox64Concat, T::AccountId, T::AccountId>; + + /// Collator's reward points. + #[pallet::storage] + #[pallet::unbounded] + #[pallet::getter(fn reward_points)] + pub type RewardPoints = + StorageValue<_, (RewardPoint, BTreeMap), ValueQuery>; + + /// Active session's started timestamp. + #[pallet::storage] + #[pallet::getter(fn session_started_time)] + pub type SessionStartedTime = StorageValue<_, Moment, ValueQuery>; + + /// Elapsed time. + #[pallet::storage] + #[pallet::getter(fn elapsed_time)] + pub type ElapsedTime = StorageValue<_, Moment, ValueQuery>; + + #[pallet::genesis_config] + pub struct GenesisConfig { + /// Current timestamp. + pub now: Moment, + /// The running time of Darwinia1. + pub elapsed_time: Moment, + /// Genesis collator count. + pub collator_count: u32, + /// Genesis collator preferences. + pub collators: Vec<(T::AccountId, Balance)>, + } + #[cfg(feature = "std")] + impl Default for GenesisConfig { + fn default() -> Self { + GenesisConfig { now: 0, elapsed_time: 0, collator_count: 0, collators: Vec::new() } + } + } + #[pallet::genesis_build] + impl GenesisBuild for GenesisConfig { + fn build(&self) { + >::put(self.now); + >::put(self.elapsed_time); + >::put(self.collator_count); + + self.collators.iter().cloned().for_each(|(who, stake)| { + >::stake(RawOrigin::Signed(who.clone()).into(), stake, 0, Vec::new()) + .unwrap(); + >::collect(RawOrigin::Signed(who).into(), Default::default()).unwrap(); + }); + } + } + + #[pallet::pallet] + #[pallet::generate_store(pub(super) trait Store)] + pub struct Pallet(PhantomData); + #[pallet::call] + impl Pallet { + /// Add stakes to the staking pool. + /// + /// This will transfer the stakes to a pallet/contact account. + #[pallet::weight(0)] + pub fn stake( + origin: OriginFor, + ring_amount: Balance, + kton_amount: Balance, + deposits: Vec>, + ) -> DispatchResult { + let who = ensure_signed(origin)?; + + if ring_amount == 0 && kton_amount == 0 && deposits.is_empty() { + return Ok(()); + } + + >::try_mutate(&who, |l| { + let l = if let Some(l) = l { + l + } else { + >::inc_consumers(&who)?; + + *l = Some(Ledger { + account: who.to_owned(), + staked_ring: Default::default(), + staked_kton: Default::default(), + staked_deposits: Default::default(), + unstaking_ring: Default::default(), + unstaking_kton: Default::default(), + unstaking_deposits: Default::default(), + }); + + l.as_mut().expect("[pallet::staking] `l` must be some; qed") + }; + + if ring_amount != 0 { + Self::stake_ring(l, ring_amount)?; + } + if kton_amount != 0 { + Self::stake_kton(l, kton_amount)?; + } + + for d in deposits.clone() { + Self::stake_deposit(l, d)?; + } + + DispatchResult::Ok(()) + })?; + + Self::deposit_event(Event::::Staked { + staker: who, + ring_amount, + kton_amount, + deposits, + }); + + Ok(()) + } + + /// Withdraw stakes from the staking pool. + #[pallet::weight(0)] + pub fn unstake( + origin: OriginFor, + ring_amount: Balance, + kton_amount: Balance, + deposits: Vec>, + ) -> DispatchResult { + let who = ensure_signed(origin)?; + + if ring_amount == 0 && kton_amount == 0 && deposits.is_empty() { + return Ok(()); + } + + >::try_mutate(&who, |l| { + let Some(l) = l else { + return Err(>::NotStaker)?; + }; + + if ring_amount != 0 { + Self::unstake_ring(l, ring_amount)?; + } + if kton_amount != 0 { + Self::unstake_kton(l, kton_amount)?; + } + + for d in deposits { + Self::unstake_deposit(l, d)?; + } + + DispatchResult::Ok(()) + })?; + + // TODO: event? + + Ok(()) + } + + /// Claim the stakes from the pallet/contract account. + #[pallet::weight(0)] + pub fn claim(origin: OriginFor) -> DispatchResult { + let who = ensure_signed(origin)?; + + // Deposit doesn't need to be claimed. + Self::claim_unstakings(&who)?; + Self::try_clean_ledger_of(&who); + + // TODO: event? + + Ok(()) + } + + /// Declare the desire to collect. + /// + /// Effects will be felt at the beginning of the next session. + #[pallet::weight(0)] + pub fn collect(origin: OriginFor, commission: Perbill) -> DispatchResult { + let who = ensure_signed(origin)?; + + Self::ensure_staker(&who)?; + >::mutate(&who, |c| *c = Some(commission)); + + // TODO: event? + + Ok(()) + } + + /// Declare the desire to nominate a collator. + /// + /// Effects will be felt at the beginning of the next session. + #[pallet::weight(0)] + pub fn nominate(origin: OriginFor, target: T::AccountId) -> DispatchResult { + let who = ensure_signed(origin)?; + + Self::ensure_staker(&who)?; + + if !>::contains_key(&target) { + Err(>::TargetNotCollator)?; + } + + >::mutate(&who, |n| *n = Some(target)); + + // TODO: event? + + Ok(()) + } + + /// Declare no desire to either collect or nominate. + /// + /// Effects will be felt at the beginning of the next era. + /// + /// If the target is a collator, its nominators need to re-nominate. + #[pallet::weight(0)] + pub fn chill(origin: OriginFor) -> DispatchResult { + let who = ensure_signed(origin)?; + + >::remove(&who); + >::remove(&who); + + // TODO: event? + + Ok(()) + } + } + impl Pallet + where + T: Config, + { + fn update_pool

(increase: bool, amount: Balance) -> DispatchResult + where + P: frame_support::StorageValue, + { + P::try_mutate(|p| { + let p_new = if increase { + let Some(p_new) = p.checked_add(amount) else { + return Err("[pallet::staking] `u128` must not be overflowed; qed")?; + }; + + p_new + } else { + let Some(p_new) = p.checked_sub(amount) else { + return Err("[pallet::staking] `u128` must not be overflowed; qed")?; + }; + + p_new + }; + + *p = p_new; + + Ok(()) + }) + } + + fn stake_ring(ledger: &mut Ledger, amount: Balance) -> DispatchResult { + T::Ring::stake(&ledger.account, amount)?; + + ledger.staked_ring = if let Some(r) = ledger.staked_ring.checked_add(amount) { + r + } else { + return Err("[pallet::staking] `u128` must not be overflowed; qed")?; + }; + + Self::update_pool::>(true, amount)?; + + Ok(()) + } + + fn stake_kton(ledger: &mut Ledger, amount: Balance) -> DispatchResult { + T::Kton::stake(&ledger.account, amount)?; + + ledger.staked_kton = if let Some(k) = ledger.staked_kton.checked_add(amount) { + k + } else { + return Err("[pallet::staking] `u128` must not be overflowed; qed")?; + }; + + Self::update_pool::>(true, amount)?; + + Ok(()) + } + + fn stake_deposit(ledger: &mut Ledger, deposit: DepositId) -> DispatchResult { + T::Deposit::stake(&ledger.account, deposit)?; + + ledger.staked_deposits.try_push(deposit).map_err(|_| >::ExceedMaxDeposits)?; + + Self::update_pool::>(true, T::Deposit::amount(&ledger.account, deposit))?; + + Ok(()) + } + + fn unstake_ring(ledger: &mut Ledger, amount: Balance) -> DispatchResult { + let Some(nr) = ledger.staked_ring.checked_sub(amount) else { + return Err("[pallet::staking] `u128` must not be overflowed; qed")?; + }; + + ledger.staked_ring = nr; + ledger + .unstaking_ring + .try_push(( + amount, + >::block_number() + T::MinStakingDuration::get(), + )) + .map_err(|_| >::ExceedMaxUnstakings)?; + + Self::update_pool::>(false, amount)?; + + Ok(()) + } + + fn unstake_kton(ledger: &mut Ledger, amount: Balance) -> DispatchResult { + let Some(nk) = ledger.staked_kton.checked_sub(amount) else { + return Err("[pallet::staking] `u128` must not be overflowed; qed")?; + }; + + ledger.staked_kton = nk; + ledger + .unstaking_kton + .try_push(( + amount, + >::block_number() + T::MinStakingDuration::get(), + )) + .map_err(|_| >::ExceedMaxUnstakings)?; + + Self::update_pool::>(false, amount)?; + + Ok(()) + } + + fn unstake_deposit(ledger: &mut Ledger, deposit: DepositId) -> DispatchResult { + let Some(i) = ledger.staked_deposits.iter().position(|d| d == &deposit) else { + return Err("[pallet::staking] deposit id must be existed, due to previous unstake OP; qed")?; + }; + + ledger + .unstaking_deposits + .try_push(( + ledger.staked_deposits.remove(i), + >::block_number() + T::MinStakingDuration::get(), + )) + .map_err(|_| >::ExceedMaxUnstakings)?; + + Self::update_pool::>(false, T::Deposit::amount(&ledger.account, deposit))?; + + Ok(()) + } + + fn claim_unstakings(who: &T::AccountId) -> DispatchResult { + >::try_mutate(who, |l| { + let Some(l) = l else { + return Err(>::NotStaker)?; + }; + let now = >::block_number(); + let claim = |u: &mut BoundedVec<_, _>, c: &mut Balance| { + u.retain(|(a, t)| { + if t <= &now { + *c += a; + + false + } else { + true + } + }); + }; + let mut r_claimed = 0; + + claim(&mut l.unstaking_ring, &mut r_claimed); + T::Ring::unstake(who, r_claimed)?; + + let mut k_claimed = 0; + + claim(&mut l.unstaking_kton, &mut k_claimed); + T::Kton::unstake(who, k_claimed)?; + + let mut d_claimed = Vec::new(); + + l.unstaking_deposits.retain(|(d, t)| { + if t <= &now { + d_claimed.push(*d); + + false + } else { + true + } + }); + + for d in d_claimed { + T::Deposit::unstake(who, d)?; + } + + Ok(()) + }) + } + + fn try_clean_ledger_of(who: &T::AccountId) { + let _ = >::try_mutate(who, |maybe_l| { + let Some(l) = maybe_l else { return Err(()); }; + + if l.is_empty() { + *maybe_l = None; + + >::dec_consumers(who); + + Ok(()) + } else { + Err(()) + } + }); + } + + fn ensure_staker(who: &T::AccountId) -> DispatchResult { + if >::contains_key(who) { + Ok(()) + } else { + Err(>::NotStaker)? + } + } + + /// Add reward points to collators using their account id. + pub fn reward_by_ids(collators: &[(T::AccountId, RewardPoint)]) { + >::mutate(|(total, reward_map)| { + collators.iter().cloned().for_each(|(c, p)| { + *total += p; + + reward_map.entry(c).and_modify(|p_| *p_ += p).or_insert(p); + }); + }); + } + + // Power is a mixture of RING and KTON. + // - `total_ring_power = (amount / total_staked_ring) * HALF_POWER` + // - `total_kton_power = (amount / total_staked_kton) * HALF_POWER` + fn balance2power

(amount: Balance) -> Power + where + P: frame_support::StorageValue, + { + (Perquintill::from_rational(amount, P::get().max(1)) * 500_000_000_u128) as _ + } + + /// Calculate the power of the given account. + pub fn power_of(who: &T::AccountId) -> Power { + >::get(who) + .map(|l| { + Self::balance2power::>( + l.staked_ring + + l.staked_deposits + .into_iter() + .fold(0, |r, d| r + T::Deposit::amount(who, d)), + ) + Self::balance2power::>(l.staked_kton) + }) + .unwrap_or_default() + } + + // TODO: weight + /// Pay the session reward to the stakers. + pub fn payout(session_duration: Moment, elapsed_time: Moment) { + let unminted = TOTAL_SUPPLY - T::RingCurrency::total_issuance(); + + log::info!( + "\ + [pallet::staking] making a payout for: \ + `unminted = {unminted}`, \ + `session_duration = {session_duration}`, \ + `elapsed_time = {elapsed_time}`\ + " + ); + + let Some(inflation) = dc_inflation::in_period( + unminted, + session_duration, + elapsed_time, + ) else { + return; + }; + let payout = T::PayoutFraction::get() * inflation; + let (total_points, reward_map) = >::get(); + // Due to the `payout * percent` there might be some losses. + let mut actual_payout = 0; + + for (c, p) in reward_map { + let Some(commission) = >::get(&c) else { + log::error!("[pallet::staking] collator({c:?}) must be found; qed"); + + continue; + }; + let c_total_payout = Perbill::from_rational(p, total_points) * payout; + let c_commission_payout = commission * c_total_payout; + let n_payout = c_total_payout - c_commission_payout; + let Some(c_exposure) = >::get(&c) else { + log::error!("[pallet::staking] exposure({c:?}) must be found; qed"); + + continue; + }; + let c_payout = c_commission_payout + + Perbill::from_rational(c_exposure.own, c_exposure.total) * n_payout; + + if let Ok(_i) = T::RingCurrency::deposit_into_existing(&c, c_payout) { + actual_payout += c_payout; + + Self::deposit_event(Event::::Payout { staker: c, ring_amount: c_payout }); + } + + for n_exposure in c_exposure.others { + let n_payout = + Perbill::from_rational(n_exposure.value, c_exposure.total) * n_payout; + + if let Ok(_i) = + T::RingCurrency::deposit_into_existing(&n_exposure.who, n_payout) + { + actual_payout += n_payout; + + Self::deposit_event(Event::::Payout { + staker: n_exposure.who, + ring_amount: n_payout, + }); + } + } + } + + T::RewardRemainder::on_unbalanced(T::RingCurrency::issue(inflation - actual_payout)); + } + + /// Clean the old session data. + pub fn clean_old_session() { + >::kill(); + #[allow(deprecated)] + >::remove_all(None); + } + + /// Elect the new collators. + /// + /// This should only be called by the [`pallet_session::SessionManager::new_session`]. + pub fn elect() -> Vec { + let mut collators = >::iter_keys() + .map(|c| { + let c_power = Self::power_of(&c); + let mut t_power = c_power; + let i_exposures = >::iter() + .filter_map(|(n, c_)| { + if c_ == c { + let n_power = Self::power_of(&n); + + t_power += n_power; + + Some(IndividualExposure { who: n, value: n_power }) + } else { + None + } + }) + .collect(); + + ((c, Exposure { total: t_power, own: c_power, others: i_exposures }), t_power) + }) + .collect::>(); + + collators.sort_by(|(_, a), (_, b)| b.cmp(a)); + + collators + .into_iter() + .take(>::get() as _) + .map(|((c, e), _)| { + >::insert(&c, e); + + c + }) + .collect() + } + } +} +pub use pallet::*; + +// Add reward points to block authors: +// - 20 points to the block producer for producing a (non-uncle) block in the parachain chain, +// - 2 points to the block producer for each reference to a previously unreferenced uncle, and +// - 1 point to the producer of each referenced uncle block. +impl pallet_authorship::EventHandler for Pallet +where + T: Config + pallet_authorship::Config + pallet_session::Config, +{ + fn note_author(author: T::AccountId) { + Self::reward_by_ids(&[(author, 20)]) + } + + fn note_uncle(uncle_author: T::AccountId, _age: T::BlockNumber) { + if let Some(block_author) = >::author() { + Self::reward_by_ids(&[(block_author, 2), (uncle_author, 1)]) + } else { + log::error!("[pallet::staking] block author not set, this should never happen; qed"); + } + } +} + +// Play the role of the session manager. +impl pallet_session::SessionManager for Pallet +where + T: Config, +{ + fn new_session(index: u32) -> Option> { + log::info!( + "[pallet::staking] assembling new collators for new session {} at #{:?}", + index, + >::block_number(), + ); + + let collators = Self::elect(); + + Self::deposit_event(Event::::Elected { collators: collators.clone() }); + + Some(collators) + } + + fn start_session(_: u32) {} + + fn end_session(_: u32) { + let now = T::UnixTime::now().as_millis(); + let session_duration = now - >::get(); + let elapsed_time = >::mutate(|t| { + *t += session_duration; + + *t + }); + + >::put(now); + + Self::payout(session_duration, elapsed_time); + Self::clean_old_session(); + } +} + +/// The account of the staking pot. +pub fn account_id() -> A +where + A: FullCodec, +{ + PalletId(*b"dar/stak").into_account_truncating() +} diff --git a/pallet/staking/src/weights.rs b/pallet/staking/src/weights.rs new file mode 100644 index 000000000..18be72e2c --- /dev/null +++ b/pallet/staking/src/weights.rs @@ -0,0 +1,4 @@ +#![allow(missing_docs)] + +pub trait WeightInfo {} +impl WeightInfo for () {} diff --git a/pallet/staking/tests/mock.rs b/pallet/staking/tests/mock.rs new file mode 100644 index 000000000..d25ca8c88 --- /dev/null +++ b/pallet/staking/tests/mock.rs @@ -0,0 +1,311 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use dc_types::{AssetId, Balance, Moment, UNIT}; +// substrate +use sp_runtime::RuntimeAppPublic; + +impl frame_system::Config for Runtime { + type AccountData = pallet_balances::AccountData; + type AccountId = u32; + type BaseCallFilter = frame_support::traits::Everything; + type BlockHashCount = (); + type BlockLength = (); + type BlockNumber = u64; + type BlockWeights = (); + type DbWeight = (); + type Hash = sp_core::H256; + type Hashing = sp_runtime::traits::BlakeTwo256; + type Header = sp_runtime::testing::Header; + type Index = u64; + type Lookup = sp_runtime::traits::IdentityLookup; + type MaxConsumers = frame_support::traits::ConstU32<16>; + type OnKilledAccount = (); + type OnNewAccount = (); + type OnSetCode = (); + type PalletInfo = PalletInfo; + type RuntimeCall = RuntimeCall; + type RuntimeEvent = RuntimeEvent; + type RuntimeOrigin = RuntimeOrigin; + type SS58Prefix = (); + type SystemWeightInfo = (); + type Version = (); +} + +impl pallet_timestamp::Config for Runtime { + type MinimumPeriod = (); + type Moment = Moment; + type OnTimestampSet = (); + type WeightInfo = (); +} + +impl pallet_balances::Config for Runtime { + type AccountStore = System; + type Balance = Balance; + type DustRemoval = (); + type ExistentialDeposit = frame_support::traits::ConstU128<0>; + type MaxLocks = (); + type MaxReserves = (); + type ReserveIdentifier = [u8; 8]; + type RuntimeEvent = RuntimeEvent; + type WeightInfo = (); +} + +impl pallet_assets::Config for Runtime { + type ApprovalDeposit = (); + type AssetAccountDeposit = (); + type AssetDeposit = (); + type AssetId = AssetId; + type Balance = Balance; + type Currency = Balances; + type Extra = (); + type ForceOrigin = frame_system::EnsureRoot; + type Freezer = (); + type MetadataDepositBase = (); + type MetadataDepositPerByte = (); + type RuntimeEvent = RuntimeEvent; + type StringLimit = frame_support::traits::ConstU32<4>; + type WeightInfo = (); +} + +frame_support::parameter_types! { + pub static Time: core::time::Duration = core::time::Duration::new(0, 0); +} +impl Time { + pub fn run(milli_secs: Moment) { + Time::mutate(|t| *t += core::time::Duration::from_millis(milli_secs as _)); + } +} +impl frame_support::traits::UnixTime for Time { + fn now() -> core::time::Duration { + Time::get() + } +} +pub enum KtonMinting {} +impl darwinia_deposit::Minting for KtonMinting { + type AccountId = u32; + + fn mint(beneficiary: &Self::AccountId, amount: Balance) -> sp_runtime::DispatchResult { + Assets::mint(RuntimeOrigin::signed(0), 0, *beneficiary, amount) + } +} +impl darwinia_deposit::Config for Runtime { + type Kton = KtonMinting; + type MaxDeposits = frame_support::traits::ConstU32<16>; + type MinLockingAmount = frame_support::traits::ConstU128; + type Ring = Balances; + type RuntimeEvent = RuntimeEvent; + type UnixTime = Time; +} + +pub enum RingStaking {} +impl darwinia_staking::Stake for RingStaking { + type AccountId = u32; + type Item = Balance; + + fn stake(who: &Self::AccountId, item: Self::Item) -> sp_runtime::DispatchResult { + >::transfer( + who, + &darwinia_staking::account_id(), + item, + frame_support::traits::ExistenceRequirement::KeepAlive, + ) + } + + fn unstake(who: &Self::AccountId, item: Self::Item) -> sp_runtime::DispatchResult { + >::transfer( + &darwinia_staking::account_id(), + who, + item, + frame_support::traits::ExistenceRequirement::AllowDeath, + ) + } +} + +frame_support::parameter_types! { + pub static SessionHandlerCollators: Vec = Vec::new(); + pub static SessionChangeBlock: u64 = 0; +} +sp_runtime::impl_opaque_keys! { + pub struct SessionKeys { + pub aura: sp_runtime::testing::UintAuthorityId, + } +} +type Period = frame_support::traits::ConstU64<3>; +pub struct TestSessionHandler; +impl pallet_session::SessionHandler for TestSessionHandler { + const KEY_TYPE_IDS: &'static [sp_runtime::KeyTypeId] = + &[sp_runtime::testing::UintAuthorityId::ID]; + + fn on_genesis_session(keys: &[(u32, Ks)]) { + SessionHandlerCollators::set(keys.into_iter().map(|(a, _)| *a).collect::>()) + } + + fn on_new_session( + _: bool, + keys: &[(u32, Ks)], + _: &[(u32, Ks)], + ) { + SessionChangeBlock::set(System::block_number()); + SessionHandlerCollators::set(keys.into_iter().map(|(a, _)| *a).collect::>()) + } + + fn on_before_session_ending() {} + + fn on_disabled(_: u32) {} +} +impl pallet_session::Config for Runtime { + type Keys = SessionKeys; + type NextSessionRotation = pallet_session::PeriodicSessions; + type RuntimeEvent = RuntimeEvent; + type SessionHandler = pallet_session::TestSessionHandler; + type SessionManager = Staking; + type ShouldEndSession = pallet_session::PeriodicSessions; + type ValidatorId = Self::AccountId; + type ValidatorIdOf = darwinia_staking::IdentityCollator; + type WeightInfo = (); +} + +pub enum KtonStaking {} +impl darwinia_staking::Stake for KtonStaking { + type AccountId = u32; + type Item = Balance; + + fn stake(who: &Self::AccountId, item: Self::Item) -> sp_runtime::DispatchResult { + Assets::transfer(RuntimeOrigin::signed(*who), 0, darwinia_staking::account_id(), item) + } + + fn unstake(who: &Self::AccountId, item: Self::Item) -> sp_runtime::DispatchResult { + Assets::transfer(RuntimeOrigin::signed(darwinia_staking::account_id()), 0, *who, item) + } +} +frame_support::parameter_types! { + pub const PayoutFraction: sp_runtime::Perbill = sp_runtime::Perbill::from_percent(20); +} +impl darwinia_staking::Config for Runtime { + type Deposit = Deposit; + type Kton = KtonStaking; + type MaxDeposits = frame_support::traits::ConstU32<16>; + type MaxUnstakings = frame_support::traits::ConstU32<16>; + type MinStakingDuration = frame_support::traits::ConstU64<3>; + type PayoutFraction = PayoutFraction; + type RewardRemainder = (); + type Ring = RingStaking; + type RingCurrency = Balances; + type RuntimeEvent = RuntimeEvent; + type UnixTime = Time; +} + +frame_support::construct_runtime!( + pub enum Runtime where + Block = frame_system::mocking::MockBlock, + NodeBlock = frame_system::mocking::MockBlock, + UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic, + { + System: frame_system, + Timestamp: pallet_timestamp, + Balances: pallet_balances, + Assets: pallet_assets, + Deposit: darwinia_deposit, + Session: pallet_session, + Staking: darwinia_staking, + } +); + +pub trait ZeroDefault { + fn default() -> Self; +} +impl ZeroDefault for darwinia_staking::Ledger { + fn default() -> Self { + Self { + account: Default::default(), + staked_ring: Default::default(), + staked_kton: Default::default(), + staked_deposits: Default::default(), + unstaking_ring: Default::default(), + unstaking_kton: Default::default(), + unstaking_deposits: Default::default(), + } + } +} + +pub enum Efflux {} +impl Efflux { + pub fn time(milli_secs: Moment) { + Timestamp::set_timestamp(Timestamp::now() + milli_secs); + } + + pub fn block(number: u64) { + for _ in 0..number { + initialize_block(System::block_number() + 1) + } + } +} + +fn initialize_block(number: u64) { + System::set_block_number(number); + Efflux::time(1); + >::on_initialize(number); +} + +#[derive(Default)] +pub struct ExtBuilder { + collator_count: u32, +} +impl ExtBuilder { + pub fn collator_count(mut self, collator_count: u32) -> Self { + self.collator_count = collator_count; + + self + } + + pub fn build(self) -> sp_io::TestExternalities { + // substrate + use frame_support::traits::GenesisBuild; + + let _ = pretty_env_logger::try_init(); + let mut storage = + frame_system::GenesisConfig::default().build_storage::().unwrap(); + + pallet_balances::GenesisConfig:: { + balances: (1..=10).map(|i| (i, 1_000 * UNIT)).collect(), + } + .assimilate_storage(&mut storage) + .unwrap(); + pallet_assets::GenesisConfig:: { + assets: vec![(0, 0, true, 1)], + metadata: vec![(0, b"KTON".to_vec(), b"KTON".to_vec(), 18)], + accounts: (1..=10).map(|i| (0, i, 1_000 * UNIT)).collect(), + } + .assimilate_storage(&mut storage) + .unwrap(); + darwinia_staking::GenesisConfig:: { + collator_count: self.collator_count, + ..Default::default() + } + .assimilate_storage(&mut storage) + .unwrap(); + + let mut ext = sp_io::TestExternalities::from(storage); + + ext.execute_with(|| initialize_block(1)); + + ext + } +} diff --git a/pallet/staking/tests/tests.rs b/pallet/staking/tests/tests.rs new file mode 100644 index 000000000..5ee8a6aa7 --- /dev/null +++ b/pallet/staking/tests/tests.rs @@ -0,0 +1,488 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +mod mock; +use mock::*; + +// core +use core::time::Duration; +// darwinia +use darwinia_staking::*; +use dc_types::{Balance, UNIT}; +// substrate +use frame_support::{assert_ok, BoundedVec}; +use sp_runtime::{assert_eq_error_rate, Perbill}; + +#[test] +fn stake_should_work() { + ExtBuilder::default().build().execute_with(|| { + assert_eq!(System::account(1).consumers, 0); + assert!(Staking::ledger_of(1).is_none()); + assert_eq!(Balances::free_balance(1), 1_000 * UNIT); + assert_eq!(Assets::balance(0, 1), 1_000 * UNIT); + + // Stake 1 RING. + assert_ok!(Staking::stake(RuntimeOrigin::signed(1), UNIT, 0, Vec::new())); + assert_eq!(System::account(1).consumers, 1); + assert_eq!( + Staking::ledger_of(1).unwrap(), + Ledger { account: 1, staked_ring: UNIT, ..ZeroDefault::default() } + ); + assert_eq!(Balances::free_balance(1), 999 * UNIT); + + // Stake 1 KTON. + assert_eq!(System::account(1).consumers, 1); + assert_ok!(Staking::stake(RuntimeOrigin::signed(1), 0, UNIT, Vec::new())); + assert_eq!(Assets::balance(0, 1), 999 * UNIT); + assert_eq!( + Staking::ledger_of(1).unwrap(), + Ledger { account: 1, staked_ring: UNIT, staked_kton: UNIT, ..ZeroDefault::default() } + ); + + // Stake 1 deposit. + assert_eq!(System::account(1).consumers, 1); + assert_ok!(Deposit::lock(RuntimeOrigin::signed(1), UNIT, 1)); + assert_ok!(Staking::stake(RuntimeOrigin::signed(1), 0, 0, vec![0])); + assert_eq!( + Staking::ledger_of(1).unwrap(), + Ledger { + account: 1, + staked_ring: UNIT, + staked_kton: UNIT, + staked_deposits: BoundedVec::truncate_from(vec![0]), + ..ZeroDefault::default() + } + ); + + // Stake 500 RING, 500 KTON and 2 deposits. + assert_eq!(System::account(1).consumers, 1); + assert_ok!(Deposit::lock(RuntimeOrigin::signed(1), 200 * UNIT, 1)); + assert_ok!(Deposit::lock(RuntimeOrigin::signed(1), 200 * UNIT, 1)); + assert_ok!(Staking::stake(RuntimeOrigin::signed(1), 500 * UNIT, 500 * UNIT, vec![1, 2])); + assert_eq!(Balances::free_balance(1), 98 * UNIT); + assert_eq!(Assets::balance(0, 1), 499 * UNIT + 3_053_299_492_385_785); + assert_eq!( + Staking::ledger_of(1).unwrap(), + Ledger { + account: 1, + staked_ring: 501 * UNIT, + staked_kton: 501 * UNIT, + staked_deposits: BoundedVec::truncate_from(vec![0, 1, 2]), + ..ZeroDefault::default() + } + ); + }); +} + +#[test] +fn unstake_should_work() { + ExtBuilder::default().build().execute_with(|| { + assert_ok!(Deposit::lock(RuntimeOrigin::signed(1), UNIT, 1)); + assert_ok!(Deposit::lock(RuntimeOrigin::signed(1), UNIT, 1)); + assert_ok!(Deposit::lock(RuntimeOrigin::signed(1), UNIT, 1)); + assert_ok!(Staking::stake(RuntimeOrigin::signed(1), 2 * UNIT, 2 * UNIT, vec![0, 1, 2])); + assert_eq!(Balances::free_balance(1), 995 * UNIT); + assert_eq!(Assets::balance(0, 1), 998 * UNIT + 22_842_639_593_907); + assert_eq!( + Staking::ledger_of(1).unwrap(), + Ledger { + account: 1, + staked_ring: 2 * UNIT, + staked_kton: 2 * UNIT, + staked_deposits: BoundedVec::truncate_from(vec![0, 1, 2]), + ..ZeroDefault::default() + } + ); + + // Unstake 1 RING. + assert_ok!(Staking::unstake(RuntimeOrigin::signed(1), UNIT, 0, Vec::new())); + assert_eq!( + Staking::ledger_of(1).unwrap(), + Ledger { + account: 1, + staked_ring: 1 * UNIT, + staked_kton: 2 * UNIT, + staked_deposits: BoundedVec::truncate_from(vec![0, 1, 2]), + unstaking_ring: BoundedVec::truncate_from(vec![(UNIT, 4)]), + ..ZeroDefault::default() + } + ); + + // Unstake 1 KTON. + Efflux::block(1); + assert_ok!(Staking::unstake(RuntimeOrigin::signed(1), 0, UNIT, Vec::new())); + assert_eq!( + Staking::ledger_of(1).unwrap(), + Ledger { + account: 1, + staked_ring: 1 * UNIT, + staked_kton: 1 * UNIT, + staked_deposits: BoundedVec::truncate_from(vec![0, 1, 2]), + unstaking_ring: BoundedVec::truncate_from(vec![(UNIT, 4)]), + unstaking_kton: BoundedVec::truncate_from(vec![(UNIT, 5)]), + ..ZeroDefault::default() + } + ); + + // Unstake 1 deposit. + Efflux::block(1); + assert_ok!(Staking::unstake(RuntimeOrigin::signed(1), 0, 0, vec![0])); + assert_eq!( + Staking::ledger_of(1).unwrap(), + Ledger { + account: 1, + staked_ring: 1 * UNIT, + staked_kton: 1 * UNIT, + staked_deposits: BoundedVec::truncate_from(vec![1, 2]), + unstaking_ring: BoundedVec::truncate_from(vec![(UNIT, 4)]), + unstaking_kton: BoundedVec::truncate_from(vec![(UNIT, 5)]), + unstaking_deposits: BoundedVec::truncate_from(vec![(0, 6)]) + } + ); + + // Unstake 1 RING, 1 KTON and 2 deposits. + Efflux::block(1); + assert_ok!(Staking::unstake(RuntimeOrigin::signed(1), UNIT, UNIT, vec![1, 2])); + assert_eq!( + Staking::ledger_of(1).unwrap(), + Ledger { + account: 1, + staked_ring: 0, + staked_kton: 0, + staked_deposits: Default::default(), + unstaking_ring: BoundedVec::truncate_from(vec![(UNIT, 4), (UNIT, 7)]), + unstaking_kton: BoundedVec::truncate_from(vec![(UNIT, 5), (UNIT, 7)]), + unstaking_deposits: BoundedVec::truncate_from(vec![(0, 6), (1, 7), (2, 7)]) + } + ); + + // Keep the stakes for at least `MinStakingDuration`. + assert_eq!(Balances::free_balance(1), 995 * UNIT); + assert_eq!(Assets::balance(0, 1), 998 * UNIT + 22_842_639_593_907); + }); +} + +#[test] +fn claim_should_work() { + ExtBuilder::default().build().execute_with(|| { + assert_ok!(Deposit::lock(RuntimeOrigin::signed(1), UNIT, 1)); + assert_ok!(Deposit::lock(RuntimeOrigin::signed(1), UNIT, 1)); + assert_ok!(Deposit::lock(RuntimeOrigin::signed(1), UNIT, 1)); + assert_ok!(Staking::stake(RuntimeOrigin::signed(1), 2 * UNIT, 2 * UNIT, vec![0, 1, 2])); + assert_eq!(System::account(1).consumers, 1); + assert_ok!(Staking::unstake(RuntimeOrigin::signed(1), UNIT, 0, Vec::new())); + Efflux::block(1); + assert_ok!(Staking::unstake(RuntimeOrigin::signed(1), 0, UNIT, Vec::new())); + Efflux::block(1); + assert_ok!(Staking::unstake(RuntimeOrigin::signed(1), 0, 0, vec![0])); + Efflux::block(1); + assert_ok!(Staking::unstake(RuntimeOrigin::signed(1), UNIT, UNIT, vec![1, 2])); + assert_eq!(Balances::free_balance(1), 995 * UNIT); + assert_eq!(Assets::balance(0, 1), 998 * UNIT + 22_842_639_593_907); + assert_eq!( + Staking::ledger_of(1).unwrap(), + Ledger { + account: 1, + staked_ring: 0, + staked_kton: 0, + staked_deposits: Default::default(), + unstaking_ring: BoundedVec::truncate_from(vec![(UNIT, 4), (UNIT, 7)]), + unstaking_kton: BoundedVec::truncate_from(vec![(UNIT, 5), (UNIT, 7)]), + unstaking_deposits: BoundedVec::truncate_from(vec![(0, 6), (1, 7), (2, 7)]) + } + ); + + // 4 expired. + assert_ok!(Staking::claim(RuntimeOrigin::signed(1))); + assert_eq!(System::account(1).consumers, 1); + assert_eq!(Balances::free_balance(1), 996 * UNIT); + assert_eq!( + Staking::ledger_of(1).unwrap(), + Ledger { + account: 1, + staked_ring: 0, + staked_kton: 0, + staked_deposits: Default::default(), + unstaking_ring: BoundedVec::truncate_from(vec![(UNIT, 7)]), + unstaking_kton: BoundedVec::truncate_from(vec![(UNIT, 5), (UNIT, 7)]), + unstaking_deposits: BoundedVec::truncate_from(vec![(0, 6), (1, 7), (2, 7)]) + } + ); + + // 5 expired. + Efflux::block(1); + assert_ok!(Staking::claim(RuntimeOrigin::signed(1))); + assert_eq!(System::account(1).consumers, 1); + assert_eq!(Assets::balance(0, 1), 999 * UNIT + 22_842_639_593_907); + assert_eq!( + Staking::ledger_of(1).unwrap(), + Ledger { + account: 1, + staked_ring: 0, + staked_kton: 0, + staked_deposits: Default::default(), + unstaking_ring: BoundedVec::truncate_from(vec![(UNIT, 7)]), + unstaking_kton: BoundedVec::truncate_from(vec![(UNIT, 7)]), + unstaking_deposits: BoundedVec::truncate_from(vec![(0, 6), (1, 7), (2, 7)]) + } + ); + + // 6 expired. + Efflux::block(1); + assert_ok!(Staking::claim(RuntimeOrigin::signed(1))); + assert_eq!(System::account(1).consumers, 1); + assert_eq!(Assets::balance(0, 1), 999 * UNIT + 22_842_639_593_907); + assert_eq!( + Staking::ledger_of(1).unwrap(), + Ledger { + account: 1, + staked_ring: 0, + staked_kton: 0, + staked_deposits: Default::default(), + unstaking_ring: BoundedVec::truncate_from(vec![(UNIT, 7)]), + unstaking_kton: BoundedVec::truncate_from(vec![(UNIT, 7)]), + unstaking_deposits: BoundedVec::truncate_from(vec![(1, 7), (2, 7)]) + } + ); + + // 7 expired. + Efflux::block(2); + assert_ok!(Staking::claim(RuntimeOrigin::signed(1))); + assert_eq!(System::account(1).consumers, 0); + assert_eq!(Balances::free_balance(1), 997 * UNIT); + assert_eq!(Assets::balance(0, 1), 1_000 * UNIT + 22_842_639_593_907); + assert!(Staking::ledger_of(1).is_none()); + }); +} + +#[test] +fn collect_should_work() { + ExtBuilder::default().build().execute_with(|| { + assert!(Staking::collator_of(1).is_none()); + assert_ok!(Staking::stake(RuntimeOrigin::signed(1), UNIT, 0, Vec::new())); + + (0..=100).for_each(|c| { + let c = Perbill::from_percent(c); + + assert_ok!(Staking::collect(RuntimeOrigin::signed(1), c)); + assert_eq!(Staking::collator_of(1).unwrap(), c); + }); + }); +} + +#[test] +fn nominate_should_work() { + ExtBuilder::default().build().execute_with(|| { + assert_ok!(Staking::stake(RuntimeOrigin::signed(1), UNIT, 0, Vec::new())); + assert_ok!(Staking::collect(RuntimeOrigin::signed(1), Default::default())); + + (2..=10).for_each(|n| { + assert!(Staking::nominator_of(n).is_none()); + assert_ok!(Staking::stake(RuntimeOrigin::signed(n), UNIT, 0, Vec::new())); + assert_ok!(Staking::nominate(RuntimeOrigin::signed(n), 1)); + assert_eq!(Staking::nominator_of(n).unwrap(), 1); + }); + }); +} + +#[test] +fn chill_should_work() { + ExtBuilder::default().build().execute_with(|| { + assert_ok!(Staking::stake(RuntimeOrigin::signed(1), UNIT, 0, Vec::new())); + assert_ok!(Staking::collect(RuntimeOrigin::signed(1), Default::default())); + (2..=10).for_each(|n| { + assert_ok!(Staking::stake(RuntimeOrigin::signed(n), UNIT, 0, Vec::new())); + assert_ok!(Staking::nominate(RuntimeOrigin::signed(n), 1)); + }); + assert!(Staking::collator_of(1).is_some()); + (2..=10).for_each(|n| assert!(Staking::nominator_of(n).is_some())); + + (1..=10).for_each(|i| { + assert_ok!(Staking::chill(RuntimeOrigin::signed(i))); + }); + assert!(Staking::collator_of(1).is_none()); + (2..=10).for_each(|n| assert!(Staking::nominator_of(n).is_none())); + }); +} + +#[test] +fn power_should_work() { + ExtBuilder::default().build().execute_with(|| { + assert_eq!(Staking::power_of(&1), 0); + assert_eq!(Staking::power_of(&2), 0); + assert_eq!(Staking::power_of(&3), 0); + assert_eq!(Staking::power_of(&4), 0); + + // 1 stakes 1 RING. + assert_ok!(Staking::stake(RuntimeOrigin::signed(1), UNIT, 0, Vec::new())); + assert_eq!(Staking::power_of(&1), 500_000_000); + + // 2 stakes 1 KTON. + assert_ok!(Staking::stake(RuntimeOrigin::signed(2), 0, UNIT, Vec::new())); + assert_eq!(Staking::power_of(&1), 500_000_000); + assert_eq!(Staking::power_of(&2), 500_000_000); + + // 3 stakes 1 deposit. + assert_ok!(Deposit::lock(RuntimeOrigin::signed(3), UNIT, 1)); + assert_ok!(Staking::stake(RuntimeOrigin::signed(3), 0, 0, vec![0])); + assert_eq!(Staking::power_of(&1), 250_000_000); + assert_eq!(Staking::power_of(&2), 500_000_000); + assert_eq!(Staking::power_of(&3), 250_000_000); + + // 4 stakes 1 KTON. + assert_ok!(Staking::stake(RuntimeOrigin::signed(4), 0, UNIT, Vec::new())); + assert_eq!(Staking::power_of(&1), 250_000_000); + assert_eq!(Staking::power_of(&2), 250_000_000); + assert_eq!(Staking::power_of(&3), 250_000_000); + assert_eq!(Staking::power_of(&4), 250_000_000); + + // 1 unstakes 1 RING. + assert_ok!(Staking::unstake(RuntimeOrigin::signed(1), UNIT, 0, Vec::new())); + assert_eq!(Staking::power_of(&1), 0); + assert_eq!(Staking::power_of(&2), 250_000_000); + assert_eq!(Staking::power_of(&3), 500_000_000); + assert_eq!(Staking::power_of(&4), 250_000_000); + + // 2 unstakes 1 KTON. + assert_ok!(Staking::unstake(RuntimeOrigin::signed(2), 0, UNIT, Vec::new())); + assert_eq!(Staking::power_of(&1), 0); + assert_eq!(Staking::power_of(&2), 0); + assert_eq!(Staking::power_of(&3), 500_000_000); + assert_eq!(Staking::power_of(&4), 500_000_000); + + // 3 unstakes 1 deposit. + assert_ok!(Deposit::lock(RuntimeOrigin::signed(3), UNIT, 1)); + assert_ok!(Staking::unstake(RuntimeOrigin::signed(3), 0, 0, vec![0])); + assert_eq!(Staking::power_of(&1), 0); + assert_eq!(Staking::power_of(&2), 0); + assert_eq!(Staking::power_of(&3), 0); + assert_eq!(Staking::power_of(&4), 500_000_000); + + // 4 unstakes 1 KTON. + assert_ok!(Staking::unstake(RuntimeOrigin::signed(4), 0, UNIT, Vec::new())); + assert_eq!(Staking::power_of(&1), 0); + assert_eq!(Staking::power_of(&2), 0); + assert_eq!(Staking::power_of(&3), 0); + assert_eq!(Staking::power_of(&4), 0); + }); +} + +#[test] +fn elect_should_work() { + ExtBuilder::default().collator_count(3).build().execute_with(|| { + (1..=5).for_each(|i| { + assert_ok!(Staking::stake( + RuntimeOrigin::signed(i), + i as Balance * UNIT, + UNIT, + Vec::new() + )); + assert_ok!(Staking::collect(RuntimeOrigin::signed(i), Default::default())); + }); + (6..=10).for_each(|i| { + assert_ok!(Staking::stake( + RuntimeOrigin::signed(i), + 0, + (11 - i as Balance) * UNIT, + Vec::new() + )); + assert_ok!(Staking::nominate(RuntimeOrigin::signed(i), i - 5)); + }); + + assert_eq!(Staking::elect(), vec![5, 4, 3]); + }); + ExtBuilder::default().collator_count(3).build().execute_with(|| { + (1..=5).for_each(|i| { + assert_ok!(Staking::stake( + RuntimeOrigin::signed(i), + i as Balance * UNIT, + 0, + Vec::new() + )); + assert_ok!(Staking::collect(RuntimeOrigin::signed(i), Default::default())); + }); + (6..=10).for_each(|i| { + assert_ok!(Staking::stake( + RuntimeOrigin::signed(i), + UNIT, + (11 - i as Balance) * UNIT, + Vec::new() + )); + assert_ok!(Staking::nominate(RuntimeOrigin::signed(i), i - 5)); + }); + + assert_eq!(Staking::elect(), vec![1, 2, 3]); + }); +} + +#[test] +fn payout_should_work() { + ExtBuilder::default().collator_count(5).build().execute_with(|| { + (1..=5).for_each(|i| { + assert_ok!(Staking::stake( + RuntimeOrigin::signed(i), + 0, + i as Balance * UNIT, + Vec::new() + )); + assert_ok!(Staking::collect(RuntimeOrigin::signed(i), Perbill::from_percent(i * 10))); + }); + (6..=10).for_each(|i| { + assert_ok!(Staking::stake( + RuntimeOrigin::signed(i), + 0, + (11 - i as Balance) * UNIT, + Vec::new() + )); + assert_ok!(Staking::nominate(RuntimeOrigin::signed(i), i - 5)); + }); + Staking::elect(); + Staking::reward_by_ids(&[(1, 20), (2, 20), (3, 20), (4, 20), (5, 20)]); + (1..=10).for_each(|i| assert_eq!(Balances::free_balance(i), 1_000 * UNIT)); + + let session_duration = Duration::new(6 * 60 * 60, 0).as_millis(); + Staking::payout(session_duration, Staking::elapsed_time()); + let rewards = [ + 683_059_435_062_369_982_561_u128, + 1_275_044_256_196_592_252_422, + 1_775_954_509_850_707_836_449, + 2_185_790_171_434_577_367_478, + 2_504_551_227_287_012_308_196, + 2_049_178_272_400_257_458_130, + 1_457_193_451_266_035_188_269, + 956_283_197_611_919_604_242, + 546_447_536_028_050_073_213, + 227_686_480_175_615_132_495, + ]; + (1..=10) + .zip(rewards.iter()) + .for_each(|(i, r)| assert_eq!(Balances::free_balance(i), 1_000 * UNIT + r)); + assert_eq_error_rate!( + ::PayoutFraction::get() + * dc_inflation::in_period( + dc_inflation::TOTAL_SUPPLY - Balances::total_issuance(), + session_duration, + 0 + ) + .unwrap(), + rewards.iter().sum::(), + // Error rate 0.02 RING + 2 * UNIT / 100 + ); + }); +} diff --git a/precompiles/assets/Cargo.toml b/precompile/assets/Cargo.toml similarity index 100% rename from precompiles/assets/Cargo.toml rename to precompile/assets/Cargo.toml diff --git a/precompiles/assets/src/lib.rs b/precompile/assets/src/lib.rs similarity index 98% rename from precompiles/assets/src/lib.rs rename to precompile/assets/src/lib.rs index fbdcf8b78..07be5077f 100644 --- a/precompiles/assets/src/lib.rs +++ b/precompile/assets/src/lib.rs @@ -224,7 +224,7 @@ where let value = Self::u256_to_amount(value).in_field("value")?; { let caller: AccountIdOf = handle.context().caller.into(); - let from: AccountIdOf = from.clone().into(); + let from: AccountIdOf = from.into(); let to: AccountIdOf = to.into(); // If caller is "from", it can spend as much as it wants from its own balance. @@ -300,7 +300,7 @@ where let value = Self::u256_to_amount(value).in_field("value")?; { let origin: AccountIdOf = handle.context().caller.into(); - let to: AccountIdOf = to.clone().into(); + let to: AccountIdOf = to.into(); RuntimeHelper::::try_dispatch( handle, @@ -334,7 +334,7 @@ where let value = Self::u256_to_amount(value).in_field("value")?; { let origin: AccountIdOf = handle.context().caller.into(); - let from: AccountIdOf = from.clone().into(); + let from: AccountIdOf = from.into(); RuntimeHelper::::try_dispatch( handle, diff --git a/precompiles/assets/src/mock.rs b/precompile/assets/src/mock.rs similarity index 100% rename from precompiles/assets/src/mock.rs rename to precompile/assets/src/mock.rs diff --git a/precompiles/assets/src/tests.rs b/precompile/assets/src/tests.rs similarity index 100% rename from precompiles/assets/src/tests.rs rename to precompile/assets/src/tests.rs diff --git a/precompiles/bls12-381/Cargo.toml b/precompile/bls12-381/Cargo.toml similarity index 98% rename from precompiles/bls12-381/Cargo.toml rename to precompile/bls12-381/Cargo.toml index 396855bfb..c02145ee7 100644 --- a/precompiles/bls12-381/Cargo.toml +++ b/precompile/bls12-381/Cargo.toml @@ -20,7 +20,7 @@ pallet-evm = { default-features = false, git = "https://github.com/paritytech/fr # moonbeam precompile-utils = { default-features = false, git = "https://github.com/darwinia-network/moonbeam.git", branch = "polkadot-v0.9.30" } -# paritytech +# substrate frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } @@ -32,7 +32,7 @@ scale-info = { version = "2.3", features = ["derive"] } # moonbeam precompile-utils = { git = "https://github.com/darwinia-network/moonbeam.git", branch = "polkadot-v0.9.30", features = ["testing"] } -# paritytech +# substrate frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } @@ -50,7 +50,7 @@ std = [ # moonbeam "precompile-utils/std", - # paritytech + # substrate "frame-support/std", "sp-std/std", ] diff --git a/precompiles/bls12-381/src/lib.rs b/precompile/bls12-381/src/lib.rs similarity index 100% rename from precompiles/bls12-381/src/lib.rs rename to precompile/bls12-381/src/lib.rs diff --git a/precompiles/state-storage/Cargo.toml b/precompile/state-storage/Cargo.toml similarity index 98% rename from precompiles/state-storage/Cargo.toml rename to precompile/state-storage/Cargo.toml index edd52a2b8..45d396d96 100644 --- a/precompiles/state-storage/Cargo.toml +++ b/precompile/state-storage/Cargo.toml @@ -17,7 +17,7 @@ pallet-evm = { default-features = false, git = "https://github.com/paritytech/fr # moonbeam precompile-utils = { default-features = false, git = "https://github.com/darwinia-network/moonbeam.git", branch = "polkadot-v0.9.30" } -# paritytech +# substrate frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } @@ -29,7 +29,7 @@ scale-info = { version = "2.3", features = ["derive"] } # moonbeam precompile-utils = { git = "https://github.com/darwinia-network/moonbeam.git", branch = "polkadot-v0.9.30", features = ["testing"] } -# paritytech +# substrate frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } @@ -47,7 +47,7 @@ std = [ # moonbeam "precompile-utils/std", - # paritytech + # substrate "frame-support/std", "sp-std/std", ] diff --git a/precompiles/state-storage/src/lib.rs b/precompile/state-storage/src/lib.rs similarity index 100% rename from precompiles/state-storage/src/lib.rs rename to precompile/state-storage/src/lib.rs diff --git a/precompiles/state-storage/src/mock.rs b/precompile/state-storage/src/mock.rs similarity index 100% rename from precompiles/state-storage/src/mock.rs rename to precompile/state-storage/src/mock.rs diff --git a/precompiles/state-storage/src/tests.rs b/precompile/state-storage/src/tests.rs similarity index 100% rename from precompiles/state-storage/src/tests.rs rename to precompile/state-storage/src/tests.rs diff --git a/runtime/common/src/gov_origin.rs b/runtime/common/src/gov_origin.rs index 814c1e921..1d34450f1 100644 --- a/runtime/common/src/gov_origin.rs +++ b/runtime/common/src/gov_origin.rs @@ -16,12 +16,12 @@ // You should have received a copy of the GNU General Public License // along with Darwinia. If not, see . -// paritytech +// darwinia +use dc_primitives::AccountId; +// substrate use frame_support::traits::EitherOfDiverse; use frame_system::EnsureRoot; use pallet_collective::{EnsureProportionAtLeast, EnsureProportionMoreThan}; -// darwinia -use dc_primitives::AccountId; pub type Root = EnsureRoot; diff --git a/runtime/common/src/lib.rs b/runtime/common/src/lib.rs index 7b0c65c68..1b10adbd4 100644 --- a/runtime/common/src/lib.rs +++ b/runtime/common/src/lib.rs @@ -17,9 +17,11 @@ // along with Darwinia. If not, see . #![cfg_attr(not(feature = "std"), no_std)] +// TODO: +// #![deny(missing_docs)] pub mod gov_origin; -pub mod xcm_barrier; +pub mod xcm_configs; pub use bp_darwinia_core as bp_crab; pub use bp_darwinia_core as bp_darwinia; diff --git a/runtime/common/src/xcm_barrier.rs b/runtime/common/src/xcm_configs.rs similarity index 94% rename from runtime/common/src/xcm_barrier.rs rename to runtime/common/src/xcm_configs.rs index 5fcb135f6..fda13a2ce 100644 --- a/runtime/common/src/xcm_barrier.rs +++ b/runtime/common/src/xcm_configs.rs @@ -18,11 +18,16 @@ // core use core::marker::PhantomData; +// darwinia +use dc_primitives::GWEI; // polkadot use xcm::latest::{prelude::*, Weight as XCMWeight}; use xcm_executor::traits::ShouldExecute; // substrate -use frame_support::log; +use frame_support::{log, traits::ConstU128}; + +/// Base balance required for the XCM unit weight. +pub type XcmBaseWeightFee = ConstU128; frame_support::match_types! { pub type ParentOrParentsExecutivePlurality: impl Contains = { diff --git a/runtime/crab/Cargo.toml b/runtime/crab/Cargo.toml index 82407bfcd..370e34636 100644 --- a/runtime/crab/Cargo.toml +++ b/runtime/crab/Cargo.toml @@ -37,10 +37,10 @@ cumulus-pallet-session-benchmarking = { optional = true, default-features = fals # darwinia darwinia-common-runtime = { default-features = false, path = "../common" } -darwinia-message-transact = { default-features = false, path = "../../pallets/message-transact" } -darwinia-precompile-assets = { default-features = false, path = "../../precompiles/assets" } -darwinia-precompile-bls12-381 = { default-features = false, path = "../../precompiles/bls12-381" } -darwinia-precompile-state-storage = { default-features = false, path = "../../precompiles/state-storage" } +darwinia-message-transact = { default-features = false, path = "../../pallet/message-transact" } +darwinia-precompile-assets = { default-features = false, path = "../../precompile/assets" } +darwinia-precompile-bls12-381 = { default-features = false, path = "../../precompile/bls12-381" } +darwinia-precompile-state-storage = { default-features = false, path = "../../precompile/state-storage" } dc-primitives = { default-features = false, path = "../../core/primitives" } # darwinia-messages-substrate diff --git a/runtime/crab/src/lib.rs b/runtime/crab/src/lib.rs index d9ff10911..e0963fb87 100644 --- a/runtime/crab/src/lib.rs +++ b/runtime/crab/src/lib.rs @@ -273,9 +273,9 @@ frame_support::construct_runtime! { // Monetary stuff. // Leave 4 here. // To keep balances consistent with the existing XCM configurations. - Assets: pallet_assets = 34, Balances: pallet_balances = 5, TransactionPayment: pallet_transaction_payment = 6, + Assets: pallet_assets = 34, // Consensus stuff. Authorship: pallet_authorship = 7, diff --git a/runtime/crab/src/pallets/assets.rs b/runtime/crab/src/pallets/assets.rs index 1e59c1fec..d649ffa49 100644 --- a/runtime/crab/src/pallets/assets.rs +++ b/runtime/crab/src/pallets/assets.rs @@ -19,14 +19,12 @@ // darwinia use crate::*; -pub type AssetId = u64; - impl pallet_assets::Config for Runtime { type ApprovalDeposit = ConstU128<0>; type AssetAccountDeposit = ConstU128<0>; type AssetDeposit = ConstU128<0>; type AssetId = AssetId; - type Balance = u128; + type Balance = Balance; type Currency = Balances; type Extra = (); // TODO: Restrict the create asset origin. https://github.com/paritytech/substrate/pull/12586 diff --git a/runtime/crab/src/pallets/bridge_dispatch.rs b/runtime/crab/src/pallets/bridge_dispatch.rs index 963e98b74..9a06180d1 100644 --- a/runtime/crab/src/pallets/bridge_dispatch.rs +++ b/runtime/crab/src/pallets/bridge_dispatch.rs @@ -84,7 +84,7 @@ impl IntoDispatchOriginT for IntoDispatch RuntimeCall::MessageTransact(darwinia_message_transact::Call::message_transact { .. }) => darwinia_message_transact::LcmpEthOrigin::MessageTransact(H160(id.0)).into(), - _ => frame_system::RawOrigin::Signed(id.clone()).into(), + _ => frame_system::RawOrigin::Signed(*id).into(), } } } diff --git a/runtime/crab/src/pallets/bridge_messages.rs b/runtime/crab/src/pallets/bridge_messages.rs index bd260b878..c38ea6d98 100644 --- a/runtime/crab/src/pallets/bridge_messages.rs +++ b/runtime/crab/src/pallets/bridge_messages.rs @@ -31,7 +31,7 @@ impl SenderOrigin for RuntimeOrigin { fn linked_account(&self) -> Option { match self.caller { OriginCaller::system(frame_system::RawOrigin::Signed(ref submitter)) => - Some(submitter.clone()), + Some(*submitter), _ => None, } } diff --git a/runtime/crab/src/pallets/mod.rs b/runtime/crab/src/pallets/mod.rs index 1df2a00f4..96d7c9236 100644 --- a/runtime/crab/src/pallets/mod.rs +++ b/runtime/crab/src/pallets/mod.rs @@ -35,13 +35,12 @@ mod timestamp; mod parachain_info_; // Monetary stuff. -mod assets; -pub use assets::*; - mod balances; mod transaction_payment; +mod assets; + // Consensus stuff. mod authorship; diff --git a/runtime/crab/src/pallets/polkadot_xcm.rs b/runtime/crab/src/pallets/polkadot_xcm.rs index 15fa2c0b0..997faaa5c 100644 --- a/runtime/crab/src/pallets/polkadot_xcm.rs +++ b/runtime/crab/src/pallets/polkadot_xcm.rs @@ -18,7 +18,7 @@ // darwinia use crate::*; -use darwinia_common_runtime::xcm_barrier::*; +use darwinia_common_runtime::xcm_configs::*; // moonbeam use xcm_primitives::*; // polkadot @@ -121,7 +121,7 @@ impl xcm_executor::Config for XcmExecutorConfig { type RuntimeCall = RuntimeCall; type SubscriptionService = PolkadotXcm; type Trader = UsingComponents< - ConstantMultiplier>, + ConstantMultiplier, AnchoringSelfReserve, AccountId, Balances, diff --git a/runtime/darwinia/Cargo.toml b/runtime/darwinia/Cargo.toml index 01f3a8982..01ee28c50 100644 --- a/runtime/darwinia/Cargo.toml +++ b/runtime/darwinia/Cargo.toml @@ -30,17 +30,18 @@ cumulus-pallet-xcmp-queue = { default-features = false, git = "https://git cumulus-primitives-core = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } cumulus-primitives-timestamp = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } cumulus-primitives-utility = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } -pallet-collator-selection = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } parachain-info = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } # cumulus optional cumulus-pallet-session-benchmarking = { optional = true, default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } # darwinia darwinia-common-runtime = { default-features = false, path = "../common" } -darwinia-message-transact = { default-features = false, path = "../../pallets/message-transact" } -darwinia-precompile-assets = { default-features = false, path = "../../precompiles/assets" } -darwinia-precompile-bls12-381 = { default-features = false, path = "../../precompiles/bls12-381" } -darwinia-precompile-state-storage = { default-features = false, path = "../../precompiles/state-storage" } +darwinia-deposit = { default-features = false, path = "../../pallet/deposit" } +darwinia-message-transact = { default-features = false, path = "../../pallet/message-transact" } +darwinia-precompile-assets = { default-features = false, path = "../../precompile/assets" } +darwinia-precompile-bls12-381 = { default-features = false, path = "../../precompile/bls12-381" } +darwinia-precompile-state-storage = { default-features = false, path = "../../precompile/state-storage" } +darwinia-staking = { default-features = false, path = "../../pallet/staking" } dc-primitives = { default-features = false, path = "../../core/primitives" } # darwinia-messages-substrate @@ -67,7 +68,7 @@ pallet-evm-precompile-modexp = { default-features = false, git = "https://gith pallet-evm-precompile-simple = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } # moonbeam -precompile-utils = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.30"} +precompile-utils = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.30" } xcm-primitives = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.30" } # polkadot @@ -124,6 +125,7 @@ frame-try-runtime = { optional = true, default-features = false, git = " [features] default = ["std"] +production = [] std = [ # crates.io "codec/std", @@ -138,17 +140,18 @@ std = [ "cumulus-primitives-core/std", "cumulus-primitives-timestamp/std", "cumulus-primitives-utility/std", - "pallet-collator-selection/std", "parachain-info/std", # cumulus optional "cumulus-pallet-session-benchmarking?/std", # darwinia "darwinia-common-runtime/std", + "darwinia-deposit/std", "darwinia-message-transact/std", "darwinia-precompile-assets/std", "darwinia-precompile-bls12-381/std", "darwinia-precompile-state-storage/std", + "darwinia-staking/std", "dc-primitives/std", # darwinia-messages-substrate @@ -237,7 +240,6 @@ runtime-benchmarks = [ "array-bytes", # cumulus - "pallet-collator-selection/runtime-benchmarks", "cumulus-pallet-parachain-system/runtime-benchmarks", "cumulus-pallet-xcmp-queue/runtime-benchmarks", # cumulus optional @@ -295,7 +297,6 @@ try-runtime = [ "cumulus-pallet-parachain-system/try-runtime", "cumulus-pallet-xcm/try-runtime", "cumulus-pallet-xcmp-queue/try-runtime", - "pallet-collator-selection/try-runtime", "parachain-info/try-runtime", # frontier diff --git a/runtime/darwinia/src/lib.rs b/runtime/darwinia/src/lib.rs index 15ecc0e06..20dfba24a 100644 --- a/runtime/darwinia/src/lib.rs +++ b/runtime/darwinia/src/lib.rs @@ -40,7 +40,6 @@ use cumulus_pallet_parachain_system::RelayNumberStrictlyIncreases; // darwinia use dc_primitives::*; // polkadot -use xcm::latest::prelude::BodyId; use xcm_executor::XcmExecutor; // substrate use frame_support::{ @@ -50,7 +49,6 @@ use frame_support::{ ConstantMultiplier, Weight, WeightToFeeCoefficient, WeightToFeeCoefficients, WeightToFeePolynomial, }, - PalletId, }; use frame_system::EnsureRoot; use sp_core::{crypto::KeyTypeId, OpaqueMetadata, H160, H256, U256}; @@ -273,13 +271,14 @@ frame_support::construct_runtime! { // Monetary stuff. // Leave 4 here. // To keep balances consistent with the existing XCM configurations. - Assets: pallet_assets = 34, Balances: pallet_balances = 5, TransactionPayment: pallet_transaction_payment = 6, + Assets: pallet_assets = 34, + Deposit: darwinia_deposit = 40, // Consensus stuff. Authorship: pallet_authorship = 7, - CollatorSelection: pallet_collator_selection = 8, + Staking: darwinia_staking = 8, Session: pallet_session = 9, Aura: pallet_aura = 10, AuraExt: cumulus_pallet_aura_ext = 11, diff --git a/runtime/darwinia/src/pallets/assets.rs b/runtime/darwinia/src/pallets/assets.rs index 1e59c1fec..d649ffa49 100644 --- a/runtime/darwinia/src/pallets/assets.rs +++ b/runtime/darwinia/src/pallets/assets.rs @@ -19,14 +19,12 @@ // darwinia use crate::*; -pub type AssetId = u64; - impl pallet_assets::Config for Runtime { type ApprovalDeposit = ConstU128<0>; type AssetAccountDeposit = ConstU128<0>; type AssetDeposit = ConstU128<0>; type AssetId = AssetId; - type Balance = u128; + type Balance = Balance; type Currency = Balances; type Extra = (); // TODO: Restrict the create asset origin. https://github.com/paritytech/substrate/pull/12586 diff --git a/runtime/darwinia/src/pallets/authorship.rs b/runtime/darwinia/src/pallets/authorship.rs index eb48e3bdb..d2a61afc7 100644 --- a/runtime/darwinia/src/pallets/authorship.rs +++ b/runtime/darwinia/src/pallets/authorship.rs @@ -20,7 +20,7 @@ use crate::*; impl pallet_authorship::Config for Runtime { - type EventHandler = (CollatorSelection,); + type EventHandler = (Staking,); type FilterUncle = (); type FindAuthor = pallet_session::FindAccountFromAuthorIndex; type UncleGenerations = ConstU32<0>; diff --git a/runtime/darwinia/src/pallets/bridge_dispatch.rs b/runtime/darwinia/src/pallets/bridge_dispatch.rs index 361c23f64..eee1acc0c 100644 --- a/runtime/darwinia/src/pallets/bridge_dispatch.rs +++ b/runtime/darwinia/src/pallets/bridge_dispatch.rs @@ -84,7 +84,7 @@ impl IntoDispatchOriginT for IntoDispatch RuntimeCall::MessageTransact(darwinia_message_transact::Call::message_transact { .. }) => darwinia_message_transact::LcmpEthOrigin::MessageTransact(H160(id.0)).into(), - _ => frame_system::RawOrigin::Signed(id.clone()).into(), + _ => frame_system::RawOrigin::Signed(*id).into(), } } } diff --git a/runtime/darwinia/src/pallets/bridge_messages.rs b/runtime/darwinia/src/pallets/bridge_messages.rs index 544f5a894..c6eba469a 100644 --- a/runtime/darwinia/src/pallets/bridge_messages.rs +++ b/runtime/darwinia/src/pallets/bridge_messages.rs @@ -31,7 +31,7 @@ impl SenderOrigin for RuntimeOrigin { fn linked_account(&self) -> Option { match self.caller { OriginCaller::system(frame_system::RawOrigin::Signed(ref submitter)) => - Some(submitter.clone()), + Some(*submitter), _ => None, } } diff --git a/runtime/darwinia/src/pallets/collator_selection.rs b/runtime/darwinia/src/pallets/collator_selection.rs deleted file mode 100644 index 610420061..000000000 --- a/runtime/darwinia/src/pallets/collator_selection.rs +++ /dev/null @@ -1,47 +0,0 @@ -// This file is part of Darwinia. -// -// Copyright (C) 2018-2022 Darwinia Network -// SPDX-License-Identifier: GPL-3.0 -// -// Darwinia is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// Darwinia 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 Darwinia. If not, see . - -// darwinia -use crate::*; - -// We allow root only to execute privileged collator selection operations. -pub type CollatorSelectionUpdateOrigin = EnsureRoot; -frame_support::parameter_types! { - pub const PotId: PalletId = PalletId(*b"PotStake"); - pub const MaxCandidates: u32 = 1000; - pub const MinCandidates: u32 = 5; - pub const SessionLength: BlockNumber = 6 * HOURS; - pub const MaxInvulnerables: u32 = 100; - pub const ExecutiveBody: BodyId = BodyId::Executive; -} - -impl pallet_collator_selection::Config for Runtime { - type Currency = Balances; - // should be a multiple of session or things will get inconsistent - type KickThreshold = Period; - type MaxCandidates = MaxCandidates; - type MaxInvulnerables = MaxInvulnerables; - type MinCandidates = MinCandidates; - type PotId = PotId; - type RuntimeEvent = RuntimeEvent; - type UpdateOrigin = CollatorSelectionUpdateOrigin; - type ValidatorId = ::AccountId; - type ValidatorIdOf = pallet_collator_selection::IdentityCollator; - type ValidatorRegistration = Session; - type WeightInfo = weights::pallet_collator_selection::WeightInfo; -} diff --git a/runtime/darwinia/src/pallets/deposit.rs b/runtime/darwinia/src/pallets/deposit.rs new file mode 100644 index 000000000..5eadb228c --- /dev/null +++ b/runtime/darwinia/src/pallets/deposit.rs @@ -0,0 +1,38 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +pub enum KtonMinting {} +impl darwinia_deposit::Minting for KtonMinting { + type AccountId = AccountId; + + fn mint(beneficiary: &Self::AccountId, amount: Balance) -> sp_runtime::DispatchResult { + Assets::mint(RuntimeOrigin::root(), 0, *beneficiary, amount) + } +} + +impl darwinia_deposit::Config for Runtime { + type Kton = KtonMinting; + type MaxDeposits = frame_support::traits::ConstU32<16>; + type MinLockingAmount = frame_support::traits::ConstU128; + type Ring = Balances; + type RuntimeEvent = RuntimeEvent; + type UnixTime = Timestamp; +} diff --git a/runtime/darwinia/src/pallets/mod.rs b/runtime/darwinia/src/pallets/mod.rs index 1df2a00f4..40b660f6b 100644 --- a/runtime/darwinia/src/pallets/mod.rs +++ b/runtime/darwinia/src/pallets/mod.rs @@ -35,17 +35,18 @@ mod timestamp; mod parachain_info_; // Monetary stuff. -mod assets; -pub use assets::*; - mod balances; mod transaction_payment; +mod assets; + +mod deposit; + // Consensus stuff. mod authorship; -mod collator_selection; +mod staking; mod session; pub use session::*; diff --git a/runtime/darwinia/src/pallets/polkadot_xcm.rs b/runtime/darwinia/src/pallets/polkadot_xcm.rs index 308f7a10f..0aabb755b 100644 --- a/runtime/darwinia/src/pallets/polkadot_xcm.rs +++ b/runtime/darwinia/src/pallets/polkadot_xcm.rs @@ -18,7 +18,7 @@ // darwinia use crate::*; -use darwinia_common_runtime::xcm_barrier::*; +use darwinia_common_runtime::xcm_configs::*; // moonbeam use xcm_primitives::*; // polkadot @@ -121,7 +121,7 @@ impl xcm_executor::Config for XcmExecutorConfig { type RuntimeCall = RuntimeCall; type SubscriptionService = PolkadotXcm; type Trader = UsingComponents< - ConstantMultiplier>, + ConstantMultiplier, AnchoringSelfReserve, AccountId, Balances, diff --git a/runtime/darwinia/src/pallets/session.rs b/runtime/darwinia/src/pallets/session.rs index 7725500ed..bb36bdc36 100644 --- a/runtime/darwinia/src/pallets/session.rs +++ b/runtime/darwinia/src/pallets/session.rs @@ -25,21 +25,27 @@ sp_runtime::impl_opaque_keys! { } } +#[cfg(feature = "production")] frame_support::parameter_types! { pub const Period: u32 = 6 * HOURS; pub const Offset: u32 = 0; } +#[cfg(not(feature = "production"))] +frame_support::parameter_types! { + pub const Period: u32 = 2 * MINUTES; + pub const Offset: u32 = 0; +} impl pallet_session::Config for Runtime { type Keys = SessionKeys; type NextSessionRotation = pallet_session::PeriodicSessions; type RuntimeEvent = RuntimeEvent; - // Essentially just Aura, but lets be pedantic. + // Essentially just AURA, but lets be pedantic. type SessionHandler = ::KeyTypeIdProviders; - type SessionManager = CollatorSelection; + type SessionManager = Staking; type ShouldEndSession = pallet_session::PeriodicSessions; type ValidatorId = ::AccountId; - // we don't have stash and controller, thus we don't need the convert as well. - type ValidatorIdOf = pallet_collator_selection::IdentityCollator; + // We don't have stash and controller, thus we don't need the convert as well. + type ValidatorIdOf = darwinia_staking::IdentityCollator; type WeightInfo = weights::pallet_session::WeightInfo; } diff --git a/runtime/darwinia/src/pallets/staking.rs b/runtime/darwinia/src/pallets/staking.rs new file mode 100644 index 000000000..aaabc41c1 --- /dev/null +++ b/runtime/darwinia/src/pallets/staking.rs @@ -0,0 +1,75 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +pub enum RingStaking {} +impl darwinia_staking::Stake for RingStaking { + type AccountId = AccountId; + type Item = Balance; + + fn stake(who: &Self::AccountId, item: Self::Item) -> sp_runtime::DispatchResult { + >::transfer( + who, + &darwinia_staking::account_id(), + item, + frame_support::traits::ExistenceRequirement::KeepAlive, + ) + } + + fn unstake(who: &Self::AccountId, item: Self::Item) -> sp_runtime::DispatchResult { + >::transfer( + &darwinia_staking::account_id(), + who, + item, + frame_support::traits::ExistenceRequirement::AllowDeath, + ) + } +} +pub enum KtonStaking {} +impl darwinia_staking::Stake for KtonStaking { + type AccountId = AccountId; + type Item = Balance; + + fn stake(who: &Self::AccountId, item: Self::Item) -> sp_runtime::DispatchResult { + Assets::transfer(RuntimeOrigin::signed(*who), 0, darwinia_staking::account_id(), item) + } + + fn unstake(who: &Self::AccountId, item: Self::Item) -> sp_runtime::DispatchResult { + Assets::transfer(RuntimeOrigin::signed(darwinia_staking::account_id()), 0, *who, item) + } +} + +frame_support::parameter_types! { + pub const PayoutFraction: sp_runtime::Perbill = sp_runtime::Perbill::from_percent(20); +} + +impl darwinia_staking::Config for Runtime { + type Deposit = Deposit; + type Kton = KtonStaking; + type MaxDeposits = ConstU32<16>; + type MaxUnstakings = ConstU32<16>; + type MinStakingDuration = ConstU32<{ 14 * DAYS }>; + type PayoutFraction = PayoutFraction; + type RewardRemainder = Treasury; + type Ring = RingStaking; + type RingCurrency = Balances; + type RuntimeEvent = RuntimeEvent; + type UnixTime = Timestamp; +} diff --git a/runtime/darwinia/src/weights/mod.rs b/runtime/darwinia/src/weights/mod.rs index 74dbfcbbd..5856c3a7f 100644 --- a/runtime/darwinia/src/weights/mod.rs +++ b/runtime/darwinia/src/weights/mod.rs @@ -35,6 +35,5 @@ pub use rocksdb_weights::constants::RocksDbWeight; pub mod cumulus_pallet_xcmp_queue; pub mod frame_system; pub mod pallet_balances; -pub mod pallet_collator_selection; pub mod pallet_session; pub mod pallet_timestamp; diff --git a/runtime/darwinia/src/weights/pallet_collator_selection.rs b/runtime/darwinia/src/weights/pallet_collator_selection.rs deleted file mode 100644 index affdfcef8..000000000 --- a/runtime/darwinia/src/weights/pallet_collator_selection.rs +++ /dev/null @@ -1,111 +0,0 @@ -// This file is part of Darwinia. -// -// Copyright (C) 2018-2022 Darwinia Network -// SPDX-License-Identifier: GPL-3.0 -// -// Darwinia is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// Darwinia 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 Darwinia. If not, see . - -//! Autogenerated weights for `pallet_collator_selection` -//! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2022-11-09, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! HOSTNAME: `inv.cafe`, CPU: `AMD Ryzen 9 5950X 16-Core Processor` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("local"), DB CACHE: 1024 - -// Executed Command: -// target/release/darwinia -// benchmark -// pallet -// --header -// .maintain/license-header -// --execution -// wasm -// --heap-pages -// 4096 -// --chain -// local -// --output -// runtime/src/weights -// --extrinsic -// set_invulnerables,set_desired_candidates,set_candidacy_bond,leave_intent,new_session,note_author -// --pallet -// pallet-collator-selection - -#![cfg_attr(rustfmt, rustfmt_skip)] -#![allow(unused_parens)] -#![allow(unused_imports)] - -use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; - -/// Weight functions for `pallet_collator_selection`. -pub struct WeightInfo(PhantomData); -impl pallet_collator_selection::WeightInfo for WeightInfo { - // Storage: Session NextKeys (r:1 w:0) - // Storage: CollatorSelection Invulnerables (r:0 w:1) - /// The range of component `b` is `[1, 100]`. - fn set_invulnerables(_b: u32, ) -> Weight { - Weight::from_ref_time(317_565_000 as u64) - .saturating_add(T::DbWeight::get().reads(100 as u64)) - .saturating_add(T::DbWeight::get().writes(1 as u64)) - } - // Storage: CollatorSelection DesiredCandidates (r:0 w:1) - fn set_desired_candidates() -> Weight { - Weight::from_ref_time(19_951_000 as u64) - .saturating_add(T::DbWeight::get().writes(1 as u64)) - } - // Storage: CollatorSelection CandidacyBond (r:0 w:1) - fn set_candidacy_bond() -> Weight { - Weight::from_ref_time(19_730_000 as u64) - .saturating_add(T::DbWeight::get().writes(1 as u64)) - } - fn register_as_candidate(c: u32) -> Weight { - Weight::from_ref_time(71_196_000 as u64) - // Standard Error: 0 - .saturating_add(Weight::from_ref_time(198_000 as u64).saturating_mul(c as u64)) - .saturating_add(T::DbWeight::get().reads(4 as u64)) - .saturating_add(T::DbWeight::get().writes(2 as u64)) - } - // Storage: CollatorSelection Candidates (r:1 w:1) - // Storage: CollatorSelection LastAuthoredBlock (r:0 w:1) - /// The range of component `c` is `[6, 1000]`. - fn leave_intent(_c: u32, ) -> Weight { - Weight::from_ref_time(181_302_000 as u64) - .saturating_add(T::DbWeight::get().reads(1 as u64)) - .saturating_add(T::DbWeight::get().writes(2 as u64)) - } - // Storage: System Account (r:2 w:2) - // Storage: System BlockWeight (r:1 w:1) - // Storage: CollatorSelection LastAuthoredBlock (r:0 w:1) - fn note_author() -> Weight { - Weight::from_ref_time(43_091_000 as u64) - .saturating_add(T::DbWeight::get().reads(3 as u64)) - .saturating_add(T::DbWeight::get().writes(4 as u64)) - } - // Storage: CollatorSelection Candidates (r:1 w:1) - // Storage: CollatorSelection LastAuthoredBlock (r:1000 w:1) - // Storage: System Account (r:1 w:1) - // Storage: CollatorSelection Invulnerables (r:1 w:0) - // Storage: System BlockWeight (r:1 w:1) - /// The range of component `r` is `[1, 1000]`. - /// The range of component `c` is `[1, 1000]`. - fn new_session(_r: u32, c: u32, ) -> Weight { - Weight::from_ref_time(28_111_000 as u64) - // Standard Error: 39_309 - .saturating_add(Weight::from_ref_time(3_055_761 as u64).saturating_mul(c as u64)) - .saturating_add(T::DbWeight::get().reads(4 as u64)) - .saturating_add(T::DbWeight::get().reads((1 as u64).saturating_mul(c as u64))) - .saturating_add(T::DbWeight::get().writes(1 as u64)) - } -} diff --git a/runtime/pangolin/Cargo.toml b/runtime/pangolin/Cargo.toml index ab98468f7..8f71d50f6 100644 --- a/runtime/pangolin/Cargo.toml +++ b/runtime/pangolin/Cargo.toml @@ -37,10 +37,10 @@ cumulus-pallet-session-benchmarking = { optional = true, default-features = fals # darwinia darwinia-common-runtime = { default-features = false, path = "../common" } -darwinia-message-transact = { default-features = false, path = "../../pallets/message-transact" } -darwinia-precompile-assets = { default-features = false, path = "../../precompiles/assets" } -darwinia-precompile-bls12-381 = { default-features = false, path = "../../precompiles/bls12-381" } -darwinia-precompile-state-storage = { default-features = false, path = "../../precompiles/state-storage" } +darwinia-message-transact = { default-features = false, path = "../../pallet/message-transact" } +darwinia-precompile-assets = { default-features = false, path = "../../precompile/assets" } +darwinia-precompile-bls12-381 = { default-features = false, path = "../../precompile/bls12-381" } +darwinia-precompile-state-storage = { default-features = false, path = "../../precompile/state-storage" } dc-primitives = { default-features = false, path = "../../core/primitives" } # darwinia-messages-substrate diff --git a/runtime/pangolin/src/lib.rs b/runtime/pangolin/src/lib.rs index cf5aea755..e832a5993 100644 --- a/runtime/pangolin/src/lib.rs +++ b/runtime/pangolin/src/lib.rs @@ -269,9 +269,9 @@ frame_support::construct_runtime! { // Monetary stuff. // Leave 4 here. // To keep balances consistent with the existing XCM configurations. - Assets: pallet_assets = 34, Balances: pallet_balances = 5, TransactionPayment: pallet_transaction_payment = 6, + Assets: pallet_assets = 34, // Consensus stuff. Authorship: pallet_authorship = 7, diff --git a/runtime/pangolin/src/pallets/assets.rs b/runtime/pangolin/src/pallets/assets.rs index 1e59c1fec..d649ffa49 100644 --- a/runtime/pangolin/src/pallets/assets.rs +++ b/runtime/pangolin/src/pallets/assets.rs @@ -19,14 +19,12 @@ // darwinia use crate::*; -pub type AssetId = u64; - impl pallet_assets::Config for Runtime { type ApprovalDeposit = ConstU128<0>; type AssetAccountDeposit = ConstU128<0>; type AssetDeposit = ConstU128<0>; type AssetId = AssetId; - type Balance = u128; + type Balance = Balance; type Currency = Balances; type Extra = (); // TODO: Restrict the create asset origin. https://github.com/paritytech/substrate/pull/12586 diff --git a/runtime/pangolin/src/pallets/mod.rs b/runtime/pangolin/src/pallets/mod.rs index ea7d4188f..597ae9ed1 100644 --- a/runtime/pangolin/src/pallets/mod.rs +++ b/runtime/pangolin/src/pallets/mod.rs @@ -26,7 +26,6 @@ pub use shared_imports::*; // System stuffs. mod assets; -pub use assets::*; mod system; pub use system::*; diff --git a/runtime/pangolin/src/pallets/polkadot_xcm.rs b/runtime/pangolin/src/pallets/polkadot_xcm.rs index 08fe7222f..1962d01b2 100644 --- a/runtime/pangolin/src/pallets/polkadot_xcm.rs +++ b/runtime/pangolin/src/pallets/polkadot_xcm.rs @@ -18,7 +18,7 @@ // darwinia use crate::*; -use darwinia_common_runtime::xcm_barrier::*; +use darwinia_common_runtime::xcm_configs::*; // moonbeam use xcm_primitives::*; // polkadot @@ -121,7 +121,7 @@ impl xcm_executor::Config for XcmExecutorConfig { type RuntimeCall = RuntimeCall; type SubscriptionService = PolkadotXcm; type Trader = UsingComponents< - ConstantMultiplier>, + ConstantMultiplier, AnchoringSelfReserve, AccountId, Balances, From fa47263573203767d80891dae519b3e4cf63c6be Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Tue, 6 Dec 2022 14:58:54 +0800 Subject: [PATCH 026/189] Avoid large enum variant (#98) * Avoid large enum variant * Fix tests Co-authored-by: bear --- pallet/message-transact/src/lib.rs | 19 ++++++++------ pallet/message-transact/src/mock.rs | 4 +-- pallet/message-transact/src/tests/eip1559.rs | 25 +++++++++++-------- pallet/message-transact/src/tests/eip2930.rs | 25 +++++++++++-------- pallet/message-transact/src/tests/legacy.rs | 25 +++++++++++-------- runtime/crab/src/pallets/bridge_dispatch.rs | 4 +-- .../darwinia/src/pallets/bridge_dispatch.rs | 4 +-- 7 files changed, 62 insertions(+), 44 deletions(-) diff --git a/pallet/message-transact/src/lib.rs b/pallet/message-transact/src/lib.rs index 7cb0c5db6..f0b535192 100644 --- a/pallet/message-transact/src/lib.rs +++ b/pallet/message-transact/src/lib.rs @@ -23,6 +23,8 @@ mod mock; #[cfg(test)] mod tests; +// core +use core::borrow::BorrowMut; // crates.io use codec::{Decode, Encode, MaxEncodedLen}; use ethereum::TransactionV2 as Transaction; @@ -35,6 +37,7 @@ use pallet_evm::{FeeCalculator, GasWeightMapping}; // substrate use frame_support::{traits::EnsureOrigin, PalletError, RuntimeDebug}; use sp_core::{H160, U256}; +use sp_std::boxed::Box; pub use pallet::*; @@ -107,36 +110,36 @@ pub mod pallet { #[pallet::weight({ let without_base_extrinsic_weight = true; ::GasWeightMapping::gas_to_weight({ - let transaction_data: TransactionData = transaction.into(); + let transaction_data: TransactionData = (&**transaction).into(); transaction_data.gas_limit.unique_saturated_into() }, without_base_extrinsic_weight) })] pub fn message_transact( origin: OriginFor, - transaction: Transaction, + mut transaction: Box, ) -> DispatchResultWithPostInfo { let source = ensure_message_transact(origin)?; let (who, _) = pallet_evm::Pallet::::account_basic(&source); let base_fee = T::FeeCalculator::min_gas_price().0; - let mut transaction_mut = transaction; + let transaction_mut = transaction.borrow_mut(); match transaction_mut { - Transaction::Legacy(ref mut tx) => { + Transaction::Legacy(tx) => { tx.nonce = who.nonce; tx.gas_price = base_fee; }, - Transaction::EIP2930(ref mut tx) => { + Transaction::EIP2930(tx) => { tx.nonce = who.nonce; tx.gas_price = base_fee; }, - Transaction::EIP1559(ref mut tx) => { + Transaction::EIP1559(tx) => { tx.nonce = who.nonce; tx.max_fee_per_gas = base_fee; tx.max_priority_fee_per_gas = U256::zero(); }, }; - let transaction_data: TransactionData = (&transaction_mut).into(); + let transaction_data: TransactionData = (&*transaction).into(); let _ = CheckEvmTransaction::::new( CheckEvmTransactionConfig { evm_config: T::config(), @@ -153,7 +156,7 @@ pub mod pallet { .and_then(|v| v.with_balance_for(&who)) .map_err(|e| >::MessageTransactError(e))?; - T::ValidatedTransaction::apply(source, transaction_mut) + T::ValidatedTransaction::apply(source, *transaction) } } } diff --git a/pallet/message-transact/src/mock.rs b/pallet/message-transact/src/mock.rs index 6bdd4cde4..0960d5f1a 100644 --- a/pallet/message-transact/src/mock.rs +++ b/pallet/message-transact/src/mock.rs @@ -164,7 +164,7 @@ impl CallValidate for MockCallValidator { ) -> Result<(), &'static str> { match call { RuntimeCall::MessageTransact(crate::Call::message_transact { transaction: tx }) => { - let total_payment = crate::total_payment::(tx.into()); + let total_payment = crate::total_payment::((&**tx).into()); let relayer = pallet_evm::Pallet::::account_basic(&relayer_account).0; ensure!(relayer.balance >= total_payment, "Insufficient balance"); @@ -183,7 +183,7 @@ impl CallValidate for MockCallValidator { RuntimeCall::MessageTransact(crate::Call::message_transact { transaction: tx }) => match origin.caller { OriginCaller::MessageTransact(LcmpEthOrigin::MessageTransact(id)) => { - let total_payment = crate::total_payment::(tx.into()); + let total_payment = crate::total_payment::((&**tx).into()); pallet_balances::Pallet::::transfer( RawOrigin::Signed(*relayer_account).into(), id, diff --git a/pallet/message-transact/src/tests/eip1559.rs b/pallet/message-transact/src/tests/eip1559.rs index f13e65a02..f326c162e 100644 --- a/pallet/message-transact/src/tests/eip1559.rs +++ b/pallet/message-transact/src/tests/eip1559.rs @@ -54,8 +54,9 @@ fn test_dispatch_eip1559_transaction_works() { let mock_message_id = [0; 4]; let unsigned_tx = eip1559_erc20_creation_unsigned_transaction(); let t = unsigned_tx.sign(&alice.private_key, None); - let call = - RuntimeCall::MessageTransact(crate::Call::message_transact { transaction: t }); + let call = RuntimeCall::MessageTransact(crate::Call::message_transact { + transaction: Box::new(t), + }); let message = prepare_message(call); let result = Dispatch::dispatch( @@ -95,8 +96,9 @@ fn test_dispatch_eip1559_transaction_weight_mismatch() { // 62500001 * 16000 > 1_000_000_000_000 unsigned_tx.gas_limit = U256::from(62500001); let t = unsigned_tx.sign(&alice.private_key, None); - let call = - RuntimeCall::MessageTransact(crate::Call::message_transact { transaction: t }); + let call = RuntimeCall::MessageTransact(crate::Call::message_transact { + transaction: Box::new(t), + }); let message = prepare_message(call); let result = Dispatch::dispatch( @@ -136,8 +138,9 @@ fn test_dispatch_eip1559_transaction_with_autoset_nonce() { let mut unsigned_tx = eip1559_erc20_creation_unsigned_transaction(); unsigned_tx.nonce = U256::MAX; let t = unsigned_tx.sign(&alice.private_key, None); - let call = - RuntimeCall::MessageTransact(crate::Call::message_transact { transaction: t }); + let call = RuntimeCall::MessageTransact(crate::Call::message_transact { + transaction: Box::new(t), + }); let message = prepare_message(call); let result = Dispatch::dispatch( @@ -170,8 +173,9 @@ fn test_dispatch_eip1559_transaction_with_autoset_gas_price() { unsigned_tx.max_fee_per_gas = ::FeeCalculator::min_gas_price().0 - 1; let t = unsigned_tx.sign(&alice.private_key, None); - let call = - RuntimeCall::MessageTransact(crate::Call::message_transact { transaction: t }); + let call = RuntimeCall::MessageTransact(crate::Call::message_transact { + transaction: Box::new(t), + }); let message = prepare_message(call); let result = Dispatch::dispatch( @@ -204,8 +208,9 @@ fn test_dispatch_eip1559_transaction_with_insufficient_relayer_balance() { let mock_message_id = [0; 4]; let unsigned_tx = eip1559_erc20_creation_unsigned_transaction(); let t = unsigned_tx.sign(&alice.private_key, None); - let call = - RuntimeCall::MessageTransact(crate::Call::message_transact { transaction: t }); + let call = RuntimeCall::MessageTransact(crate::Call::message_transact { + transaction: Box::new(t), + }); let message = prepare_message(call); // Failed in pre-dispatch balance check diff --git a/pallet/message-transact/src/tests/eip2930.rs b/pallet/message-transact/src/tests/eip2930.rs index 6cc99aafa..2e880b2cc 100644 --- a/pallet/message-transact/src/tests/eip2930.rs +++ b/pallet/message-transact/src/tests/eip2930.rs @@ -53,8 +53,9 @@ fn test_dispatch_eip2930_transaction_works() { let mock_message_id = [0; 4]; let unsigned_tx = eip2930_erc20_creation_unsigned_transaction(); let t = unsigned_tx.sign(&alice.private_key, None); - let call = - RuntimeCall::MessageTransact(crate::Call::message_transact { transaction: t }); + let call = RuntimeCall::MessageTransact(crate::Call::message_transact { + transaction: Box::new(t), + }); let message = prepare_message(call); let result = Dispatch::dispatch( @@ -94,8 +95,9 @@ fn test_dispatch_eip2930_transaction_weight_mismatch() { // 62500001 * 16000 > 1_000_000_000_000 unsigned_tx.gas_limit = U256::from(62500001); let t = unsigned_tx.sign(&alice.private_key, None); - let call = - RuntimeCall::MessageTransact(crate::Call::message_transact { transaction: t }); + let call = RuntimeCall::MessageTransact(crate::Call::message_transact { + transaction: Box::new(t), + }); let message = prepare_message(call); let result = Dispatch::dispatch( @@ -135,8 +137,9 @@ fn test_dispatch_eip2930_transaction_with_autoset_nonce() { let mut unsigned_tx = eip2930_erc20_creation_unsigned_transaction(); unsigned_tx.nonce = U256::MAX; let t = unsigned_tx.sign(&alice.private_key, None); - let call = - RuntimeCall::MessageTransact(crate::Call::message_transact { transaction: t }); + let call = RuntimeCall::MessageTransact(crate::Call::message_transact { + transaction: Box::new(t), + }); let message = prepare_message(call); let result = Dispatch::dispatch( @@ -169,8 +172,9 @@ fn test_dispatch_eip2930_transaction_with_autoset_gas_price() { unsigned_tx.gas_price = ::FeeCalculator::min_gas_price().0 - 1; let t = unsigned_tx.sign(&alice.private_key, None); - let call = - RuntimeCall::MessageTransact(crate::Call::message_transact { transaction: t }); + let call = RuntimeCall::MessageTransact(crate::Call::message_transact { + transaction: Box::new(t), + }); let message = prepare_message(call); let result = Dispatch::dispatch( @@ -203,8 +207,9 @@ fn test_dispatch_eip2930_transaction_with_insufficient_relayer_balance() { let mock_message_id = [0; 4]; let unsigned_tx = eip2930_erc20_creation_unsigned_transaction(); let t = unsigned_tx.sign(&alice.private_key, None); - let call = - RuntimeCall::MessageTransact(crate::Call::message_transact { transaction: t }); + let call = RuntimeCall::MessageTransact(crate::Call::message_transact { + transaction: Box::new(t), + }); let message = prepare_message(call); // Failed in pre-dispatch balance check diff --git a/pallet/message-transact/src/tests/legacy.rs b/pallet/message-transact/src/tests/legacy.rs index 2dd375e43..e6653e5b2 100644 --- a/pallet/message-transact/src/tests/legacy.rs +++ b/pallet/message-transact/src/tests/legacy.rs @@ -52,8 +52,9 @@ fn test_dispatch_legacy_transaction_works() { .execute_with(|| { let mock_message_id = [0; 4]; let t = legacy_erc20_creation_unsigned_transaction().sign(&alice.private_key); - let call = - RuntimeCall::MessageTransact(crate::Call::message_transact { transaction: t }); + let call = RuntimeCall::MessageTransact(crate::Call::message_transact { + transaction: Box::new(t), + }); let message = prepare_message(call); let result = Dispatch::dispatch( @@ -91,8 +92,9 @@ fn test_dispatch_legacy_transaction_weight_mismatch() { let mut unsigned_tx = legacy_erc20_creation_unsigned_transaction(); unsigned_tx.gas_limit = U256::from(62500001); let t = unsigned_tx.sign(&alice.private_key); - let call = - RuntimeCall::MessageTransact(crate::Call::message_transact { transaction: t }); + let call = RuntimeCall::MessageTransact(crate::Call::message_transact { + transaction: Box::new(t), + }); let message = prepare_message(call); let result = Dispatch::dispatch( @@ -132,8 +134,9 @@ fn test_dispatch_legacy_transaction_with_autoset_nonce() { let mut unsigned_tx = legacy_erc20_creation_unsigned_transaction(); unsigned_tx.nonce = U256::MAX; let t = unsigned_tx.sign(&alice.private_key); - let call = - RuntimeCall::MessageTransact(crate::Call::message_transact { transaction: t }); + let call = RuntimeCall::MessageTransact(crate::Call::message_transact { + transaction: Box::new(t), + }); let message = prepare_message(call); let result = Dispatch::dispatch( @@ -166,8 +169,9 @@ fn test_dispatch_legacy_transaction_with_autoset_gas_price() { unsigned_tx.gas_price = ::FeeCalculator::min_gas_price().0 - 1; let t = unsigned_tx.sign(&alice.private_key); - let call = - RuntimeCall::MessageTransact(crate::Call::message_transact { transaction: t }); + let call = RuntimeCall::MessageTransact(crate::Call::message_transact { + transaction: Box::new(t), + }); let message = prepare_message(call); let result = Dispatch::dispatch( @@ -200,8 +204,9 @@ fn test_dispatch_legacy_transaction_with_insufficient_relayer_balance() { let mock_message_id = [0; 4]; let unsigned_tx = legacy_erc20_creation_unsigned_transaction(); let t = unsigned_tx.sign(&alice.private_key); - let call = - RuntimeCall::MessageTransact(crate::Call::message_transact { transaction: t }); + let call = RuntimeCall::MessageTransact(crate::Call::message_transact { + transaction: Box::new(t), + }); let message = prepare_message(call); // Failed in pre-dispatch balance check diff --git a/runtime/crab/src/pallets/bridge_dispatch.rs b/runtime/crab/src/pallets/bridge_dispatch.rs index 9a06180d1..a6e490264 100644 --- a/runtime/crab/src/pallets/bridge_dispatch.rs +++ b/runtime/crab/src/pallets/bridge_dispatch.rs @@ -39,7 +39,7 @@ impl CallValidate for CallValidator { RuntimeCall::MessageTransact(MessageTransactCall::message_transact { transaction: tx, }) => { - let total_payment = total_payment::(tx.into()); + let total_payment = total_payment::((&**tx).into()); let relayer = pallet_evm::Pallet::::account_basic(&H160(relayer_account.0)).0; @@ -60,7 +60,7 @@ impl CallValidate for CallValidator { transaction: tx, }) => match origin.caller { OriginCaller::MessageTransact(LcmpEthOrigin::MessageTransact(id)) => { - let total_payment = total_payment::(tx.into()); + let total_payment = total_payment::((&**tx).into()); pallet_balances::Pallet::::transfer( RawOrigin::Signed(*relayer_account).into(), id.into(), diff --git a/runtime/darwinia/src/pallets/bridge_dispatch.rs b/runtime/darwinia/src/pallets/bridge_dispatch.rs index eee1acc0c..96a3437fb 100644 --- a/runtime/darwinia/src/pallets/bridge_dispatch.rs +++ b/runtime/darwinia/src/pallets/bridge_dispatch.rs @@ -39,7 +39,7 @@ impl CallValidate for CallValidator { RuntimeCall::MessageTransact(MessageTransactCall::message_transact { transaction: tx, }) => { - let total_payment = total_payment::(tx.into()); + let total_payment = total_payment::((&**tx).into()); let relayer = pallet_evm::Pallet::::account_basic(&H160(relayer_account.0)).0; @@ -60,7 +60,7 @@ impl CallValidate for CallValidator { transaction: tx, }) => match origin.caller { OriginCaller::MessageTransact(LcmpEthOrigin::MessageTransact(id)) => { - let total_payment = total_payment::(tx.into()); + let total_payment = total_payment::((&**tx).into()); pallet_balances::Pallet::::transfer( RawOrigin::Signed(*relayer_account).into(), id.into(), From a2d5ae851c7bdbaf9e48ca8be081dc77fc017a02 Mon Sep 17 00:00:00 2001 From: bear Date: Tue, 6 Dec 2022 16:56:43 +0800 Subject: [PATCH 027/189] Add account migration pallet (#86) * Init commit * Add todos * Add `ValidateUnsigned` * Add signature verify * Add event * Add comment * Update message hash * Add mock file * Compile mock * Add basic tests * Add more tests * Code clean * Clean toml * Format * Install it to the runtimes * Rename Co-authored-by: HackFisher Co-authored-by: Xavier Lau --- Cargo.lock | 23 +++ node/src/chain_spec/crab.rs | 2 + node/src/chain_spec/darwinia.rs | 2 + node/src/chain_spec/pangolin.rs | 2 + pallet/account-migration/Cargo.toml | 60 +++++++ pallet/account-migration/src/lib.rs | 189 +++++++++++++++++++++ pallet/account-migration/src/mock.rs | 214 ++++++++++++++++++++++++ pallet/account-migration/src/test.rs | 193 +++++++++++++++++++++ runtime/crab/Cargo.toml | 2 + runtime/crab/src/lib.rs | 1 + runtime/crab/src/pallets/migrate.rs | 25 +++ runtime/crab/src/pallets/mod.rs | 2 + runtime/darwinia/Cargo.toml | 2 + runtime/darwinia/src/lib.rs | 1 + runtime/darwinia/src/pallets/migrate.rs | 25 +++ runtime/darwinia/src/pallets/mod.rs | 1 + runtime/pangolin/Cargo.toml | 2 + runtime/pangolin/src/lib.rs | 1 + runtime/pangolin/src/pallets/migrate.rs | 25 +++ runtime/pangolin/src/pallets/mod.rs | 2 + 20 files changed, 774 insertions(+) create mode 100644 pallet/account-migration/Cargo.toml create mode 100644 pallet/account-migration/src/lib.rs create mode 100644 pallet/account-migration/src/mock.rs create mode 100644 pallet/account-migration/src/test.rs create mode 100644 runtime/crab/src/pallets/migrate.rs create mode 100644 runtime/darwinia/src/pallets/migrate.rs create mode 100644 runtime/pangolin/src/pallets/migrate.rs diff --git a/Cargo.lock b/Cargo.lock index 97b00e628..50120fd20 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1348,6 +1348,7 @@ dependencies = [ "cumulus-primitives-core", "cumulus-primitives-timestamp", "cumulus-primitives-utility", + "darwinia-account-migration", "darwinia-common-runtime", "darwinia-message-transact", "darwinia-precompile-assets", @@ -2285,6 +2286,26 @@ dependencies = [ "xcm", ] +[[package]] +name = "darwinia-account-migration" +version = "6.0.0" +dependencies = [ + "dc-primitives", + "fp-ethereum", + "fp-evm", + "frame-support", + "frame-system", + "pallet-balances", + "pallet-evm", + "pallet-timestamp", + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", +] + [[package]] name = "darwinia-common-runtime" version = "6.0.0" @@ -2427,6 +2448,7 @@ dependencies = [ "cumulus-primitives-core", "cumulus-primitives-timestamp", "cumulus-primitives-utility", + "darwinia-account-migration", "darwinia-common-runtime", "darwinia-deposit", "darwinia-message-transact", @@ -7326,6 +7348,7 @@ dependencies = [ "cumulus-primitives-core", "cumulus-primitives-timestamp", "cumulus-primitives-utility", + "darwinia-account-migration", "darwinia-common-runtime", "darwinia-message-transact", "darwinia-precompile-assets", diff --git a/node/src/chain_spec/crab.rs b/node/src/chain_spec/crab.rs index 0a29118ee..c1eb487d1 100644 --- a/node/src/chain_spec/crab.rs +++ b/node/src/chain_spec/crab.rs @@ -179,6 +179,7 @@ pub fn config() -> ChainSpec { balances: Default::default(), transaction_payment: Default::default(), assets: Default::default(), + account_migration: Default::default(), // Consensus stuff. collator_selection: crab_runtime::CollatorSelectionConfig { @@ -260,6 +261,7 @@ fn testnet_genesis( }, transaction_payment: Default::default(), assets: Default::default(), + account_migration: Default::default(), // Consensus stuff. collator_selection: crab_runtime::CollatorSelectionConfig { diff --git a/node/src/chain_spec/darwinia.rs b/node/src/chain_spec/darwinia.rs index 11ec40a55..0c42b96c4 100644 --- a/node/src/chain_spec/darwinia.rs +++ b/node/src/chain_spec/darwinia.rs @@ -175,6 +175,7 @@ pub fn genesis_config() -> ChainSpec { balances: Default::default(), transaction_payment: Default::default(), assets: Default::default(), + account_migration: Default::default(), // Consensus stuff. staking: StakingConfig { @@ -258,6 +259,7 @@ fn testnet_genesis( }, transaction_payment: Default::default(), assets: Default::default(), + account_migration: Default::default(), // Consensus stuff. staking: StakingConfig { diff --git a/node/src/chain_spec/pangolin.rs b/node/src/chain_spec/pangolin.rs index 491d54170..d6f66de12 100644 --- a/node/src/chain_spec/pangolin.rs +++ b/node/src/chain_spec/pangolin.rs @@ -179,6 +179,7 @@ pub fn config() -> ChainSpec { balances: Default::default(), transaction_payment: Default::default(), assets: Default::default(), + account_migration: Default::default(), // Consensus stuff. collator_selection: pangolin_runtime::CollatorSelectionConfig { @@ -257,6 +258,7 @@ fn testnet_genesis( }, transaction_payment: Default::default(), assets: Default::default(), + account_migration: Default::default(), // Consensus stuff. collator_selection: pangolin_runtime::CollatorSelectionConfig { diff --git a/pallet/account-migration/Cargo.toml b/pallet/account-migration/Cargo.toml new file mode 100644 index 000000000..a26fea97b --- /dev/null +++ b/pallet/account-migration/Cargo.toml @@ -0,0 +1,60 @@ +[package] +authors = ["Darwinia Network "] +description = "State storage precompiles for EVM pallet." +edition = "2021" +homepage = "https://darwinia.network" +license = "GPL-3.0" +name = "darwinia-account-migration" +readme = "README.md" +repository = "https://github.com/darwinia-network/darwinia" +version = "6.0.0" + +[dependencies] +# crates.io +codec = { default-features = false, package = "parity-scale-codec", version = "3.2.1", features = ["derive"] } +scale-info = { default-features = false, version = "2.3.0", features = ["derive"] } + +# darwinia +dc-primitives = { default-features = false, path = "../../core/primitives"} + +# frontier +fp-ethereum = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +fp-evm = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +pallet-evm = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } + +# substrate +frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-io = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } + +[dev-dependencies] +# substrate +pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } + +[features] +default = ["std"] +std = [ + # crates.io + "codec/std", + "scale-info/std", + + # darwinia + "dc-primitives/std", + + # frontier + "fp-evm/std", + "fp-ethereum/std", + "pallet-evm/std", + + # paritytech + "frame-support/std", + "frame-system/std", + "sp-core/std", + "sp-runtime/std", + "sp-io/std", + "sp-std/std", +] diff --git a/pallet/account-migration/src/lib.rs b/pallet/account-migration/src/lib.rs new file mode 100644 index 000000000..f349ff650 --- /dev/null +++ b/pallet/account-migration/src/lib.rs @@ -0,0 +1,189 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +#![cfg_attr(not(feature = "std"), no_std)] + +#[cfg(test)] +mod mock; +#[cfg(test)] +mod test; + +/// Type alias for currency AccountId. +type AccountIdOf = ::AccountId; +/// Type alias for currency balance. +type BalanceOf = + <::Currency as Currency<::AccountId>>::Balance; + +// darwinia +use dc_primitives::Balance; +// substrate +use frame_support::traits::Currency; +#[cfg(feature = "std")] +use frame_support::traits::GenesisBuild; +use sp_core::{ + crypto::ByteArray, + sr25519::{Public, Signature}, + H160, +}; +use sp_io::hashing::blake2_256; +use sp_runtime::{traits::Verify, AccountId32}; +use sp_std::vec::Vec; + +pub use pallet::*; +#[frame_support::pallet] +pub mod pallet { + use super::*; + use frame_support::pallet_prelude::*; + use frame_system::pallet_prelude::*; + + #[pallet::pallet] + pub struct Pallet(PhantomData); + + #[pallet::config] + pub trait Config: frame_system::Config + pallet_evm::Config { + /// The overarching event type. + type RuntimeEvent: From + IsType<::RuntimeEvent>; + /// Currency type for the runtime. + type Currency: Currency; + } + + // Store the migrated balance snapshot for the darwinia-1.0 chain state. + #[pallet::storage] + #[pallet::getter(fn balance_of)] + pub(super) type Balances = StorageMap<_, Blake2_128Concat, AccountId32, Balance>; + + #[pallet::error] + pub enum Error { + /// This account does not exist in the darwinia 1.0 chain state. + AccountNotExist, + } + + #[pallet::event] + #[pallet::generate_deposit(pub(super) fn deposit_event)] + pub enum Event { + /// Claim to the new account id. + Claim { old_pub_key: AccountId32, new_pub_key: H160, amount: Balance }, + } + + #[pallet::genesis_config] + #[cfg_attr(feature = "std", derive(Default))] + pub struct GenesisConfig { + pub migrated_accounts: Vec<(AccountId32, Balance)>, + } + + #[pallet::genesis_build] + impl GenesisBuild for GenesisConfig { + fn build(&self) { + self.migrated_accounts.iter().for_each(|(account, amount)| { + Balances::::insert(account, amount); + }); + } + } + + #[pallet::call] + impl Pallet + where + AccountIdOf: From, + BalanceOf: From, + { + // since signature and chain_id verification is done in `validate_unsigned` + // we can skip doing it here again. + // TODO: update weight + #[pallet::weight(0)] + pub fn claim_to( + origin: OriginFor, + _chain_id: u64, + old_pub_key: AccountId32, + new_pub_key: H160, + _sig: Signature, + ) -> DispatchResult { + ensure_none(origin)?; + + let Some(amount) = Balances::::take(&old_pub_key) else { + return Err(Error::::AccountNotExist.into()); + }; + + ::Currency::deposit_creating(&new_pub_key.into(), amount.into()); + Self::deposit_event(Event::Claim { old_pub_key, new_pub_key, amount }); + + Ok(()) + } + } + #[pallet::validate_unsigned] + impl ValidateUnsigned for Pallet + where + AccountIdOf: From, + BalanceOf: From, + { + type Call = Call; + + fn validate_unsigned(_source: TransactionSource, call: &Self::Call) -> TransactionValidity { + let Call::claim_to { chain_id, old_pub_key, new_pub_key, sig } = call else { + return InvalidTransaction::Call.into(); + }; + + if *chain_id != ::ChainId::get() { + return InvalidTransaction::BadProof.into(); + } + if !Balances::::contains_key(old_pub_key) { + return InvalidTransaction::BadSigner.into(); + } + + let message = ClaimMessage::new( + ::ChainId::get(), + old_pub_key, + new_pub_key, + ); + if let Ok(signer) = Public::from_slice(old_pub_key.as_ref()) { + let is_valid = sig.verify(&blake2_256(&message.raw_bytes())[..], &signer); + + if is_valid { + return ValidTransaction::with_tag_prefix("MigrateClaim") + .priority(TransactionPriority::max_value()) + .propagate(true) + .build(); + } + } + InvalidTransaction::BadSigner.into() + } + } +} + +/// ClaimMessage is the metadata that needs to be signed when the user invokes claim dispatch. +/// +/// It consists of three parts, namely the chain_id, the AccountId32 account for darwinia 1.0, and +/// the H160 account for darwinia 2.0. +pub struct ClaimMessage<'m> { + pub chain_id: u64, + pub old_pub_key: &'m AccountId32, + pub new_pub_key: &'m H160, +} + +impl<'m> ClaimMessage<'m> { + fn new(chain_id: u64, old_pub_key: &'m AccountId32, new_pub_key: &'m H160) -> Self { + Self { chain_id, old_pub_key, new_pub_key } + } + + fn raw_bytes(&self) -> Vec { + let mut result = Vec::new(); + result.extend_from_slice(&self.chain_id.to_be_bytes()); + result.extend_from_slice(self.old_pub_key.as_slice()); + result.extend_from_slice(self.new_pub_key.as_bytes()); + result + } +} diff --git a/pallet/account-migration/src/mock.rs b/pallet/account-migration/src/mock.rs new file mode 100644 index 000000000..64f11fedb --- /dev/null +++ b/pallet/account-migration/src/mock.rs @@ -0,0 +1,214 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Test utilities + +// frontier +use pallet_evm::IdentityAddressMapping; +// parity +use frame_support::{ + pallet_prelude::Weight, + traits::{ConstU32, Everything}, +}; +use sp_core::{sr25519::Pair, Pair as PairT, H160, H256, U256}; +use sp_runtime::{ + testing::Header, + traits::{BlakeTwo256, IdentityLookup}, + AccountId32, BuildStorage, +}; +use sp_std::prelude::*; +// darwinia +use crate::{self as darwinia_account_migration}; + +pub type Block = frame_system::mocking::MockBlock; +pub type Balance = u128; +pub type AccountId = H160; +pub type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; + +pub enum EthAccounts { + Alice, + Bob, +} + +impl Into for EthAccounts { + fn into(self) -> H160 { + match self { + EthAccounts::Alice => H160::repeat_byte(0xAA), + EthAccounts::Bob => H160::repeat_byte(0xBB), + } + } +} + +#[derive(Debug, Clone, Copy)] +pub enum SubAccounts { + Charlie, + Bogus, +} + +impl SubAccounts { + pub fn to_pair(self) -> (Pair, AccountId32) { + match self { + SubAccounts::Charlie => { + let pair = Pair::from_seed(b"12345678901234567890123456789012"); + let account_id = AccountId32::new(pair.public().0); + (pair, account_id) + }, + SubAccounts::Bogus => { + let pair = Pair::from_seed(b"12345678901234567890123456789013"); + let account_id = AccountId32::new(pair.public().0); + (pair, account_id) + }, + } + } +} + +frame_support::parameter_types! { + pub const BlockHashCount: u64 = 250; +} +impl frame_system::Config for TestRuntime { + type AccountData = pallet_balances::AccountData; + type AccountId = AccountId; + type BaseCallFilter = Everything; + type BlockHashCount = (); + type BlockLength = (); + type BlockNumber = u64; + type BlockWeights = (); + type DbWeight = (); + type Hash = H256; + type Hashing = BlakeTwo256; + type Header = Header; + type Index = u64; + type Lookup = IdentityLookup; + type MaxConsumers = ConstU32<16>; + type OnKilledAccount = (); + type OnNewAccount = (); + type OnSetCode = (); + type PalletInfo = PalletInfo; + type RuntimeCall = RuntimeCall; + type RuntimeEvent = RuntimeEvent; + type RuntimeOrigin = RuntimeOrigin; + type SS58Prefix = (); + type SystemWeightInfo = (); + type Version = (); +} + +frame_support::parameter_types! { + pub const MaxLocks: u32 = 10; + pub const ExistentialDeposit: u64 = 0; +} +impl pallet_balances::Config for TestRuntime { + type AccountStore = System; + type Balance = Balance; + type DustRemoval = (); + type ExistentialDeposit = ExistentialDeposit; + type MaxLocks = MaxLocks; + type MaxReserves = (); + type ReserveIdentifier = [u8; 8]; + type RuntimeEvent = RuntimeEvent; + type WeightInfo = (); +} + +frame_support::parameter_types! { + pub const MinimumPeriod: u64 = 6000 / 2; +} +impl pallet_timestamp::Config for TestRuntime { + type MinimumPeriod = MinimumPeriod; + type Moment = u64; + type OnTimestampSet = (); + type WeightInfo = (); +} + +frame_support::parameter_types! { + pub const TransactionByteFee: u64 = 1; + pub const ChainId: u64 = 42; + pub const BlockGasLimit: U256 = U256::MAX; + pub const WeightPerGas: Weight = Weight::from_ref_time(20_000); +} + +impl pallet_evm::Config for TestRuntime { + type AddressMapping = IdentityAddressMapping; + type BlockGasLimit = BlockGasLimit; + type BlockHashMapping = pallet_evm::SubstrateBlockHashMapping; + type CallOrigin = pallet_evm::EnsureAddressRoot; + type ChainId = ChainId; + type Currency = Balances; + type FeeCalculator = (); + type FindAuthor = (); + type GasWeightMapping = pallet_evm::FixedGasWeightMapping; + type OnChargeTransaction = (); + type PrecompilesType = (); + type PrecompilesValue = (); + type Runner = pallet_evm::runner::stack::Runner; + type RuntimeEvent = RuntimeEvent; + type WeightPerGas = WeightPerGas; + type WithdrawOrigin = pallet_evm::EnsureAddressNever; +} + +impl darwinia_account_migration::Config for TestRuntime { + type Currency = Balances; + type RuntimeEvent = RuntimeEvent; +} + +frame_support::construct_runtime! { + pub enum TestRuntime where + Block = Block, + NodeBlock = Block, + UncheckedExtrinsic = UncheckedExtrinsic, + { + System: frame_system::{Pallet, Call, Config, Storage, Event}, + Timestamp: pallet_timestamp::{Pallet, Call, Storage}, + Balances: pallet_balances::{Pallet, Call, Storage, Config, Event}, + EVM: pallet_evm::{Pallet, Call, Storage, Config, Event}, + AccountMigration: darwinia_account_migration::{Pallet, Call, Storage, Config, Event}, + } +} + +#[derive(Default)] +pub(crate) struct ExtBuilder { + migrated_accounts: Vec<(AccountId32, Balance)>, + balances: Vec<(AccountId, Balance)>, +} + +impl ExtBuilder { + pub(crate) fn with_migrated_accounts(mut self, accounts: Vec<(AccountId32, Balance)>) -> Self { + self.migrated_accounts = accounts; + self + } + + pub(crate) fn with_balances(mut self, balances: Vec<(AccountId, Balance)>) -> Self { + self.balances = balances; + self + } + + pub(crate) fn build(self) -> sp_io::TestExternalities { + let t = GenesisConfig { + system: Default::default(), + balances: pallet_balances::GenesisConfig { balances: self.balances }, + evm: Default::default(), + account_migration: darwinia_account_migration::GenesisConfig { + migrated_accounts: self.migrated_accounts, + }, + } + .build_storage() + .unwrap(); + + let mut ext = sp_io::TestExternalities::new(t); + ext.execute_with(|| System::set_block_number(1)); + ext + } +} diff --git a/pallet/account-migration/src/test.rs b/pallet/account-migration/src/test.rs new file mode 100644 index 000000000..d918c3053 --- /dev/null +++ b/pallet/account-migration/src/test.rs @@ -0,0 +1,193 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::{mock::*, ClaimMessage, Error}; +// substrate +use frame_support::{assert_err, assert_ok, unsigned::ValidateUnsigned}; +use sp_core::{blake2_256, Pair, H160}; +use sp_runtime::transaction_validity::{InvalidTransaction, TransactionValidityError}; + +#[test] +fn claim_to_new_account() { + let (pair, charlie) = SubAccounts::Charlie.to_pair(); + let alice: H160 = EthAccounts::Alice.into(); + + ExtBuilder::default() + .with_migrated_accounts(vec![(charlie.clone(), 1000)]) + .build() + .execute_with(|| { + let message = ClaimMessage::new(42, &charlie, &alice); + let sig = pair.sign(&blake2_256(&message.raw_bytes())[..]); + + assert_eq!(AccountMigration::balance_of(charlie.clone()), Some(1000)); + assert_eq!(Balances::free_balance(alice), 0); + assert_ok!(AccountMigration::claim_to( + RuntimeOrigin::none(), + 42, + charlie.clone(), + alice, + sig + )); + assert!(AccountMigration::balance_of(charlie).is_none()); + assert_eq!(Balances::free_balance(alice), 1000); + }); +} + +#[test] +fn claim_with_not_exist_old_pub_key() { + let (pair, charlie) = SubAccounts::Charlie.to_pair(); + let alice: H160 = EthAccounts::Alice.into(); + + ExtBuilder::default().build().execute_with(|| { + let message = ClaimMessage::new(42, &charlie, &alice); + let sig = pair.sign(&blake2_256(&message.raw_bytes())[..]); + + assert_err!( + AccountMigration::claim_to(RuntimeOrigin::none(), 42, charlie.clone(), alice, sig), + Error::::AccountNotExist + ); + }); +} + +#[test] +fn claim_to_existed_account() { + let (pair, bogus) = SubAccounts::Bogus.to_pair(); + let bob: H160 = EthAccounts::Bob.into(); + + ExtBuilder::default() + .with_migrated_accounts(vec![(bogus.clone(), 1000)]) + .with_balances(vec![(bob, 500)]) + .build() + .execute_with(|| { + let message = ClaimMessage::new(42, &bogus, &bob); + let sig = pair.sign(&blake2_256(&message.raw_bytes())[..]); + + assert_eq!(AccountMigration::balance_of(bogus.clone()), Some(1000)); + assert_eq!(Balances::free_balance(bob), 500); + assert_ok!(AccountMigration::claim_to( + RuntimeOrigin::none(), + 42, + bogus.clone(), + bob, + sig + )); + assert!(AccountMigration::balance_of(bogus).is_none()); + assert_eq!(Balances::free_balance(bob), 1000 + 500); + }); +} + +#[test] +fn claim_event() { + let (pair, charlie) = SubAccounts::Charlie.to_pair(); + let alice: H160 = EthAccounts::Alice.into(); + + ExtBuilder::default() + .with_migrated_accounts(vec![(charlie.clone(), 1000)]) + .build() + .execute_with(|| { + let message = ClaimMessage::new(42, &charlie, &alice); + let sig = pair.sign(&blake2_256(&message.raw_bytes())[..]); + + assert_ok!(AccountMigration::claim_to( + RuntimeOrigin::none(), + 42, + charlie.clone(), + alice, + sig + )); + System::assert_has_event(RuntimeEvent::AccountMigration(crate::Event::Claim { + old_pub_key: charlie, + new_pub_key: alice, + amount: 1000, + })) + }); +} + +#[test] +fn claim_pre_dispatch_with_invalid_chain_id() { + let (pair, charlie) = SubAccounts::Charlie.to_pair(); + let alice: H160 = EthAccounts::Alice.into(); + + ExtBuilder::default() + .with_migrated_accounts(vec![(charlie.clone(), 1000)]) + .build() + .execute_with(|| { + let message = ClaimMessage::new(42, &charlie, &alice); + let sig = pair.sign(&blake2_256(&message.raw_bytes())[..]); + + let call = crate::Call::claim_to { + chain_id: 43, // The correct chain id is 42 + old_pub_key: charlie.clone(), + new_pub_key: alice, + sig, + }; + assert_err!( + AccountMigration::pre_dispatch(&call), + TransactionValidityError::Invalid(InvalidTransaction::BadProof) + ); + }); +} + +#[test] +fn claim_pre_dispatch_with_invalid_old_pub_key() { + let (pair, charlie) = SubAccounts::Charlie.to_pair(); + let alice: H160 = EthAccounts::Alice.into(); + + ExtBuilder::default().with_migrated_accounts(vec![]).build().execute_with(|| { + let message = ClaimMessage::new(42, &charlie, &alice); + let sig = pair.sign(&blake2_256(&message.raw_bytes())[..]); + + let call = crate::Call::claim_to { + chain_id: 42, + old_pub_key: charlie.clone(), + new_pub_key: alice, + sig, + }; + assert_err!( + AccountMigration::pre_dispatch(&call), + TransactionValidityError::Invalid(InvalidTransaction::BadSigner) + ); + }); +} + +#[test] +fn claim_pre_dispatch_with_invalid_signature() { + let (_, charlie) = SubAccounts::Charlie.to_pair(); + let (bogus_pair, _) = SubAccounts::Bogus.to_pair(); + let alice: H160 = EthAccounts::Alice.into(); + + ExtBuilder::default() + .with_migrated_accounts(vec![(charlie.clone(), 1000)]) + .build() + .execute_with(|| { + let message = ClaimMessage::new(42, &charlie, &alice); + let sig = bogus_pair.sign(&blake2_256(&message.raw_bytes())[..]); + + let call = crate::Call::claim_to { + chain_id: 42, + old_pub_key: charlie.clone(), + new_pub_key: alice, + sig, + }; + assert_err!( + AccountMigration::pre_dispatch(&call), + TransactionValidityError::Invalid(InvalidTransaction::BadSigner) + ); + }); +} diff --git a/runtime/crab/Cargo.toml b/runtime/crab/Cargo.toml index 370e34636..6c3b79b5e 100644 --- a/runtime/crab/Cargo.toml +++ b/runtime/crab/Cargo.toml @@ -36,6 +36,7 @@ parachain-info = { default-features = false, git = "https://git cumulus-pallet-session-benchmarking = { optional = true, default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } # darwinia +darwinia-account-migration = { default-features = false, path = "../../pallet/account-migration" } darwinia-common-runtime = { default-features = false, path = "../common" } darwinia-message-transact = { default-features = false, path = "../../pallet/message-transact" } darwinia-precompile-assets = { default-features = false, path = "../../precompile/assets" } @@ -144,6 +145,7 @@ std = [ "cumulus-pallet-session-benchmarking?/std", # darwinia + "darwinia-account-migration/std", "darwinia-common-runtime/std", "darwinia-message-transact/std", "darwinia-precompile-assets/std", diff --git a/runtime/crab/src/lib.rs b/runtime/crab/src/lib.rs index e0963fb87..63201b349 100644 --- a/runtime/crab/src/lib.rs +++ b/runtime/crab/src/lib.rs @@ -276,6 +276,7 @@ frame_support::construct_runtime! { Balances: pallet_balances = 5, TransactionPayment: pallet_transaction_payment = 6, Assets: pallet_assets = 34, + AccountMigration: darwinia_account_migration = 40, // Consensus stuff. Authorship: pallet_authorship = 7, diff --git a/runtime/crab/src/pallets/migrate.rs b/runtime/crab/src/pallets/migrate.rs new file mode 100644 index 000000000..0b40e9110 --- /dev/null +++ b/runtime/crab/src/pallets/migrate.rs @@ -0,0 +1,25 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +impl darwinia_account_migration::Config for Runtime { + type Currency = Balances; + type RuntimeEvent = RuntimeEvent; +} diff --git a/runtime/crab/src/pallets/mod.rs b/runtime/crab/src/pallets/mod.rs index 96d7c9236..493f9ddc5 100644 --- a/runtime/crab/src/pallets/mod.rs +++ b/runtime/crab/src/pallets/mod.rs @@ -41,6 +41,8 @@ mod transaction_payment; mod assets; +mod migrate; + // Consensus stuff. mod authorship; diff --git a/runtime/darwinia/Cargo.toml b/runtime/darwinia/Cargo.toml index 01ee28c50..b27ae95b1 100644 --- a/runtime/darwinia/Cargo.toml +++ b/runtime/darwinia/Cargo.toml @@ -35,6 +35,7 @@ parachain-info = { default-features = false, git = "https://git cumulus-pallet-session-benchmarking = { optional = true, default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } # darwinia +darwinia-account-migration = { default-features = false, path = "../../pallet/account-migration" } darwinia-common-runtime = { default-features = false, path = "../common" } darwinia-deposit = { default-features = false, path = "../../pallet/deposit" } darwinia-message-transact = { default-features = false, path = "../../pallet/message-transact" } @@ -145,6 +146,7 @@ std = [ "cumulus-pallet-session-benchmarking?/std", # darwinia + "darwinia-account-migration/std", "darwinia-common-runtime/std", "darwinia-deposit/std", "darwinia-message-transact/std", diff --git a/runtime/darwinia/src/lib.rs b/runtime/darwinia/src/lib.rs index 20dfba24a..d8f6bafdb 100644 --- a/runtime/darwinia/src/lib.rs +++ b/runtime/darwinia/src/lib.rs @@ -275,6 +275,7 @@ frame_support::construct_runtime! { TransactionPayment: pallet_transaction_payment = 6, Assets: pallet_assets = 34, Deposit: darwinia_deposit = 40, + AccountMigration: darwinia_account_migration = 41, // Consensus stuff. Authorship: pallet_authorship = 7, diff --git a/runtime/darwinia/src/pallets/migrate.rs b/runtime/darwinia/src/pallets/migrate.rs new file mode 100644 index 000000000..0b40e9110 --- /dev/null +++ b/runtime/darwinia/src/pallets/migrate.rs @@ -0,0 +1,25 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +impl darwinia_account_migration::Config for Runtime { + type Currency = Balances; + type RuntimeEvent = RuntimeEvent; +} diff --git a/runtime/darwinia/src/pallets/mod.rs b/runtime/darwinia/src/pallets/mod.rs index 40b660f6b..31c61b9d9 100644 --- a/runtime/darwinia/src/pallets/mod.rs +++ b/runtime/darwinia/src/pallets/mod.rs @@ -43,6 +43,7 @@ mod assets; mod deposit; +mod migrate; // Consensus stuff. mod authorship; diff --git a/runtime/pangolin/Cargo.toml b/runtime/pangolin/Cargo.toml index 8f71d50f6..9dfb456a6 100644 --- a/runtime/pangolin/Cargo.toml +++ b/runtime/pangolin/Cargo.toml @@ -36,6 +36,7 @@ parachain-info = { default-features = false, git = "https://git cumulus-pallet-session-benchmarking = { optional = true, default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } # darwinia +darwinia-account-migration = { default-features = false, path = "../../pallet/account-migration" } darwinia-common-runtime = { default-features = false, path = "../common" } darwinia-message-transact = { default-features = false, path = "../../pallet/message-transact" } darwinia-precompile-assets = { default-features = false, path = "../../precompile/assets" } @@ -144,6 +145,7 @@ std = [ "cumulus-pallet-session-benchmarking?/std", # darwinia + "darwinia-account-migration/std", "darwinia-common-runtime/std", "darwinia-message-transact/std", "darwinia-precompile-assets/std", diff --git a/runtime/pangolin/src/lib.rs b/runtime/pangolin/src/lib.rs index e832a5993..73bb9d614 100644 --- a/runtime/pangolin/src/lib.rs +++ b/runtime/pangolin/src/lib.rs @@ -272,6 +272,7 @@ frame_support::construct_runtime! { Balances: pallet_balances = 5, TransactionPayment: pallet_transaction_payment = 6, Assets: pallet_assets = 34, + AccountMigration: darwinia_account_migration = 36, // Consensus stuff. Authorship: pallet_authorship = 7, diff --git a/runtime/pangolin/src/pallets/migrate.rs b/runtime/pangolin/src/pallets/migrate.rs new file mode 100644 index 000000000..0b40e9110 --- /dev/null +++ b/runtime/pangolin/src/pallets/migrate.rs @@ -0,0 +1,25 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +impl darwinia_account_migration::Config for Runtime { + type Currency = Balances; + type RuntimeEvent = RuntimeEvent; +} diff --git a/runtime/pangolin/src/pallets/mod.rs b/runtime/pangolin/src/pallets/mod.rs index 597ae9ed1..4ec80c833 100644 --- a/runtime/pangolin/src/pallets/mod.rs +++ b/runtime/pangolin/src/pallets/mod.rs @@ -41,6 +41,8 @@ mod balances; mod transaction_payment; +mod migrate; + // Consensus stuff. mod authorship; From 1720db6ed0425ea4120836775e648b6dafd849db Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Tue, 6 Dec 2022 16:57:00 +0800 Subject: [PATCH 028/189] Handle reference count (#102) * Handle reference count * Fix test --- pallet/deposit/src/lib.rs | 44 ++++++++++++++++++++++++----------- pallet/deposit/tests/tests.rs | 36 +++++++++++++++++----------- pallet/staking/tests/tests.rs | 12 +++++----- 3 files changed, 60 insertions(+), 32 deletions(-) diff --git a/pallet/deposit/src/lib.rs b/pallet/deposit/src/lib.rs index d280bd2aa..6f43e31e1 100644 --- a/pallet/deposit/src/lib.rs +++ b/pallet/deposit/src/lib.rs @@ -137,13 +137,8 @@ pub mod pallet { /// The items must be sorted by the id. #[pallet::storage] #[pallet::getter(fn deposit_of)] - pub type Deposits = StorageMap< - _, - Blake2_128Concat, - T::AccountId, - BoundedVec, - ValueQuery, - >; + pub type Deposits = + StorageMap<_, Blake2_128Concat, T::AccountId, BoundedVec>; #[pallet::pallet] #[pallet::generate_store(pub(super) trait Store)] @@ -169,6 +164,16 @@ pub mod pallet { } >::try_mutate(&who, |ds| { + let ds = if let Some(ds) = ds { + ds + } else { + >::inc_consumers(&who)?; + + *ds = Some(Default::default()); + + ds.as_mut().expect("[pallet::deposit] `ds` must be some; qed") + }; + // Keep the list sorted in increasing order. // And find the missing id. let id = match ds.iter().map(|d| d.id).try_fold(0, |i, id| match i.cmp(&id) { @@ -190,12 +195,13 @@ pub mod pallet { in_use: false, }, ) - .map_err(|_| >::ExceedMaxDeposits) + .map_err(|_| >::ExceedMaxDeposits)?; + + DispatchResult::Ok(()) })?; T::Ring::transfer(&who, &Self::account_id(), amount, KeepAlive)?; T::Kton::mint(&who, dc_inflation::deposit_interest(amount, months))?; - // TODO: account ref // TODO: event? Ok(()) @@ -207,8 +213,9 @@ pub mod pallet { let who = ensure_signed(origin)?; let now = T::UnixTime::now().as_millis(); let mut claimed = 0; + let _ = >::try_mutate(&who, |maybe_ds| { + let Some(ds) = maybe_ds else { return Err(()); }; - >::mutate(&who, |ds| { ds.retain(|d| { if d.expired_time <= now && !d.in_use { claimed += d.value; @@ -218,10 +225,18 @@ pub mod pallet { true } }); + + if ds.is_empty() { + >::dec_consumers(&who); + + *maybe_ds = None; + } + + Ok(()) }); + T::Ring::transfer(&Self::account_id(), &who, claimed, AllowDeath)?; - // TODO: account ref // TODO: event? Ok(()) @@ -250,6 +265,7 @@ where fn stake(who: &Self::AccountId, item: Self::Item) -> DispatchResult { >::try_mutate(who, |ds| { + let Some(ds) = ds else { return Err(>::DepositNotFound)?; }; let Some(d) = ds.iter_mut().find(|d| d.id == item) else { return Err(>::DepositNotFound)?; }; @@ -266,6 +282,7 @@ where fn unstake(who: &Self::AccountId, item: Self::Item) -> DispatchResult { >::try_mutate(who, |ds| { + let Some(ds) = ds else { return Err(>::DepositNotFound)?; }; let Some(d) = ds.iter_mut().find(|d| d.id == item) else { return Err(>::DepositNotFound)?; }; @@ -288,8 +305,9 @@ where fn amount(who: &Self::AccountId, item: Self::Item) -> Self::Amount { >::get(who) - .into_iter() - .find_map(|d| if d.id == item { Some(d.value) } else { None }) + .and_then(|ds| { + ds.into_iter().find_map(|d| if d.id == item { Some(d.value) } else { None }) + }) .unwrap_or_default() } } diff --git a/pallet/deposit/tests/tests.rs b/pallet/deposit/tests/tests.rs index 75a37d38c..2b27152ee 100644 --- a/pallet/deposit/tests/tests.rs +++ b/pallet/deposit/tests/tests.rs @@ -29,9 +29,11 @@ use frame_support::{assert_noop, assert_ok, traits::Get}; #[test] fn lock_should_work() { new_test_ext().execute_with(|| { + assert_eq!(System::account(&1).consumers, 0); assert_eq!(Balances::free_balance(&Deposit::account_id()), 0); assert_eq!(Balances::free_balance(&1), 1_000 * UNIT); assert_ok!(Deposit::lock(RuntimeOrigin::signed(1), 10 * UNIT, 1)); + assert_eq!(System::account(&1).consumers, 1); assert_eq!(Balances::free_balance(&Deposit::account_id()), 10 * UNIT); assert_eq!(Balances::free_balance(&1), 990 * UNIT); }); @@ -53,14 +55,14 @@ fn deposit_interest_should_work() { #[test] fn unique_identity_should_work() { new_test_ext().execute_with(|| { - assert!(Deposit::deposit_of(&1).is_empty()); + assert!(Deposit::deposit_of(&1).is_none()); assert_ok!(Deposit::lock(RuntimeOrigin::signed(1), UNIT, 1)); assert_ok!(Deposit::lock(RuntimeOrigin::signed(1), 2 * UNIT, 2)); assert_ok!(Deposit::lock(RuntimeOrigin::signed(1), 3 * UNIT, 1)); assert_ok!(Deposit::lock(RuntimeOrigin::signed(1), 4 * UNIT, 2)); assert_ok!(Deposit::lock(RuntimeOrigin::signed(1), 5 * UNIT, 1)); assert_eq!( - Deposit::deposit_of(&1).as_slice(), + Deposit::deposit_of(&1).unwrap().as_slice(), &[ DepositS { id: 0, value: UNIT, expired_time: MILLISECS_PER_MONTH, in_use: false }, DepositS { @@ -95,7 +97,7 @@ fn unique_identity_should_work() { assert_ok!(Deposit::lock(RuntimeOrigin::signed(1), 6 * UNIT, 1)); assert_eq!( - Deposit::deposit_of(&1).as_slice(), + Deposit::deposit_of(&1).unwrap().as_slice(), &[ DepositS { id: 0, @@ -120,7 +122,7 @@ fn unique_identity_should_work() { assert_ok!(Deposit::lock(RuntimeOrigin::signed(1), 7 * UNIT, 1)); assert_eq!( - Deposit::deposit_of(&1).as_slice(), + Deposit::deposit_of(&1).unwrap().as_slice(), &[ DepositS { id: 0, @@ -151,7 +153,7 @@ fn unique_identity_should_work() { assert_ok!(Deposit::lock(RuntimeOrigin::signed(1), 8 * UNIT, 1)); assert_eq!( - Deposit::deposit_of(&1).as_slice(), + Deposit::deposit_of(&1).unwrap().as_slice(), &[ DepositS { id: 0, @@ -196,7 +198,7 @@ fn expire_time_should_work() { efflux(MILLISECS_PER_MONTH); }); assert_eq!( - Deposit::deposit_of(&1).as_slice(), + Deposit::deposit_of(&1).unwrap().as_slice(), (1..=8) .map(|i| DepositS { id: i - 1, @@ -246,29 +248,37 @@ fn lock_should_fail() { #[test] fn claim_should_work() { new_test_ext().execute_with(|| { - assert!(Deposit::deposit_of(&1).is_empty()); + assert!(Deposit::deposit_of(&1).is_none()); assert_ok!(Deposit::claim(RuntimeOrigin::signed(1))); - assert!(Deposit::deposit_of(&1).is_empty()); + assert!(Deposit::deposit_of(&1).is_none()); assert_ok!(Deposit::lock(RuntimeOrigin::signed(1), UNIT, 1)); - assert!(!Deposit::deposit_of(&1).is_empty()); + assert!(!Deposit::deposit_of(&1).is_none()); efflux(MILLISECS_PER_MONTH - 1); + assert_eq!(System::account(&1).consumers, 1); assert_ok!(Deposit::claim(RuntimeOrigin::signed(1))); - assert!(!Deposit::deposit_of(&1).is_empty()); + assert_eq!(System::account(&1).consumers, 1); + assert!(!Deposit::deposit_of(&1).is_none()); efflux(MILLISECS_PER_MONTH); + assert_eq!(System::account(&1).consumers, 1); assert_ok!(Deposit::claim(RuntimeOrigin::signed(1))); - assert!(Deposit::deposit_of(&1).is_empty()); + assert_eq!(System::account(&1).consumers, 0); + assert!(Deposit::deposit_of(&1).is_none()); assert_ok!(Deposit::lock(RuntimeOrigin::signed(1), UNIT, 1)); assert_ok!(Deposit::stake(&1, 0)); efflux(2 * MILLISECS_PER_MONTH); + assert_eq!(System::account(&1).consumers, 1); assert_ok!(Deposit::claim(RuntimeOrigin::signed(1))); - assert!(!Deposit::deposit_of(&1).is_empty()); + assert_eq!(System::account(&1).consumers, 1); + assert!(!Deposit::deposit_of(&1).is_none()); assert_ok!(Deposit::unstake(&1, 0)); + assert_eq!(System::account(&1).consumers, 1); assert_ok!(Deposit::claim(RuntimeOrigin::signed(1))); - assert!(Deposit::deposit_of(&1).is_empty()); + assert_eq!(System::account(&1).consumers, 0); + assert!(Deposit::deposit_of(&1).is_none()); }); } diff --git a/pallet/staking/tests/tests.rs b/pallet/staking/tests/tests.rs index 5ee8a6aa7..917857398 100644 --- a/pallet/staking/tests/tests.rs +++ b/pallet/staking/tests/tests.rs @@ -70,7 +70,7 @@ fn stake_should_work() { ); // Stake 500 RING, 500 KTON and 2 deposits. - assert_eq!(System::account(1).consumers, 1); + assert_eq!(System::account(1).consumers, 2); assert_ok!(Deposit::lock(RuntimeOrigin::signed(1), 200 * UNIT, 1)); assert_ok!(Deposit::lock(RuntimeOrigin::signed(1), 200 * UNIT, 1)); assert_ok!(Staking::stake(RuntimeOrigin::signed(1), 500 * UNIT, 500 * UNIT, vec![1, 2])); @@ -184,7 +184,7 @@ fn claim_should_work() { assert_ok!(Deposit::lock(RuntimeOrigin::signed(1), UNIT, 1)); assert_ok!(Deposit::lock(RuntimeOrigin::signed(1), UNIT, 1)); assert_ok!(Staking::stake(RuntimeOrigin::signed(1), 2 * UNIT, 2 * UNIT, vec![0, 1, 2])); - assert_eq!(System::account(1).consumers, 1); + assert_eq!(System::account(1).consumers, 2); assert_ok!(Staking::unstake(RuntimeOrigin::signed(1), UNIT, 0, Vec::new())); Efflux::block(1); assert_ok!(Staking::unstake(RuntimeOrigin::signed(1), 0, UNIT, Vec::new())); @@ -209,7 +209,7 @@ fn claim_should_work() { // 4 expired. assert_ok!(Staking::claim(RuntimeOrigin::signed(1))); - assert_eq!(System::account(1).consumers, 1); + assert_eq!(System::account(1).consumers, 2); assert_eq!(Balances::free_balance(1), 996 * UNIT); assert_eq!( Staking::ledger_of(1).unwrap(), @@ -227,7 +227,7 @@ fn claim_should_work() { // 5 expired. Efflux::block(1); assert_ok!(Staking::claim(RuntimeOrigin::signed(1))); - assert_eq!(System::account(1).consumers, 1); + assert_eq!(System::account(1).consumers, 2); assert_eq!(Assets::balance(0, 1), 999 * UNIT + 22_842_639_593_907); assert_eq!( Staking::ledger_of(1).unwrap(), @@ -245,7 +245,7 @@ fn claim_should_work() { // 6 expired. Efflux::block(1); assert_ok!(Staking::claim(RuntimeOrigin::signed(1))); - assert_eq!(System::account(1).consumers, 1); + assert_eq!(System::account(1).consumers, 2); assert_eq!(Assets::balance(0, 1), 999 * UNIT + 22_842_639_593_907); assert_eq!( Staking::ledger_of(1).unwrap(), @@ -263,7 +263,7 @@ fn claim_should_work() { // 7 expired. Efflux::block(2); assert_ok!(Staking::claim(RuntimeOrigin::signed(1))); - assert_eq!(System::account(1).consumers, 0); + assert_eq!(System::account(1).consumers, 1); assert_eq!(Balances::free_balance(1), 997 * UNIT); assert_eq!(Assets::balance(0, 1), 1_000 * UNIT + 22_842_639_593_907); assert!(Staking::ledger_of(1).is_none()); From 437b769de5cc28bc64019135484a140af604f51c Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Tue, 6 Dec 2022 18:18:22 +0800 Subject: [PATCH 029/189] Housekeeping (#105) * Housekeeping * Format --- node/src/chain_spec/crab.rs | 137 ++++++++++------------------ node/src/chain_spec/darwinia.rs | 41 ++------- node/src/chain_spec/mod.rs | 6 +- node/src/chain_spec/pangolin.rs | 137 ++++++++++------------------ node/src/command.rs | 4 +- pallet/staking/src/lib.rs | 12 +-- runtime/crab/src/lib.rs | 2 +- runtime/crab/src/pallets/mod.rs | 2 +- runtime/darwinia/src/lib.rs | 2 +- runtime/darwinia/src/pallets/mod.rs | 2 +- 10 files changed, 119 insertions(+), 226 deletions(-) diff --git a/node/src/chain_spec/crab.rs b/node/src/chain_spec/crab.rs index c1eb487d1..426353994 100644 --- a/node/src/chain_spec/crab.rs +++ b/node/src/chain_spec/crab.rs @@ -24,51 +24,42 @@ use std::{collections::BTreeMap, str::FromStr}; use cumulus_primitives_core::ParaId; // darwinia use super::*; -use crab_runtime::{AuraId, CrabPrecompiles, EvmConfig, Runtime}; +use crab_runtime::*; use dc_primitives::*; // frontier use fp_evm::GenesisAccount; // substrate +use sc_chain_spec::Properties; use sc_service::ChainType; use sp_core::H160; /// Specialized `ChainSpec` for the normal parachain runtime. -pub type ChainSpec = sc_service::GenericChainSpec; +pub type ChainSpec = sc_service::GenericChainSpec; -/// Generate the session keys from individual elements. -/// -/// The input must be a tuple of individual keys (a single arg for now since we have just one key). -pub fn session_keys(keys: AuraId) -> crab_runtime::SessionKeys { - crab_runtime::SessionKeys { aura: keys } +fn properties() -> Properties { + super::properties("CRAB", 42) } -pub fn development_config() -> ChainSpec { - // Give your base currency a unit name and decimal places - let mut properties = sc_chain_spec::Properties::new(); - properties.insert("tokenSymbol".into(), "CRAB".into()); - properties.insert("tokenDecimals".into(), 18.into()); - properties.insert("ss58Format".into(), 42.into()); +// Generate the session keys from individual elements. +// +// The input must be a tuple of individual keys (a single arg for now since we have just one key). +fn session_keys(keys: AuraId) -> SessionKeys { + SessionKeys { aura: keys } +} +pub fn development_config() -> ChainSpec { ChainSpec::from_genesis( - // Name "Crab2 Development", - // ID - "crab-dev", + "crab2-development", ChainType::Development, move || { testnet_genesis( - // initial collators. vec![ // Bind the `Alice` to `Alith` to make `--alice` available for testnet. ( array_bytes::hex_n_into_unchecked(ALITH), get_collator_keys_from_seed("Alice"), ), - // Bind the `Bob` to `Balthar` to make `--bob` available for testnet. - ( - array_bytes::hex_n_into_unchecked(BALTATHAR), - get_collator_keys_from_seed("Bob"), - ), ], vec![ array_bytes::hex_n_into_unchecked(ALITH), @@ -83,9 +74,9 @@ pub fn development_config() -> ChainSpec { }, Vec::new(), None, + Some(PROTOCOL_ID), None, - None, - Some(properties), + Some(properties()), Extensions { relay_chain: "rococo-local".into(), // You MUST set this to the correct network! para_id: 2105, @@ -93,22 +84,13 @@ pub fn development_config() -> ChainSpec { ) } -pub fn local_testnet_config() -> ChainSpec { - // Give your base currency a unit name and decimal places - let mut properties = sc_chain_spec::Properties::new(); - properties.insert("tokenSymbol".into(), "CRAB".into()); - properties.insert("tokenDecimals".into(), 18.into()); - properties.insert("ss58Format".into(), 42.into()); - +pub fn local_config() -> ChainSpec { ChainSpec::from_genesis( - // Name - "Crab2 Local Testnet", - // ID - "crab_local_testnet", + "Crab2 Local", + "crab2-local", ChainType::Local, move || { testnet_genesis( - // initial collators. vec![ // Bind the `Alice` to `Alith` to make `--alice` available for testnet. ( @@ -120,6 +102,11 @@ pub fn local_testnet_config() -> ChainSpec { array_bytes::hex_n_into_unchecked(BALTATHAR), get_collator_keys_from_seed("Bob"), ), + // Bind the `Charlie` to `CHARLETH` to make `--charlie` available for testnet. + ( + array_bytes::hex_n_into_unchecked(CHARLETH), + get_collator_keys_from_seed("Charlie"), + ), ], vec![ array_bytes::hex_n_into_unchecked(ALITH), @@ -132,17 +119,11 @@ pub fn local_testnet_config() -> ChainSpec { 2105.into(), ) }, - // Bootnodes Vec::new(), - // Telemetry None, - // Protocol ID - Some("crab"), - // Fork ID + Some(PROTOCOL_ID), None, - // Properties - Some(properties), - // Extensions + Some(properties()), Extensions { relay_chain: "rococo-local".into(), // You MUST set this to the correct network! para_id: 2105, @@ -150,30 +131,20 @@ pub fn local_testnet_config() -> ChainSpec { ) } -pub fn config() -> ChainSpec { - // Give your base currency a unit name and decimal places - let mut properties = sc_chain_spec::Properties::new(); - properties.insert("tokenSymbol".into(), "CRAB".into()); - properties.insert("tokenDecimals".into(), 18.into()); - properties.insert("ss58Format".into(), 42.into()); - +pub fn genesis_config() -> ChainSpec { // TODO: update this before final release ChainSpec::from_genesis( // Name "Crab2", // ID - "crab", + "crab2", ChainType::Live, move || { - crab_runtime::GenesisConfig { + GenesisConfig { // System stuff. - system: crab_runtime::SystemConfig { - code: crab_runtime::WASM_BINARY - .expect("WASM binary was not build, please build it!") - .to_vec(), - }, + system: SystemConfig { code: WASM_BINARY.unwrap().to_vec() }, parachain_system: Default::default(), - parachain_info: crab_runtime::ParachainInfoConfig { parachain_id: 2105.into() }, + parachain_info: ParachainInfoConfig { parachain_id: 2105.into() }, // Monetary stuff. balances: Default::default(), @@ -182,11 +153,11 @@ pub fn config() -> ChainSpec { account_migration: Default::default(), // Consensus stuff. - collator_selection: crab_runtime::CollatorSelectionConfig { + collator_selection: CollatorSelectionConfig { invulnerables: vec![array_bytes::hex_n_into_unchecked(ALITH)], ..Default::default() }, - session: crab_runtime::SessionConfig { + session: SessionConfig { keys: vec![( array_bytes::hex_n_into_unchecked(ALITH), array_bytes::hex_n_into_unchecked(ALITH), @@ -211,32 +182,24 @@ pub fn config() -> ChainSpec { vesting: Default::default(), // XCM stuff. - polkadot_xcm: crab_runtime::PolkadotXcmConfig { - safe_xcm_version: Some(SAFE_XCM_VERSION), - }, + polkadot_xcm: PolkadotXcmConfig { safe_xcm_version: Some(SAFE_XCM_VERSION) }, // EVM stuff. ethereum: Default::default(), evm: Default::default(), base_fee: Default::default(), - // S2S stuff + // S2S stuff. bridge_darwinia_grandpa: Default::default(), bridge_darwinia_messages: Default::default(), darwinia_fee_market: Default::default(), } }, - // Bootnodes Vec::new(), - // Telemetry None, - // Protocol ID - Some("crab"), - // Fork ID + Some(PROTOCOL_ID), None, - // Properties - Some(properties), - // Extensions + Some(properties()), Extensions { relay_chain: "kusama".into(), // You MUST set this to the correct network! para_id: 2105, @@ -244,19 +207,23 @@ pub fn config() -> ChainSpec { ) } +pub fn config() -> ChainSpec { + unimplemented!("TODO") +} + fn testnet_genesis( invulnerables: Vec<(AccountId, AuraId)>, endowed_accounts: Vec, id: ParaId, -) -> crab_runtime::GenesisConfig { - crab_runtime::GenesisConfig { +) -> GenesisConfig { + GenesisConfig { // System stuff. - system: crab_runtime::SystemConfig { code: crab_runtime::WASM_BINARY.unwrap().to_vec() }, + system: SystemConfig { code: WASM_BINARY.unwrap().to_vec() }, parachain_system: Default::default(), - parachain_info: crab_runtime::ParachainInfoConfig { parachain_id: id }, + parachain_info: ParachainInfoConfig { parachain_id: id }, // Monetary stuff. - balances: crab_runtime::BalancesConfig { + balances: BalancesConfig { balances: endowed_accounts.iter().cloned().map(|k| (k, 100_000_000 * UNIT)).collect(), }, transaction_payment: Default::default(), @@ -264,12 +231,12 @@ fn testnet_genesis( account_migration: Default::default(), // Consensus stuff. - collator_selection: crab_runtime::CollatorSelectionConfig { + collator_selection: CollatorSelectionConfig { invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(), candidacy_bond: UNIT, ..Default::default() }, - session: crab_runtime::SessionConfig { + session: SessionConfig { keys: invulnerables .into_iter() .map(|(acc, aura)| { @@ -281,8 +248,6 @@ fn testnet_genesis( }) .collect(), }, - // no need to pass anything to aura, in fact it will panic if we do. Session will take care - // of this. aura: Default::default(), aura_ext: Default::default(), @@ -299,7 +264,7 @@ fn testnet_genesis( vesting: Default::default(), // XCM stuff. - polkadot_xcm: crab_runtime::PolkadotXcmConfig { safe_xcm_version: Some(SAFE_XCM_VERSION) }, + polkadot_xcm: PolkadotXcmConfig { safe_xcm_version: Some(SAFE_XCM_VERSION) }, // EVM stuff. ethereum: Default::default(), @@ -347,13 +312,9 @@ fn testnet_genesis( }, base_fee: Default::default(), - // S2S stuff + // S2S stuff. bridge_darwinia_grandpa: Default::default(), bridge_darwinia_messages: Default::default(), darwinia_fee_market: Default::default(), } } - -pub fn genesis_config() -> ChainSpec { - unimplemented!("TODO") -} diff --git a/node/src/chain_spec/darwinia.rs b/node/src/chain_spec/darwinia.rs index 0c42b96c4..9fa5ce7af 100644 --- a/node/src/chain_spec/darwinia.rs +++ b/node/src/chain_spec/darwinia.rs @@ -41,10 +41,9 @@ use sp_core::H160; pub type ChainSpec = sc_service::GenericChainSpec; fn properties() -> Properties { - super::properties("RING") + super::properties("RING", 18) } -// TODO: maybe a more general one // Generate the session keys from individual elements. // // The input must be a tuple of individual keys (a single arg for now since we have just one key). @@ -54,30 +53,17 @@ fn session_keys(keys: AuraId) -> SessionKeys { pub fn development_config() -> ChainSpec { ChainSpec::from_genesis( - // Name "Darwinia2 Development", - // ID "darwinia2-development", ChainType::Development, move || { testnet_genesis( - // Initial collators. vec![ // Bind the `Alice` to `Alith` to make `--alice` available for testnet. ( array_bytes::hex_n_into_unchecked(ALITH), get_collator_keys_from_seed("Alice"), ), - // Bind the `Bob` to `Balthar` to make `--bob` available for testnet. - ( - array_bytes::hex_n_into_unchecked(BALTATHAR), - get_collator_keys_from_seed("Bob"), - ), - // Bind the `Charlie` to `CHARLETH` to make `--charlie` available for testnet. - ( - array_bytes::hex_n_into_unchecked(CHARLETH), - get_collator_keys_from_seed("Charlie"), - ), ], vec![ array_bytes::hex_n_into_unchecked(ALITH), @@ -92,7 +78,7 @@ pub fn development_config() -> ChainSpec { }, Vec::new(), None, - None, + Some(PROTOCOL_ID), None, Some(properties()), Extensions { @@ -104,14 +90,11 @@ pub fn development_config() -> ChainSpec { pub fn local_config() -> ChainSpec { ChainSpec::from_genesis( - // Name "Darwinia2 Local", - // ID "darwinia2-local", ChainType::Local, move || { testnet_genesis( - // Initial collators. vec![ // Bind the `Alice` to `Alith` to make `--alice` available for testnet. ( @@ -142,7 +125,7 @@ pub fn local_config() -> ChainSpec { }, Vec::new(), None, - None, + Some(PROTOCOL_ID), None, Some(properties()), Extensions { @@ -163,11 +146,7 @@ pub fn genesis_config() -> ChainSpec { move || { GenesisConfig { // System stuff. - system: SystemConfig { - code: WASM_BINARY - .expect("WASM binary was not build, please build it!") - .to_vec(), - }, + system: SystemConfig { code: WASM_BINARY.unwrap().to_vec() }, parachain_system: Default::default(), parachain_info: ParachainInfoConfig { parachain_id: 2046.into() }, @@ -214,23 +193,17 @@ pub fn genesis_config() -> ChainSpec { evm: Default::default(), base_fee: Default::default(), - // S2S stuff + // S2S stuff. bridge_crab_grandpa: Default::default(), bridge_crab_messages: Default::default(), crab_fee_market: Default::default(), } }, - // Bootnodes Vec::new(), - // Telemetry None, - // Protocol ID - Some("darwinia"), - // Fork ID + Some(PROTOCOL_ID), None, - // Properties Some(properties()), - // Extensions Extensions { relay_chain: "polkadot".into(), // You MUST set this to the correct network! para_id: 2046, @@ -344,7 +317,7 @@ fn testnet_genesis( }, base_fee: Default::default(), - // S2S stuff + // S2S stuff. bridge_crab_grandpa: Default::default(), bridge_crab_messages: Default::default(), crab_fee_market: Default::default(), diff --git a/node/src/chain_spec/mod.rs b/node/src/chain_spec/mod.rs index 9ec06988b..6f7cfbaba 100644 --- a/node/src/chain_spec/mod.rs +++ b/node/src/chain_spec/mod.rs @@ -50,6 +50,8 @@ const FAITH: &str = "0xC0F0f4ab324C46e55D02D0033343B4Be8A55532d"; /// The default XCM version to set in genesis config. const SAFE_XCM_VERSION: u32 = xcm::prelude::XCM_VERSION; +const PROTOCOL_ID: &str = "dar"; + /// The extensions for the [`ChainSpec`]. #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, ChainSpecGroup, ChainSpecExtension)] #[serde(deny_unknown_fields)] @@ -66,12 +68,12 @@ impl Extensions { } } -fn properties(token_symbol: &str) -> Properties { +fn properties(token_symbol: &str, ss58_format: u16) -> Properties { let mut properties = Properties::new(); properties.insert("tokenSymbol".into(), token_symbol.into()); properties.insert("tokenDecimals".into(), 18.into()); - properties.insert("ss58Format".into(), 18.into()); + properties.insert("ss58Format".into(), ss58_format.into()); properties } diff --git a/node/src/chain_spec/pangolin.rs b/node/src/chain_spec/pangolin.rs index d6f66de12..42a58a0fd 100644 --- a/node/src/chain_spec/pangolin.rs +++ b/node/src/chain_spec/pangolin.rs @@ -25,50 +25,41 @@ use cumulus_primitives_core::ParaId; // darwinia use super::*; use dc_primitives::*; -use pangolin_runtime::{AuraId, EvmConfig, PangolinPrecompiles, Runtime}; +use pangolin_runtime::*; // frontier use fp_evm::GenesisAccount; // substrate +use sc_chain_spec::Properties; use sc_service::ChainType; use sp_core::H160; /// Specialized `ChainSpec` for the normal parachain runtime. -pub type ChainSpec = sc_service::GenericChainSpec; +pub type ChainSpec = sc_service::GenericChainSpec; -/// Generate the session keys from individual elements. -/// -/// The input must be a tuple of individual keys (a single arg for now since we have just one key). -pub fn session_keys(keys: AuraId) -> pangolin_runtime::SessionKeys { - pangolin_runtime::SessionKeys { aura: keys } +fn properties() -> Properties { + super::properties("PRING", 42) } -pub fn development_config() -> ChainSpec { - // Give your base currency a unit name and decimal places - let mut properties = sc_chain_spec::Properties::new(); - properties.insert("tokenSymbol".into(), "PRING".into()); - properties.insert("tokenDecimals".into(), 18.into()); - properties.insert("ss58Format".into(), 42.into()); +// Generate the session keys from individual elements. +// +// The input must be a tuple of individual keys (a single arg for now since we have just one key). +fn session_keys(keys: AuraId) -> SessionKeys { + SessionKeys { aura: keys } +} +pub fn development_config() -> ChainSpec { ChainSpec::from_genesis( - // Name "Pangolin2 Development", - // ID - "pangolin-dev", + "pangolin2-development", ChainType::Development, move || { testnet_genesis( - // initial collators. vec![ // Bind the `Alice` to `Alith` to make `--alice` available for testnet. ( array_bytes::hex_n_into_unchecked(ALITH), get_collator_keys_from_seed("Alice"), ), - // Bind the `Bob` to `Balthar` to make `--bob` available for testnet. - ( - array_bytes::hex_n_into_unchecked(BALTATHAR), - get_collator_keys_from_seed("Bob"), - ), ], vec![ array_bytes::hex_n_into_unchecked(ALITH), @@ -83,9 +74,9 @@ pub fn development_config() -> ChainSpec { }, Vec::new(), None, + Some(PROTOCOL_ID), None, - None, - Some(properties), + Some(properties()), Extensions { relay_chain: "rococo-local".into(), // You MUST set this to the correct network! para_id: 2105, @@ -93,22 +84,13 @@ pub fn development_config() -> ChainSpec { ) } -pub fn local_testnet_config() -> ChainSpec { - // Give your base currency a unit name and decimal places - let mut properties = sc_chain_spec::Properties::new(); - properties.insert("tokenSymbol".into(), "PRING".into()); - properties.insert("tokenDecimals".into(), 18.into()); - properties.insert("ss58Format".into(), 42.into()); - +pub fn local_config() -> ChainSpec { ChainSpec::from_genesis( - // Name - "Pangolin2 Local Testnet", - // ID - "pangolin_local_testnet", + "Pangolin2 Local", + "pangolin2-local", ChainType::Local, move || { testnet_genesis( - // initial collators. vec![ // Bind the `Alice` to `Alith` to make `--alice` available for testnet. ( @@ -120,6 +102,11 @@ pub fn local_testnet_config() -> ChainSpec { array_bytes::hex_n_into_unchecked(BALTATHAR), get_collator_keys_from_seed("Bob"), ), + // Bind the `Charlie` to `CHARLETH` to make `--charlie` available for testnet. + ( + array_bytes::hex_n_into_unchecked(CHARLETH), + get_collator_keys_from_seed("Charlie"), + ), ], vec![ array_bytes::hex_n_into_unchecked(ALITH), @@ -132,17 +119,11 @@ pub fn local_testnet_config() -> ChainSpec { 2105.into(), ) }, - // Bootnodes Vec::new(), - // Telemetry None, - // Protocol ID - Some("crab"), - // Fork ID + Some(PROTOCOL_ID), None, - // Properties - Some(properties), - // Extensions + Some(properties()), Extensions { relay_chain: "rococo-local".into(), // You MUST set this to the correct network! para_id: 2105, @@ -150,30 +131,20 @@ pub fn local_testnet_config() -> ChainSpec { ) } -pub fn config() -> ChainSpec { - // Give your base currency a unit name and decimal places - let mut properties = sc_chain_spec::Properties::new(); - properties.insert("tokenSymbol".into(), "PRING".into()); - properties.insert("tokenDecimals".into(), 18.into()); - properties.insert("ss58Format".into(), 42.into()); - +pub fn genesis_config() -> ChainSpec { // TODO: update this before final release ChainSpec::from_genesis( // Name "Pangolin2", // ID - "pangolin", + "pangolin2", ChainType::Live, move || { - pangolin_runtime::GenesisConfig { + GenesisConfig { // System stuff. - system: pangolin_runtime::SystemConfig { - code: pangolin_runtime::WASM_BINARY - .expect("WASM binary was not build, please build it!") - .to_vec(), - }, + system: SystemConfig { code: WASM_BINARY.unwrap().to_vec() }, parachain_system: Default::default(), - parachain_info: pangolin_runtime::ParachainInfoConfig { parachain_id: 2105.into() }, + parachain_info: ParachainInfoConfig { parachain_id: 2105.into() }, // Monetary stuff. balances: Default::default(), @@ -182,11 +153,11 @@ pub fn config() -> ChainSpec { account_migration: Default::default(), // Consensus stuff. - collator_selection: pangolin_runtime::CollatorSelectionConfig { + collator_selection: CollatorSelectionConfig { invulnerables: vec![array_bytes::hex_n_into_unchecked(ALITH)], ..Default::default() }, - session: pangolin_runtime::SessionConfig { + session: SessionConfig { keys: vec![( array_bytes::hex_n_into_unchecked(ALITH), array_bytes::hex_n_into_unchecked(ALITH), @@ -211,9 +182,7 @@ pub fn config() -> ChainSpec { vesting: Default::default(), // XCM stuff. - polkadot_xcm: pangolin_runtime::PolkadotXcmConfig { - safe_xcm_version: Some(SAFE_XCM_VERSION), - }, + polkadot_xcm: PolkadotXcmConfig { safe_xcm_version: Some(SAFE_XCM_VERSION) }, // EVM stuff. ethereum: Default::default(), @@ -221,17 +190,11 @@ pub fn config() -> ChainSpec { base_fee: Default::default(), } }, - // Bootnodes Vec::new(), - // Telemetry None, - // Protocol ID - Some("pangolin"), - // Fork ID + Some(PROTOCOL_ID), None, - // Properties - Some(properties), - // Extensions + Some(properties()), Extensions { relay_chain: "rococo".into(), // You MUST set this to the correct network! para_id: 2105, @@ -239,21 +202,23 @@ pub fn config() -> ChainSpec { ) } +pub fn config() -> ChainSpec { + unimplemented!("TODO") +} + fn testnet_genesis( invulnerables: Vec<(AccountId, AuraId)>, endowed_accounts: Vec, id: ParaId, -) -> pangolin_runtime::GenesisConfig { - pangolin_runtime::GenesisConfig { +) -> GenesisConfig { + GenesisConfig { // System stuff. - system: pangolin_runtime::SystemConfig { - code: pangolin_runtime::WASM_BINARY.unwrap().to_vec(), - }, + system: SystemConfig { code: WASM_BINARY.unwrap().to_vec() }, parachain_system: Default::default(), - parachain_info: pangolin_runtime::ParachainInfoConfig { parachain_id: id }, + parachain_info: ParachainInfoConfig { parachain_id: id }, // Monetary stuff. - balances: pangolin_runtime::BalancesConfig { + balances: BalancesConfig { balances: endowed_accounts.iter().cloned().map(|k| (k, 100_000_000 * UNIT)).collect(), }, transaction_payment: Default::default(), @@ -261,12 +226,12 @@ fn testnet_genesis( account_migration: Default::default(), // Consensus stuff. - collator_selection: pangolin_runtime::CollatorSelectionConfig { + collator_selection: CollatorSelectionConfig { invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(), candidacy_bond: UNIT, ..Default::default() }, - session: pangolin_runtime::SessionConfig { + session: SessionConfig { keys: invulnerables .into_iter() .map(|(acc, aura)| { @@ -278,8 +243,6 @@ fn testnet_genesis( }) .collect(), }, - // no need to pass anything to aura, in fact it will panic if we do. Session will take care - // of this. aura: Default::default(), aura_ext: Default::default(), @@ -296,9 +259,7 @@ fn testnet_genesis( vesting: Default::default(), // XCM stuff. - polkadot_xcm: pangolin_runtime::PolkadotXcmConfig { - safe_xcm_version: Some(SAFE_XCM_VERSION), - }, + polkadot_xcm: PolkadotXcmConfig { safe_xcm_version: Some(SAFE_XCM_VERSION) }, // EVM stuff. ethereum: Default::default(), @@ -347,7 +308,3 @@ fn testnet_genesis( base_fee: Default::default(), } } - -pub fn genesis_config() -> ChainSpec { - unimplemented!("TODO") -} diff --git a/node/src/command.rs b/node/src/command.rs index 1cf8b0783..566199932 100644 --- a/node/src/command.rs +++ b/node/src/command.rs @@ -607,11 +607,11 @@ fn load_spec(id: &str) -> std::result::Result, String> { "crab" => Box::new(crab_chain_spec::config()), "crab-genesis" => Box::new(crab_chain_spec::genesis_config()), "crab-dev" => Box::new(crab_chain_spec::development_config()), - "crab-local" => Box::new(crab_chain_spec::local_testnet_config()), + "crab-local" => Box::new(crab_chain_spec::local_config()), "pangolin" => Box::new(pangolin_chain_spec::config()), "pangolin-genesis" => Box::new(pangolin_chain_spec::genesis_config()), "pangolin-dev" => Box::new(pangolin_chain_spec::development_config()), - "pangolin-local" => Box::new(pangolin_chain_spec::local_testnet_config()), + "pangolin-local" => Box::new(pangolin_chain_spec::local_config()), _ => { let path = PathBuf::from(id); let chain_spec = diff --git a/pallet/staking/src/lib.rs b/pallet/staking/src/lib.rs index b61ded027..91b78e9be 100644 --- a/pallet/staking/src/lib.rs +++ b/pallet/staking/src/lib.rs @@ -294,10 +294,10 @@ pub mod pallet { pub type RewardPoints = StorageValue<_, (RewardPoint, BTreeMap), ValueQuery>; - /// Active session's started timestamp. + /// Active session's start-time. #[pallet::storage] - #[pallet::getter(fn session_started_time)] - pub type SessionStartedTime = StorageValue<_, Moment, ValueQuery>; + #[pallet::getter(fn session_start_time)] + pub type SessionStartTime = StorageValue<_, Moment, ValueQuery>; /// Elapsed time. #[pallet::storage] @@ -324,7 +324,7 @@ pub mod pallet { #[pallet::genesis_build] impl GenesisBuild for GenesisConfig { fn build(&self) { - >::put(self.now); + >::put(self.now); >::put(self.elapsed_time); >::put(self.collator_count); @@ -895,14 +895,14 @@ where fn end_session(_: u32) { let now = T::UnixTime::now().as_millis(); - let session_duration = now - >::get(); + let session_duration = now - >::get(); let elapsed_time = >::mutate(|t| { *t += session_duration; *t }); - >::put(now); + >::put(now); Self::payout(session_duration, elapsed_time); Self::clean_old_session(); diff --git a/runtime/crab/src/lib.rs b/runtime/crab/src/lib.rs index 63201b349..9789a29b5 100644 --- a/runtime/crab/src/lib.rs +++ b/runtime/crab/src/lib.rs @@ -316,7 +316,7 @@ frame_support::construct_runtime! { BaseFee: pallet_base_fee = 33, MessageTransact: darwinia_message_transact = 39, - // S2S stuff + // S2S stuff. BridgeDarwiniaGrandpa: pallet_bridge_grandpa:: = 35, BridgeDarwiniaMessages: pallet_bridge_messages:: = 36, BridgeDarwiniaDispatch: pallet_bridge_dispatch:: = 37, diff --git a/runtime/crab/src/pallets/mod.rs b/runtime/crab/src/pallets/mod.rs index 493f9ddc5..169c4eff8 100644 --- a/runtime/crab/src/pallets/mod.rs +++ b/runtime/crab/src/pallets/mod.rs @@ -104,7 +104,7 @@ mod base_fee; mod message_transact; -// S2S stuff +// S2S stuff. mod bridge_dispatch; pub use bridge_dispatch::*; diff --git a/runtime/darwinia/src/lib.rs b/runtime/darwinia/src/lib.rs index d8f6bafdb..c1f694ab2 100644 --- a/runtime/darwinia/src/lib.rs +++ b/runtime/darwinia/src/lib.rs @@ -315,7 +315,7 @@ frame_support::construct_runtime! { BaseFee: pallet_base_fee = 33, MessageTransact: darwinia_message_transact = 39, - // S2S stuff + // S2S stuff. BridgeCrabGrandpa: pallet_bridge_grandpa:: = 35, BridgeCrabMessages: pallet_bridge_messages:: = 36, BridgeCrabDispatch: pallet_bridge_dispatch:: = 37, diff --git a/runtime/darwinia/src/pallets/mod.rs b/runtime/darwinia/src/pallets/mod.rs index 31c61b9d9..01d8f6b29 100644 --- a/runtime/darwinia/src/pallets/mod.rs +++ b/runtime/darwinia/src/pallets/mod.rs @@ -105,7 +105,7 @@ mod base_fee; mod message_transact; -// S2S stuff +// S2S stuff. mod bridge_dispatch; pub use bridge_dispatch::*; From 14b7e7b369564c4620fc0d5d87284ec2c3a31783 Mon Sep 17 00:00:00 2001 From: Guantong <04637@163.com> Date: Tue, 6 Dec 2022 19:24:06 +0800 Subject: [PATCH 030/189] Adjust path style (#99) * Bridge related pallets * fee market * format * evm * xcm * format * MaxMessagesToPruneAtOnce * move ByteArray * move AccountToAssetId * move UniqueSaturatedInto * Const * format --- runtime/crab/src/pallets/bridge_dispatch.rs | 48 ++++----- runtime/crab/src/pallets/bridge_grandpa.rs | 16 +-- runtime/crab/src/pallets/bridge_messages.rs | 31 +++--- .../crab/src/pallets/collator_selection.rs | 10 +- runtime/crab/src/pallets/evm.rs | 95 +++++++++--------- runtime/crab/src/pallets/fee_market.rs | 58 +++++------ runtime/crab/src/pallets/polkadot_xcm.rs | 86 ++++++++-------- .../darwinia/src/pallets/bridge_dispatch.rs | 48 ++++----- .../darwinia/src/pallets/bridge_grandpa.rs | 16 +-- .../darwinia/src/pallets/bridge_messages.rs | 32 +++--- runtime/darwinia/src/pallets/evm.rs | 95 +++++++++--------- runtime/darwinia/src/pallets/fee_market.rs | 57 +++++------ runtime/darwinia/src/pallets/polkadot_xcm.rs | 86 ++++++++-------- .../src/pallets/collator_selection.rs | 10 +- runtime/pangolin/src/pallets/evm.rs | 97 ++++++++++--------- runtime/pangolin/src/pallets/polkadot_xcm.rs | 86 ++++++++-------- 16 files changed, 414 insertions(+), 457 deletions(-) diff --git a/runtime/crab/src/pallets/bridge_dispatch.rs b/runtime/crab/src/pallets/bridge_dispatch.rs index a6e490264..807c64239 100644 --- a/runtime/crab/src/pallets/bridge_dispatch.rs +++ b/runtime/crab/src/pallets/bridge_dispatch.rs @@ -20,30 +20,23 @@ pub use pallet_bridge_dispatch::Instance1 as WithDarwiniaDispatch; // darwinia use crate::*; -use bp_message_dispatch::{CallValidate, IntoDispatchOrigin as IntoDispatchOriginT}; -use bp_messages::{LaneId, MessageNonce}; -use darwinia_message_transact::{total_payment, Call as MessageTransactCall, LcmpEthOrigin}; -use pallet_bridge_dispatch::Config; -// substrate -use frame_support::ensure; -use frame_system::RawOrigin; -use sp_runtime::transaction_validity::{InvalidTransaction, TransactionValidityError}; pub struct CallValidator; -impl CallValidate for CallValidator { +impl bp_message_dispatch::CallValidate for CallValidator { fn check_receiving_before_dispatch( relayer_account: &AccountId, call: &RuntimeCall, ) -> Result<(), &'static str> { match call { - RuntimeCall::MessageTransact(MessageTransactCall::message_transact { + RuntimeCall::MessageTransact(darwinia_message_transact::Call::message_transact { transaction: tx, }) => { - let total_payment = total_payment::((&**tx).into()); + let total_payment = + darwinia_message_transact::total_payment::((&**tx).into()); let relayer = pallet_evm::Pallet::::account_basic(&H160(relayer_account.0)).0; - ensure!(relayer.balance >= total_payment, "Insufficient balance"); + frame_support::ensure!(relayer.balance >= total_payment, "Insufficient balance"); Ok(()) }, _ => Ok(()), @@ -54,23 +47,32 @@ impl CallValidate for CallValidator { relayer_account: &AccountId, origin: &RuntimeOrigin, call: &RuntimeCall, - ) -> Result<(), TransactionValidityError> { + ) -> Result<(), sp_runtime::transaction_validity::TransactionValidityError> { match call { - RuntimeCall::MessageTransact(MessageTransactCall::message_transact { + RuntimeCall::MessageTransact(darwinia_message_transact::Call::message_transact { transaction: tx, }) => match origin.caller { - OriginCaller::MessageTransact(LcmpEthOrigin::MessageTransact(id)) => { - let total_payment = total_payment::((&**tx).into()); + OriginCaller::MessageTransact( + darwinia_message_transact::LcmpEthOrigin::MessageTransact(id), + ) => { + let total_payment = + darwinia_message_transact::total_payment::((&**tx).into()); pallet_balances::Pallet::::transfer( - RawOrigin::Signed(*relayer_account).into(), + frame_system::RawOrigin::Signed(*relayer_account).into(), id.into(), total_payment.as_u128(), ) - .map_err(|_| TransactionValidityError::Invalid(InvalidTransaction::Payment))?; + .map_err(|_| { + sp_runtime::transaction_validity::TransactionValidityError::Invalid( + sp_runtime::transaction_validity::InvalidTransaction::Payment, + ) + })?; Ok(()) }, - _ => Err(TransactionValidityError::Invalid(InvalidTransaction::BadSigner)), + _ => Err(sp_runtime::transaction_validity::TransactionValidityError::Invalid( + sp_runtime::transaction_validity::InvalidTransaction::BadSigner, + )), }, _ => Ok(()), } @@ -78,7 +80,9 @@ impl CallValidate for CallValidator { } pub struct IntoDispatchOrigin; -impl IntoDispatchOriginT for IntoDispatchOrigin { +impl bp_message_dispatch::IntoDispatchOrigin + for IntoDispatchOrigin +{ fn into_dispatch_origin(id: &AccountId, call: &RuntimeCall) -> RuntimeOrigin { match call { RuntimeCall::MessageTransact(darwinia_message_transact::Call::message_transact { @@ -89,9 +93,9 @@ impl IntoDispatchOriginT for IntoDispatch } } -impl Config for Runtime { +impl pallet_bridge_dispatch::Config for Runtime { type AccountIdConverter = bp_crab::AccountIdConverter; - type BridgeMessageId = (LaneId, MessageNonce); + type BridgeMessageId = (bp_messages::LaneId, bp_messages::MessageNonce); type CallValidator = CallValidator; type EncodedCall = bm_darwinia::FromDarwiniaEncodedCall; type IntoDispatchOrigin = IntoDispatchOrigin; diff --git a/runtime/crab/src/pallets/bridge_grandpa.rs b/runtime/crab/src/pallets/bridge_grandpa.rs index 3ce65f20b..8fdfa09d4 100644 --- a/runtime/crab/src/pallets/bridge_grandpa.rs +++ b/runtime/crab/src/pallets/bridge_grandpa.rs @@ -20,22 +20,12 @@ pub use pallet_bridge_grandpa::Instance1 as WithDarwiniaGrandpa; // darwinia use crate::*; -use pallet_bridge_grandpa::Config; -frame_support::parameter_types! { - // This is a pretty unscientific cap. - // - // Note that once this is hit the pallet will essentially throttle incoming requests down to one - // call per block. - pub const MaxRequests: u32 = 50; - pub const DarwiniaHeadersToKeep: u32 = 500; -} - -impl Config for Runtime { +impl pallet_bridge_grandpa::Config for Runtime { type BridgedChain = bp_darwinia::DarwiniaLike; - type HeadersToKeep = DarwiniaHeadersToKeep; + type HeadersToKeep = ConstU32<500>; type MaxBridgedAuthorities = (); type MaxBridgedHeaderSize = (); - type MaxRequests = MaxRequests; + type MaxRequests = ConstU32<50>; type WeightInfo = (); } diff --git a/runtime/crab/src/pallets/bridge_messages.rs b/runtime/crab/src/pallets/bridge_messages.rs index c38ea6d98..3070cf0cd 100644 --- a/runtime/crab/src/pallets/bridge_messages.rs +++ b/runtime/crab/src/pallets/bridge_messages.rs @@ -19,15 +19,9 @@ use pallet_bridge_messages::Instance1 as WithDarwiniaMessages; // darwinia -use crate::{bm_darwinia::ToDarwiniaMaximalOutboundPayloadSize, *}; -use bp_messages::{source_chain::SenderOrigin, MessageNonce}; -use bp_runtime::{ChainId, DARWINIA_CHAIN_ID}; -use pallet_bridge_messages::Config; -use pallet_fee_market::s2s::{ - FeeMarketMessageAcceptedHandler, FeeMarketMessageConfirmedHandler, FeeMarketPayment, -}; +use crate::*; -impl SenderOrigin for RuntimeOrigin { +impl bp_messages::source_chain::SenderOrigin for RuntimeOrigin { fn linked_account(&self) -> Option { match self.caller { OriginCaller::system(frame_system::RawOrigin::Signed(ref submitter)) => @@ -38,31 +32,32 @@ impl SenderOrigin for RuntimeOrigin { } frame_support::parameter_types! { - pub const MaxMessagesToPruneAtOnce: MessageNonce = 8; - pub const BridgedChainId: ChainId = DARWINIA_CHAIN_ID; - pub const MaxUnconfirmedMessagesAtInboundLane: MessageNonce = + pub const BridgedChainId: bp_runtime::ChainId = bp_runtime::DARWINIA_CHAIN_ID; + pub const MaxUnconfirmedMessagesAtInboundLane: bp_messages::MessageNonce = bp_darwinia::MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX; - pub const MaxUnrewardedRelayerEntriesAtInboundLane: MessageNonce = + pub const MaxUnrewardedRelayerEntriesAtInboundLane: bp_messages::MessageNonce = bp_darwinia::MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX; pub RootAccountForPayments: Option = None; } -impl Config for Runtime { +impl pallet_bridge_messages::Config for Runtime { type AccountIdConverter = bp_crab::AccountIdConverter; type BridgedChainId = BridgedChainId; type InboundMessageFee = bp_darwinia::Balance; type InboundPayload = bm_darwinia::FromDarwiniaMessagePayload; type InboundRelayer = bp_darwinia::AccountId; type LaneMessageVerifier = bm_darwinia::ToDarwiniaMessageVerifier; - type MaxMessagesToPruneAtOnce = MaxMessagesToPruneAtOnce; + type MaxMessagesToPruneAtOnce = ConstU64<8>; type MaxUnconfirmedMessagesAtInboundLane = MaxUnconfirmedMessagesAtInboundLane; type MaxUnrewardedRelayerEntriesAtInboundLane = MaxUnrewardedRelayerEntriesAtInboundLane; - type MaximalOutboundPayloadSize = ToDarwiniaMaximalOutboundPayloadSize; + type MaximalOutboundPayloadSize = bm_darwinia::ToDarwiniaMaximalOutboundPayloadSize; type MessageDeliveryAndDispatchPayment = - FeeMarketPayment; + pallet_fee_market::s2s::FeeMarketPayment; type MessageDispatch = bm_darwinia::FromDarwiniaMessageDispatch; - type OnDeliveryConfirmed = FeeMarketMessageConfirmedHandler; - type OnMessageAccepted = FeeMarketMessageAcceptedHandler; + type OnDeliveryConfirmed = + pallet_fee_market::s2s::FeeMarketMessageConfirmedHandler; + type OnMessageAccepted = + pallet_fee_market::s2s::FeeMarketMessageAcceptedHandler; type OutboundMessageFee = bp_crab::Balance; type OutboundPayload = bm_darwinia::ToDarwiniaMessagePayload; type Parameter = bm_darwinia::CrabToDarwiniaParameter; diff --git a/runtime/crab/src/pallets/collator_selection.rs b/runtime/crab/src/pallets/collator_selection.rs index 610420061..511377862 100644 --- a/runtime/crab/src/pallets/collator_selection.rs +++ b/runtime/crab/src/pallets/collator_selection.rs @@ -23,10 +23,6 @@ use crate::*; pub type CollatorSelectionUpdateOrigin = EnsureRoot; frame_support::parameter_types! { pub const PotId: PalletId = PalletId(*b"PotStake"); - pub const MaxCandidates: u32 = 1000; - pub const MinCandidates: u32 = 5; - pub const SessionLength: BlockNumber = 6 * HOURS; - pub const MaxInvulnerables: u32 = 100; pub const ExecutiveBody: BodyId = BodyId::Executive; } @@ -34,9 +30,9 @@ impl pallet_collator_selection::Config for Runtime { type Currency = Balances; // should be a multiple of session or things will get inconsistent type KickThreshold = Period; - type MaxCandidates = MaxCandidates; - type MaxInvulnerables = MaxInvulnerables; - type MinCandidates = MinCandidates; + type MaxCandidates = ConstU32<1000>; + type MaxInvulnerables = ConstU32<100>; + type MinCandidates = ConstU32<5>; type PotId = PotId; type RuntimeEvent = RuntimeEvent; type UpdateOrigin = CollatorSelectionUpdateOrigin; diff --git a/runtime/crab/src/pallets/evm.rs b/runtime/crab/src/pallets/evm.rs index e6c048dd8..278cdca06 100644 --- a/runtime/crab/src/pallets/evm.rs +++ b/runtime/crab/src/pallets/evm.rs @@ -18,26 +18,8 @@ // darwinia use crate::*; -use darwinia_precompile_assets::{AccountToAssetId, ERC20Assets}; -use darwinia_precompile_bls12_381::BLS12381; -use darwinia_precompile_state_storage::{EthereumStorageFilter, StateStorage}; // frontier -use pallet_ethereum::EthereumBlockHashMapping; -use pallet_evm::{ - AddressMapping, EnsureAddressNever, EnsureAddressRoot, FeeCalculator, FixedGasWeightMapping, - Precompile, PrecompileHandle, PrecompileResult, PrecompileSet, -}; -use pallet_evm_precompile_blake2::Blake2F; -use pallet_evm_precompile_bn128::{Bn128Add, Bn128Mul, Bn128Pairing}; -use pallet_evm_precompile_dispatch::Dispatch; -use pallet_evm_precompile_modexp::Modexp; -use pallet_evm_precompile_simple::{ECRecover, Identity, Ripemd160, Sha256}; -// moonbeam -use precompile_utils::prelude::*; -// substrate -use frame_support::{traits::FindAuthor, ConsensusEngineId}; -use sp_core::crypto::ByteArray; -use sp_std::marker::PhantomData; +use pallet_evm::Precompile; const WEIGHT_PER_GAS: u64 = 40_000; @@ -47,12 +29,17 @@ frame_support::parameter_types! { pub WeightPerGas: Weight = Weight::from_ref_time(WEIGHT_PER_GAS); } -pub struct FindAuthorTruncated(PhantomData); -impl> FindAuthor for FindAuthorTruncated { +pub struct FindAuthorTruncated(sp_std::marker::PhantomData); +impl> frame_support::traits::FindAuthor + for FindAuthorTruncated +{ fn find_author<'a, I>(digests: I) -> Option where - I: 'a + IntoIterator, + I: 'a + IntoIterator, { + // substrate + use sp_core::crypto::ByteArray; + F::find_author(digests).and_then(|i| { Aura::authorities().get(i as usize).and_then(|id| { let raw = id.to_raw_vec(); @@ -68,7 +55,7 @@ impl> FindAuthor for FindAuthorTruncated { } pub struct FixedGasPrice; -impl FeeCalculator for FixedGasPrice { +impl pallet_evm::FeeCalculator for FixedGasPrice { fn min_gas_price() -> (U256, Weight) { (U256::from(GWEI), Weight::zero()) } @@ -76,7 +63,7 @@ impl FeeCalculator for FixedGasPrice { // TODO: Integrate to the upstream repo pub struct FromH160; -impl AddressMapping for FromH160 +impl pallet_evm::AddressMapping for FromH160 where T: From, { @@ -86,14 +73,14 @@ where } pub struct AssetIdConverter; -impl AccountToAssetId for AssetIdConverter { +impl darwinia_precompile_assets::AccountToAssetId for AssetIdConverter { fn account_to_asset_id(account_id: AccountId) -> AssetId { let addr: H160 = account_id.into(); addr.to_low_u64_be() } } -pub struct CrabPrecompiles(PhantomData); +pub struct CrabPrecompiles(sp_std::marker::PhantomData); impl CrabPrecompiles where R: pallet_evm::Config, @@ -121,38 +108,52 @@ where ] } } -impl PrecompileSet for CrabPrecompiles +impl pallet_evm::PrecompileSet for CrabPrecompiles where R: pallet_evm::Config, { - fn execute(&self, handle: &mut impl PrecompileHandle) -> Option { + fn execute( + &self, + handle: &mut impl pallet_evm::PrecompileHandle, + ) -> Option { + // darwinia + use darwinia_precompile_assets::AccountToAssetId; + let (code_address, caller) = (handle.code_address(), handle.context().caller); // Filter known precompile addresses except Ethereum officials if self.is_precompile(code_address) && code_address > addr(9) && code_address != caller { - return Some(Err(revert("cannot be called with DELEGATECALL or CALLCODE"))); + return Some(Err(precompile_utils::revert( + "cannot be called with DELEGATECALL or CALLCODE", + ))); }; match code_address { // Ethereum precompiles: - a if a == addr(1) => Some(ECRecover::execute(handle)), - a if a == addr(2) => Some(Sha256::execute(handle)), - a if a == addr(3) => Some(Ripemd160::execute(handle)), - a if a == addr(4) => Some(Identity::execute(handle)), - a if a == addr(5) => Some(Modexp::execute(handle)), - a if a == addr(6) => Some(Bn128Add::execute(handle)), - a if a == addr(7) => Some(Bn128Mul::execute(handle)), - a if a == addr(8) => Some(Bn128Pairing::execute(handle)), - a if a == addr(9) => Some(Blake2F::execute(handle)), + a if a == addr(1) => Some(pallet_evm_precompile_simple::ECRecover::execute(handle)), + a if a == addr(2) => Some(pallet_evm_precompile_simple::Sha256::execute(handle)), + a if a == addr(3) => Some(pallet_evm_precompile_simple::Ripemd160::execute(handle)), + a if a == addr(4) => Some(pallet_evm_precompile_simple::Identity::execute(handle)), + a if a == addr(5) => Some(pallet_evm_precompile_modexp::Modexp::execute(handle)), + a if a == addr(6) => Some(pallet_evm_precompile_bn128::Bn128Add::execute(handle)), + a if a == addr(7) => Some(pallet_evm_precompile_bn128::Bn128Mul::execute(handle)), + a if a == addr(8) => Some(pallet_evm_precompile_bn128::Bn128Pairing::execute(handle)), + a if a == addr(9) => Some(pallet_evm_precompile_blake2::Blake2F::execute(handle)), // Darwinia precompiles: [1024, 2048) for stable precompiles. - a if a == addr(1024) => - Some(>::execute(handle)), - a if a == addr(1025) => Some(>::execute(handle)), + a if a == addr(1024) => Some(>::execute(handle)), + a if a == addr(1025) => + Some(>::execute(handle)), // [1026, 1536) reserved for assets precompiles. a if (1026..1536).contains(&AssetIdConverter::account_to_asset_id(a.into())) => - Some(>::execute(handle)), + Some(>::execute( + handle, + )), // [1536, 2048) reserved for other stable precompiles. // [2048..) reserved for the experimental precompiles. - a if a == addr(2048) => Some(>::execute(handle)), + a if a == addr(2048) => + Some(>::execute(handle)), _ => None, } } @@ -165,20 +166,20 @@ where impl pallet_evm::Config for Runtime { type AddressMapping = FromH160; type BlockGasLimit = BlockGasLimit; - type BlockHashMapping = EthereumBlockHashMapping; - type CallOrigin = EnsureAddressRoot; + type BlockHashMapping = pallet_ethereum::EthereumBlockHashMapping; + type CallOrigin = pallet_evm::EnsureAddressRoot; type ChainId = ConstU64<44>; type Currency = Balances; type FeeCalculator = FixedGasPrice; type FindAuthor = FindAuthorTruncated; - type GasWeightMapping = FixedGasWeightMapping; + type GasWeightMapping = pallet_evm::FixedGasWeightMapping; type OnChargeTransaction = (); type PrecompilesType = CrabPrecompiles; type PrecompilesValue = PrecompilesValue; type Runner = pallet_evm::runner::stack::Runner; type RuntimeEvent = RuntimeEvent; type WeightPerGas = WeightPerGas; - type WithdrawOrigin = EnsureAddressNever; + type WithdrawOrigin = pallet_evm::EnsureAddressNever; } fn addr(a: u64) -> H160 { diff --git a/runtime/crab/src/pallets/fee_market.rs b/runtime/crab/src/pallets/fee_market.rs index a9d93df1b..93f24583e 100644 --- a/runtime/crab/src/pallets/fee_market.rs +++ b/runtime/crab/src/pallets/fee_market.rs @@ -18,53 +18,57 @@ pub use pallet_fee_market::Instance1 as WithDarwiniaFeeMarket; -// --- core --- -use core::cmp; -// --- substrate --- -use frame_support::{traits::LockIdentifier, PalletId}; -use sp_runtime::{traits::UniqueSaturatedInto, Permill}; -// --- darwinia --- +// darwinia use crate::*; -use pallet_fee_market::{BalanceOf, Config, Slasher}; pub struct FeeMarketSlasher; -impl, I: 'static> Slasher for FeeMarketSlasher { - fn calc_amount(locked_collateral: BalanceOf, timeout: T::BlockNumber) -> BalanceOf { + +impl, I: 'static> pallet_fee_market::Slasher + for FeeMarketSlasher +{ + fn calc_amount( + locked_collateral: pallet_fee_market::BalanceOf, + timeout: T::BlockNumber, + ) -> pallet_fee_market::BalanceOf { + // substrate + use sp_runtime::traits::UniqueSaturatedInto; + let slash_each_block = 2 * UNIT; - let slash_value = UniqueSaturatedInto::::unique_saturated_into(timeout) - .saturating_mul(UniqueSaturatedInto::::unique_saturated_into(slash_each_block)) - .unique_saturated_into(); + let slash_value = + sp_runtime::traits::UniqueSaturatedInto::::unique_saturated_into(timeout) + .saturating_mul( + sp_runtime::traits::UniqueSaturatedInto::::unique_saturated_into( + slash_each_block, + ), + ) + .unique_saturated_into(); - cmp::min(locked_collateral, slash_value) + core::cmp::min(locked_collateral, slash_value) } } frame_support::parameter_types! { - pub const TreasuryPalletId: PalletId = PalletId(*b"da/trsry"); - pub const FeeMarketLockId: LockIdentifier = *b"da/feecr"; - - pub const MinimumRelayFee: Balance = 15 * UNIT; - pub const CollateralPerOrder: Balance = 50 * UNIT; - pub const Slot: BlockNumber = 600; + pub const TreasuryPalletId: frame_support::PalletId = frame_support::PalletId(*b"da/trsry"); + pub const FeeMarketLockId: frame_support::traits::LockIdentifier = *b"da/feecr"; - pub const DutyRelayersRewardRatio: Permill = Permill::from_percent(60); - pub const MessageRelayersRewardRatio: Permill = Permill::from_percent(80); - pub const ConfirmRelayersRewardRatio: Permill = Permill::from_percent(20); - pub const AssignedRelayerSlashRatio: Permill = Permill::from_percent(20); + pub const DutyRelayersRewardRatio: sp_runtime::Permill = sp_runtime::Permill::from_percent(60); + pub const MessageRelayersRewardRatio: sp_runtime::Permill = sp_runtime::Permill::from_percent(80); + pub const ConfirmRelayersRewardRatio: sp_runtime::Permill = sp_runtime::Permill::from_percent(20); + pub const AssignedRelayerSlashRatio: sp_runtime::Permill = sp_runtime::Permill::from_percent(20); } -impl Config for Runtime { +impl pallet_fee_market::Config for Runtime { type AssignedRelayerSlashRatio = AssignedRelayerSlashRatio; - type CollateralPerOrder = CollateralPerOrder; + type CollateralPerOrder = ConstU128<{ 50 * UNIT }>; type ConfirmRelayersRewardRatio = ConfirmRelayersRewardRatio; type Currency = Balances; type DutyRelayersRewardRatio = DutyRelayersRewardRatio; type LockId = FeeMarketLockId; type MessageRelayersRewardRatio = MessageRelayersRewardRatio; - type MinimumRelayFee = MinimumRelayFee; + type MinimumRelayFee = ConstU128<{ 15 * UNIT }>; type RuntimeEvent = RuntimeEvent; type Slasher = FeeMarketSlasher; - type Slot = Slot; + type Slot = ConstU32<600>; type TreasuryPalletId = TreasuryPalletId; type WeightInfo = (); } diff --git a/runtime/crab/src/pallets/polkadot_xcm.rs b/runtime/crab/src/pallets/polkadot_xcm.rs index 997faaa5c..29a61e930 100644 --- a/runtime/crab/src/pallets/polkadot_xcm.rs +++ b/runtime/crab/src/pallets/polkadot_xcm.rs @@ -18,24 +18,13 @@ // darwinia use crate::*; -use darwinia_common_runtime::xcm_configs::*; -// moonbeam -use xcm_primitives::*; -// polkadot -use pallet_xcm::XcmPassthrough; -use polkadot_parachain::primitives::Sibling; -use xcm::latest::prelude::*; -use xcm_builder::*; -use xcm_executor::XcmExecutor; -// substrate -use frame_support::traits::{Everything, Nothing, PalletInfoAccess}; /// Means for transacting assets on this chain. -pub type LocalAssetTransactor = CurrencyAdapter< +pub type LocalAssetTransactor = xcm_builder::CurrencyAdapter< // Use this currency: Balances, // Use this currency when it is a fungible asset matching the given location or name: - IsConcrete, + xcm_builder::IsConcrete, // Do a simple punn to convert an AccountId32 MultiLocation into a native chain account ID: LocationToAccountId, // Our chain's account ID type (we can't get away without mentioning it explicitly): @@ -45,7 +34,7 @@ pub type LocalAssetTransactor = CurrencyAdapter< >; frame_support::parameter_types! { - pub const RelayNetwork: NetworkId = NetworkId::Kusama; + pub const RelayNetwork: xcm::latest::prelude::NetworkId = xcm::latest::prelude::NetworkId::Kusama; pub RelayChainOrigin: RuntimeOrigin = cumulus_pallet_xcm::Origin::Relay.into(); } /// Type for specifying how a `MultiLocation` can be converted into an `AccountId`. This is used @@ -53,11 +42,11 @@ frame_support::parameter_types! { /// `Transact` in order to determine the dispatch Origin. pub type LocationToAccountId = ( // The parent (Relay-chain) origin converts to the parent `AccountId`. - ParentIsPreset, + xcm_builder::ParentIsPreset, // Sibling parachain origins convert to AccountId via the `ParaId::into`. - SiblingParachainConvertsVia, + xcm_builder::SiblingParachainConvertsVia, // Straight up local `AccountId20` origins just alias directly to `AccountId`. - AccountKey20Aliases, + xcm_builder::AccountKey20Aliases, ); /// This is the type we use to convert an (incoming) XCM origin into a local `Origin` instance, /// ready for dispatching a transaction with Xcm's `Transact`. There is an `OriginKind` which can @@ -66,42 +55,44 @@ pub type XcmOriginToTransactDispatchOrigin = ( // Sovereign account converter; this attempts to derive an `AccountId` from the origin location // using `LocationToAccountId` and then turn that into the usual `Signed` origin. Useful for // foreign chains who want to have a local sovereign account on this chain which they control. - SovereignSignedViaLocation, + xcm_builder::SovereignSignedViaLocation, // Native converter for Relay-chain (Parent) location; will converts to a `Relay` origin when // recognized. - RelayChainAsNative, + xcm_builder::RelayChainAsNative, // Native converter for sibling Parachains; will convert to a `SiblingPara` origin when // recognized. - SiblingParachainAsNative, + xcm_builder::SiblingParachainAsNative, // Native signed account converter; this just converts an `AccountKey20` origin into a normal // `RuntimeOrigin::Signed` origin of the same 20-byte value. - SignedAccountKey20AsNative, + xcm_builder::SignedAccountKey20AsNative, // Xcm origins can be represented natively under the Xcm pallet's Xcm origin. - XcmPassthrough, + pallet_xcm::XcmPassthrough, ); -pub type Barrier = DenyThenTry< - DenyReserveTransferToRelayChain, +pub type Barrier = darwinia_common_runtime::xcm_configs::DenyThenTry< + darwinia_common_runtime::xcm_configs::DenyReserveTransferToRelayChain, ( - TakeWeightCredit, - AllowTopLevelPaidExecutionFrom, + xcm_builder::TakeWeightCredit, + xcm_builder::AllowTopLevelPaidExecutionFrom, // Parent and its exec plurality get free execution - AllowUnpaidExecutionFrom, + xcm_builder::AllowUnpaidExecutionFrom< + darwinia_common_runtime::xcm_configs::ParentOrParentsExecutivePlurality, + >, // Expected responses are OK. - AllowKnownQueryResponses, + xcm_builder::AllowKnownQueryResponses, // Subscriptions for version tracking are OK. - AllowSubscriptionsFrom, + xcm_builder::AllowSubscriptionsFrom, ), >; frame_support::parameter_types! { pub const MaxInstructions: u32 = 100; - pub AnchoringSelfReserve: MultiLocation = MultiLocation::new( + pub AnchoringSelfReserve: xcm::latest::prelude::MultiLocation = xcm::latest::prelude::MultiLocation::new( 0, - X1(PalletInstance(::index() as u8)) + xcm::latest::prelude::X1(xcm::latest::prelude::PalletInstance(::index() as u8)) ); // One XCM operation is 1_000_000_000 weight - almost certainly a conservative estimate. - pub Ancestry: MultiLocation = Parachain(ParachainInfo::parachain_id().into()).into(); + pub Ancestry: xcm::latest::prelude::MultiLocation = xcm::latest::prelude::Parachain(ParachainInfo::parachain_id().into()).into(); pub UnitWeightCost: u64 = 1_000_000_000; } @@ -112,27 +103,28 @@ impl xcm_executor::Config for XcmExecutorConfig { type AssetTransactor = LocalAssetTransactor; type AssetTrap = PolkadotXcm; type Barrier = Barrier; - type IsReserve = NativeAsset; + type IsReserve = xcm_builder::NativeAsset; type IsTeleporter = (); // Teleporting is disabled. - type LocationInverter = LocationInverter; + type LocationInverter = xcm_builder::LocationInverter; type OriginConverter = XcmOriginToTransactDispatchOrigin; type ResponseHandler = PolkadotXcm; type RuntimeCall = RuntimeCall; type SubscriptionService = PolkadotXcm; - type Trader = UsingComponents< - ConstantMultiplier, + type Trader = xcm_builder::UsingComponents< + ConstantMultiplier, AnchoringSelfReserve, AccountId, Balances, DealWithFees, >; - type Weigher = FixedWeightBounds; + type Weigher = xcm_builder::FixedWeightBounds; type XcmSender = XcmRouter; } /// No local origins on this chain are allowed to dispatch XCM sends/executions. -pub type LocalOriginToLocation = SignedToAccountId20; +pub type LocalOriginToLocation = + xcm_primitives::SignedToAccountId20; /// The means for routing XCM messages which are not for local execution into the right message /// queues. pub type XcmRouter = ( @@ -145,25 +137,25 @@ pub type XcmRouter = ( impl pallet_xcm::Config for Runtime { // ^ Override for AdvertisedXcmVersion default type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion; - type ExecuteXcmOrigin = EnsureXcmOrigin; - type LocationInverter = LocationInverter; + type ExecuteXcmOrigin = xcm_builder::EnsureXcmOrigin; + type LocationInverter = xcm_builder::LocationInverter; type RuntimeCall = RuntimeCall; type RuntimeEvent = RuntimeEvent; type RuntimeOrigin = RuntimeOrigin; - type SendXcmOrigin = EnsureXcmOrigin; - type Weigher = FixedWeightBounds; - type XcmExecuteFilter = Nothing; + type SendXcmOrigin = xcm_builder::EnsureXcmOrigin; + type Weigher = xcm_builder::FixedWeightBounds; + type XcmExecuteFilter = frame_support::traits::Nothing; // ^ Disable dispatchable execute on the XCM pallet. // Needs to be `Everything` for local testing. - type XcmExecutor = XcmExecutor; - type XcmReserveTransferFilter = Nothing; + type XcmExecutor = xcm_executor::XcmExecutor; + type XcmReserveTransferFilter = frame_support::traits::Nothing; type XcmRouter = XcmRouter; - type XcmTeleportFilter = Nothing; + type XcmTeleportFilter = frame_support::traits::Nothing; const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100; } impl cumulus_pallet_xcm::Config for Runtime { type RuntimeEvent = RuntimeEvent; - type XcmExecutor = XcmExecutor; + type XcmExecutor = xcm_executor::XcmExecutor; } diff --git a/runtime/darwinia/src/pallets/bridge_dispatch.rs b/runtime/darwinia/src/pallets/bridge_dispatch.rs index 96a3437fb..05e210ceb 100644 --- a/runtime/darwinia/src/pallets/bridge_dispatch.rs +++ b/runtime/darwinia/src/pallets/bridge_dispatch.rs @@ -20,30 +20,23 @@ pub use pallet_bridge_dispatch::Instance1 as WithCrabDispatch; // darwinia use crate::*; -use bp_message_dispatch::{CallValidate, IntoDispatchOrigin as IntoDispatchOriginT}; -use bp_messages::{LaneId, MessageNonce}; -use darwinia_message_transact::{total_payment, Call as MessageTransactCall, LcmpEthOrigin}; -use pallet_bridge_dispatch::Config; -// substrate -use frame_support::ensure; -use frame_system::RawOrigin; -use sp_runtime::transaction_validity::{InvalidTransaction, TransactionValidityError}; pub struct CallValidator; -impl CallValidate for CallValidator { +impl bp_message_dispatch::CallValidate for CallValidator { fn check_receiving_before_dispatch( relayer_account: &AccountId, call: &RuntimeCall, ) -> Result<(), &'static str> { match call { - RuntimeCall::MessageTransact(MessageTransactCall::message_transact { + RuntimeCall::MessageTransact(darwinia_message_transact::Call::message_transact { transaction: tx, }) => { - let total_payment = total_payment::((&**tx).into()); + let total_payment = + darwinia_message_transact::total_payment::((&**tx).into()); let relayer = pallet_evm::Pallet::::account_basic(&H160(relayer_account.0)).0; - ensure!(relayer.balance >= total_payment, "Insufficient balance"); + frame_support::ensure!(relayer.balance >= total_payment, "Insufficient balance"); Ok(()) }, _ => Ok(()), @@ -54,23 +47,32 @@ impl CallValidate for CallValidator { relayer_account: &AccountId, origin: &RuntimeOrigin, call: &RuntimeCall, - ) -> Result<(), TransactionValidityError> { + ) -> Result<(), sp_runtime::transaction_validity::TransactionValidityError> { match call { - RuntimeCall::MessageTransact(MessageTransactCall::message_transact { + RuntimeCall::MessageTransact(darwinia_message_transact::Call::message_transact { transaction: tx, }) => match origin.caller { - OriginCaller::MessageTransact(LcmpEthOrigin::MessageTransact(id)) => { - let total_payment = total_payment::((&**tx).into()); + OriginCaller::MessageTransact( + darwinia_message_transact::LcmpEthOrigin::MessageTransact(id), + ) => { + let total_payment = + darwinia_message_transact::total_payment::((&**tx).into()); pallet_balances::Pallet::::transfer( - RawOrigin::Signed(*relayer_account).into(), + frame_system::RawOrigin::Signed(*relayer_account).into(), id.into(), total_payment.as_u128(), ) - .map_err(|_| TransactionValidityError::Invalid(InvalidTransaction::Payment))?; + .map_err(|_| { + sp_runtime::transaction_validity::TransactionValidityError::Invalid( + sp_runtime::transaction_validity::InvalidTransaction::Payment, + ) + })?; Ok(()) }, - _ => Err(TransactionValidityError::Invalid(InvalidTransaction::BadSigner)), + _ => Err(sp_runtime::transaction_validity::TransactionValidityError::Invalid( + sp_runtime::transaction_validity::InvalidTransaction::BadSigner, + )), }, _ => Ok(()), } @@ -78,7 +80,9 @@ impl CallValidate for CallValidator { } pub struct IntoDispatchOrigin; -impl IntoDispatchOriginT for IntoDispatchOrigin { +impl bp_message_dispatch::IntoDispatchOrigin + for IntoDispatchOrigin +{ fn into_dispatch_origin(id: &AccountId, call: &RuntimeCall) -> RuntimeOrigin { match call { RuntimeCall::MessageTransact(darwinia_message_transact::Call::message_transact { @@ -89,9 +93,9 @@ impl IntoDispatchOriginT for IntoDispatch } } -impl Config for Runtime { +impl pallet_bridge_dispatch::Config for Runtime { type AccountIdConverter = bp_darwinia::AccountIdConverter; - type BridgeMessageId = (LaneId, MessageNonce); + type BridgeMessageId = (bp_messages::LaneId, bp_messages::MessageNonce); type CallValidator = CallValidator; type EncodedCall = bm_crab::FromCrabEncodedCall; type IntoDispatchOrigin = IntoDispatchOrigin; diff --git a/runtime/darwinia/src/pallets/bridge_grandpa.rs b/runtime/darwinia/src/pallets/bridge_grandpa.rs index b2180fa6f..6d64b9f8f 100644 --- a/runtime/darwinia/src/pallets/bridge_grandpa.rs +++ b/runtime/darwinia/src/pallets/bridge_grandpa.rs @@ -20,22 +20,12 @@ pub use pallet_bridge_grandpa::Instance1 as WithCrabGrandpa; // darwinia use crate::*; -use pallet_bridge_grandpa::Config; -frame_support::parameter_types! { - // This is a pretty unscientific cap. - // - // Note that once this is hit the pallet will essentially throttle incoming requests down to one - // call per block. - pub const MaxRequests: u32 = 50; - pub const CrabHeadersToKeep: u32 = 500; -} - -impl Config for Runtime { +impl pallet_bridge_grandpa::Config for Runtime { type BridgedChain = bp_crab::DarwiniaLike; - type HeadersToKeep = CrabHeadersToKeep; + type HeadersToKeep = ConstU32<500>; type MaxBridgedAuthorities = (); type MaxBridgedHeaderSize = (); - type MaxRequests = MaxRequests; + type MaxRequests = ConstU32<50>; type WeightInfo = (); } diff --git a/runtime/darwinia/src/pallets/bridge_messages.rs b/runtime/darwinia/src/pallets/bridge_messages.rs index c6eba469a..6cba09dad 100644 --- a/runtime/darwinia/src/pallets/bridge_messages.rs +++ b/runtime/darwinia/src/pallets/bridge_messages.rs @@ -19,15 +19,9 @@ use pallet_bridge_messages::Instance1 as WithCrabMessages; // darwinia -use crate::{bm_crab::ToCrabMaximalOutboundPayloadSize, *}; -use bp_messages::{source_chain::SenderOrigin, MessageNonce}; -use bp_runtime::{ChainId, CRAB_CHAIN_ID}; -use pallet_bridge_messages::Config; -use pallet_fee_market::s2s::{ - FeeMarketMessageAcceptedHandler, FeeMarketMessageConfirmedHandler, FeeMarketPayment, -}; +use crate::*; -impl SenderOrigin for RuntimeOrigin { +impl bp_messages::source_chain::SenderOrigin for RuntimeOrigin { fn linked_account(&self) -> Option { match self.caller { OriginCaller::system(frame_system::RawOrigin::Signed(ref submitter)) => @@ -38,30 +32,32 @@ impl SenderOrigin for RuntimeOrigin { } frame_support::parameter_types! { - pub const MaxMessagesToPruneAtOnce: MessageNonce = 8; - pub const BridgedChainId: ChainId = CRAB_CHAIN_ID; - pub const MaxUnconfirmedMessagesAtInboundLane: MessageNonce = + pub const BridgedChainId: bp_runtime::ChainId = bp_runtime::CRAB_CHAIN_ID; + pub const MaxUnconfirmedMessagesAtInboundLane: bp_messages::MessageNonce = bp_darwinia::MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX; - pub const MaxUnrewardedRelayerEntriesAtInboundLane: MessageNonce = + pub const MaxUnrewardedRelayerEntriesAtInboundLane: bp_messages::MessageNonce = bp_darwinia::MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX; pub RootAccountForPayments: Option = None; } -impl Config for Runtime { +impl pallet_bridge_messages::Config for Runtime { type AccountIdConverter = bp_darwinia::AccountIdConverter; type BridgedChainId = BridgedChainId; type InboundMessageFee = bp_crab::Balance; type InboundPayload = bm_crab::FromCrabMessagePayload; type InboundRelayer = bp_crab::AccountId; type LaneMessageVerifier = bm_crab::ToCrabMessageVerifier; - type MaxMessagesToPruneAtOnce = MaxMessagesToPruneAtOnce; + type MaxMessagesToPruneAtOnce = ConstU64<8>; type MaxUnconfirmedMessagesAtInboundLane = MaxUnconfirmedMessagesAtInboundLane; type MaxUnrewardedRelayerEntriesAtInboundLane = MaxUnrewardedRelayerEntriesAtInboundLane; - type MaximalOutboundPayloadSize = ToCrabMaximalOutboundPayloadSize; - type MessageDeliveryAndDispatchPayment = FeeMarketPayment; + type MaximalOutboundPayloadSize = bm_crab::ToCrabMaximalOutboundPayloadSize; + type MessageDeliveryAndDispatchPayment = + pallet_fee_market::s2s::FeeMarketPayment; type MessageDispatch = bm_crab::FromCrabMessageDispatch; - type OnDeliveryConfirmed = FeeMarketMessageConfirmedHandler; - type OnMessageAccepted = FeeMarketMessageAcceptedHandler; + type OnDeliveryConfirmed = + pallet_fee_market::s2s::FeeMarketMessageConfirmedHandler; + type OnMessageAccepted = + pallet_fee_market::s2s::FeeMarketMessageAcceptedHandler; type OutboundMessageFee = bp_darwinia::Balance; type OutboundPayload = bm_crab::ToCrabMessagePayload; type Parameter = bm_crab::DarwiniaToCrabParameter; diff --git a/runtime/darwinia/src/pallets/evm.rs b/runtime/darwinia/src/pallets/evm.rs index e8bef3236..bad4c0c97 100644 --- a/runtime/darwinia/src/pallets/evm.rs +++ b/runtime/darwinia/src/pallets/evm.rs @@ -18,26 +18,8 @@ // darwinia use crate::*; -use darwinia_precompile_assets::{AccountToAssetId, ERC20Assets}; -use darwinia_precompile_bls12_381::BLS12381; -use darwinia_precompile_state_storage::{EthereumStorageFilter, StateStorage}; // frontier -use pallet_ethereum::EthereumBlockHashMapping; -use pallet_evm::{ - AddressMapping, EnsureAddressNever, EnsureAddressRoot, FeeCalculator, FixedGasWeightMapping, - Precompile, PrecompileHandle, PrecompileResult, PrecompileSet, -}; -use pallet_evm_precompile_blake2::Blake2F; -use pallet_evm_precompile_bn128::{Bn128Add, Bn128Mul, Bn128Pairing}; -use pallet_evm_precompile_dispatch::Dispatch; -use pallet_evm_precompile_modexp::Modexp; -use pallet_evm_precompile_simple::{ECRecover, Identity, Ripemd160, Sha256}; -// moonbeam -use precompile_utils::prelude::*; -// substrate -use frame_support::{traits::FindAuthor, ConsensusEngineId}; -use sp_core::crypto::ByteArray; -use sp_std::marker::PhantomData; +use pallet_evm::Precompile; const WEIGHT_PER_GAS: u64 = 40_000; @@ -47,12 +29,17 @@ frame_support::parameter_types! { pub WeightPerGas: Weight = Weight::from_ref_time(WEIGHT_PER_GAS); } -pub struct FindAuthorTruncated(PhantomData); -impl> FindAuthor for FindAuthorTruncated { +pub struct FindAuthorTruncated(sp_std::marker::PhantomData); +impl> frame_support::traits::FindAuthor + for FindAuthorTruncated +{ fn find_author<'a, I>(digests: I) -> Option where - I: 'a + IntoIterator, + I: 'a + IntoIterator, { + // substrate + use sp_core::crypto::ByteArray; + F::find_author(digests).and_then(|i| { Aura::authorities().get(i as usize).and_then(|id| { let raw = id.to_raw_vec(); @@ -68,7 +55,7 @@ impl> FindAuthor for FindAuthorTruncated { } pub struct FixedGasPrice; -impl FeeCalculator for FixedGasPrice { +impl pallet_evm::FeeCalculator for FixedGasPrice { fn min_gas_price() -> (U256, Weight) { (U256::from(GWEI), Weight::zero()) } @@ -76,7 +63,7 @@ impl FeeCalculator for FixedGasPrice { // TODO: Integrate to the upstream repo pub struct FromH160; -impl AddressMapping for FromH160 +impl pallet_evm::AddressMapping for FromH160 where T: From, { @@ -86,14 +73,14 @@ where } pub struct AssetIdConverter; -impl AccountToAssetId for AssetIdConverter { +impl darwinia_precompile_assets::AccountToAssetId for AssetIdConverter { fn account_to_asset_id(account_id: AccountId) -> AssetId { let addr: H160 = account_id.into(); addr.to_low_u64_be() } } -pub struct DarwiniaPrecompiles(PhantomData); +pub struct DarwiniaPrecompiles(sp_std::marker::PhantomData); impl DarwiniaPrecompiles where R: pallet_evm::Config, @@ -121,38 +108,52 @@ where ] } } -impl PrecompileSet for DarwiniaPrecompiles +impl pallet_evm::PrecompileSet for DarwiniaPrecompiles where R: pallet_evm::Config, { - fn execute(&self, handle: &mut impl PrecompileHandle) -> Option { + fn execute( + &self, + handle: &mut impl pallet_evm::PrecompileHandle, + ) -> Option { + // darwinia + use darwinia_precompile_assets::AccountToAssetId; + let (code_address, caller) = (handle.code_address(), handle.context().caller); // Filter known precompile addresses except Ethereum officials if self.is_precompile(code_address) && code_address > addr(9) && code_address != caller { - return Some(Err(revert("cannot be called with DELEGATECALL or CALLCODE"))); + return Some(Err(precompile_utils::revert( + "cannot be called with DELEGATECALL or CALLCODE", + ))); }; match code_address { // Ethereum precompiles: - a if a == addr(1) => Some(ECRecover::execute(handle)), - a if a == addr(2) => Some(Sha256::execute(handle)), - a if a == addr(3) => Some(Ripemd160::execute(handle)), - a if a == addr(4) => Some(Identity::execute(handle)), - a if a == addr(5) => Some(Modexp::execute(handle)), - a if a == addr(6) => Some(Bn128Add::execute(handle)), - a if a == addr(7) => Some(Bn128Mul::execute(handle)), - a if a == addr(8) => Some(Bn128Pairing::execute(handle)), - a if a == addr(9) => Some(Blake2F::execute(handle)), + a if a == addr(1) => Some(pallet_evm_precompile_simple::ECRecover::execute(handle)), + a if a == addr(2) => Some(pallet_evm_precompile_simple::Sha256::execute(handle)), + a if a == addr(3) => Some(pallet_evm_precompile_simple::Ripemd160::execute(handle)), + a if a == addr(4) => Some(pallet_evm_precompile_simple::Identity::execute(handle)), + a if a == addr(5) => Some(pallet_evm_precompile_modexp::Modexp::execute(handle)), + a if a == addr(6) => Some(pallet_evm_precompile_bn128::Bn128Add::execute(handle)), + a if a == addr(7) => Some(pallet_evm_precompile_bn128::Bn128Mul::execute(handle)), + a if a == addr(8) => Some(pallet_evm_precompile_bn128::Bn128Pairing::execute(handle)), + a if a == addr(9) => Some(pallet_evm_precompile_blake2::Blake2F::execute(handle)), // Darwinia precompiles: [1024, 2048) for stable precompiles. - a if a == addr(1024) => - Some(>::execute(handle)), - a if a == addr(1025) => Some(>::execute(handle)), + a if a == addr(1024) => Some(>::execute(handle)), + a if a == addr(1025) => + Some(>::execute(handle)), // [1026, 1536) reserved for assets precompiles. a if (1026..1536).contains(&AssetIdConverter::account_to_asset_id(a.into())) => - Some(>::execute(handle)), + Some(>::execute( + handle, + )), // [1536, 2048) reserved for other stable precompiles. // [2048..) reserved for the experimental precompiles. - a if a == addr(2048) => Some(>::execute(handle)), + a if a == addr(2048) => + Some(>::execute(handle)), _ => None, } } @@ -165,20 +166,20 @@ where impl pallet_evm::Config for Runtime { type AddressMapping = FromH160; type BlockGasLimit = BlockGasLimit; - type BlockHashMapping = EthereumBlockHashMapping; - type CallOrigin = EnsureAddressRoot; + type BlockHashMapping = pallet_ethereum::EthereumBlockHashMapping; + type CallOrigin = pallet_evm::EnsureAddressRoot; type ChainId = ConstU64<46>; type Currency = Balances; type FeeCalculator = FixedGasPrice; type FindAuthor = FindAuthorTruncated; - type GasWeightMapping = FixedGasWeightMapping; + type GasWeightMapping = pallet_evm::FixedGasWeightMapping; type OnChargeTransaction = (); type PrecompilesType = DarwiniaPrecompiles; type PrecompilesValue = PrecompilesValue; type Runner = pallet_evm::runner::stack::Runner; type RuntimeEvent = RuntimeEvent; type WeightPerGas = WeightPerGas; - type WithdrawOrigin = EnsureAddressNever; + type WithdrawOrigin = pallet_evm::EnsureAddressNever; } fn addr(a: u64) -> H160 { diff --git a/runtime/darwinia/src/pallets/fee_market.rs b/runtime/darwinia/src/pallets/fee_market.rs index 67b134938..a41ae8a8a 100644 --- a/runtime/darwinia/src/pallets/fee_market.rs +++ b/runtime/darwinia/src/pallets/fee_market.rs @@ -18,53 +18,56 @@ pub use pallet_fee_market::Instance1 as WithCrabFeeMarket; -// --- core --- -use core::cmp; -// --- substrate --- -use frame_support::{traits::LockIdentifier, PalletId}; -use sp_runtime::{traits::UniqueSaturatedInto, Permill}; -// --- darwinia --- +// darwinia use crate::*; -use pallet_fee_market::{BalanceOf, Config, Slasher}; pub struct FeeMarketSlasher; -impl, I: 'static> Slasher for FeeMarketSlasher { - fn calc_amount(locked_collateral: BalanceOf, timeout: T::BlockNumber) -> BalanceOf { +impl, I: 'static> pallet_fee_market::Slasher + for FeeMarketSlasher +{ + fn calc_amount( + locked_collateral: pallet_fee_market::BalanceOf, + timeout: T::BlockNumber, + ) -> pallet_fee_market::BalanceOf { + // substrate + use sp_runtime::traits::UniqueSaturatedInto; + let slash_each_block = 2 * UNIT; - let slash_value = UniqueSaturatedInto::::unique_saturated_into(timeout) - .saturating_mul(UniqueSaturatedInto::::unique_saturated_into(slash_each_block)) - .unique_saturated_into(); + let slash_value = + sp_runtime::traits::UniqueSaturatedInto::::unique_saturated_into(timeout) + .saturating_mul( + sp_runtime::traits::UniqueSaturatedInto::::unique_saturated_into( + slash_each_block, + ), + ) + .unique_saturated_into(); - cmp::min(locked_collateral, slash_value) + core::cmp::min(locked_collateral, slash_value) } } frame_support::parameter_types! { - pub const TreasuryPalletId: PalletId = PalletId(*b"da/trsry"); - pub const FeeMarketLockId: LockIdentifier = *b"da/feecr"; - - pub const MinimumRelayFee: Balance = 15 * UNIT; - pub const CollateralPerOrder: Balance = 50 * UNIT; - pub const Slot: BlockNumber = 600; + pub const TreasuryPalletId: frame_support::PalletId = frame_support::PalletId(*b"da/trsry"); + pub const FeeMarketLockId: frame_support::traits::LockIdentifier = *b"da/feecr"; - pub const DutyRelayersRewardRatio: Permill = Permill::from_percent(60); - pub const MessageRelayersRewardRatio: Permill = Permill::from_percent(80); - pub const ConfirmRelayersRewardRatio: Permill = Permill::from_percent(20); - pub const AssignedRelayerSlashRatio: Permill = Permill::from_percent(20); + pub const DutyRelayersRewardRatio: sp_runtime::Permill = sp_runtime::Permill::from_percent(60); + pub const MessageRelayersRewardRatio: sp_runtime::Permill = sp_runtime::Permill::from_percent(80); + pub const ConfirmRelayersRewardRatio: sp_runtime::Permill = sp_runtime::Permill::from_percent(20); + pub const AssignedRelayerSlashRatio: sp_runtime::Permill = sp_runtime::Permill::from_percent(20); } -impl Config for Runtime { +impl pallet_fee_market::Config for Runtime { type AssignedRelayerSlashRatio = AssignedRelayerSlashRatio; - type CollateralPerOrder = CollateralPerOrder; + type CollateralPerOrder = ConstU128<{ 50 * UNIT }>; type ConfirmRelayersRewardRatio = ConfirmRelayersRewardRatio; type Currency = Balances; type DutyRelayersRewardRatio = DutyRelayersRewardRatio; type LockId = FeeMarketLockId; type MessageRelayersRewardRatio = MessageRelayersRewardRatio; - type MinimumRelayFee = MinimumRelayFee; + type MinimumRelayFee = ConstU128<{ 15 * UNIT }>; type RuntimeEvent = RuntimeEvent; type Slasher = FeeMarketSlasher; - type Slot = Slot; + type Slot = ConstU32<600>; type TreasuryPalletId = TreasuryPalletId; type WeightInfo = (); } diff --git a/runtime/darwinia/src/pallets/polkadot_xcm.rs b/runtime/darwinia/src/pallets/polkadot_xcm.rs index 0aabb755b..38d03b134 100644 --- a/runtime/darwinia/src/pallets/polkadot_xcm.rs +++ b/runtime/darwinia/src/pallets/polkadot_xcm.rs @@ -18,24 +18,13 @@ // darwinia use crate::*; -use darwinia_common_runtime::xcm_configs::*; -// moonbeam -use xcm_primitives::*; -// polkadot -use pallet_xcm::XcmPassthrough; -use polkadot_parachain::primitives::Sibling; -use xcm::latest::prelude::*; -use xcm_builder::*; -use xcm_executor::XcmExecutor; -// substrate -use frame_support::traits::{Everything, Nothing, PalletInfoAccess}; /// Means for transacting assets on this chain. -pub type LocalAssetTransactor = CurrencyAdapter< +pub type LocalAssetTransactor = xcm_builder::CurrencyAdapter< // Use this currency: Balances, // Use this currency when it is a fungible asset matching the given location or name: - IsConcrete, + xcm_builder::IsConcrete, // Do a simple punn to convert an AccountId32 MultiLocation into a native chain account ID: LocationToAccountId, // Our chain's account ID type (we can't get away without mentioning it explicitly): @@ -45,7 +34,7 @@ pub type LocalAssetTransactor = CurrencyAdapter< >; frame_support::parameter_types! { - pub const RelayNetwork: NetworkId = NetworkId::Polkadot; + pub const RelayNetwork: xcm::latest::prelude::NetworkId = xcm::latest::prelude::NetworkId::Polkadot; pub RelayChainOrigin: RuntimeOrigin = cumulus_pallet_xcm::Origin::Relay.into(); } /// Type for specifying how a `MultiLocation` can be converted into an `AccountId`. This is used @@ -53,11 +42,11 @@ frame_support::parameter_types! { /// `Transact` in order to determine the dispatch Origin. pub type LocationToAccountId = ( // The parent (Relay-chain) origin converts to the parent `AccountId`. - ParentIsPreset, + xcm_builder::ParentIsPreset, // Sibling parachain origins convert to AccountId via the `ParaId::into`. - SiblingParachainConvertsVia, + xcm_builder::SiblingParachainConvertsVia, // Straight up local `AccountId20` origins just alias directly to `AccountId`. - AccountKey20Aliases, + xcm_builder::AccountKey20Aliases, ); /// This is the type we use to convert an (incoming) XCM origin into a local `Origin` instance, /// ready for dispatching a transaction with Xcm's `Transact`. There is an `OriginKind` which can @@ -66,42 +55,44 @@ pub type XcmOriginToTransactDispatchOrigin = ( // Sovereign account converter; this attempts to derive an `AccountId` from the origin location // using `LocationToAccountId` and then turn that into the usual `Signed` origin. Useful for // foreign chains who want to have a local sovereign account on this chain which they control. - SovereignSignedViaLocation, + xcm_builder::SovereignSignedViaLocation, // Native converter for Relay-chain (Parent) location; will converts to a `Relay` origin when // recognized. - RelayChainAsNative, + xcm_builder::RelayChainAsNative, // Native converter for sibling Parachains; will convert to a `SiblingPara` origin when // recognized. - SiblingParachainAsNative, + xcm_builder::SiblingParachainAsNative, // Native signed account converter; this just converts an `AccountKey20` origin into a normal // `RuntimeOrigin::Signed` origin of the same 20-byte value. - SignedAccountKey20AsNative, + xcm_builder::SignedAccountKey20AsNative, // Xcm origins can be represented natively under the Xcm pallet's Xcm origin. - XcmPassthrough, + pallet_xcm::XcmPassthrough, ); -pub type Barrier = DenyThenTry< - DenyReserveTransferToRelayChain, +pub type Barrier = darwinia_common_runtime::xcm_configs::DenyThenTry< + darwinia_common_runtime::xcm_configs::DenyReserveTransferToRelayChain, ( - TakeWeightCredit, - AllowTopLevelPaidExecutionFrom, + xcm_builder::TakeWeightCredit, + xcm_builder::AllowTopLevelPaidExecutionFrom, // Parent and its exec plurality get free execution - AllowUnpaidExecutionFrom, + xcm_builder::AllowUnpaidExecutionFrom< + darwinia_common_runtime::xcm_configs::ParentOrParentsExecutivePlurality, + >, // Expected responses are OK. - AllowKnownQueryResponses, + xcm_builder::AllowKnownQueryResponses, // Subscriptions for version tracking are OK. - AllowSubscriptionsFrom, + xcm_builder::AllowSubscriptionsFrom, ), >; frame_support::parameter_types! { pub const MaxInstructions: u32 = 100; - pub AnchoringSelfReserve: MultiLocation = MultiLocation::new( + pub AnchoringSelfReserve: xcm::latest::prelude::MultiLocation = xcm::latest::prelude::MultiLocation::new( 0, - X1(PalletInstance(::index() as u8)) + xcm::latest::prelude::X1(xcm::latest::prelude::PalletInstance(::index() as u8)) ); // One XCM operation is 1_000_000_000 weight - almost certainly a conservative estimate. - pub Ancestry: MultiLocation = Parachain(ParachainInfo::parachain_id().into()).into(); + pub Ancestry: xcm::latest::prelude::MultiLocation = xcm::latest::prelude::Parachain(ParachainInfo::parachain_id().into()).into(); pub UnitWeightCost: u64 = 1_000_000_000; } @@ -112,27 +103,28 @@ impl xcm_executor::Config for XcmExecutorConfig { type AssetTransactor = LocalAssetTransactor; type AssetTrap = PolkadotXcm; type Barrier = Barrier; - type IsReserve = NativeAsset; + type IsReserve = xcm_builder::NativeAsset; type IsTeleporter = (); // Teleporting is disabled. - type LocationInverter = LocationInverter; + type LocationInverter = xcm_builder::LocationInverter; type OriginConverter = XcmOriginToTransactDispatchOrigin; type ResponseHandler = PolkadotXcm; type RuntimeCall = RuntimeCall; type SubscriptionService = PolkadotXcm; - type Trader = UsingComponents< - ConstantMultiplier, + type Trader = xcm_builder::UsingComponents< + ConstantMultiplier, AnchoringSelfReserve, AccountId, Balances, DealWithFees, >; - type Weigher = FixedWeightBounds; + type Weigher = xcm_builder::FixedWeightBounds; type XcmSender = XcmRouter; } /// No local origins on this chain are allowed to dispatch XCM sends/executions. -pub type LocalOriginToLocation = SignedToAccountId20; +pub type LocalOriginToLocation = + xcm_primitives::SignedToAccountId20; /// The means for routing XCM messages which are not for local execution into the right message /// queues. pub type XcmRouter = ( @@ -145,25 +137,25 @@ pub type XcmRouter = ( impl pallet_xcm::Config for Runtime { // ^ Override for AdvertisedXcmVersion default type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion; - type ExecuteXcmOrigin = EnsureXcmOrigin; - type LocationInverter = LocationInverter; + type ExecuteXcmOrigin = xcm_builder::EnsureXcmOrigin; + type LocationInverter = xcm_builder::LocationInverter; type RuntimeCall = RuntimeCall; type RuntimeEvent = RuntimeEvent; type RuntimeOrigin = RuntimeOrigin; - type SendXcmOrigin = EnsureXcmOrigin; - type Weigher = FixedWeightBounds; - type XcmExecuteFilter = Nothing; + type SendXcmOrigin = xcm_builder::EnsureXcmOrigin; + type Weigher = xcm_builder::FixedWeightBounds; + type XcmExecuteFilter = frame_support::traits::Nothing; // ^ Disable dispatchable execute on the XCM pallet. // Needs to be `Everything` for local testing. - type XcmExecutor = XcmExecutor; - type XcmReserveTransferFilter = Nothing; + type XcmExecutor = xcm_executor::XcmExecutor; + type XcmReserveTransferFilter = frame_support::traits::Nothing; type XcmRouter = XcmRouter; - type XcmTeleportFilter = Nothing; + type XcmTeleportFilter = frame_support::traits::Nothing; const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100; } impl cumulus_pallet_xcm::Config for Runtime { type RuntimeEvent = RuntimeEvent; - type XcmExecutor = XcmExecutor; + type XcmExecutor = xcm_executor::XcmExecutor; } diff --git a/runtime/pangolin/src/pallets/collator_selection.rs b/runtime/pangolin/src/pallets/collator_selection.rs index 610420061..511377862 100644 --- a/runtime/pangolin/src/pallets/collator_selection.rs +++ b/runtime/pangolin/src/pallets/collator_selection.rs @@ -23,10 +23,6 @@ use crate::*; pub type CollatorSelectionUpdateOrigin = EnsureRoot; frame_support::parameter_types! { pub const PotId: PalletId = PalletId(*b"PotStake"); - pub const MaxCandidates: u32 = 1000; - pub const MinCandidates: u32 = 5; - pub const SessionLength: BlockNumber = 6 * HOURS; - pub const MaxInvulnerables: u32 = 100; pub const ExecutiveBody: BodyId = BodyId::Executive; } @@ -34,9 +30,9 @@ impl pallet_collator_selection::Config for Runtime { type Currency = Balances; // should be a multiple of session or things will get inconsistent type KickThreshold = Period; - type MaxCandidates = MaxCandidates; - type MaxInvulnerables = MaxInvulnerables; - type MinCandidates = MinCandidates; + type MaxCandidates = ConstU32<1000>; + type MaxInvulnerables = ConstU32<100>; + type MinCandidates = ConstU32<5>; type PotId = PotId; type RuntimeEvent = RuntimeEvent; type UpdateOrigin = CollatorSelectionUpdateOrigin; diff --git a/runtime/pangolin/src/pallets/evm.rs b/runtime/pangolin/src/pallets/evm.rs index 215e63681..b99da6ded 100644 --- a/runtime/pangolin/src/pallets/evm.rs +++ b/runtime/pangolin/src/pallets/evm.rs @@ -18,26 +18,8 @@ // darwinia use crate::*; -use darwinia_precompile_assets::{AccountToAssetId, ERC20Assets}; -use darwinia_precompile_bls12_381::BLS12381; -use darwinia_precompile_state_storage::{EthereumStorageFilter, StateStorage}; // frontier -use pallet_ethereum::EthereumBlockHashMapping; -use pallet_evm::{ - AddressMapping, EnsureAddressNever, EnsureAddressRoot, FeeCalculator, FixedGasWeightMapping, - Precompile, PrecompileHandle, PrecompileResult, PrecompileSet, -}; -use pallet_evm_precompile_blake2::Blake2F; -use pallet_evm_precompile_bn128::{Bn128Add, Bn128Mul, Bn128Pairing}; -use pallet_evm_precompile_dispatch::Dispatch; -use pallet_evm_precompile_modexp::Modexp; -use pallet_evm_precompile_simple::{ECRecover, Identity, Ripemd160, Sha256}; -// moonbeam -use precompile_utils::prelude::*; -// substrate -use frame_support::{traits::FindAuthor, ConsensusEngineId}; -use sp_core::crypto::ByteArray; -use sp_std::marker::PhantomData; +use pallet_evm::Precompile; const WEIGHT_PER_GAS: u64 = 40_000; @@ -47,12 +29,17 @@ frame_support::parameter_types! { pub WeightPerGas: Weight = Weight::from_ref_time(WEIGHT_PER_GAS); } -pub struct FindAuthorTruncated(PhantomData); -impl> FindAuthor for FindAuthorTruncated { +pub struct FindAuthorTruncated(sp_std::marker::PhantomData); +impl> frame_support::traits::FindAuthor + for FindAuthorTruncated +{ fn find_author<'a, I>(digests: I) -> Option where - I: 'a + IntoIterator, + I: 'a + IntoIterator, { + // substrate + use sp_core::crypto::ByteArray; + F::find_author(digests).and_then(|i| { Aura::authorities().get(i as usize).and_then(|id| { let raw = id.to_raw_vec(); @@ -68,7 +55,7 @@ impl> FindAuthor for FindAuthorTruncated { } pub struct FixedGasPrice; -impl FeeCalculator for FixedGasPrice { +impl pallet_evm::FeeCalculator for FixedGasPrice { fn min_gas_price() -> (U256, Weight) { (U256::from(GWEI), Weight::zero()) } @@ -76,7 +63,7 @@ impl FeeCalculator for FixedGasPrice { // TODO: Integrate to the upstream repo pub struct FromH160; -impl AddressMapping for FromH160 +impl pallet_evm::AddressMapping for FromH160 where T: From, { @@ -86,14 +73,14 @@ where } pub struct AssetIdConverter; -impl AccountToAssetId for AssetIdConverter { +impl darwinia_precompile_assets::AccountToAssetId for AssetIdConverter { fn account_to_asset_id(account_id: AccountId) -> AssetId { let addr: H160 = account_id.into(); addr.to_low_u64_be() } } -pub struct PangolinPrecompiles(PhantomData); +pub struct PangolinPrecompiles(sp_std::marker::PhantomData); impl PangolinPrecompiles where R: pallet_evm::Config, @@ -121,38 +108,52 @@ where ] } } -impl PrecompileSet for PangolinPrecompiles +impl pallet_evm::PrecompileSet for PangolinPrecompiles where R: pallet_evm::Config, { - fn execute(&self, handle: &mut impl PrecompileHandle) -> Option { + fn execute( + &self, + handle: &mut impl pallet_evm::PrecompileHandle, + ) -> Option { + // darwinia + use darwinia_precompile_assets::AccountToAssetId; + let (code_address, caller) = (handle.code_address(), handle.context().caller); // Filter known precompile addresses except Ethereum officials if self.is_precompile(code_address) && code_address > addr(9) && code_address != caller { - return Some(Err(revert("cannot be called with DELEGATECALL or CALLCODE"))); + return Some(Err(precompile_utils::revert( + "cannot be called with DELEGATECALL or CALLCODE", + ))); }; match code_address { // Ethereum precompiles: - a if a == addr(1) => Some(ECRecover::execute(handle)), - a if a == addr(2) => Some(Sha256::execute(handle)), - a if a == addr(3) => Some(Ripemd160::execute(handle)), - a if a == addr(4) => Some(Identity::execute(handle)), - a if a == addr(5) => Some(Modexp::execute(handle)), - a if a == addr(6) => Some(Bn128Add::execute(handle)), - a if a == addr(7) => Some(Bn128Mul::execute(handle)), - a if a == addr(8) => Some(Bn128Pairing::execute(handle)), - a if a == addr(9) => Some(Blake2F::execute(handle)), + a if a == addr(1) => Some(pallet_evm_precompile_simple::ECRecover::execute(handle)), + a if a == addr(2) => Some(pallet_evm_precompile_simple::Sha256::execute(handle)), + a if a == addr(3) => Some(pallet_evm_precompile_simple::Ripemd160::execute(handle)), + a if a == addr(4) => Some(pallet_evm_precompile_simple::Identity::execute(handle)), + a if a == addr(5) => Some(pallet_evm_precompile_modexp::Modexp::execute(handle)), + a if a == addr(6) => Some(pallet_evm_precompile_bn128::Bn128Add::execute(handle)), + a if a == addr(7) => Some(pallet_evm_precompile_bn128::Bn128Mul::execute(handle)), + a if a == addr(8) => Some(pallet_evm_precompile_bn128::Bn128Pairing::execute(handle)), + a if a == addr(9) => Some(pallet_evm_precompile_blake2::Blake2F::execute(handle)), // Darwinia precompiles: [1024, 2048) for stable precompiles. - a if a == addr(1024) => - Some(>::execute(handle)), - a if a == addr(1025) => Some(>::execute(handle)), + a if a == addr(1024) => Some(>::execute(handle)), + a if a == addr(1025) => + Some(>::execute(handle)), // [1026, 1536) reserved for assets precompiles. a if (1026..1536).contains(&AssetIdConverter::account_to_asset_id(a.into())) => - Some(>::execute(handle)), + Some(>::execute( + handle, + )), // [1536, 2048) reserved for other stable precompiles. // [2048..) reserved for the experimental precompiles. - a if a == addr(2048) => Some(>::execute(handle)), + a if a == addr(2048) => + Some(>::execute(handle)), _ => None, } } @@ -165,20 +166,20 @@ where impl pallet_evm::Config for Runtime { type AddressMapping = FromH160; type BlockGasLimit = BlockGasLimit; - type BlockHashMapping = EthereumBlockHashMapping; - type CallOrigin = EnsureAddressRoot; - type ChainId = ConstU64<43>; + type BlockHashMapping = pallet_ethereum::EthereumBlockHashMapping; + type CallOrigin = pallet_evm::EnsureAddressRoot; + type ChainId = ConstU64<44>; type Currency = Balances; type FeeCalculator = FixedGasPrice; type FindAuthor = FindAuthorTruncated; - type GasWeightMapping = FixedGasWeightMapping; + type GasWeightMapping = pallet_evm::FixedGasWeightMapping; type OnChargeTransaction = (); type PrecompilesType = PangolinPrecompiles; type PrecompilesValue = PrecompilesValue; type Runner = pallet_evm::runner::stack::Runner; type RuntimeEvent = RuntimeEvent; type WeightPerGas = WeightPerGas; - type WithdrawOrigin = EnsureAddressNever; + type WithdrawOrigin = pallet_evm::EnsureAddressNever; } fn addr(a: u64) -> H160 { diff --git a/runtime/pangolin/src/pallets/polkadot_xcm.rs b/runtime/pangolin/src/pallets/polkadot_xcm.rs index 1962d01b2..bd23a5b3c 100644 --- a/runtime/pangolin/src/pallets/polkadot_xcm.rs +++ b/runtime/pangolin/src/pallets/polkadot_xcm.rs @@ -18,24 +18,13 @@ // darwinia use crate::*; -use darwinia_common_runtime::xcm_configs::*; -// moonbeam -use xcm_primitives::*; -// polkadot -use pallet_xcm::XcmPassthrough; -use polkadot_parachain::primitives::Sibling; -use xcm::latest::prelude::*; -use xcm_builder::*; -use xcm_executor::XcmExecutor; -// substrate -use frame_support::traits::{Everything, Nothing, PalletInfoAccess}; /// Means for transacting assets on this chain. -pub type LocalAssetTransactor = CurrencyAdapter< +pub type LocalAssetTransactor = xcm_builder::CurrencyAdapter< // Use this currency: Balances, // Use this currency when it is a fungible asset matching the given location or name: - IsConcrete, + xcm_builder::IsConcrete, // Do a simple punn to convert an AccountId32 MultiLocation into a native chain account ID: LocationToAccountId, // Our chain's account ID type (we can't get away without mentioning it explicitly): @@ -45,7 +34,7 @@ pub type LocalAssetTransactor = CurrencyAdapter< >; frame_support::parameter_types! { - pub const RelayNetwork: NetworkId = NetworkId::Any; + pub const RelayNetwork: xcm::latest::prelude::NetworkId = xcm::latest::prelude::NetworkId::Any; pub RelayChainOrigin: RuntimeOrigin = cumulus_pallet_xcm::Origin::Relay.into(); } /// Type for specifying how a `MultiLocation` can be converted into an `AccountId`. This is used @@ -53,11 +42,11 @@ frame_support::parameter_types! { /// `Transact` in order to determine the dispatch Origin. pub type LocationToAccountId = ( // The parent (Relay-chain) origin converts to the parent `AccountId`. - ParentIsPreset, + xcm_builder::ParentIsPreset, // Sibling parachain origins convert to AccountId via the `ParaId::into`. - SiblingParachainConvertsVia, + xcm_builder::SiblingParachainConvertsVia, // Straight up local `AccountId20` origins just alias directly to `AccountId`. - AccountKey20Aliases, + xcm_builder::AccountKey20Aliases, ); /// This is the type we use to convert an (incoming) XCM origin into a local `Origin` instance, /// ready for dispatching a transaction with Xcm's `Transact`. There is an `OriginKind` which can @@ -66,42 +55,44 @@ pub type XcmOriginToTransactDispatchOrigin = ( // Sovereign account converter; this attempts to derive an `AccountId` from the origin location // using `LocationToAccountId` and then turn that into the usual `Signed` origin. Useful for // foreign chains who want to have a local sovereign account on this chain which they control. - SovereignSignedViaLocation, + xcm_builder::SovereignSignedViaLocation, // Native converter for Relay-chain (Parent) location; will converts to a `Relay` origin when // recognized. - RelayChainAsNative, + xcm_builder::RelayChainAsNative, // Native converter for sibling Parachains; will convert to a `SiblingPara` origin when // recognized. - SiblingParachainAsNative, + xcm_builder::SiblingParachainAsNative, // Native signed account converter; this just converts an `AccountKey20` origin into a normal // `RuntimeOrigin::Signed` origin of the same 20-byte value. - SignedAccountKey20AsNative, + xcm_builder::SignedAccountKey20AsNative, // Xcm origins can be represented natively under the Xcm pallet's Xcm origin. - XcmPassthrough, + pallet_xcm::XcmPassthrough, ); -pub type Barrier = DenyThenTry< - DenyReserveTransferToRelayChain, +pub type Barrier = darwinia_common_runtime::xcm_configs::DenyThenTry< + darwinia_common_runtime::xcm_configs::DenyReserveTransferToRelayChain, ( - TakeWeightCredit, - AllowTopLevelPaidExecutionFrom, + xcm_builder::TakeWeightCredit, + xcm_builder::AllowTopLevelPaidExecutionFrom, // Parent and its exec plurality get free execution - AllowUnpaidExecutionFrom, + xcm_builder::AllowUnpaidExecutionFrom< + darwinia_common_runtime::xcm_configs::ParentOrParentsExecutivePlurality, + >, // Expected responses are OK. - AllowKnownQueryResponses, + xcm_builder::AllowKnownQueryResponses, // Subscriptions for version tracking are OK. - AllowSubscriptionsFrom, + xcm_builder::AllowSubscriptionsFrom, ), >; frame_support::parameter_types! { pub const MaxInstructions: u32 = 100; - pub AnchoringSelfReserve: MultiLocation = MultiLocation::new( + pub AnchoringSelfReserve: xcm::latest::prelude::MultiLocation = xcm::latest::prelude::MultiLocation::new( 0, - X1(PalletInstance(::index() as u8)) + xcm::latest::prelude::X1(xcm::latest::prelude::PalletInstance(::index() as u8)) ); // One XCM operation is 1_000_000_000 weight - almost certainly a conservative estimate. - pub Ancestry: MultiLocation = Parachain(ParachainInfo::parachain_id().into()).into(); + pub Ancestry: xcm::latest::prelude::MultiLocation = xcm::latest::prelude::Parachain(ParachainInfo::parachain_id().into()).into(); pub UnitWeightCost: u64 = 1_000_000_000; } @@ -112,27 +103,28 @@ impl xcm_executor::Config for XcmExecutorConfig { type AssetTransactor = LocalAssetTransactor; type AssetTrap = PolkadotXcm; type Barrier = Barrier; - type IsReserve = NativeAsset; + type IsReserve = xcm_builder::NativeAsset; type IsTeleporter = (); // Teleporting is disabled. - type LocationInverter = LocationInverter; + type LocationInverter = xcm_builder::LocationInverter; type OriginConverter = XcmOriginToTransactDispatchOrigin; type ResponseHandler = PolkadotXcm; type RuntimeCall = RuntimeCall; type SubscriptionService = PolkadotXcm; - type Trader = UsingComponents< - ConstantMultiplier, + type Trader = xcm_builder::UsingComponents< + ConstantMultiplier, AnchoringSelfReserve, AccountId, Balances, DealWithFees, >; - type Weigher = FixedWeightBounds; + type Weigher = xcm_builder::FixedWeightBounds; type XcmSender = XcmRouter; } /// No local origins on this chain are allowed to dispatch XCM sends/executions. -pub type LocalOriginToLocation = SignedToAccountId20; +pub type LocalOriginToLocation = + xcm_primitives::SignedToAccountId20; /// The means for routing XCM messages which are not for local execution into the right message /// queues. pub type XcmRouter = ( @@ -145,25 +137,25 @@ pub type XcmRouter = ( impl pallet_xcm::Config for Runtime { // ^ Override for AdvertisedXcmVersion default type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion; - type ExecuteXcmOrigin = EnsureXcmOrigin; - type LocationInverter = LocationInverter; + type ExecuteXcmOrigin = xcm_builder::EnsureXcmOrigin; + type LocationInverter = xcm_builder::LocationInverter; type RuntimeCall = RuntimeCall; type RuntimeEvent = RuntimeEvent; type RuntimeOrigin = RuntimeOrigin; - type SendXcmOrigin = EnsureXcmOrigin; - type Weigher = FixedWeightBounds; - type XcmExecuteFilter = Nothing; + type SendXcmOrigin = xcm_builder::EnsureXcmOrigin; + type Weigher = xcm_builder::FixedWeightBounds; + type XcmExecuteFilter = frame_support::traits::Nothing; // ^ Disable dispatchable execute on the XCM pallet. // Needs to be `Everything` for local testing. - type XcmExecutor = XcmExecutor; - type XcmReserveTransferFilter = Nothing; + type XcmExecutor = xcm_executor::XcmExecutor; + type XcmReserveTransferFilter = frame_support::traits::Nothing; type XcmRouter = XcmRouter; - type XcmTeleportFilter = Nothing; + type XcmTeleportFilter = frame_support::traits::Nothing; const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100; } impl cumulus_pallet_xcm::Config for Runtime { type RuntimeEvent = RuntimeEvent; - type XcmExecutor = XcmExecutor; + type XcmExecutor = xcm_executor::XcmExecutor; } From 509bf6ac3cf8867254514fceac64f597e3e194a9 Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Wed, 7 Dec 2022 03:16:58 +0800 Subject: [PATCH 031/189] Add sudo key (#107) --- Cargo.lock | 40 +++++++++++++++++++-------------- node/Cargo.toml | 2 +- node/src/chain_spec/crab.rs | 2 +- node/src/chain_spec/darwinia.rs | 2 +- node/src/chain_spec/mod.rs | 1 + node/src/chain_spec/pangolin.rs | 2 +- runtime/crab/Cargo.toml | 2 +- runtime/darwinia/Cargo.toml | 2 +- runtime/pangolin/Cargo.toml | 2 +- 9 files changed, 31 insertions(+), 24 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 50120fd20..baee020df 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -162,6 +162,12 @@ version = "4.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f52f63c5c1316a16a4b35eaac8b76a98248961a533f061684cb2a7cb0eafb6c6" +[[package]] +name = "array-bytes" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22f72e9d6fac4bc80778ea470b20197b88d28c292bb7d60c3fb099280003cd19" + [[package]] name = "arrayref" version = "0.3.6" @@ -486,7 +492,7 @@ name = "beefy-gadget" version = "4.0.0-dev" source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ - "array-bytes", + "array-bytes 4.2.0", "async-trait", "beefy-primitives", "fnv", @@ -1333,7 +1339,7 @@ dependencies = [ name = "crab-runtime" version = "6.0.0" dependencies = [ - "array-bytes", + "array-bytes 6.0.0", "bp-message-dispatch", "bp-messages", "bp-polkadot-core", @@ -2210,7 +2216,7 @@ dependencies = [ name = "darwinia" version = "6.0.0" dependencies = [ - "array-bytes", + "array-bytes 6.0.0", "clap", "crab-runtime", "cumulus-client-cli", @@ -2343,7 +2349,7 @@ dependencies = [ name = "darwinia-message-transact" version = "6.0.0" dependencies = [ - "array-bytes", + "array-bytes 4.2.0", "bp-message-dispatch", "bp-runtime", "ethereum", @@ -2433,7 +2439,7 @@ dependencies = [ name = "darwinia-runtime" version = "6.0.0" dependencies = [ - "array-bytes", + "array-bytes 6.0.0", "bp-message-dispatch", "bp-messages", "bp-polkadot-core", @@ -3482,7 +3488,7 @@ version = "4.0.0-dev" source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "Inflector", - "array-bytes", + "array-bytes 4.2.0", "chrono", "clap", "comfy-table", @@ -6373,7 +6379,7 @@ name = "pallet-beefy-mmr" version = "4.0.0-dev" source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ - "array-bytes", + "array-bytes 4.2.0", "beefy-merkle-tree", "beefy-primitives", "frame-support", @@ -7333,7 +7339,7 @@ dependencies = [ name = "pangolin-runtime" version = "6.0.0" dependencies = [ - "array-bytes", + "array-bytes 6.0.0", "bp-message-dispatch", "bp-messages", "bp-polkadot-core", @@ -9942,7 +9948,7 @@ name = "sc-cli" version = "0.10.0-dev" source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ - "array-bytes", + "array-bytes 4.2.0", "chrono", "clap", "fdlimit", @@ -10268,7 +10274,7 @@ version = "0.10.0-dev" source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "ahash", - "array-bytes", + "array-bytes 4.2.0", "async-trait", "dyn-clone", "finality-grandpa", @@ -10346,7 +10352,7 @@ name = "sc-keystore" version = "4.0.0-dev" source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ - "array-bytes", + "array-bytes 4.2.0", "async-trait", "parking_lot 0.12.1", "serde_json", @@ -10361,7 +10367,7 @@ name = "sc-network" version = "0.10.0-dev" source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ - "array-bytes", + "array-bytes 4.2.0", "async-trait", "asynchronous-codec", "bitflags", @@ -10472,7 +10478,7 @@ name = "sc-network-light" version = "0.10.0-dev" source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ - "array-bytes", + "array-bytes 4.2.0", "futures", "libp2p", "log", @@ -10493,7 +10499,7 @@ name = "sc-network-sync" version = "0.10.0-dev" source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ - "array-bytes", + "array-bytes 4.2.0", "fork-tree", "futures", "libp2p", @@ -10521,7 +10527,7 @@ name = "sc-network-transactions" version = "0.10.0-dev" source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ - "array-bytes", + "array-bytes 4.2.0", "futures", "hex", "libp2p", @@ -10540,7 +10546,7 @@ name = "sc-offchain" version = "4.0.0-dev" source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ - "array-bytes", + "array-bytes 4.2.0", "bytes", "fnv", "futures", @@ -11557,7 +11563,7 @@ name = "sp-core" version = "6.0.0" source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ - "array-bytes", + "array-bytes 4.2.0", "base58", "bitflags", "blake2", diff --git a/node/Cargo.toml b/node/Cargo.toml index 1580c18a2..5df5fe540 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -14,7 +14,7 @@ substrate-build-script-utils = { git = "https://github.com/paritytech/substrate" [dependencies] # crates.io -array-bytes = { version = "4.2" } +array-bytes = { version = "6.0" } clap = { version = "3.2", features = ["derive"] } codec = { package = "parity-scale-codec", version = "3.2" } futures = { version = "0.3" } diff --git a/node/src/chain_spec/crab.rs b/node/src/chain_spec/crab.rs index 426353994..0305463a1 100644 --- a/node/src/chain_spec/crab.rs +++ b/node/src/chain_spec/crab.rs @@ -260,7 +260,7 @@ fn testnet_genesis( treasury: Default::default(), // Utility stuff. - sudo: Default::default(), + sudo: SudoConfig { key: Some(array_bytes::hex_n_into_unchecked(SUDO)) }, vesting: Default::default(), // XCM stuff. diff --git a/node/src/chain_spec/darwinia.rs b/node/src/chain_spec/darwinia.rs index 9fa5ce7af..0ea4d3ca2 100644 --- a/node/src/chain_spec/darwinia.rs +++ b/node/src/chain_spec/darwinia.rs @@ -265,7 +265,7 @@ fn testnet_genesis( treasury: Default::default(), // Utility stuff. - sudo: Default::default(), + sudo: SudoConfig { key: Some(array_bytes::hex_n_into_unchecked(SUDO)) }, vesting: Default::default(), // XCM stuff. diff --git a/node/src/chain_spec/mod.rs b/node/src/chain_spec/mod.rs index 6f7cfbaba..d4101757b 100644 --- a/node/src/chain_spec/mod.rs +++ b/node/src/chain_spec/mod.rs @@ -46,6 +46,7 @@ const CHARLETH: &str = "0x798d4Ba9baf0064Ec19eB4F0a1a45785ae9D6DFc"; const DOROTHY: &str = "0x773539d4Ac0e786233D90A233654ccEE26a613D9"; const ETHAN: &str = "0xFf64d3F6efE2317EE2807d223a0Bdc4c0c49dfDB"; const FAITH: &str = "0xC0F0f4ab324C46e55D02D0033343B4Be8A55532d"; +const SUDO: &str = "0x2748def2f9c3cfbbb963002935bc6d2e1c36ce2e"; /// The default XCM version to set in genesis config. const SAFE_XCM_VERSION: u32 = xcm::prelude::XCM_VERSION; diff --git a/node/src/chain_spec/pangolin.rs b/node/src/chain_spec/pangolin.rs index 42a58a0fd..7e33a927d 100644 --- a/node/src/chain_spec/pangolin.rs +++ b/node/src/chain_spec/pangolin.rs @@ -255,7 +255,7 @@ fn testnet_genesis( treasury: Default::default(), // Utility stuff. - sudo: Default::default(), + sudo: SudoConfig { key: Some(array_bytes::hex_n_into_unchecked(SUDO)) }, vesting: Default::default(), // XCM stuff. diff --git a/runtime/crab/Cargo.toml b/runtime/crab/Cargo.toml index 6c3b79b5e..a7e214e98 100644 --- a/runtime/crab/Cargo.toml +++ b/runtime/crab/Cargo.toml @@ -19,7 +19,7 @@ scale-info = { version = "2.3", default-features = false, features = ["de smallvec = { version = "1.10" } static_assertions = { version = "1.1" } # crates.io optional -array-bytes = { version = "4.1", optional = true } +array-bytes = { version = "6.0", optional = true } # cumulus cumulus-pallet-aura-ext = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } diff --git a/runtime/darwinia/Cargo.toml b/runtime/darwinia/Cargo.toml index b27ae95b1..13138570e 100644 --- a/runtime/darwinia/Cargo.toml +++ b/runtime/darwinia/Cargo.toml @@ -19,7 +19,7 @@ scale-info = { version = "2.3", default-features = false, features = ["de smallvec = { version = "1.10" } static_assertions = { version = "1.1" } # crates.io optional -array-bytes = { version = "4.1", optional = true } +array-bytes = { version = "6.0", optional = true } # cumulus cumulus-pallet-aura-ext = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } diff --git a/runtime/pangolin/Cargo.toml b/runtime/pangolin/Cargo.toml index 9dfb456a6..106613408 100644 --- a/runtime/pangolin/Cargo.toml +++ b/runtime/pangolin/Cargo.toml @@ -19,7 +19,7 @@ scale-info = { version = "2.3", default-features = false, features = ["de smallvec = { version = "1.10" } static_assertions = { version = "1.1" } # crates.io optional -array-bytes = { version = "4.1", optional = true } +array-bytes = { version = "6.0", optional = true } # cumulus cumulus-pallet-aura-ext = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } From 4d167f09a8db24180566d2e6bb9c3f5cd74c32ec Mon Sep 17 00:00:00 2001 From: Guantong <04637@163.com> Date: Wed, 7 Dec 2022 11:22:52 +0800 Subject: [PATCH 032/189] Update XCM filter (#88) --- runtime/crab/src/pallets/polkadot_xcm.rs | 2 +- runtime/darwinia/src/pallets/polkadot_xcm.rs | 2 +- runtime/pangolin/src/pallets/polkadot_xcm.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/runtime/crab/src/pallets/polkadot_xcm.rs b/runtime/crab/src/pallets/polkadot_xcm.rs index 29a61e930..f33bec411 100644 --- a/runtime/crab/src/pallets/polkadot_xcm.rs +++ b/runtime/crab/src/pallets/polkadot_xcm.rs @@ -144,7 +144,7 @@ impl pallet_xcm::Config for Runtime { type RuntimeOrigin = RuntimeOrigin; type SendXcmOrigin = xcm_builder::EnsureXcmOrigin; type Weigher = xcm_builder::FixedWeightBounds; - type XcmExecuteFilter = frame_support::traits::Nothing; + type XcmExecuteFilter = frame_support::traits::Everything; // ^ Disable dispatchable execute on the XCM pallet. // Needs to be `Everything` for local testing. type XcmExecutor = xcm_executor::XcmExecutor; diff --git a/runtime/darwinia/src/pallets/polkadot_xcm.rs b/runtime/darwinia/src/pallets/polkadot_xcm.rs index 38d03b134..8f5f9a9c9 100644 --- a/runtime/darwinia/src/pallets/polkadot_xcm.rs +++ b/runtime/darwinia/src/pallets/polkadot_xcm.rs @@ -144,7 +144,7 @@ impl pallet_xcm::Config for Runtime { type RuntimeOrigin = RuntimeOrigin; type SendXcmOrigin = xcm_builder::EnsureXcmOrigin; type Weigher = xcm_builder::FixedWeightBounds; - type XcmExecuteFilter = frame_support::traits::Nothing; + type XcmExecuteFilter = frame_support::traits::Everything; // ^ Disable dispatchable execute on the XCM pallet. // Needs to be `Everything` for local testing. type XcmExecutor = xcm_executor::XcmExecutor; diff --git a/runtime/pangolin/src/pallets/polkadot_xcm.rs b/runtime/pangolin/src/pallets/polkadot_xcm.rs index bd23a5b3c..ba122f3c5 100644 --- a/runtime/pangolin/src/pallets/polkadot_xcm.rs +++ b/runtime/pangolin/src/pallets/polkadot_xcm.rs @@ -144,7 +144,7 @@ impl pallet_xcm::Config for Runtime { type RuntimeOrigin = RuntimeOrigin; type SendXcmOrigin = xcm_builder::EnsureXcmOrigin; type Weigher = xcm_builder::FixedWeightBounds; - type XcmExecuteFilter = frame_support::traits::Nothing; + type XcmExecuteFilter = frame_support::traits::Everything; // ^ Disable dispatchable execute on the XCM pallet. // Needs to be `Everything` for local testing. type XcmExecutor = xcm_executor::XcmExecutor; From 8943e2dde198d755aa90b6776eb3260035fdf81b Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Wed, 7 Dec 2022 21:33:29 +0800 Subject: [PATCH 033/189] Improve code (#111) --- pallet/deposit/src/lib.rs | 16 ++++----- pallet/staking/src/lib.rs | 70 +++++++++++++++++---------------------- 2 files changed, 37 insertions(+), 49 deletions(-) diff --git a/pallet/deposit/src/lib.rs b/pallet/deposit/src/lib.rs index 6f43e31e1..97babfa07 100644 --- a/pallet/deposit/src/lib.rs +++ b/pallet/deposit/src/lib.rs @@ -214,7 +214,7 @@ pub mod pallet { let now = T::UnixTime::now().as_millis(); let mut claimed = 0; let _ = >::try_mutate(&who, |maybe_ds| { - let Some(ds) = maybe_ds else { return Err(()); }; + let ds = maybe_ds.as_mut().ok_or(())?; ds.retain(|d| { if d.expired_time <= now && !d.in_use { @@ -232,7 +232,7 @@ pub mod pallet { *maybe_ds = None; } - Ok(()) + >::Ok(()) }); T::Ring::transfer(&Self::account_id(), &who, claimed, AllowDeath)?; @@ -265,10 +265,8 @@ where fn stake(who: &Self::AccountId, item: Self::Item) -> DispatchResult { >::try_mutate(who, |ds| { - let Some(ds) = ds else { return Err(>::DepositNotFound)?; }; - let Some(d) = ds.iter_mut().find(|d| d.id == item) else { - return Err(>::DepositNotFound)?; - }; + let ds = ds.as_mut().ok_or(>::DepositNotFound)?; + let d = ds.iter_mut().find(|d| d.id == item).ok_or(>::DepositNotFound)?; if d.in_use { Err(>::DepositInUse)? @@ -282,10 +280,8 @@ where fn unstake(who: &Self::AccountId, item: Self::Item) -> DispatchResult { >::try_mutate(who, |ds| { - let Some(ds) = ds else { return Err(>::DepositNotFound)?; }; - let Some(d) = ds.iter_mut().find(|d| d.id == item) else { - return Err(>::DepositNotFound)?; - }; + let ds = ds.as_mut().ok_or(>::DepositNotFound)?; + let d = ds.iter_mut().find(|d| d.id == item).ok_or(>::DepositNotFound)?; if d.in_use { d.in_use = false; diff --git a/pallet/staking/src/lib.rs b/pallet/staking/src/lib.rs index 91b78e9be..e095e9e11 100644 --- a/pallet/staking/src/lib.rs +++ b/pallet/staking/src/lib.rs @@ -18,6 +18,8 @@ //! # Darwinia parachain staking pallet //! +//! ## Overview +//! //! This is a completely specialized stake pallet designed only for Darwinia parachain. //! So, this pallet will eliminate the generic parameters as much as possible. //! @@ -415,9 +417,7 @@ pub mod pallet { } >::try_mutate(&who, |l| { - let Some(l) = l else { - return Err(>::NotStaker)?; - }; + let l = l.as_mut().ok_or(>::NotStaker)?; if ring_amount != 0 { Self::unstake_ring(l, ring_amount)?; @@ -513,22 +513,14 @@ pub mod pallet { P: frame_support::StorageValue, { P::try_mutate(|p| { - let p_new = if increase { - let Some(p_new) = p.checked_add(amount) else { - return Err("[pallet::staking] `u128` must not be overflowed; qed")?; - }; - - p_new + *p = if increase { + p.checked_add(amount) + .ok_or("[pallet::staking] `u128` must not be overflowed; qed")? } else { - let Some(p_new) = p.checked_sub(amount) else { - return Err("[pallet::staking] `u128` must not be overflowed; qed")?; - }; - - p_new + p.checked_sub(amount) + .ok_or("[pallet::staking] `u128` must not be overflowed; qed")? }; - *p = p_new; - Ok(()) }) } @@ -536,11 +528,10 @@ pub mod pallet { fn stake_ring(ledger: &mut Ledger, amount: Balance) -> DispatchResult { T::Ring::stake(&ledger.account, amount)?; - ledger.staked_ring = if let Some(r) = ledger.staked_ring.checked_add(amount) { - r - } else { - return Err("[pallet::staking] `u128` must not be overflowed; qed")?; - }; + ledger.staked_ring = ledger + .staked_ring + .checked_add(amount) + .ok_or("[pallet::staking] `u128` must not be overflowed; qed")?; Self::update_pool::>(true, amount)?; @@ -550,11 +541,10 @@ pub mod pallet { fn stake_kton(ledger: &mut Ledger, amount: Balance) -> DispatchResult { T::Kton::stake(&ledger.account, amount)?; - ledger.staked_kton = if let Some(k) = ledger.staked_kton.checked_add(amount) { - k - } else { - return Err("[pallet::staking] `u128` must not be overflowed; qed")?; - }; + ledger.staked_kton = ledger + .staked_kton + .checked_add(amount) + .ok_or("[pallet::staking] `u128` must not be overflowed; qed")?; Self::update_pool::>(true, amount)?; @@ -572,9 +562,10 @@ pub mod pallet { } fn unstake_ring(ledger: &mut Ledger, amount: Balance) -> DispatchResult { - let Some(nr) = ledger.staked_ring.checked_sub(amount) else { - return Err("[pallet::staking] `u128` must not be overflowed; qed")?; - }; + let nr = ledger + .staked_ring + .checked_sub(amount) + .ok_or("[pallet::staking] `u128` must not be overflowed; qed")?; ledger.staked_ring = nr; ledger @@ -591,9 +582,10 @@ pub mod pallet { } fn unstake_kton(ledger: &mut Ledger, amount: Balance) -> DispatchResult { - let Some(nk) = ledger.staked_kton.checked_sub(amount) else { - return Err("[pallet::staking] `u128` must not be overflowed; qed")?; - }; + let nk = ledger + .staked_kton + .checked_sub(amount) + .ok_or("[pallet::staking] `u128` must not be overflowed; qed")?; ledger.staked_kton = nk; ledger @@ -610,9 +602,9 @@ pub mod pallet { } fn unstake_deposit(ledger: &mut Ledger, deposit: DepositId) -> DispatchResult { - let Some(i) = ledger.staked_deposits.iter().position(|d| d == &deposit) else { - return Err("[pallet::staking] deposit id must be existed, due to previous unstake OP; qed")?; - }; + let i = ledger.staked_deposits.iter().position(|d| d == &deposit).ok_or( + "[pallet::staking] deposit id must be existed, due to previous unstake OP; qed", + )?; ledger .unstaking_deposits @@ -629,9 +621,7 @@ pub mod pallet { fn claim_unstakings(who: &T::AccountId) -> DispatchResult { >::try_mutate(who, |l| { - let Some(l) = l else { - return Err(>::NotStaker)?; - }; + let l = l.as_mut().ok_or(>::NotStaker)?; let now = >::block_number(); let claim = |u: &mut BoundedVec<_, _>, c: &mut Balance| { u.retain(|(a, t)| { @@ -676,7 +666,7 @@ pub mod pallet { fn try_clean_ledger_of(who: &T::AccountId) { let _ = >::try_mutate(who, |maybe_l| { - let Some(l) = maybe_l else { return Err(()); }; + let l = maybe_l.as_mut().ok_or(())?; if l.is_empty() { *maybe_l = None; @@ -752,6 +742,8 @@ pub mod pallet { session_duration, elapsed_time, ) else { + log::error!("[pallet::staking] failed to calculate the inflation"); + return; }; let payout = T::PayoutFraction::get() * inflation; From 97ff5cc5ea485a40b6d033269adbbf5e2019eedb Mon Sep 17 00:00:00 2001 From: bear Date: Thu, 8 Dec 2022 01:46:13 +0800 Subject: [PATCH 034/189] Update AssetId (#109) * Update asset id * Rename --- runtime/darwinia/src/pallets/assets.rs | 5 +++++ runtime/darwinia/src/pallets/deposit.rs | 2 +- runtime/darwinia/src/pallets/mod.rs | 1 + runtime/darwinia/src/pallets/staking.rs | 14 ++++++++++++-- 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/runtime/darwinia/src/pallets/assets.rs b/runtime/darwinia/src/pallets/assets.rs index d649ffa49..7b4fdd01b 100644 --- a/runtime/darwinia/src/pallets/assets.rs +++ b/runtime/darwinia/src/pallets/assets.rs @@ -19,6 +19,11 @@ // darwinia use crate::*; +/// List of the assets existed in this runtime. +pub enum AssetIds { + Kton = 1026, +} + impl pallet_assets::Config for Runtime { type ApprovalDeposit = ConstU128<0>; type AssetAccountDeposit = ConstU128<0>; diff --git a/runtime/darwinia/src/pallets/deposit.rs b/runtime/darwinia/src/pallets/deposit.rs index 5eadb228c..84dc288c3 100644 --- a/runtime/darwinia/src/pallets/deposit.rs +++ b/runtime/darwinia/src/pallets/deposit.rs @@ -24,7 +24,7 @@ impl darwinia_deposit::Minting for KtonMinting { type AccountId = AccountId; fn mint(beneficiary: &Self::AccountId, amount: Balance) -> sp_runtime::DispatchResult { - Assets::mint(RuntimeOrigin::root(), 0, *beneficiary, amount) + Assets::mint(RuntimeOrigin::root(), AssetIds::Kton as AssetId, *beneficiary, amount) } } diff --git a/runtime/darwinia/src/pallets/mod.rs b/runtime/darwinia/src/pallets/mod.rs index 01d8f6b29..d6cdba9f7 100644 --- a/runtime/darwinia/src/pallets/mod.rs +++ b/runtime/darwinia/src/pallets/mod.rs @@ -40,6 +40,7 @@ mod balances; mod transaction_payment; mod assets; +pub use assets::*; mod deposit; diff --git a/runtime/darwinia/src/pallets/staking.rs b/runtime/darwinia/src/pallets/staking.rs index aaabc41c1..eca7c53cb 100644 --- a/runtime/darwinia/src/pallets/staking.rs +++ b/runtime/darwinia/src/pallets/staking.rs @@ -48,11 +48,21 @@ impl darwinia_staking::Stake for KtonStaking { type Item = Balance; fn stake(who: &Self::AccountId, item: Self::Item) -> sp_runtime::DispatchResult { - Assets::transfer(RuntimeOrigin::signed(*who), 0, darwinia_staking::account_id(), item) + Assets::transfer( + RuntimeOrigin::signed(*who), + AssetIds::Kton as AssetId, + darwinia_staking::account_id(), + item, + ) } fn unstake(who: &Self::AccountId, item: Self::Item) -> sp_runtime::DispatchResult { - Assets::transfer(RuntimeOrigin::signed(darwinia_staking::account_id()), 0, *who, item) + Assets::transfer( + RuntimeOrigin::signed(darwinia_staking::account_id()), + AssetIds::Kton as AssetId, + *who, + item, + ) } } From e5b640911ea6097a88cb266effff9f1ef25e151e Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Thu, 8 Dec 2022 11:53:18 +0800 Subject: [PATCH 035/189] Release collator staking restriction (#114) --- pallet/staking/src/lib.rs | 36 +++++++++++++---------------------- pallet/staking/tests/tests.rs | 2 ++ 2 files changed, 15 insertions(+), 23 deletions(-) diff --git a/pallet/staking/src/lib.rs b/pallet/staking/src/lib.rs index e095e9e11..039c90602 100644 --- a/pallet/staking/src/lib.rs +++ b/pallet/staking/src/lib.rs @@ -148,10 +148,8 @@ where pub struct Exposure { /// The total power backing this collator. pub total: Power, - /// Collator's self stake power. - pub own: Power, /// Nominators' stake power. - pub others: Vec>, + pub nominators: Vec>, } /// A snapshot of the staker's state. #[derive(Encode, Decode, MaxEncodedLen, TypeInfo, RuntimeDebug)] @@ -459,7 +457,6 @@ pub mod pallet { pub fn collect(origin: OriginFor, commission: Perbill) -> DispatchResult { let who = ensure_signed(origin)?; - Self::ensure_staker(&who)?; >::mutate(&who, |c| *c = Some(commission)); // TODO: event? @@ -474,8 +471,9 @@ pub mod pallet { pub fn nominate(origin: OriginFor, target: T::AccountId) -> DispatchResult { let who = ensure_signed(origin)?; - Self::ensure_staker(&who)?; - + if !>::contains_key(&who) { + Err(>::NotStaker)? + } if !>::contains_key(&target) { Err(>::TargetNotCollator)?; } @@ -680,14 +678,6 @@ pub mod pallet { }); } - fn ensure_staker(who: &T::AccountId) -> DispatchResult { - if >::contains_key(who) { - Ok(()) - } else { - Err(>::NotStaker)? - } - } - /// Add reward points to collators using their account id. pub fn reward_by_ids(collators: &[(T::AccountId, RewardPoint)]) { >::mutate(|(total, reward_map)| { @@ -765,16 +755,17 @@ pub mod pallet { continue; }; - let c_payout = c_commission_payout - + Perbill::from_rational(c_exposure.own, c_exposure.total) * n_payout; - if let Ok(_i) = T::RingCurrency::deposit_into_existing(&c, c_payout) { - actual_payout += c_payout; + if let Ok(_i) = T::RingCurrency::deposit_into_existing(&c, c_commission_payout) { + actual_payout += c_commission_payout; - Self::deposit_event(Event::::Payout { staker: c, ring_amount: c_payout }); + Self::deposit_event(Event::::Payout { + staker: c, + ring_amount: c_commission_payout, + }); } - for n_exposure in c_exposure.others { + for n_exposure in c_exposure.nominators { let n_payout = Perbill::from_rational(n_exposure.value, c_exposure.total) * n_payout; @@ -807,8 +798,7 @@ pub mod pallet { pub fn elect() -> Vec { let mut collators = >::iter_keys() .map(|c| { - let c_power = Self::power_of(&c); - let mut t_power = c_power; + let mut t_power = 0; let i_exposures = >::iter() .filter_map(|(n, c_)| { if c_ == c { @@ -823,7 +813,7 @@ pub mod pallet { }) .collect(); - ((c, Exposure { total: t_power, own: c_power, others: i_exposures }), t_power) + ((c, Exposure { total: t_power, nominators: i_exposures }), t_power) }) .collect::>(); diff --git a/pallet/staking/tests/tests.rs b/pallet/staking/tests/tests.rs index 917857398..7c3bbf958 100644 --- a/pallet/staking/tests/tests.rs +++ b/pallet/staking/tests/tests.rs @@ -393,6 +393,7 @@ fn elect_should_work() { Vec::new() )); assert_ok!(Staking::collect(RuntimeOrigin::signed(i), Default::default())); + assert_ok!(Staking::nominate(RuntimeOrigin::signed(i), i)); }); (6..=10).for_each(|i| { assert_ok!(Staking::stake( @@ -441,6 +442,7 @@ fn payout_should_work() { Vec::new() )); assert_ok!(Staking::collect(RuntimeOrigin::signed(i), Perbill::from_percent(i * 10))); + assert_ok!(Staking::nominate(RuntimeOrigin::signed(i), i)); }); (6..=10).for_each(|i| { assert_ok!(Staking::stake( From 4f78cb8b05a8e103faf55aad9840479bee1bbd6d Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Thu, 8 Dec 2022 15:59:47 +0800 Subject: [PATCH 036/189] Account migration (#108) --- Cargo.lock | 6 +- node/src/chain_spec/crab.rs | 2 - node/src/chain_spec/darwinia.rs | 2 - node/src/chain_spec/pangolin.rs | 2 - pallet/account-migration/Cargo.toml | 32 ++-- pallet/account-migration/src/lib.rs | 222 ++++++++++++------------ pallet/account-migration/src/mock.rs | 214 ----------------------- pallet/account-migration/src/test.rs | 193 -------------------- pallet/account-migration/src/tests.rs | 56 ++++++ pallet/deposit/src/lib.rs | 2 + pallet/staking/src/lib.rs | 6 +- runtime/crab/src/pallets/migrate.rs | 1 - runtime/darwinia/src/pallets/migrate.rs | 1 - runtime/pangolin/src/pallets/migrate.rs | 1 - tool/state-processor/src/main.rs | 2 + 15 files changed, 181 insertions(+), 561 deletions(-) delete mode 100644 pallet/account-migration/src/mock.rs delete mode 100644 pallet/account-migration/src/test.rs create mode 100644 pallet/account-migration/src/tests.rs diff --git a/Cargo.lock b/Cargo.lock index baee020df..978177a7b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2297,19 +2297,15 @@ name = "darwinia-account-migration" version = "6.0.0" dependencies = [ "dc-primitives", - "fp-ethereum", - "fp-evm", "frame-support", "frame-system", "pallet-balances", - "pallet-evm", - "pallet-timestamp", "parity-scale-codec", "scale-info", "sp-core", "sp-io", + "sp-keyring", "sp-runtime", - "sp-std", ] [[package]] diff --git a/node/src/chain_spec/crab.rs b/node/src/chain_spec/crab.rs index 0305463a1..18af6ed49 100644 --- a/node/src/chain_spec/crab.rs +++ b/node/src/chain_spec/crab.rs @@ -150,7 +150,6 @@ pub fn genesis_config() -> ChainSpec { balances: Default::default(), transaction_payment: Default::default(), assets: Default::default(), - account_migration: Default::default(), // Consensus stuff. collator_selection: CollatorSelectionConfig { @@ -228,7 +227,6 @@ fn testnet_genesis( }, transaction_payment: Default::default(), assets: Default::default(), - account_migration: Default::default(), // Consensus stuff. collator_selection: CollatorSelectionConfig { diff --git a/node/src/chain_spec/darwinia.rs b/node/src/chain_spec/darwinia.rs index 0ea4d3ca2..47bf1b030 100644 --- a/node/src/chain_spec/darwinia.rs +++ b/node/src/chain_spec/darwinia.rs @@ -154,7 +154,6 @@ pub fn genesis_config() -> ChainSpec { balances: Default::default(), transaction_payment: Default::default(), assets: Default::default(), - account_migration: Default::default(), // Consensus stuff. staking: StakingConfig { @@ -232,7 +231,6 @@ fn testnet_genesis( }, transaction_payment: Default::default(), assets: Default::default(), - account_migration: Default::default(), // Consensus stuff. staking: StakingConfig { diff --git a/node/src/chain_spec/pangolin.rs b/node/src/chain_spec/pangolin.rs index 7e33a927d..44fe34d8f 100644 --- a/node/src/chain_spec/pangolin.rs +++ b/node/src/chain_spec/pangolin.rs @@ -150,7 +150,6 @@ pub fn genesis_config() -> ChainSpec { balances: Default::default(), transaction_payment: Default::default(), assets: Default::default(), - account_migration: Default::default(), // Consensus stuff. collator_selection: CollatorSelectionConfig { @@ -223,7 +222,6 @@ fn testnet_genesis( }, transaction_payment: Default::default(), assets: Default::default(), - account_migration: Default::default(), // Consensus stuff. collator_selection: CollatorSelectionConfig { diff --git a/pallet/account-migration/Cargo.toml b/pallet/account-migration/Cargo.toml index a26fea97b..8981877e5 100644 --- a/pallet/account-migration/Cargo.toml +++ b/pallet/account-migration/Cargo.toml @@ -1,6 +1,6 @@ [package] authors = ["Darwinia Network "] -description = "State storage precompiles for EVM pallet." +description = "Darwinia SR25519 to ECDSA account migration." edition = "2021" homepage = "https://darwinia.network" license = "GPL-3.0" @@ -15,25 +15,18 @@ codec = { default-features = false, package = "parity-scale-codec", version scale-info = { default-features = false, version = "2.3.0", features = ["derive"] } # darwinia -dc-primitives = { default-features = false, path = "../../core/primitives"} - -# frontier -fp-ethereum = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } -fp-evm = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } -pallet-evm = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +dc-primitives = { default-features = false, path = "../../core/primitives" } # substrate -frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-io = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-balances = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-io = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } [dev-dependencies] -# substrate -pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } [features] default = ["std"] @@ -45,16 +38,11 @@ std = [ # darwinia "dc-primitives/std", - # frontier - "fp-evm/std", - "fp-ethereum/std", - "pallet-evm/std", - # paritytech "frame-support/std", "frame-system/std", + "pallet-balances/std", "sp-core/std", "sp-runtime/std", "sp-io/std", - "sp-std/std", ] diff --git a/pallet/account-migration/src/lib.rs b/pallet/account-migration/src/lib.rs index f349ff650..88213072f 100644 --- a/pallet/account-migration/src/lib.rs +++ b/pallet/account-migration/src/lib.rs @@ -16,174 +16,166 @@ // You should have received a copy of the GNU General Public License // along with Darwinia. If not, see . +//! # Darwinia account migration pallet +//! +//! ## Overview +//! +//! Darwinia2 uses ECDSA as its signature algorithm instead of SR25519. +//! These two algorithm are not compatible. +//! Thus, an account migration is required. +//! +//! ## Technical detail +//! +//! Users must send an extrinsic themselves to migrate their account(s). +//! This extrinsic should be unsigned, the reason is the same as `pallet-claims`. +//! This extrinsic's payload must contain a signature to the new ECDSA address, signed by their +//! origin SR25519 key. +//! +//! This pallet will store all the account data from Darwinia1 and Darwinia Parachain. +//! This pallet's genesis will be write into the chain spec JSON directly. +//! The data will be processed off-chain(ly). +//! After the verification, simply perform a take & put operation. +//! +//! ```nocompile +//! user -> send extrinsic -> verify -> put(storages, ECDSA, take(storages, SR25519)) +//! ``` + #![cfg_attr(not(feature = "std"), no_std)] +#![deny(missing_docs)] -#[cfg(test)] -mod mock; -#[cfg(test)] -mod test; +// TODO: update weight -/// Type alias for currency AccountId. -type AccountIdOf = ::AccountId; -/// Type alias for currency balance. -type BalanceOf = - <::Currency as Currency<::AccountId>>::Balance; +#[cfg(test)] +mod tests; // darwinia -use dc_primitives::Balance; +use dc_primitives::{AccountId as AccountId20, Balance, Index}; // substrate -use frame_support::traits::Currency; -#[cfg(feature = "std")] -use frame_support::traits::GenesisBuild; -use sp_core::{ - crypto::ByteArray, - sr25519::{Public, Signature}, - H160, -}; -use sp_io::hashing::blake2_256; +use frame_support::{log, pallet_prelude::*}; +use frame_system::{pallet_prelude::*, AccountInfo}; +use pallet_balances::AccountData; +use sp_core::sr25519::{Public, Signature}; +use sp_io::hashing; use sp_runtime::{traits::Verify, AccountId32}; -use sp_std::vec::Vec; -pub use pallet::*; +type Message = [u8; 32]; + #[frame_support::pallet] pub mod pallet { use super::*; - use frame_support::pallet_prelude::*; - use frame_system::pallet_prelude::*; #[pallet::pallet] pub struct Pallet(PhantomData); #[pallet::config] - pub trait Config: frame_system::Config + pallet_evm::Config { - /// The overarching event type. + pub trait Config: + frame_system::Config< + AccountId = AccountId20, + Index = Index, + AccountData = AccountData, + > + { + /// Override the [`frame_system::Config::RuntimeEvent`]. type RuntimeEvent: From + IsType<::RuntimeEvent>; - /// Currency type for the runtime. - type Currency: Currency; - } - - // Store the migrated balance snapshot for the darwinia-1.0 chain state. - #[pallet::storage] - #[pallet::getter(fn balance_of)] - pub(super) type Balances = StorageMap<_, Blake2_128Concat, AccountId32, Balance>; - - #[pallet::error] - pub enum Error { - /// This account does not exist in the darwinia 1.0 chain state. - AccountNotExist, } + #[allow(missing_docs)] #[pallet::event] #[pallet::generate_deposit(pub(super) fn deposit_event)] pub enum Event { - /// Claim to the new account id. - Claim { old_pub_key: AccountId32, new_pub_key: H160, amount: Balance }, + /// An account has been migrated. + Migrated { from: AccountId32, to: AccountId20 }, } - #[pallet::genesis_config] - #[cfg_attr(feature = "std", derive(Default))] - pub struct GenesisConfig { - pub migrated_accounts: Vec<(AccountId32, Balance)>, - } + /// [`frame_system::Account`] data. + #[pallet::storage] + #[pallet::getter(fn account_of)] + pub type Accounts = + StorageMap<_, Identity, AccountId32, AccountInfo>>; - #[pallet::genesis_build] - impl GenesisBuild for GenesisConfig { - fn build(&self) { - self.migrated_accounts.iter().for_each(|(account, amount)| { - Balances::::insert(account, amount); - }); - } - } + // TODO: identity storages + // TODO: proxy storages + // TODO: staking storages + // TODO: vesting storages #[pallet::call] - impl Pallet - where - AccountIdOf: From, - BalanceOf: From, - { - // since signature and chain_id verification is done in `validate_unsigned` - // we can skip doing it here again. - // TODO: update weight + impl Pallet { + /// Migrate all the account data under the `from` to `to`. #[pallet::weight(0)] - pub fn claim_to( + pub fn migrate( origin: OriginFor, - _chain_id: u64, - old_pub_key: AccountId32, - new_pub_key: H160, - _sig: Signature, + from: AccountId32, + to: AccountId20, + _signature: Signature, ) -> DispatchResult { ensure_none(origin)?; - let Some(amount) = Balances::::take(&old_pub_key) else { - return Err(Error::::AccountNotExist.into()); - }; + let account = >::take(&from) + .ok_or("[pallet::account-migration] already checked in `pre_dispatch`; qed")?; + + >::insert(to, account); - ::Currency::deposit_creating(&new_pub_key.into(), amount.into()); - Self::deposit_event(Event::Claim { old_pub_key, new_pub_key, amount }); + Self::deposit_event(Event::Migrated { from, to }); Ok(()) } } #[pallet::validate_unsigned] - impl ValidateUnsigned for Pallet - where - AccountIdOf: From, - BalanceOf: From, - { + impl ValidateUnsigned for Pallet { type Call = Call; fn validate_unsigned(_source: TransactionSource, call: &Self::Call) -> TransactionValidity { - let Call::claim_to { chain_id, old_pub_key, new_pub_key, sig } = call else { + // The migration destination was already taken by someone. + const E_ACCOUNT_ALREADY_EXISTED: u8 = 0; + // The migration source was not exist. + const E_ACCOUNT_NOT_FOUND: u8 = 1; + // Invalid signature. + const E_INVALID_SIGNATURE: u8 = 2; + + let Call::migrate { from, to, signature } = call else { return InvalidTransaction::Call.into(); }; - if *chain_id != ::ChainId::get() { - return InvalidTransaction::BadProof.into(); + if !>::contains_key(from) { + return InvalidTransaction::Custom(E_ACCOUNT_NOT_FOUND).into(); } - if !Balances::::contains_key(old_pub_key) { - return InvalidTransaction::BadSigner.into(); + if >::contains_key(to) { + return InvalidTransaction::Custom(E_ACCOUNT_ALREADY_EXISTED).into(); } - let message = ClaimMessage::new( - ::ChainId::get(), - old_pub_key, - new_pub_key, - ); - if let Ok(signer) = Public::from_slice(old_pub_key.as_ref()) { - let is_valid = sig.verify(&blake2_256(&message.raw_bytes())[..], &signer); - - if is_valid { - return ValidTransaction::with_tag_prefix("MigrateClaim") - .priority(TransactionPriority::max_value()) - .propagate(true) - .build(); - } + let message = sr25519_signable_message(T::Version::get().spec_name.as_ref(), to); + + if verify_sr25519_signature(from, &message, signature) { + ValidTransaction::with_tag_prefix("account-migration") + .and_provides(from) + .priority(100) + .longevity(TransactionLongevity::max_value()) + .propagate(true) + .build() + } else { + InvalidTransaction::Custom(E_INVALID_SIGNATURE).into() } - InvalidTransaction::BadSigner.into() } } } +pub use pallet::*; -/// ClaimMessage is the metadata that needs to be signed when the user invokes claim dispatch. -/// -/// It consists of three parts, namely the chain_id, the AccountId32 account for darwinia 1.0, and -/// the H160 account for darwinia 2.0. -pub struct ClaimMessage<'m> { - pub chain_id: u64, - pub old_pub_key: &'m AccountId32, - pub new_pub_key: &'m H160, +fn sr25519_signable_message(spec_name: &[u8], account_id_20: &AccountId20) -> Message { + hashing::blake2_256(&[spec_name, b"::account-migration", &account_id_20.0].concat()) } -impl<'m> ClaimMessage<'m> { - fn new(chain_id: u64, old_pub_key: &'m AccountId32, new_pub_key: &'m H160) -> Self { - Self { chain_id, old_pub_key, new_pub_key } - } +fn verify_sr25519_signature( + public_key: &AccountId32, + message: &Message, + signature: &Signature, +) -> bool { + // Actually, `&[u8]` is `[u8; 32]` here. + // But for better safety. + let Ok(public_key) = &Public::try_from(public_key.as_ref()) else { + log::error!("[pallet::account-migration] `public_key` must be valid; qed"); - fn raw_bytes(&self) -> Vec { - let mut result = Vec::new(); - result.extend_from_slice(&self.chain_id.to_be_bytes()); - result.extend_from_slice(self.old_pub_key.as_slice()); - result.extend_from_slice(self.new_pub_key.as_bytes()); - result - } + return false; + }; + + signature.verify(message.as_slice(), public_key) } diff --git a/pallet/account-migration/src/mock.rs b/pallet/account-migration/src/mock.rs deleted file mode 100644 index 64f11fedb..000000000 --- a/pallet/account-migration/src/mock.rs +++ /dev/null @@ -1,214 +0,0 @@ -// This file is part of Darwinia. -// -// Copyright (C) 2018-2022 Darwinia Network -// SPDX-License-Identifier: GPL-3.0 -// -// Darwinia is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// Darwinia 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 Darwinia. If not, see . - -//! Test utilities - -// frontier -use pallet_evm::IdentityAddressMapping; -// parity -use frame_support::{ - pallet_prelude::Weight, - traits::{ConstU32, Everything}, -}; -use sp_core::{sr25519::Pair, Pair as PairT, H160, H256, U256}; -use sp_runtime::{ - testing::Header, - traits::{BlakeTwo256, IdentityLookup}, - AccountId32, BuildStorage, -}; -use sp_std::prelude::*; -// darwinia -use crate::{self as darwinia_account_migration}; - -pub type Block = frame_system::mocking::MockBlock; -pub type Balance = u128; -pub type AccountId = H160; -pub type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; - -pub enum EthAccounts { - Alice, - Bob, -} - -impl Into for EthAccounts { - fn into(self) -> H160 { - match self { - EthAccounts::Alice => H160::repeat_byte(0xAA), - EthAccounts::Bob => H160::repeat_byte(0xBB), - } - } -} - -#[derive(Debug, Clone, Copy)] -pub enum SubAccounts { - Charlie, - Bogus, -} - -impl SubAccounts { - pub fn to_pair(self) -> (Pair, AccountId32) { - match self { - SubAccounts::Charlie => { - let pair = Pair::from_seed(b"12345678901234567890123456789012"); - let account_id = AccountId32::new(pair.public().0); - (pair, account_id) - }, - SubAccounts::Bogus => { - let pair = Pair::from_seed(b"12345678901234567890123456789013"); - let account_id = AccountId32::new(pair.public().0); - (pair, account_id) - }, - } - } -} - -frame_support::parameter_types! { - pub const BlockHashCount: u64 = 250; -} -impl frame_system::Config for TestRuntime { - type AccountData = pallet_balances::AccountData; - type AccountId = AccountId; - type BaseCallFilter = Everything; - type BlockHashCount = (); - type BlockLength = (); - type BlockNumber = u64; - type BlockWeights = (); - type DbWeight = (); - type Hash = H256; - type Hashing = BlakeTwo256; - type Header = Header; - type Index = u64; - type Lookup = IdentityLookup; - type MaxConsumers = ConstU32<16>; - type OnKilledAccount = (); - type OnNewAccount = (); - type OnSetCode = (); - type PalletInfo = PalletInfo; - type RuntimeCall = RuntimeCall; - type RuntimeEvent = RuntimeEvent; - type RuntimeOrigin = RuntimeOrigin; - type SS58Prefix = (); - type SystemWeightInfo = (); - type Version = (); -} - -frame_support::parameter_types! { - pub const MaxLocks: u32 = 10; - pub const ExistentialDeposit: u64 = 0; -} -impl pallet_balances::Config for TestRuntime { - type AccountStore = System; - type Balance = Balance; - type DustRemoval = (); - type ExistentialDeposit = ExistentialDeposit; - type MaxLocks = MaxLocks; - type MaxReserves = (); - type ReserveIdentifier = [u8; 8]; - type RuntimeEvent = RuntimeEvent; - type WeightInfo = (); -} - -frame_support::parameter_types! { - pub const MinimumPeriod: u64 = 6000 / 2; -} -impl pallet_timestamp::Config for TestRuntime { - type MinimumPeriod = MinimumPeriod; - type Moment = u64; - type OnTimestampSet = (); - type WeightInfo = (); -} - -frame_support::parameter_types! { - pub const TransactionByteFee: u64 = 1; - pub const ChainId: u64 = 42; - pub const BlockGasLimit: U256 = U256::MAX; - pub const WeightPerGas: Weight = Weight::from_ref_time(20_000); -} - -impl pallet_evm::Config for TestRuntime { - type AddressMapping = IdentityAddressMapping; - type BlockGasLimit = BlockGasLimit; - type BlockHashMapping = pallet_evm::SubstrateBlockHashMapping; - type CallOrigin = pallet_evm::EnsureAddressRoot; - type ChainId = ChainId; - type Currency = Balances; - type FeeCalculator = (); - type FindAuthor = (); - type GasWeightMapping = pallet_evm::FixedGasWeightMapping; - type OnChargeTransaction = (); - type PrecompilesType = (); - type PrecompilesValue = (); - type Runner = pallet_evm::runner::stack::Runner; - type RuntimeEvent = RuntimeEvent; - type WeightPerGas = WeightPerGas; - type WithdrawOrigin = pallet_evm::EnsureAddressNever; -} - -impl darwinia_account_migration::Config for TestRuntime { - type Currency = Balances; - type RuntimeEvent = RuntimeEvent; -} - -frame_support::construct_runtime! { - pub enum TestRuntime where - Block = Block, - NodeBlock = Block, - UncheckedExtrinsic = UncheckedExtrinsic, - { - System: frame_system::{Pallet, Call, Config, Storage, Event}, - Timestamp: pallet_timestamp::{Pallet, Call, Storage}, - Balances: pallet_balances::{Pallet, Call, Storage, Config, Event}, - EVM: pallet_evm::{Pallet, Call, Storage, Config, Event}, - AccountMigration: darwinia_account_migration::{Pallet, Call, Storage, Config, Event}, - } -} - -#[derive(Default)] -pub(crate) struct ExtBuilder { - migrated_accounts: Vec<(AccountId32, Balance)>, - balances: Vec<(AccountId, Balance)>, -} - -impl ExtBuilder { - pub(crate) fn with_migrated_accounts(mut self, accounts: Vec<(AccountId32, Balance)>) -> Self { - self.migrated_accounts = accounts; - self - } - - pub(crate) fn with_balances(mut self, balances: Vec<(AccountId, Balance)>) -> Self { - self.balances = balances; - self - } - - pub(crate) fn build(self) -> sp_io::TestExternalities { - let t = GenesisConfig { - system: Default::default(), - balances: pallet_balances::GenesisConfig { balances: self.balances }, - evm: Default::default(), - account_migration: darwinia_account_migration::GenesisConfig { - migrated_accounts: self.migrated_accounts, - }, - } - .build_storage() - .unwrap(); - - let mut ext = sp_io::TestExternalities::new(t); - ext.execute_with(|| System::set_block_number(1)); - ext - } -} diff --git a/pallet/account-migration/src/test.rs b/pallet/account-migration/src/test.rs deleted file mode 100644 index d918c3053..000000000 --- a/pallet/account-migration/src/test.rs +++ /dev/null @@ -1,193 +0,0 @@ -// This file is part of Darwinia. -// -// Copyright (C) 2018-2022 Darwinia Network -// SPDX-License-Identifier: GPL-3.0 -// -// Darwinia is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// Darwinia 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 Darwinia. If not, see . - -// darwinia -use crate::{mock::*, ClaimMessage, Error}; -// substrate -use frame_support::{assert_err, assert_ok, unsigned::ValidateUnsigned}; -use sp_core::{blake2_256, Pair, H160}; -use sp_runtime::transaction_validity::{InvalidTransaction, TransactionValidityError}; - -#[test] -fn claim_to_new_account() { - let (pair, charlie) = SubAccounts::Charlie.to_pair(); - let alice: H160 = EthAccounts::Alice.into(); - - ExtBuilder::default() - .with_migrated_accounts(vec![(charlie.clone(), 1000)]) - .build() - .execute_with(|| { - let message = ClaimMessage::new(42, &charlie, &alice); - let sig = pair.sign(&blake2_256(&message.raw_bytes())[..]); - - assert_eq!(AccountMigration::balance_of(charlie.clone()), Some(1000)); - assert_eq!(Balances::free_balance(alice), 0); - assert_ok!(AccountMigration::claim_to( - RuntimeOrigin::none(), - 42, - charlie.clone(), - alice, - sig - )); - assert!(AccountMigration::balance_of(charlie).is_none()); - assert_eq!(Balances::free_balance(alice), 1000); - }); -} - -#[test] -fn claim_with_not_exist_old_pub_key() { - let (pair, charlie) = SubAccounts::Charlie.to_pair(); - let alice: H160 = EthAccounts::Alice.into(); - - ExtBuilder::default().build().execute_with(|| { - let message = ClaimMessage::new(42, &charlie, &alice); - let sig = pair.sign(&blake2_256(&message.raw_bytes())[..]); - - assert_err!( - AccountMigration::claim_to(RuntimeOrigin::none(), 42, charlie.clone(), alice, sig), - Error::::AccountNotExist - ); - }); -} - -#[test] -fn claim_to_existed_account() { - let (pair, bogus) = SubAccounts::Bogus.to_pair(); - let bob: H160 = EthAccounts::Bob.into(); - - ExtBuilder::default() - .with_migrated_accounts(vec![(bogus.clone(), 1000)]) - .with_balances(vec![(bob, 500)]) - .build() - .execute_with(|| { - let message = ClaimMessage::new(42, &bogus, &bob); - let sig = pair.sign(&blake2_256(&message.raw_bytes())[..]); - - assert_eq!(AccountMigration::balance_of(bogus.clone()), Some(1000)); - assert_eq!(Balances::free_balance(bob), 500); - assert_ok!(AccountMigration::claim_to( - RuntimeOrigin::none(), - 42, - bogus.clone(), - bob, - sig - )); - assert!(AccountMigration::balance_of(bogus).is_none()); - assert_eq!(Balances::free_balance(bob), 1000 + 500); - }); -} - -#[test] -fn claim_event() { - let (pair, charlie) = SubAccounts::Charlie.to_pair(); - let alice: H160 = EthAccounts::Alice.into(); - - ExtBuilder::default() - .with_migrated_accounts(vec![(charlie.clone(), 1000)]) - .build() - .execute_with(|| { - let message = ClaimMessage::new(42, &charlie, &alice); - let sig = pair.sign(&blake2_256(&message.raw_bytes())[..]); - - assert_ok!(AccountMigration::claim_to( - RuntimeOrigin::none(), - 42, - charlie.clone(), - alice, - sig - )); - System::assert_has_event(RuntimeEvent::AccountMigration(crate::Event::Claim { - old_pub_key: charlie, - new_pub_key: alice, - amount: 1000, - })) - }); -} - -#[test] -fn claim_pre_dispatch_with_invalid_chain_id() { - let (pair, charlie) = SubAccounts::Charlie.to_pair(); - let alice: H160 = EthAccounts::Alice.into(); - - ExtBuilder::default() - .with_migrated_accounts(vec![(charlie.clone(), 1000)]) - .build() - .execute_with(|| { - let message = ClaimMessage::new(42, &charlie, &alice); - let sig = pair.sign(&blake2_256(&message.raw_bytes())[..]); - - let call = crate::Call::claim_to { - chain_id: 43, // The correct chain id is 42 - old_pub_key: charlie.clone(), - new_pub_key: alice, - sig, - }; - assert_err!( - AccountMigration::pre_dispatch(&call), - TransactionValidityError::Invalid(InvalidTransaction::BadProof) - ); - }); -} - -#[test] -fn claim_pre_dispatch_with_invalid_old_pub_key() { - let (pair, charlie) = SubAccounts::Charlie.to_pair(); - let alice: H160 = EthAccounts::Alice.into(); - - ExtBuilder::default().with_migrated_accounts(vec![]).build().execute_with(|| { - let message = ClaimMessage::new(42, &charlie, &alice); - let sig = pair.sign(&blake2_256(&message.raw_bytes())[..]); - - let call = crate::Call::claim_to { - chain_id: 42, - old_pub_key: charlie.clone(), - new_pub_key: alice, - sig, - }; - assert_err!( - AccountMigration::pre_dispatch(&call), - TransactionValidityError::Invalid(InvalidTransaction::BadSigner) - ); - }); -} - -#[test] -fn claim_pre_dispatch_with_invalid_signature() { - let (_, charlie) = SubAccounts::Charlie.to_pair(); - let (bogus_pair, _) = SubAccounts::Bogus.to_pair(); - let alice: H160 = EthAccounts::Alice.into(); - - ExtBuilder::default() - .with_migrated_accounts(vec![(charlie.clone(), 1000)]) - .build() - .execute_with(|| { - let message = ClaimMessage::new(42, &charlie, &alice); - let sig = bogus_pair.sign(&blake2_256(&message.raw_bytes())[..]); - - let call = crate::Call::claim_to { - chain_id: 42, - old_pub_key: charlie.clone(), - new_pub_key: alice, - sig, - }; - assert_err!( - AccountMigration::pre_dispatch(&call), - TransactionValidityError::Invalid(InvalidTransaction::BadSigner) - ); - }); -} diff --git a/pallet/account-migration/src/tests.rs b/pallet/account-migration/src/tests.rs new file mode 100644 index 000000000..6ada6336c --- /dev/null +++ b/pallet/account-migration/src/tests.rs @@ -0,0 +1,56 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; +// substrate +use sp_keyring::sr25519::Keyring; + +#[test] +fn sr25519_signable_message_should_work() { + [b"Darwinia2".as_slice(), b"Crab2", b"Pangolin2"] + .iter() + .zip([ + [ + 81, 88, 182, 48, 229, 179, 23, 224, 117, 134, 146, 124, 106, 211, 130, 135, 68, + 191, 187, 224, 116, 219, 61, 45, 126, 38, 77, 144, 214, 132, 173, 77, + ], + [ + 253, 68, 12, 181, 246, 68, 61, 64, 106, 115, 48, 108, 235, 106, 2, 40, 115, 99, 84, + 46, 106, 132, 116, 241, 65, 214, 128, 8, 88, 85, 137, 86, + ], + [ + 227, 102, 33, 150, 94, 161, 161, 187, 83, 242, 232, 50, 184, 187, 169, 235, 148, + 146, 90, 88, 85, 45, 61, 24, 224, 10, 33, 182, 177, 57, 219, 61, + ], + ]) + .for_each(|(spec_name, message)| { + assert_eq!(sr25519_signable_message(spec_name, &Default::default()), message); + }); +} + +#[test] +fn verify_sr25519_signature_should_work() { + Keyring::iter().enumerate().for_each(|(i, from)| { + let to = [i as _; 20]; + let message = sr25519_signable_message(b"Darwinia2", &to.into()); + let signature = from.sign(&message); + + assert!(verify_sr25519_signature(&from.public().0.into(), &message, &signature)); + }); +} diff --git a/pallet/deposit/src/lib.rs b/pallet/deposit/src/lib.rs index 97babfa07..5b33dc871 100644 --- a/pallet/deposit/src/lib.rs +++ b/pallet/deposit/src/lib.rs @@ -18,6 +18,8 @@ //! # Darwinia deposit pallet //! +//! ## Overview +//! //! This is a completely specialized deposit pallet designed only for Darwinia parachain. //! So, this pallet will eliminate the generic parameters as much as possible. diff --git a/pallet/staking/src/lib.rs b/pallet/staking/src/lib.rs index 039c90602..f02a6a104 100644 --- a/pallet/staking/src/lib.rs +++ b/pallet/staking/src/lib.rs @@ -23,8 +23,6 @@ //! This is a completely specialized stake pallet designed only for Darwinia parachain. //! So, this pallet will eliminate the generic parameters as much as possible. //! -//! ## Overview -//! //! ### Acceptable stakes: //! - RING: Darwinia's native token //! - KTON: Darwinia's commitment token @@ -53,7 +51,9 @@ use frame_support::{ traits::{Currency, OnUnbalanced, UnixTime}, EqNoBound, PalletId, PartialEqNoBound, }; -use frame_system::{pallet_prelude::*, RawOrigin}; +use frame_system::pallet_prelude::*; +#[cfg(feature = "std")] +use frame_system::RawOrigin; use sp_runtime::{ traits::{AccountIdConversion, Convert}, Perbill, Perquintill, diff --git a/runtime/crab/src/pallets/migrate.rs b/runtime/crab/src/pallets/migrate.rs index 0b40e9110..2374bc4eb 100644 --- a/runtime/crab/src/pallets/migrate.rs +++ b/runtime/crab/src/pallets/migrate.rs @@ -20,6 +20,5 @@ use crate::*; impl darwinia_account_migration::Config for Runtime { - type Currency = Balances; type RuntimeEvent = RuntimeEvent; } diff --git a/runtime/darwinia/src/pallets/migrate.rs b/runtime/darwinia/src/pallets/migrate.rs index 0b40e9110..2374bc4eb 100644 --- a/runtime/darwinia/src/pallets/migrate.rs +++ b/runtime/darwinia/src/pallets/migrate.rs @@ -20,6 +20,5 @@ use crate::*; impl darwinia_account_migration::Config for Runtime { - type Currency = Balances; type RuntimeEvent = RuntimeEvent; } diff --git a/runtime/pangolin/src/pallets/migrate.rs b/runtime/pangolin/src/pallets/migrate.rs index 0b40e9110..2374bc4eb 100644 --- a/runtime/pangolin/src/pallets/migrate.rs +++ b/runtime/pangolin/src/pallets/migrate.rs @@ -20,6 +20,5 @@ use crate::*; impl darwinia_account_migration::Config for Runtime { - type Currency = Balances; type RuntimeEvent = RuntimeEvent; } diff --git a/tool/state-processor/src/main.rs b/tool/state-processor/src/main.rs index 2268700de..e19296def 100644 --- a/tool/state-processor/src/main.rs +++ b/tool/state-processor/src/main.rs @@ -182,10 +182,12 @@ where Ok(D::decode(&mut &*v)?) } +twox128(pallet) + twox128(item) + blake2_256_concat(item_key) fn get_blake2_128_concat_suffix(full_key: &str, item_key: &str) -> String { full_key.trim_start_matches(item_key).into() } +twox128(pallet) + twox128(item) + last 64 bytes #[allow(unused)] fn get_concat_suffix(full_key: &str, _: &str) -> String { format!("0x{}", &full_key[full_key.len() - 64..]) From 1da4e6c12d177eb0aec06d2004424f27902c7e9f Mon Sep 17 00:00:00 2001 From: bear Date: Thu, 8 Dec 2022 16:02:19 +0800 Subject: [PATCH 037/189] Add `staking` and `deposit` pre-compiles (#81) --- Cargo.lock | 43 +++++ precompile/assets/src/mock.rs | 110 +++-------- precompile/bls12-381/src/lib.rs | 3 +- precompile/deposit/Cargo.toml | 61 ++++++ precompile/deposit/src/lib.rs | 77 ++++++++ precompile/deposit/src/mock.rs | 215 +++++++++++++++++++++ precompile/deposit/src/tests.rs | 58 ++++++ precompile/staking/Cargo.toml | 66 +++++++ precompile/staking/src/lib.rs | 155 +++++++++++++++ precompile/staking/src/mock.rs | 272 +++++++++++++++++++++++++++ precompile/staking/src/tests.rs | 174 +++++++++++++++++ precompile/state-storage/src/mock.rs | 95 +++------- runtime/darwinia/Cargo.toml | 4 + runtime/darwinia/src/pallets/evm.rs | 8 +- 14 files changed, 1184 insertions(+), 157 deletions(-) create mode 100644 precompile/deposit/Cargo.toml create mode 100644 precompile/deposit/src/lib.rs create mode 100644 precompile/deposit/src/mock.rs create mode 100644 precompile/deposit/src/tests.rs create mode 100644 precompile/staking/Cargo.toml create mode 100644 precompile/staking/src/lib.rs create mode 100644 precompile/staking/src/mock.rs create mode 100644 precompile/staking/src/tests.rs diff --git a/Cargo.lock b/Cargo.lock index 978177a7b..2c24a41c3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2412,6 +2412,47 @@ dependencies = [ "sp-std", ] +[[package]] +name = "darwinia-precompile-deposit" +version = "6.0.0" +dependencies = [ + "darwinia-deposit", + "fp-evm", + "frame-support", + "frame-system", + "pallet-balances", + "pallet-evm", + "pallet-timestamp", + "parity-scale-codec", + "precompile-utils", + "scale-info", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "darwinia-precompile-staking" +version = "6.0.0" +dependencies = [ + "darwinia-deposit", + "darwinia-staking", + "fp-evm", + "frame-support", + "frame-system", + "pallet-balances", + "pallet-evm", + "pallet-timestamp", + "parity-scale-codec", + "precompile-utils", + "scale-info", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", +] + [[package]] name = "darwinia-precompile-state-storage" version = "6.0.0" @@ -2456,6 +2497,8 @@ dependencies = [ "darwinia-message-transact", "darwinia-precompile-assets", "darwinia-precompile-bls12-381", + "darwinia-precompile-deposit", + "darwinia-precompile-staking", "darwinia-precompile-state-storage", "darwinia-staking", "dc-primitives", diff --git a/precompile/assets/src/mock.rs b/precompile/assets/src/mock.rs index bece04086..2eceda295 100644 --- a/precompile/assets/src/mock.rs +++ b/precompile/assets/src/mock.rs @@ -16,69 +16,38 @@ // You should have received a copy of the GNU General Public License // along with Darwinia. If not, see . -//! Test utilities - // crates.io use codec::{Decode, Encode, MaxEncodedLen}; // frontier use fp_evm::{Precompile, PrecompileSet}; -use pallet_evm::IdentityAddressMapping; // parity -use frame_support::{ - pallet_prelude::Weight, - traits::{ConstU32, Everything}, -}; -use frame_system::EnsureRoot; +use frame_support::pallet_prelude::Weight; use sp_core::{H160, H256, U256}; -use sp_runtime::{ - testing::Header, - traits::{BlakeTwo256, IdentityLookup}, -}; use sp_std::{marker::PhantomData, prelude::*}; // darwinia use crate::*; -pub type Block = frame_system::mocking::MockBlock; pub type Balance = u128; pub type AssetId = u64; +pub type InternalCall = ERC20AssetsCall; pub type AccountId = H160; -pub type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; pub const TEST_ID: AssetId = 1026; -#[derive( - Eq, - PartialEq, - Ord, - PartialOrd, - Clone, - Encode, - Decode, - Debug, - MaxEncodedLen, - scale_info::TypeInfo, -)] +#[derive(Clone, Encode, Decode, Debug, MaxEncodedLen, scale_info::TypeInfo)] pub enum Account { Alice, Bob, Charlie, - Bogus, Precompile, } -impl Default for Account { - fn default() -> Self { - Self::Bogus - } -} - impl Into for Account { fn into(self) -> H160 { match self { Account::Alice => H160::repeat_byte(0xAA), Account::Bob => H160::repeat_byte(0xBB), Account::Charlie => H160::repeat_byte(0xCC), - Account::Bogus => H160::repeat_byte(0xDD), Account::Precompile => H160::from_low_u64_be(TEST_ID), } } @@ -91,24 +60,21 @@ impl From for H256 { } } -frame_support::parameter_types! { - pub const BlockHashCount: u64 = 250; -} impl frame_system::Config for TestRuntime { type AccountData = pallet_balances::AccountData; type AccountId = AccountId; - type BaseCallFilter = Everything; + type BaseCallFilter = frame_support::traits::Everything; type BlockHashCount = (); type BlockLength = (); type BlockNumber = u64; type BlockWeights = (); type DbWeight = (); type Hash = H256; - type Hashing = BlakeTwo256; - type Header = Header; + type Hashing = sp_runtime::traits::BlakeTwo256; + type Header = sp_runtime::testing::Header; type Index = u64; - type Lookup = IdentityLookup; - type MaxConsumers = ConstU32<16>; + type Lookup = sp_runtime::traits::IdentityLookup; + type MaxConsumers = frame_support::traits::ConstU32<16>; type OnKilledAccount = (); type OnNewAccount = (); type OnSetCode = (); @@ -121,27 +87,20 @@ impl frame_system::Config for TestRuntime { type Version = (); } -frame_support::parameter_types! { - pub const MaxLocks: u32 = 10; - pub const ExistentialDeposit: u64 = 0; -} impl pallet_balances::Config for TestRuntime { type AccountStore = System; type Balance = Balance; type DustRemoval = (); - type ExistentialDeposit = ExistentialDeposit; - type MaxLocks = MaxLocks; + type ExistentialDeposit = frame_support::traits::ConstU128<0>; + type MaxLocks = (); type MaxReserves = (); type ReserveIdentifier = [u8; 8]; type RuntimeEvent = RuntimeEvent; type WeightInfo = (); } -frame_support::parameter_types! { - pub const MinimumPeriod: u64 = 6000 / 2; -} impl pallet_timestamp::Config for TestRuntime { - type MinimumPeriod = MinimumPeriod; + type MinimumPeriod = (); type Moment = u64; type OnTimestampSet = (); type WeightInfo = (); @@ -189,21 +148,17 @@ impl AccountToAssetId for AssetIdConverter { } frame_support::parameter_types! { - pub const TransactionByteFee: u64 = 1; - pub const ChainId: u64 = 42; pub const BlockGasLimit: U256 = U256::MAX; pub const WeightPerGas: Weight = Weight::from_ref_time(20_000); pub PrecompilesValue: TestPrecompiles = TestPrecompiles::<_>::new(); } -pub type InternalCall = ERC20AssetsCall; - impl pallet_evm::Config for TestRuntime { - type AddressMapping = IdentityAddressMapping; + type AddressMapping = pallet_evm::IdentityAddressMapping; type BlockGasLimit = BlockGasLimit; type BlockHashMapping = pallet_evm::SubstrateBlockHashMapping; type CallOrigin = pallet_evm::EnsureAddressRoot; - type ChainId = ChainId; + type ChainId = frame_support::traits::ConstU64<42>; type Currency = Balances; type FeeCalculator = (); type FindAuthor = (); @@ -217,43 +172,34 @@ impl pallet_evm::Config for TestRuntime { type WithdrawOrigin = pallet_evm::EnsureAddressNever; } -frame_support::parameter_types! { - pub const AssetDeposit: Balance = 0; - pub const ApprovalDeposit: Balance = 0; - pub const AssetsStringLimit: u32 = 50; - pub const MetadataDepositBase: Balance = 0; - pub const MetadataDepositPerByte: Balance = 0; - pub const AssetAccountDeposit: Balance = 0; -} - impl pallet_assets::Config for TestRuntime { - type ApprovalDeposit = ApprovalDeposit; - type AssetAccountDeposit = AssetAccountDeposit; - type AssetDeposit = AssetDeposit; + type ApprovalDeposit = (); + type AssetAccountDeposit = (); + type AssetDeposit = (); type AssetId = AssetId; type Balance = Balance; type Currency = Balances; type Extra = (); - type ForceOrigin = EnsureRoot; + type ForceOrigin = frame_system::EnsureRoot; type Freezer = (); - type MetadataDepositBase = MetadataDepositBase; - type MetadataDepositPerByte = MetadataDepositPerByte; + type MetadataDepositBase = (); + type MetadataDepositPerByte = (); type RuntimeEvent = RuntimeEvent; - type StringLimit = AssetsStringLimit; + type StringLimit = frame_support::traits::ConstU32<50>; type WeightInfo = (); } frame_support::construct_runtime! { pub enum TestRuntime where - Block = Block, - NodeBlock = Block, - UncheckedExtrinsic = UncheckedExtrinsic, + Block = frame_system::mocking::MockBlock, + NodeBlock = frame_system::mocking::MockBlock, + UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic, { - System: frame_system::{Pallet, Call, Config, Storage, Event}, - Timestamp: pallet_timestamp::{Pallet, Call, Storage}, - Balances: pallet_balances::{Pallet, Call, Storage, Config, Event}, - EVM: pallet_evm::{Pallet, Call, Storage, Config, Event}, - Assets: pallet_assets::{Pallet, Call, Storage, Event} + System: frame_system, + Timestamp: pallet_timestamp, + Balances: pallet_balances, + EVM: pallet_evm, + Assets: pallet_assets } } diff --git a/precompile/bls12-381/src/lib.rs b/precompile/bls12-381/src/lib.rs index 79eebe79e..8ac02bbe4 100644 --- a/precompile/bls12-381/src/lib.rs +++ b/precompile/bls12-381/src/lib.rs @@ -18,7 +18,7 @@ #![cfg_attr(not(feature = "std"), no_std)] -// std +// core use core::marker::PhantomData; // crates.io use milagro_bls::{AggregatePublicKey, AggregateSignature, PublicKey, Signature}; @@ -28,7 +28,6 @@ use precompile_utils::prelude::*; use sp_std::vec::Vec; pub(crate) const VERIFY_ESTIMATED_COST: u64 = 100_000; - pub struct BLS12381(PhantomData); #[precompile_utils::precompile] diff --git a/precompile/deposit/Cargo.toml b/precompile/deposit/Cargo.toml new file mode 100644 index 000000000..a60c174c3 --- /dev/null +++ b/precompile/deposit/Cargo.toml @@ -0,0 +1,61 @@ +[package] +authors = ["Darwinia Network "] +description = "State storage precompiles for EVM pallet." +edition = "2021" +homepage = "https://darwinia.network" +license = "GPL-3.0" +name = "darwinia-precompile-deposit" +readme = "README.md" +repository = "https://github.com/darwinia-network/darwinia" +version = "6.0.0" + +[dependencies] +# frontier +fp-evm = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +pallet-evm = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } + +# darwinia +darwinia-deposit = { default-features = false, path = "../../pallet/deposit"} + +# moonbeam +precompile-utils = { default-features = false, git = "https://github.com/darwinia-network/moonbeam.git", branch = "polkadot-v0.9.30" } + +# substrate +frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } + +[dev-dependencies] +# crates.io +codec = { package = "parity-scale-codec", version = "3.2" } +scale-info = { version = "2.3", features = ["derive"] } + +# moonbeam +precompile-utils = { git = "https://github.com/darwinia-network/moonbeam.git", branch = "polkadot-v0.9.30", features = ["testing"] } + +# substrate +pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } + +[features] +default = ["std"] +std = [ + # frontier + "fp-evm/std", + "pallet-evm/std", + + # darwinia + "darwinia-deposit/std", + + # moonbeam + "precompile-utils/std", + + # substrate + "frame-support/std", + "frame-system/std", + "sp-core/std", + "sp-std/std", +] diff --git a/precompile/deposit/src/lib.rs b/precompile/deposit/src/lib.rs new file mode 100644 index 000000000..bb7846b1a --- /dev/null +++ b/precompile/deposit/src/lib.rs @@ -0,0 +1,77 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +#![cfg_attr(not(feature = "std"), no_std)] + +#[cfg(test)] +mod mock; +#[cfg(test)] +mod tests; + +// core +use core::marker::PhantomData; +// moonbeam +use precompile_utils::prelude::*; +// substrate +use frame_support::{ + dispatch::{Dispatchable, GetDispatchInfo, PostDispatchInfo}, + traits::OriginTrait, +}; +use sp_core::{H160, U256}; + +/// AccountId of the runtime. +type AccountIdOf = ::AccountId; + +pub struct Deposit(PhantomData); + +#[precompile_utils::precompile] +impl Deposit +where + Runtime: darwinia_deposit::Config + pallet_evm::Config, + Runtime::RuntimeCall: Dispatchable + GetDispatchInfo, + Runtime::RuntimeCall: From>, + <::RuntimeCall as Dispatchable>::RuntimeOrigin: OriginTrait, + ::RuntimeOrigin: From>, + AccountIdOf: From, +{ + #[precompile::public("lock(uint256,uint8)")] + fn lock(handle: &mut impl PrecompileHandle, amount: U256, months: u8) -> EvmResult { + let origin: AccountIdOf = handle.context().caller.into(); + + RuntimeHelper::::try_dispatch( + handle, + Some(origin).into(), + darwinia_deposit::Call::::lock { amount: amount.as_u128(), months }, + )?; + + Ok(true) + } + + #[precompile::public("claim()")] + fn claim(handle: &mut impl PrecompileHandle) -> EvmResult { + let origin: AccountIdOf = handle.context().caller.into(); + + RuntimeHelper::::try_dispatch( + handle, + Some(origin).into(), + darwinia_deposit::Call::::claim {}, + )?; + + Ok(true) + } +} diff --git a/precompile/deposit/src/mock.rs b/precompile/deposit/src/mock.rs new file mode 100644 index 000000000..be699ad57 --- /dev/null +++ b/precompile/deposit/src/mock.rs @@ -0,0 +1,215 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// crates.io +use codec::{Decode, Encode, MaxEncodedLen}; +// darwinia +use crate::*; +// frontier +use fp_evm::{Precompile, PrecompileSet}; +// substrate +use frame_support::pallet_prelude::Weight; +use sp_core::{ConstU32, H160, H256, U256}; + +pub(crate) type Balance = u128; +pub(crate) type AccountId = H160; +pub(crate) type PCall = DepositCall; + +#[derive(Clone, Encode, Decode, Debug, MaxEncodedLen, scale_info::TypeInfo)] +pub enum Account { + Alice, + Bob, + Precompile, +} + +impl Into for Account { + fn into(self) -> H160 { + match self { + Account::Alice => H160::repeat_byte(0xAA), + Account::Bob => H160::repeat_byte(0xBB), + Account::Precompile => H160::from_low_u64_be(1), + } + } +} + +impl frame_system::Config for TestRuntime { + type AccountData = pallet_balances::AccountData; + type AccountId = AccountId; + type BaseCallFilter = frame_support::traits::Everything; + type BlockHashCount = (); + type BlockLength = (); + type BlockNumber = u64; + type BlockWeights = (); + type DbWeight = (); + type Hash = H256; + type Hashing = sp_runtime::traits::BlakeTwo256; + type Header = sp_runtime::testing::Header; + type Index = u64; + type Lookup = sp_runtime::traits::IdentityLookup; + type MaxConsumers = ConstU32<16>; + type OnKilledAccount = (); + type OnNewAccount = (); + type OnSetCode = (); + type PalletInfo = PalletInfo; + type RuntimeCall = RuntimeCall; + type RuntimeEvent = RuntimeEvent; + type RuntimeOrigin = RuntimeOrigin; + type SS58Prefix = (); + type SystemWeightInfo = (); + type Version = (); +} + +impl pallet_balances::Config for TestRuntime { + type AccountStore = System; + type Balance = Balance; + type DustRemoval = (); + type ExistentialDeposit = frame_support::traits::ConstU128<0>; + type MaxLocks = (); + type MaxReserves = (); + type ReserveIdentifier = [u8; 8]; + type RuntimeEvent = RuntimeEvent; + type WeightInfo = (); +} + +impl pallet_timestamp::Config for TestRuntime { + type MinimumPeriod = (); + type Moment = u128; + type OnTimestampSet = (); + type WeightInfo = (); +} + +pub enum KtonMinting {} +impl darwinia_deposit::Minting for KtonMinting { + type AccountId = AccountId; + + fn mint(_beneficiary: &Self::AccountId, _amount: Balance) -> sp_runtime::DispatchResult { + Ok(()) + } +} + +impl darwinia_deposit::Config for TestRuntime { + type Kton = KtonMinting; + type MaxDeposits = frame_support::traits::ConstU32<16>; + type MinLockingAmount = frame_support::traits::ConstU128<100>; + type Ring = Balances; + type RuntimeEvent = RuntimeEvent; + type UnixTime = Timestamp; +} + +pub struct TestPrecompiles(PhantomData); +impl TestPrecompiles +where + R: pallet_evm::Config, +{ + pub fn new() -> Self { + Self(Default::default()) + } + + pub fn used_addresses() -> [H160; 1] { + [addr(1)] + } +} +impl PrecompileSet for TestPrecompiles +where + crate::Deposit: Precompile, + R: pallet_evm::Config, +{ + fn execute(&self, handle: &mut impl PrecompileHandle) -> Option> { + match handle.code_address() { + a if a == addr(1) => Some(crate::Deposit::::execute(handle)), + _ => None, + } + } + + fn is_precompile(&self, address: H160) -> bool { + Self::used_addresses().contains(&address) + } +} +fn addr(a: u64) -> H160 { + H160::from_low_u64_be(a) +} + +frame_support::parameter_types! { + pub const BlockGasLimit: U256 = U256::MAX; + pub const WeightPerGas: Weight = Weight::from_ref_time(20_000); + pub PrecompilesValue: TestPrecompiles = TestPrecompiles::<_>::new(); +} + +impl pallet_evm::Config for TestRuntime { + type AddressMapping = pallet_evm::IdentityAddressMapping; + type BlockGasLimit = BlockGasLimit; + type BlockHashMapping = pallet_evm::SubstrateBlockHashMapping; + type CallOrigin = pallet_evm::EnsureAddressRoot; + type ChainId = frame_support::traits::ConstU64<42>; + type Currency = Balances; + type FeeCalculator = (); + type FindAuthor = (); + type GasWeightMapping = pallet_evm::FixedGasWeightMapping; + type OnChargeTransaction = (); + type PrecompilesType = TestPrecompiles; + type PrecompilesValue = PrecompilesValue; + type Runner = pallet_evm::runner::stack::Runner; + type RuntimeEvent = RuntimeEvent; + type WeightPerGas = WeightPerGas; + type WithdrawOrigin = pallet_evm::EnsureAddressNever; +} + +frame_support::construct_runtime!( + pub enum TestRuntime where + Block = frame_system::mocking::MockBlock, + NodeBlock = frame_system::mocking::MockBlock, + UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic, + { + System: frame_system, + Balances: pallet_balances, + Timestamp: pallet_timestamp, + Deposit: darwinia_deposit, + EVM: pallet_evm, + } +); + +pub fn efflux(milli_secs: u128) { + Timestamp::set_timestamp(Timestamp::now() + milli_secs); +} + +#[derive(Default)] +pub(crate) struct ExtBuilder { + // endowed accounts with balances + balances: Vec<(AccountId, Balance)>, +} + +impl ExtBuilder { + pub(crate) fn with_balances(mut self, balances: Vec<(AccountId, Balance)>) -> Self { + self.balances = balances; + self + } + + pub(crate) fn build(self) -> sp_io::TestExternalities { + let mut t = frame_system::GenesisConfig::default() + .build_storage::() + .expect("Frame system builds valid default genesis config"); + + pallet_balances::GenesisConfig:: { balances: self.balances } + .assimilate_storage(&mut t) + .expect("Pallet balances storage can be assimilated"); + + let mut ext = sp_io::TestExternalities::new(t); + ext.execute_with(|| System::set_block_number(1)); + ext + } +} diff --git a/precompile/deposit/src/tests.rs b/precompile/deposit/src/tests.rs new file mode 100644 index 000000000..a3aa84119 --- /dev/null +++ b/precompile/deposit/src/tests.rs @@ -0,0 +1,58 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::mock::{ + efflux, + Account::{Alice, Precompile}, + Deposit, ExtBuilder, PCall, PrecompilesValue, TestPrecompiles, TestRuntime, +}; +use darwinia_deposit::MILLISECS_PER_MONTH; +// moonbeam +use precompile_utils::{testing::PrecompileTesterExt, EvmDataWriter}; +// substrate +use sp_core::H160; + +fn precompiles() -> TestPrecompiles { + PrecompilesValue::get() +} + +#[test] +fn selectors() { + assert!(PCall::lock_selectors().contains(&0x998e4242)); + assert!(PCall::claim_selectors().contains(&0x4e71d92d)); +} + +#[test] +fn lock_and_claim() { + let alice: H160 = Alice.into(); + ExtBuilder::default().with_balances(vec![(alice, 300)]).build().execute_with(|| { + // lock + precompiles() + .prepare_test(alice, Precompile, PCall::lock { amount: 200.into(), months: 1 }) + .execute_returns(EvmDataWriter::new().write(true).build()); + assert!(Deposit::deposit_of(&alice).is_some()); + + // claim + efflux(MILLISECS_PER_MONTH); + precompiles() + .prepare_test(alice, Precompile, PCall::claim {}) + .execute_returns(EvmDataWriter::new().write(true).build()); + assert!(Deposit::deposit_of(&alice).is_none()); + }); +} diff --git a/precompile/staking/Cargo.toml b/precompile/staking/Cargo.toml new file mode 100644 index 000000000..bec082f49 --- /dev/null +++ b/precompile/staking/Cargo.toml @@ -0,0 +1,66 @@ +[package] +authors = ["Darwinia Network "] +description = "State storage precompiles for EVM pallet." +edition = "2021" +homepage = "https://darwinia.network" +license = "GPL-3.0" +name = "darwinia-precompile-staking" +readme = "README.md" +repository = "https://github.com/darwinia-network/darwinia" +version = "6.0.0" + +[dependencies] +# frontier +fp-evm = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +pallet-evm = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } + +# darwinia +darwinia-staking = { default-features = false, path = "../../pallet/staking"} +darwinia-deposit = { default-features = false, path = "../../pallet/deposit"} + +# moonbeam +precompile-utils = { default-features = false, git = "https://github.com/darwinia-network/moonbeam.git", branch = "polkadot-v0.9.30" } + +# substrate +frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } + +[dev-dependencies] +# crates.io +codec = { package = "parity-scale-codec", version = "3.2" } +scale-info = { version = "2.3", features = ["derive"] } + +# moonbeam +precompile-utils = { git = "https://github.com/darwinia-network/moonbeam.git", branch = "polkadot-v0.9.30", features = ["testing"] } + +# substrate +frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } + + +[features] +default = ["std"] +std = [ + # frontier + "fp-evm/std", + "pallet-evm/std", + + # darwinia + "darwinia-staking/std", + "darwinia-deposit/std", + + # moonbeam + "precompile-utils/std", + + # substrate + "frame-support/std", + "frame-system/std", + "sp-core/std", + "sp-runtime/std", + "sp-std/std", +] diff --git a/precompile/staking/src/lib.rs b/precompile/staking/src/lib.rs new file mode 100644 index 000000000..6319054f9 --- /dev/null +++ b/precompile/staking/src/lib.rs @@ -0,0 +1,155 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +#![cfg_attr(not(feature = "std"), no_std)] + +#[cfg(test)] +mod mock; +#[cfg(test)] +mod tests; + +// std +use core::marker::PhantomData; +// darwinia +use darwinia_deposit::DepositId; +use darwinia_staking::Stake; +// moonbeam +use precompile_utils::prelude::*; +// substrate +use frame_support::{ + dispatch::{Dispatchable, GetDispatchInfo, PostDispatchInfo}, + traits::OriginTrait, +}; +use sp_core::{H160, U256}; +use sp_runtime::Perbill; +use sp_std::vec::Vec; + +/// AccountId of the runtime. +type AccountIdOf = ::AccountId; + +/// DepositId of the runtime. +type DepositIdOf = <::Deposit as Stake>::Item; + +pub struct Staking(PhantomData); + +#[precompile_utils::precompile] +impl Staking +where + Runtime: darwinia_staking::Config + pallet_evm::Config, + Runtime::RuntimeCall: Dispatchable + GetDispatchInfo, + Runtime::RuntimeCall: From>, + <::RuntimeCall as Dispatchable>::RuntimeOrigin: OriginTrait, + ::RuntimeOrigin: From>, + AccountIdOf: From, + DepositIdOf: From, +{ + #[precompile::public("stake(uint256,uint256,uint8[])")] + fn stake( + handle: &mut impl PrecompileHandle, + ring_amount: U256, + kton_amount: U256, + deposits: Vec, + ) -> EvmResult { + let origin: AccountIdOf = handle.context().caller.into(); + let deposits: Vec> = deposits.into_iter().map(|i| i.into()).collect(); + + RuntimeHelper::::try_dispatch( + handle, + Some(origin).into(), + darwinia_staking::Call::::stake { + ring_amount: ring_amount.as_u128(), + kton_amount: kton_amount.as_u128(), + deposits, + }, + )?; + Ok(true) + } + + #[precompile::public("unstake(uint256,uint256,uint8[])")] + fn unstake( + handle: &mut impl PrecompileHandle, + ring_amount: U256, + kton_amount: U256, + deposits: Vec, + ) -> EvmResult { + let origin: AccountIdOf = handle.context().caller.into(); + let deposits: Vec> = deposits.into_iter().map(|i| i.into()).collect(); + + RuntimeHelper::::try_dispatch( + handle, + Some(origin).into(), + darwinia_staking::Call::::unstake { + ring_amount: ring_amount.as_u128(), + kton_amount: kton_amount.as_u128(), + deposits, + }, + )?; + Ok(true) + } + + #[precompile::public("claim()")] + fn claim(handle: &mut impl PrecompileHandle) -> EvmResult { + let origin: AccountIdOf = handle.context().caller.into(); + + RuntimeHelper::::try_dispatch( + handle, + Some(origin).into(), + darwinia_staking::Call::::claim {}, + )?; + Ok(true) + } + + #[precompile::public("collect(uint32)")] + fn collect(handle: &mut impl PrecompileHandle, commission: u32) -> EvmResult { + let origin: AccountIdOf = handle.context().caller.into(); + + RuntimeHelper::::try_dispatch( + handle, + Some(origin).into(), + darwinia_staking::Call::::collect { + commission: Perbill::from_percent(commission), + }, + )?; + Ok(true) + } + + #[precompile::public("nominate(address)")] + fn nominate(handle: &mut impl PrecompileHandle, target: Address) -> EvmResult { + let target: H160 = target.into(); + let origin: AccountIdOf = handle.context().caller.into(); + + RuntimeHelper::::try_dispatch( + handle, + Some(origin).into(), + darwinia_staking::Call::::nominate { target: target.into() }, + )?; + Ok(true) + } + + #[precompile::public("chill()")] + fn chill(handle: &mut impl PrecompileHandle) -> EvmResult { + let origin: AccountIdOf = handle.context().caller.into(); + + RuntimeHelper::::try_dispatch( + handle, + Some(origin).into(), + darwinia_staking::Call::::chill {}, + )?; + Ok(true) + } +} diff --git a/precompile/staking/src/mock.rs b/precompile/staking/src/mock.rs new file mode 100644 index 000000000..d7ad75908 --- /dev/null +++ b/precompile/staking/src/mock.rs @@ -0,0 +1,272 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// crates.io +use codec::{Decode, Encode, MaxEncodedLen}; +// darwinia +use crate::*; +// frontier +use fp_evm::{Precompile, PrecompileSet}; +// substrate +use frame_support::pallet_prelude::Weight; +use sp_core::{ConstU32, H160, H256, U256}; + +pub(crate) type Balance = u128; +pub(crate) type AccountId = H160; + +#[derive(Clone, Encode, Decode, Debug, MaxEncodedLen, scale_info::TypeInfo)] +pub enum Account { + Alice, + Bob, + Precompile, +} + +impl Into for Account { + fn into(self) -> H160 { + match self { + Account::Alice => H160::repeat_byte(0xAA), + Account::Bob => H160::repeat_byte(0xBB), + Account::Precompile => H160::from_low_u64_be(1), + } + } +} + +frame_support::parameter_types! { + pub const BlockHashCount: u64 = 250; +} +impl frame_system::Config for TestRuntime { + type AccountData = pallet_balances::AccountData; + type AccountId = AccountId; + type BaseCallFilter = frame_support::traits::Everything; + type BlockHashCount = (); + type BlockLength = (); + type BlockNumber = u64; + type BlockWeights = (); + type DbWeight = (); + type Hash = H256; + type Hashing = sp_runtime::traits::BlakeTwo256; + type Header = sp_runtime::testing::Header; + type Index = u64; + type Lookup = sp_runtime::traits::IdentityLookup; + type MaxConsumers = ConstU32<16>; + type OnKilledAccount = (); + type OnNewAccount = (); + type OnSetCode = (); + type PalletInfo = PalletInfo; + type RuntimeCall = RuntimeCall; + type RuntimeEvent = RuntimeEvent; + type RuntimeOrigin = RuntimeOrigin; + type SS58Prefix = (); + type SystemWeightInfo = (); + type Version = (); +} + +impl pallet_balances::Config for TestRuntime { + type AccountStore = System; + type Balance = Balance; + type DustRemoval = (); + type ExistentialDeposit = frame_support::traits::ConstU128<0>; + type MaxLocks = (); + type MaxReserves = (); + type ReserveIdentifier = [u8; 8]; + type RuntimeEvent = RuntimeEvent; + type WeightInfo = (); +} + +impl pallet_timestamp::Config for TestRuntime { + type MinimumPeriod = (); + type Moment = u128; + type OnTimestampSet = (); + type WeightInfo = (); +} + +pub enum KtonMinting {} +impl darwinia_deposit::Minting for KtonMinting { + type AccountId = AccountId; + + fn mint(_beneficiary: &Self::AccountId, _amount: Balance) -> sp_runtime::DispatchResult { + Ok(()) + } +} + +impl darwinia_deposit::Config for TestRuntime { + type Kton = KtonMinting; + type MaxDeposits = frame_support::traits::ConstU32<16>; + type MinLockingAmount = frame_support::traits::ConstU128<100>; + type Ring = Balances; + type RuntimeEvent = RuntimeEvent; + type UnixTime = Timestamp; +} + +pub struct TestPrecompiles(PhantomData); +impl TestPrecompiles +where + R: pallet_evm::Config, +{ + pub fn new() -> Self { + Self(Default::default()) + } + + pub fn used_addresses() -> [H160; 1] { + [addr(1)] + } +} +impl PrecompileSet for TestPrecompiles +where + crate::Staking: Precompile, + R: pallet_evm::Config, +{ + fn execute(&self, handle: &mut impl PrecompileHandle) -> Option> { + match handle.code_address() { + a if a == addr(1) => Some(crate::Staking::::execute(handle)), + _ => None, + } + } + + fn is_precompile(&self, address: H160) -> bool { + Self::used_addresses().contains(&address) + } +} +fn addr(a: u64) -> H160 { + H160::from_low_u64_be(a) +} + +pub type PCall = StakingCall; + +frame_support::parameter_types! { + pub const BlockGasLimit: U256 = U256::MAX; + pub const WeightPerGas: Weight = Weight::from_ref_time(20_000); + pub PrecompilesValue: TestPrecompiles = TestPrecompiles::<_>::new(); +} + +impl pallet_evm::Config for TestRuntime { + type AddressMapping = pallet_evm::IdentityAddressMapping; + type BlockGasLimit = BlockGasLimit; + type BlockHashMapping = pallet_evm::SubstrateBlockHashMapping; + type CallOrigin = pallet_evm::EnsureAddressRoot; + type ChainId = frame_support::traits::ConstU64<42>; + type Currency = Balances; + type FeeCalculator = (); + type FindAuthor = (); + type GasWeightMapping = pallet_evm::FixedGasWeightMapping; + type OnChargeTransaction = (); + type PrecompilesType = TestPrecompiles; + type PrecompilesValue = PrecompilesValue; + type Runner = pallet_evm::runner::stack::Runner; + type RuntimeEvent = RuntimeEvent; + type WeightPerGas = WeightPerGas; + type WithdrawOrigin = pallet_evm::EnsureAddressNever; +} + +frame_support::parameter_types! { + pub const PayoutFraction: sp_runtime::Perbill = sp_runtime::Perbill::from_percent(20); +} + +pub enum RingStaking {} +impl darwinia_staking::Stake for RingStaking { + type AccountId = AccountId; + type Item = Balance; + + fn stake(who: &Self::AccountId, item: Self::Item) -> sp_runtime::DispatchResult { + >::transfer( + who, + &darwinia_staking::account_id(), + item, + frame_support::traits::ExistenceRequirement::KeepAlive, + ) + } + + fn unstake(who: &Self::AccountId, item: Self::Item) -> sp_runtime::DispatchResult { + >::transfer( + &darwinia_staking::account_id(), + who, + item, + frame_support::traits::ExistenceRequirement::AllowDeath, + ) + } +} + +pub enum KtonStaking {} +impl darwinia_staking::Stake for KtonStaking { + type AccountId = AccountId; + type Item = Balance; + + fn stake(_who: &Self::AccountId, _item: Self::Item) -> sp_runtime::DispatchResult { + Ok(()) + } + + fn unstake(_who: &Self::AccountId, _item: Self::Item) -> sp_runtime::DispatchResult { + Ok(()) + } +} + +impl darwinia_staking::Config for TestRuntime { + type Deposit = Deposit; + type Kton = KtonStaking; + type MaxDeposits = frame_support::traits::ConstU32<16>; + type MaxUnstakings = frame_support::traits::ConstU32<16>; + type MinStakingDuration = frame_support::traits::ConstU64<3>; + type PayoutFraction = PayoutFraction; + type RewardRemainder = (); + type Ring = RingStaking; + type RingCurrency = Balances; + type RuntimeEvent = RuntimeEvent; + type UnixTime = Timestamp; +} + +frame_support::construct_runtime!( + pub enum TestRuntime where + Block = frame_system::mocking::MockBlock, + NodeBlock = frame_system::mocking::MockBlock, + UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic, + { + System: frame_system, + Balances: pallet_balances, + Timestamp: pallet_timestamp, + Deposit: darwinia_deposit, + EVM: pallet_evm, + Staking: darwinia_staking, + } +); + +#[derive(Default)] +pub(crate) struct ExtBuilder { + // endowed accounts with balances + balances: Vec<(AccountId, Balance)>, +} + +impl ExtBuilder { + pub(crate) fn with_balances(mut self, balances: Vec<(AccountId, Balance)>) -> Self { + self.balances = balances; + self + } + + pub(crate) fn build(self) -> sp_io::TestExternalities { + let mut t = frame_system::GenesisConfig::default() + .build_storage::() + .expect("Frame system builds valid default genesis config"); + + pallet_balances::GenesisConfig:: { balances: self.balances } + .assimilate_storage(&mut t) + .expect("Pallet balances storage can be assimilated"); + + let mut ext = sp_io::TestExternalities::new(t); + ext.execute_with(|| System::set_block_number(1)); + ext + } +} diff --git a/precompile/staking/src/tests.rs b/precompile/staking/src/tests.rs new file mode 100644 index 000000000..65cebb7ac --- /dev/null +++ b/precompile/staking/src/tests.rs @@ -0,0 +1,174 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::mock::{ + Account::{Alice, Bob, Precompile}, + ExtBuilder, PCall, PrecompilesValue, Staking, System, TestPrecompiles, TestRuntime, +}; +use sp_runtime::Perbill; +// moonbeam +use precompile_utils::{testing::PrecompileTesterExt, EvmDataWriter}; +// substrate +use sp_core::{H160, U256}; + +fn precompiles() -> TestPrecompiles { + PrecompilesValue::get() +} + +#[test] +fn selectors() { + assert!(PCall::stake_selectors().contains(&0x757f9b3b)); + assert!(PCall::unstake_selectors().contains(&0xef20fcb3)); + assert!(PCall::claim_selectors().contains(&0x4e71d92d)); + assert!(PCall::nominate_selectors().contains(&0xb332180b)); + assert!(PCall::collect_selectors().contains(&0x10a66536)); + assert!(PCall::chill_selectors().contains(&0x2b8a3ae6)); +} + +#[test] +fn stake_and_unstake() { + let alice: H160 = Alice.into(); + ExtBuilder::default().with_balances(vec![(alice, 300)]).build().execute_with(|| { + // stake + precompiles() + .prepare_test( + alice, + Precompile, + PCall::stake { + ring_amount: 200.into(), + kton_amount: U256::zero(), + deposits: vec![], + }, + ) + .execute_returns(EvmDataWriter::new().write(true).build()); + assert_eq!(Staking::ledger_of(alice).unwrap().staked_ring, 200); + + // unstake + precompiles() + .prepare_test( + alice, + Precompile, + PCall::unstake { + ring_amount: 200.into(), + kton_amount: U256::zero(), + deposits: vec![], + }, + ) + .execute_returns(EvmDataWriter::new().write(true).build()); + assert_eq!(Staking::ledger_of(alice).unwrap().staked_ring, 0); + }); +} + +#[test] +fn claim() { + let alice: H160 = Alice.into(); + ExtBuilder::default().with_balances(vec![(alice, 300)]).build().execute_with(|| { + // stake + precompiles() + .prepare_test( + alice, + Precompile, + PCall::stake { + ring_amount: 200.into(), + kton_amount: U256::zero(), + deposits: vec![], + }, + ) + .execute_returns(EvmDataWriter::new().write(true).build()); + + // unstake + precompiles() + .prepare_test( + alice, + Precompile, + PCall::unstake { + ring_amount: 200.into(), + kton_amount: U256::zero(), + deposits: vec![], + }, + ) + .execute_returns(EvmDataWriter::new().write(true).build()); + + // You have to wait for MinStakingDuration to claim + System::set_block_number(5); + precompiles() + .prepare_test(alice, Precompile, PCall::claim {}) + .execute_returns(EvmDataWriter::new().write(true).build()); + assert!(Staking::ledger_of(alice).is_none()); + }); +} + +#[test] +fn nominate() { + let alice: H160 = Alice.into(); + let bob: H160 = Bob.into(); + ExtBuilder::default().with_balances(vec![(alice, 300), (bob, 300)]).build().execute_with( + || { + // alice stake first as collator + precompiles() + .prepare_test( + alice, + Precompile, + PCall::stake { + ring_amount: 200.into(), + kton_amount: U256::zero(), + deposits: vec![], + }, + ) + .execute_returns(EvmDataWriter::new().write(true).build()); + + // check the collator commission + precompiles() + .prepare_test(alice, Precompile, PCall::collect { commission: 30 }) + .execute_returns(EvmDataWriter::new().write(true).build()); + assert_eq!(Staking::collator_of(alice).unwrap(), Perbill::from_percent(30)); + + // bob stake as nominator + precompiles() + .prepare_test( + bob, + Precompile, + PCall::stake { + ring_amount: 200.into(), + kton_amount: U256::zero(), + deposits: vec![], + }, + ) + .execute_returns(EvmDataWriter::new().write(true).build()); + + // check nominate result + precompiles() + .prepare_test(bob, Precompile, PCall::nominate { target: alice.into() }) + .execute_returns(EvmDataWriter::new().write(true).build()); + assert_eq!(Staking::nominator_of(bob).unwrap(), alice); + + // check alice(collator) chill + precompiles() + .prepare_test(alice, Precompile, PCall::chill {}) + .execute_returns(EvmDataWriter::new().write(true).build()); + assert!(Staking::collator_of(alice).is_none()); + + // check bob(nominator) chill + precompiles() + .prepare_test(bob, Precompile, PCall::chill {}) + .execute_returns(EvmDataWriter::new().write(true).build()); + assert!(Staking::nominator_of(bob).is_none()); + }, + ); +} diff --git a/precompile/state-storage/src/mock.rs b/precompile/state-storage/src/mock.rs index 5d24429ee..492513528 100644 --- a/precompile/state-storage/src/mock.rs +++ b/precompile/state-storage/src/mock.rs @@ -16,89 +16,51 @@ // You should have received a copy of the GNU General Public License // along with Darwinia. If not, see . -//! Test utilities - // crates.io use codec::{Decode, Encode, MaxEncodedLen}; // frontier use fp_evm::{Precompile, PrecompileSet}; -use pallet_evm::IdentityAddressMapping; // substrate -use frame_support::{ - pallet_prelude::Weight, - traits::{ConstU32, Everything}, - StorageHasher, Twox128, -}; +use frame_support::{pallet_prelude::Weight, StorageHasher, Twox128}; use sp_core::{H160, H256, U256}; -use sp_runtime::{ - testing::Header, - traits::{BlakeTwo256, IdentityLookup}, -}; use sp_std::{marker::PhantomData, prelude::*}; // darwinia use crate::*; -pub type Block = frame_system::mocking::MockBlock; -pub type Balance = u64; -pub type AccountId = H160; -pub type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; - -#[derive( - Eq, - PartialEq, - Ord, - PartialOrd, - Clone, - Encode, - Decode, - Debug, - MaxEncodedLen, - scale_info::TypeInfo, -)] +pub(crate) type Balance = u64; +pub(crate) type AccountId = H160; +pub(crate) type PCall = StateStorageCall; + +#[derive(Clone, Encode, Decode, Debug, MaxEncodedLen, scale_info::TypeInfo)] pub enum Account { Alice, - Bob, - Charlie, - Bogus, Precompile, } -impl Default for Account { - fn default() -> Self { - Self::Bogus - } -} - impl Into for Account { fn into(self) -> H160 { match self { Account::Alice => H160::repeat_byte(0xAA), - Account::Bob => H160::repeat_byte(0xBB), - Account::Charlie => H160::repeat_byte(0xCC), - Account::Bogus => H160::repeat_byte(0xDD), Account::Precompile => H160::from_low_u64_be(1), } } } -frame_support::parameter_types! { - pub const BlockHashCount: u64 = 250; -} impl frame_system::Config for TestRuntime { type AccountData = pallet_balances::AccountData; type AccountId = AccountId; - type BaseCallFilter = Everything; + type BaseCallFilter = frame_support::traits::Everything; type BlockHashCount = (); type BlockLength = (); type BlockNumber = u64; type BlockWeights = (); type DbWeight = (); type Hash = H256; - type Hashing = BlakeTwo256; - type Header = Header; + type Hashing = sp_runtime::traits::BlakeTwo256; + type Header = sp_runtime::testing::Header; type Index = u64; - type Lookup = IdentityLookup; - type MaxConsumers = ConstU32<16>; + type Lookup = sp_runtime::traits::IdentityLookup; + type MaxConsumers = frame_support::traits::ConstU32<16>; type OnKilledAccount = (); type OnNewAccount = (); type OnSetCode = (); @@ -111,27 +73,20 @@ impl frame_system::Config for TestRuntime { type Version = (); } -frame_support::parameter_types! { - pub const MaxLocks: u32 = 10; - pub const ExistentialDeposit: u64 = 0; -} impl pallet_balances::Config for TestRuntime { type AccountStore = System; type Balance = Balance; type DustRemoval = (); - type ExistentialDeposit = ExistentialDeposit; - type MaxLocks = MaxLocks; + type ExistentialDeposit = frame_support::traits::ConstU64<0>; + type MaxLocks = (); type MaxReserves = (); type ReserveIdentifier = [u8; 8]; type RuntimeEvent = RuntimeEvent; type WeightInfo = (); } -frame_support::parameter_types! { - pub const MinimumPeriod: u64 = 6000 / 2; -} impl pallet_timestamp::Config for TestRuntime { - type MinimumPeriod = MinimumPeriod; + type MinimumPeriod = (); type Moment = u64; type OnTimestampSet = (); type WeightInfo = (); @@ -178,21 +133,17 @@ fn addr(a: u64) -> H160 { } frame_support::parameter_types! { - pub const TransactionByteFee: u64 = 1; - pub const ChainId: u64 = 42; pub const BlockGasLimit: U256 = U256::MAX; pub const WeightPerGas: Weight = Weight::from_ref_time(20_000); pub PrecompilesValue: TestPrecompiles = TestPrecompiles::<_>::new(); } -pub type PCall = StateStorageCall; - impl pallet_evm::Config for TestRuntime { - type AddressMapping = IdentityAddressMapping; + type AddressMapping = pallet_evm::IdentityAddressMapping; type BlockGasLimit = BlockGasLimit; type BlockHashMapping = pallet_evm::SubstrateBlockHashMapping; type CallOrigin = pallet_evm::EnsureAddressRoot; - type ChainId = ChainId; + type ChainId = frame_support::traits::ConstU64<42>; type Currency = Balances; type FeeCalculator = (); type FindAuthor = (); @@ -208,14 +159,14 @@ impl pallet_evm::Config for TestRuntime { frame_support::construct_runtime! { pub enum TestRuntime where - Block = Block, - NodeBlock = Block, - UncheckedExtrinsic = UncheckedExtrinsic, + Block = frame_system::mocking::MockBlock, + NodeBlock = frame_system::mocking::MockBlock, + UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic, { - System: frame_system::{Pallet, Call, Config, Storage, Event}, - Timestamp: pallet_timestamp::{Pallet, Call, Storage}, - Balances: pallet_balances::{Pallet, Call, Storage, Config, Event}, - EVM: pallet_evm::{Pallet, Call, Storage, Config, Event}, + System: frame_system, + Timestamp: pallet_timestamp, + Balances: pallet_balances, + EVM: pallet_evm, } } diff --git a/runtime/darwinia/Cargo.toml b/runtime/darwinia/Cargo.toml index 13138570e..66de5bf10 100644 --- a/runtime/darwinia/Cargo.toml +++ b/runtime/darwinia/Cargo.toml @@ -41,6 +41,8 @@ darwinia-deposit = { default-features = false, path = "../../pa darwinia-message-transact = { default-features = false, path = "../../pallet/message-transact" } darwinia-precompile-assets = { default-features = false, path = "../../precompile/assets" } darwinia-precompile-bls12-381 = { default-features = false, path = "../../precompile/bls12-381" } +darwinia-precompile-deposit = { default-features = false, path = "../../precompile/deposit" } +darwinia-precompile-staking = { default-features = false, path = "../../precompile/staking" } darwinia-precompile-state-storage = { default-features = false, path = "../../precompile/state-storage" } darwinia-staking = { default-features = false, path = "../../pallet/staking" } dc-primitives = { default-features = false, path = "../../core/primitives" } @@ -152,6 +154,8 @@ std = [ "darwinia-message-transact/std", "darwinia-precompile-assets/std", "darwinia-precompile-bls12-381/std", + "darwinia-precompile-staking/std", + "darwinia-precompile-deposit/std", "darwinia-precompile-state-storage/std", "darwinia-staking/std", "dc-primitives/std", diff --git a/runtime/darwinia/src/pallets/evm.rs b/runtime/darwinia/src/pallets/evm.rs index bad4c0c97..d3e94bec0 100644 --- a/runtime/darwinia/src/pallets/evm.rs +++ b/runtime/darwinia/src/pallets/evm.rs @@ -90,7 +90,7 @@ where Self(Default::default()) } - pub fn used_addresses() -> [H160; 13] { + pub fn used_addresses() -> [H160; 15] { [ addr(1), addr(2), @@ -104,6 +104,8 @@ where addr(1024), addr(1025), addr(1026), // For KTON asset + addr(1536), + addr(1537), addr(2048), ] } @@ -151,6 +153,10 @@ where handle, )), // [1536, 2048) reserved for other stable precompiles. + a if a == addr(1536) => + Some(>::execute(handle)), + a if a == addr(1537) => + Some(>::execute(handle)), // [2048..) reserved for the experimental precompiles. a if a == addr(2048) => Some(>::execute(handle)), From 222d968aac2ace5b660ceed621faefa0aa081492 Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Thu, 8 Dec 2022 18:19:39 +0800 Subject: [PATCH 038/189] Some optimization (#116) * Change sudo to Alith * Format * Doc * Security * Security * Opt * Grammar --- node/src/chain_spec/crab.rs | 4 +--- node/src/chain_spec/darwinia.rs | 2 +- node/src/chain_spec/mod.rs | 2 +- node/src/chain_spec/pangolin.rs | 4 +--- node/src/service/mod.rs | 4 ++-- pallet/account-migration/src/lib.rs | 25 ++++++++++++++++++++++--- pallet/account-migration/src/tests.rs | 23 +++++++++++++---------- pallet/staking/src/lib.rs | 11 ++++++++++- runtime/crab/src/pallets/migrate.rs | 1 + runtime/darwinia/src/pallets/migrate.rs | 1 + runtime/pangolin/src/pallets/evm.rs | 2 +- runtime/pangolin/src/pallets/migrate.rs | 1 + tool/state-processor/src/main.rs | 4 ++-- 13 files changed, 57 insertions(+), 27 deletions(-) diff --git a/node/src/chain_spec/crab.rs b/node/src/chain_spec/crab.rs index 18af6ed49..141cdb634 100644 --- a/node/src/chain_spec/crab.rs +++ b/node/src/chain_spec/crab.rs @@ -163,8 +163,6 @@ pub fn genesis_config() -> ChainSpec { session_keys(get_collator_keys_from_seed("Alice")), )], }, - // no need to pass anything to aura, in fact it will panic if we do. Session will - // take care of this. aura: Default::default(), aura_ext: Default::default(), @@ -258,7 +256,7 @@ fn testnet_genesis( treasury: Default::default(), // Utility stuff. - sudo: SudoConfig { key: Some(array_bytes::hex_n_into_unchecked(SUDO)) }, + sudo: SudoConfig { key: Some(array_bytes::hex_n_into_unchecked(ALITH)) }, vesting: Default::default(), // XCM stuff. diff --git a/node/src/chain_spec/darwinia.rs b/node/src/chain_spec/darwinia.rs index 47bf1b030..3a74c229c 100644 --- a/node/src/chain_spec/darwinia.rs +++ b/node/src/chain_spec/darwinia.rs @@ -263,7 +263,7 @@ fn testnet_genesis( treasury: Default::default(), // Utility stuff. - sudo: SudoConfig { key: Some(array_bytes::hex_n_into_unchecked(SUDO)) }, + sudo: SudoConfig { key: Some(array_bytes::hex_n_into_unchecked(ALITH)) }, vesting: Default::default(), // XCM stuff. diff --git a/node/src/chain_spec/mod.rs b/node/src/chain_spec/mod.rs index d4101757b..35b7c37d3 100644 --- a/node/src/chain_spec/mod.rs +++ b/node/src/chain_spec/mod.rs @@ -48,7 +48,7 @@ const ETHAN: &str = "0xFf64d3F6efE2317EE2807d223a0Bdc4c0c49dfDB"; const FAITH: &str = "0xC0F0f4ab324C46e55D02D0033343B4Be8A55532d"; const SUDO: &str = "0x2748def2f9c3cfbbb963002935bc6d2e1c36ce2e"; -/// The default XCM version to set in genesis config. +// The default XCM version to set in genesis config. const SAFE_XCM_VERSION: u32 = xcm::prelude::XCM_VERSION; const PROTOCOL_ID: &str = "dar"; diff --git a/node/src/chain_spec/pangolin.rs b/node/src/chain_spec/pangolin.rs index 44fe34d8f..fb43c347e 100644 --- a/node/src/chain_spec/pangolin.rs +++ b/node/src/chain_spec/pangolin.rs @@ -163,8 +163,6 @@ pub fn genesis_config() -> ChainSpec { session_keys(get_collator_keys_from_seed("Alice")), )], }, - // no need to pass anything to aura, in fact it will panic if we do. Session will - // take care of this. aura: Default::default(), aura_ext: Default::default(), @@ -253,7 +251,7 @@ fn testnet_genesis( treasury: Default::default(), // Utility stuff. - sudo: SudoConfig { key: Some(array_bytes::hex_n_into_unchecked(SUDO)) }, + sudo: SudoConfig { key: Some(array_bytes::hex_n_into_unchecked(ALITH)) }, vesting: Default::default(), // XCM stuff. diff --git a/node/src/service/mod.rs b/node/src/service/mod.rs index bf351bbe3..81ad7fceb 100644 --- a/node/src/service/mod.rs +++ b/node/src/service/mod.rs @@ -607,11 +607,11 @@ pub async fn start_parachain_node( keystore, force_authoring, slot_duration, - // We got around 500ms for proposing + // We got around 500ms for proposing. block_proposal_slot_portion: cumulus_client_consensus_aura::SlotProportion::new( 1f32 / 24f32, ), - // And a maximum of 750ms if slots are skipped + // And a maximum of 750ms if slots are skipped. max_block_proposal_slot_portion: Some( cumulus_client_consensus_aura::SlotProportion::new(1f32 / 16f32), ), diff --git a/pallet/account-migration/src/lib.rs b/pallet/account-migration/src/lib.rs index 88213072f..34316b5ed 100644 --- a/pallet/account-migration/src/lib.rs +++ b/pallet/account-migration/src/lib.rs @@ -77,6 +77,9 @@ pub mod pallet { { /// Override the [`frame_system::Config::RuntimeEvent`]. type RuntimeEvent: From + IsType<::RuntimeEvent>; + /// Chain's ID, which is used for constructing the message. (follow EIP-712 SPEC) + #[pallet::constant] + type ChainId: Get; } #[allow(missing_docs)] @@ -143,7 +146,11 @@ pub mod pallet { return InvalidTransaction::Custom(E_ACCOUNT_ALREADY_EXISTED).into(); } - let message = sr25519_signable_message(T::Version::get().spec_name.as_ref(), to); + let message = sr25519_signable_message( + T::ChainId::get(), + T::Version::get().spec_name.as_ref(), + to, + ); if verify_sr25519_signature(from, &message, signature) { ValidTransaction::with_tag_prefix("account-migration") @@ -160,8 +167,20 @@ pub mod pallet { } pub use pallet::*; -fn sr25519_signable_message(spec_name: &[u8], account_id_20: &AccountId20) -> Message { - hashing::blake2_256(&[spec_name, b"::account-migration", &account_id_20.0].concat()) +fn sr25519_signable_message( + chain_id: u64, + spec_name: &[u8], + account_id_20: &AccountId20, +) -> Message { + hashing::blake2_256( + &[ + &hashing::blake2_256( + &[&chain_id.to_le_bytes(), spec_name, b"::account-migration"].concat(), + ), + account_id_20.0.as_slice(), + ] + .concat(), + ) } fn verify_sr25519_signature( diff --git a/pallet/account-migration/src/tests.rs b/pallet/account-migration/src/tests.rs index 6ada6336c..0bc157675 100644 --- a/pallet/account-migration/src/tests.rs +++ b/pallet/account-migration/src/tests.rs @@ -23,24 +23,27 @@ use sp_keyring::sr25519::Keyring; #[test] fn sr25519_signable_message_should_work() { - [b"Darwinia2".as_slice(), b"Crab2", b"Pangolin2"] + [(46_u64, b"Darwinia2".as_slice()), (44, b"Crab2"), (43, b"Pangolin2")] .iter() .zip([ [ - 81, 88, 182, 48, 229, 179, 23, 224, 117, 134, 146, 124, 106, 211, 130, 135, 68, - 191, 187, 224, 116, 219, 61, 45, 126, 38, 77, 144, 214, 132, 173, 77, + 75, 134, 66, 181, 153, 10, 7, 244, 225, 154, 100, 68, 239, 19, 129, 51, 181, 78, + 66, 254, 167, 54, 211, 20, 171, 68, 160, 46, 216, 98, 9, 44, ], [ - 253, 68, 12, 181, 246, 68, 61, 64, 106, 115, 48, 108, 235, 106, 2, 40, 115, 99, 84, - 46, 106, 132, 116, 241, 65, 214, 128, 8, 88, 85, 137, 86, + 171, 8, 180, 157, 214, 41, 236, 80, 127, 218, 216, 136, 239, 56, 153, 31, 128, 168, + 154, 112, 70, 245, 19, 68, 53, 29, 49, 95, 238, 209, 238, 129, ], [ - 227, 102, 33, 150, 94, 161, 161, 187, 83, 242, 232, 50, 184, 187, 169, 235, 148, - 146, 90, 88, 85, 45, 61, 24, 224, 10, 33, 182, 177, 57, 219, 61, + 251, 70, 107, 65, 22, 164, 1, 85, 114, 150, 161, 208, 235, 131, 15, 111, 154, 207, + 193, 216, 110, 54, 58, 177, 15, 99, 104, 179, 13, 30, 55, 205, ], ]) - .for_each(|(spec_name, message)| { - assert_eq!(sr25519_signable_message(spec_name, &Default::default()), message); + .for_each(|((chain_id, spec_name), message)| { + assert_eq!( + sr25519_signable_message(*chain_id, spec_name, &Default::default()), + message + ); }); } @@ -48,7 +51,7 @@ fn sr25519_signable_message_should_work() { fn verify_sr25519_signature_should_work() { Keyring::iter().enumerate().for_each(|(i, from)| { let to = [i as _; 20]; - let message = sr25519_signable_message(b"Darwinia2", &to.into()); + let message = sr25519_signable_message(46, b"Darwinia2", &to.into()); let signature = from.sign(&message); assert!(verify_sr25519_signature(&from.public().0.into(), &message, &signature)); diff --git a/pallet/staking/src/lib.rs b/pallet/staking/src/lib.rs index f02a6a104..68acb805f 100644 --- a/pallet/staking/src/lib.rs +++ b/pallet/staking/src/lib.rs @@ -43,7 +43,7 @@ use core::fmt::Debug; use codec::FullCodec; // darwinia use dc_inflation::TOTAL_SUPPLY; -use dc_types::{Balance, Moment}; +use dc_types::{Balance, Moment, UNIT}; // substrate use frame_support::{ log, @@ -736,6 +736,15 @@ pub mod pallet { return; }; + + // TODO: add some tests in the core inflation, + // and get a more precise value/worst case. + if inflation > 1_000_000 * UNIT { + log::error!("[pallet::staking] it's impossible to mint over 1 million RING within a session according to current reward curve"); + + return; + } + let payout = T::PayoutFraction::get() * inflation; let (total_points, reward_map) = >::get(); // Due to the `payout * percent` there might be some losses. diff --git a/runtime/crab/src/pallets/migrate.rs b/runtime/crab/src/pallets/migrate.rs index 2374bc4eb..f2fd2b38b 100644 --- a/runtime/crab/src/pallets/migrate.rs +++ b/runtime/crab/src/pallets/migrate.rs @@ -20,5 +20,6 @@ use crate::*; impl darwinia_account_migration::Config for Runtime { + type ChainId = ::ChainId; type RuntimeEvent = RuntimeEvent; } diff --git a/runtime/darwinia/src/pallets/migrate.rs b/runtime/darwinia/src/pallets/migrate.rs index 2374bc4eb..f2fd2b38b 100644 --- a/runtime/darwinia/src/pallets/migrate.rs +++ b/runtime/darwinia/src/pallets/migrate.rs @@ -20,5 +20,6 @@ use crate::*; impl darwinia_account_migration::Config for Runtime { + type ChainId = ::ChainId; type RuntimeEvent = RuntimeEvent; } diff --git a/runtime/pangolin/src/pallets/evm.rs b/runtime/pangolin/src/pallets/evm.rs index b99da6ded..8d7e764e4 100644 --- a/runtime/pangolin/src/pallets/evm.rs +++ b/runtime/pangolin/src/pallets/evm.rs @@ -168,7 +168,7 @@ impl pallet_evm::Config for Runtime { type BlockGasLimit = BlockGasLimit; type BlockHashMapping = pallet_ethereum::EthereumBlockHashMapping; type CallOrigin = pallet_evm::EnsureAddressRoot; - type ChainId = ConstU64<44>; + type ChainId = ConstU64<43>; type Currency = Balances; type FeeCalculator = FixedGasPrice; type FindAuthor = FindAuthorTruncated; diff --git a/runtime/pangolin/src/pallets/migrate.rs b/runtime/pangolin/src/pallets/migrate.rs index 2374bc4eb..f2fd2b38b 100644 --- a/runtime/pangolin/src/pallets/migrate.rs +++ b/runtime/pangolin/src/pallets/migrate.rs @@ -20,5 +20,6 @@ use crate::*; impl darwinia_account_migration::Config for Runtime { + type ChainId = ::ChainId; type RuntimeEvent = RuntimeEvent; } diff --git a/tool/state-processor/src/main.rs b/tool/state-processor/src/main.rs index e19296def..79d76bf67 100644 --- a/tool/state-processor/src/main.rs +++ b/tool/state-processor/src/main.rs @@ -182,12 +182,12 @@ where Ok(D::decode(&mut &*v)?) } -twox128(pallet) + twox128(item) + blake2_256_concat(item_key) +// twox128(pallet) + twox128(item) + blake2_256_concat(item_key) -> blake2_256_concat(item_key) fn get_blake2_128_concat_suffix(full_key: &str, item_key: &str) -> String { full_key.trim_start_matches(item_key).into() } -twox128(pallet) + twox128(item) + last 64 bytes +// twox128(pallet) + twox128(item) + blake2_256_concat(account_id_32) -> account_id_32 #[allow(unused)] fn get_concat_suffix(full_key: &str, _: &str) -> String { format!("0x{}", &full_key[full_key.len() - 64..]) From d27513a21ea223d144479d8a0611fe3ee7daa38f Mon Sep 17 00:00:00 2001 From: Guantong <04637@163.com> Date: Thu, 8 Dec 2022 20:18:16 +0800 Subject: [PATCH 039/189] Add staking & deposit to Crab & Pangolin (#112) --- Cargo.lock | 30 ++--- node/src/chain_spec/crab.rs | 27 +++-- node/src/chain_spec/pangolin.rs | 27 +++-- runtime/crab/Cargo.toml | 15 ++- runtime/crab/src/lib.rs | 7 +- runtime/crab/src/pallets/assets.rs | 5 + runtime/crab/src/pallets/authorship.rs | 2 +- .../crab/src/pallets/collator_selection.rs | 43 ------- runtime/crab/src/pallets/deposit.rs | 38 ++++++ runtime/crab/src/pallets/evm.rs | 8 +- runtime/crab/src/pallets/mod.rs | 5 +- runtime/crab/src/pallets/session.rs | 14 ++- runtime/crab/src/pallets/staking.rs | 85 ++++++++++++++ runtime/crab/src/weights/mod.rs | 1 - .../src/weights/pallet_collator_selection.rs | 111 ------------------ runtime/darwinia/src/pallets/mod.rs | 1 + runtime/pangolin/Cargo.toml | 15 ++- runtime/pangolin/src/lib.rs | 10 +- runtime/pangolin/src/pallets/assets.rs | 5 + runtime/pangolin/src/pallets/authorship.rs | 2 +- .../src/pallets/collator_selection.rs | 43 ------- runtime/pangolin/src/pallets/deposit.rs | 38 ++++++ runtime/pangolin/src/pallets/evm.rs | 8 +- runtime/pangolin/src/pallets/mod.rs | 9 +- runtime/pangolin/src/pallets/session.rs | 14 ++- runtime/pangolin/src/pallets/staking.rs | 85 ++++++++++++++ runtime/pangolin/src/weights/mod.rs | 1 - .../src/weights/pallet_collator_selection.rs | 111 ------------------ 28 files changed, 373 insertions(+), 387 deletions(-) delete mode 100644 runtime/crab/src/pallets/collator_selection.rs create mode 100644 runtime/crab/src/pallets/deposit.rs create mode 100644 runtime/crab/src/pallets/staking.rs delete mode 100644 runtime/crab/src/weights/pallet_collator_selection.rs delete mode 100644 runtime/pangolin/src/pallets/collator_selection.rs create mode 100644 runtime/pangolin/src/pallets/deposit.rs create mode 100644 runtime/pangolin/src/pallets/staking.rs delete mode 100644 runtime/pangolin/src/weights/pallet_collator_selection.rs diff --git a/Cargo.lock b/Cargo.lock index 2c24a41c3..ea18262d1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1356,10 +1356,14 @@ dependencies = [ "cumulus-primitives-utility", "darwinia-account-migration", "darwinia-common-runtime", + "darwinia-deposit", "darwinia-message-transact", "darwinia-precompile-assets", "darwinia-precompile-bls12-381", + "darwinia-precompile-deposit", + "darwinia-precompile-staking", "darwinia-precompile-state-storage", + "darwinia-staking", "dc-primitives", "fp-rpc", "fp-self-contained", @@ -1378,7 +1382,6 @@ dependencies = [ "pallet-bridge-dispatch", "pallet-bridge-grandpa", "pallet-bridge-messages", - "pallet-collator-selection", "pallet-collective", "pallet-democracy", "pallet-elections-phragmen", @@ -6552,26 +6555,6 @@ dependencies = [ "sp-std", ] -[[package]] -name = "pallet-collator-selection" -version = "3.0.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.30#7b1fc0ed107fe42bb7e6a5dfefb586f4c3ae4328" -dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", - "log", - "pallet-authorship", - "pallet-session", - "parity-scale-codec", - "rand 0.8.5", - "scale-info", - "serde", - "sp-runtime", - "sp-staking", - "sp-std", -] - [[package]] name = "pallet-collective" version = "4.0.0-dev" @@ -7395,10 +7378,14 @@ dependencies = [ "cumulus-primitives-utility", "darwinia-account-migration", "darwinia-common-runtime", + "darwinia-deposit", "darwinia-message-transact", "darwinia-precompile-assets", "darwinia-precompile-bls12-381", + "darwinia-precompile-deposit", + "darwinia-precompile-staking", "darwinia-precompile-state-storage", + "darwinia-staking", "dc-primitives", "fp-rpc", "fp-self-contained", @@ -7417,7 +7404,6 @@ dependencies = [ "pallet-bridge-dispatch", "pallet-bridge-grandpa", "pallet-bridge-messages", - "pallet-collator-selection", "pallet-collective", "pallet-democracy", "pallet-elections-phragmen", diff --git a/node/src/chain_spec/crab.rs b/node/src/chain_spec/crab.rs index 141cdb634..71165a9ca 100644 --- a/node/src/chain_spec/crab.rs +++ b/node/src/chain_spec/crab.rs @@ -19,7 +19,11 @@ #![allow(clippy::derive_partial_eq_without_eq)] // std -use std::{collections::BTreeMap, str::FromStr}; +use std::{ + collections::BTreeMap, + str::FromStr, + time::{SystemTime, UNIX_EPOCH}, +}; // cumulus use cumulus_primitives_core::ParaId; // darwinia @@ -152,9 +156,11 @@ pub fn genesis_config() -> ChainSpec { assets: Default::default(), // Consensus stuff. - collator_selection: CollatorSelectionConfig { - invulnerables: vec![array_bytes::hex_n_into_unchecked(ALITH)], - ..Default::default() + staking: StakingConfig { + now: SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_millis(), + elapsed_time: 0, + collator_count: 3, + collators: Vec::new(), }, session: SessionConfig { keys: vec![( @@ -209,7 +215,7 @@ pub fn config() -> ChainSpec { } fn testnet_genesis( - invulnerables: Vec<(AccountId, AuraId)>, + collators: Vec<(AccountId, AuraId)>, endowed_accounts: Vec, id: ParaId, ) -> GenesisConfig { @@ -227,13 +233,14 @@ fn testnet_genesis( assets: Default::default(), // Consensus stuff. - collator_selection: CollatorSelectionConfig { - invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(), - candidacy_bond: UNIT, - ..Default::default() + staking: StakingConfig { + now: SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_millis(), + elapsed_time: 0, + collator_count: collators.len() as _, + collators: collators.iter().map(|(a, _)| (a.to_owned(), UNIT)).collect(), }, session: SessionConfig { - keys: invulnerables + keys: collators .into_iter() .map(|(acc, aura)| { ( diff --git a/node/src/chain_spec/pangolin.rs b/node/src/chain_spec/pangolin.rs index fb43c347e..685500e62 100644 --- a/node/src/chain_spec/pangolin.rs +++ b/node/src/chain_spec/pangolin.rs @@ -19,7 +19,11 @@ #![allow(clippy::derive_partial_eq_without_eq)] // std -use std::{collections::BTreeMap, str::FromStr}; +use std::{ + collections::BTreeMap, + str::FromStr, + time::{SystemTime, UNIX_EPOCH}, +}; // cumulus use cumulus_primitives_core::ParaId; // darwinia @@ -152,9 +156,11 @@ pub fn genesis_config() -> ChainSpec { assets: Default::default(), // Consensus stuff. - collator_selection: CollatorSelectionConfig { - invulnerables: vec![array_bytes::hex_n_into_unchecked(ALITH)], - ..Default::default() + staking: StakingConfig { + now: SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_millis(), + elapsed_time: 0, + collator_count: 3, + collators: Vec::new(), }, session: SessionConfig { keys: vec![( @@ -204,7 +210,7 @@ pub fn config() -> ChainSpec { } fn testnet_genesis( - invulnerables: Vec<(AccountId, AuraId)>, + collators: Vec<(AccountId, AuraId)>, endowed_accounts: Vec, id: ParaId, ) -> GenesisConfig { @@ -222,13 +228,14 @@ fn testnet_genesis( assets: Default::default(), // Consensus stuff. - collator_selection: CollatorSelectionConfig { - invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(), - candidacy_bond: UNIT, - ..Default::default() + staking: StakingConfig { + now: SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_millis(), + elapsed_time: 0, + collator_count: collators.len() as _, + collators: collators.iter().map(|(a, _)| (a.to_owned(), UNIT)).collect(), }, session: SessionConfig { - keys: invulnerables + keys: collators .into_iter() .map(|(acc, aura)| { ( diff --git a/runtime/crab/Cargo.toml b/runtime/crab/Cargo.toml index a7e214e98..83a6af4b5 100644 --- a/runtime/crab/Cargo.toml +++ b/runtime/crab/Cargo.toml @@ -30,7 +30,6 @@ cumulus-pallet-xcmp-queue = { default-features = false, git = "https://git cumulus-primitives-core = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } cumulus-primitives-timestamp = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } cumulus-primitives-utility = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } -pallet-collator-selection = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } parachain-info = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } # cumulus optional cumulus-pallet-session-benchmarking = { optional = true, default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } @@ -38,10 +37,14 @@ cumulus-pallet-session-benchmarking = { optional = true, default-features = fals # darwinia darwinia-account-migration = { default-features = false, path = "../../pallet/account-migration" } darwinia-common-runtime = { default-features = false, path = "../common" } +darwinia-deposit = { default-features = false, path = "../../pallet/deposit" } darwinia-message-transact = { default-features = false, path = "../../pallet/message-transact" } darwinia-precompile-assets = { default-features = false, path = "../../precompile/assets" } darwinia-precompile-bls12-381 = { default-features = false, path = "../../precompile/bls12-381" } +darwinia-precompile-deposit = { default-features = false, path = "../../precompile/deposit" } +darwinia-precompile-staking = { default-features = false, path = "../../precompile/staking" } darwinia-precompile-state-storage = { default-features = false, path = "../../precompile/state-storage" } +darwinia-staking = { default-features = false, path = "../../pallet/staking" } dc-primitives = { default-features = false, path = "../../core/primitives" } # darwinia-messages-substrate @@ -68,7 +71,7 @@ pallet-evm-precompile-modexp = { default-features = false, git = "https://gith pallet-evm-precompile-simple = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } # moonbeam -precompile-utils = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.30"} +precompile-utils = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.30" } xcm-primitives = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.30" } # polkadot @@ -125,6 +128,7 @@ frame-try-runtime = { optional = true, default-features = false, git = " [features] default = ["std"] +production = [] std = [ # crates.io "codec/std", @@ -139,7 +143,6 @@ std = [ "cumulus-primitives-core/std", "cumulus-primitives-timestamp/std", "cumulus-primitives-utility/std", - "pallet-collator-selection/std", "parachain-info/std", # cumulus optional "cumulus-pallet-session-benchmarking?/std", @@ -147,10 +150,14 @@ std = [ # darwinia "darwinia-account-migration/std", "darwinia-common-runtime/std", + "darwinia-deposit/std", "darwinia-message-transact/std", "darwinia-precompile-assets/std", "darwinia-precompile-bls12-381/std", + "darwinia-precompile-staking/std", + "darwinia-precompile-deposit/std", "darwinia-precompile-state-storage/std", + "darwinia-staking/std", "dc-primitives/std", # darwinia-messages-substrate @@ -239,7 +246,6 @@ runtime-benchmarks = [ "array-bytes", # cumulus - "pallet-collator-selection/runtime-benchmarks", "cumulus-pallet-parachain-system/runtime-benchmarks", "cumulus-pallet-xcmp-queue/runtime-benchmarks", # cumulus optional @@ -297,7 +303,6 @@ try-runtime = [ "cumulus-pallet-parachain-system/try-runtime", "cumulus-pallet-xcm/try-runtime", "cumulus-pallet-xcmp-queue/try-runtime", - "pallet-collator-selection/try-runtime", "parachain-info/try-runtime", # frontier diff --git a/runtime/crab/src/lib.rs b/runtime/crab/src/lib.rs index 9789a29b5..d379aa5b2 100644 --- a/runtime/crab/src/lib.rs +++ b/runtime/crab/src/lib.rs @@ -40,7 +40,6 @@ use cumulus_pallet_parachain_system::RelayNumberStrictlyIncreases; // darwinia use dc_primitives::*; // polkadot -use xcm::latest::prelude::BodyId; use xcm_executor::XcmExecutor; // substrate use frame_support::{ @@ -50,7 +49,6 @@ use frame_support::{ ConstantMultiplier, Weight, WeightToFeeCoefficient, WeightToFeeCoefficients, WeightToFeePolynomial, }, - PalletId, }; use frame_system::EnsureRoot; use sp_core::{crypto::KeyTypeId, OpaqueMetadata, H160, H256, U256}; @@ -276,11 +274,12 @@ frame_support::construct_runtime! { Balances: pallet_balances = 5, TransactionPayment: pallet_transaction_payment = 6, Assets: pallet_assets = 34, - AccountMigration: darwinia_account_migration = 40, + Deposit: darwinia_deposit = 40, + AccountMigration: darwinia_account_migration = 41, // Consensus stuff. Authorship: pallet_authorship = 7, - CollatorSelection: pallet_collator_selection = 8, + Staking: darwinia_staking = 8, Session: pallet_session = 9, Aura: pallet_aura = 10, AuraExt: cumulus_pallet_aura_ext = 11, diff --git a/runtime/crab/src/pallets/assets.rs b/runtime/crab/src/pallets/assets.rs index d649ffa49..a456fa09e 100644 --- a/runtime/crab/src/pallets/assets.rs +++ b/runtime/crab/src/pallets/assets.rs @@ -19,6 +19,11 @@ // darwinia use crate::*; +/// List of the assets existed in this runtime. +pub enum AssetIds { + CKton = 1026, +} + impl pallet_assets::Config for Runtime { type ApprovalDeposit = ConstU128<0>; type AssetAccountDeposit = ConstU128<0>; diff --git a/runtime/crab/src/pallets/authorship.rs b/runtime/crab/src/pallets/authorship.rs index eb48e3bdb..d2a61afc7 100644 --- a/runtime/crab/src/pallets/authorship.rs +++ b/runtime/crab/src/pallets/authorship.rs @@ -20,7 +20,7 @@ use crate::*; impl pallet_authorship::Config for Runtime { - type EventHandler = (CollatorSelection,); + type EventHandler = (Staking,); type FilterUncle = (); type FindAuthor = pallet_session::FindAccountFromAuthorIndex; type UncleGenerations = ConstU32<0>; diff --git a/runtime/crab/src/pallets/collator_selection.rs b/runtime/crab/src/pallets/collator_selection.rs deleted file mode 100644 index 511377862..000000000 --- a/runtime/crab/src/pallets/collator_selection.rs +++ /dev/null @@ -1,43 +0,0 @@ -// This file is part of Darwinia. -// -// Copyright (C) 2018-2022 Darwinia Network -// SPDX-License-Identifier: GPL-3.0 -// -// Darwinia is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// Darwinia 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 Darwinia. If not, see . - -// darwinia -use crate::*; - -// We allow root only to execute privileged collator selection operations. -pub type CollatorSelectionUpdateOrigin = EnsureRoot; -frame_support::parameter_types! { - pub const PotId: PalletId = PalletId(*b"PotStake"); - pub const ExecutiveBody: BodyId = BodyId::Executive; -} - -impl pallet_collator_selection::Config for Runtime { - type Currency = Balances; - // should be a multiple of session or things will get inconsistent - type KickThreshold = Period; - type MaxCandidates = ConstU32<1000>; - type MaxInvulnerables = ConstU32<100>; - type MinCandidates = ConstU32<5>; - type PotId = PotId; - type RuntimeEvent = RuntimeEvent; - type UpdateOrigin = CollatorSelectionUpdateOrigin; - type ValidatorId = ::AccountId; - type ValidatorIdOf = pallet_collator_selection::IdentityCollator; - type ValidatorRegistration = Session; - type WeightInfo = weights::pallet_collator_selection::WeightInfo; -} diff --git a/runtime/crab/src/pallets/deposit.rs b/runtime/crab/src/pallets/deposit.rs new file mode 100644 index 000000000..0ed9b9bfb --- /dev/null +++ b/runtime/crab/src/pallets/deposit.rs @@ -0,0 +1,38 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +pub enum CKtonMinting {} +impl darwinia_deposit::Minting for CKtonMinting { + type AccountId = AccountId; + + fn mint(beneficiary: &Self::AccountId, amount: Balance) -> sp_runtime::DispatchResult { + Assets::mint(RuntimeOrigin::root(), AssetIds::CKton as AssetId, *beneficiary, amount) + } +} + +impl darwinia_deposit::Config for Runtime { + type Kton = CKtonMinting; + type MaxDeposits = frame_support::traits::ConstU32<16>; + type MinLockingAmount = frame_support::traits::ConstU128; + type Ring = Balances; + type RuntimeEvent = RuntimeEvent; + type UnixTime = Timestamp; +} diff --git a/runtime/crab/src/pallets/evm.rs b/runtime/crab/src/pallets/evm.rs index 278cdca06..06766c029 100644 --- a/runtime/crab/src/pallets/evm.rs +++ b/runtime/crab/src/pallets/evm.rs @@ -90,7 +90,7 @@ where Self(Default::default()) } - pub fn used_addresses() -> [H160; 13] { + pub fn used_addresses() -> [H160; 15] { [ addr(1), addr(2), @@ -104,6 +104,8 @@ where addr(1024), addr(1025), addr(1026), // For KTON asset + addr(1536), + addr(1537), addr(2048), ] } @@ -151,6 +153,10 @@ where handle, )), // [1536, 2048) reserved for other stable precompiles. + a if a == addr(1536) => + Some(>::execute(handle)), + a if a == addr(1537) => + Some(>::execute(handle)), // [2048..) reserved for the experimental precompiles. a if a == addr(2048) => Some(>::execute(handle)), diff --git a/runtime/crab/src/pallets/mod.rs b/runtime/crab/src/pallets/mod.rs index 169c4eff8..a64ad0db0 100644 --- a/runtime/crab/src/pallets/mod.rs +++ b/runtime/crab/src/pallets/mod.rs @@ -40,13 +40,16 @@ mod balances; mod transaction_payment; mod assets; +pub use assets::*; + +mod deposit; mod migrate; // Consensus stuff. mod authorship; -mod collator_selection; +mod staking; mod session; pub use session::*; diff --git a/runtime/crab/src/pallets/session.rs b/runtime/crab/src/pallets/session.rs index 7725500ed..bb36bdc36 100644 --- a/runtime/crab/src/pallets/session.rs +++ b/runtime/crab/src/pallets/session.rs @@ -25,21 +25,27 @@ sp_runtime::impl_opaque_keys! { } } +#[cfg(feature = "production")] frame_support::parameter_types! { pub const Period: u32 = 6 * HOURS; pub const Offset: u32 = 0; } +#[cfg(not(feature = "production"))] +frame_support::parameter_types! { + pub const Period: u32 = 2 * MINUTES; + pub const Offset: u32 = 0; +} impl pallet_session::Config for Runtime { type Keys = SessionKeys; type NextSessionRotation = pallet_session::PeriodicSessions; type RuntimeEvent = RuntimeEvent; - // Essentially just Aura, but lets be pedantic. + // Essentially just AURA, but lets be pedantic. type SessionHandler = ::KeyTypeIdProviders; - type SessionManager = CollatorSelection; + type SessionManager = Staking; type ShouldEndSession = pallet_session::PeriodicSessions; type ValidatorId = ::AccountId; - // we don't have stash and controller, thus we don't need the convert as well. - type ValidatorIdOf = pallet_collator_selection::IdentityCollator; + // We don't have stash and controller, thus we don't need the convert as well. + type ValidatorIdOf = darwinia_staking::IdentityCollator; type WeightInfo = weights::pallet_session::WeightInfo; } diff --git a/runtime/crab/src/pallets/staking.rs b/runtime/crab/src/pallets/staking.rs new file mode 100644 index 000000000..b705f2502 --- /dev/null +++ b/runtime/crab/src/pallets/staking.rs @@ -0,0 +1,85 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +pub enum CrabStaking {} +impl darwinia_staking::Stake for CrabStaking { + type AccountId = AccountId; + type Item = Balance; + + fn stake(who: &Self::AccountId, item: Self::Item) -> sp_runtime::DispatchResult { + >::transfer( + who, + &darwinia_staking::account_id(), + item, + frame_support::traits::ExistenceRequirement::KeepAlive, + ) + } + + fn unstake(who: &Self::AccountId, item: Self::Item) -> sp_runtime::DispatchResult { + >::transfer( + &darwinia_staking::account_id(), + who, + item, + frame_support::traits::ExistenceRequirement::AllowDeath, + ) + } +} +pub enum CKtonStaking {} +impl darwinia_staking::Stake for CKtonStaking { + type AccountId = AccountId; + type Item = Balance; + + fn stake(who: &Self::AccountId, item: Self::Item) -> sp_runtime::DispatchResult { + Assets::transfer( + RuntimeOrigin::signed(*who), + AssetIds::CKton as AssetId, + darwinia_staking::account_id(), + item, + ) + } + + fn unstake(who: &Self::AccountId, item: Self::Item) -> sp_runtime::DispatchResult { + Assets::transfer( + RuntimeOrigin::signed(darwinia_staking::account_id()), + AssetIds::CKton as AssetId, + *who, + item, + ) + } +} + +frame_support::parameter_types! { + pub const PayoutFraction: sp_runtime::Perbill = sp_runtime::Perbill::from_percent(20); +} + +impl darwinia_staking::Config for Runtime { + type Deposit = Deposit; + type Kton = CKtonStaking; + type MaxDeposits = ConstU32<16>; + type MaxUnstakings = ConstU32<16>; + type MinStakingDuration = ConstU32<{ 14 * DAYS }>; + type PayoutFraction = PayoutFraction; + type RewardRemainder = Treasury; + type Ring = CrabStaking; + type RingCurrency = Balances; + type RuntimeEvent = RuntimeEvent; + type UnixTime = Timestamp; +} diff --git a/runtime/crab/src/weights/mod.rs b/runtime/crab/src/weights/mod.rs index 74dbfcbbd..5856c3a7f 100644 --- a/runtime/crab/src/weights/mod.rs +++ b/runtime/crab/src/weights/mod.rs @@ -35,6 +35,5 @@ pub use rocksdb_weights::constants::RocksDbWeight; pub mod cumulus_pallet_xcmp_queue; pub mod frame_system; pub mod pallet_balances; -pub mod pallet_collator_selection; pub mod pallet_session; pub mod pallet_timestamp; diff --git a/runtime/crab/src/weights/pallet_collator_selection.rs b/runtime/crab/src/weights/pallet_collator_selection.rs deleted file mode 100644 index affdfcef8..000000000 --- a/runtime/crab/src/weights/pallet_collator_selection.rs +++ /dev/null @@ -1,111 +0,0 @@ -// This file is part of Darwinia. -// -// Copyright (C) 2018-2022 Darwinia Network -// SPDX-License-Identifier: GPL-3.0 -// -// Darwinia is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// Darwinia 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 Darwinia. If not, see . - -//! Autogenerated weights for `pallet_collator_selection` -//! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2022-11-09, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! HOSTNAME: `inv.cafe`, CPU: `AMD Ryzen 9 5950X 16-Core Processor` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("local"), DB CACHE: 1024 - -// Executed Command: -// target/release/darwinia -// benchmark -// pallet -// --header -// .maintain/license-header -// --execution -// wasm -// --heap-pages -// 4096 -// --chain -// local -// --output -// runtime/src/weights -// --extrinsic -// set_invulnerables,set_desired_candidates,set_candidacy_bond,leave_intent,new_session,note_author -// --pallet -// pallet-collator-selection - -#![cfg_attr(rustfmt, rustfmt_skip)] -#![allow(unused_parens)] -#![allow(unused_imports)] - -use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; - -/// Weight functions for `pallet_collator_selection`. -pub struct WeightInfo(PhantomData); -impl pallet_collator_selection::WeightInfo for WeightInfo { - // Storage: Session NextKeys (r:1 w:0) - // Storage: CollatorSelection Invulnerables (r:0 w:1) - /// The range of component `b` is `[1, 100]`. - fn set_invulnerables(_b: u32, ) -> Weight { - Weight::from_ref_time(317_565_000 as u64) - .saturating_add(T::DbWeight::get().reads(100 as u64)) - .saturating_add(T::DbWeight::get().writes(1 as u64)) - } - // Storage: CollatorSelection DesiredCandidates (r:0 w:1) - fn set_desired_candidates() -> Weight { - Weight::from_ref_time(19_951_000 as u64) - .saturating_add(T::DbWeight::get().writes(1 as u64)) - } - // Storage: CollatorSelection CandidacyBond (r:0 w:1) - fn set_candidacy_bond() -> Weight { - Weight::from_ref_time(19_730_000 as u64) - .saturating_add(T::DbWeight::get().writes(1 as u64)) - } - fn register_as_candidate(c: u32) -> Weight { - Weight::from_ref_time(71_196_000 as u64) - // Standard Error: 0 - .saturating_add(Weight::from_ref_time(198_000 as u64).saturating_mul(c as u64)) - .saturating_add(T::DbWeight::get().reads(4 as u64)) - .saturating_add(T::DbWeight::get().writes(2 as u64)) - } - // Storage: CollatorSelection Candidates (r:1 w:1) - // Storage: CollatorSelection LastAuthoredBlock (r:0 w:1) - /// The range of component `c` is `[6, 1000]`. - fn leave_intent(_c: u32, ) -> Weight { - Weight::from_ref_time(181_302_000 as u64) - .saturating_add(T::DbWeight::get().reads(1 as u64)) - .saturating_add(T::DbWeight::get().writes(2 as u64)) - } - // Storage: System Account (r:2 w:2) - // Storage: System BlockWeight (r:1 w:1) - // Storage: CollatorSelection LastAuthoredBlock (r:0 w:1) - fn note_author() -> Weight { - Weight::from_ref_time(43_091_000 as u64) - .saturating_add(T::DbWeight::get().reads(3 as u64)) - .saturating_add(T::DbWeight::get().writes(4 as u64)) - } - // Storage: CollatorSelection Candidates (r:1 w:1) - // Storage: CollatorSelection LastAuthoredBlock (r:1000 w:1) - // Storage: System Account (r:1 w:1) - // Storage: CollatorSelection Invulnerables (r:1 w:0) - // Storage: System BlockWeight (r:1 w:1) - /// The range of component `r` is `[1, 1000]`. - /// The range of component `c` is `[1, 1000]`. - fn new_session(_r: u32, c: u32, ) -> Weight { - Weight::from_ref_time(28_111_000 as u64) - // Standard Error: 39_309 - .saturating_add(Weight::from_ref_time(3_055_761 as u64).saturating_mul(c as u64)) - .saturating_add(T::DbWeight::get().reads(4 as u64)) - .saturating_add(T::DbWeight::get().reads((1 as u64).saturating_mul(c as u64))) - .saturating_add(T::DbWeight::get().writes(1 as u64)) - } -} diff --git a/runtime/darwinia/src/pallets/mod.rs b/runtime/darwinia/src/pallets/mod.rs index d6cdba9f7..a64ad0db0 100644 --- a/runtime/darwinia/src/pallets/mod.rs +++ b/runtime/darwinia/src/pallets/mod.rs @@ -45,6 +45,7 @@ pub use assets::*; mod deposit; mod migrate; + // Consensus stuff. mod authorship; diff --git a/runtime/pangolin/Cargo.toml b/runtime/pangolin/Cargo.toml index 106613408..87a56f151 100644 --- a/runtime/pangolin/Cargo.toml +++ b/runtime/pangolin/Cargo.toml @@ -30,7 +30,6 @@ cumulus-pallet-xcmp-queue = { default-features = false, git = "https://git cumulus-primitives-core = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } cumulus-primitives-timestamp = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } cumulus-primitives-utility = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } -pallet-collator-selection = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } parachain-info = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } # cumulus optional cumulus-pallet-session-benchmarking = { optional = true, default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } @@ -38,10 +37,14 @@ cumulus-pallet-session-benchmarking = { optional = true, default-features = fals # darwinia darwinia-account-migration = { default-features = false, path = "../../pallet/account-migration" } darwinia-common-runtime = { default-features = false, path = "../common" } +darwinia-deposit = { default-features = false, path = "../../pallet/deposit" } darwinia-message-transact = { default-features = false, path = "../../pallet/message-transact" } darwinia-precompile-assets = { default-features = false, path = "../../precompile/assets" } darwinia-precompile-bls12-381 = { default-features = false, path = "../../precompile/bls12-381" } +darwinia-precompile-deposit = { default-features = false, path = "../../precompile/deposit" } +darwinia-precompile-staking = { default-features = false, path = "../../precompile/staking" } darwinia-precompile-state-storage = { default-features = false, path = "../../precompile/state-storage" } +darwinia-staking = { default-features = false, path = "../../pallet/staking" } dc-primitives = { default-features = false, path = "../../core/primitives" } # darwinia-messages-substrate @@ -68,7 +71,7 @@ pallet-evm-precompile-modexp = { default-features = false, git = "https://gith pallet-evm-precompile-simple = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } # moonbeam -precompile-utils = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.30"} +precompile-utils = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.30" } xcm-primitives = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.30" } # polkadot @@ -125,6 +128,7 @@ frame-try-runtime = { optional = true, default-features = false, git = " [features] default = ["std"] +production = [] std = [ # crates.io "codec/std", @@ -139,7 +143,6 @@ std = [ "cumulus-primitives-core/std", "cumulus-primitives-timestamp/std", "cumulus-primitives-utility/std", - "pallet-collator-selection/std", "parachain-info/std", # cumulus optional "cumulus-pallet-session-benchmarking?/std", @@ -147,10 +150,14 @@ std = [ # darwinia "darwinia-account-migration/std", "darwinia-common-runtime/std", + "darwinia-deposit/std", "darwinia-message-transact/std", "darwinia-precompile-assets/std", "darwinia-precompile-bls12-381/std", + "darwinia-precompile-staking/std", + "darwinia-precompile-deposit/std", "darwinia-precompile-state-storage/std", + "darwinia-staking/std", "dc-primitives/std", # darwinia-messages-substrate @@ -239,7 +246,6 @@ runtime-benchmarks = [ "array-bytes", # cumulus - "pallet-collator-selection/runtime-benchmarks", "cumulus-pallet-parachain-system/runtime-benchmarks", "cumulus-pallet-xcmp-queue/runtime-benchmarks", # cumulus optional @@ -297,7 +303,6 @@ try-runtime = [ "cumulus-pallet-parachain-system/try-runtime", "cumulus-pallet-xcm/try-runtime", "cumulus-pallet-xcmp-queue/try-runtime", - "pallet-collator-selection/try-runtime", "parachain-info/try-runtime", # frontier diff --git a/runtime/pangolin/src/lib.rs b/runtime/pangolin/src/lib.rs index 73bb9d614..74406598d 100644 --- a/runtime/pangolin/src/lib.rs +++ b/runtime/pangolin/src/lib.rs @@ -29,6 +29,7 @@ pub use pallets::*; mod weights; +pub use darwinia_common_runtime::*; pub use sp_consensus_aura::sr25519::AuthorityId as AuraId; // cumulus @@ -36,7 +37,6 @@ use cumulus_pallet_parachain_system::RelayNumberStrictlyIncreases; // darwinia use dc_primitives::*; // polkadot -use xcm::latest::prelude::BodyId; use xcm_executor::XcmExecutor; // substrate use frame_support::{ @@ -46,7 +46,6 @@ use frame_support::{ ConstantMultiplier, Weight, WeightToFeeCoefficient, WeightToFeeCoefficients, WeightToFeePolynomial, }, - PalletId, }; use frame_system::EnsureRoot; use sp_core::{crypto::KeyTypeId, OpaqueMetadata, H160, H256, U256}; @@ -272,11 +271,12 @@ frame_support::construct_runtime! { Balances: pallet_balances = 5, TransactionPayment: pallet_transaction_payment = 6, Assets: pallet_assets = 34, - AccountMigration: darwinia_account_migration = 36, + Deposit: darwinia_deposit = 40, + AccountMigration: darwinia_account_migration = 41, // Consensus stuff. Authorship: pallet_authorship = 7, - CollatorSelection: pallet_collator_selection = 8, + Staking: darwinia_staking = 8, Session: pallet_session = 9, Aura: pallet_aura = 10, AuraExt: cumulus_pallet_aura_ext = 11, @@ -310,7 +310,7 @@ frame_support::construct_runtime! { Ethereum: pallet_ethereum = 31, Evm: pallet_evm = 32, BaseFee: pallet_base_fee = 33, - MessageTransact: darwinia_message_transact = 35, + MessageTransact: darwinia_message_transact = 39, } } diff --git a/runtime/pangolin/src/pallets/assets.rs b/runtime/pangolin/src/pallets/assets.rs index d649ffa49..dde186c4a 100644 --- a/runtime/pangolin/src/pallets/assets.rs +++ b/runtime/pangolin/src/pallets/assets.rs @@ -19,6 +19,11 @@ // darwinia use crate::*; +/// List of the assets existed in this runtime. +pub enum AssetIds { + PKton = 1026, +} + impl pallet_assets::Config for Runtime { type ApprovalDeposit = ConstU128<0>; type AssetAccountDeposit = ConstU128<0>; diff --git a/runtime/pangolin/src/pallets/authorship.rs b/runtime/pangolin/src/pallets/authorship.rs index eb48e3bdb..d2a61afc7 100644 --- a/runtime/pangolin/src/pallets/authorship.rs +++ b/runtime/pangolin/src/pallets/authorship.rs @@ -20,7 +20,7 @@ use crate::*; impl pallet_authorship::Config for Runtime { - type EventHandler = (CollatorSelection,); + type EventHandler = (Staking,); type FilterUncle = (); type FindAuthor = pallet_session::FindAccountFromAuthorIndex; type UncleGenerations = ConstU32<0>; diff --git a/runtime/pangolin/src/pallets/collator_selection.rs b/runtime/pangolin/src/pallets/collator_selection.rs deleted file mode 100644 index 511377862..000000000 --- a/runtime/pangolin/src/pallets/collator_selection.rs +++ /dev/null @@ -1,43 +0,0 @@ -// This file is part of Darwinia. -// -// Copyright (C) 2018-2022 Darwinia Network -// SPDX-License-Identifier: GPL-3.0 -// -// Darwinia is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// Darwinia 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 Darwinia. If not, see . - -// darwinia -use crate::*; - -// We allow root only to execute privileged collator selection operations. -pub type CollatorSelectionUpdateOrigin = EnsureRoot; -frame_support::parameter_types! { - pub const PotId: PalletId = PalletId(*b"PotStake"); - pub const ExecutiveBody: BodyId = BodyId::Executive; -} - -impl pallet_collator_selection::Config for Runtime { - type Currency = Balances; - // should be a multiple of session or things will get inconsistent - type KickThreshold = Period; - type MaxCandidates = ConstU32<1000>; - type MaxInvulnerables = ConstU32<100>; - type MinCandidates = ConstU32<5>; - type PotId = PotId; - type RuntimeEvent = RuntimeEvent; - type UpdateOrigin = CollatorSelectionUpdateOrigin; - type ValidatorId = ::AccountId; - type ValidatorIdOf = pallet_collator_selection::IdentityCollator; - type ValidatorRegistration = Session; - type WeightInfo = weights::pallet_collator_selection::WeightInfo; -} diff --git a/runtime/pangolin/src/pallets/deposit.rs b/runtime/pangolin/src/pallets/deposit.rs new file mode 100644 index 000000000..023819bc4 --- /dev/null +++ b/runtime/pangolin/src/pallets/deposit.rs @@ -0,0 +1,38 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +pub enum PKtonMinting {} +impl darwinia_deposit::Minting for PKtonMinting { + type AccountId = AccountId; + + fn mint(beneficiary: &Self::AccountId, amount: Balance) -> sp_runtime::DispatchResult { + Assets::mint(RuntimeOrigin::root(), AssetIds::PKton as AssetId, *beneficiary, amount) + } +} + +impl darwinia_deposit::Config for Runtime { + type Kton = PKtonMinting; + type MaxDeposits = frame_support::traits::ConstU32<16>; + type MinLockingAmount = frame_support::traits::ConstU128; + type Ring = Balances; + type RuntimeEvent = RuntimeEvent; + type UnixTime = Timestamp; +} diff --git a/runtime/pangolin/src/pallets/evm.rs b/runtime/pangolin/src/pallets/evm.rs index 8d7e764e4..051329ca2 100644 --- a/runtime/pangolin/src/pallets/evm.rs +++ b/runtime/pangolin/src/pallets/evm.rs @@ -90,7 +90,7 @@ where Self(Default::default()) } - pub fn used_addresses() -> [H160; 13] { + pub fn used_addresses() -> [H160; 15] { [ addr(1), addr(2), @@ -104,6 +104,8 @@ where addr(1024), addr(1025), addr(1026), // For KTON asset + addr(1536), + addr(1537), addr(2048), ] } @@ -151,6 +153,10 @@ where handle, )), // [1536, 2048) reserved for other stable precompiles. + a if a == addr(1536) => + Some(>::execute(handle)), + a if a == addr(1537) => + Some(>::execute(handle)), // [2048..) reserved for the experimental precompiles. a if a == addr(2048) => Some(>::execute(handle)), diff --git a/runtime/pangolin/src/pallets/mod.rs b/runtime/pangolin/src/pallets/mod.rs index 4ec80c833..8ffa23449 100644 --- a/runtime/pangolin/src/pallets/mod.rs +++ b/runtime/pangolin/src/pallets/mod.rs @@ -25,8 +25,6 @@ mod shared_imports { pub use shared_imports::*; // System stuffs. -mod assets; - mod system; pub use system::*; @@ -41,12 +39,17 @@ mod balances; mod transaction_payment; +mod assets; +pub use assets::*; + +mod deposit; + mod migrate; // Consensus stuff. mod authorship; -mod collator_selection; +mod staking; mod session; pub use session::*; diff --git a/runtime/pangolin/src/pallets/session.rs b/runtime/pangolin/src/pallets/session.rs index 7725500ed..bb36bdc36 100644 --- a/runtime/pangolin/src/pallets/session.rs +++ b/runtime/pangolin/src/pallets/session.rs @@ -25,21 +25,27 @@ sp_runtime::impl_opaque_keys! { } } +#[cfg(feature = "production")] frame_support::parameter_types! { pub const Period: u32 = 6 * HOURS; pub const Offset: u32 = 0; } +#[cfg(not(feature = "production"))] +frame_support::parameter_types! { + pub const Period: u32 = 2 * MINUTES; + pub const Offset: u32 = 0; +} impl pallet_session::Config for Runtime { type Keys = SessionKeys; type NextSessionRotation = pallet_session::PeriodicSessions; type RuntimeEvent = RuntimeEvent; - // Essentially just Aura, but lets be pedantic. + // Essentially just AURA, but lets be pedantic. type SessionHandler = ::KeyTypeIdProviders; - type SessionManager = CollatorSelection; + type SessionManager = Staking; type ShouldEndSession = pallet_session::PeriodicSessions; type ValidatorId = ::AccountId; - // we don't have stash and controller, thus we don't need the convert as well. - type ValidatorIdOf = pallet_collator_selection::IdentityCollator; + // We don't have stash and controller, thus we don't need the convert as well. + type ValidatorIdOf = darwinia_staking::IdentityCollator; type WeightInfo = weights::pallet_session::WeightInfo; } diff --git a/runtime/pangolin/src/pallets/staking.rs b/runtime/pangolin/src/pallets/staking.rs new file mode 100644 index 000000000..81c9a2f4c --- /dev/null +++ b/runtime/pangolin/src/pallets/staking.rs @@ -0,0 +1,85 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +pub enum PRingStaking {} +impl darwinia_staking::Stake for PRingStaking { + type AccountId = AccountId; + type Item = Balance; + + fn stake(who: &Self::AccountId, item: Self::Item) -> sp_runtime::DispatchResult { + >::transfer( + who, + &darwinia_staking::account_id(), + item, + frame_support::traits::ExistenceRequirement::KeepAlive, + ) + } + + fn unstake(who: &Self::AccountId, item: Self::Item) -> sp_runtime::DispatchResult { + >::transfer( + &darwinia_staking::account_id(), + who, + item, + frame_support::traits::ExistenceRequirement::AllowDeath, + ) + } +} +pub enum PKtonStaking {} +impl darwinia_staking::Stake for PKtonStaking { + type AccountId = AccountId; + type Item = Balance; + + fn stake(who: &Self::AccountId, item: Self::Item) -> sp_runtime::DispatchResult { + Assets::transfer( + RuntimeOrigin::signed(*who), + AssetIds::PKton as AssetId, + darwinia_staking::account_id(), + item, + ) + } + + fn unstake(who: &Self::AccountId, item: Self::Item) -> sp_runtime::DispatchResult { + Assets::transfer( + RuntimeOrigin::signed(darwinia_staking::account_id()), + AssetIds::PKton as AssetId, + *who, + item, + ) + } +} + +frame_support::parameter_types! { + pub const PayoutFraction: sp_runtime::Perbill = sp_runtime::Perbill::from_percent(20); +} + +impl darwinia_staking::Config for Runtime { + type Deposit = Deposit; + type Kton = PKtonStaking; + type MaxDeposits = ConstU32<16>; + type MaxUnstakings = ConstU32<16>; + type MinStakingDuration = ConstU32<{ 14 * DAYS }>; + type PayoutFraction = PayoutFraction; + type RewardRemainder = Treasury; + type Ring = PRingStaking; + type RingCurrency = Balances; + type RuntimeEvent = RuntimeEvent; + type UnixTime = Timestamp; +} diff --git a/runtime/pangolin/src/weights/mod.rs b/runtime/pangolin/src/weights/mod.rs index 74dbfcbbd..5856c3a7f 100644 --- a/runtime/pangolin/src/weights/mod.rs +++ b/runtime/pangolin/src/weights/mod.rs @@ -35,6 +35,5 @@ pub use rocksdb_weights::constants::RocksDbWeight; pub mod cumulus_pallet_xcmp_queue; pub mod frame_system; pub mod pallet_balances; -pub mod pallet_collator_selection; pub mod pallet_session; pub mod pallet_timestamp; diff --git a/runtime/pangolin/src/weights/pallet_collator_selection.rs b/runtime/pangolin/src/weights/pallet_collator_selection.rs deleted file mode 100644 index affdfcef8..000000000 --- a/runtime/pangolin/src/weights/pallet_collator_selection.rs +++ /dev/null @@ -1,111 +0,0 @@ -// This file is part of Darwinia. -// -// Copyright (C) 2018-2022 Darwinia Network -// SPDX-License-Identifier: GPL-3.0 -// -// Darwinia is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// Darwinia 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 Darwinia. If not, see . - -//! Autogenerated weights for `pallet_collator_selection` -//! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2022-11-09, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! HOSTNAME: `inv.cafe`, CPU: `AMD Ryzen 9 5950X 16-Core Processor` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("local"), DB CACHE: 1024 - -// Executed Command: -// target/release/darwinia -// benchmark -// pallet -// --header -// .maintain/license-header -// --execution -// wasm -// --heap-pages -// 4096 -// --chain -// local -// --output -// runtime/src/weights -// --extrinsic -// set_invulnerables,set_desired_candidates,set_candidacy_bond,leave_intent,new_session,note_author -// --pallet -// pallet-collator-selection - -#![cfg_attr(rustfmt, rustfmt_skip)] -#![allow(unused_parens)] -#![allow(unused_imports)] - -use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; - -/// Weight functions for `pallet_collator_selection`. -pub struct WeightInfo(PhantomData); -impl pallet_collator_selection::WeightInfo for WeightInfo { - // Storage: Session NextKeys (r:1 w:0) - // Storage: CollatorSelection Invulnerables (r:0 w:1) - /// The range of component `b` is `[1, 100]`. - fn set_invulnerables(_b: u32, ) -> Weight { - Weight::from_ref_time(317_565_000 as u64) - .saturating_add(T::DbWeight::get().reads(100 as u64)) - .saturating_add(T::DbWeight::get().writes(1 as u64)) - } - // Storage: CollatorSelection DesiredCandidates (r:0 w:1) - fn set_desired_candidates() -> Weight { - Weight::from_ref_time(19_951_000 as u64) - .saturating_add(T::DbWeight::get().writes(1 as u64)) - } - // Storage: CollatorSelection CandidacyBond (r:0 w:1) - fn set_candidacy_bond() -> Weight { - Weight::from_ref_time(19_730_000 as u64) - .saturating_add(T::DbWeight::get().writes(1 as u64)) - } - fn register_as_candidate(c: u32) -> Weight { - Weight::from_ref_time(71_196_000 as u64) - // Standard Error: 0 - .saturating_add(Weight::from_ref_time(198_000 as u64).saturating_mul(c as u64)) - .saturating_add(T::DbWeight::get().reads(4 as u64)) - .saturating_add(T::DbWeight::get().writes(2 as u64)) - } - // Storage: CollatorSelection Candidates (r:1 w:1) - // Storage: CollatorSelection LastAuthoredBlock (r:0 w:1) - /// The range of component `c` is `[6, 1000]`. - fn leave_intent(_c: u32, ) -> Weight { - Weight::from_ref_time(181_302_000 as u64) - .saturating_add(T::DbWeight::get().reads(1 as u64)) - .saturating_add(T::DbWeight::get().writes(2 as u64)) - } - // Storage: System Account (r:2 w:2) - // Storage: System BlockWeight (r:1 w:1) - // Storage: CollatorSelection LastAuthoredBlock (r:0 w:1) - fn note_author() -> Weight { - Weight::from_ref_time(43_091_000 as u64) - .saturating_add(T::DbWeight::get().reads(3 as u64)) - .saturating_add(T::DbWeight::get().writes(4 as u64)) - } - // Storage: CollatorSelection Candidates (r:1 w:1) - // Storage: CollatorSelection LastAuthoredBlock (r:1000 w:1) - // Storage: System Account (r:1 w:1) - // Storage: CollatorSelection Invulnerables (r:1 w:0) - // Storage: System BlockWeight (r:1 w:1) - /// The range of component `r` is `[1, 1000]`. - /// The range of component `c` is `[1, 1000]`. - fn new_session(_r: u32, c: u32, ) -> Weight { - Weight::from_ref_time(28_111_000 as u64) - // Standard Error: 39_309 - .saturating_add(Weight::from_ref_time(3_055_761 as u64).saturating_mul(c as u64)) - .saturating_add(T::DbWeight::get().reads(4 as u64)) - .saturating_add(T::DbWeight::get().reads((1 as u64).saturating_mul(c as u64))) - .saturating_add(T::DbWeight::get().writes(1 as u64)) - } -} From f2ce40c38f86ff8d0f714b5fcb73a168c6e36aac Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Fri, 9 Dec 2022 17:58:35 +0800 Subject: [PATCH 040/189] Some adjustment (#120) * Fast runtime * Valid genesis exposure * Assets genesis --- node/Cargo.toml | 4 +++- node/src/chain_spec/crab.rs | 6 +++++- node/src/chain_spec/darwinia.rs | 6 +++++- node/src/chain_spec/pangolin.rs | 6 +++++- pallet/staking/src/lib.rs | 11 +++++++---- runtime/common/src/lib.rs | 10 ++++++++++ runtime/crab/Cargo.toml | 3 ++- runtime/crab/src/pallets/session.rs | 13 +++---------- runtime/crab/src/pallets/staking.rs | 4 +++- runtime/darwinia/Cargo.toml | 3 ++- runtime/darwinia/src/pallets/session.rs | 13 +++---------- runtime/darwinia/src/pallets/staking.rs | 4 +++- runtime/pangolin/Cargo.toml | 3 ++- runtime/pangolin/src/pallets/session.rs | 13 +++---------- runtime/pangolin/src/pallets/staking.rs | 4 +++- 15 files changed, 59 insertions(+), 44 deletions(-) diff --git a/node/Cargo.toml b/node/Cargo.toml index 5df5fe540..84f406205 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -99,7 +99,9 @@ substrate-prometheus-endpoint = { git = "https://github.com/paritytech/substrat try-runtime-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } [features] -default = ["darwinia-runtime/production"] +default = [] + +fast-runtime = [] runtime-benchmarks = [ # darwinia diff --git a/node/src/chain_spec/crab.rs b/node/src/chain_spec/crab.rs index 71165a9ca..223b21299 100644 --- a/node/src/chain_spec/crab.rs +++ b/node/src/chain_spec/crab.rs @@ -230,7 +230,11 @@ fn testnet_genesis( balances: endowed_accounts.iter().cloned().map(|k| (k, 100_000_000 * UNIT)).collect(), }, transaction_payment: Default::default(), - assets: Default::default(), + assets: AssetsConfig { + assets: vec![(AssetIds::CKton as _, array_bytes::hex_n_into_unchecked(ALITH), true, 1)], + metadata: vec![(AssetIds::CKton as _, b"Crab Commitment Token".to_vec(), b"CKTON".to_vec(), 18)], + ..Default::default() + }, // Consensus stuff. staking: StakingConfig { diff --git a/node/src/chain_spec/darwinia.rs b/node/src/chain_spec/darwinia.rs index 3a74c229c..99f6ee39c 100644 --- a/node/src/chain_spec/darwinia.rs +++ b/node/src/chain_spec/darwinia.rs @@ -230,7 +230,11 @@ fn testnet_genesis( balances: endowed_accounts.iter().cloned().map(|k| (k, 100_000_000 * UNIT)).collect(), }, transaction_payment: Default::default(), - assets: Default::default(), + assets: AssetsConfig { + assets: vec![(AssetIds::Kton as _, array_bytes::hex_n_into_unchecked(ALITH), true, 1)], + metadata: vec![(AssetIds::Kton as _, b"Darwinia Commitment Token".to_vec(), b"KTON".to_vec(), 18)], + ..Default::default() + }, // Consensus stuff. staking: StakingConfig { diff --git a/node/src/chain_spec/pangolin.rs b/node/src/chain_spec/pangolin.rs index 685500e62..31e26e5a6 100644 --- a/node/src/chain_spec/pangolin.rs +++ b/node/src/chain_spec/pangolin.rs @@ -153,7 +153,11 @@ pub fn genesis_config() -> ChainSpec { // Monetary stuff. balances: Default::default(), transaction_payment: Default::default(), - assets: Default::default(), + assets: AssetsConfig { + assets: vec![(AssetIds::PKton as _, array_bytes::hex_n_into_unchecked(ALITH), true, 1)], + metadata: vec![(AssetIds::PKton as _, b"Pangolin Commitment Token".to_vec(), b"PKTON".to_vec(), 18)], + ..Default::default() + }, // Consensus stuff. staking: StakingConfig { diff --git a/pallet/staking/src/lib.rs b/pallet/staking/src/lib.rs index 68acb805f..a12c08a06 100644 --- a/pallet/staking/src/lib.rs +++ b/pallet/staking/src/lib.rs @@ -328,10 +328,13 @@ pub mod pallet { >::put(self.elapsed_time); >::put(self.collator_count); - self.collators.iter().cloned().for_each(|(who, stake)| { - >::stake(RawOrigin::Signed(who.clone()).into(), stake, 0, Vec::new()) - .unwrap(); - >::collect(RawOrigin::Signed(who).into(), Default::default()).unwrap(); + self.collators.iter().for_each(|(who, stake)| { + >::stake(RawOrigin::Signed(who.to_owned()).into(), *stake, 0, Vec::new()) + .expect("[pallet::staking] 0, genesis must be built; qed"); + >::collect(RawOrigin::Signed(who.to_owned()).into(), Default::default()) + .expect("[pallet::staking] 1, genesis must be built; qed"); + >::nominate(RawOrigin::Signed(who.to_owned()).into(), who.to_owned()) + .expect("[pallet::staking] 2, genesis must be built; qed"); }); } } diff --git a/runtime/common/src/lib.rs b/runtime/common/src/lib.rs index 1b10adbd4..63fbc1757 100644 --- a/runtime/common/src/lib.rs +++ b/runtime/common/src/lib.rs @@ -26,3 +26,13 @@ pub mod xcm_configs; pub use bp_darwinia_core as bp_crab; pub use bp_darwinia_core as bp_darwinia; pub use bp_darwinia_core as bp_pangolin; + +#[macro_export] +macro_rules! fast_runtime_or_not { + ($name:ident, $development_type:ty, $production_type:ty) => { + #[cfg(feature = "fast-runtime")] + type $name = $development_type; + #[cfg(not(feature = "fast-runtime"))] + type $name = $production_type; + }; +} diff --git a/runtime/crab/Cargo.toml b/runtime/crab/Cargo.toml index 83a6af4b5..ecd97eb63 100644 --- a/runtime/crab/Cargo.toml +++ b/runtime/crab/Cargo.toml @@ -128,7 +128,6 @@ frame-try-runtime = { optional = true, default-features = false, git = " [features] default = ["std"] -production = [] std = [ # crates.io "codec/std", @@ -241,6 +240,8 @@ std = [ ] +fast-runtime = [] + runtime-benchmarks = [ # crates.io "array-bytes", diff --git a/runtime/crab/src/pallets/session.rs b/runtime/crab/src/pallets/session.rs index bb36bdc36..3e16fbf61 100644 --- a/runtime/crab/src/pallets/session.rs +++ b/runtime/crab/src/pallets/session.rs @@ -25,16 +25,9 @@ sp_runtime::impl_opaque_keys! { } } -#[cfg(feature = "production")] -frame_support::parameter_types! { - pub const Period: u32 = 6 * HOURS; - pub const Offset: u32 = 0; -} -#[cfg(not(feature = "production"))] -frame_support::parameter_types! { - pub const Period: u32 = 2 * MINUTES; - pub const Offset: u32 = 0; -} +fast_runtime_or_not!(Period, ConstU32<{ 2 * MINUTES }>, ConstU32<{ 6 * HOURS }>); + +type Offset = ConstU32<0>; impl pallet_session::Config for Runtime { type Keys = SessionKeys; diff --git a/runtime/crab/src/pallets/staking.rs b/runtime/crab/src/pallets/staking.rs index b705f2502..b6dc61e3a 100644 --- a/runtime/crab/src/pallets/staking.rs +++ b/runtime/crab/src/pallets/staking.rs @@ -19,6 +19,8 @@ // darwinia use crate::*; +fast_runtime_or_not!(MinStakingDuration, ConstU32, ConstU32<{ 14 * DAYS }>); + pub enum CrabStaking {} impl darwinia_staking::Stake for CrabStaking { type AccountId = AccountId; @@ -75,7 +77,7 @@ impl darwinia_staking::Config for Runtime { type Kton = CKtonStaking; type MaxDeposits = ConstU32<16>; type MaxUnstakings = ConstU32<16>; - type MinStakingDuration = ConstU32<{ 14 * DAYS }>; + type MinStakingDuration = MinStakingDuration; type PayoutFraction = PayoutFraction; type RewardRemainder = Treasury; type Ring = CrabStaking; diff --git a/runtime/darwinia/Cargo.toml b/runtime/darwinia/Cargo.toml index 66de5bf10..54770923f 100644 --- a/runtime/darwinia/Cargo.toml +++ b/runtime/darwinia/Cargo.toml @@ -128,7 +128,6 @@ frame-try-runtime = { optional = true, default-features = false, git = " [features] default = ["std"] -production = [] std = [ # crates.io "codec/std", @@ -241,6 +240,8 @@ std = [ ] +fast-runtime = [] + runtime-benchmarks = [ # crates.io "array-bytes", diff --git a/runtime/darwinia/src/pallets/session.rs b/runtime/darwinia/src/pallets/session.rs index bb36bdc36..3e16fbf61 100644 --- a/runtime/darwinia/src/pallets/session.rs +++ b/runtime/darwinia/src/pallets/session.rs @@ -25,16 +25,9 @@ sp_runtime::impl_opaque_keys! { } } -#[cfg(feature = "production")] -frame_support::parameter_types! { - pub const Period: u32 = 6 * HOURS; - pub const Offset: u32 = 0; -} -#[cfg(not(feature = "production"))] -frame_support::parameter_types! { - pub const Period: u32 = 2 * MINUTES; - pub const Offset: u32 = 0; -} +fast_runtime_or_not!(Period, ConstU32<{ 2 * MINUTES }>, ConstU32<{ 6 * HOURS }>); + +type Offset = ConstU32<0>; impl pallet_session::Config for Runtime { type Keys = SessionKeys; diff --git a/runtime/darwinia/src/pallets/staking.rs b/runtime/darwinia/src/pallets/staking.rs index eca7c53cb..7db320a45 100644 --- a/runtime/darwinia/src/pallets/staking.rs +++ b/runtime/darwinia/src/pallets/staking.rs @@ -19,6 +19,8 @@ // darwinia use crate::*; +fast_runtime_or_not!(MinStakingDuration, ConstU32, ConstU32<{ 14 * DAYS }>); + pub enum RingStaking {} impl darwinia_staking::Stake for RingStaking { type AccountId = AccountId; @@ -75,7 +77,7 @@ impl darwinia_staking::Config for Runtime { type Kton = KtonStaking; type MaxDeposits = ConstU32<16>; type MaxUnstakings = ConstU32<16>; - type MinStakingDuration = ConstU32<{ 14 * DAYS }>; + type MinStakingDuration = MinStakingDuration; type PayoutFraction = PayoutFraction; type RewardRemainder = Treasury; type Ring = RingStaking; diff --git a/runtime/pangolin/Cargo.toml b/runtime/pangolin/Cargo.toml index 87a56f151..5e2edabc7 100644 --- a/runtime/pangolin/Cargo.toml +++ b/runtime/pangolin/Cargo.toml @@ -128,7 +128,6 @@ frame-try-runtime = { optional = true, default-features = false, git = " [features] default = ["std"] -production = [] std = [ # crates.io "codec/std", @@ -296,6 +295,8 @@ runtime-benchmarks = [ "frame-system-benchmarking/runtime-benchmarks", ] +fast-runtime = [] + try-runtime = [ # cumulus "cumulus-pallet-aura-ext/try-runtime", diff --git a/runtime/pangolin/src/pallets/session.rs b/runtime/pangolin/src/pallets/session.rs index bb36bdc36..3e16fbf61 100644 --- a/runtime/pangolin/src/pallets/session.rs +++ b/runtime/pangolin/src/pallets/session.rs @@ -25,16 +25,9 @@ sp_runtime::impl_opaque_keys! { } } -#[cfg(feature = "production")] -frame_support::parameter_types! { - pub const Period: u32 = 6 * HOURS; - pub const Offset: u32 = 0; -} -#[cfg(not(feature = "production"))] -frame_support::parameter_types! { - pub const Period: u32 = 2 * MINUTES; - pub const Offset: u32 = 0; -} +fast_runtime_or_not!(Period, ConstU32<{ 2 * MINUTES }>, ConstU32<{ 6 * HOURS }>); + +type Offset = ConstU32<0>; impl pallet_session::Config for Runtime { type Keys = SessionKeys; diff --git a/runtime/pangolin/src/pallets/staking.rs b/runtime/pangolin/src/pallets/staking.rs index 81c9a2f4c..d2b40f445 100644 --- a/runtime/pangolin/src/pallets/staking.rs +++ b/runtime/pangolin/src/pallets/staking.rs @@ -19,6 +19,8 @@ // darwinia use crate::*; +fast_runtime_or_not!(MinStakingDuration, ConstU32, ConstU32<{ 14 * DAYS }>); + pub enum PRingStaking {} impl darwinia_staking::Stake for PRingStaking { type AccountId = AccountId; @@ -75,7 +77,7 @@ impl darwinia_staking::Config for Runtime { type Kton = PKtonStaking; type MaxDeposits = ConstU32<16>; type MaxUnstakings = ConstU32<16>; - type MinStakingDuration = ConstU32<{ 14 * DAYS }>; + type MinStakingDuration = MinStakingDuration; type PayoutFraction = PayoutFraction; type RewardRemainder = Treasury; type Ring = PRingStaking; From 5b19e28739cd6e24286e686b8412e8cf6bd704d3 Mon Sep 17 00:00:00 2001 From: Guantong <04637@163.com> Date: Mon, 12 Dec 2022 17:17:56 +0800 Subject: [PATCH 041/189] Add `bridge_parachains` pallet (#122) * Update Grandpa Name * Add bridge parachain pallet * Correct bridge message verify * type HeadersToKeep * Fix CI * Fix CI --- Cargo.lock | 3 ++ node/src/chain_spec/crab.rs | 13 +++++-- node/src/chain_spec/darwinia.rs | 13 +++++-- runtime/crab/Cargo.toml | 21 ++++++----- runtime/crab/src/bridges_message/darwinia.rs | 18 ++++++---- runtime/crab/src/lib.rs | 3 +- runtime/crab/src/pallets/bridge_grandpa.rs | 8 +++-- runtime/crab/src/pallets/bridge_parachains.rs | 36 +++++++++++++++++++ runtime/crab/src/pallets/mod.rs | 3 ++ runtime/darwinia/Cargo.toml | 21 ++++++----- runtime/darwinia/src/bridges_message/crab.rs | 20 +++++++---- runtime/darwinia/src/lib.rs | 3 +- .../darwinia/src/pallets/bridge_grandpa.rs | 8 +++-- .../darwinia/src/pallets/bridge_parachains.rs | 36 +++++++++++++++++++ runtime/darwinia/src/pallets/mod.rs | 3 ++ 15 files changed, 163 insertions(+), 46 deletions(-) create mode 100644 runtime/crab/src/pallets/bridge_parachains.rs create mode 100644 runtime/darwinia/src/pallets/bridge_parachains.rs diff --git a/Cargo.lock b/Cargo.lock index ea18262d1..936fbc747 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1382,6 +1382,7 @@ dependencies = [ "pallet-bridge-dispatch", "pallet-bridge-grandpa", "pallet-bridge-messages", + "pallet-bridge-parachains", "pallet-collective", "pallet-democracy", "pallet-elections-phragmen", @@ -2522,6 +2523,7 @@ dependencies = [ "pallet-bridge-dispatch", "pallet-bridge-grandpa", "pallet-bridge-messages", + "pallet-bridge-parachains", "pallet-collective", "pallet-democracy", "pallet-elections-phragmen", @@ -6524,6 +6526,7 @@ dependencies = [ "bp-parachains", "bp-polkadot-core", "bp-runtime", + "frame-benchmarking", "frame-support", "frame-system", "pallet-bridge-grandpa", diff --git a/node/src/chain_spec/crab.rs b/node/src/chain_spec/crab.rs index 223b21299..caf865dd4 100644 --- a/node/src/chain_spec/crab.rs +++ b/node/src/chain_spec/crab.rs @@ -193,7 +193,8 @@ pub fn genesis_config() -> ChainSpec { base_fee: Default::default(), // S2S stuff. - bridge_darwinia_grandpa: Default::default(), + bridge_polkadot_grandpa: Default::default(), + bridge_polkadot_parachain: Default::default(), bridge_darwinia_messages: Default::default(), darwinia_fee_market: Default::default(), } @@ -232,7 +233,12 @@ fn testnet_genesis( transaction_payment: Default::default(), assets: AssetsConfig { assets: vec![(AssetIds::CKton as _, array_bytes::hex_n_into_unchecked(ALITH), true, 1)], - metadata: vec![(AssetIds::CKton as _, b"Crab Commitment Token".to_vec(), b"CKTON".to_vec(), 18)], + metadata: vec![( + AssetIds::CKton as _, + b"Crab Commitment Token".to_vec(), + b"CKTON".to_vec(), + 18, + )], ..Default::default() }, @@ -320,7 +326,8 @@ fn testnet_genesis( base_fee: Default::default(), // S2S stuff. - bridge_darwinia_grandpa: Default::default(), + bridge_polkadot_grandpa: Default::default(), + bridge_polkadot_parachain: Default::default(), bridge_darwinia_messages: Default::default(), darwinia_fee_market: Default::default(), } diff --git a/node/src/chain_spec/darwinia.rs b/node/src/chain_spec/darwinia.rs index 99f6ee39c..ea3ed8dc7 100644 --- a/node/src/chain_spec/darwinia.rs +++ b/node/src/chain_spec/darwinia.rs @@ -193,7 +193,8 @@ pub fn genesis_config() -> ChainSpec { base_fee: Default::default(), // S2S stuff. - bridge_crab_grandpa: Default::default(), + bridge_kusama_grandpa: Default::default(), + bridge_kusama_parachain: Default::default(), bridge_crab_messages: Default::default(), crab_fee_market: Default::default(), } @@ -232,7 +233,12 @@ fn testnet_genesis( transaction_payment: Default::default(), assets: AssetsConfig { assets: vec![(AssetIds::Kton as _, array_bytes::hex_n_into_unchecked(ALITH), true, 1)], - metadata: vec![(AssetIds::Kton as _, b"Darwinia Commitment Token".to_vec(), b"KTON".to_vec(), 18)], + metadata: vec![( + AssetIds::Kton as _, + b"Darwinia Commitment Token".to_vec(), + b"KTON".to_vec(), + 18, + )], ..Default::default() }, @@ -320,7 +326,8 @@ fn testnet_genesis( base_fee: Default::default(), // S2S stuff. - bridge_crab_grandpa: Default::default(), + bridge_kusama_grandpa: Default::default(), + bridge_kusama_parachain: Default::default(), bridge_crab_messages: Default::default(), crab_fee_market: Default::default(), } diff --git a/runtime/crab/Cargo.toml b/runtime/crab/Cargo.toml index ecd97eb63..e918c0331 100644 --- a/runtime/crab/Cargo.toml +++ b/runtime/crab/Cargo.toml @@ -48,15 +48,16 @@ darwinia-staking = { default-features = false, path = "../../pa dc-primitives = { default-features = false, path = "../../core/primitives" } # darwinia-messages-substrate -bp-message-dispatch = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } -bp-messages = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } -bp-polkadot-core = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } -bp-runtime = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } -bridge-runtime-common = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } -pallet-bridge-dispatch = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } -pallet-bridge-grandpa = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } -pallet-bridge-messages = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } -pallet-fee-market = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } +bp-message-dispatch = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } +bp-messages = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } +bp-polkadot-core = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } +bp-runtime = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } +bridge-runtime-common = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } +pallet-bridge-dispatch = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } +pallet-bridge-grandpa = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } +pallet-bridge-messages = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } +pallet-bridge-parachains = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } +pallet-fee-market = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } # frontier fp-rpc = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } @@ -168,6 +169,7 @@ std = [ "pallet-bridge-dispatch/std", "pallet-bridge-grandpa/std", "pallet-bridge-messages/std", + "pallet-bridge-parachains/std", "pallet-fee-market/std", # frontier @@ -256,6 +258,7 @@ runtime-benchmarks = [ "bridge-runtime-common/runtime-benchmarks", "pallet-bridge-grandpa/runtime-benchmarks", "pallet-bridge-messages/runtime-benchmarks", + "pallet-bridge-parachains/runtime-benchmarks", "pallet-fee-market/runtime-benchmarks", # frontier diff --git a/runtime/crab/src/bridges_message/darwinia.rs b/runtime/crab/src/bridges_message/darwinia.rs index e9883b2e4..20ea1e71f 100644 --- a/runtime/crab/src/bridges_message/darwinia.rs +++ b/runtime/crab/src/bridges_message/darwinia.rs @@ -25,6 +25,7 @@ use sp_runtime::{FixedPointNumber, FixedU128}; // darwinia use crate::*; use bp_messages::{source_chain::*, target_chain::*, *}; +use bp_polkadot_core::parachains::ParaId; use bp_runtime::*; use bridge_runtime_common::{ lanes::*, @@ -155,11 +156,12 @@ impl TargetHeaderChain::Ac fn verify_messages_delivery_proof( proof: Self::MessagesDeliveryProof, ) -> Result<(LaneId, InboundLaneData), Self::Error> { - source::verify_messages_delivery_proof::< + source::verify_messages_delivery_proof_from_parachain::< WithDarwiniaMessageBridge, + bp_darwinia::Header, Runtime, - WithDarwiniaGrandpa, - >(proof) + WithPolkadotParachainsInstance, + >(ParaId(2046), proof) } } impl SourceHeaderChain<::Balance> for Darwinia { @@ -170,9 +172,11 @@ impl SourceHeaderChain<::Balance> for Darwinia { proof: Self::MessagesProof, messages_count: u32, ) -> Result::Balance>>, Self::Error> { - target::verify_messages_proof::( - proof, - messages_count, - ) + target::verify_messages_proof_from_parachain::< + WithDarwiniaMessageBridge, + bp_darwinia::Header, + Runtime, + WithPolkadotParachainsInstance, + >(ParaId(2046), proof, messages_count) } } diff --git a/runtime/crab/src/lib.rs b/runtime/crab/src/lib.rs index d379aa5b2..6e8cdab54 100644 --- a/runtime/crab/src/lib.rs +++ b/runtime/crab/src/lib.rs @@ -316,7 +316,8 @@ frame_support::construct_runtime! { MessageTransact: darwinia_message_transact = 39, // S2S stuff. - BridgeDarwiniaGrandpa: pallet_bridge_grandpa:: = 35, + BridgePolkadotGrandpa: pallet_bridge_grandpa:: = 35, + BridgePolkadotParachain: pallet_bridge_parachains:: = 42, BridgeDarwiniaMessages: pallet_bridge_messages:: = 36, BridgeDarwiniaDispatch: pallet_bridge_dispatch:: = 37, DarwiniaFeeMarket: pallet_fee_market:: = 38 diff --git a/runtime/crab/src/pallets/bridge_grandpa.rs b/runtime/crab/src/pallets/bridge_grandpa.rs index 8fdfa09d4..986228c63 100644 --- a/runtime/crab/src/pallets/bridge_grandpa.rs +++ b/runtime/crab/src/pallets/bridge_grandpa.rs @@ -16,14 +16,16 @@ // You should have received a copy of the GNU General Public License // along with Darwinia. If not, see . -pub use pallet_bridge_grandpa::Instance1 as WithDarwiniaGrandpa; +pub use pallet_bridge_grandpa::Instance1 as WithPolkadotGrandpa; // darwinia use crate::*; -impl pallet_bridge_grandpa::Config for Runtime { +pub type PolkadotHeadersToKeep = ConstU32<500>; + +impl pallet_bridge_grandpa::Config for Runtime { type BridgedChain = bp_darwinia::DarwiniaLike; - type HeadersToKeep = ConstU32<500>; + type HeadersToKeep = PolkadotHeadersToKeep; type MaxBridgedAuthorities = (); type MaxBridgedHeaderSize = (); type MaxRequests = ConstU32<50>; diff --git a/runtime/crab/src/pallets/bridge_parachains.rs b/runtime/crab/src/pallets/bridge_parachains.rs new file mode 100644 index 000000000..3c0190d20 --- /dev/null +++ b/runtime/crab/src/pallets/bridge_parachains.rs @@ -0,0 +1,36 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +pub use pallet_bridge_parachains::Instance1 as WithPolkadotParachainsInstance; + +// darwinia +use crate::*; + +frame_support::parameter_types! { + pub const ParasPalletName: &'static str = bp_polkadot_core::parachains::PARAS_PALLET_NAME; +} + +impl pallet_bridge_parachains::Config for Runtime { + type BridgesGrandpaPalletInstance = WithPolkadotGrandpa; + type HeadsToKeep = PolkadotHeadersToKeep; + type MaxParaHeadSize = ConstU32<1024>; + type ParasPalletName = ParasPalletName; + type RuntimeEvent = RuntimeEvent; + type TrackedParachains = frame_support::traits::Everything; + type WeightInfo = (); +} diff --git a/runtime/crab/src/pallets/mod.rs b/runtime/crab/src/pallets/mod.rs index a64ad0db0..ed2a23a2f 100644 --- a/runtime/crab/src/pallets/mod.rs +++ b/runtime/crab/src/pallets/mod.rs @@ -117,5 +117,8 @@ pub use bridge_grandpa::*; mod bridge_messages; pub use bridge_messages::*; +mod bridge_parachains; +pub use bridge_parachains::*; + mod fee_market; pub use fee_market::*; diff --git a/runtime/darwinia/Cargo.toml b/runtime/darwinia/Cargo.toml index 54770923f..10cd885a5 100644 --- a/runtime/darwinia/Cargo.toml +++ b/runtime/darwinia/Cargo.toml @@ -48,15 +48,16 @@ darwinia-staking = { default-features = false, path = "../../pa dc-primitives = { default-features = false, path = "../../core/primitives" } # darwinia-messages-substrate -bp-message-dispatch = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } -bp-messages = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } -bp-polkadot-core = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } -bp-runtime = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } -bridge-runtime-common = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } -pallet-bridge-dispatch = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } -pallet-bridge-grandpa = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } -pallet-bridge-messages = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } -pallet-fee-market = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } +bp-message-dispatch = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } +bp-messages = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } +bp-polkadot-core = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } +bp-runtime = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } +bridge-runtime-common = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } +pallet-bridge-dispatch = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } +pallet-bridge-grandpa = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } +pallet-bridge-messages = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } +pallet-bridge-parachains = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } +pallet-fee-market = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } # frontier fp-rpc = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } @@ -168,6 +169,7 @@ std = [ "pallet-bridge-dispatch/std", "pallet-bridge-grandpa/std", "pallet-bridge-messages/std", + "pallet-bridge-parachains/std", "pallet-fee-market/std", # frontier @@ -256,6 +258,7 @@ runtime-benchmarks = [ "bridge-runtime-common/runtime-benchmarks", "pallet-bridge-grandpa/runtime-benchmarks", "pallet-bridge-messages/runtime-benchmarks", + "pallet-bridge-parachains/runtime-benchmarks", "pallet-fee-market/runtime-benchmarks", # frontier diff --git a/runtime/darwinia/src/bridges_message/crab.rs b/runtime/darwinia/src/bridges_message/crab.rs index dde6a12f8..b3772962d 100644 --- a/runtime/darwinia/src/bridges_message/crab.rs +++ b/runtime/darwinia/src/bridges_message/crab.rs @@ -25,6 +25,7 @@ use sp_runtime::{FixedPointNumber, FixedU128}; // darwinia use crate::*; use bp_messages::{source_chain::*, target_chain::*, *}; +use bp_polkadot_core::parachains::ParaId; use bp_runtime::*; use bridge_runtime_common::{ lanes::*, @@ -149,9 +150,12 @@ impl TargetHeaderChain::Accoun fn verify_messages_delivery_proof( proof: Self::MessagesDeliveryProof, ) -> Result<(LaneId, InboundLaneData), Self::Error> { - source::verify_messages_delivery_proof::( - proof, - ) + source::verify_messages_delivery_proof_from_parachain::< + WithCrabMessageBridge, + bp_crab::Header, + Runtime, + WithKusamaParachainsInstance, + >(ParaId(2105), proof) } } impl SourceHeaderChain<::Balance> for Crab { @@ -162,9 +166,11 @@ impl SourceHeaderChain<::Balance> for Crab { proof: Self::MessagesProof, messages_count: u32, ) -> Result::Balance>>, Self::Error> { - target::verify_messages_proof::( - proof, - messages_count, - ) + target::verify_messages_proof_from_parachain::< + WithCrabMessageBridge, + bp_crab::Header, + Runtime, + WithKusamaParachainsInstance, + >(ParaId(2105), proof, messages_count) } } diff --git a/runtime/darwinia/src/lib.rs b/runtime/darwinia/src/lib.rs index c1f694ab2..1afd451c0 100644 --- a/runtime/darwinia/src/lib.rs +++ b/runtime/darwinia/src/lib.rs @@ -316,7 +316,8 @@ frame_support::construct_runtime! { MessageTransact: darwinia_message_transact = 39, // S2S stuff. - BridgeCrabGrandpa: pallet_bridge_grandpa:: = 35, + BridgeKusamaGrandpa: pallet_bridge_grandpa:: = 35, + BridgeKusamaParachain: pallet_bridge_parachains:: = 42, BridgeCrabMessages: pallet_bridge_messages:: = 36, BridgeCrabDispatch: pallet_bridge_dispatch:: = 37, CrabFeeMarket: pallet_fee_market:: = 38 diff --git a/runtime/darwinia/src/pallets/bridge_grandpa.rs b/runtime/darwinia/src/pallets/bridge_grandpa.rs index 6d64b9f8f..e1a8b7358 100644 --- a/runtime/darwinia/src/pallets/bridge_grandpa.rs +++ b/runtime/darwinia/src/pallets/bridge_grandpa.rs @@ -16,14 +16,16 @@ // You should have received a copy of the GNU General Public License // along with Darwinia. If not, see . -pub use pallet_bridge_grandpa::Instance1 as WithCrabGrandpa; +pub use pallet_bridge_grandpa::Instance1 as WithKusamaGrandpa; // darwinia use crate::*; -impl pallet_bridge_grandpa::Config for Runtime { +pub type KusamaHeadersToKeep = ConstU32<500>; + +impl pallet_bridge_grandpa::Config for Runtime { type BridgedChain = bp_crab::DarwiniaLike; - type HeadersToKeep = ConstU32<500>; + type HeadersToKeep = KusamaHeadersToKeep; type MaxBridgedAuthorities = (); type MaxBridgedHeaderSize = (); type MaxRequests = ConstU32<50>; diff --git a/runtime/darwinia/src/pallets/bridge_parachains.rs b/runtime/darwinia/src/pallets/bridge_parachains.rs new file mode 100644 index 000000000..810f25788 --- /dev/null +++ b/runtime/darwinia/src/pallets/bridge_parachains.rs @@ -0,0 +1,36 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +pub use pallet_bridge_parachains::Instance1 as WithKusamaParachainsInstance; + +// darwinia +use crate::*; + +frame_support::parameter_types! { + pub const ParasPalletName: &'static str = bp_polkadot_core::parachains::PARAS_PALLET_NAME; +} + +impl pallet_bridge_parachains::Config for Runtime { + type BridgesGrandpaPalletInstance = WithKusamaGrandpa; + type HeadsToKeep = KusamaHeadersToKeep; + type MaxParaHeadSize = ConstU32<1024>; + type ParasPalletName = ParasPalletName; + type RuntimeEvent = RuntimeEvent; + type TrackedParachains = frame_support::traits::Everything; + type WeightInfo = (); +} diff --git a/runtime/darwinia/src/pallets/mod.rs b/runtime/darwinia/src/pallets/mod.rs index a64ad0db0..ed2a23a2f 100644 --- a/runtime/darwinia/src/pallets/mod.rs +++ b/runtime/darwinia/src/pallets/mod.rs @@ -117,5 +117,8 @@ pub use bridge_grandpa::*; mod bridge_messages; pub use bridge_messages::*; +mod bridge_parachains; +pub use bridge_parachains::*; + mod fee_market; pub use fee_market::*; From d4922e1162d0aa4cce7da75c655860e8e84d2abb Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Wed, 14 Dec 2022 16:49:23 +0800 Subject: [PATCH 042/189] Account genesis (#123) * Handle EVM accounts and pruge locks Signed-off-by: Xavier Lau * Refactor account genesis * Purge locks * Update scope * Update special accounts list Signed-off-by: Xavier Lau --- tool/state-processor/Cargo.lock | 10 +- tool/state-processor/Cargo.toml | 4 +- tool/state-processor/src/balances/mod.rs | 112 ++++++++---- tool/state-processor/src/main.rs | 51 +++++- tool/state-processor/src/system/README.md | 36 ++++ tool/state-processor/src/system/mod.rs | 208 +++++++++++----------- tool/state-processor/src/vesting/mod.rs | 8 + 7 files changed, 281 insertions(+), 148 deletions(-) create mode 100644 tool/state-processor/src/system/README.md create mode 100644 tool/state-processor/src/vesting/mod.rs diff --git a/tool/state-processor/Cargo.lock b/tool/state-processor/Cargo.lock index ba158446d..8365b0cd8 100644 --- a/tool/state-processor/Cargo.lock +++ b/tool/state-processor/Cargo.lock @@ -23,6 +23,12 @@ version = "4.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a913633b0c922e6b745072795f50d90ebea78ba31a57e2ac8c2fc7b50950949" +[[package]] +name = "array-bytes" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22f72e9d6fac4bc80778ea470b20197b88d28c292bb7d60c3fb099280003cd19" + [[package]] name = "arrayvec" version = "0.4.12" @@ -439,7 +445,7 @@ name = "state-processor" version = "0.0.0" dependencies = [ "anyhow", - "array-bytes", + "array-bytes 6.0.0", "fxhash", "log", "parity-scale-codec", @@ -484,7 +490,7 @@ name = "substorager" version = "0.9.0-rc16" source = "git+https://github.com/hack-ink/subalfred#de1ed2b16b0b2c3ceeb61b1f9168401bc0ace51d" dependencies = [ - "array-bytes", + "array-bytes 4.1.0", "subhasher", ] diff --git a/tool/state-processor/Cargo.toml b/tool/state-processor/Cargo.toml index 829a5f9e8..eb70123db 100644 --- a/tool/state-processor/Cargo.toml +++ b/tool/state-processor/Cargo.toml @@ -1,20 +1,20 @@ [package] authors = ["Xavier Lau "] edition = "2021" -license = "GPL-3.0" name = "state-processor" version = "0.0.0" [dependencies] # crates.io anyhow = { version = "1.0" } -array-bytes = { version = "4.1" } +array-bytes = { version = "6.0" } fxhash = { version = "0.2" } log = { version = "0.4" } parity-scale-codec = { version = "3.2", features = ["derive"] } pretty_env_logger = { version = "0.4" } serde = { version = "1.0" } serde_json = { version = "1.0" } + # hack-ink subhasher = { git = "https://github.com/hack-ink/subalfred" } subspector = { git = "https://github.com/hack-ink/subalfred" } diff --git a/tool/state-processor/src/balances/mod.rs b/tool/state-processor/src/balances/mod.rs index ec9d4dbc5..be52f97fe 100644 --- a/tool/state-processor/src/balances/mod.rs +++ b/tool/state-processor/src/balances/mod.rs @@ -1,37 +1,89 @@ // darwinia use crate::*; +type Locks = Vec; + impl Processor { - pub fn process_balances( - &mut self, - ring_locks: &mut Map>, - kton_locks: &mut Map>, - ) -> &mut Self { - log::info!("take solo balance locks"); + pub fn process_balances(&mut self) -> (u128, u128) { + let mut solo_ring_total_issuance = u128::default(); + let mut kton_total_issuance = u128::default(); + let mut solo_ring_locks = >::default(); + let mut solo_kton_locks = >::default(); + let mut para_ring_locks = >::default(); + let mut para_ring_total_issuance = u128::default(); + + log::info!("take solo balances total issuances and locks"); self.solo_state - .take::, _>( - b"Balances", - b"Locks", - ring_locks, - get_blake2_128_concat_suffix, - ) - .take::, _>( - b"Kton", - b"Locks", - kton_locks, - get_blake2_128_concat_suffix, - ); - - // --- - // Currently, there are only fee-market locks. - // I suggest shutting down the fee-market before merging. - // So, we could ignore the para balance locks migration. - // --- - - log::info!("adjust solo balance lock decimals"); - ring_locks.iter_mut().for_each(|(_, v)| v.iter_mut().for_each(|l| l.amount *= GWEI)); - kton_locks.iter_mut().for_each(|(_, v)| v.iter_mut().for_each(|l| l.amount *= GWEI)); - - self + .take_value(b"Balances", b"TotalIssuance", &mut solo_ring_total_issuance) + .take_value(b"Kton", b"TotalIssuance", &mut kton_total_issuance) + .take_map(b"Balances", b"Locks", &mut solo_ring_locks, get_hashed_key) + .take_map(b"Kton", b"Locks", &mut solo_kton_locks, get_hashed_key); + + log::info!("prune solo balance locks"); + prune(&mut solo_ring_locks); + prune(&mut solo_kton_locks); + + log::info!("adjust solo balances items' decimals"); + solo_ring_total_issuance *= GWEI; + kton_total_issuance *= GWEI; + // solo_ring_locks.iter_mut().for_each(|(_, v)| v.iter_mut().for_each(|l| l.amount *= + // GWEI)); solo_kton_locks.iter_mut().for_each(|(_, v)| v.iter_mut().for_each(|l| l.amount + // *= GWEI)); + + log::info!("take para balances total issuances and locks"); + self.para_state + .take_value(b"Balances", b"TotalIssuance", &mut para_ring_total_issuance) + .take_map(b"Balances", b"Locks", &mut para_ring_locks, get_hashed_key); + + log::info!("check solo ring locks, there should not be any `solo_ring_locks`"); + check_locks(solo_ring_locks); + log::info!("check solo kton locks, there should not be any `solo_kton_locks`"); + check_locks(solo_kton_locks); + log::info!("check para locks, there should not be any `para_ring_locks`"); + check_locks(para_ring_locks); + + (solo_ring_total_issuance + para_ring_total_issuance, kton_total_issuance) } } + +fn prune(locks: &mut Map) { + // https://github.dev/darwinia-network/darwinia-common/blob/6a9392cfb9fe2c99b1c2b47d0c36125d61991bb7/frame/staking/src/primitives.rs#L39 + const STAKING: [u8; 8] = *b"da/staki"; + // https://github.dev/darwinia-network/darwinia/blob/2d1c1436594b2c397d450e317c35eb16c71105d6/runtime/crab/src/pallets/elections_phragmen.rs#L8 + const PHRAGMEN_ELECTION: [u8; 8] = *b"phrelect"; + // https://github.dev/paritytech/substrate/blob/19162e43be45817b44c7d48e50d03f074f60fbf4/frame/democracy/src/lib.rs#L190 + const DEMOCRACY: [u8; 8] = *b"democrac"; + // https://github.dev/paritytech/substrate/blob/19162e43be45817b44c7d48e50d03f074f60fbf4/frame/vesting/src/lib.rs#L86 + const VESTING: [u8; 8] = *b"vesting "; + const RELAY_AUTHORITY: [u8; 8] = *b"ethrauth"; + // https://github.dev/darwinia-network/darwinia/blob/2d1c1436594b2c397d450e317c35eb16c71105d6/runtime/crab/src/pallets/fee_market.rs#L35 + const FEE_MARKET_0: [u8; 8] = *b"da/feelf"; + // https://github.dev/darwinia-network/darwinia/blob/2d1c1436594b2c397d450e317c35eb16c71105d6/runtime/crab/src/pallets/fee_market.rs#L36 + const FEE_MARKET_1: [u8; 8] = *b"da/feecp"; + // https://github.dev/darwinia-network/darwinia/blob/2d1c1436594b2c397d450e317c35eb16c71105d6/runtime/darwinia/src/pallets/fee_market.rs#L37 + const FEE_MARKET_2: [u8; 8] = *b"da/feedp"; + + locks.retain(|k, v| { + v.retain(|l| match l.id { + STAKING | PHRAGMEN_ELECTION | DEMOCRACY | VESTING | RELAY_AUTHORITY | FEE_MARKET_0 + | FEE_MARKET_1 | FEE_MARKET_2 => false, + id => { + log::error!( + "pruned unknown lock id({}) of account({})", + String::from_utf8_lossy(&id), + get_last_64(k) + ); + + false + }, + }); + + !v.is_empty() + }); +} + +fn check_locks(locks: Map) { + locks + .into_iter() + .for_each(|(k, _)| log::error!("found unexpected locks of account({})", get_last_64(&k))); +} diff --git a/tool/state-processor/src/main.rs b/tool/state-processor/src/main.rs index 79d76bf67..bb0bbbb6f 100644 --- a/tool/state-processor/src/main.rs +++ b/tool/state-processor/src/main.rs @@ -1,5 +1,6 @@ mod balances; mod system; +mod vesting; mod type_registry; use type_registry::*; @@ -45,6 +46,7 @@ impl Processor { fn process(mut self) -> Result<()> { self.process_system(); + self.process_vesting(); self.save() } @@ -108,7 +110,23 @@ impl State { self } - fn take( + fn take_value(&mut self, pallet: &[u8], item: &[u8], value: &mut D) -> &mut Self + where + D: Decode, + { + let key = item_key(pallet, item); + + if let Some(v) = self.0.remove(&key) { + match decode(&v) { + Ok(v) => *value = v, + Err(e) => log::warn!("failed to decode `{key}:{v}`, due to `{e}`"), + } + } + + self + } + + fn take_map( &mut self, pallet: &[u8], item: &[u8], @@ -119,6 +137,7 @@ impl State { D: Decode, F: Fn(&str, &str) -> String, { + let len = buffer.len(); let item_key = item_key(pallet, item); self.0.retain(|full_key, v| { @@ -136,6 +155,14 @@ impl State { } }); + if buffer.len() == len { + log::info!( + "no new item inserted for {}::{}", + String::from_utf8_lossy(pallet), + String::from_utf8_lossy(item) + ); + } + self } } @@ -157,7 +184,7 @@ where fn pallet_key(pallet: &[u8]) -> String { let prefix = subhasher::twox128(pallet); - array_bytes::bytes2hex("0x", &prefix) + array_bytes::bytes2hex("0x", prefix) } fn item_key(pallet: &[u8], item: &[u8]) -> String { @@ -166,6 +193,10 @@ fn item_key(pallet: &[u8], item: &[u8]) -> String { array_bytes::bytes2hex("0x", &k.0) } +fn full_key(pallet: &[u8], item: &[u8], hash: &str) -> String { + format!("{}{hash}", item_key(pallet, item)) +} + fn encode_value(v: V) -> String where V: Encode, @@ -182,13 +213,17 @@ where Ok(D::decode(&mut &*v)?) } -// twox128(pallet) + twox128(item) + blake2_256_concat(item_key) -> blake2_256_concat(item_key) -fn get_blake2_128_concat_suffix(full_key: &str, item_key: &str) -> String { +// twox128(pallet) + twox128(item) -> twox128(pallet) + twox128(item) +fn get_identity_key(key: &str, _: &str) -> String { + key.into() +} + +// twox128(pallet) + twox128(item) + *(item_key) -> *(item_key) +fn get_hashed_key(full_key: &str, item_key: &str) -> String { full_key.trim_start_matches(item_key).into() } -// twox128(pallet) + twox128(item) + blake2_256_concat(account_id_32) -> account_id_32 -#[allow(unused)] -fn get_concat_suffix(full_key: &str, _: &str) -> String { - format!("0x{}", &full_key[full_key.len() - 64..]) +// twox128(pallet) + twox128(item) + *_concat(account_id_32) -> account_id_32 +fn get_last_64(key: &str) -> String { + format!("0x{}", &key[key.len() - 64..]) } diff --git a/tool/state-processor/src/system/README.md b/tool/state-processor/src/system/README.md new file mode 100644 index 000000000..3ced4bf12 --- /dev/null +++ b/tool/state-processor/src/system/README.md @@ -0,0 +1,36 @@ +### Process steps +- take solo account infos and remaining balances + - merge solo remaining balances + - adjust solo balance decimals +- take para account infos +- process balances + - take solo balances total issuances and locks + - prune solo balance locks + - prune staking, phragmen election, democracy, vesting, relay authority, fee market locks + - check if there are any other locks + - adjust solo balances items' decimals + - take para balances total issuances and locks + - there should not be any locks on parachain +- use all previous data to build the new accounts and calculate total issuances + - merge solo and para account infos + - how to deal with the account references? - TODO +- set `Balances::TotalIssuance` + - compare the calculated one with the storage one + - remove para backing account - TODO + - check remaining sum - TODO + - XCM relate - TODO +- set KTON total issuances - TODO + - compare the calculated one with the storage one + - check remaining sum - TODO +- set accounts + - if is EVM address + - insert to `System::Account` + - if is Substrate address + - reset the nonce + - insert to `AccountMigration::Accounts` + - calculate misc frozen and fee frozen + +- some remaining accounts, bridge endpoint accounts - TODO +- special accounts - TODO + - parachain backing account 0x8c585F9791EE5b4B23fe82888cE576DBB69607eB + - bridge root account 0x726f6f7400000000000000000000000000000000 diff --git a/tool/state-processor/src/system/mod.rs b/tool/state-processor/src/system/mod.rs index 66977d038..ba0214515 100644 --- a/tool/state-processor/src/system/mod.rs +++ b/tool/state-processor/src/system/mod.rs @@ -22,80 +22,16 @@ impl Processor { // Balances storage items. // https://github.com/paritytech/substrate/blob/polkadot-v0.9.16/frame/balances/src/lib.rs#L486-L535 pub fn process_system(&mut self) -> &mut Self { + let solo_account_infos = self.process_solo_account_infos(); + let para_account_infos = self.process_para_account_infos(); + let (ring_total_issuance_storage, kton_total_issuance_storage) = self.process_balances(); let mut accounts = Map::default(); - let mut solo_account_infos = Map::default(); - let mut solo_ring_locks = Map::default(); - let mut solo_kton_locks = Map::default(); - let mut para_account_infos = Map::default(); - let mut remaining_ring = Map::default(); - let mut remaining_kton = Map::default(); - let mut ring_total_issuance = 0; - - log::info!("take solo and remaining balances"); - self.solo_state - .take::( - b"System", - b"Account", - &mut solo_account_infos, - get_blake2_128_concat_suffix, - ) - .take::( - b"Ethereum", - b"RemainingRingBalance", - &mut remaining_ring, - get_blake2_128_concat_suffix, - ) - .take::( - b"Ethereum", - b"RemainingKtonBalance", - &mut remaining_kton, - get_blake2_128_concat_suffix, - ); - - log::info!("take solo and para balance locks"); - self.process_balances(&mut solo_ring_locks, &mut solo_kton_locks); - - log::info!("take para balances"); - self.para_state.take::( - b"System", - b"Account", - &mut para_account_infos, - get_blake2_128_concat_suffix, - ); - - log::info!("adjust solo balance decimals"); - solo_account_infos.iter_mut().for_each(|(_, v)| { - v.data.free *= GWEI; - v.data.reserved *= GWEI; - v.data.free_kton_or_misc_frozen *= GWEI; - v.data.reserved_kton_or_fee_frozen *= GWEI; - }); - - log::info!("merge solo and remaining balances"); - remaining_ring.into_iter().for_each(|(k, v)| { - if let Some(a) = solo_account_infos.get_mut(&k) { - a.data.free += v; - } else { - log::warn!("`RemainingRingBalance({k})` not found"); - } - }); - remaining_kton.into_iter().for_each(|(k, v)| { - if let Some(a) = solo_account_infos.get_mut(&k) { - a.data.free_kton_or_misc_frozen += v; - } else { - log::warn!("`RemainingKtonBalance({k})` not found"); - } - }); + let mut ring_total_issuance = u128::default(); + let mut kton_total_issuance = u128::default(); log::info!("build accounts"); - log::info!("calculate ring total issuance"); + log::info!("calculate total issuance"); solo_account_infos.into_iter().for_each(|(k, v)| { - let ring_locks = solo_ring_locks.remove(&k).unwrap_or_default(); - let kton_locks = solo_kton_locks.remove(&k).unwrap_or_default(); - - ring_total_issuance += v.data.free; - ring_total_issuance += v.data.reserved; - accounts.insert( k.clone(), AccountAll { @@ -109,17 +45,19 @@ impl Processor { // --- ring: v.data.free, ring_reserved: v.data.reserved, - ring_locks, + ring_locks: Default::default(), kton: v.data.free_kton_or_misc_frozen, kton_reserved: v.data.reserved_kton_or_fee_frozen, - kton_locks, + kton_locks: Default::default(), }, ); - }); - para_account_infos.into_iter().for_each(|(k, v)| { + ring_total_issuance += v.data.free; ring_total_issuance += v.data.reserved; - + kton_total_issuance += v.data.free_kton_or_misc_frozen; + kton_total_issuance += v.data.reserved_kton_or_fee_frozen; + }); + para_account_infos.into_iter().for_each(|(k, v)| { accounts .entry(k.clone()) .and_modify(|a| { @@ -135,22 +73,27 @@ impl Processor { sufficients: v.sufficients, ring: v.data.free, ring_reserved: v.data.reserved, - ring_locks: Vec::new(), + ring_locks: Default::default(), kton: 0, kton_reserved: 0, - kton_locks: Vec::new(), + kton_locks: Default::default(), }); - }); - log::info!("check solo remaining locks"); - solo_ring_locks.into_iter().for_each(|(k, _)| log::warn!("ring_locks' owner({k}) dropped")); - solo_kton_locks.into_iter().for_each(|(k, _)| log::warn!("kton_locks' owner({k}) dropped")); + ring_total_issuance += v.data.free; + ring_total_issuance += v.data.reserved; + }); let state = &mut self.shell_chain_spec.genesis.raw.top; log::info!("set `Balances::TotalIssuance`"); + log::info!("ring_total_issuance({ring_total_issuance})"); + log::info!("ring_total_issuance_storage({ring_total_issuance_storage})"); state.insert(item_key(b"Balances", b"TotalIssuance"), encode_value(ring_total_issuance)); + log::info!("kton_total_issuance({kton_total_issuance})"); + log::info!("kton_total_issuance_storage({kton_total_issuance_storage})"); + // TODO: set KTON total issuance + log::info!("update ring misc frozen and fee frozen"); log::info!("set `System::Account`"); log::info!("set `Balances::Locks`"); @@ -163,38 +106,91 @@ impl Processor { data: AccountData { free: v.ring, reserved: v.ring_reserved, - free_kton_or_misc_frozen: 0, - reserved_kton_or_fee_frozen: 0, + free_kton_or_misc_frozen: Default::default(), + reserved_kton_or_fee_frozen: Default::default(), }, }; - // https://github.com/paritytech/substrate/blob/polkadot-v0.9.16/frame/balances/src/lib.rs#L945-L952 - // Update ring misc frozen and fee frozen. - for l in v.ring_locks.iter() { - if l.reasons == Reasons::All || l.reasons == Reasons::Misc { - a.data.free_kton_or_misc_frozen = a.data.free_kton_or_misc_frozen.max(l.amount); - } - if l.reasons == Reasons::All || l.reasons == Reasons::Fee { - a.data.reserved_kton_or_fee_frozen = - a.data.reserved_kton_or_fee_frozen.max(l.amount); - } + if is_evm_address(&k) { + state.insert(full_key(b"System", b"Account", &k), encode_value(a)); + + // TODO: migrate kton balances. + } else { + a.nonce = 0; + + state.insert(full_key(b"AccountMigration", b"Accounts", &k), encode_value(a)); } - // --- - // TODO: migrate kton locks. - // --- - - // Set `System::Account`. - state.insert(format!("{}{k}", item_key(b"System", b"Account")), encode_value(a)); - // Set `Balances::Locks`. - // Skip empty locks. - if !v.ring_locks.is_empty() { - state.insert( - format!("{}{k}", item_key(b"Balances", b"Locks")), - encode_value(v.ring_locks), + }); + + self + } + + fn process_solo_account_infos(&mut self) -> Map { + let mut account_infos = >::default(); + let mut remaining_ring = >::default(); + let mut remaining_kton = >::default(); + + log::info!("take solo account infos and remaining balances"); + self.solo_state + .take_map(b"System", b"Account", &mut account_infos, get_hashed_key) + .take_map(b"Ethereum", b"RemainingRingBalance", &mut remaining_ring, get_hashed_key) + .take_map(b"Ethereum", b"RemainingKtonBalance", &mut remaining_kton, get_hashed_key); + + log::info!("merge solo remaining balances"); + remaining_ring.into_iter().for_each(|(k, v)| { + if let Some(a) = account_infos.get_mut(&k) { + a.data.free += v; + } else { + log::error!( + "`Account({})` not found while merging `RemainingRingBalance`", + get_last_64(&k) + ); + } + }); + remaining_kton.into_iter().for_each(|(k, v)| { + if let Some(a) = account_infos.get_mut(&k) { + a.data.free_kton_or_misc_frozen += v; + } else { + log::error!( + "`Account({})` not found while merging `RemainingKtonBalance`", + get_last_64(&k) ); } }); - self + log::info!("adjust solo balance decimals"); + account_infos.iter_mut().for_each(|(_, v)| { + v.data.free *= GWEI; + v.data.reserved *= GWEI; + v.data.free_kton_or_misc_frozen *= GWEI; + v.data.reserved_kton_or_fee_frozen *= GWEI; + }); + + account_infos } + + fn process_para_account_infos(&mut self) -> Map { + let mut account_infos = >::default(); + + log::info!("take para account infos"); + self.para_state.take_map(b"System", b"Account", &mut account_infos, get_hashed_key); + + account_infos + } +} + +fn is_evm_address(address: &str) -> bool { + let address = array_bytes::hex2bytes_unchecked(address); + + address.starts_with(b"dvm:") + && address[1..31].iter().fold(address[0], |checksum, &byte| checksum ^ byte) == address[31] +} + +#[test] +fn verify_evm_address_checksum_should_work() { + // subalfred key 5ELRpquT7C3mWtjerpPfdmaGoSh12BL2gFCv2WczEcv6E1zL + // sub-seed + // public-key 0x64766d3a00000000000000b7de7f8c52ac75e036d05fda53a75cf12714a76973 + // Substrate 5ELRpquT7C3mWtjerpPfdmaGoSh12BL2gFCv2WczEcv6E1zL + assert!(is_evm_address("0x64766d3a00000000000000b7de7f8c52ac75e036d05fda53a75cf12714a76973")); } diff --git a/tool/state-processor/src/vesting/mod.rs b/tool/state-processor/src/vesting/mod.rs new file mode 100644 index 000000000..adcefb429 --- /dev/null +++ b/tool/state-processor/src/vesting/mod.rs @@ -0,0 +1,8 @@ +// darwinia +use crate::*; + +impl Processor { + pub fn process_vesting(&mut self) -> &mut Self { + self + } +} From 5b5a7d917ba9e2a40bb5c8c0526ac196a2b41f1d Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Wed, 14 Dec 2022 17:32:17 +0800 Subject: [PATCH 043/189] Vesting genesis (#127) * Handle EVM accounts and pruge locks Signed-off-by: Xavier Lau * Refactor account genesis * Purge locks * Update scope * Update special accounts list * Vesting genesis * Improve state management Signed-off-by: Xavier Lau --- Cargo.lock | 2 + pallet/account-migration/Cargo.toml | 6 ++- pallet/account-migration/src/lib.rs | 55 +++++++++++++++++++--- tool/state-processor/src/main.rs | 51 ++++++++++++++++++-- tool/state-processor/src/system/mod.rs | 12 +++-- tool/state-processor/src/vesting/README.md | 5 ++ tool/state-processor/src/vesting/mod.rs | 7 +++ 7 files changed, 122 insertions(+), 16 deletions(-) create mode 100644 tool/state-processor/src/vesting/README.md diff --git a/Cargo.lock b/Cargo.lock index 936fbc747..a9cf80ac6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2304,12 +2304,14 @@ dependencies = [ "frame-support", "frame-system", "pallet-balances", + "pallet-vesting", "parity-scale-codec", "scale-info", "sp-core", "sp-io", "sp-keyring", "sp-runtime", + "sp-std", ] [[package]] diff --git a/pallet/account-migration/Cargo.toml b/pallet/account-migration/Cargo.toml index 8981877e5..f9b908082 100644 --- a/pallet/account-migration/Cargo.toml +++ b/pallet/account-migration/Cargo.toml @@ -21,9 +21,11 @@ dc-primitives = { default-features = false, path = "../../core/primitives" } frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } pallet-balances = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-vesting = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } sp-io = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } [dev-dependencies] sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } @@ -42,7 +44,9 @@ std = [ "frame-support/std", "frame-system/std", "pallet-balances/std", + "pallet-vesting/std", "sp-core/std", - "sp-runtime/std", "sp-io/std", + "sp-runtime/std", + "sp-std/std", ] diff --git a/pallet/account-migration/src/lib.rs b/pallet/account-migration/src/lib.rs index 34316b5ed..b43f48e28 100644 --- a/pallet/account-migration/src/lib.rs +++ b/pallet/account-migration/src/lib.rs @@ -49,14 +49,20 @@ mod tests; // darwinia -use dc_primitives::{AccountId as AccountId20, Balance, Index}; +use dc_primitives::{AccountId as AccountId20, Balance, BlockNumber, Index}; // substrate -use frame_support::{log, pallet_prelude::*}; +use frame_support::{ + log, + pallet_prelude::*, + traits::{LockableCurrency, WithdrawReasons}, +}; use frame_system::{pallet_prelude::*, AccountInfo}; use pallet_balances::AccountData; +use pallet_vesting::VestingInfo; use sp_core::sr25519::{Public, Signature}; use sp_io::hashing; use sp_runtime::{traits::Verify, AccountId32}; +use sp_std::prelude::*; type Message = [u8; 32]; @@ -70,10 +76,12 @@ pub mod pallet { #[pallet::config] pub trait Config: frame_system::Config< - AccountId = AccountId20, - Index = Index, - AccountData = AccountData, - > + Index = Index, + BlockNumber = BlockNumber, + AccountId = AccountId20, + AccountData = AccountData, + > + pallet_balances::Config + + pallet_vesting::Config> { /// Override the [`frame_system::Config::RuntimeEvent`]. type RuntimeEvent: From + IsType<::RuntimeEvent>; @@ -90,16 +98,32 @@ pub mod pallet { Migrated { from: AccountId32, to: AccountId20 }, } + #[pallet::error] + pub enum Error { + /// Exceed maximum vesting count. + ExceedMaxVestings, + } + /// [`frame_system::Account`] data. + /// + /// #[pallet::storage] #[pallet::getter(fn account_of)] pub type Accounts = StorageMap<_, Identity, AccountId32, AccountInfo>>; + /// [`pallet_vesting::Vesting`] data. + /// + /// + #[pallet::storage] + #[pallet::unbounded] + #[pallet::getter(fn vesting_of)] + pub type Vestings = + StorageMap<_, Blake2_128Concat, AccountId32, Vec>>; + // TODO: identity storages // TODO: proxy storages // TODO: staking storages - // TODO: vesting storages #[pallet::call] impl Pallet { @@ -118,10 +142,27 @@ pub mod pallet { >::insert(to, account); + if let Some(vs) = >::get(&from) { + let locked = vs.iter().map(|v| v.locked()).sum(); + + >::insert( + to, + BoundedVec::try_from(vs).map_err(|_| >::ExceedMaxVestings)?, + ); + + // https://github.dev/paritytech/substrate/blob/19162e43be45817b44c7d48e50d03f074f60fbf4/frame/vesting/src/lib.rs#L248 + let reasons = WithdrawReasons::TRANSFER | WithdrawReasons::RESERVE; + + // https://github.dev/paritytech/substrate/blob/19162e43be45817b44c7d48e50d03f074f60fbf4/frame/vesting/src/lib.rs#L86 + >::set_lock(*b"vesting ", &to, locked, reasons); + } + Self::deposit_event(Event::Migrated { from, to }); Ok(()) } + + // TODO: migrate multi-sig } #[pallet::validate_unsigned] impl ValidateUnsigned for Pallet { diff --git a/tool/state-processor/src/main.rs b/tool/state-processor/src/main.rs index bb0bbbb6f..99bcf49a6 100644 --- a/tool/state-processor/src/main.rs +++ b/tool/state-processor/src/main.rs @@ -10,6 +10,7 @@ use std::{ env, fs::File, io::{Read, Write}, + mem, }; // crates.io use anyhow::Result; @@ -33,14 +34,18 @@ fn main() -> Result<()> { struct Processor { solo_state: State, para_state: State, + shell_state: State, shell_chain_spec: ChainSpec, } impl Processor { fn new() -> Result { + let mut shell_chain_spec = from_file::("test-data/shell.json")?; + Ok(Self { solo_state: State::from_file("test-data/solo.json")?, para_state: State::from_file("test-data/para.json")?, - shell_chain_spec: from_file("test-data/shell.json")?, + shell_state: State(mem::take(&mut shell_chain_spec.genesis.raw.top)), + shell_chain_spec, }) } @@ -51,8 +56,10 @@ impl Processor { self.save() } - fn save(self) -> Result<()> { - log::info!("save processed chain spec"); + fn save(mut self) -> Result<()> { + log::info!("saving processed chain spec"); + + mem::swap(&mut self.shell_state.0, &mut self.shell_chain_spec.genesis.raw.top); let mut f = File::create("test-data/processed.json")?; let v = serde_json::to_vec(&self.shell_chain_spec)?; @@ -110,6 +117,40 @@ impl State { self } + fn take_raw( + &mut self, + prefix: &str, + buffer: &mut Map, + preprocess_key: F, + ) -> &mut Self + where + F: Fn(&str, &str) -> String, + { + self.0.retain(|k, v| { + if k.starts_with(prefix) { + buffer.insert(preprocess_key(k, prefix), v.to_owned()); + + false + } else { + true + } + }); + + self + } + + fn insert_raw(&mut self, pairs: Map) -> &mut Self { + pairs.into_iter().for_each(|(k, v)| { + if self.0.contains_key(&k) { + log::error!("key({k}) has already existed, overriding"); + } + + self.0.insert(k, v); + }); + + self + } + fn take_value(&mut self, pallet: &[u8], item: &[u8], value: &mut D) -> &mut Self where D: Decode, @@ -227,3 +268,7 @@ fn get_hashed_key(full_key: &str, item_key: &str) -> String { fn get_last_64(key: &str) -> String { format!("0x{}", &key[key.len() - 64..]) } + +fn replace_first_match(key: &str, from: &str, to: &str) -> String { + key.replacen(from, to, 1) +} diff --git a/tool/state-processor/src/system/mod.rs b/tool/state-processor/src/system/mod.rs index ba0214515..53f34ea6f 100644 --- a/tool/state-processor/src/system/mod.rs +++ b/tool/state-processor/src/system/mod.rs @@ -83,12 +83,12 @@ impl Processor { ring_total_issuance += v.data.reserved; }); - let state = &mut self.shell_chain_spec.genesis.raw.top; - log::info!("set `Balances::TotalIssuance`"); log::info!("ring_total_issuance({ring_total_issuance})"); log::info!("ring_total_issuance_storage({ring_total_issuance_storage})"); - state.insert(item_key(b"Balances", b"TotalIssuance"), encode_value(ring_total_issuance)); + self.shell_state + .0 + .insert(item_key(b"Balances", b"TotalIssuance"), encode_value(ring_total_issuance)); log::info!("kton_total_issuance({kton_total_issuance})"); log::info!("kton_total_issuance_storage({kton_total_issuance_storage})"); @@ -112,13 +112,15 @@ impl Processor { }; if is_evm_address(&k) { - state.insert(full_key(b"System", b"Account", &k), encode_value(a)); + self.shell_state.0.insert(full_key(b"System", b"Account", &k), encode_value(a)); // TODO: migrate kton balances. } else { a.nonce = 0; - state.insert(full_key(b"AccountMigration", b"Accounts", &k), encode_value(a)); + self.shell_state + .0 + .insert(full_key(b"AccountMigration", b"Accounts", &k), encode_value(a)); } }); diff --git a/tool/state-processor/src/vesting/README.md b/tool/state-processor/src/vesting/README.md new file mode 100644 index 000000000..e6a889c80 --- /dev/null +++ b/tool/state-processor/src/vesting/README.md @@ -0,0 +1,5 @@ +### Process steps +> There are only 3 vesting records on Crab and 1 vesting record on Darwinia. + +- take `Vesting::Vesting` +- insert to `AccountMigration::Vestings` diff --git a/tool/state-processor/src/vesting/mod.rs b/tool/state-processor/src/vesting/mod.rs index adcefb429..1865b5f5b 100644 --- a/tool/state-processor/src/vesting/mod.rs +++ b/tool/state-processor/src/vesting/mod.rs @@ -3,6 +3,13 @@ use crate::*; impl Processor { pub fn process_vesting(&mut self) -> &mut Self { + let mut vestings = Map::default(); + + self.solo_state.take_raw(&item_key(b"Vesting", b"Vesting"), &mut vestings, |key, from| { + replace_first_match(key, from, &item_key(b"AccountMigration", b"Vestings")) + }); + self.shell_state.insert_raw(vestings); + self } } From 807b99c7de59089eac1437330b933b9a6a18c835 Mon Sep 17 00:00:00 2001 From: bear Date: Wed, 14 Dec 2022 18:10:45 +0800 Subject: [PATCH 044/189] Merge balance after update decimal (#128) * Update order * Update README --- tool/state-processor/src/system/README.md | 6 +++--- tool/state-processor/src/system/mod.rs | 16 ++++++++-------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/tool/state-processor/src/system/README.md b/tool/state-processor/src/system/README.md index 3ced4bf12..d15e83f72 100644 --- a/tool/state-processor/src/system/README.md +++ b/tool/state-processor/src/system/README.md @@ -1,16 +1,16 @@ ### Process steps - take solo account infos and remaining balances - - merge solo remaining balances - adjust solo balance decimals + - merge solo remaining balances - take para account infos - process balances - take solo balances total issuances and locks - prune solo balance locks - prune staking, phragmen election, democracy, vesting, relay authority, fee market locks - - check if there are any other locks - - adjust solo balances items' decimals + - adjust solo balances items' decimals - take para balances total issuances and locks - there should not be any locks on parachain + - check if there are any other locks - use all previous data to build the new accounts and calculate total issuances - merge solo and para account infos - how to deal with the account references? - TODO diff --git a/tool/state-processor/src/system/mod.rs b/tool/state-processor/src/system/mod.rs index 53f34ea6f..703c460f6 100644 --- a/tool/state-processor/src/system/mod.rs +++ b/tool/state-processor/src/system/mod.rs @@ -138,6 +138,14 @@ impl Processor { .take_map(b"Ethereum", b"RemainingRingBalance", &mut remaining_ring, get_hashed_key) .take_map(b"Ethereum", b"RemainingKtonBalance", &mut remaining_kton, get_hashed_key); + log::info!("adjust solo balance decimals"); + account_infos.iter_mut().for_each(|(_, v)| { + v.data.free *= GWEI; + v.data.reserved *= GWEI; + v.data.free_kton_or_misc_frozen *= GWEI; + v.data.reserved_kton_or_fee_frozen *= GWEI; + }); + log::info!("merge solo remaining balances"); remaining_ring.into_iter().for_each(|(k, v)| { if let Some(a) = account_infos.get_mut(&k) { @@ -160,14 +168,6 @@ impl Processor { } }); - log::info!("adjust solo balance decimals"); - account_infos.iter_mut().for_each(|(_, v)| { - v.data.free *= GWEI; - v.data.reserved *= GWEI; - v.data.free_kton_or_misc_frozen *= GWEI; - v.data.reserved_kton_or_fee_frozen *= GWEI; - }); - account_infos } From 16ad2507317364143fccb500b8767293441aa0a9 Mon Sep 17 00:00:00 2001 From: Guantong <04637@163.com> Date: Thu, 15 Dec 2022 10:38:18 +0800 Subject: [PATCH 045/189] Update reserve transfer filter (#130) --- runtime/crab/src/pallets/polkadot_xcm.rs | 2 +- runtime/darwinia/src/pallets/polkadot_xcm.rs | 2 +- runtime/pangolin/src/pallets/polkadot_xcm.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/runtime/crab/src/pallets/polkadot_xcm.rs b/runtime/crab/src/pallets/polkadot_xcm.rs index f33bec411..2f1b3ef09 100644 --- a/runtime/crab/src/pallets/polkadot_xcm.rs +++ b/runtime/crab/src/pallets/polkadot_xcm.rs @@ -148,7 +148,7 @@ impl pallet_xcm::Config for Runtime { // ^ Disable dispatchable execute on the XCM pallet. // Needs to be `Everything` for local testing. type XcmExecutor = xcm_executor::XcmExecutor; - type XcmReserveTransferFilter = frame_support::traits::Nothing; + type XcmReserveTransferFilter = frame_support::traits::Everything; type XcmRouter = XcmRouter; type XcmTeleportFilter = frame_support::traits::Nothing; diff --git a/runtime/darwinia/src/pallets/polkadot_xcm.rs b/runtime/darwinia/src/pallets/polkadot_xcm.rs index 8f5f9a9c9..2c98cb4c1 100644 --- a/runtime/darwinia/src/pallets/polkadot_xcm.rs +++ b/runtime/darwinia/src/pallets/polkadot_xcm.rs @@ -148,7 +148,7 @@ impl pallet_xcm::Config for Runtime { // ^ Disable dispatchable execute on the XCM pallet. // Needs to be `Everything` for local testing. type XcmExecutor = xcm_executor::XcmExecutor; - type XcmReserveTransferFilter = frame_support::traits::Nothing; + type XcmReserveTransferFilter = frame_support::traits::Everything; type XcmRouter = XcmRouter; type XcmTeleportFilter = frame_support::traits::Nothing; diff --git a/runtime/pangolin/src/pallets/polkadot_xcm.rs b/runtime/pangolin/src/pallets/polkadot_xcm.rs index ba122f3c5..5cac8a806 100644 --- a/runtime/pangolin/src/pallets/polkadot_xcm.rs +++ b/runtime/pangolin/src/pallets/polkadot_xcm.rs @@ -148,7 +148,7 @@ impl pallet_xcm::Config for Runtime { // ^ Disable dispatchable execute on the XCM pallet. // Needs to be `Everything` for local testing. type XcmExecutor = xcm_executor::XcmExecutor; - type XcmReserveTransferFilter = frame_support::traits::Nothing; + type XcmReserveTransferFilter = frame_support::traits::Everything; type XcmRouter = XcmRouter; type XcmTeleportFilter = frame_support::traits::Nothing; From 1b9a5fc44ed94b042c22937bb1efe5a371b838f6 Mon Sep 17 00:00:00 2001 From: bear Date: Thu, 15 Dec 2022 14:54:44 +0800 Subject: [PATCH 046/189] Frontier pallets storage process (#121) * Build test * Add licenses * Add ethereum schema process * Add evm state process * Self review * Delte useless file * Bump deps * Free license * Refactor * Correct prefixes Signed-off-by: Xavier Lau Signed-off-by: Xavier Lau Co-authored-by: Xavier Lau --- Cargo.lock | 492 ++++++++++++--------- tool/state-processor/src/balances/mod.rs | 4 +- tool/state-processor/src/evm/README.md | 4 + tool/state-processor/src/evm/mod.rs | 42 ++ tool/state-processor/src/main.rs | 8 +- tool/state-processor/src/system/README.md | 8 +- tool/state-processor/src/system/mod.rs | 4 +- tool/state-processor/src/vesting/README.md | 4 +- tool/state-processor/src/vesting/mod.rs | 4 + 9 files changed, 343 insertions(+), 227 deletions(-) create mode 100644 tool/state-processor/src/evm/README.md create mode 100644 tool/state-processor/src/evm/mod.rs diff --git a/Cargo.lock b/Cargo.lock index a9cf80ac6..71bf82e53 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -39,7 +39,16 @@ version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9ecd88a8c8378ca913a680cd98f0f13ac67383d35993f86c90a70e3f137816b" dependencies = [ - "gimli", + "gimli 0.26.2", +] + +[[package]] +name = "addr2line" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a76fd60b23679b7d19bd066031410fb7e458ccc5e958eb5c325888ce4baedc97" +dependencies = [ + "gimli 0.27.0", ] [[package]] @@ -105,9 +114,9 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "0.7.19" +version = "0.7.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4f55bd91a0978cbfd91c457a164bab8b4001c833b7f323132c0a4e1922dd44e" +checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac" dependencies = [ "memchr", ] @@ -219,11 +228,11 @@ dependencies = [ [[package]] name = "async-channel" -version = "1.7.1" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e14485364214912d3b19cc3435dde4df66065127f05fa0d75c712f36f12c2f28" +checksum = "cf46fee83e5ccffc220104713af3292ff9bc7c64c7de289f66dae8e38d826833" dependencies = [ - "concurrent-queue 1.2.4", + "concurrent-queue", "event-listener", "futures-core", ] @@ -236,7 +245,7 @@ checksum = "17adb73da160dfb475c183343c8cccd80721ea5a605d3eb57125f0a7b7a92d0b" dependencies = [ "async-lock", "async-task", - "concurrent-queue 2.0.0", + "concurrent-queue", "fastrand", "futures-lite", "slab", @@ -259,13 +268,13 @@ dependencies = [ [[package]] name = "async-io" -version = "1.10.0" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8121296a9f05be7f34aa4196b1747243b3b62e048bb7906f644f3fbfc490cf7" +checksum = "8c374dda1ed3e7d8f0d9ba58715f924862c63eae6849c92d3a18e7fbde9e2794" dependencies = [ "async-lock", "autocfg", - "concurrent-queue 1.2.4", + "concurrent-queue", "futures-lite", "libc", "log", @@ -274,7 +283,7 @@ dependencies = [ "slab", "socket2", "waker-fn", - "winapi", + "windows-sys 0.42.0", ] [[package]] @@ -289,20 +298,20 @@ dependencies = [ [[package]] name = "async-process" -version = "1.5.0" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02111fd8655a613c25069ea89fc8d9bb89331fa77486eb3bc059ee757cfa481c" +checksum = "6381ead98388605d0d9ff86371043b5aa922a3905824244de40dc263a14fcba4" dependencies = [ "async-io", + "async-lock", "autocfg", "blocking", "cfg-if 1.0.0", "event-listener", "futures-lite", "libc", - "once_cell", "signal-hook", - "winapi", + "windows-sys 0.42.0", ] [[package]] @@ -356,9 +365,9 @@ checksum = "7a40729d2133846d9ed0ea60a8b9541bccddab49cd30f0715a1da672fe9a2524" [[package]] name = "async-trait" -version = "0.1.58" +version = "0.1.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e805d94e6b5001b651426cf4cd446b1ab5f319d27bab5c644f61de0a804360c" +checksum = "31e6e93155431f3931513b243d371981bb2770112b370c82745a1d19d2f99364" dependencies = [ "proc-macro2", "quote", @@ -429,16 +438,16 @@ dependencies = [ [[package]] name = "backtrace" -version = "0.3.66" +version = "0.3.67" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cab84319d616cfb654d03394f38ab7e6f0919e181b1b57e1fd15e7fb4077d9a7" +checksum = "233d376d6d185f2a3093e58f283f60f880315b6c60075b01f36b3b85154564ca" dependencies = [ - "addr2line", + "addr2line 0.19.0", "cc", "cfg-if 1.0.0", "libc", "miniz_oxide", - "object", + "object 0.30.0", "rustc-demangle", ] @@ -625,7 +634,7 @@ version = "0.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b12e5fd123190ce1c2e559308a94c9bacad77907d4c6005d9e58fe1a0689e55e" dependencies = [ - "digest 0.10.5", + "digest 0.10.6", ] [[package]] @@ -635,7 +644,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5d6d530bdd2d52966a6d03b7a964add7ae1a288d25214066fd4b600f0f796400" dependencies = [ "arrayvec 0.4.12", - "constant_time_eq", + "constant_time_eq 0.1.5", ] [[package]] @@ -646,7 +655,7 @@ checksum = "72936ee4afc7f8f736d1c38383b56480b5497b4617b4a77bdbf1d2ababc76127" dependencies = [ "arrayref", "arrayvec 0.7.2", - "constant_time_eq", + "constant_time_eq 0.1.5", ] [[package]] @@ -657,21 +666,21 @@ checksum = "db539cc2b5f6003621f1cd9ef92d7ded8ea5232c7de0f9faa2de251cd98730d4" dependencies = [ "arrayref", "arrayvec 0.7.2", - "constant_time_eq", + "constant_time_eq 0.1.5", ] [[package]] name = "blake3" -version = "1.3.1" +version = "1.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a08e53fc5a564bb15bfe6fae56bd71522205f1f91893f9c0116edad6496c183f" +checksum = "42ae2468a89544a466886840aa467a25b766499f4f04bf7d9fcd10ecee9fccef" dependencies = [ "arrayref", "arrayvec 0.7.2", "cc", "cfg-if 1.0.0", - "constant_time_eq", - "digest 0.10.5", + "constant_time_eq 0.2.4", + "digest 0.10.6", ] [[package]] @@ -722,16 +731,16 @@ checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae" [[package]] name = "blocking" -version = "1.2.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6ccb65d468978a086b69884437ded69a90faab3bbe6e67f242173ea728acccc" +checksum = "3c67b173a56acffd6d2326fb7ab938ba0b00a71480e14902b2591c87bc5741e8" dependencies = [ "async-channel", + "async-lock", "async-task", "atomic-waker", "fastrand", "futures-lite", - "once_cell", ] [[package]] @@ -961,9 +970,9 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "bytes" -version = "1.2.1" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec8a7b6a70fde80372154c65702f00a0f56f3e1c36abbc6c440484be248856db" +checksum = "dfb24e866b15a1af2a1b663f10c6b6b8f397a84aadb828f12e5b289ec23a3a3c" [[package]] name = "bzip2-sys" @@ -976,12 +985,6 @@ dependencies = [ "pkg-config", ] -[[package]] -name = "cache-padded" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1db59621ec70f09c5e9b597b220c7a2b43611f4710dc03ceb8748637775692c" - [[package]] name = "camino" version = "1.1.1" @@ -1021,9 +1024,9 @@ checksum = "fd6c0e7b807d60291f42f33f58480c0bfafe28ed08286446f45e463728cf9c1c" [[package]] name = "cc" -version = "1.0.76" +version = "1.0.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76a284da2e6fe2092f2353e51713435363112dfd60030e22add80be333fb928f" +checksum = "a20104e2335ce8a659d6dd92a51a767a0c062599c73b343fd152cb401e828c3d" dependencies = [ "jobserver", ] @@ -1228,24 +1231,15 @@ dependencies = [ [[package]] name = "comfy-table" -version = "6.1.2" +version = "6.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1090f39f45786ec6dc6286f8ea9c75d0a7ef0a0d3cda674cef0c3af7b307fbc2" +checksum = "e621e7e86c46fd8a14c32c6ae3cb95656621b4743a27d0cffedb831d46e7ad21" dependencies = [ "strum", "strum_macros", "unicode-width", ] -[[package]] -name = "concurrent-queue" -version = "1.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af4780a44ab5696ea9e28294517f1fffb421a83a25af521333c838635509db9c" -dependencies = [ - "cache-padded", -] - [[package]] name = "concurrent-queue" version = "2.0.0" @@ -1280,6 +1274,12 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" +[[package]] +name = "constant_time_eq" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3ad85c1f65dc7b37604eb0e89748faf0b9653065f2a8ef69f96a687ec1e9279" + [[package]] name = "convert_case" version = "0.4.0" @@ -1459,7 +1459,7 @@ dependencies = [ "cranelift-codegen-shared", "cranelift-entity", "cranelift-isle", - "gimli", + "gimli 0.26.2", "log", "regalloc2", "smallvec", @@ -1567,22 +1567,22 @@ dependencies = [ [[package]] name = "crossbeam-epoch" -version = "0.9.11" +version = "0.9.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f916dfc5d356b0ed9dae65f1db9fc9770aa2851d2662b988ccf4fe3516e86348" +checksum = "01a9af1f4c2ef74bb8aa1f7e19706bc72d03598c8a570bb5de72243c7a9d9d5a" dependencies = [ "autocfg", "cfg-if 1.0.0", "crossbeam-utils", - "memoffset", + "memoffset 0.7.1", "scopeguard", ] [[package]] name = "crossbeam-queue" -version = "0.3.6" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cd42583b04998a5363558e5f9291ee5a5ff6b49944332103f251e7479a82aa7" +checksum = "d1cfb3ea8a53f37c40dea2c7bedcbd88bdfae54f5e2175d6ecaff1c988353add" dependencies = [ "cfg-if 1.0.0", "crossbeam-utils", @@ -1590,9 +1590,9 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.8.12" +version = "0.8.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edbafec5fa1f196ca66527c1b12c2ec4745ca14b50f1ad8f9f6f720b55d11fac" +checksum = "4fb766fa798726286dbbb842f174001dab8abc7b627a1dd86e0b7222a95d929f" dependencies = [ "cfg-if 1.0.0", ] @@ -1622,7 +1622,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ "generic-array 0.14.6", - "typenum 1.15.0", + "typenum 1.16.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2161,22 +2161,23 @@ dependencies = [ [[package]] name = "curve25519-dalek" -version = "4.0.0-pre.1" +version = "4.0.0-pre.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4033478fbf70d6acf2655ac70da91ee65852d69daf7a67bf7a2f518fb47aafcf" +checksum = "67bc65846be335cb20f4e52d49a437b773a2c1fdb42b19fc84e79e6f6771536f" dependencies = [ - "byteorder", - "digest 0.9.0", - "rand_core 0.6.4", + "cfg-if 1.0.0", + "fiat-crypto", + "packed_simd_2", + "platforms 3.0.2", "subtle", "zeroize", ] [[package]] name = "cxx" -version = "1.0.81" +version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97abf9f0eca9e52b7f81b945524e76710e6cb2366aead23b7d4fbf72e281f888" +checksum = "bdf07d07d6531bfcdbe9b8b739b104610c6508dcc4d63b410585faf338241daf" dependencies = [ "cc", "cxxbridge-flags", @@ -2186,9 +2187,9 @@ dependencies = [ [[package]] name = "cxx-build" -version = "1.0.81" +version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cc32cc5fea1d894b77d269ddb9f192110069a8a9c1f1d441195fba90553dea3" +checksum = "d2eb5b96ecdc99f72657332953d4d9c50135af1bac34277801cc3937906ebd39" dependencies = [ "cc", "codespan-reporting", @@ -2201,15 +2202,15 @@ dependencies = [ [[package]] name = "cxxbridge-flags" -version = "1.0.81" +version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ca220e4794c934dc6b1207c3b42856ad4c302f2df1712e9f8d2eec5afaacf1f" +checksum = "ac040a39517fd1674e0f32177648334b0f4074625b5588a64519804ba0553b12" [[package]] name = "cxxbridge-macro" -version = "1.0.81" +version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b846f081361125bfc8dc9d3940c84e1fd83ba54bbca7b17cd29483c828be0704" +checksum = "1362b0ddcfc4eb0a1f57b68bd77dd99f0e826958a96abd0ae9bd092e114ffed6" dependencies = [ "proc-macro2", "quote", @@ -2605,9 +2606,9 @@ dependencies = [ [[package]] name = "data-encoding" -version = "2.3.2" +version = "2.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ee2393c4a91429dffb4bedf19f4d6abf27d8a732c8ce4980305d782e5426d57" +checksum = "23d8666cb01533c39dde32bcbab8e227b4ed6679b2c925eba05feabea39508fb" [[package]] name = "data-encoding-macro" @@ -2706,9 +2707,9 @@ dependencies = [ [[package]] name = "digest" -version = "0.10.5" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adfbc57365a37acbd2ebf2b64d7e69bb766e2fea813521ed536f5d0520dcf86c" +checksum = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f" dependencies = [ "block-buffer 0.10.3", "crypto-common", @@ -2955,9 +2956,9 @@ dependencies = [ [[package]] name = "environmental" -version = "1.1.3" +version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68b91989ae21441195d7d9b9993a2f9295c7e1a8c96255d8b729accddc124797" +checksum = "e48c92028aaa870e83d51c64e5d4e0b6981b360c522198c23959f219a4e1b15b" [[package]] name = "errno" @@ -3323,6 +3324,12 @@ dependencies = [ "subtle", ] +[[package]] +name = "fiat-crypto" +version = "0.1.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a214f5bb88731d436478f3ae1f8a277b62124089ba9fb67f4f93fb100ef73c90" + [[package]] name = "file-per-thread-logger" version = "0.1.5" @@ -3335,9 +3342,9 @@ dependencies = [ [[package]] name = "filetime" -version = "0.2.18" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b9663d381d07ae25dc88dbdf27df458faa83a9b25336bcac83d5e452b5fc9d3" +checksum = "4e884668cd0c7480504233e951174ddc3b382f7c2666e3b7310b5c4e7b0c37f9" dependencies = [ "cfg-if 1.0.0", "libc", @@ -3393,9 +3400,9 @@ checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" [[package]] name = "flate2" -version = "1.0.24" +version = "1.0.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f82b0f4c27ad9f8bfd1f3208d882da2b09c301bc1c828fd3a00d0216d2fbbff6" +checksum = "a8a2db397cb1c8772f31494cb8917e48cd1e64f0fa7efac59fbd741a0a8ce841" dependencies = [ "crc32fast", "libz-sys", @@ -3934,7 +3941,7 @@ version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ffdf9f34f1447443d37393cc6c2b8313aebddcd96906caf34e54c68d8e57d7bd" dependencies = [ - "typenum 1.15.0", + "typenum 1.16.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -3943,7 +3950,7 @@ version = "0.14.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bff49e947297f3312447abdca79f45f4738097cc82b06e72054d2223f601f1b9" dependencies = [ - "typenum 1.15.0", + "typenum 1.16.0 (registry+https://github.com/rust-lang/crates.io-index)", "version_check", ] @@ -4002,6 +4009,12 @@ dependencies = [ "stable_deref_trait", ] +[[package]] +name = "gimli" +version = "0.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dec7af912d60cdbd3677c1af9352ebae6fb8394d165568a2234df0fa00f87793" + [[package]] name = "glob" version = "0.3.0" @@ -4023,9 +4036,9 @@ dependencies = [ [[package]] name = "gloo-timers" -version = "0.2.4" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fb7d06c1c8cc2a29bee7ec961009a0b2caa0793ee4900c2ffb348734ba1c8f9" +checksum = "98c4a8d6391675c6b2ee1a6c8d06e8e2d03605c44cec1270675985a4c2a5500b" dependencies = [ "futures-channel", "futures-core", @@ -4251,9 +4264,9 @@ dependencies = [ [[package]] name = "hyper-rustls" -version = "0.23.1" +version = "0.23.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59df7c4e19c950e6e0e868dcc0a300b09a9b88e9ec55bd879ca819087a77355d" +checksum = "1788965e61b367cd03a62950836d5cd41560c3577d90e40e0819373194d1661c" dependencies = [ "http", "hyper", @@ -4377,9 +4390,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "1.9.1" +version = "1.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e" +checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399" dependencies = [ "autocfg", "hashbrown", @@ -4427,9 +4440,9 @@ checksum = "59ce5ef949d49ee85593fc4d3f3f95ad61657076395cbbce23e2121fc5542074" [[package]] name = "io-lifetimes" -version = "1.0.1" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7d367024b3f3414d8e01f437f704f41a9f64ab36f9067fa73e526ad4c763c87" +checksum = "46112a93252b123d31a119a8d1a1ac19deac4fac6e0e8b0df58f0d4e5870e63c" dependencies = [ "libc", "windows-sys 0.42.0", @@ -4455,9 +4468,9 @@ dependencies = [ [[package]] name = "ipnet" -version = "2.5.1" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f88c5561171189e69df9d98bcf18fd5f9558300f7ea7b801eb8a0fd748bd8745" +checksum = "11b0d96e660696543b251e58030cf9787df56da39dab19ad60eae7353040917e" [[package]] name = "itertools" @@ -4828,9 +4841,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.137" +version = "0.2.138" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc7fcc620a3bff7cdd7a365be3376c97191aeaccc2a603e600951e452615bf89" +checksum = "db6d7e329c562c5dfab7a46a2afabc8b987ab9a4834c9d1ca04dc54c1546cef8" [[package]] name = "libloading" @@ -4852,6 +4865,12 @@ dependencies = [ "winapi", ] +[[package]] +name = "libm" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fc7aa29613bd6a620df431842069224d8bc9011086b1db4c0e0cd47fa03ec9a" + [[package]] name = "libm" version = "0.2.6" @@ -5189,9 +5208,9 @@ dependencies = [ [[package]] name = "libp2p-pnet" -version = "0.22.1" +version = "0.22.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a5a702574223aa55d8878bdc8bf55c84a6086f87ddaddc28ce730b4caa81538" +checksum = "de160c5631696cea22be326c19bd9d306e254c4964945263aea10f25f6e0864e" dependencies = [ "futures", "log", @@ -5404,7 +5423,7 @@ dependencies = [ "rand 0.7.3", "serde", "sha2 0.9.9", - "typenum 1.15.0", + "typenum 1.16.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -5423,7 +5442,7 @@ dependencies = [ "rand 0.7.3", "serde", "sha2 0.9.9", - "typenum 1.15.0", + "typenum 1.16.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -5442,7 +5461,7 @@ dependencies = [ "rand 0.8.5", "serde", "sha2 0.9.9", - "typenum 1.15.0", + "typenum 1.16.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -5556,9 +5575,9 @@ checksum = "d4d2456c373231a208ad294c33dc5bff30051eafd954cd4caae83a712b12854d" [[package]] name = "linux-raw-sys" -version = "0.1.2" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb68f22743a3fb35785f1e7f844ca5a3de2dde5bd0c0ef5b372065814699b121" +checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4" [[package]] name = "lock_api" @@ -5678,7 +5697,7 @@ version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b20a59d985586e4a5aef64564ac77299f8586d8be6cf9106a5a40207e8908efb" dependencies = [ - "rustix 0.36.1", + "rustix 0.36.5", ] [[package]] @@ -5699,6 +5718,15 @@ dependencies = [ "autocfg", ] +[[package]] +name = "memoffset" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4" +dependencies = [ + "autocfg", +] + [[package]] name = "memory-db" version = "0.29.0" @@ -5766,9 +5794,9 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniz_oxide" -version = "0.5.4" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96590ba8f175222643a85693f33d26e9c8a015f599c216509b1a6894af675d34" +checksum = "b275950c28b37e794e8c55d88aeb5e139d0ce23fdbbeda68f8d7174abdf9e8fa" dependencies = [ "adler", ] @@ -5824,7 +5852,7 @@ dependencies = [ "blake2s_simd", "blake3", "core2", - "digest 0.10.5", + "digest 0.10.6", "multihash-derive", "sha2 0.10.6", "sha3 0.10.6", @@ -5880,7 +5908,7 @@ dependencies = [ "rand 0.8.5", "rand_distr", "simba", - "typenum 1.15.0", + "typenum 1.16.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -5977,9 +6005,9 @@ dependencies = [ [[package]] name = "nix" -version = "0.24.2" +version = "0.24.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "195cdbc1741b8134346d515b3a56a1c94b0912758009cfd53f99ea0f57b065fc" +checksum = "fa52e972a9a719cecb6864fb88568781eb706bac2cd1d4f04a648542dbf78069" dependencies = [ "bitflags", "cfg-if 1.0.0", @@ -6055,9 +6083,9 @@ dependencies = [ [[package]] name = "num-format" -version = "0.4.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54b862ff8df690cf089058c98b183676a7ed0f974cc08b426800093227cbff3b" +checksum = "a652d9771a63711fd3c3deb670acfbe5c30a4072e664d7a3bf5a9e1056ac72c3" dependencies = [ "arrayvec 0.7.2", "itoa", @@ -6115,7 +6143,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" dependencies = [ "autocfg", - "libm", + "libm 0.2.6", ] [[package]] @@ -6161,6 +6189,15 @@ dependencies = [ "memchr", ] +[[package]] +name = "object" +version = "0.30.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "239da7f290cfa979f43f85a8efeee9a8a76d0827c356d37f9d3d7254d6b537fb" +dependencies = [ + "memchr", +] + [[package]] name = "once_cell" version = "1.16.0" @@ -6256,9 +6293,9 @@ dependencies = [ [[package]] name = "os_str_bytes" -version = "6.4.0" +version = "6.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b5bf27447411e9ee3ff51186bf7a08e16c341efdde93f4d823e8844429bed7e" +checksum = "9b7820b9daea5457c9f21c69448905d723fbd21136ccf521748f23fd49e723ee" [[package]] name = "owning_ref" @@ -6269,6 +6306,16 @@ dependencies = [ "stable_deref_trait", ] +[[package]] +name = "packed_simd_2" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1914cd452d8fccd6f9db48147b29fd4ae05bea9dc5d9ad578509f72415de282" +dependencies = [ + "cfg-if 1.0.0", + "libm 0.1.4", +] + [[package]] name = "pallet-assets" version = "4.0.0-dev" @@ -7586,7 +7633,7 @@ checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" dependencies = [ "instant", "lock_api", - "parking_lot_core 0.8.5", + "parking_lot_core 0.8.6", ] [[package]] @@ -7596,14 +7643,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" dependencies = [ "lock_api", - "parking_lot_core 0.9.4", + "parking_lot_core 0.9.5", ] [[package]] name = "parking_lot_core" -version = "0.8.5" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216" +checksum = "60a2cfe6f0ad2bfc16aefa463b497d5c7a5ecd44a23efa72aa342d90177356dc" dependencies = [ "cfg-if 1.0.0", "instant", @@ -7615,9 +7662,9 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.4" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dc9e0dc2adc1c69d09143aff38d3d30c5c3f0df0dad82e6d25547af174ebec0" +checksum = "7ff9f3fef3968a3ec5945535ed654cb38ff72d7495a25619e2247fb15a2ed9ba" dependencies = [ "cfg-if 1.0.0", "libc", @@ -7628,9 +7675,9 @@ dependencies = [ [[package]] name = "paste" -version = "1.0.9" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1de2e551fb905ac83f73f7aedf2f0cb4a0da7e35efa24a202a936269f1f18e1" +checksum = "cf1c2c742266c2f1041c914ba65355a83ae8747b05f208319784083583494b4b" [[package]] name = "pbkdf2" @@ -7664,9 +7711,9 @@ checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" [[package]] name = "pest" -version = "2.4.1" +version = "2.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a528564cc62c19a7acac4d81e01f39e53e25e17b934878f4c6d25cc2836e62f8" +checksum = "cc8bed3549e0f9b0a2a78bf7c0018237a2cdf085eecbbc048e52612438e4e9d0" dependencies = [ "thiserror", "ucd-trie", @@ -7674,9 +7721,9 @@ dependencies = [ [[package]] name = "pest_derive" -version = "2.4.1" +version = "2.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5fd9bc6500181952d34bd0b2b0163a54d794227b498be0b7afa7698d0a7b18f" +checksum = "cdc078600d06ff90d4ed238f0119d84ab5d43dbaad278b0e33a8820293b32344" dependencies = [ "pest", "pest_generator", @@ -7684,9 +7731,9 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.4.1" +version = "2.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2610d5ac5156217b4ff8e46ddcef7cdf44b273da2ac5bca2ecbfa86a330e7c4" +checksum = "28a1af60b1c4148bb269006a750cff8e2ea36aff34d2d96cf7be0b14d1bed23c" dependencies = [ "pest", "pest_meta", @@ -7697,9 +7744,9 @@ dependencies = [ [[package]] name = "pest_meta" -version = "2.4.1" +version = "2.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "824749bf7e21dd66b36fbe26b3f45c713879cccd4a009a917ab8e045ca8246fe" +checksum = "fec8605d59fc2ae0c6c1aefc0c7c7a9769732017c0ce07f7a9cfffa7b4404f20" dependencies = [ "once_cell", "pest", @@ -7777,6 +7824,12 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e8d0eef3571242013a0d5dc84861c3ae4a652e56e12adf8bdc26ff5f8cb34c94" +[[package]] +name = "platforms" +version = "3.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3d7ddaed09e0eb771a79ab0fd64609ba0afb0a8366421957936ad14cbd13630" + [[package]] name = "polkadot-approval-distribution" version = "0.9.30" @@ -8909,16 +8962,16 @@ dependencies = [ [[package]] name = "polling" -version = "2.4.0" +version = "2.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab4609a838d88b73d8238967b60dd115cc08d38e2bbaf51ee1e4b695f89122e2" +checksum = "22122d5ec4f9fe1b3916419b76be1e80bcb93f618d071d2edf841b137b2a2bd6" dependencies = [ "autocfg", "cfg-if 1.0.0", "libc", "log", "wepoll-ffi", - "winapi", + "windows-sys 0.42.0", ] [[package]] @@ -9143,9 +9196,9 @@ dependencies = [ [[package]] name = "prost" -version = "0.11.2" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0841812012b2d4a6145fae9a6af1534873c32aa67fff26bd09f8fa42c83f95a" +checksum = "c0b18e655c21ff5ac2084a5ad0611e827b3f92badf79f4910b5a5c58f4d87ff0" dependencies = [ "bytes", "prost-derive 0.11.2", @@ -9175,9 +9228,9 @@ dependencies = [ [[package]] name = "prost-build" -version = "0.11.2" +version = "0.11.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d8b442418ea0822409d9e7d047cbf1e7e9e1760b172bf9982cf29d517c93511" +checksum = "276470f7f281b0ed53d2ae42dd52b4a8d08853a3c70e7fe95882acbb98a6ae94" dependencies = [ "bytes", "heck", @@ -9187,7 +9240,7 @@ dependencies = [ "multimap", "petgraph", "prettyplease", - "prost 0.11.2", + "prost 0.11.3", "prost-types 0.11.2", "regex", "syn", @@ -9251,7 +9304,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "747761bc3dc48f9a34553bf65605cf6cb6288ba219f3450b4275dbd81539551a" dependencies = [ "bytes", - "prost 0.11.2", + "prost 0.11.3", ] [[package]] @@ -9403,21 +9456,19 @@ checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3" [[package]] name = "rayon" -version = "1.5.3" +version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd99e5772ead8baa5215278c9b15bf92087709e9c1b2d1f97cdb5a183c933a7d" +checksum = "6db3a213adf02b3bcfd2d3846bb41cb22857d131789e01df434fb7e7bc0759b7" dependencies = [ - "autocfg", - "crossbeam-deque", "either", "rayon-core", ] [[package]] name = "rayon-core" -version = "1.9.3" +version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "258bcdb5ac6dad48491bb2992db6b7cf74878b0384908af124823d118c99683f" +checksum = "cac410af5d00ab6884528b4ab69d1e8e146e8d471201800fa1b4524126de6ad3" dependencies = [ "crossbeam-channel", "crossbeam-deque", @@ -9584,7 +9635,7 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bd124222d17ad93a644ed9d011a40f4fb64aa54275c08cc216524a9ea82fb09f" dependencies = [ - "digest 0.10.5", + "digest 0.10.6", ] [[package]] @@ -9716,11 +9767,12 @@ dependencies = [ [[package]] name = "rpassword" -version = "7.1.0" +version = "7.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20c9f5d2a0c3e2ea729ab3706d22217177770654c3ef5056b68b69d07332d3f5" +checksum = "6678cf63ab3491898c0d021b493c94c9b221d91295294a2a5746eacbe5928322" dependencies = [ "libc", + "rtoolbox", "winapi", ] @@ -9739,6 +9791,16 @@ dependencies = [ "thiserror", ] +[[package]] +name = "rtoolbox" +version = "0.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "034e22c514f5c0cb8a10ff341b9b048b5ceb21591f31c8f44c43b960f9b3524a" +dependencies = [ + "libc", + "winapi", +] + [[package]] name = "rustc-demangle" version = "0.1.21" @@ -9782,15 +9844,15 @@ dependencies = [ [[package]] name = "rustix" -version = "0.36.1" +version = "0.36.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "812a2ec2043c4d6bc6482f5be2ab8244613cac2493d128d36c0759e52a626ab3" +checksum = "a3807b5d10909833d3e9acd1eb5fb988f79376ff10fce42937de71a449c4c588" dependencies = [ "bitflags", "errno", - "io-lifetimes 1.0.1", + "io-lifetimes 1.0.3", "libc", - "linux-raw-sys 0.1.2", + "linux-raw-sys 0.1.4", "windows-sys 0.42.0", ] @@ -10448,8 +10510,8 @@ dependencies = [ "futures", "libp2p", "log", - "prost 0.11.2", - "prost-build 0.11.2", + "prost 0.11.3", + "prost-build 0.11.4", "sc-client-api", "sc-network-common", "sp-blockchain", @@ -10925,9 +10987,9 @@ dependencies = [ [[package]] name = "scale-info" -version = "2.3.0" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88d8a765117b237ef233705cc2cc4c6a27fccd46eea6ef0c8c6dae5f3ef407f8" +checksum = "001cf62ece89779fd16105b5f515ad0e5cedcd5440d3dd806bb067978e7c3608" dependencies = [ "bitvec", "cfg-if 1.0.0", @@ -10939,9 +11001,9 @@ dependencies = [ [[package]] name = "scale-info-derive" -version = "2.3.0" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdcd47b380d8c4541044e341dcd9475f55ba37ddc50c908d945fc036a8642496" +checksum = "303959cf613a6f6efd19ed4b4ad5bf79966a13352716299ad532cfb115f4205c" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -11014,9 +11076,9 @@ dependencies = [ [[package]] name = "secp256k1" -version = "0.24.1" +version = "0.24.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff55dc09d460954e9ef2fa8a7ced735a964be9981fd50e870b2b3b0705e14964" +checksum = "d9512ffd81e3a3503ed401f79c33168b9148c75038956039166cd750eaa037c3" dependencies = [ "secp256k1-sys", ] @@ -11088,18 +11150,18 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.147" +version = "1.0.150" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d193d69bae983fc11a79df82342761dfbf28a99fc8d203dca4c3c1b590948965" +checksum = "e326c9ec8042f1b5da33252c8a37e9ffbd2c9bef0155215b6e6c80c790e05f91" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.147" +version = "1.0.150" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f1d362ca8fc9c3e3a7484440752472d68a6caa98f1ab81d99b5dfe517cec852" +checksum = "42a3df25b0713732468deadad63ab9da1f1fd75a48a15024b50363f128db627e" dependencies = [ "proc-macro2", "quote", @@ -11108,9 +11170,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.87" +version = "1.0.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ce777b7b150d76b9cf60d28b55f5847135a003f7d7350c6be7a773508ce7d45" +checksum = "020ff22c755c2ed3f8cf162dbb41a7268d934702f3ed3631656ea597e08fc3db" dependencies = [ "itoa", "ryu", @@ -11147,7 +11209,7 @@ checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3" dependencies = [ "cfg-if 1.0.0", "cpufeatures", - "digest 0.10.5", + "digest 0.10.6", ] [[package]] @@ -11183,7 +11245,7 @@ checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" dependencies = [ "cfg-if 1.0.0", "cpufeatures", - "digest 0.10.5", + "digest 0.10.6", ] [[package]] @@ -11217,7 +11279,7 @@ version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bdf0c33fae925bdc080598b84bc15c55e7b9a4a43b3c704da051f977469691c9" dependencies = [ - "digest 0.10.5", + "digest 0.10.6", "keccak", ] @@ -11341,9 +11403,9 @@ checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" [[package]] name = "snap" -version = "1.0.5" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45456094d1983e2ee2a18fdfebce3189fa451699d0502cb8e3b49dba5ba41451" +checksum = "5e9f0ab6ef7eb7353d9119c170a436d1bf248eea575ac42d19d12f4e34130831" [[package]] name = "snow" @@ -11354,7 +11416,7 @@ dependencies = [ "aes-gcm", "blake2", "chacha20poly1305", - "curve25519-dalek 4.0.0-pre.1", + "curve25519-dalek 4.0.0-pre.5", "rand_core 0.6.4", "ring", "rustc_version", @@ -11641,7 +11703,7 @@ source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3 dependencies = [ "blake2", "byteorder", - "digest 0.10.5", + "digest 0.10.6", "sha2 0.10.6", "sha3 0.10.6", "sp-std", @@ -12139,9 +12201,9 @@ dependencies = [ [[package]] name = "ss58-registry" -version = "1.34.0" +version = "1.36.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37a9821878e1f13aba383aa40a86fb1b33c7265774ec91e32563cb1dd1577496" +checksum = "23d92659e7d18d82b803824a9ba5a6022cff101c3491d027c1c1d8d30e749284" dependencies = [ "Inflector", "num-format", @@ -12186,7 +12248,7 @@ dependencies = [ "cfg_aliases", "libc", "parking_lot 0.11.2", - "parking_lot_core 0.8.5", + "parking_lot_core 0.8.6", "static_init_macro 1.0.2", "winapi", ] @@ -12289,7 +12351,7 @@ name = "substrate-build-script-utils" version = "3.0.0" source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ - "platforms", + "platforms 2.0.0", ] [[package]] @@ -12300,7 +12362,7 @@ dependencies = [ "parity-scale-codec", "scale-info", "serde", - "typenum 1.16.0", + "typenum 1.16.0 (git+https://github.com/encointer/typenum?tag=v1.16.0)", ] [[package]] @@ -12383,9 +12445,9 @@ checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" [[package]] name = "syn" -version = "1.0.103" +version = "1.0.105" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a864042229133ada95abf3b54fdc62ef5ccabe9515b64717bcb9a1919e59445d" +checksum = "60b9b43d45702de4c839cb9b51d9f529c5dd26a4aff255b42b1ebc03e88ee908" dependencies = [ "proc-macro2", "quote", @@ -12546,9 +12608,9 @@ dependencies = [ [[package]] name = "time" -version = "0.1.44" +version = "0.1.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255" +checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a" dependencies = [ "libc", "wasi 0.10.0+wasi-snapshot-preview1", @@ -12600,9 +12662,9 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" [[package]] name = "tokio" -version = "1.21.2" +version = "1.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9e03c497dc955702ba729190dc4aac6f2a0ce97f913e5b1b5912fc5039d9099" +checksum = "eab6d665857cc6ca78d6e80303a02cea7a7851e85dfbd77cbdc09bd129f1ef46" dependencies = [ "autocfg", "bytes", @@ -12615,14 +12677,14 @@ dependencies = [ "signal-hook-registry", "socket2", "tokio-macros", - "winapi", + "windows-sys 0.42.0", ] [[package]] name = "tokio-macros" -version = "1.8.0" +version = "1.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9724f9a975fb987ef7a3cd9be0350edcbe130698af5b8f7a631e23d42d052484" +checksum = "d266c00fde287f55d3f1c3e96c500c362a2b8c695076ec180f27918820bc6df8" dependencies = [ "proc-macro2", "quote", @@ -12668,9 +12730,9 @@ dependencies = [ [[package]] name = "toml" -version = "0.5.9" +version = "0.5.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7" +checksum = "1333c76748e868a4d9d1017b5ab53171dfd095f70c712fdb4653a406547f598f" dependencies = [ "serde", ] @@ -12911,16 +12973,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" dependencies = [ "cfg-if 1.0.0", - "digest 0.10.5", + "digest 0.10.6", "rand 0.8.5", "static_assertions", ] [[package]] name = "typenum" -version = "1.15.0" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" +checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" [[package]] name = "typenum" @@ -12939,9 +13001,9 @@ checksum = "9e79c4d996edb816c91e4308506774452e55e95c3c9de07b6729e17e15a5ef81" [[package]] name = "uint" -version = "0.9.4" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a45526d29728d135c2900b0d30573fe3ee79fceb12ef534c7bb30e810a91b601" +checksum = "76f64bba2c53b04fcab63c01a7d7427eadc821e3bc48c34dc9ba29c501164b52" dependencies = [ "byteorder", "crunchy", @@ -13243,7 +13305,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57d20cb3c59b788653d99541c646c561c9dd26506f25c0cebfe810659c54c6d7" dependencies = [ "downcast-rs", - "libm", + "libm 0.2.6", "memory_units", "num-rational 0.4.1", "num-traits", @@ -13270,7 +13332,7 @@ dependencies = [ "indexmap", "libc", "log", - "object", + "object 0.29.0", "once_cell", "paste", "psm", @@ -13327,9 +13389,9 @@ dependencies = [ "cranelift-frontend", "cranelift-native", "cranelift-wasm", - "gimli", + "gimli 0.26.2", "log", - "object", + "object 0.29.0", "target-lexicon", "thiserror", "wasmparser", @@ -13344,10 +13406,10 @@ checksum = "ebb881c61f4f627b5d45c54e629724974f8a8890d455bcbe634330cc27309644" dependencies = [ "anyhow", "cranelift-entity", - "gimli", + "gimli 0.26.2", "indexmap", "log", - "object", + "object 0.29.0", "serde", "target-lexicon", "thiserror", @@ -13361,14 +13423,14 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1985c628011fe26adf5e23a5301bdc79b245e0e338f14bb58b39e4e25e4d8681" dependencies = [ - "addr2line", + "addr2line 0.17.0", "anyhow", "bincode", "cfg-if 1.0.0", "cpp_demangle", - "gimli", + "gimli 0.26.2", "log", - "object", + "object 0.29.0", "rustc-demangle", "rustix 0.35.13", "serde", @@ -13386,7 +13448,7 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f671b588486f5ccec8c5a3dba6b4c07eac2e66ab8c60e6f4e53717c77f709731" dependencies = [ - "object", + "object 0.29.0", "once_cell", "rustix 0.35.13", ] @@ -13405,7 +13467,7 @@ dependencies = [ "log", "mach", "memfd", - "memoffset", + "memoffset 0.6.5", "paste", "rand 0.8.5", "rustix 0.35.13", @@ -13450,9 +13512,9 @@ dependencies = [ [[package]] name = "webpki-roots" -version = "0.22.5" +version = "0.22.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "368bfe657969fb01238bb756d351dcade285e0f6fcbd36dcb23359a5169975be" +checksum = "b6c71e40d7d2c34a5106301fb632274ca37242cd0c9d3e64dbece371a40a2d87" dependencies = [ "webpki", ] @@ -13900,9 +13962,9 @@ dependencies = [ [[package]] name = "zeroize_derive" -version = "1.3.2" +version = "1.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f8f187641dad4f680d25c4bfc4225b418165984179f26ca76ec4fb6441d3a17" +checksum = "44bf07cb3e50ea2003396695d58bf46bc9887a1f362260446fad6bc4e79bd36c" dependencies = [ "proc-macro2", "quote", @@ -13931,9 +13993,9 @@ dependencies = [ [[package]] name = "zstd-sys" -version = "2.0.1+zstd.1.5.2" +version = "2.0.4+zstd.1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fd07cbbc53846d9145dbffdf6dd09a7a0aa52be46741825f5c97bdd4f73f12b" +checksum = "4fa202f2ef00074143e219d15b62ffc317d17cc33909feac471c044087cad7b0" dependencies = [ "cc", "libc", diff --git a/tool/state-processor/src/balances/mod.rs b/tool/state-processor/src/balances/mod.rs index be52f97fe..929fb7dee 100644 --- a/tool/state-processor/src/balances/mod.rs +++ b/tool/state-processor/src/balances/mod.rs @@ -12,7 +12,7 @@ impl Processor { let mut para_ring_locks = >::default(); let mut para_ring_total_issuance = u128::default(); - log::info!("take solo balances total issuances and locks"); + log::info!("take solo `Balances::TotalIssuance`, `Kton::TotalIssuance`, `Balances::Locks` and `Kton::Locks`"); self.solo_state .take_value(b"Balances", b"TotalIssuance", &mut solo_ring_total_issuance) .take_value(b"Kton", b"TotalIssuance", &mut kton_total_issuance) @@ -30,7 +30,7 @@ impl Processor { // GWEI)); solo_kton_locks.iter_mut().for_each(|(_, v)| v.iter_mut().for_each(|l| l.amount // *= GWEI)); - log::info!("take para balances total issuances and locks"); + log::info!("take para `Balances::TotalIssuance` and `Balances::Locks`"); self.para_state .take_value(b"Balances", b"TotalIssuance", &mut para_ring_total_issuance) .take_map(b"Balances", b"Locks", &mut para_ring_locks, get_hashed_key); diff --git a/tool/state-processor/src/evm/README.md b/tool/state-processor/src/evm/README.md new file mode 100644 index 000000000..c45f83e91 --- /dev/null +++ b/tool/state-processor/src/evm/README.md @@ -0,0 +1,4 @@ +### Process steps +- set `PALLET_ETHEREUM_SCHEMA` +- take `EVM::AccountCodes` and `EVM::AccountStorages` +- set `Evm::AccountCodes` and `Evm::AccountStorages` diff --git a/tool/state-processor/src/evm/mod.rs b/tool/state-processor/src/evm/mod.rs new file mode 100644 index 000000000..eb130d80e --- /dev/null +++ b/tool/state-processor/src/evm/mod.rs @@ -0,0 +1,42 @@ +// darwinia +use crate::*; + +// https://github.com/paritytech/frontier/blob/polkadot-v0.9.30/primitives/storage/src/lib.rs#L23 +const PALLET_ETHEREUM_SCHEMA: &str = "0x3a657468657265756d5f736368656d61"; + +impl Processor { + fn process_ethereum_schema(&mut self) -> &mut Self { + log::info!("set `PALLET_ETHEREUM_SCHEMA`"); + self.shell_state.0.insert(PALLET_ETHEREUM_SCHEMA.into(), "0x3".into()); + + self + } + + pub fn process_evm(&mut self) -> &mut Self { + self.process_ethereum_schema(); + + // Storage items. + // https://github.com/paritytech/frontier/blob/aca04f2269a9d6da2011f0c04069f0354fab01a1/frame/evm/src/lib.rs#L495-L502 + let mut account_codes = Map::default(); + let mut account_storages = Map::default(); + + log::info!("take `EVM::AccountCodes` and `EVM::AccountStorages`"); + self.solo_state + .take_raw(&item_key(b"EVM", b"AccountCodes"), &mut account_codes, |key, from| { + replace_first_match(key, from, &item_key(b"Evm", b"AccountCodes")) + }) + .take_raw(&item_key(b"EVM", b"AccountStorages"), &mut account_storages, |key, from| { + replace_first_match(key, from, &item_key(b"Evm", b"AccountStorages")) + }); + + log::info!("set `Evm::AccountCodes` and `Evm::AccountStorages`"); + self.shell_state.insert_raw(account_codes).insert_raw(account_storages); + + self + } +} + +#[test] +fn pallet_ethereum_schema_should_work() { + assert_eq!(array_bytes::bytes2hex("0x", b":ethereum_schema"), PALLET_ETHEREUM_SCHEMA); +} diff --git a/tool/state-processor/src/main.rs b/tool/state-processor/src/main.rs index 99bcf49a6..60a594a2f 100644 --- a/tool/state-processor/src/main.rs +++ b/tool/state-processor/src/main.rs @@ -1,4 +1,5 @@ mod balances; +mod evm; mod system; mod vesting; @@ -50,8 +51,7 @@ impl Processor { } fn process(mut self) -> Result<()> { - self.process_system(); - self.process_vesting(); + self.process_system().process_vesting().process_evm(); self.save() } @@ -269,6 +269,10 @@ fn get_last_64(key: &str) -> String { format!("0x{}", &key[key.len() - 64..]) } +fn identity(key: &str, _: &str) -> String { + key.into() +} + fn replace_first_match(key: &str, from: &str, to: &str) -> String { key.replacen(from, to, 1) } diff --git a/tool/state-processor/src/system/README.md b/tool/state-processor/src/system/README.md index d15e83f72..0d8a4e446 100644 --- a/tool/state-processor/src/system/README.md +++ b/tool/state-processor/src/system/README.md @@ -1,14 +1,14 @@ ### Process steps -- take solo account infos and remaining balances +- take solo `System::Account`, `Ethereum::RemainingRingBalance` and `Ethereum::RemainingKtonBalance` - adjust solo balance decimals - merge solo remaining balances -- take para account infos +- take para `System::Account` - process balances - - take solo balances total issuances and locks + - take solo `System::Account`, `Ethereum::RemainingRingBalance` and `Ethereum::RemainingKtonBalance` - prune solo balance locks - prune staking, phragmen election, democracy, vesting, relay authority, fee market locks - adjust solo balances items' decimals - - take para balances total issuances and locks + - take para `Balances::TotalIssuance` and `Balances::Locks` - there should not be any locks on parachain - check if there are any other locks - use all previous data to build the new accounts and calculate total issuances diff --git a/tool/state-processor/src/system/mod.rs b/tool/state-processor/src/system/mod.rs index 703c460f6..caee8dcf7 100644 --- a/tool/state-processor/src/system/mod.rs +++ b/tool/state-processor/src/system/mod.rs @@ -132,7 +132,7 @@ impl Processor { let mut remaining_ring = >::default(); let mut remaining_kton = >::default(); - log::info!("take solo account infos and remaining balances"); + log::info!("take solo `System::Account`, `Ethereum::RemainingRingBalance` and `Ethereum::RemainingKtonBalance`"); self.solo_state .take_map(b"System", b"Account", &mut account_infos, get_hashed_key) .take_map(b"Ethereum", b"RemainingRingBalance", &mut remaining_ring, get_hashed_key) @@ -174,7 +174,7 @@ impl Processor { fn process_para_account_infos(&mut self) -> Map { let mut account_infos = >::default(); - log::info!("take para account infos"); + log::info!("take para `System::Account`"); self.para_state.take_map(b"System", b"Account", &mut account_infos, get_hashed_key); account_infos diff --git a/tool/state-processor/src/vesting/README.md b/tool/state-processor/src/vesting/README.md index e6a889c80..7088a5e46 100644 --- a/tool/state-processor/src/vesting/README.md +++ b/tool/state-processor/src/vesting/README.md @@ -1,5 +1,5 @@ ### Process steps > There are only 3 vesting records on Crab and 1 vesting record on Darwinia. -- take `Vesting::Vesting` -- insert to `AccountMigration::Vestings` +- take solo `Vesting::Vesting` +- set `AccountMigration::Vestings` diff --git a/tool/state-processor/src/vesting/mod.rs b/tool/state-processor/src/vesting/mod.rs index 1865b5f5b..8a698139a 100644 --- a/tool/state-processor/src/vesting/mod.rs +++ b/tool/state-processor/src/vesting/mod.rs @@ -3,11 +3,15 @@ use crate::*; impl Processor { pub fn process_vesting(&mut self) -> &mut Self { + // Storage items. + // https://github.dev/paritytech/substrate/blob/19162e43be45817b44c7d48e50d03f074f60fbf4/frame/vesting/src/lib.rs#L188-L196 let mut vestings = Map::default(); + log::info!("take solo `Vesting::Vesting`"); self.solo_state.take_raw(&item_key(b"Vesting", b"Vesting"), &mut vestings, |key, from| { replace_first_match(key, from, &item_key(b"AccountMigration", b"Vestings")) }); + log::info!("set `Vesting::Vesting`"); self.shell_state.insert_raw(vestings); self From ab8261a34ceaa54437ccbf59b3abe2be29216ba8 Mon Sep 17 00:00:00 2001 From: Guantong <04637@163.com> Date: Thu, 15 Dec 2022 22:12:47 +0800 Subject: [PATCH 047/189] Configure instant sealing for dev chains (#119) * Add start_dev_node * Add start_dev_node to command Fix compile * Don't check relay chain for dev node * Correct chain spec Identify * Add instant finalize * Clean * Add tip * Fix CI * opt * format * Revert "Fix CI" This reverts commit 63ae56a8a4ff329a708de8ae7287b3a2133fac19. * Format Signed-off-by: Xavier Lau * Remove redundant clone Signed-off-by: Xavier Lau Co-authored-by: bear Co-authored-by: fisher Co-authored-by: Xavier Lau --- Cargo.lock | 3 + node/Cargo.toml | 3 + node/src/chain_spec/pangolin.rs | 14 +- node/src/command.rs | 31 +++- node/src/service/instant_finalize.rs | 54 +++++++ node/src/service/mod.rs | 229 ++++++++++++++++++++++++++- 6 files changed, 324 insertions(+), 10 deletions(-) create mode 100644 node/src/service/instant_finalize.rs diff --git a/Cargo.lock b/Cargo.lock index 71bf82e53..029954c8d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2222,6 +2222,7 @@ name = "darwinia" version = "6.0.0" dependencies = [ "array-bytes 6.0.0", + "async-trait", "clap", "crab-runtime", "cumulus-client-cli", @@ -2263,10 +2264,12 @@ dependencies = [ "sc-cli", "sc-client-api", "sc-consensus", + "sc-consensus-aura", "sc-executor", "sc-keystore", "sc-network", "sc-network-common", + "sc-offchain", "sc-rpc", "sc-rpc-api", "sc-service", diff --git a/node/Cargo.toml b/node/Cargo.toml index 84f406205..cf57504f6 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -15,6 +15,7 @@ substrate-build-script-utils = { git = "https://github.com/paritytech/substrate" [dependencies] # crates.io array-bytes = { version = "6.0" } +async-trait = { version = "0.1" } clap = { version = "3.2", features = ["derive"] } codec = { package = "parity-scale-codec", version = "3.2" } futures = { version = "0.3" } @@ -68,10 +69,12 @@ sc-chain-spec = { git = "https://github.com/paritytech/substrat sc-cli = { features = ["wasmtime"], git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sc-consensus-aura = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } sc-executor = { features = ["wasmtime"], git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } sc-keystore = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } sc-network = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } sc-network-common = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sc-offchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } sc-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } sc-rpc-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } sc-service = { features = ["wasmtime"], git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } diff --git a/node/src/chain_spec/pangolin.rs b/node/src/chain_spec/pangolin.rs index 31e26e5a6..2694b8331 100644 --- a/node/src/chain_spec/pangolin.rs +++ b/node/src/chain_spec/pangolin.rs @@ -154,8 +154,18 @@ pub fn genesis_config() -> ChainSpec { balances: Default::default(), transaction_payment: Default::default(), assets: AssetsConfig { - assets: vec![(AssetIds::PKton as _, array_bytes::hex_n_into_unchecked(ALITH), true, 1)], - metadata: vec![(AssetIds::PKton as _, b"Pangolin Commitment Token".to_vec(), b"PKTON".to_vec(), 18)], + assets: vec![( + AssetIds::PKton as _, + array_bytes::hex_n_into_unchecked(ALITH), + true, + 1, + )], + metadata: vec![( + AssetIds::PKton as _, + b"Pangolin Commitment Token".to_vec(), + b"PKTON".to_vec(), + 18, + )], ..Default::default() }, diff --git a/node/src/command.rs b/node/src/command.rs index 566199932..bc9f2ad21 100644 --- a/node/src/command.rs +++ b/node/src/command.rs @@ -558,9 +558,6 @@ pub fn run() -> Result<()> { .map_err(|e| format!("{:?}", e))?; let genesis_state = format!("0x{:?}", HexDisplay::from(&block.header().encode())); let tokio_handle = config.tokio_handle.clone(); - let polkadot_config = - SubstrateCli::create_configuration(&polkadot_cli, &polkadot_cli, tokio_handle) - .map_err(|err| format!("Relay chain argument error: {}", err))?; let eth_rpc_config = cli.eth_args.build_eth_rpc_config(); log::info!("Parachain id: {:?}", id); @@ -571,7 +568,33 @@ pub fn run() -> Result<()> { if config.role.is_authority() { "yes" } else { "no" } ); - crate::service::start_parachain_node( + if chain_spec.is_dev() { + return if chain_spec.is_crab() { + service::start_dev_node::( + config, + ð_rpc_config, + ) + .map_err(Into::into) + } else if chain_spec.is_pangolin() { + service::start_dev_node::( + config, + ð_rpc_config, + ) + .map_err(Into::into) + } else { + service::start_dev_node::( + config, + ð_rpc_config, + ) + .map_err(Into::into) + }; + } + + let polkadot_config = + SubstrateCli::create_configuration(&polkadot_cli, &polkadot_cli, tokio_handle) + .map_err(|err| format!("Relay chain argument error: {}", err))?; + + service::start_parachain_node( config, polkadot_config, collator_options, diff --git a/node/src/service/instant_finalize.rs b/node/src/service/instant_finalize.rs new file mode 100644 index 000000000..3b7de65d7 --- /dev/null +++ b/node/src/service/instant_finalize.rs @@ -0,0 +1,54 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// substrate +use sc_consensus::BlockImport; +use sp_runtime::traits::Block as BlockT; + +pub struct InstantFinalizeBlockImport(I); +impl InstantFinalizeBlockImport { + /// Create a new instance. + pub fn new(inner: I) -> Self { + Self(inner) + } +} +#[async_trait::async_trait] +impl BlockImport for InstantFinalizeBlockImport +where + Block: BlockT, + I: BlockImport + Send, +{ + type Error = I::Error; + type Transaction = I::Transaction; + + async fn check_block( + &mut self, + block: sc_consensus::BlockCheckParams, + ) -> Result { + self.0.check_block(block).await + } + + async fn import_block( + &mut self, + mut block_import_params: sc_consensus::BlockImportParams, + cache: std::collections::HashMap>, + ) -> Result { + block_import_params.finalized = true; + self.0.import_block(block_import_params, cache).await + } +} diff --git a/node/src/service/mod.rs b/node/src/service/mod.rs index 81ad7fceb..4385434fc 100644 --- a/node/src/service/mod.rs +++ b/node/src/service/mod.rs @@ -21,6 +21,8 @@ pub mod executors; pub use executors::*; +mod instant_finalize; + pub use crab_runtime::RuntimeApi as CrabRuntimeApi; pub use darwinia_runtime::RuntimeApi as DarwiniaRuntimeApi; pub use pangolin_runtime::RuntimeApi as PangolinRuntimeApi; @@ -65,7 +67,7 @@ impl IdentifyVariant for Box { } fn is_dev(&self) -> bool { - self.id().ends_with("dev") + self.id().ends_with("development") } } @@ -113,7 +115,7 @@ pub fn new_partial( sc_service::PartialComponents< FullClient, FullBackend, - (), + sc_consensus::LongestChain, sc_consensus::DefaultImportQueue>, sc_transaction_pool::FullPool>, ( @@ -187,13 +189,13 @@ where let fee_history_cache_limit = eth_rpc_config.fee_history_limit; Ok(sc_service::PartialComponents { - backend, + backend: backend.clone(), client, import_queue, keystore_container, task_manager, transaction_pool, - select_chain: (), + select_chain: sc_consensus::LongestChain::new(backend), other: ( frontier_backend, filter_pool, @@ -623,3 +625,222 @@ pub async fn start_parachain_node( ) .await } + +/// Start a dev node which can seal instantly. +/// !!! WARNING: DO NOT USE ELSEWHERE +pub fn start_dev_node( + config: sc_service::Configuration, + eth_rpc_config: &crate::cli::EthRpcConfig, +) -> Result +where + RuntimeApi: sp_api::ConstructRuntimeApi> + + Send + + Sync + + 'static, + RuntimeApi::RuntimeApi: + RuntimeApiCollection>, + RuntimeApi::RuntimeApi: sp_consensus_aura::AuraApi, + Executor: 'static + sc_executor::NativeExecutionDispatch, +{ + // substrate + use sc_client_api::HeaderBackend; + + let sc_service::PartialComponents { + client, + backend, + mut task_manager, + import_queue, + keystore_container, + select_chain, + transaction_pool, + other: + ( + frontier_backend, + filter_pool, + fee_history_cache, + fee_history_cache_limit, + _telemetry, + _telemetry_worker_handle, + ), + } = new_partial::(&config, eth_rpc_config)?; + + let (network, system_rpc_tx, tx_handler_controller, start_network) = + sc_service::build_network(sc_service::BuildNetworkParams { + config: &config, + client: client.clone(), + transaction_pool: transaction_pool.clone(), + spawn_handle: task_manager.spawn_handle(), + import_queue, + block_announce_validator_builder: None, + warp_sync: None, + })?; + + if config.offchain_worker.enabled { + let offchain_workers = Arc::new(sc_offchain::OffchainWorkers::new_with_options( + client.clone(), + sc_offchain::OffchainWorkerOptions { enable_http_requests: false }, + )); + + // Start the offchain workers to have + task_manager.spawn_handle().spawn( + "offchain-notifications", + None, + sc_offchain::notification_future( + config.role.is_authority(), + client.clone(), + offchain_workers, + task_manager.spawn_handle(), + network.clone(), + ), + ); + } + + let force_authoring = config.force_authoring; + let backoff_authoring_blocks: Option<()> = None; + let proposer_factory = sc_basic_authorship::ProposerFactory::new( + task_manager.spawn_handle(), + client.clone(), + transaction_pool.clone(), + None, + None, + ); + + let slot_duration = sc_consensus_aura::slot_duration(&*client)?; + let client_for_cidp = client.clone(); + if config.role.is_authority() { + let aura = sc_consensus_aura::start_aura::< + sp_consensus_aura::sr25519::AuthorityPair, + _, + _, + _, + _, + _, + _, + _, + _, + _, + _, + >(sc_consensus_aura::StartAuraParams { + slot_duration: sc_consensus_aura::slot_duration(&*client)?, + client: client.clone(), + select_chain, + block_import: instant_finalize::InstantFinalizeBlockImport::new(client.clone()), + proposer_factory, + create_inherent_data_providers: move |block: Hash, ()| { + let current_para_block = client_for_cidp + .number(block) + .expect("Header lookup should succeed") + .expect("Header passed in as parent should be present in backend."); + let client_for_xcm = client_for_cidp.clone(); + + async move { + let timestamp = sp_timestamp::InherentDataProvider::from_system_time(); + + let slot = sp_consensus_aura::inherents::InherentDataProvider::from_timestamp_and_slot_duration( + *timestamp, + slot_duration, + ); + + let mocked_parachain = + cumulus_primitives_parachain_inherent::MockValidationDataInherentDataProvider { + current_para_block, + relay_offset: 1000, + relay_blocks_per_para_block: 2, + para_blocks_per_relay_epoch: 0, + relay_randomness_config: (), + xcm_config: cumulus_primitives_parachain_inherent::MockXcmConfig::new( + &*client_for_xcm, + block, + Default::default(), + Default::default(), + ), + raw_downward_messages: vec![], + raw_horizontal_messages: vec![], + }; + + Ok((slot, timestamp, mocked_parachain)) + } + }, + force_authoring, + backoff_authoring_blocks, + keystore: keystore_container.sync_keystore(), + sync_oracle: network.clone(), + justification_sync_link: network.clone(), + // We got around 500ms for proposing + block_proposal_slot_portion: cumulus_client_consensus_aura::SlotProportion::new( + 1f32 / 24f32, + ), + // And a maximum of 750ms if slots are skipped + max_block_proposal_slot_portion: Some( + cumulus_client_consensus_aura::SlotProportion::new(1f32 / 16f32), + ), + telemetry: None, + })?; + + // the AURA authoring task is considered essential, i.e. if it + // fails we take down the service with it. + task_manager.spawn_essential_handle().spawn_blocking("aura", Some("block-authoring"), aura); + } else { + log::warn!("You could add --alice or --bob to make dev chain seal instantly."); + } + + let prometheus_registry = config.prometheus_registry().cloned(); + let overrides = frontier_service::overrides_handle(client.clone()); + let block_data_cache = Arc::new(fc_rpc::EthBlockDataCacheTask::new( + task_manager.spawn_handle(), + overrides.clone(), + eth_rpc_config.eth_log_block_cache, + eth_rpc_config.eth_statuses_cache, + prometheus_registry, + )); + + let rpc_extensions_builder = { + let client = client.clone(); + let pool = transaction_pool.clone(); + let network = network.clone(); + let filter_pool = filter_pool; + let frontier_backend = frontier_backend; + let overrides = overrides; + let fee_history_cache = fee_history_cache; + let max_past_logs = eth_rpc_config.max_past_logs; + let collator = config.role.is_authority(); + + Box::new(move |deny_unsafe, subscription_task_executor| { + let deps = crate::rpc::FullDeps { + client: client.clone(), + pool: pool.clone(), + graph: pool.pool().clone(), + deny_unsafe, + is_authority: collator, + network: network.clone(), + filter_pool: filter_pool.clone(), + backend: frontier_backend.clone(), + max_past_logs, + fee_history_cache: fee_history_cache.clone(), + fee_history_cache_limit, + overrides: overrides.clone(), + block_data_cache: block_data_cache.clone(), + }; + + crate::rpc::create_full(deps, subscription_task_executor).map_err(Into::into) + }) + }; + + sc_service::spawn_tasks(sc_service::SpawnTasksParams { + rpc_builder: Box::new(rpc_extensions_builder), + client, + transaction_pool, + task_manager: &mut task_manager, + config, + keystore: keystore_container.sync_keystore(), + backend, + network, + system_rpc_tx, + tx_handler_controller, + telemetry: None, + })?; + + start_network.start_network(); + + Ok(task_manager) +} From d29a9bd4b9d4436343a641ca54d6eeb122c8c3e7 Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Thu, 15 Dec 2022 22:28:21 +0800 Subject: [PATCH 048/189] Optimize storage (#132) --- pallet/staking/src/lib.rs | 45 ++++++++++++++++++++++------------- pallet/staking/tests/mock.rs | 1 - pallet/staking/tests/tests.rs | 15 ++---------- 3 files changed, 31 insertions(+), 30 deletions(-) diff --git a/pallet/staking/src/lib.rs b/pallet/staking/src/lib.rs index a12c08a06..041ce026e 100644 --- a/pallet/staking/src/lib.rs +++ b/pallet/staking/src/lib.rs @@ -114,8 +114,6 @@ pub struct Ledger where T: Config, { - /// Staker. - pub account: T::AccountId, /// Staked RING. pub staked_ring: Balance, /// Staked KTON. @@ -367,7 +365,6 @@ pub mod pallet { >::inc_consumers(&who)?; *l = Some(Ledger { - account: who.to_owned(), staked_ring: Default::default(), staked_kton: Default::default(), staked_deposits: Default::default(), @@ -380,14 +377,14 @@ pub mod pallet { }; if ring_amount != 0 { - Self::stake_ring(l, ring_amount)?; + Self::stake_ring(&who, l, ring_amount)?; } if kton_amount != 0 { - Self::stake_kton(l, kton_amount)?; + Self::stake_kton(&who, l, kton_amount)?; } for d in deposits.clone() { - Self::stake_deposit(l, d)?; + Self::stake_deposit(&who, l, d)?; } DispatchResult::Ok(()) @@ -428,7 +425,7 @@ pub mod pallet { } for d in deposits { - Self::unstake_deposit(l, d)?; + Self::unstake_deposit(&who, l, d)?; } DispatchResult::Ok(()) @@ -526,8 +523,12 @@ pub mod pallet { }) } - fn stake_ring(ledger: &mut Ledger, amount: Balance) -> DispatchResult { - T::Ring::stake(&ledger.account, amount)?; + fn stake_ring( + who: &T::AccountId, + ledger: &mut Ledger, + amount: Balance, + ) -> DispatchResult { + T::Ring::stake(who, amount)?; ledger.staked_ring = ledger .staked_ring @@ -539,8 +540,12 @@ pub mod pallet { Ok(()) } - fn stake_kton(ledger: &mut Ledger, amount: Balance) -> DispatchResult { - T::Kton::stake(&ledger.account, amount)?; + fn stake_kton( + who: &T::AccountId, + ledger: &mut Ledger, + amount: Balance, + ) -> DispatchResult { + T::Kton::stake(who, amount)?; ledger.staked_kton = ledger .staked_kton @@ -552,12 +557,16 @@ pub mod pallet { Ok(()) } - fn stake_deposit(ledger: &mut Ledger, deposit: DepositId) -> DispatchResult { - T::Deposit::stake(&ledger.account, deposit)?; + fn stake_deposit( + who: &T::AccountId, + ledger: &mut Ledger, + deposit: DepositId, + ) -> DispatchResult { + T::Deposit::stake(who, deposit)?; ledger.staked_deposits.try_push(deposit).map_err(|_| >::ExceedMaxDeposits)?; - Self::update_pool::>(true, T::Deposit::amount(&ledger.account, deposit))?; + Self::update_pool::>(true, T::Deposit::amount(who, deposit))?; Ok(()) } @@ -602,7 +611,11 @@ pub mod pallet { Ok(()) } - fn unstake_deposit(ledger: &mut Ledger, deposit: DepositId) -> DispatchResult { + fn unstake_deposit( + who: &T::AccountId, + ledger: &mut Ledger, + deposit: DepositId, + ) -> DispatchResult { let i = ledger.staked_deposits.iter().position(|d| d == &deposit).ok_or( "[pallet::staking] deposit id must be existed, due to previous unstake OP; qed", )?; @@ -615,7 +628,7 @@ pub mod pallet { )) .map_err(|_| >::ExceedMaxUnstakings)?; - Self::update_pool::>(false, T::Deposit::amount(&ledger.account, deposit))?; + Self::update_pool::>(false, T::Deposit::amount(who, deposit))?; Ok(()) } diff --git a/pallet/staking/tests/mock.rs b/pallet/staking/tests/mock.rs index d25ca8c88..dbb9cfdca 100644 --- a/pallet/staking/tests/mock.rs +++ b/pallet/staking/tests/mock.rs @@ -234,7 +234,6 @@ pub trait ZeroDefault { impl ZeroDefault for darwinia_staking::Ledger { fn default() -> Self { Self { - account: Default::default(), staked_ring: Default::default(), staked_kton: Default::default(), staked_deposits: Default::default(), diff --git a/pallet/staking/tests/tests.rs b/pallet/staking/tests/tests.rs index 7c3bbf958..09735d826 100644 --- a/pallet/staking/tests/tests.rs +++ b/pallet/staking/tests/tests.rs @@ -41,7 +41,7 @@ fn stake_should_work() { assert_eq!(System::account(1).consumers, 1); assert_eq!( Staking::ledger_of(1).unwrap(), - Ledger { account: 1, staked_ring: UNIT, ..ZeroDefault::default() } + Ledger { staked_ring: UNIT, ..ZeroDefault::default() } ); assert_eq!(Balances::free_balance(1), 999 * UNIT); @@ -51,7 +51,7 @@ fn stake_should_work() { assert_eq!(Assets::balance(0, 1), 999 * UNIT); assert_eq!( Staking::ledger_of(1).unwrap(), - Ledger { account: 1, staked_ring: UNIT, staked_kton: UNIT, ..ZeroDefault::default() } + Ledger { staked_ring: UNIT, staked_kton: UNIT, ..ZeroDefault::default() } ); // Stake 1 deposit. @@ -61,7 +61,6 @@ fn stake_should_work() { assert_eq!( Staking::ledger_of(1).unwrap(), Ledger { - account: 1, staked_ring: UNIT, staked_kton: UNIT, staked_deposits: BoundedVec::truncate_from(vec![0]), @@ -79,7 +78,6 @@ fn stake_should_work() { assert_eq!( Staking::ledger_of(1).unwrap(), Ledger { - account: 1, staked_ring: 501 * UNIT, staked_kton: 501 * UNIT, staked_deposits: BoundedVec::truncate_from(vec![0, 1, 2]), @@ -101,7 +99,6 @@ fn unstake_should_work() { assert_eq!( Staking::ledger_of(1).unwrap(), Ledger { - account: 1, staked_ring: 2 * UNIT, staked_kton: 2 * UNIT, staked_deposits: BoundedVec::truncate_from(vec![0, 1, 2]), @@ -114,7 +111,6 @@ fn unstake_should_work() { assert_eq!( Staking::ledger_of(1).unwrap(), Ledger { - account: 1, staked_ring: 1 * UNIT, staked_kton: 2 * UNIT, staked_deposits: BoundedVec::truncate_from(vec![0, 1, 2]), @@ -129,7 +125,6 @@ fn unstake_should_work() { assert_eq!( Staking::ledger_of(1).unwrap(), Ledger { - account: 1, staked_ring: 1 * UNIT, staked_kton: 1 * UNIT, staked_deposits: BoundedVec::truncate_from(vec![0, 1, 2]), @@ -145,7 +140,6 @@ fn unstake_should_work() { assert_eq!( Staking::ledger_of(1).unwrap(), Ledger { - account: 1, staked_ring: 1 * UNIT, staked_kton: 1 * UNIT, staked_deposits: BoundedVec::truncate_from(vec![1, 2]), @@ -161,7 +155,6 @@ fn unstake_should_work() { assert_eq!( Staking::ledger_of(1).unwrap(), Ledger { - account: 1, staked_ring: 0, staked_kton: 0, staked_deposits: Default::default(), @@ -197,7 +190,6 @@ fn claim_should_work() { assert_eq!( Staking::ledger_of(1).unwrap(), Ledger { - account: 1, staked_ring: 0, staked_kton: 0, staked_deposits: Default::default(), @@ -214,7 +206,6 @@ fn claim_should_work() { assert_eq!( Staking::ledger_of(1).unwrap(), Ledger { - account: 1, staked_ring: 0, staked_kton: 0, staked_deposits: Default::default(), @@ -232,7 +223,6 @@ fn claim_should_work() { assert_eq!( Staking::ledger_of(1).unwrap(), Ledger { - account: 1, staked_ring: 0, staked_kton: 0, staked_deposits: Default::default(), @@ -250,7 +240,6 @@ fn claim_should_work() { assert_eq!( Staking::ledger_of(1).unwrap(), Ledger { - account: 1, staked_ring: 0, staked_kton: 0, staked_deposits: Default::default(), From b161ead102fa426610e5bdd24bbc4f897cf13c60 Mon Sep 17 00:00:00 2001 From: Guantong <04637@163.com> Date: Fri, 16 Dec 2022 10:39:33 +0800 Subject: [PATCH 049/189] Update bridge deps (#134) * Update bridge deps * Correct version of cfg-if for `twox-hash` --- Cargo.lock | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 029954c8d..531368524 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -755,7 +755,7 @@ dependencies = [ [[package]] name = "bp-darwinia-core" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.30#eb71a8eea2679c8fe6cd04c7c98421a631f63838" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.30#dd55c3dbc30f54e93fc231e9161a810153a8c266" dependencies = [ "account", "bp-messages", @@ -772,7 +772,7 @@ dependencies = [ [[package]] name = "bp-header-chain" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.30#eb71a8eea2679c8fe6cd04c7c98421a631f63838" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.30#dd55c3dbc30f54e93fc231e9161a810153a8c266" dependencies = [ "bp-runtime", "finality-grandpa", @@ -789,7 +789,7 @@ dependencies = [ [[package]] name = "bp-message-dispatch" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.30#eb71a8eea2679c8fe6cd04c7c98421a631f63838" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.30#dd55c3dbc30f54e93fc231e9161a810153a8c266" dependencies = [ "bp-runtime", "frame-support", @@ -802,7 +802,7 @@ dependencies = [ [[package]] name = "bp-messages" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.30#eb71a8eea2679c8fe6cd04c7c98421a631f63838" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.30#dd55c3dbc30f54e93fc231e9161a810153a8c266" dependencies = [ "bitvec", "bp-runtime", @@ -819,7 +819,7 @@ dependencies = [ [[package]] name = "bp-parachains" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.30#eb71a8eea2679c8fe6cd04c7c98421a631f63838" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.30#dd55c3dbc30f54e93fc231e9161a810153a8c266" dependencies = [ "bp-polkadot-core", "bp-runtime", @@ -832,7 +832,7 @@ dependencies = [ [[package]] name = "bp-polkadot-core" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.30#eb71a8eea2679c8fe6cd04c7c98421a631f63838" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.30#dd55c3dbc30f54e93fc231e9161a810153a8c266" dependencies = [ "bp-messages", "bp-runtime", @@ -852,7 +852,7 @@ dependencies = [ [[package]] name = "bp-runtime" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.30#eb71a8eea2679c8fe6cd04c7c98421a631f63838" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.30#dd55c3dbc30f54e93fc231e9161a810153a8c266" dependencies = [ "frame-support", "frame-system", @@ -873,7 +873,7 @@ dependencies = [ [[package]] name = "bp-test-utils" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.30#eb71a8eea2679c8fe6cd04c7c98421a631f63838" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.30#dd55c3dbc30f54e93fc231e9161a810153a8c266" dependencies = [ "bp-header-chain", "ed25519-dalek", @@ -888,7 +888,7 @@ dependencies = [ [[package]] name = "bridge-runtime-common" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.30#eb71a8eea2679c8fe6cd04c7c98421a631f63838" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.30#dd55c3dbc30f54e93fc231e9161a810153a8c266" dependencies = [ "bp-message-dispatch", "bp-messages", @@ -6514,7 +6514,7 @@ dependencies = [ [[package]] name = "pallet-bridge-dispatch" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.30#eb71a8eea2679c8fe6cd04c7c98421a631f63838" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.30#dd55c3dbc30f54e93fc231e9161a810153a8c266" dependencies = [ "bp-message-dispatch", "bp-runtime", @@ -6530,7 +6530,7 @@ dependencies = [ [[package]] name = "pallet-bridge-grandpa" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.30#eb71a8eea2679c8fe6cd04c7c98421a631f63838" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.30#dd55c3dbc30f54e93fc231e9161a810153a8c266" dependencies = [ "bp-header-chain", "bp-runtime", @@ -6552,7 +6552,7 @@ dependencies = [ [[package]] name = "pallet-bridge-messages" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.30#eb71a8eea2679c8fe6cd04c7c98421a631f63838" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.30#dd55c3dbc30f54e93fc231e9161a810153a8c266" dependencies = [ "bitvec", "bp-message-dispatch", @@ -6573,7 +6573,7 @@ dependencies = [ [[package]] name = "pallet-bridge-parachains" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.30#eb71a8eea2679c8fe6cd04c7c98421a631f63838" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.30#dd55c3dbc30f54e93fc231e9161a810153a8c266" dependencies = [ "bp-parachains", "bp-polkadot-core", @@ -6821,7 +6821,7 @@ dependencies = [ [[package]] name = "pallet-fee-market" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.30#eb71a8eea2679c8fe6cd04c7c98421a631f63838" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.30#dd55c3dbc30f54e93fc231e9161a810153a8c266" dependencies = [ "bp-messages", "bp-runtime", From 4187b7b5f3f5e579b6504fa3f5103fe572bcbcb0 Mon Sep 17 00:00:00 2001 From: bear Date: Tue, 20 Dec 2022 12:00:40 +0800 Subject: [PATCH 050/189] Fix account insert key (#139) * Fix account insert bug * Code clean * Delete empty line --- pallet/account-migration/src/lib.rs | 2 +- tool/state-processor/Cargo.lock | 2614 ++++++++++++++++++++++-- tool/state-processor/Cargo.toml | 4 + tool/state-processor/src/evm/mod.rs | 8 +- tool/state-processor/src/system/mod.rs | 54 +- 5 files changed, 2507 insertions(+), 175 deletions(-) diff --git a/pallet/account-migration/src/lib.rs b/pallet/account-migration/src/lib.rs index b43f48e28..b4f9e1851 100644 --- a/pallet/account-migration/src/lib.rs +++ b/pallet/account-migration/src/lib.rs @@ -110,7 +110,7 @@ pub mod pallet { #[pallet::storage] #[pallet::getter(fn account_of)] pub type Accounts = - StorageMap<_, Identity, AccountId32, AccountInfo>>; + StorageMap<_, Blake2_128Concat, AccountId32, AccountInfo>>; /// [`pallet_vesting::Vesting`] data. /// diff --git a/tool/state-processor/Cargo.lock b/tool/state-processor/Cargo.lock index 8365b0cd8..39db17a24 100644 --- a/tool/state-processor/Cargo.lock +++ b/tool/state-processor/Cargo.lock @@ -2,6 +2,42 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "Inflector" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" +dependencies = [ + "lazy_static", + "regex", +] + +[[package]] +name = "addr2line" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a76fd60b23679b7d19bd066031410fb7e458ccc5e958eb5c325888ce4baedc97" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" + +[[package]] +name = "ahash" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" +dependencies = [ + "getrandom 0.2.8", + "once_cell", + "version_check", +] + [[package]] name = "aho-corasick" version = "0.7.19" @@ -11,6 +47,24 @@ dependencies = [ "memchr", ] +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + +[[package]] +name = "ansi_term" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" +dependencies = [ + "winapi", +] + [[package]] name = "anyhow" version = "1.0.66" @@ -29,6 +83,12 @@ version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "22f72e9d6fac4bc80778ea470b20197b88d28c292bb7d60c3fb099280003cd19" +[[package]] +name = "arrayref" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" + [[package]] name = "arrayvec" version = "0.4.12" @@ -38,12 +98,29 @@ dependencies = [ "nodrop", ] +[[package]] +name = "arrayvec" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" + [[package]] name = "arrayvec" version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +[[package]] +name = "async-trait" +version = "0.1.60" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d1d8ab452a3936018a687b20e6f7cf5363d713b732b8884001317b0e48aa3" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "atty" version = "0.2.14" @@ -55,6 +132,57 @@ dependencies = [ "winapi", ] +[[package]] +name = "autocfg" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + +[[package]] +name = "backtrace" +version = "0.3.67" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "233d376d6d185f2a3093e58f283f60f880315b6c60075b01f36b3b85154564ca" +dependencies = [ + "addr2line", + "cc", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", +] + +[[package]] +name = "base16ct" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "349a06037c7bf932dd7e7d1f653678b2038b9ad46a74102f1fc7bd7872678cce" + +[[package]] +name = "base58" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6107fe1be6682a68940da878d9e9f5e90ca5745b3dec9fd1bb393c8777d4f581" + +[[package]] +name = "base64" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" + +[[package]] +name = "base64ct" +version = "1.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b645a089122eccb6111b4f81cbc1a49f5900ac4666bb93ac027feaecf15607bf" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + [[package]] name = "bitvec" version = "1.0.1" @@ -67,6 +195,15 @@ dependencies = [ "wyz", ] +[[package]] +name = "blake2" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" +dependencies = [ + "digest 0.10.5", +] + [[package]] name = "blake2-rfc" version = "0.2.18" @@ -77,39 +214,136 @@ dependencies = [ "constant_time_eq", ] +[[package]] +name = "block-buffer" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" +dependencies = [ + "block-padding", + "byte-tools", + "byteorder", + "generic-array 0.12.4", +] + +[[package]] +name = "block-buffer" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" +dependencies = [ + "generic-array 0.14.6", +] + [[package]] name = "block-buffer" version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "69cce20737498f97b993470a6e536b8523f0af7892a4f928cceb1ac5e52ebe7e" dependencies = [ - "generic-array", + "generic-array 0.14.6", +] + +[[package]] +name = "block-padding" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5" +dependencies = [ + "byte-tools", ] +[[package]] +name = "bumpalo" +version = "3.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "572f695136211188308f16ad2ca5c851a712c464060ae6974944458eb83880ba" + [[package]] name = "byte-slice-cast" version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c" +[[package]] +name = "byte-tools" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" + [[package]] name = "byteorder" version = "1.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" +[[package]] +name = "bytes" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfb24e866b15a1af2a1b663f10c6b6b8f397a84aadb828f12e5b289ec23a3a3c" + +[[package]] +name = "cc" +version = "1.0.78" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a20104e2335ce8a659d6dd92a51a767a0c062599c73b343fd152cb401e828c3d" + +[[package]] +name = "cfg-expr" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0aacacf4d96c24b2ad6eb8ee6df040e4f27b0d0b39a5710c30091baa830485db" +dependencies = [ + "smallvec", +] + [[package]] name = "cfg-if" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "chrono" +version = "0.4.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16b0a3d9ed01224b22057780a37bb8c5dbfe1be8ba48678e7bf57ec4b385411f" +dependencies = [ + "iana-time-zone", + "num-integer", + "num-traits", + "winapi", +] + +[[package]] +name = "codespan-reporting" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e" +dependencies = [ + "termcolor", + "unicode-width", +] + +[[package]] +name = "const-oid" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4c78c047431fee22c1a7bb92e00ad095a02a983affe4d8a72e2a2c62c1b94f3" + [[package]] name = "constant_time_eq" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" +[[package]] +name = "core-foundation-sys" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" + [[package]] name = "cpufeatures" version = "0.2.5" @@ -125,98 +359,112 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" +[[package]] +name = "crypto-bigint" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03c6a1d5fa1de37e071642dfa44ec552ca5b299adb128fab16138e24b548fd21" +dependencies = [ + "generic-array 0.14.6", + "rand_core 0.6.4", + "subtle", + "zeroize", +] + [[package]] name = "crypto-common" version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ - "generic-array", + "generic-array 0.14.6", "typenum", ] [[package]] -name = "digest" -version = "0.10.5" +name = "crypto-mac" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adfbc57365a37acbd2ebf2b64d7e69bb766e2fea813521ed536f5d0520dcf86c" +checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab" dependencies = [ - "block-buffer", - "crypto-common", + "generic-array 0.14.6", + "subtle", ] [[package]] -name = "env_logger" -version = "0.7.1" +name = "crypto-mac" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36" +checksum = "b1d1a86f49236c215f271d40892d5fc950490551400b02ef360692c29815c714" dependencies = [ - "atty", - "humantime", - "log", - "regex", - "termcolor", + "generic-array 0.14.6", + "subtle", ] [[package]] -name = "funty" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" - -[[package]] -name = "fxhash" -version = "0.2.1" +name = "curve25519-dalek" +version = "2.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" +checksum = "4a9b85542f99a2dfa2a1b8e192662741c9859a846b296bef1c92ef9b58b5a216" dependencies = [ "byteorder", + "digest 0.8.1", + "rand_core 0.5.1", + "subtle", + "zeroize", ] [[package]] -name = "generic-array" -version = "0.14.6" +name = "curve25519-dalek" +version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bff49e947297f3312447abdca79f45f4738097cc82b06e72054d2223f601f1b9" +checksum = "0b9fdf9972b2bd6af2d913799d9ebc165ea4d2e65878e329d9c6b372c4491b61" dependencies = [ - "typenum", - "version_check", + "byteorder", + "digest 0.9.0", + "rand_core 0.5.1", + "subtle", + "zeroize", ] [[package]] -name = "getrandom" -version = "0.2.8" +name = "cxx" +version = "1.0.85" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" +checksum = "5add3fc1717409d029b20c5b6903fc0c0b02fa6741d820054f4a2efa5e5816fd" dependencies = [ - "cfg-if", - "libc", - "wasi", + "cc", + "cxxbridge-flags", + "cxxbridge-macro", + "link-cplusplus", ] [[package]] -name = "hermit-abi" -version = "0.1.19" +name = "cxx-build" +version = "1.0.85" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" +checksum = "b4c87959ba14bc6fbc61df77c3fcfe180fc32b93538c4f1031dd802ccb5f2ff0" dependencies = [ - "libc", + "cc", + "codespan-reporting", + "once_cell", + "proc-macro2", + "quote", + "scratch", + "syn", ] [[package]] -name = "humantime" -version = "1.3.0" +name = "cxxbridge-flags" +version = "1.0.85" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df004cfca50ef23c36850aaaa59ad52cc70d0e90243c3c7737a4dd32dc7a3c4f" -dependencies = [ - "quick-error", -] +checksum = "69a3e162fde4e594ed2b07d0f83c6c67b745e7f28ce58c6df5e6b6bef99dfb59" [[package]] -name = "impl-trait-for-tuples" -version = "0.2.2" +name = "cxxbridge-macro" +version = "1.0.85" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11d7a9f6330b71fea57921c9b61c47ee6e84f72d394754eff6163ae67e7395eb" +checksum = "3e7e2adeb6a0d4a282e581096b06e1791532b7d576dcde5ccd9382acf55db8e6" dependencies = [ "proc-macro2", "quote", @@ -224,220 +472,1883 @@ dependencies = [ ] [[package]] -name = "itoa" -version = "1.0.4" +name = "der" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4217ad341ebadf8d8e724e264f13e593e0648f5b3e94b3896a5df283be015ecc" +checksum = "6919815d73839e7ad218de758883aae3a257ba6759ce7a9992501efbb53d705c" +dependencies = [ + "const-oid", +] [[package]] -name = "libc" -version = "0.2.137" +name = "derive_more" +version = "0.99.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc7fcc620a3bff7cdd7a365be3376c97191aeaccc2a603e600951e452615bf89" +checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] [[package]] -name = "log" -version = "0.4.17" +name = "digest" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" +checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" dependencies = [ - "cfg-if", + "generic-array 0.12.4", ] [[package]] -name = "memchr" -version = "2.5.0" +name = "digest" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" +checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" +dependencies = [ + "generic-array 0.14.6", +] [[package]] -name = "nodrop" -version = "0.1.14" +name = "digest" +version = "0.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" +checksum = "adfbc57365a37acbd2ebf2b64d7e69bb766e2fea813521ed536f5d0520dcf86c" +dependencies = [ + "block-buffer 0.10.3", + "crypto-common", + "subtle", +] [[package]] -name = "once_cell" -version = "1.16.0" +name = "downcast-rs" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860" +checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" [[package]] -name = "parity-scale-codec" -version = "3.2.1" +name = "dyn-clonable" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "366e44391a8af4cfd6002ef6ba072bae071a96aafca98d7d448a34c5dca38b6a" +checksum = "4e9232f0e607a262ceb9bd5141a3dfb3e4db6994b31989bbfd845878cba59fd4" dependencies = [ - "arrayvec 0.7.2", - "bitvec", - "byte-slice-cast", - "impl-trait-for-tuples", - "parity-scale-codec-derive", - "serde", + "dyn-clonable-impl", + "dyn-clone", ] [[package]] -name = "parity-scale-codec-derive" -version = "3.1.3" +name = "dyn-clonable-impl" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9299338969a3d2f491d65f140b00ddec470858402f888af98e8642fb5e8965cd" +checksum = "558e40ea573c374cf53507fd240b7ee2f5477df7cfebdb97323ec61c719399c5" dependencies = [ - "proc-macro-crate", "proc-macro2", "quote", "syn", ] [[package]] -name = "ppv-lite86" -version = "0.2.17" +name = "dyn-clone" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" +checksum = "c9b0705efd4599c15a38151f4721f7bc388306f61084d3bfd50bd07fbca5cb60" [[package]] -name = "pretty_env_logger" -version = "0.4.0" +name = "ecdsa" +version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "926d36b9553851b8b0005f1275891b392ee4d2d833852c417ed025477350fb9d" +checksum = "d0d69ae62e0ce582d56380743515fefaf1a8c70cec685d9677636d7e30ae9dc9" dependencies = [ - "env_logger", - "log", + "der", + "elliptic-curve", + "rfc6979", + "signature", ] [[package]] -name = "proc-macro-crate" -version = "1.2.1" +name = "ed25519-zebra" +version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eda0fc3b0fb7c975631757e14d9049da17374063edb6ebbcbc54d880d4fe94e9" +checksum = "7c24f403d068ad0b359e577a77f92392118be3f3c927538f2bb544a5ecd828c6" dependencies = [ - "once_cell", - "thiserror", - "toml", + "curve25519-dalek 3.2.0", + "hashbrown", + "hex", + "rand_core 0.6.4", + "sha2 0.9.9", + "zeroize", ] [[package]] -name = "proc-macro2" -version = "1.0.47" +name = "either" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ea3d908b0e36316caf9e9e2c4625cdde190a7e6f440d794667ed17a1855e725" +checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797" + +[[package]] +name = "elliptic-curve" +version = "0.11.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25b477563c2bfed38a3b7a60964c49e058b2510ad3f12ba3483fd8f62c2306d6" dependencies = [ - "unicode-ident", + "base16ct", + "crypto-bigint", + "der", + "ff", + "generic-array 0.14.6", + "group", + "rand_core 0.6.4", + "sec1", + "subtle", + "zeroize", ] [[package]] -name = "quick-error" -version = "1.2.3" +name = "env_logger" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" +checksum = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36" +dependencies = [ + "atty", + "humantime", + "log", + "regex", + "termcolor", +] [[package]] -name = "quote" -version = "1.0.21" +name = "environmental" +version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179" +checksum = "e48c92028aaa870e83d51c64e5d4e0b6981b360c522198c23959f219a4e1b15b" + +[[package]] +name = "fake-simd" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" + +[[package]] +name = "ff" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "131655483be284720a17d74ff97592b8e76576dc25563148601df2d7c9080924" dependencies = [ - "proc-macro2", + "rand_core 0.6.4", + "subtle", ] [[package]] -name = "radium" +name = "fixed-hash" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" +checksum = "cfcf0ed7fe52a17a03854ec54a9f76d6d84508d1c0e66bc1793301c73fc8493c" +dependencies = [ + "byteorder", + "rand 0.8.5", + "rustc-hex", + "static_assertions", +] [[package]] -name = "rand" -version = "0.8.5" +name = "frame-metadata" +version = "15.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +checksum = "df6bb8542ef006ef0de09a5c4420787d79823c0ed7924225822362fd2bf2ff2d" dependencies = [ - "libc", - "rand_chacha", - "rand_core", + "cfg-if", + "parity-scale-codec", + "scale-info", + "serde", ] [[package]] -name = "rand_chacha" -version = "0.3.1" +name = "frame-support" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "bitflags", + "frame-metadata", + "frame-support-procedural", + "impl-trait-for-tuples", + "k256", + "log", + "once_cell", + "parity-scale-codec", + "paste", + "scale-info", + "serde", + "smallvec", + "sp-api", + "sp-arithmetic", + "sp-core", + "sp-core-hashing-proc-macro", + "sp-inherents", + "sp-io", + "sp-runtime", + "sp-staking", + "sp-state-machine", + "sp-std", + "sp-tracing", + "sp-weights", + "tt-call", +] + +[[package]] +name = "frame-support-procedural" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "Inflector", + "cfg-expr", + "frame-support-procedural-tools", + "itertools", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "frame-support-procedural-tools" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "frame-support-procedural-tools-derive", + "proc-macro-crate", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "frame-support-procedural-tools-derive" +version = "3.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "funty" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" + +[[package]] +name = "futures" +version = "0.3.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38390104763dc37a5145a53c29c63c1290b5d316d6086ec32c293f6736051bb0" dependencies = [ - "ppv-lite86", - "rand_core", + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", ] [[package]] -name = "rand_core" -version = "0.6.4" +name = "futures-channel" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +checksum = "52ba265a92256105f45b719605a571ffe2d1f0fea3807304b522c1d778f79eed" dependencies = [ - "getrandom", + "futures-core", + "futures-sink", ] [[package]] -name = "regex" -version = "1.7.0" +name = "futures-core" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e076559ef8e241f2ae3479e36f97bd5741c0330689e217ad51ce2c76808b868a" +checksum = "04909a7a7e4633ae6c4a9ab280aeb86da1236243a77b694a49eacd659a4bd3ac" + +[[package]] +name = "futures-executor" +version = "0.3.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7acc85df6714c176ab5edf386123fafe217be88c0840ec11f199441134a074e2" dependencies = [ - "aho-corasick", + "futures-core", + "futures-task", + "futures-util", + "num_cpus", +] + +[[package]] +name = "futures-io" +version = "0.3.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00f5fb52a06bdcadeb54e8d3671f8888a39697dcb0b81b23b55174030427f4eb" + +[[package]] +name = "futures-macro" +version = "0.3.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bdfb8ce053d86b91919aad980c220b1fb8401a9394410e1c289ed7e66b61835d" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "futures-sink" +version = "0.3.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39c15cf1a4aa79df40f1bb462fb39676d0ad9e366c2a33b590d7c66f4f81fcf9" + +[[package]] +name = "futures-task" +version = "0.3.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ffb393ac5d9a6eaa9d3fdf37ae2776656b706e200c8e16b1bdb227f5198e6ea" + +[[package]] +name = "futures-util" +version = "0.3.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "197676987abd2f9cadff84926f410af1c183608d36641465df73ae8211dc65d6" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", "memchr", - "regex-syntax", + "pin-project-lite", + "pin-utils", + "slab", ] [[package]] -name = "regex-syntax" -version = "0.6.28" +name = "fxhash" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" +checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" +dependencies = [ + "byteorder", +] [[package]] -name = "ryu" -version = "1.0.11" +name = "generic-array" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09" +checksum = "ffdf9f34f1447443d37393cc6c2b8313aebddcd96906caf34e54c68d8e57d7bd" +dependencies = [ + "typenum", +] + +[[package]] +name = "generic-array" +version = "0.14.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bff49e947297f3312447abdca79f45f4738097cc82b06e72054d2223f601f1b9" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "wasi 0.9.0+wasi-snapshot-preview1", + "wasm-bindgen", +] + +[[package]] +name = "getrandom" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" +dependencies = [ + "cfg-if", + "libc", + "wasi 0.11.0+wasi-snapshot-preview1", +] + +[[package]] +name = "gimli" +version = "0.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dec7af912d60cdbd3677c1af9352ebae6fb8394d165568a2234df0fa00f87793" + +[[package]] +name = "group" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc5ac374b108929de78460075f3dc439fa66df9d8fc77e8f12caa5165fcf0c89" +dependencies = [ + "ff", + "rand_core 0.6.4", + "subtle", +] + +[[package]] +name = "hash-db" +version = "0.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d23bd4e7b5eda0d0f3a307e8b381fdc8ba9000f26fbe912250c0a4cc3956364a" + +[[package]] +name = "hash256-std-hasher" +version = "0.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92c171d55b98633f4ed3860808f004099b36c1cc29c42cfc53aa8591b21efcf2" +dependencies = [ + "crunchy", +] + +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +dependencies = [ + "ahash", +] + +[[package]] +name = "hermit-abi" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" +dependencies = [ + "libc", +] + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "hmac" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "126888268dcc288495a26bf004b38c5fdbb31682f992c84ceb046a1f0fe38840" +dependencies = [ + "crypto-mac 0.8.0", + "digest 0.9.0", +] + +[[package]] +name = "hmac" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a2a2320eb7ec0ebe8da8f744d7812d9fc4cb4d09344ac01898dbcb6a20ae69b" +dependencies = [ + "crypto-mac 0.11.1", + "digest 0.9.0", +] + +[[package]] +name = "hmac-drbg" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17ea0a1394df5b6574da6e0c1ade9e78868c9fb0a4e5ef4428e32da4676b85b1" +dependencies = [ + "digest 0.9.0", + "generic-array 0.14.6", + "hmac 0.8.1", +] + +[[package]] +name = "humantime" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df004cfca50ef23c36850aaaa59ad52cc70d0e90243c3c7737a4dd32dc7a3c4f" +dependencies = [ + "quick-error", +] + +[[package]] +name = "iana-time-zone" +version = "0.1.53" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64c122667b287044802d6ce17ee2ddf13207ed924c712de9a66a5814d5b64765" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "wasm-bindgen", + "winapi", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0703ae284fc167426161c2e3f1da3ea71d94b21bedbcc9494e92b28e334e3dca" +dependencies = [ + "cxx", + "cxx-build", +] + +[[package]] +name = "impl-codec" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba6a270039626615617f3f36d15fc827041df3b78c439da2cadfa47455a77f2f" +dependencies = [ + "parity-scale-codec", +] + +[[package]] +name = "impl-serde" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4551f042f3438e64dbd6226b20527fc84a6e1fe65688b58746a2f53623f25f5c" +dependencies = [ + "serde", +] + +[[package]] +name = "impl-trait-for-tuples" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11d7a9f6330b71fea57921c9b61c47ee6e84f72d394754eff6163ae67e7395eb" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "integer-sqrt" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "276ec31bcb4a9ee45f58bec6f9ec700ae4cf4f4f8f2fa7e06cb406bd5ffdd770" +dependencies = [ + "num-traits", +] + +[[package]] +name = "itertools" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4217ad341ebadf8d8e724e264f13e593e0648f5b3e94b3896a5df283be015ecc" + +[[package]] +name = "js-sys" +version = "0.3.60" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49409df3e3bf0856b916e2ceaca09ee28e6871cf7d9ce97a692cacfdb2a25a47" +dependencies = [ + "wasm-bindgen", +] + +[[package]] +name = "k256" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19c3a5e0a0b8450278feda242592512e09f61c72e018b8cd5c859482802daf2d" +dependencies = [ + "cfg-if", + "ecdsa", + "elliptic-curve", + "sec1", +] + +[[package]] +name = "keccak" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3afef3b6eff9ce9d8ff9b3601125eec7f0c8cbac7abd14f355d053fa56c98768" +dependencies = [ + "cpufeatures", +] + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "libc" +version = "0.2.137" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc7fcc620a3bff7cdd7a365be3376c97191aeaccc2a603e600951e452615bf89" + +[[package]] +name = "libm" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "348108ab3fba42ec82ff6e9564fc4ca0247bdccdc68dd8af9764bbc79c3c8ffb" + +[[package]] +name = "libsecp256k1" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95b09eff1b35ed3b33b877ced3a691fc7a481919c7e29c53c906226fcf55e2a1" +dependencies = [ + "arrayref", + "base64", + "digest 0.9.0", + "hmac-drbg", + "libsecp256k1-core", + "libsecp256k1-gen-ecmult", + "libsecp256k1-gen-genmult", + "rand 0.8.5", + "serde", + "sha2 0.9.9", + "typenum", +] + +[[package]] +name = "libsecp256k1-core" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5be9b9bb642d8522a44d533eab56c16c738301965504753b03ad1de3425d5451" +dependencies = [ + "crunchy", + "digest 0.9.0", + "subtle", +] + +[[package]] +name = "libsecp256k1-gen-ecmult" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3038c808c55c87e8a172643a7d87187fc6c4174468159cb3090659d55bcb4809" +dependencies = [ + "libsecp256k1-core", +] + +[[package]] +name = "libsecp256k1-gen-genmult" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3db8d6ba2cec9eacc40e6e8ccc98931840301f1006e95647ceb2dd5c3aa06f7c" +dependencies = [ + "libsecp256k1-core", +] + +[[package]] +name = "link-cplusplus" +version = "1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecd207c9c713c34f95a097a5b029ac2ce6010530c7b49d7fea24d977dede04f5" +dependencies = [ + "cc", +] + +[[package]] +name = "lock_api" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df" +dependencies = [ + "autocfg", + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "lru" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e999beba7b6e8345721bd280141ed958096a2e4abdf74f67ff4ce49b4b54e47a" +dependencies = [ + "hashbrown", +] + +[[package]] +name = "matchers" +version = "0.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f099785f7595cc4b4553a174ce30dd7589ef93391ff414dbb67f62392b9e0ce1" +dependencies = [ + "regex-automata", +] + +[[package]] +name = "memchr" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" + +[[package]] +name = "memory-db" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6566c70c1016f525ced45d7b7f97730a2bafb037c788211d0c186ef5b2189f0a" +dependencies = [ + "hash-db", + "hashbrown", + "parity-util-mem", +] + +[[package]] +name = "memory_units" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" + +[[package]] +name = "merlin" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e261cf0f8b3c42ded9f7d2bb59dea03aa52bc8a1cbc7482f9fc3fd1229d3b42" +dependencies = [ + "byteorder", + "keccak", + "rand_core 0.5.1", + "zeroize", +] + +[[package]] +name = "miniz_oxide" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b275950c28b37e794e8c55d88aeb5e139d0ce23fdbbeda68f8d7174abdf9e8fa" +dependencies = [ + "adler", +] + +[[package]] +name = "nodrop" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" + +[[package]] +name = "nohash-hasher" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451" + +[[package]] +name = "num-bigint" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f93ab6289c7b344a8a9f60f88d80aa20032336fe78da341afc91c8a2341fc75f" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-format" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a652d9771a63711fd3c3deb670acfbe5c30a4072e664d7a3bf5a9e1056ac72c3" +dependencies = [ + "arrayvec 0.7.2", + "itoa", +] + +[[package]] +name = "num-integer" +version = "0.1.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" +dependencies = [ + "autocfg", + "num-traits", +] + +[[package]] +name = "num-rational" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" +dependencies = [ + "autocfg", + "num-bigint", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" +dependencies = [ + "autocfg", +] + +[[package]] +name = "num_cpus" +version = "1.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6058e64324c71e02bc2b150e4f3bc8286db6c83092132ffa3f6b1eab0f9def5" +dependencies = [ + "hermit-abi", + "libc", +] + +[[package]] +name = "object" +version = "0.30.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "239da7f290cfa979f43f85a8efeee9a8a76d0827c356d37f9d3d7254d6b537fb" +dependencies = [ + "memchr", +] + +[[package]] +name = "once_cell" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860" + +[[package]] +name = "opaque-debug" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" + +[[package]] +name = "opaque-debug" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" + +[[package]] +name = "parity-scale-codec" +version = "3.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "366e44391a8af4cfd6002ef6ba072bae071a96aafca98d7d448a34c5dca38b6a" +dependencies = [ + "arrayvec 0.7.2", + "bitvec", + "byte-slice-cast", + "bytes", + "impl-trait-for-tuples", + "parity-scale-codec-derive", + "serde", +] + +[[package]] +name = "parity-scale-codec-derive" +version = "3.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9299338969a3d2f491d65f140b00ddec470858402f888af98e8642fb5e8965cd" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "parity-util-mem" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c32561d248d352148124f036cac253a644685a21dc9fea383eb4907d7bd35a8f" +dependencies = [ + "cfg-if", + "hashbrown", + "impl-trait-for-tuples", + "parity-util-mem-derive", + "parking_lot", + "primitive-types", + "winapi", +] + +[[package]] +name = "parity-util-mem-derive" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f557c32c6d268a07c921471619c0295f5efad3a0e76d4f97a05c091a51d110b2" +dependencies = [ + "proc-macro2", + "syn", + "synstructure", +] + +[[package]] +name = "parity-wasm" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1ad0aff30c1da14b1254fcb2af73e1fa9a28670e584a626f53a369d0e157304" + +[[package]] +name = "parking_lot" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ff9f3fef3968a3ec5945535ed654cb38ff72d7495a25619e2247fb15a2ed9ba" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-sys", +] + +[[package]] +name = "paste" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d01a5bd0424d00070b0098dd17ebca6f961a959dead1dbcbbbc1d1cd8d3deeba" + +[[package]] +name = "pbkdf2" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "216eaa586a190f0a738f2f918511eecfa90f13295abec0e457cdebcceda80cbd" +dependencies = [ + "crypto-mac 0.8.0", +] + +[[package]] +name = "pbkdf2" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d95f5254224e617595d2cc3cc73ff0a5eaf2637519e25f03388154e9378b6ffa" +dependencies = [ + "crypto-mac 0.11.1", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "pkcs8" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7cabda3fb821068a9a4fab19a683eac3af12edf0f34b94a8be53c4972b8149d0" +dependencies = [ + "der", + "spki", + "zeroize", +] + +[[package]] +name = "ppv-lite86" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" + +[[package]] +name = "pretty_env_logger" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "926d36b9553851b8b0005f1275891b392ee4d2d833852c417ed025477350fb9d" +dependencies = [ + "env_logger", + "log", +] + +[[package]] +name = "primitive-types" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e28720988bff275df1f51b171e1b2a18c30d194c4d2b61defdacecd625a5d94a" +dependencies = [ + "fixed-hash", + "impl-codec", + "impl-serde", + "scale-info", + "uint", +] + +[[package]] +name = "proc-macro-crate" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eda0fc3b0fb7c975631757e14d9049da17374063edb6ebbcbc54d880d4fe94e9" +dependencies = [ + "once_cell", + "thiserror", + "toml", +] + +[[package]] +name = "proc-macro2" +version = "1.0.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ea3d908b0e36316caf9e9e2c4625cdde190a7e6f440d794667ed17a1855e725" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quick-error" +version = "1.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" + +[[package]] +name = "quote" +version = "1.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "radium" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" + +[[package]] +name = "rand" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" +dependencies = [ + "getrandom 0.1.16", + "libc", + "rand_chacha 0.2.2", + "rand_core 0.5.1", + "rand_hc", + "rand_pcg", +] + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha 0.3.1", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_chacha" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" +dependencies = [ + "ppv-lite86", + "rand_core 0.5.1", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_core" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" +dependencies = [ + "getrandom 0.1.16", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.8", +] + +[[package]] +name = "rand_hc" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" +dependencies = [ + "rand_core 0.5.1", +] + +[[package]] +name = "rand_pcg" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429" +dependencies = [ + "rand_core 0.5.1", +] + +[[package]] +name = "redox_syscall" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" +dependencies = [ + "bitflags", +] + +[[package]] +name = "ref-cast" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c78fb8c9293bcd48ef6fce7b4ca950ceaf21210de6e105a883ee280c0f7b9ed" +dependencies = [ + "ref-cast-impl", +] + +[[package]] +name = "ref-cast-impl" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f9c0c92af03644e4806106281fe2e068ac5bc0ae74a707266d06ea27bccee5f" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "regex" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e076559ef8e241f2ae3479e36f97bd5741c0330689e217ad51ce2c76808b868a" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" +dependencies = [ + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.6.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" + +[[package]] +name = "rfc6979" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96ef608575f6392792f9ecf7890c00086591d29a83910939d430753f7c050525" +dependencies = [ + "crypto-bigint", + "hmac 0.11.0", + "zeroize", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342" + +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + +[[package]] +name = "rustc-hex" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" + +[[package]] +name = "ryu" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09" + +[[package]] +name = "scale-info" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "001cf62ece89779fd16105b5f515ad0e5cedcd5440d3dd806bb067978e7c3608" +dependencies = [ + "bitvec", + "cfg-if", + "derive_more", + "parity-scale-codec", + "scale-info-derive", + "serde", +] + +[[package]] +name = "scale-info-derive" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "303959cf613a6f6efd19ed4b4ad5bf79966a13352716299ad532cfb115f4205c" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "schnorrkel" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "021b403afe70d81eea68f6ea12f6b3c9588e5d536a94c3bf80f15e7faa267862" +dependencies = [ + "arrayref", + "arrayvec 0.5.2", + "curve25519-dalek 2.1.3", + "getrandom 0.1.16", + "merlin", + "rand 0.7.3", + "rand_core 0.5.1", + "sha2 0.8.2", + "subtle", + "zeroize", +] + +[[package]] +name = "scopeguard" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" + +[[package]] +name = "scratch" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddccb15bcce173023b3fedd9436f882a0739b8dfb45e4f6b6002bee5929f61b2" + +[[package]] +name = "sec1" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08da66b8b0965a5555b6bd6639e68ccba85e1e2506f5fbb089e93f8a04e1a2d1" +dependencies = [ + "der", + "generic-array 0.14.6", + "pkcs8", + "subtle", + "zeroize", +] + +[[package]] +name = "secp256k1" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9512ffd81e3a3503ed401f79c33168b9148c75038956039166cd750eaa037c3" +dependencies = [ + "secp256k1-sys", +] + +[[package]] +name = "secp256k1-sys" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83080e2c2fc1006e625be82e5d1eb6a43b7fd9578b617fcc55814daf286bba4b" +dependencies = [ + "cc", +] + +[[package]] +name = "secrecy" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bd1c54ea06cfd2f6b63219704de0b9b4f72dcc2b8fdef820be6cd799780e91e" +dependencies = [ + "zeroize", +] + +[[package]] +name = "serde" +version = "1.0.147" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d193d69bae983fc11a79df82342761dfbf28a99fc8d203dca4c3c1b590948965" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.147" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f1d362ca8fc9c3e3a7484440752472d68a6caa98f1ab81d99b5dfe517cec852" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce777b7b150d76b9cf60d28b55f5847135a003f7d7350c6be7a773508ce7d45" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "sha2" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a256f46ea78a0c0d9ff00077504903ac881a1dafdc20da66545699e7776b3e69" +dependencies = [ + "block-buffer 0.7.3", + "digest 0.8.1", + "fake-simd", + "opaque-debug 0.2.3", +] + +[[package]] +name = "sha2" +version = "0.9.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" +dependencies = [ + "block-buffer 0.9.0", + "cfg-if", + "cpufeatures", + "digest 0.9.0", + "opaque-debug 0.3.0", +] + +[[package]] +name = "sha2" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest 0.10.5", +] + +[[package]] +name = "sha3" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bdf0c33fae925bdc080598b84bc15c55e7b9a4a43b3c704da051f977469691c9" +dependencies = [ + "digest 0.10.5", + "keccak", +] + +[[package]] +name = "sharded-slab" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "900fba806f70c630b0a382d0d825e17a0f19fcd059a2ade1ff237bcddf446b31" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "signature" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02658e48d89f2bec991f9a78e69cfa4c316f8d6a6c4ec12fae1aeb263d486788" +dependencies = [ + "digest 0.9.0", + "rand_core 0.6.4", +] + +[[package]] +name = "slab" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4614a76b2a8be0058caa9dbbaf66d988527d86d003c11a94fbd335d7661edcef" +dependencies = [ + "autocfg", +] + +[[package]] +name = "smallvec" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" + +[[package]] +name = "sp-api" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "hash-db", + "log", + "parity-scale-codec", + "sp-api-proc-macro", + "sp-core", + "sp-runtime", + "sp-state-machine", + "sp-std", + "sp-trie", + "sp-version", + "thiserror", +] + +[[package]] +name = "sp-api-proc-macro" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "blake2", + "proc-macro-crate", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "sp-application-crypto" +version = "6.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "parity-scale-codec", + "scale-info", + "serde", + "sp-core", + "sp-io", + "sp-std", +] + +[[package]] +name = "sp-arithmetic" +version = "5.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "integer-sqrt", + "num-traits", + "parity-scale-codec", + "scale-info", + "serde", + "sp-debug-derive", + "sp-std", + "static_assertions", +] + +[[package]] +name = "sp-core" +version = "6.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "array-bytes 4.1.0", + "base58", + "bitflags", + "blake2", + "byteorder", + "dyn-clonable", + "ed25519-zebra", + "futures", + "hash-db", + "hash256-std-hasher", + "impl-serde", + "lazy_static", + "libsecp256k1", + "log", + "merlin", + "num-traits", + "parity-scale-codec", + "parity-util-mem", + "parking_lot", + "primitive-types", + "rand 0.7.3", + "regex", + "scale-info", + "schnorrkel", + "secp256k1", + "secrecy", + "serde", + "sp-core-hashing", + "sp-debug-derive", + "sp-externalities", + "sp-runtime-interface", + "sp-std", + "sp-storage", + "ss58-registry", + "substrate-bip39", + "thiserror", + "tiny-bip39", + "wasmi", + "zeroize", +] + +[[package]] +name = "sp-core-hashing" +version = "4.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "blake2", + "byteorder", + "digest 0.10.5", + "sha2 0.10.6", + "sha3", + "sp-std", + "twox-hash", +] + +[[package]] +name = "sp-core-hashing-proc-macro" +version = "5.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "proc-macro2", + "quote", + "sp-core-hashing", + "syn", +] + +[[package]] +name = "sp-debug-derive" +version = "4.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "sp-externalities" +version = "0.12.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "environmental", + "parity-scale-codec", + "sp-std", + "sp-storage", +] + +[[package]] +name = "sp-inherents" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "async-trait", + "impl-trait-for-tuples", + "parity-scale-codec", + "sp-core", + "sp-runtime", + "sp-std", + "thiserror", +] + +[[package]] +name = "sp-io" +version = "6.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "bytes", + "futures", + "hash-db", + "libsecp256k1", + "log", + "parity-scale-codec", + "parking_lot", + "secp256k1", + "sp-core", + "sp-externalities", + "sp-keystore", + "sp-runtime-interface", + "sp-state-machine", + "sp-std", + "sp-tracing", + "sp-trie", + "sp-wasm-interface", + "tracing", + "tracing-core", +] + +[[package]] +name = "sp-keystore" +version = "0.12.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "async-trait", + "futures", + "merlin", + "parity-scale-codec", + "parking_lot", + "schnorrkel", + "sp-core", + "sp-externalities", + "thiserror", +] + +[[package]] +name = "sp-panic-handler" +version = "4.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "backtrace", + "lazy_static", + "regex", +] + +[[package]] +name = "sp-runtime" +version = "6.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "either", + "hash256-std-hasher", + "impl-trait-for-tuples", + "log", + "parity-scale-codec", + "parity-util-mem", + "paste", + "rand 0.7.3", + "scale-info", + "serde", + "sp-application-crypto", + "sp-arithmetic", + "sp-core", + "sp-io", + "sp-std", + "sp-weights", +] + +[[package]] +name = "sp-runtime-interface" +version = "6.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "bytes", + "impl-trait-for-tuples", + "parity-scale-codec", + "primitive-types", + "sp-externalities", + "sp-runtime-interface-proc-macro", + "sp-std", + "sp-storage", + "sp-tracing", + "sp-wasm-interface", + "static_assertions", +] + +[[package]] +name = "sp-runtime-interface-proc-macro" +version = "5.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "Inflector", + "proc-macro-crate", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "sp-staking" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "parity-scale-codec", + "scale-info", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "sp-state-machine" +version = "0.12.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "hash-db", + "log", + "num-traits", + "parity-scale-codec", + "parking_lot", + "rand 0.7.3", + "smallvec", + "sp-core", + "sp-externalities", + "sp-panic-handler", + "sp-std", + "sp-trie", + "thiserror", + "tracing", + "trie-root", +] + +[[package]] +name = "sp-std" +version = "4.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" + +[[package]] +name = "sp-storage" +version = "6.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "impl-serde", + "parity-scale-codec", + "ref-cast", + "serde", + "sp-debug-derive", + "sp-std", +] + +[[package]] +name = "sp-tracing" +version = "5.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "parity-scale-codec", + "sp-std", + "tracing", + "tracing-core", + "tracing-subscriber", +] + +[[package]] +name = "sp-trie" +version = "6.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "ahash", + "hash-db", + "hashbrown", + "lazy_static", + "lru", + "memory-db", + "nohash-hasher", + "parity-scale-codec", + "parking_lot", + "scale-info", + "sp-core", + "sp-std", + "thiserror", + "tracing", + "trie-db", + "trie-root", +] [[package]] -name = "serde" -version = "1.0.147" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d193d69bae983fc11a79df82342761dfbf28a99fc8d203dca4c3c1b590948965" +name = "sp-version" +version = "5.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ - "serde_derive", + "impl-serde", + "parity-scale-codec", + "parity-wasm", + "scale-info", + "serde", + "sp-core-hashing-proc-macro", + "sp-runtime", + "sp-std", + "sp-version-proc-macro", + "thiserror", ] [[package]] -name = "serde_derive" -version = "1.0.147" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f1d362ca8fc9c3e3a7484440752472d68a6caa98f1ab81d99b5dfe517cec852" +name = "sp-version-proc-macro" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ + "parity-scale-codec", "proc-macro2", "quote", "syn", ] [[package]] -name = "serde_json" -version = "1.0.87" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ce777b7b150d76b9cf60d28b55f5847135a003f7d7350c6be7a773508ce7d45" +name = "sp-wasm-interface" +version = "6.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ - "itoa", - "ryu", + "impl-trait-for-tuples", + "log", + "parity-scale-codec", + "sp-std", + "wasmi", +] + +[[package]] +name = "sp-weights" +version = "4.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +dependencies = [ + "impl-trait-for-tuples", + "parity-scale-codec", + "scale-info", "serde", + "smallvec", + "sp-arithmetic", + "sp-core", + "sp-debug-derive", + "sp-std", ] [[package]] -name = "sha2" -version = "0.10.6" +name = "spki" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" +checksum = "44d01ac02a6ccf3e07db148d2be087da624fea0221a16152ed01f0496a6b0a27" dependencies = [ - "cfg-if", - "cpufeatures", - "digest", + "base64ct", + "der", +] + +[[package]] +name = "ss58-registry" +version = "1.36.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23d92659e7d18d82b803824a9ba5a6022cff101c3491d027c1c1d8d30e749284" +dependencies = [ + "Inflector", + "num-format", + "proc-macro2", + "quote", + "serde", + "serde_json", + "unicode-xid", ] [[package]] @@ -446,12 +2357,14 @@ version = "0.0.0" dependencies = [ "anyhow", "array-bytes 6.0.0", + "frame-support", "fxhash", "log", "parity-scale-codec", "pretty_env_logger", "serde", "serde_json", + "sp-core", "subhasher", "subspector", "substorager", @@ -470,7 +2383,7 @@ source = "git+https://github.com/hack-ink/subalfred#de1ed2b16b0b2c3ceeb61b1f9168 dependencies = [ "blake2-rfc", "byteorder", - "sha2", + "sha2 0.10.6", "tiny-keccak", "twox-hash", ] @@ -494,6 +2407,25 @@ dependencies = [ "subhasher", ] +[[package]] +name = "substrate-bip39" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49eee6965196b32f882dd2ee85a92b1dbead41b04e53907f269de3b0dc04733c" +dependencies = [ + "hmac 0.11.0", + "pbkdf2 0.8.0", + "schnorrkel", + "sha2 0.9.9", + "zeroize", +] + +[[package]] +name = "subtle" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" + [[package]] name = "syn" version = "1.0.103" @@ -505,6 +2437,18 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "synstructure" +version = "0.12.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "unicode-xid", +] + [[package]] name = "tap" version = "1.0.1" @@ -540,6 +2484,34 @@ dependencies = [ "syn", ] +[[package]] +name = "thread_local" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5516c27b78311c50bf42c071425c560ac799b11c30b31f87e3081965fe5e0180" +dependencies = [ + "once_cell", +] + +[[package]] +name = "tiny-bip39" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffc59cb9dfc85bb312c3a78fd6aa8a8582e310b0fa885d5bb877f6dcc601839d" +dependencies = [ + "anyhow", + "hmac 0.8.1", + "once_cell", + "pbkdf2 0.4.0", + "rand 0.7.3", + "rustc-hash", + "sha2 0.9.9", + "thiserror", + "unicode-normalization", + "wasm-bindgen", + "zeroize", +] + [[package]] name = "tiny-keccak" version = "2.0.2" @@ -549,6 +2521,21 @@ dependencies = [ "crunchy", ] +[[package]] +name = "tinyvec" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +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 = "toml" version = "0.5.9" @@ -558,6 +2545,110 @@ dependencies = [ "serde", ] +[[package]] +name = "tracing" +version = "0.1.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" +dependencies = [ + "cfg-if", + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4017f8f45139870ca7e672686113917c71c7a6e02d4924eda67186083c03081a" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tracing-core" +version = "0.1.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24eb03ba0eab1fd845050058ce5e616558e8f8d8fca633e6b163fe25c797213a" +dependencies = [ + "once_cell", + "valuable", +] + +[[package]] +name = "tracing-log" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ddad33d2d10b1ed7eb9d1f518a5674713876e97e5bb9b7345a7984fbb4f922" +dependencies = [ + "lazy_static", + "log", + "tracing-core", +] + +[[package]] +name = "tracing-serde" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc6b213177105856957181934e4920de57730fc69bf42c37ee5bb664d406d9e1" +dependencies = [ + "serde", + "tracing-core", +] + +[[package]] +name = "tracing-subscriber" +version = "0.2.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e0d2eaa99c3c2e41547cfa109e910a68ea03823cccad4a0525dcbc9b01e8c71" +dependencies = [ + "ansi_term", + "chrono", + "lazy_static", + "matchers", + "regex", + "serde", + "serde_json", + "sharded-slab", + "smallvec", + "thread_local", + "tracing", + "tracing-core", + "tracing-log", + "tracing-serde", +] + +[[package]] +name = "trie-db" +version = "0.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "004e1e8f92535694b4cb1444dc5a8073ecf0815e3357f729638b9f8fc4062908" +dependencies = [ + "hash-db", + "hashbrown", + "log", + "rustc-hex", + "smallvec", +] + +[[package]] +name = "trie-root" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a36c5ca3911ed3c9a5416ee6c679042064b93fc637ded67e25f92e68d783891" +dependencies = [ + "hash-db", +] + +[[package]] +name = "tt-call" +version = "1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e66dcbec4290c69dd03c57e76c2469ea5c7ce109c6dd4351c13055cf71ea055" + [[package]] name = "twox-hash" version = "1.6.3" @@ -565,7 +2656,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" dependencies = [ "cfg-if", - "rand", + "digest 0.10.5", + "rand 0.8.5", "static_assertions", ] @@ -575,24 +2667,156 @@ version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" +[[package]] +name = "uint" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76f64bba2c53b04fcab63c01a7d7427eadc821e3bc48c34dc9ba29c501164b52" +dependencies = [ + "byteorder", + "crunchy", + "hex", + "static_assertions", +] + [[package]] name = "unicode-ident" version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6ceab39d59e4c9499d4e5a8ee0e2735b891bb7308ac83dfb4e80cad195c9f6f3" +[[package]] +name = "unicode-normalization" +version = "0.1.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "unicode-width" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" + +[[package]] +name = "unicode-xid" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" + +[[package]] +name = "valuable" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" + [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +[[package]] +name = "wasi" +version = "0.9.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" + [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" +[[package]] +name = "wasm-bindgen" +version = "0.2.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eaf9f5aceeec8be17c128b2e93e031fb8a4d469bb9c4ae2d7dc1888b26887268" +dependencies = [ + "cfg-if", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c8ffb332579b0557b52d268b91feab8df3615f265d5270fec2a8c95b17c1142" +dependencies = [ + "bumpalo", + "log", + "once_cell", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "052be0f94026e6cbc75cdefc9bae13fd6052cdcaf532fa6c45e7ae33a1e6c810" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07bc0c051dc5f23e307b13285f9d75df86bfdf816c5721e573dec1f9b8aa193c" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f" + +[[package]] +name = "wasmi" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06c326c93fbf86419608361a2c925a31754cf109da1b8b55737070b4d6669422" +dependencies = [ + "parity-wasm", + "wasmi-validation", + "wasmi_core", +] + +[[package]] +name = "wasmi-validation" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91ff416ad1ff0c42e5a926ed5d5fab74c0f098749aa0ad8b2a34b982ce0e867b" +dependencies = [ + "parity-wasm", +] + +[[package]] +name = "wasmi_core" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57d20cb3c59b788653d99541c646c561c9dd26506f25c0cebfe810659c54c6d7" +dependencies = [ + "downcast-rs", + "libm", + "memory_units", + "num-rational", + "num-traits", +] + [[package]] name = "winapi" version = "0.3.9" @@ -624,6 +2848,63 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows-sys" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d2aa71f6f0cbe00ae5167d90ef3cfe66527d6f613ca78ac8024c3ccab9a19e" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4" + +[[package]] +name = "windows_i686_gnu" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbeae19f6716841636c28d695375df17562ca208b2b7d0dc47635a50ae6c5de7" + +[[package]] +name = "windows_i686_msvc" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84c12f65daa39dd2babe6e442988fc329d6243fdce47d7d2d155b8d874862246" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf7b1b21b5362cbc318f686150e5bcea75ecedc74dd157d874d754a2ca44b0ed" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09d525d2ba30eeb3297665bd434a54297e4170c7f1a44cad4ef58095b4cd2028" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5" + [[package]] name = "wyz" version = "0.5.0" @@ -632,3 +2913,24 @@ checksum = "30b31594f29d27036c383b53b59ed3476874d518f0efb151b27a4c275141390e" dependencies = [ "tap", ] + +[[package]] +name = "zeroize" +version = "1.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c394b5bd0c6f669e7275d9c20aa90ae064cb22e75a1cad54e1b34088034b149f" +dependencies = [ + "zeroize_derive", +] + +[[package]] +name = "zeroize_derive" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44bf07cb3e50ea2003396695d58bf46bc9887a1f362260446fad6bc4e79bd36c" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] diff --git a/tool/state-processor/Cargo.toml b/tool/state-processor/Cargo.toml index eb70123db..c5f2013b9 100644 --- a/tool/state-processor/Cargo.toml +++ b/tool/state-processor/Cargo.toml @@ -20,5 +20,9 @@ subhasher = { git = "https://github.com/hack-ink/subalfred" } subspector = { git = "https://github.com/hack-ink/subalfred" } substorager = { git = "https://github.com/hack-ink/subalfred" } +# parity +frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } + [workspace] exclude = [] diff --git a/tool/state-processor/src/evm/mod.rs b/tool/state-processor/src/evm/mod.rs index eb130d80e..f9a44beec 100644 --- a/tool/state-processor/src/evm/mod.rs +++ b/tool/state-processor/src/evm/mod.rs @@ -23,11 +23,11 @@ impl Processor { log::info!("take `EVM::AccountCodes` and `EVM::AccountStorages`"); self.solo_state .take_raw(&item_key(b"EVM", b"AccountCodes"), &mut account_codes, |key, from| { - replace_first_match(key, from, &item_key(b"Evm", b"AccountCodes")) - }) + replace_first_match(key, from, &item_key(b"Evm", b"AccountCodes")) + }) .take_raw(&item_key(b"EVM", b"AccountStorages"), &mut account_storages, |key, from| { - replace_first_match(key, from, &item_key(b"Evm", b"AccountStorages")) - }); + replace_first_match(key, from, &item_key(b"Evm", b"AccountStorages")) + }); log::info!("set `Evm::AccountCodes` and `Evm::AccountStorages`"); self.shell_state.insert_raw(account_codes).insert_raw(account_storages); diff --git a/tool/state-processor/src/system/mod.rs b/tool/state-processor/src/system/mod.rs index caee8dcf7..8d27cb23f 100644 --- a/tool/state-processor/src/system/mod.rs +++ b/tool/state-processor/src/system/mod.rs @@ -1,5 +1,10 @@ +// crates.io +use array_bytes::bytes2hex; // darwinia use crate::*; +// parity +use frame_support::{Blake2_128Concat, StorageHasher}; +use sp_core::H160; #[derive(Debug)] pub struct AccountAll { @@ -98,6 +103,7 @@ impl Processor { log::info!("set `System::Account`"); log::info!("set `Balances::Locks`"); accounts.into_iter().for_each(|(k, v)| { + let key = get_last_64(&k); let mut a = AccountInfo { nonce: v.nonce, consumers: v.consumers, @@ -111,16 +117,26 @@ impl Processor { }, }; - if is_evm_address(&k) { - self.shell_state.0.insert(full_key(b"System", b"Account", &k), encode_value(a)); - - // TODO: migrate kton balances. - } else { - a.nonce = 0; + match is_evm_addr(&key) { + (true, addr) => { + self.shell_state.0.insert( + full_key( + b"System", + b"Account", + &bytes2hex("", &Blake2_128Concat::hash(&addr.encode())), + ), + encode_value(a), + ); + // TODO: migrate kton balances. + }, + (false, None) => { + a.nonce = 0; - self.shell_state - .0 - .insert(full_key(b"AccountMigration", b"Accounts", &k), encode_value(a)); + self.shell_state + .0 + .insert(full_key(b"AccountMigration", b"Accounts", &key), encode_value(a)); + }, + _ => unreachable!(), } }); @@ -181,18 +197,28 @@ impl Processor { } } -fn is_evm_address(address: &str) -> bool { - let address = array_bytes::hex2bytes_unchecked(address); +// Returns true if the key is an EVM account key and the associated address, otherwise, returns None +fn is_evm_addr(key: &str) -> (bool, Option) { + let k = array_bytes::hex2bytes_unchecked(key); - address.starts_with(b"dvm:") - && address[1..31].iter().fold(address[0], |checksum, &byte| checksum ^ byte) == address[31] + if k.starts_with(b"dvm:") && k[1..31].iter().fold(k[0], |checksum, &b| checksum ^ b) == k[31] { + return (true, Some(H160::from_slice(&k[11..31]))); + } + (false, None) } #[test] fn verify_evm_address_checksum_should_work() { + // std + use std::str::FromStr; + // subalfred key 5ELRpquT7C3mWtjerpPfdmaGoSh12BL2gFCv2WczEcv6E1zL // sub-seed // public-key 0x64766d3a00000000000000b7de7f8c52ac75e036d05fda53a75cf12714a76973 // Substrate 5ELRpquT7C3mWtjerpPfdmaGoSh12BL2gFCv2WczEcv6E1zL - assert!(is_evm_address("0x64766d3a00000000000000b7de7f8c52ac75e036d05fda53a75cf12714a76973")); + assert!(is_evm_addr("0x64766d3a00000000000000b7de7f8c52ac75e036d05fda53a75cf12714a76973").0); + assert_eq!( + is_evm_addr("0x64766d3a00000000000000b7de7f8c52ac75e036d05fda53a75cf12714a76973").1, + H160::from_str("b7de7f8c52ac75e036d05fda53a75cf12714a769").ok(), + ); } From 02b2ccb175355904f31fb3320ec36ddcaa265555 Mon Sep 17 00:00:00 2001 From: Guantong <04637@163.com> Date: Tue, 20 Dec 2022 13:44:29 +0800 Subject: [PATCH 051/189] Correct `RuntimeApi` & `RuntimeExecutor` (#141) --- node/src/command.rs | 48 +++++++++++++++++++++++++++++++---------- node/src/service/mod.rs | 24 ++++++++++++--------- 2 files changed, 51 insertions(+), 21 deletions(-) diff --git a/node/src/command.rs b/node/src/command.rs index bc9f2ad21..c0a7e4baa 100644 --- a/node/src/command.rs +++ b/node/src/command.rs @@ -594,17 +594,43 @@ pub fn run() -> Result<()> { SubstrateCli::create_configuration(&polkadot_cli, &polkadot_cli, tokio_handle) .map_err(|err| format!("Relay chain argument error: {}", err))?; - service::start_parachain_node( - config, - polkadot_config, - collator_options, - id, - hwbench, - ð_rpc_config, - ) - .await - .map(|r| r.0) - .map_err(Into::into) + return if chain_spec.is_crab() { + service::start_parachain_node::( + config, + polkadot_config, + collator_options, + id, + hwbench, + ð_rpc_config, + ) + .await + .map(|r| r.0) + .map_err(Into::into) + } else if chain_spec.is_pangolin() { + service::start_parachain_node::( + config, + polkadot_config, + collator_options, + id, + hwbench, + ð_rpc_config, + ) + .await + .map(|r| r.0) + .map_err(Into::into) + } else { + service::start_parachain_node::( + config, + polkadot_config, + collator_options, + id, + hwbench, + ð_rpc_config, + ) + .await + .map(|r| r.0) + .map_err(Into::into) + }; }) }, } diff --git a/node/src/service/mod.rs b/node/src/service/mod.rs index 4385434fc..35f42d160 100644 --- a/node/src/service/mod.rs +++ b/node/src/service/mod.rs @@ -524,7 +524,7 @@ where } /// Start a parachain node. -pub async fn start_parachain_node( +pub async fn start_parachain_node( parachain_config: sc_service::Configuration, polkadot_config: sc_service::Configuration, collator_options: cumulus_client_cli::CollatorOptions, @@ -533,15 +533,19 @@ pub async fn start_parachain_node( eth_rpc_config: &crate::cli::EthRpcConfig, ) -> sc_service::error::Result<( sc_service::TaskManager, - Arc< - sc_service::TFullClient< - Block, - darwinia_runtime::RuntimeApi, - sc_executor::NativeElseWasmExecutor, - >, - >, -)> { - start_node_impl::( + Arc>>, +)> +where + RuntimeApi: sp_api::ConstructRuntimeApi> + + Send + + Sync + + 'static, + RuntimeApi::RuntimeApi: + RuntimeApiCollection>, + RuntimeApi::RuntimeApi: sp_consensus_aura::AuraApi, + Executor: 'static + sc_executor::NativeExecutionDispatch, +{ + start_node_impl::( parachain_config, polkadot_config, collator_options, From ba6a50cf46ccbfc377d5d26dcd5a1634ca0c6b04 Mon Sep 17 00:00:00 2001 From: Guantong <04637@163.com> Date: Tue, 20 Dec 2022 14:51:46 +0800 Subject: [PATCH 052/189] Convert the rest locations to H160 by hashing it (#138) * Convert the rest locations to H160 by hashing it * format * fix review --- Cargo.lock | 3 +++ runtime/common/Cargo.toml | 16 ++++++++++--- runtime/common/src/xcm_configs.rs | 24 +++++++++++++++++++- runtime/crab/src/pallets/polkadot_xcm.rs | 2 ++ runtime/darwinia/src/pallets/polkadot_xcm.rs | 2 ++ runtime/pangolin/src/pallets/polkadot_xcm.rs | 2 ++ 6 files changed, 45 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 531368524..1f94680ee 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2327,6 +2327,9 @@ dependencies = [ "frame-support", "frame-system", "pallet-collective", + "parity-scale-codec", + "sp-io", + "sp-std", "xcm", "xcm-executor", ] diff --git a/runtime/common/Cargo.toml b/runtime/common/Cargo.toml index eded93bf3..3bd45cee5 100644 --- a/runtime/common/Cargo.toml +++ b/runtime/common/Cargo.toml @@ -10,6 +10,9 @@ repository = "https://github.com/darwinia-network/darwinia" version = "6.0.0" [dependencies] +# crates.io +codec = { package = "parity-scale-codec", version = "3.2", default-features = false } + # darwinia dc-primitives = { default-features = false, path = "../../core/primitives" } @@ -21,13 +24,18 @@ xcm = { default-features = false, git = "https://github.com/paritytech/ xcm-executor = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" } # substrate -frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-collective = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-collective = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-io = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } [features] default = ["std"] std = [ + # crates.io + "codec/std", + # darwinia "dc-primitives/std", @@ -39,4 +47,6 @@ std = [ "frame-support/std", "frame-system/std", "pallet-collective/std", + "sp-io/std", + "sp-std/std", ] diff --git a/runtime/common/src/xcm_configs.rs b/runtime/common/src/xcm_configs.rs index fda13a2ce..489ff60d0 100644 --- a/runtime/common/src/xcm_configs.rs +++ b/runtime/common/src/xcm_configs.rs @@ -18,13 +18,17 @@ // core use core::marker::PhantomData; +// crates.io +use codec::Encode; // darwinia use dc_primitives::GWEI; // polkadot use xcm::latest::{prelude::*, Weight as XCMWeight}; -use xcm_executor::traits::ShouldExecute; +use xcm_executor::traits::{Convert, ShouldExecute}; // substrate use frame_support::{log, traits::ConstU128}; +use sp_io::hashing::blake2_256; +use sp_std::borrow::Borrow; /// Base balance required for the XCM unit weight. pub type XcmBaseWeightFee = ConstU128; @@ -104,3 +108,21 @@ impl ShouldExecute for DenyReserveTransferToRelayChain { Ok(()) } } + +/// Struct that converts a given MultiLocation into a 20 bytes account id by hashing +/// with blake2_256 and taking the first 20 bytes +pub struct Account20Hash(PhantomData); +impl + Into<[u8; 20]> + Clone> Convert + for Account20Hash +{ + fn convert_ref(location: impl Borrow) -> Result { + let hash: [u8; 32] = ("multiloc", location.borrow()).borrow().using_encoded(blake2_256); + let mut account_id = [0u8; 20]; + account_id.copy_from_slice(&hash[0..20]); + Ok(account_id.into()) + } + + fn reverse_ref(_: impl Borrow) -> Result { + Err(()) + } +} diff --git a/runtime/crab/src/pallets/polkadot_xcm.rs b/runtime/crab/src/pallets/polkadot_xcm.rs index 2f1b3ef09..e2cd39280 100644 --- a/runtime/crab/src/pallets/polkadot_xcm.rs +++ b/runtime/crab/src/pallets/polkadot_xcm.rs @@ -47,6 +47,8 @@ pub type LocationToAccountId = ( xcm_builder::SiblingParachainConvertsVia, // Straight up local `AccountId20` origins just alias directly to `AccountId`. xcm_builder::AccountKey20Aliases, + // The rest of locations are converted via hashing it. + darwinia_common_runtime::xcm_configs::Account20Hash, ); /// This is the type we use to convert an (incoming) XCM origin into a local `Origin` instance, /// ready for dispatching a transaction with Xcm's `Transact`. There is an `OriginKind` which can diff --git a/runtime/darwinia/src/pallets/polkadot_xcm.rs b/runtime/darwinia/src/pallets/polkadot_xcm.rs index 2c98cb4c1..83478be91 100644 --- a/runtime/darwinia/src/pallets/polkadot_xcm.rs +++ b/runtime/darwinia/src/pallets/polkadot_xcm.rs @@ -47,6 +47,8 @@ pub type LocationToAccountId = ( xcm_builder::SiblingParachainConvertsVia, // Straight up local `AccountId20` origins just alias directly to `AccountId`. xcm_builder::AccountKey20Aliases, + // The rest of locations are converted via hashing it. + darwinia_common_runtime::xcm_configs::Account20Hash, ); /// This is the type we use to convert an (incoming) XCM origin into a local `Origin` instance, /// ready for dispatching a transaction with Xcm's `Transact`. There is an `OriginKind` which can diff --git a/runtime/pangolin/src/pallets/polkadot_xcm.rs b/runtime/pangolin/src/pallets/polkadot_xcm.rs index 5cac8a806..0164d8693 100644 --- a/runtime/pangolin/src/pallets/polkadot_xcm.rs +++ b/runtime/pangolin/src/pallets/polkadot_xcm.rs @@ -47,6 +47,8 @@ pub type LocationToAccountId = ( xcm_builder::SiblingParachainConvertsVia, // Straight up local `AccountId20` origins just alias directly to `AccountId`. xcm_builder::AccountKey20Aliases, + // The rest of locations are converted via hashing it. + darwinia_common_runtime::xcm_configs::Account20Hash, ); /// This is the type we use to convert an (incoming) XCM origin into a local `Origin` instance, /// ready for dispatching a transaction with Xcm's `Transact`. There is an `OriginKind` which can From ced7f236bf9437e979fedda1125dfb45af608468 Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Tue, 20 Dec 2022 16:12:58 +0800 Subject: [PATCH 053/189] Process staking (#133) * Process staking * Correct type * Refactor * Introduce `Adjust` trait * Refactor * Format * Update links * Doc * Fix * Doc --- Cargo.lock | 2 + pallet/account-migration/Cargo.toml | 10 +- pallet/account-migration/src/lib.rs | 56 +- pallet/deposit/src/lib.rs | 23 +- pallet/deposit/tests/tests.rs | 4 +- tool/state-processor/.editorconfig | 21 + tool/state-processor/.gitignore | 15 + tool/state-processor/.rustfmt.toml | 29 + tool/state-processor/Cargo.lock | 2663 ++------------------ tool/state-processor/Cargo.toml | 5 +- tool/state-processor/rust-toolchain.toml | 5 + tool/state-processor/src/adjust.rs | 61 + tool/state-processor/src/balances/mod.rs | 22 +- tool/state-processor/src/evm/README.md | 2 +- tool/state-processor/src/evm/mod.rs | 18 +- tool/state-processor/src/main.rs | 137 +- tool/state-processor/src/staking/README.md | 4 + tool/state-processor/src/staking/mod.rs | 113 + tool/state-processor/src/system/README.md | 1 + tool/state-processor/src/system/mod.rs | 88 +- tool/state-processor/src/type_registry.rs | 52 + tool/state-processor/src/vesting/mod.rs | 15 +- 22 files changed, 706 insertions(+), 2640 deletions(-) create mode 100644 tool/state-processor/.editorconfig create mode 100644 tool/state-processor/.gitignore create mode 100644 tool/state-processor/.rustfmt.toml create mode 100644 tool/state-processor/rust-toolchain.toml create mode 100644 tool/state-processor/src/adjust.rs create mode 100644 tool/state-processor/src/staking/README.md create mode 100644 tool/state-processor/src/staking/mod.rs diff --git a/Cargo.lock b/Cargo.lock index 1f94680ee..7c0035acf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2304,6 +2304,8 @@ dependencies = [ name = "darwinia-account-migration" version = "6.0.0" dependencies = [ + "darwinia-deposit", + "darwinia-staking", "dc-primitives", "frame-support", "frame-system", diff --git a/pallet/account-migration/Cargo.toml b/pallet/account-migration/Cargo.toml index f9b908082..ce1ea7764 100644 --- a/pallet/account-migration/Cargo.toml +++ b/pallet/account-migration/Cargo.toml @@ -11,11 +11,13 @@ version = "6.0.0" [dependencies] # crates.io -codec = { default-features = false, package = "parity-scale-codec", version = "3.2.1", features = ["derive"] } -scale-info = { default-features = false, version = "2.3.0", features = ["derive"] } +codec = { default-features = false, package = "parity-scale-codec", version = "3.2", features = ["derive"] } +scale-info = { default-features = false, version = "2.3", features = ["derive"] } # darwinia -dc-primitives = { default-features = false, path = "../../core/primitives" } +darwinia-deposit = { default-features = false, path = "../deposit" } +darwinia-staking = { default-features = false, path = "../staking" } +dc-primitives = { default-features = false, path = "../../core/primitives" } # substrate frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } @@ -38,6 +40,8 @@ std = [ "scale-info/std", # darwinia + "darwinia-deposit/std", + "darwinia-staking/std", "dc-primitives/std", # paritytech diff --git a/pallet/account-migration/src/lib.rs b/pallet/account-migration/src/lib.rs index b4f9e1851..9a297e8e5 100644 --- a/pallet/account-migration/src/lib.rs +++ b/pallet/account-migration/src/lib.rs @@ -49,12 +49,14 @@ mod tests; // darwinia +use darwinia_deposit::Deposit; +use darwinia_staking::Ledger; use dc_primitives::{AccountId as AccountId20, Balance, BlockNumber, Index}; // substrate use frame_support::{ log, pallet_prelude::*, - traits::{LockableCurrency, WithdrawReasons}, + traits::{Currency, ExistenceRequirement::KeepAlive, LockableCurrency, WithdrawReasons}, }; use frame_system::{pallet_prelude::*, AccountInfo}; use pallet_balances::AccountData; @@ -82,6 +84,8 @@ pub mod pallet { AccountData = AccountData, > + pallet_balances::Config + pallet_vesting::Config> + + darwinia_deposit::Config + + darwinia_staking::Config { /// Override the [`frame_system::Config::RuntimeEvent`]. type RuntimeEvent: From + IsType<::RuntimeEvent>; @@ -102,6 +106,8 @@ pub mod pallet { pub enum Error { /// Exceed maximum vesting count. ExceedMaxVestings, + /// Exceed maximum deposit count. + ExceedMaxDeposits, } /// [`frame_system::Account`] data. @@ -121,9 +127,26 @@ pub mod pallet { pub type Vestings = StorageMap<_, Blake2_128Concat, AccountId32, Vec>>; + /// [`darwinia_deposit::Deposits`] data. + #[pallet::storage] + #[pallet::unbounded] + #[pallet::getter(fn deposit_of)] + pub type Deposits = StorageMap<_, Blake2_128Concat, AccountId32, Vec>; + + /// [`darwinia_staking::Bonded`] data. + /// + /// + #[pallet::storage] + #[pallet::getter(fn bonded)] + pub type Bonded = StorageMap<_, Twox64Concat, AccountId32, AccountId32>; + + /// [`darwinia_staking::Ledgers`] data. + #[pallet::storage] + #[pallet::getter(fn ledger_of)] + pub type Ledgers = StorageMap<_, Blake2_128Concat, AccountId32, Ledger>; + // TODO: identity storages // TODO: proxy storages - // TODO: staking storages #[pallet::call] impl Pallet { @@ -142,12 +165,12 @@ pub mod pallet { >::insert(to, account); - if let Some(vs) = >::get(&from) { - let locked = vs.iter().map(|v| v.locked()).sum(); + if let Some(v) = >::get(&from) { + let locked = v.iter().map(|v| v.locked()).sum(); >::insert( to, - BoundedVec::try_from(vs).map_err(|_| >::ExceedMaxVestings)?, + BoundedVec::try_from(v).map_err(|_| >::ExceedMaxVestings)?, ); // https://github.dev/paritytech/substrate/blob/19162e43be45817b44c7d48e50d03f074f60fbf4/frame/vesting/src/lib.rs#L248 @@ -156,6 +179,29 @@ pub mod pallet { // https://github.dev/paritytech/substrate/blob/19162e43be45817b44c7d48e50d03f074f60fbf4/frame/vesting/src/lib.rs#L86 >::set_lock(*b"vesting ", &to, locked, reasons); } + if let Some(l) = >::get(&from).and_then(>::get) { + if let Some(ds) = >::get(&from) { + as Currency<_>>::transfer( + &to, + &darwinia_deposit::account_id(), + ds.iter().map(|d| d.value).sum(), + KeepAlive, + )?; + >::insert( + to, + BoundedVec::try_from(ds).map_err(|_| >::ExceedMaxDeposits)?, + ); + } + + as Currency<_>>::transfer( + &to, + &darwinia_staking::account_id(), + l.staked_ring + l.unstaking_ring.iter().map(|(r, _)| r).sum::(), + KeepAlive, + )?; + // TODO: kton transfer + >::insert(to, l); + } Self::deposit_event(Event::Migrated { from, to }); diff --git a/pallet/deposit/src/lib.rs b/pallet/deposit/src/lib.rs index 5b33dc871..40c572213 100644 --- a/pallet/deposit/src/lib.rs +++ b/pallet/deposit/src/lib.rs @@ -34,6 +34,8 @@ use core::{ cmp::Ordering::{Equal, Greater, Less}, ops::ControlFlow::{Break, Continue}, }; +// crates.io +use codec::FullCodec; // darwinia use dc_inflation::MILLISECS_PER_YEAR; use dc_types::{Balance, Moment}; @@ -201,7 +203,7 @@ pub mod pallet { DispatchResult::Ok(()) })?; - T::Ring::transfer(&who, &Self::account_id(), amount, KeepAlive)?; + T::Ring::transfer(&who, &account_id(), amount, KeepAlive)?; T::Kton::mint(&who, dc_inflation::deposit_interest(amount, months))?; // TODO: event? @@ -237,7 +239,7 @@ pub mod pallet { >::Ok(()) }); - T::Ring::transfer(&Self::account_id(), &who, claimed, AllowDeath)?; + T::Ring::transfer(&account_id(), &who, claimed, AllowDeath)?; // TODO: event? @@ -246,15 +248,6 @@ pub mod pallet { // TODO: claim_with_penalty } - impl Pallet - where - T: Config, - { - /// The account of the deposit pot. - pub fn account_id() -> T::AccountId { - PalletId(*b"dar/depo").into_account_truncating() - } - } } pub use pallet::*; @@ -309,3 +302,11 @@ where .unwrap_or_default() } } + +/// The account of the deposit pot. +pub fn account_id() -> A +where + A: FullCodec, +{ + PalletId(*b"dar/depo").into_account_truncating() +} diff --git a/pallet/deposit/tests/tests.rs b/pallet/deposit/tests/tests.rs index 2b27152ee..e1de4b34e 100644 --- a/pallet/deposit/tests/tests.rs +++ b/pallet/deposit/tests/tests.rs @@ -30,11 +30,11 @@ use frame_support::{assert_noop, assert_ok, traits::Get}; fn lock_should_work() { new_test_ext().execute_with(|| { assert_eq!(System::account(&1).consumers, 0); - assert_eq!(Balances::free_balance(&Deposit::account_id()), 0); + assert_eq!(Balances::free_balance(&darwinia_deposit::account_id()), 0); assert_eq!(Balances::free_balance(&1), 1_000 * UNIT); assert_ok!(Deposit::lock(RuntimeOrigin::signed(1), 10 * UNIT, 1)); assert_eq!(System::account(&1).consumers, 1); - assert_eq!(Balances::free_balance(&Deposit::account_id()), 10 * UNIT); + assert_eq!(Balances::free_balance(&darwinia_deposit::account_id()), 10 * UNIT); assert_eq!(Balances::free_balance(&1), 990 * UNIT); }); } diff --git a/tool/state-processor/.editorconfig b/tool/state-processor/.editorconfig new file mode 100644 index 000000000..7a124a295 --- /dev/null +++ b/tool/state-processor/.editorconfig @@ -0,0 +1,21 @@ +root = true + +[*] +charset=utf-8 +end_of_line=lf +indent_size=tab +indent_style=tab +insert_final_newline=true +max_line_length=100 +tab_width=4 +trim_trailing_whitespace=true + +[*.py] +charset=utf-8 +indent_size=4 +indent_style=space + +[*.{sh,yml,yaml}] +indent_size=2 +indent_style=space +tab_width=8 diff --git a/tool/state-processor/.gitignore b/tool/state-processor/.gitignore new file mode 100644 index 000000000..a9a20e83c --- /dev/null +++ b/tool/state-processor/.gitignore @@ -0,0 +1,15 @@ +# System +.DS_Store + +# Integrated Development Environment +.idea +.vscode + +# Package Manager +## cargo +target +## npm +node_modules + +# Test data +test-data diff --git a/tool/state-processor/.rustfmt.toml b/tool/state-processor/.rustfmt.toml new file mode 100644 index 000000000..8f17dfe50 --- /dev/null +++ b/tool/state-processor/.rustfmt.toml @@ -0,0 +1,29 @@ +# Basic +edition = "2021" +hard_tabs = true +max_width = 100 +tab_spaces = 4 + +# Imports +imports_granularity = "Crate" +reorder_imports = true + +# Format comments +comment_width = 100 +wrap_comments = true + +# Misc +match_arm_blocks = false +match_block_trailing_comma = true +newline_style = "Unix" +reorder_impl_items = true +reorder_modules = true +use_field_init_shorthand = true +use_small_heuristics = "Max" + +# Wait for stablization +# format_code_in_doc_comments = true + +# Could give it a try +# group_imports = "StdExternalCrate" +# inline_attribute_width = 100 diff --git a/tool/state-processor/Cargo.lock b/tool/state-processor/Cargo.lock index 39db17a24..c2153177b 100644 --- a/tool/state-processor/Cargo.lock +++ b/tool/state-processor/Cargo.lock @@ -2,93 +2,27 @@ # It is not intended for manual editing. version = 3 -[[package]] -name = "Inflector" -version = "0.11.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" -dependencies = [ - "lazy_static", - "regex", -] - -[[package]] -name = "addr2line" -version = "0.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a76fd60b23679b7d19bd066031410fb7e458ccc5e958eb5c325888ce4baedc97" -dependencies = [ - "gimli", -] - -[[package]] -name = "adler" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" - -[[package]] -name = "ahash" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" -dependencies = [ - "getrandom 0.2.8", - "once_cell", - "version_check", -] - [[package]] name = "aho-corasick" -version = "0.7.19" +version = "0.7.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4f55bd91a0978cbfd91c457a164bab8b4001c833b7f323132c0a4e1922dd44e" +checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac" dependencies = [ "memchr", ] -[[package]] -name = "android_system_properties" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" -dependencies = [ - "libc", -] - -[[package]] -name = "ansi_term" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" -dependencies = [ - "winapi", -] - [[package]] name = "anyhow" version = "1.0.66" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "216261ddc8289130e551ddcd5ce8a064710c0d064a4d2895c67151c92b5443f6" -[[package]] -name = "array-bytes" -version = "4.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a913633b0c922e6b745072795f50d90ebea78ba31a57e2ac8c2fc7b50950949" - [[package]] name = "array-bytes" version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "22f72e9d6fac4bc80778ea470b20197b88d28c292bb7d60c3fb099280003cd19" -[[package]] -name = "arrayref" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" - [[package]] name = "arrayvec" version = "0.4.12" @@ -98,29 +32,12 @@ dependencies = [ "nodrop", ] -[[package]] -name = "arrayvec" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" - [[package]] name = "arrayvec" version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" -[[package]] -name = "async-trait" -version = "0.1.60" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "677d1d8ab452a3936018a687b20e6f7cf5363d713b732b8884001317b0e48aa3" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "atty" version = "0.2.14" @@ -132,57 +49,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "autocfg" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" - -[[package]] -name = "backtrace" -version = "0.3.67" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "233d376d6d185f2a3093e58f283f60f880315b6c60075b01f36b3b85154564ca" -dependencies = [ - "addr2line", - "cc", - "cfg-if", - "libc", - "miniz_oxide", - "object", - "rustc-demangle", -] - -[[package]] -name = "base16ct" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "349a06037c7bf932dd7e7d1f653678b2038b9ad46a74102f1fc7bd7872678cce" - -[[package]] -name = "base58" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6107fe1be6682a68940da878d9e9f5e90ca5745b3dec9fd1bb393c8777d4f581" - -[[package]] -name = "base64" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" - -[[package]] -name = "base64ct" -version = "1.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b645a089122eccb6111b4f81cbc1a49f5900ac4666bb93ac027feaecf15607bf" - -[[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - [[package]] name = "bitvec" version = "1.0.1" @@ -195,15 +61,6 @@ dependencies = [ "wyz", ] -[[package]] -name = "blake2" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" -dependencies = [ - "digest 0.10.5", -] - [[package]] name = "blake2-rfc" version = "0.2.18" @@ -214,136 +71,39 @@ dependencies = [ "constant_time_eq", ] -[[package]] -name = "block-buffer" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" -dependencies = [ - "block-padding", - "byte-tools", - "byteorder", - "generic-array 0.12.4", -] - -[[package]] -name = "block-buffer" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" -dependencies = [ - "generic-array 0.14.6", -] - [[package]] name = "block-buffer" version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "69cce20737498f97b993470a6e536b8523f0af7892a4f928cceb1ac5e52ebe7e" dependencies = [ - "generic-array 0.14.6", -] - -[[package]] -name = "block-padding" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5" -dependencies = [ - "byte-tools", + "generic-array", ] -[[package]] -name = "bumpalo" -version = "3.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "572f695136211188308f16ad2ca5c851a712c464060ae6974944458eb83880ba" - [[package]] name = "byte-slice-cast" version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c" -[[package]] -name = "byte-tools" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" - [[package]] name = "byteorder" version = "1.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" -[[package]] -name = "bytes" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfb24e866b15a1af2a1b663f10c6b6b8f397a84aadb828f12e5b289ec23a3a3c" - -[[package]] -name = "cc" -version = "1.0.78" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a20104e2335ce8a659d6dd92a51a767a0c062599c73b343fd152cb401e828c3d" - -[[package]] -name = "cfg-expr" -version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0aacacf4d96c24b2ad6eb8ee6df040e4f27b0d0b39a5710c30091baa830485db" -dependencies = [ - "smallvec", -] - [[package]] name = "cfg-if" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" -[[package]] -name = "chrono" -version = "0.4.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16b0a3d9ed01224b22057780a37bb8c5dbfe1be8ba48678e7bf57ec4b385411f" -dependencies = [ - "iana-time-zone", - "num-integer", - "num-traits", - "winapi", -] - -[[package]] -name = "codespan-reporting" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e" -dependencies = [ - "termcolor", - "unicode-width", -] - -[[package]] -name = "const-oid" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4c78c047431fee22c1a7bb92e00ad095a02a983affe4d8a72e2a2c62c1b94f3" - [[package]] name = "constant_time_eq" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" -[[package]] -name = "core-foundation-sys" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" - [[package]] name = "cpufeatures" version = "0.2.5" @@ -359,112 +119,98 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" -[[package]] -name = "crypto-bigint" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03c6a1d5fa1de37e071642dfa44ec552ca5b299adb128fab16138e24b548fd21" -dependencies = [ - "generic-array 0.14.6", - "rand_core 0.6.4", - "subtle", - "zeroize", -] - [[package]] name = "crypto-common" version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ - "generic-array 0.14.6", + "generic-array", "typenum", ] [[package]] -name = "crypto-mac" -version = "0.8.0" +name = "digest" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab" +checksum = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f" dependencies = [ - "generic-array 0.14.6", - "subtle", + "block-buffer", + "crypto-common", ] [[package]] -name = "crypto-mac" -version = "0.11.1" +name = "env_logger" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1d1a86f49236c215f271d40892d5fc950490551400b02ef360692c29815c714" +checksum = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36" dependencies = [ - "generic-array 0.14.6", - "subtle", + "atty", + "humantime", + "log", + "regex", + "termcolor", ] [[package]] -name = "curve25519-dalek" -version = "2.1.3" +name = "funty" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" + +[[package]] +name = "fxhash" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a9b85542f99a2dfa2a1b8e192662741c9859a846b296bef1c92ef9b58b5a216" +checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" dependencies = [ "byteorder", - "digest 0.8.1", - "rand_core 0.5.1", - "subtle", - "zeroize", ] [[package]] -name = "curve25519-dalek" -version = "3.2.0" +name = "generic-array" +version = "0.14.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b9fdf9972b2bd6af2d913799d9ebc165ea4d2e65878e329d9c6b372c4491b61" +checksum = "bff49e947297f3312447abdca79f45f4738097cc82b06e72054d2223f601f1b9" dependencies = [ - "byteorder", - "digest 0.9.0", - "rand_core 0.5.1", - "subtle", - "zeroize", + "typenum", + "version_check", ] [[package]] -name = "cxx" -version = "1.0.85" +name = "getrandom" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5add3fc1717409d029b20c5b6903fc0c0b02fa6741d820054f4a2efa5e5816fd" +checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" dependencies = [ - "cc", - "cxxbridge-flags", - "cxxbridge-macro", - "link-cplusplus", + "cfg-if", + "libc", + "wasi", ] [[package]] -name = "cxx-build" -version = "1.0.85" +name = "hermit-abi" +version = "0.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4c87959ba14bc6fbc61df77c3fcfe180fc32b93538c4f1031dd802ccb5f2ff0" +checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" dependencies = [ - "cc", - "codespan-reporting", - "once_cell", - "proc-macro2", - "quote", - "scratch", - "syn", + "libc", ] [[package]] -name = "cxxbridge-flags" -version = "1.0.85" +name = "humantime" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69a3e162fde4e594ed2b07d0f83c6c67b745e7f28ce58c6df5e6b6bef99dfb59" +checksum = "df004cfca50ef23c36850aaaa59ad52cc70d0e90243c3c7737a4dd32dc7a3c4f" +dependencies = [ + "quick-error", +] [[package]] -name = "cxxbridge-macro" -version = "1.0.85" +name = "impl-trait-for-tuples" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e7e2adeb6a0d4a282e581096b06e1791532b7d576dcde5ccd9382acf55db8e6" +checksum = "11d7a9f6330b71fea57921c9b61c47ee6e84f72d394754eff6163ae67e7395eb" dependencies = [ "proc-macro2", "quote", @@ -472,1883 +218,220 @@ dependencies = [ ] [[package]] -name = "der" -version = "0.5.1" +name = "itoa" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6919815d73839e7ad218de758883aae3a257ba6759ce7a9992501efbb53d705c" -dependencies = [ - "const-oid", -] +checksum = "4217ad341ebadf8d8e724e264f13e593e0648f5b3e94b3896a5df283be015ecc" [[package]] -name = "derive_more" -version = "0.99.17" +name = "libc" +version = "0.2.138" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] +checksum = "db6d7e329c562c5dfab7a46a2afabc8b987ab9a4834c9d1ca04dc54c1546cef8" [[package]] -name = "digest" -version = "0.8.1" +name = "log" +version = "0.4.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" +checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" dependencies = [ - "generic-array 0.12.4", + "cfg-if", ] [[package]] -name = "digest" -version = "0.9.0" +name = "memchr" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" -dependencies = [ - "generic-array 0.14.6", -] +checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" [[package]] -name = "digest" -version = "0.10.5" +name = "nodrop" +version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adfbc57365a37acbd2ebf2b64d7e69bb766e2fea813521ed536f5d0520dcf86c" -dependencies = [ - "block-buffer 0.10.3", - "crypto-common", - "subtle", -] +checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" [[package]] -name = "downcast-rs" -version = "1.2.0" +name = "once_cell" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" +checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860" [[package]] -name = "dyn-clonable" -version = "0.9.0" +name = "parity-scale-codec" +version = "3.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e9232f0e607a262ceb9bd5141a3dfb3e4db6994b31989bbfd845878cba59fd4" +checksum = "366e44391a8af4cfd6002ef6ba072bae071a96aafca98d7d448a34c5dca38b6a" dependencies = [ - "dyn-clonable-impl", - "dyn-clone", + "arrayvec 0.7.2", + "bitvec", + "byte-slice-cast", + "impl-trait-for-tuples", + "parity-scale-codec-derive", + "serde", ] [[package]] -name = "dyn-clonable-impl" -version = "0.9.0" +name = "parity-scale-codec-derive" +version = "3.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "558e40ea573c374cf53507fd240b7ee2f5477df7cfebdb97323ec61c719399c5" +checksum = "9299338969a3d2f491d65f140b00ddec470858402f888af98e8642fb5e8965cd" dependencies = [ + "proc-macro-crate", "proc-macro2", "quote", "syn", ] [[package]] -name = "dyn-clone" -version = "1.0.10" +name = "ppv-lite86" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9b0705efd4599c15a38151f4721f7bc388306f61084d3bfd50bd07fbca5cb60" +checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] -name = "ecdsa" -version = "0.13.4" +name = "pretty_env_logger" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0d69ae62e0ce582d56380743515fefaf1a8c70cec685d9677636d7e30ae9dc9" +checksum = "926d36b9553851b8b0005f1275891b392ee4d2d833852c417ed025477350fb9d" dependencies = [ - "der", - "elliptic-curve", - "rfc6979", - "signature", + "env_logger", + "log", ] [[package]] -name = "ed25519-zebra" -version = "3.1.0" +name = "proc-macro-crate" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c24f403d068ad0b359e577a77f92392118be3f3c927538f2bb544a5ecd828c6" +checksum = "eda0fc3b0fb7c975631757e14d9049da17374063edb6ebbcbc54d880d4fe94e9" dependencies = [ - "curve25519-dalek 3.2.0", - "hashbrown", - "hex", - "rand_core 0.6.4", - "sha2 0.9.9", - "zeroize", + "once_cell", + "thiserror", + "toml", ] [[package]] -name = "either" -version = "1.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797" - -[[package]] -name = "elliptic-curve" -version = "0.11.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25b477563c2bfed38a3b7a60964c49e058b2510ad3f12ba3483fd8f62c2306d6" -dependencies = [ - "base16ct", - "crypto-bigint", - "der", - "ff", - "generic-array 0.14.6", - "group", - "rand_core 0.6.4", - "sec1", - "subtle", - "zeroize", -] - -[[package]] -name = "env_logger" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36" -dependencies = [ - "atty", - "humantime", - "log", - "regex", - "termcolor", -] - -[[package]] -name = "environmental" -version = "1.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e48c92028aaa870e83d51c64e5d4e0b6981b360c522198c23959f219a4e1b15b" - -[[package]] -name = "fake-simd" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" - -[[package]] -name = "ff" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "131655483be284720a17d74ff97592b8e76576dc25563148601df2d7c9080924" -dependencies = [ - "rand_core 0.6.4", - "subtle", -] - -[[package]] -name = "fixed-hash" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfcf0ed7fe52a17a03854ec54a9f76d6d84508d1c0e66bc1793301c73fc8493c" -dependencies = [ - "byteorder", - "rand 0.8.5", - "rustc-hex", - "static_assertions", -] - -[[package]] -name = "frame-metadata" -version = "15.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df6bb8542ef006ef0de09a5c4420787d79823c0ed7924225822362fd2bf2ff2d" -dependencies = [ - "cfg-if", - "parity-scale-codec", - "scale-info", - "serde", -] - -[[package]] -name = "frame-support" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" -dependencies = [ - "bitflags", - "frame-metadata", - "frame-support-procedural", - "impl-trait-for-tuples", - "k256", - "log", - "once_cell", - "parity-scale-codec", - "paste", - "scale-info", - "serde", - "smallvec", - "sp-api", - "sp-arithmetic", - "sp-core", - "sp-core-hashing-proc-macro", - "sp-inherents", - "sp-io", - "sp-runtime", - "sp-staking", - "sp-state-machine", - "sp-std", - "sp-tracing", - "sp-weights", - "tt-call", -] - -[[package]] -name = "frame-support-procedural" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" -dependencies = [ - "Inflector", - "cfg-expr", - "frame-support-procedural-tools", - "itertools", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "frame-support-procedural-tools" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" -dependencies = [ - "frame-support-procedural-tools-derive", - "proc-macro-crate", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "frame-support-procedural-tools-derive" -version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "funty" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" - -[[package]] -name = "futures" -version = "0.3.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38390104763dc37a5145a53c29c63c1290b5d316d6086ec32c293f6736051bb0" -dependencies = [ - "futures-channel", - "futures-core", - "futures-executor", - "futures-io", - "futures-sink", - "futures-task", - "futures-util", -] - -[[package]] -name = "futures-channel" -version = "0.3.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52ba265a92256105f45b719605a571ffe2d1f0fea3807304b522c1d778f79eed" -dependencies = [ - "futures-core", - "futures-sink", -] - -[[package]] -name = "futures-core" -version = "0.3.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04909a7a7e4633ae6c4a9ab280aeb86da1236243a77b694a49eacd659a4bd3ac" - -[[package]] -name = "futures-executor" -version = "0.3.25" +name = "proc-macro2" +version = "1.0.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7acc85df6714c176ab5edf386123fafe217be88c0840ec11f199441134a074e2" +checksum = "5ea3d908b0e36316caf9e9e2c4625cdde190a7e6f440d794667ed17a1855e725" dependencies = [ - "futures-core", - "futures-task", - "futures-util", - "num_cpus", + "unicode-ident", ] [[package]] -name = "futures-io" -version = "0.3.25" +name = "quick-error" +version = "1.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00f5fb52a06bdcadeb54e8d3671f8888a39697dcb0b81b23b55174030427f4eb" +checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" [[package]] -name = "futures-macro" -version = "0.3.25" +name = "quote" +version = "1.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdfb8ce053d86b91919aad980c220b1fb8401a9394410e1c289ed7e66b61835d" +checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179" dependencies = [ "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "futures-sink" -version = "0.3.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39c15cf1a4aa79df40f1bb462fb39676d0ad9e366c2a33b590d7c66f4f81fcf9" - -[[package]] -name = "futures-task" -version = "0.3.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ffb393ac5d9a6eaa9d3fdf37ae2776656b706e200c8e16b1bdb227f5198e6ea" - -[[package]] -name = "futures-util" -version = "0.3.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "197676987abd2f9cadff84926f410af1c183608d36641465df73ae8211dc65d6" -dependencies = [ - "futures-channel", - "futures-core", - "futures-io", - "futures-macro", - "futures-sink", - "futures-task", - "memchr", - "pin-project-lite", - "pin-utils", - "slab", -] - -[[package]] -name = "fxhash" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" -dependencies = [ - "byteorder", -] - -[[package]] -name = "generic-array" -version = "0.12.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffdf9f34f1447443d37393cc6c2b8313aebddcd96906caf34e54c68d8e57d7bd" -dependencies = [ - "typenum", -] - -[[package]] -name = "generic-array" -version = "0.14.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bff49e947297f3312447abdca79f45f4738097cc82b06e72054d2223f601f1b9" -dependencies = [ - "typenum", - "version_check", -] - -[[package]] -name = "getrandom" -version = "0.1.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" -dependencies = [ - "cfg-if", - "js-sys", - "libc", - "wasi 0.9.0+wasi-snapshot-preview1", - "wasm-bindgen", -] - -[[package]] -name = "getrandom" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" -dependencies = [ - "cfg-if", - "libc", - "wasi 0.11.0+wasi-snapshot-preview1", -] - -[[package]] -name = "gimli" -version = "0.27.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dec7af912d60cdbd3677c1af9352ebae6fb8394d165568a2234df0fa00f87793" - -[[package]] -name = "group" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc5ac374b108929de78460075f3dc439fa66df9d8fc77e8f12caa5165fcf0c89" -dependencies = [ - "ff", - "rand_core 0.6.4", - "subtle", -] - -[[package]] -name = "hash-db" -version = "0.15.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d23bd4e7b5eda0d0f3a307e8b381fdc8ba9000f26fbe912250c0a4cc3956364a" - -[[package]] -name = "hash256-std-hasher" -version = "0.15.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92c171d55b98633f4ed3860808f004099b36c1cc29c42cfc53aa8591b21efcf2" -dependencies = [ - "crunchy", ] [[package]] -name = "hashbrown" -version = "0.12.3" +name = "radium" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" -dependencies = [ - "ahash", -] +checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" [[package]] -name = "hermit-abi" -version = "0.1.19" +name = "rand" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ "libc", + "rand_chacha", + "rand_core", ] [[package]] -name = "hex" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" - -[[package]] -name = "hmac" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "126888268dcc288495a26bf004b38c5fdbb31682f992c84ceb046a1f0fe38840" -dependencies = [ - "crypto-mac 0.8.0", - "digest 0.9.0", -] - -[[package]] -name = "hmac" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a2a2320eb7ec0ebe8da8f744d7812d9fc4cb4d09344ac01898dbcb6a20ae69b" -dependencies = [ - "crypto-mac 0.11.1", - "digest 0.9.0", -] - -[[package]] -name = "hmac-drbg" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17ea0a1394df5b6574da6e0c1ade9e78868c9fb0a4e5ef4428e32da4676b85b1" -dependencies = [ - "digest 0.9.0", - "generic-array 0.14.6", - "hmac 0.8.1", -] - -[[package]] -name = "humantime" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df004cfca50ef23c36850aaaa59ad52cc70d0e90243c3c7737a4dd32dc7a3c4f" -dependencies = [ - "quick-error", -] - -[[package]] -name = "iana-time-zone" -version = "0.1.53" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64c122667b287044802d6ce17ee2ddf13207ed924c712de9a66a5814d5b64765" -dependencies = [ - "android_system_properties", - "core-foundation-sys", - "iana-time-zone-haiku", - "js-sys", - "wasm-bindgen", - "winapi", -] - -[[package]] -name = "iana-time-zone-haiku" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0703ae284fc167426161c2e3f1da3ea71d94b21bedbcc9494e92b28e334e3dca" -dependencies = [ - "cxx", - "cxx-build", -] - -[[package]] -name = "impl-codec" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba6a270039626615617f3f36d15fc827041df3b78c439da2cadfa47455a77f2f" -dependencies = [ - "parity-scale-codec", -] - -[[package]] -name = "impl-serde" -version = "0.3.2" +name = "rand_chacha" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4551f042f3438e64dbd6226b20527fc84a6e1fe65688b58746a2f53623f25f5c" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" dependencies = [ - "serde", + "ppv-lite86", + "rand_core", ] [[package]] -name = "impl-trait-for-tuples" -version = "0.2.2" +name = "rand_core" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11d7a9f6330b71fea57921c9b61c47ee6e84f72d394754eff6163ae67e7395eb" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "proc-macro2", - "quote", - "syn", + "getrandom", ] [[package]] -name = "integer-sqrt" -version = "0.1.5" +name = "regex" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "276ec31bcb4a9ee45f58bec6f9ec700ae4cf4f4f8f2fa7e06cb406bd5ffdd770" -dependencies = [ - "num-traits", -] - -[[package]] -name = "itertools" -version = "0.10.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" -dependencies = [ - "either", -] - -[[package]] -name = "itoa" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4217ad341ebadf8d8e724e264f13e593e0648f5b3e94b3896a5df283be015ecc" - -[[package]] -name = "js-sys" -version = "0.3.60" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49409df3e3bf0856b916e2ceaca09ee28e6871cf7d9ce97a692cacfdb2a25a47" -dependencies = [ - "wasm-bindgen", -] - -[[package]] -name = "k256" -version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19c3a5e0a0b8450278feda242592512e09f61c72e018b8cd5c859482802daf2d" -dependencies = [ - "cfg-if", - "ecdsa", - "elliptic-curve", - "sec1", -] - -[[package]] -name = "keccak" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3afef3b6eff9ce9d8ff9b3601125eec7f0c8cbac7abd14f355d053fa56c98768" -dependencies = [ - "cpufeatures", -] - -[[package]] -name = "lazy_static" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" - -[[package]] -name = "libc" -version = "0.2.137" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc7fcc620a3bff7cdd7a365be3376c97191aeaccc2a603e600951e452615bf89" - -[[package]] -name = "libm" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "348108ab3fba42ec82ff6e9564fc4ca0247bdccdc68dd8af9764bbc79c3c8ffb" - -[[package]] -name = "libsecp256k1" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95b09eff1b35ed3b33b877ced3a691fc7a481919c7e29c53c906226fcf55e2a1" -dependencies = [ - "arrayref", - "base64", - "digest 0.9.0", - "hmac-drbg", - "libsecp256k1-core", - "libsecp256k1-gen-ecmult", - "libsecp256k1-gen-genmult", - "rand 0.8.5", - "serde", - "sha2 0.9.9", - "typenum", -] - -[[package]] -name = "libsecp256k1-core" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5be9b9bb642d8522a44d533eab56c16c738301965504753b03ad1de3425d5451" -dependencies = [ - "crunchy", - "digest 0.9.0", - "subtle", -] - -[[package]] -name = "libsecp256k1-gen-ecmult" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3038c808c55c87e8a172643a7d87187fc6c4174468159cb3090659d55bcb4809" -dependencies = [ - "libsecp256k1-core", -] - -[[package]] -name = "libsecp256k1-gen-genmult" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3db8d6ba2cec9eacc40e6e8ccc98931840301f1006e95647ceb2dd5c3aa06f7c" -dependencies = [ - "libsecp256k1-core", -] - -[[package]] -name = "link-cplusplus" -version = "1.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecd207c9c713c34f95a097a5b029ac2ce6010530c7b49d7fea24d977dede04f5" -dependencies = [ - "cc", -] - -[[package]] -name = "lock_api" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df" -dependencies = [ - "autocfg", - "scopeguard", -] - -[[package]] -name = "log" -version = "0.4.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "lru" -version = "0.7.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e999beba7b6e8345721bd280141ed958096a2e4abdf74f67ff4ce49b4b54e47a" -dependencies = [ - "hashbrown", -] - -[[package]] -name = "matchers" -version = "0.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f099785f7595cc4b4553a174ce30dd7589ef93391ff414dbb67f62392b9e0ce1" -dependencies = [ - "regex-automata", -] - -[[package]] -name = "memchr" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" - -[[package]] -name = "memory-db" -version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6566c70c1016f525ced45d7b7f97730a2bafb037c788211d0c186ef5b2189f0a" -dependencies = [ - "hash-db", - "hashbrown", - "parity-util-mem", -] - -[[package]] -name = "memory_units" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" - -[[package]] -name = "merlin" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e261cf0f8b3c42ded9f7d2bb59dea03aa52bc8a1cbc7482f9fc3fd1229d3b42" -dependencies = [ - "byteorder", - "keccak", - "rand_core 0.5.1", - "zeroize", -] - -[[package]] -name = "miniz_oxide" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b275950c28b37e794e8c55d88aeb5e139d0ce23fdbbeda68f8d7174abdf9e8fa" -dependencies = [ - "adler", -] - -[[package]] -name = "nodrop" -version = "0.1.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" - -[[package]] -name = "nohash-hasher" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451" - -[[package]] -name = "num-bigint" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f93ab6289c7b344a8a9f60f88d80aa20032336fe78da341afc91c8a2341fc75f" -dependencies = [ - "autocfg", - "num-integer", - "num-traits", -] - -[[package]] -name = "num-format" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a652d9771a63711fd3c3deb670acfbe5c30a4072e664d7a3bf5a9e1056ac72c3" -dependencies = [ - "arrayvec 0.7.2", - "itoa", -] - -[[package]] -name = "num-integer" -version = "0.1.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" -dependencies = [ - "autocfg", - "num-traits", -] - -[[package]] -name = "num-rational" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" -dependencies = [ - "autocfg", - "num-bigint", - "num-integer", - "num-traits", -] - -[[package]] -name = "num-traits" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" -dependencies = [ - "autocfg", -] - -[[package]] -name = "num_cpus" -version = "1.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6058e64324c71e02bc2b150e4f3bc8286db6c83092132ffa3f6b1eab0f9def5" -dependencies = [ - "hermit-abi", - "libc", -] - -[[package]] -name = "object" -version = "0.30.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "239da7f290cfa979f43f85a8efeee9a8a76d0827c356d37f9d3d7254d6b537fb" +checksum = "e076559ef8e241f2ae3479e36f97bd5741c0330689e217ad51ce2c76808b868a" dependencies = [ + "aho-corasick", "memchr", -] - -[[package]] -name = "once_cell" -version = "1.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860" - -[[package]] -name = "opaque-debug" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" - -[[package]] -name = "opaque-debug" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" - -[[package]] -name = "parity-scale-codec" -version = "3.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "366e44391a8af4cfd6002ef6ba072bae071a96aafca98d7d448a34c5dca38b6a" -dependencies = [ - "arrayvec 0.7.2", - "bitvec", - "byte-slice-cast", - "bytes", - "impl-trait-for-tuples", - "parity-scale-codec-derive", - "serde", -] - -[[package]] -name = "parity-scale-codec-derive" -version = "3.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9299338969a3d2f491d65f140b00ddec470858402f888af98e8642fb5e8965cd" -dependencies = [ - "proc-macro-crate", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "parity-util-mem" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c32561d248d352148124f036cac253a644685a21dc9fea383eb4907d7bd35a8f" -dependencies = [ - "cfg-if", - "hashbrown", - "impl-trait-for-tuples", - "parity-util-mem-derive", - "parking_lot", - "primitive-types", - "winapi", -] - -[[package]] -name = "parity-util-mem-derive" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f557c32c6d268a07c921471619c0295f5efad3a0e76d4f97a05c091a51d110b2" -dependencies = [ - "proc-macro2", - "syn", - "synstructure", -] - -[[package]] -name = "parity-wasm" -version = "0.45.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1ad0aff30c1da14b1254fcb2af73e1fa9a28670e584a626f53a369d0e157304" - -[[package]] -name = "parking_lot" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" -dependencies = [ - "lock_api", - "parking_lot_core", -] - -[[package]] -name = "parking_lot_core" -version = "0.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ff9f3fef3968a3ec5945535ed654cb38ff72d7495a25619e2247fb15a2ed9ba" -dependencies = [ - "cfg-if", - "libc", - "redox_syscall", - "smallvec", - "windows-sys", -] - -[[package]] -name = "paste" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d01a5bd0424d00070b0098dd17ebca6f961a959dead1dbcbbbc1d1cd8d3deeba" - -[[package]] -name = "pbkdf2" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "216eaa586a190f0a738f2f918511eecfa90f13295abec0e457cdebcceda80cbd" -dependencies = [ - "crypto-mac 0.8.0", -] - -[[package]] -name = "pbkdf2" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d95f5254224e617595d2cc3cc73ff0a5eaf2637519e25f03388154e9378b6ffa" -dependencies = [ - "crypto-mac 0.11.1", -] - -[[package]] -name = "pin-project-lite" -version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" - -[[package]] -name = "pin-utils" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" - -[[package]] -name = "pkcs8" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cabda3fb821068a9a4fab19a683eac3af12edf0f34b94a8be53c4972b8149d0" -dependencies = [ - "der", - "spki", - "zeroize", -] - -[[package]] -name = "ppv-lite86" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" - -[[package]] -name = "pretty_env_logger" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "926d36b9553851b8b0005f1275891b392ee4d2d833852c417ed025477350fb9d" -dependencies = [ - "env_logger", - "log", -] - -[[package]] -name = "primitive-types" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e28720988bff275df1f51b171e1b2a18c30d194c4d2b61defdacecd625a5d94a" -dependencies = [ - "fixed-hash", - "impl-codec", - "impl-serde", - "scale-info", - "uint", -] - -[[package]] -name = "proc-macro-crate" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eda0fc3b0fb7c975631757e14d9049da17374063edb6ebbcbc54d880d4fe94e9" -dependencies = [ - "once_cell", - "thiserror", - "toml", -] - -[[package]] -name = "proc-macro2" -version = "1.0.47" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ea3d908b0e36316caf9e9e2c4625cdde190a7e6f440d794667ed17a1855e725" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "quick-error" -version = "1.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" - -[[package]] -name = "quote" -version = "1.0.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "radium" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" - -[[package]] -name = "rand" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" -dependencies = [ - "getrandom 0.1.16", - "libc", - "rand_chacha 0.2.2", - "rand_core 0.5.1", - "rand_hc", - "rand_pcg", -] - -[[package]] -name = "rand" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" -dependencies = [ - "libc", - "rand_chacha 0.3.1", - "rand_core 0.6.4", -] - -[[package]] -name = "rand_chacha" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" -dependencies = [ - "ppv-lite86", - "rand_core 0.5.1", -] - -[[package]] -name = "rand_chacha" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" -dependencies = [ - "ppv-lite86", - "rand_core 0.6.4", -] - -[[package]] -name = "rand_core" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" -dependencies = [ - "getrandom 0.1.16", -] - -[[package]] -name = "rand_core" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" -dependencies = [ - "getrandom 0.2.8", -] - -[[package]] -name = "rand_hc" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" -dependencies = [ - "rand_core 0.5.1", -] - -[[package]] -name = "rand_pcg" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429" -dependencies = [ - "rand_core 0.5.1", -] - -[[package]] -name = "redox_syscall" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" -dependencies = [ - "bitflags", -] - -[[package]] -name = "ref-cast" -version = "1.0.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c78fb8c9293bcd48ef6fce7b4ca950ceaf21210de6e105a883ee280c0f7b9ed" -dependencies = [ - "ref-cast-impl", -] - -[[package]] -name = "ref-cast-impl" -version = "1.0.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f9c0c92af03644e4806106281fe2e068ac5bc0ae74a707266d06ea27bccee5f" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "regex" -version = "1.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e076559ef8e241f2ae3479e36f97bd5741c0330689e217ad51ce2c76808b868a" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax", -] - -[[package]] -name = "regex-automata" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" -dependencies = [ "regex-syntax", ] [[package]] -name = "regex-syntax" -version = "0.6.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" - -[[package]] -name = "rfc6979" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96ef608575f6392792f9ecf7890c00086591d29a83910939d430753f7c050525" -dependencies = [ - "crypto-bigint", - "hmac 0.11.0", - "zeroize", -] - -[[package]] -name = "rustc-demangle" -version = "0.1.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342" - -[[package]] -name = "rustc-hash" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" - -[[package]] -name = "rustc-hex" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" - -[[package]] -name = "ryu" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09" - -[[package]] -name = "scale-info" -version = "2.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "001cf62ece89779fd16105b5f515ad0e5cedcd5440d3dd806bb067978e7c3608" -dependencies = [ - "bitvec", - "cfg-if", - "derive_more", - "parity-scale-codec", - "scale-info-derive", - "serde", -] - -[[package]] -name = "scale-info-derive" -version = "2.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "303959cf613a6f6efd19ed4b4ad5bf79966a13352716299ad532cfb115f4205c" -dependencies = [ - "proc-macro-crate", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "schnorrkel" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "021b403afe70d81eea68f6ea12f6b3c9588e5d536a94c3bf80f15e7faa267862" -dependencies = [ - "arrayref", - "arrayvec 0.5.2", - "curve25519-dalek 2.1.3", - "getrandom 0.1.16", - "merlin", - "rand 0.7.3", - "rand_core 0.5.1", - "sha2 0.8.2", - "subtle", - "zeroize", -] - -[[package]] -name = "scopeguard" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" - -[[package]] -name = "scratch" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddccb15bcce173023b3fedd9436f882a0739b8dfb45e4f6b6002bee5929f61b2" - -[[package]] -name = "sec1" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08da66b8b0965a5555b6bd6639e68ccba85e1e2506f5fbb089e93f8a04e1a2d1" -dependencies = [ - "der", - "generic-array 0.14.6", - "pkcs8", - "subtle", - "zeroize", -] - -[[package]] -name = "secp256k1" -version = "0.24.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9512ffd81e3a3503ed401f79c33168b9148c75038956039166cd750eaa037c3" -dependencies = [ - "secp256k1-sys", -] - -[[package]] -name = "secp256k1-sys" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83080e2c2fc1006e625be82e5d1eb6a43b7fd9578b617fcc55814daf286bba4b" -dependencies = [ - "cc", -] - -[[package]] -name = "secrecy" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bd1c54ea06cfd2f6b63219704de0b9b4f72dcc2b8fdef820be6cd799780e91e" -dependencies = [ - "zeroize", -] - -[[package]] -name = "serde" -version = "1.0.147" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d193d69bae983fc11a79df82342761dfbf28a99fc8d203dca4c3c1b590948965" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_derive" -version = "1.0.147" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f1d362ca8fc9c3e3a7484440752472d68a6caa98f1ab81d99b5dfe517cec852" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "serde_json" -version = "1.0.87" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ce777b7b150d76b9cf60d28b55f5847135a003f7d7350c6be7a773508ce7d45" -dependencies = [ - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "sha2" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a256f46ea78a0c0d9ff00077504903ac881a1dafdc20da66545699e7776b3e69" -dependencies = [ - "block-buffer 0.7.3", - "digest 0.8.1", - "fake-simd", - "opaque-debug 0.2.3", -] - -[[package]] -name = "sha2" -version = "0.9.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" -dependencies = [ - "block-buffer 0.9.0", - "cfg-if", - "cpufeatures", - "digest 0.9.0", - "opaque-debug 0.3.0", -] - -[[package]] -name = "sha2" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" -dependencies = [ - "cfg-if", - "cpufeatures", - "digest 0.10.5", -] - -[[package]] -name = "sha3" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdf0c33fae925bdc080598b84bc15c55e7b9a4a43b3c704da051f977469691c9" -dependencies = [ - "digest 0.10.5", - "keccak", -] - -[[package]] -name = "sharded-slab" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "900fba806f70c630b0a382d0d825e17a0f19fcd059a2ade1ff237bcddf446b31" -dependencies = [ - "lazy_static", -] - -[[package]] -name = "signature" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02658e48d89f2bec991f9a78e69cfa4c316f8d6a6c4ec12fae1aeb263d486788" -dependencies = [ - "digest 0.9.0", - "rand_core 0.6.4", -] - -[[package]] -name = "slab" -version = "0.4.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4614a76b2a8be0058caa9dbbaf66d988527d86d003c11a94fbd335d7661edcef" -dependencies = [ - "autocfg", -] - -[[package]] -name = "smallvec" -version = "1.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" - -[[package]] -name = "sp-api" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" -dependencies = [ - "hash-db", - "log", - "parity-scale-codec", - "sp-api-proc-macro", - "sp-core", - "sp-runtime", - "sp-state-machine", - "sp-std", - "sp-trie", - "sp-version", - "thiserror", -] - -[[package]] -name = "sp-api-proc-macro" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" -dependencies = [ - "blake2", - "proc-macro-crate", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "sp-application-crypto" -version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" -dependencies = [ - "parity-scale-codec", - "scale-info", - "serde", - "sp-core", - "sp-io", - "sp-std", -] - -[[package]] -name = "sp-arithmetic" -version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" -dependencies = [ - "integer-sqrt", - "num-traits", - "parity-scale-codec", - "scale-info", - "serde", - "sp-debug-derive", - "sp-std", - "static_assertions", -] - -[[package]] -name = "sp-core" -version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" -dependencies = [ - "array-bytes 4.1.0", - "base58", - "bitflags", - "blake2", - "byteorder", - "dyn-clonable", - "ed25519-zebra", - "futures", - "hash-db", - "hash256-std-hasher", - "impl-serde", - "lazy_static", - "libsecp256k1", - "log", - "merlin", - "num-traits", - "parity-scale-codec", - "parity-util-mem", - "parking_lot", - "primitive-types", - "rand 0.7.3", - "regex", - "scale-info", - "schnorrkel", - "secp256k1", - "secrecy", - "serde", - "sp-core-hashing", - "sp-debug-derive", - "sp-externalities", - "sp-runtime-interface", - "sp-std", - "sp-storage", - "ss58-registry", - "substrate-bip39", - "thiserror", - "tiny-bip39", - "wasmi", - "zeroize", -] - -[[package]] -name = "sp-core-hashing" -version = "4.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" -dependencies = [ - "blake2", - "byteorder", - "digest 0.10.5", - "sha2 0.10.6", - "sha3", - "sp-std", - "twox-hash", -] - -[[package]] -name = "sp-core-hashing-proc-macro" -version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" -dependencies = [ - "proc-macro2", - "quote", - "sp-core-hashing", - "syn", -] - -[[package]] -name = "sp-debug-derive" -version = "4.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "sp-externalities" -version = "0.12.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" -dependencies = [ - "environmental", - "parity-scale-codec", - "sp-std", - "sp-storage", -] - -[[package]] -name = "sp-inherents" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" -dependencies = [ - "async-trait", - "impl-trait-for-tuples", - "parity-scale-codec", - "sp-core", - "sp-runtime", - "sp-std", - "thiserror", -] - -[[package]] -name = "sp-io" -version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" -dependencies = [ - "bytes", - "futures", - "hash-db", - "libsecp256k1", - "log", - "parity-scale-codec", - "parking_lot", - "secp256k1", - "sp-core", - "sp-externalities", - "sp-keystore", - "sp-runtime-interface", - "sp-state-machine", - "sp-std", - "sp-tracing", - "sp-trie", - "sp-wasm-interface", - "tracing", - "tracing-core", -] - -[[package]] -name = "sp-keystore" -version = "0.12.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" -dependencies = [ - "async-trait", - "futures", - "merlin", - "parity-scale-codec", - "parking_lot", - "schnorrkel", - "sp-core", - "sp-externalities", - "thiserror", -] - -[[package]] -name = "sp-panic-handler" -version = "4.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" -dependencies = [ - "backtrace", - "lazy_static", - "regex", -] - -[[package]] -name = "sp-runtime" -version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" -dependencies = [ - "either", - "hash256-std-hasher", - "impl-trait-for-tuples", - "log", - "parity-scale-codec", - "parity-util-mem", - "paste", - "rand 0.7.3", - "scale-info", - "serde", - "sp-application-crypto", - "sp-arithmetic", - "sp-core", - "sp-io", - "sp-std", - "sp-weights", -] - -[[package]] -name = "sp-runtime-interface" -version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" -dependencies = [ - "bytes", - "impl-trait-for-tuples", - "parity-scale-codec", - "primitive-types", - "sp-externalities", - "sp-runtime-interface-proc-macro", - "sp-std", - "sp-storage", - "sp-tracing", - "sp-wasm-interface", - "static_assertions", -] - -[[package]] -name = "sp-runtime-interface-proc-macro" -version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" -dependencies = [ - "Inflector", - "proc-macro-crate", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "sp-staking" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" -dependencies = [ - "parity-scale-codec", - "scale-info", - "sp-runtime", - "sp-std", -] - -[[package]] -name = "sp-state-machine" -version = "0.12.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" -dependencies = [ - "hash-db", - "log", - "num-traits", - "parity-scale-codec", - "parking_lot", - "rand 0.7.3", - "smallvec", - "sp-core", - "sp-externalities", - "sp-panic-handler", - "sp-std", - "sp-trie", - "thiserror", - "tracing", - "trie-root", -] - -[[package]] -name = "sp-std" -version = "4.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" - -[[package]] -name = "sp-storage" -version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" -dependencies = [ - "impl-serde", - "parity-scale-codec", - "ref-cast", - "serde", - "sp-debug-derive", - "sp-std", -] - -[[package]] -name = "sp-tracing" -version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" -dependencies = [ - "parity-scale-codec", - "sp-std", - "tracing", - "tracing-core", - "tracing-subscriber", -] - -[[package]] -name = "sp-trie" -version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" -dependencies = [ - "ahash", - "hash-db", - "hashbrown", - "lazy_static", - "lru", - "memory-db", - "nohash-hasher", - "parity-scale-codec", - "parking_lot", - "scale-info", - "sp-core", - "sp-std", - "thiserror", - "tracing", - "trie-db", - "trie-root", -] - -[[package]] -name = "sp-version" -version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" -dependencies = [ - "impl-serde", - "parity-scale-codec", - "parity-wasm", - "scale-info", - "serde", - "sp-core-hashing-proc-macro", - "sp-runtime", - "sp-std", - "sp-version-proc-macro", - "thiserror", -] +name = "regex-syntax" +version = "0.6.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" [[package]] -name = "sp-version-proc-macro" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" -dependencies = [ - "parity-scale-codec", - "proc-macro2", - "quote", - "syn", -] +name = "ryu" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09" [[package]] -name = "sp-wasm-interface" -version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +name = "serde" +version = "1.0.150" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e326c9ec8042f1b5da33252c8a37e9ffbd2c9bef0155215b6e6c80c790e05f91" dependencies = [ - "impl-trait-for-tuples", - "log", - "parity-scale-codec", - "sp-std", - "wasmi", + "serde_derive", ] [[package]] -name = "sp-weights" -version = "4.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +name = "serde_derive" +version = "1.0.150" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42a3df25b0713732468deadad63ab9da1f1fd75a48a15024b50363f128db627e" dependencies = [ - "impl-trait-for-tuples", - "parity-scale-codec", - "scale-info", - "serde", - "smallvec", - "sp-arithmetic", - "sp-core", - "sp-debug-derive", - "sp-std", + "proc-macro2", + "quote", + "syn", ] [[package]] -name = "spki" -version = "0.5.4" +name = "serde_json" +version = "1.0.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44d01ac02a6ccf3e07db148d2be087da624fea0221a16152ed01f0496a6b0a27" +checksum = "020ff22c755c2ed3f8cf162dbb41a7268d934702f3ed3631656ea597e08fc3db" dependencies = [ - "base64ct", - "der", + "itoa", + "ryu", + "serde", ] [[package]] -name = "ss58-registry" -version = "1.36.0" +name = "sha2" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23d92659e7d18d82b803824a9ba5a6022cff101c3491d027c1c1d8d30e749284" +checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" dependencies = [ - "Inflector", - "num-format", - "proc-macro2", - "quote", - "serde", - "serde_json", - "unicode-xid", + "cfg-if", + "cpufeatures", + "digest", ] [[package]] @@ -2356,15 +439,14 @@ name = "state-processor" version = "0.0.0" dependencies = [ "anyhow", - "array-bytes 6.0.0", - "frame-support", + "array-bytes", "fxhash", "log", + "once_cell", "parity-scale-codec", "pretty_env_logger", "serde", "serde_json", - "sp-core", "subhasher", "subspector", "substorager", @@ -2378,20 +460,20 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] name = "subhasher" -version = "0.9.0-rc16" -source = "git+https://github.com/hack-ink/subalfred#de1ed2b16b0b2c3ceeb61b1f9168401bc0ace51d" +version = "0.9.0-rc20" +source = "git+https://github.com/hack-ink/subalfred#4514b3728e2a8250354ea6dc4a3b12f79f436419" dependencies = [ "blake2-rfc", "byteorder", - "sha2 0.10.6", + "sha2", "tiny-keccak", "twox-hash", ] [[package]] name = "subspector" -version = "0.9.0-rc16" -source = "git+https://github.com/hack-ink/subalfred#de1ed2b16b0b2c3ceeb61b1f9168401bc0ace51d" +version = "0.9.0-rc20" +source = "git+https://github.com/hack-ink/subalfred#4514b3728e2a8250354ea6dc4a3b12f79f436419" dependencies = [ "fxhash", "serde", @@ -2400,55 +482,24 @@ dependencies = [ [[package]] name = "substorager" -version = "0.9.0-rc16" -source = "git+https://github.com/hack-ink/subalfred#de1ed2b16b0b2c3ceeb61b1f9168401bc0ace51d" +version = "0.9.0-rc20" +source = "git+https://github.com/hack-ink/subalfred#4514b3728e2a8250354ea6dc4a3b12f79f436419" dependencies = [ - "array-bytes 4.1.0", + "array-bytes", "subhasher", ] -[[package]] -name = "substrate-bip39" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49eee6965196b32f882dd2ee85a92b1dbead41b04e53907f269de3b0dc04733c" -dependencies = [ - "hmac 0.11.0", - "pbkdf2 0.8.0", - "schnorrkel", - "sha2 0.9.9", - "zeroize", -] - -[[package]] -name = "subtle" -version = "2.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" - [[package]] name = "syn" -version = "1.0.103" +version = "1.0.105" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a864042229133ada95abf3b54fdc62ef5ccabe9515b64717bcb9a1919e59445d" +checksum = "60b9b43d45702de4c839cb9b51d9f529c5dd26a4aff255b42b1ebc03e88ee908" dependencies = [ "proc-macro2", "quote", "unicode-ident", ] -[[package]] -name = "synstructure" -version = "0.12.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "unicode-xid", -] - [[package]] name = "tap" version = "1.0.1" @@ -2484,34 +535,6 @@ dependencies = [ "syn", ] -[[package]] -name = "thread_local" -version = "1.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5516c27b78311c50bf42c071425c560ac799b11c30b31f87e3081965fe5e0180" -dependencies = [ - "once_cell", -] - -[[package]] -name = "tiny-bip39" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffc59cb9dfc85bb312c3a78fd6aa8a8582e310b0fa885d5bb877f6dcc601839d" -dependencies = [ - "anyhow", - "hmac 0.8.1", - "once_cell", - "pbkdf2 0.4.0", - "rand 0.7.3", - "rustc-hash", - "sha2 0.9.9", - "thiserror", - "unicode-normalization", - "wasm-bindgen", - "zeroize", -] - [[package]] name = "tiny-keccak" version = "2.0.2" @@ -2521,134 +544,15 @@ dependencies = [ "crunchy", ] -[[package]] -name = "tinyvec" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" -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 = "toml" -version = "0.5.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7" -dependencies = [ - "serde", -] - -[[package]] -name = "tracing" -version = "0.1.37" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" -dependencies = [ - "cfg-if", - "pin-project-lite", - "tracing-attributes", - "tracing-core", -] - -[[package]] -name = "tracing-attributes" -version = "0.1.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4017f8f45139870ca7e672686113917c71c7a6e02d4924eda67186083c03081a" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "tracing-core" -version = "0.1.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24eb03ba0eab1fd845050058ce5e616558e8f8d8fca633e6b163fe25c797213a" -dependencies = [ - "once_cell", - "valuable", -] - -[[package]] -name = "tracing-log" -version = "0.1.3" +version = "0.5.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78ddad33d2d10b1ed7eb9d1f518a5674713876e97e5bb9b7345a7984fbb4f922" +checksum = "1333c76748e868a4d9d1017b5ab53171dfd095f70c712fdb4653a406547f598f" dependencies = [ - "lazy_static", - "log", - "tracing-core", -] - -[[package]] -name = "tracing-serde" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc6b213177105856957181934e4920de57730fc69bf42c37ee5bb664d406d9e1" -dependencies = [ - "serde", - "tracing-core", -] - -[[package]] -name = "tracing-subscriber" -version = "0.2.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e0d2eaa99c3c2e41547cfa109e910a68ea03823cccad4a0525dcbc9b01e8c71" -dependencies = [ - "ansi_term", - "chrono", - "lazy_static", - "matchers", - "regex", "serde", - "serde_json", - "sharded-slab", - "smallvec", - "thread_local", - "tracing", - "tracing-core", - "tracing-log", - "tracing-serde", -] - -[[package]] -name = "trie-db" -version = "0.24.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "004e1e8f92535694b4cb1444dc5a8073ecf0815e3357f729638b9f8fc4062908" -dependencies = [ - "hash-db", - "hashbrown", - "log", - "rustc-hex", - "smallvec", -] - -[[package]] -name = "trie-root" -version = "0.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a36c5ca3911ed3c9a5416ee6c679042064b93fc637ded67e25f92e68d783891" -dependencies = [ - "hash-db", ] -[[package]] -name = "tt-call" -version = "1.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e66dcbec4290c69dd03c57e76c2469ea5c7ce109c6dd4351c13055cf71ea055" - [[package]] name = "twox-hash" version = "1.6.3" @@ -2656,28 +560,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" dependencies = [ "cfg-if", - "digest 0.10.5", - "rand 0.8.5", + "rand", "static_assertions", ] [[package]] name = "typenum" -version = "1.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" - -[[package]] -name = "uint" -version = "0.9.5" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76f64bba2c53b04fcab63c01a7d7427eadc821e3bc48c34dc9ba29c501164b52" -dependencies = [ - "byteorder", - "crunchy", - "hex", - "static_assertions", -] +checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" [[package]] name = "unicode-ident" @@ -2685,138 +576,18 @@ version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6ceab39d59e4c9499d4e5a8ee0e2735b891bb7308ac83dfb4e80cad195c9f6f3" -[[package]] -name = "unicode-normalization" -version = "0.1.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" -dependencies = [ - "tinyvec", -] - -[[package]] -name = "unicode-width" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" - -[[package]] -name = "unicode-xid" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" - -[[package]] -name = "valuable" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" - [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" -[[package]] -name = "wasi" -version = "0.9.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" - [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" -[[package]] -name = "wasm-bindgen" -version = "0.2.83" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eaf9f5aceeec8be17c128b2e93e031fb8a4d469bb9c4ae2d7dc1888b26887268" -dependencies = [ - "cfg-if", - "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.83" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c8ffb332579b0557b52d268b91feab8df3615f265d5270fec2a8c95b17c1142" -dependencies = [ - "bumpalo", - "log", - "once_cell", - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.83" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "052be0f94026e6cbc75cdefc9bae13fd6052cdcaf532fa6c45e7ae33a1e6c810" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.83" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07bc0c051dc5f23e307b13285f9d75df86bfdf816c5721e573dec1f9b8aa193c" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-backend", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.83" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f" - -[[package]] -name = "wasmi" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06c326c93fbf86419608361a2c925a31754cf109da1b8b55737070b4d6669422" -dependencies = [ - "parity-wasm", - "wasmi-validation", - "wasmi_core", -] - -[[package]] -name = "wasmi-validation" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91ff416ad1ff0c42e5a926ed5d5fab74c0f098749aa0ad8b2a34b982ce0e867b" -dependencies = [ - "parity-wasm", -] - -[[package]] -name = "wasmi_core" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57d20cb3c59b788653d99541c646c561c9dd26506f25c0cebfe810659c54c6d7" -dependencies = [ - "downcast-rs", - "libm", - "memory_units", - "num-rational", - "num-traits", -] - [[package]] name = "winapi" version = "0.3.9" @@ -2848,89 +619,11 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -[[package]] -name = "windows-sys" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" -dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", -] - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41d2aa71f6f0cbe00ae5167d90ef3cfe66527d6f613ca78ac8024c3ccab9a19e" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4" - -[[package]] -name = "windows_i686_gnu" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbeae19f6716841636c28d695375df17562ca208b2b7d0dc47635a50ae6c5de7" - -[[package]] -name = "windows_i686_msvc" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84c12f65daa39dd2babe6e442988fc329d6243fdce47d7d2d155b8d874862246" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf7b1b21b5362cbc318f686150e5bcea75ecedc74dd157d874d754a2ca44b0ed" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09d525d2ba30eeb3297665bd434a54297e4170c7f1a44cad4ef58095b4cd2028" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5" - [[package]] name = "wyz" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30b31594f29d27036c383b53b59ed3476874d518f0efb151b27a4c275141390e" +checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" dependencies = [ "tap", ] - -[[package]] -name = "zeroize" -version = "1.5.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c394b5bd0c6f669e7275d9c20aa90ae064cb22e75a1cad54e1b34088034b149f" -dependencies = [ - "zeroize_derive", -] - -[[package]] -name = "zeroize_derive" -version = "1.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44bf07cb3e50ea2003396695d58bf46bc9887a1f362260446fad6bc4e79bd36c" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "synstructure", -] diff --git a/tool/state-processor/Cargo.toml b/tool/state-processor/Cargo.toml index c5f2013b9..02e52387d 100644 --- a/tool/state-processor/Cargo.toml +++ b/tool/state-processor/Cargo.toml @@ -10,6 +10,7 @@ anyhow = { version = "1.0" } array-bytes = { version = "6.0" } fxhash = { version = "0.2" } log = { version = "0.4" } +once_cell = { version = "1.16" } parity-scale-codec = { version = "3.2", features = ["derive"] } pretty_env_logger = { version = "0.4" } serde = { version = "1.0" } @@ -20,9 +21,5 @@ subhasher = { git = "https://github.com/hack-ink/subalfred" } subspector = { git = "https://github.com/hack-ink/subalfred" } substorager = { git = "https://github.com/hack-ink/subalfred" } -# parity -frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } - [workspace] exclude = [] diff --git a/tool/state-processor/rust-toolchain.toml b/tool/state-processor/rust-toolchain.toml new file mode 100644 index 000000000..f0a04ee40 --- /dev/null +++ b/tool/state-processor/rust-toolchain.toml @@ -0,0 +1,5 @@ +[toolchain] +channel = "nightly-2022-09-19" +components = ["cargo", "clippy", "rustc", "rustfmt", "rust-src"] +profile = "minimal" +targets = ["wasm32-unknown-unknown"] diff --git a/tool/state-processor/src/adjust.rs b/tool/state-processor/src/adjust.rs new file mode 100644 index 000000000..59b9485ce --- /dev/null +++ b/tool/state-processor/src/adjust.rs @@ -0,0 +1,61 @@ +// darwinia +use crate::*; + +pub trait Adjust { + fn adjust(&mut self); +} + +impl Adjust for u32 { + fn adjust(&mut self) { + // https://github.com/darwinia-network/darwinia-2.0/issues/78 + *self = self.checked_sub(*NOW.read().unwrap()).unwrap_or_default() / 2; + } +} + +impl Adjust for u128 { + fn adjust(&mut self) { + *self *= GWEI; + } +} + +impl Adjust for AccountData { + fn adjust(&mut self) { + self.free.adjust(); + self.reserved.adjust(); + self.free_kton_or_misc_frozen.adjust(); + self.reserved_kton_or_fee_frozen.adjust(); + } +} + +impl Adjust for BalanceLock { + fn adjust(&mut self) { + self.amount.adjust(); + } +} + +impl Adjust for StakingLedger { + fn adjust(&mut self) { + self.active.adjust(); + self.active_deposit_ring.adjust(); + self.active_kton.adjust(); + self.deposit_items.iter_mut().for_each(Adjust::adjust); + self.ring_staking_lock.adjust(); + self.kton_staking_lock.adjust(); + } +} +impl Adjust for TimeDepositItem { + fn adjust(&mut self) { + self.value.adjust(); + } +} +impl Adjust for StakingLock { + fn adjust(&mut self) { + self.unbondings.iter_mut().for_each(Adjust::adjust); + } +} +impl Adjust for Unbonding { + fn adjust(&mut self) { + self.amount.adjust(); + self.until.adjust(); + } +} diff --git a/tool/state-processor/src/balances/mod.rs b/tool/state-processor/src/balances/mod.rs index 929fb7dee..ae5f0d075 100644 --- a/tool/state-processor/src/balances/mod.rs +++ b/tool/state-processor/src/balances/mod.rs @@ -5,8 +5,11 @@ type Locks = Vec; impl Processor { pub fn process_balances(&mut self) -> (u128, u128) { + // Balances storage items. + // https://github.dev/darwinia-network/substrate/blob/darwinia-v0.12.5/frame/balances/src/lib.rs#L486 + let mut solo_ring_total_issuance = u128::default(); - let mut kton_total_issuance = u128::default(); + let mut solo_kton_total_issuance = u128::default(); let mut solo_ring_locks = >::default(); let mut solo_kton_locks = >::default(); let mut para_ring_locks = >::default(); @@ -14,8 +17,8 @@ impl Processor { log::info!("take solo `Balances::TotalIssuance`, `Kton::TotalIssuance`, `Balances::Locks` and `Kton::Locks`"); self.solo_state - .take_value(b"Balances", b"TotalIssuance", &mut solo_ring_total_issuance) - .take_value(b"Kton", b"TotalIssuance", &mut kton_total_issuance) + .take_value(b"Balances", b"TotalIssuance", "", &mut solo_ring_total_issuance) + .take_value(b"Kton", b"TotalIssuance", "", &mut solo_kton_total_issuance) .take_map(b"Balances", b"Locks", &mut solo_ring_locks, get_hashed_key) .take_map(b"Kton", b"Locks", &mut solo_kton_locks, get_hashed_key); @@ -23,16 +26,13 @@ impl Processor { prune(&mut solo_ring_locks); prune(&mut solo_kton_locks); - log::info!("adjust solo balances items' decimals"); - solo_ring_total_issuance *= GWEI; - kton_total_issuance *= GWEI; - // solo_ring_locks.iter_mut().for_each(|(_, v)| v.iter_mut().for_each(|l| l.amount *= - // GWEI)); solo_kton_locks.iter_mut().for_each(|(_, v)| v.iter_mut().for_each(|l| l.amount - // *= GWEI)); + log::info!("adjust solo total issuances decimals"); + solo_ring_total_issuance.adjust(); + solo_kton_total_issuance.adjust(); log::info!("take para `Balances::TotalIssuance` and `Balances::Locks`"); self.para_state - .take_value(b"Balances", b"TotalIssuance", &mut para_ring_total_issuance) + .take_value(b"Balances", b"TotalIssuance", "", &mut para_ring_total_issuance) .take_map(b"Balances", b"Locks", &mut para_ring_locks, get_hashed_key); log::info!("check solo ring locks, there should not be any `solo_ring_locks`"); @@ -42,7 +42,7 @@ impl Processor { log::info!("check para locks, there should not be any `para_ring_locks`"); check_locks(para_ring_locks); - (solo_ring_total_issuance + para_ring_total_issuance, kton_total_issuance) + (solo_ring_total_issuance + para_ring_total_issuance, solo_kton_total_issuance) } } diff --git a/tool/state-processor/src/evm/README.md b/tool/state-processor/src/evm/README.md index c45f83e91..c36e05ca7 100644 --- a/tool/state-processor/src/evm/README.md +++ b/tool/state-processor/src/evm/README.md @@ -1,4 +1,4 @@ ### Process steps - set `PALLET_ETHEREUM_SCHEMA` -- take `EVM::AccountCodes` and `EVM::AccountStorages` +- take solo `EVM::AccountCodes` and `EVM::AccountStorages` - set `Evm::AccountCodes` and `Evm::AccountStorages` diff --git a/tool/state-processor/src/evm/mod.rs b/tool/state-processor/src/evm/mod.rs index f9a44beec..db5fb61ed 100644 --- a/tool/state-processor/src/evm/mod.rs +++ b/tool/state-processor/src/evm/mod.rs @@ -1,13 +1,13 @@ // darwinia use crate::*; -// https://github.com/paritytech/frontier/blob/polkadot-v0.9.30/primitives/storage/src/lib.rs#L23 +// https://github.dev/paritytech/frontier/blob/polkadot-v0.9.30/primitives/storage/src/lib.rs#L23 const PALLET_ETHEREUM_SCHEMA: &str = "0x3a657468657265756d5f736368656d61"; impl Processor { fn process_ethereum_schema(&mut self) -> &mut Self { log::info!("set `PALLET_ETHEREUM_SCHEMA`"); - self.shell_state.0.insert(PALLET_ETHEREUM_SCHEMA.into(), "0x3".into()); + self.shell_state.insert_raw_key_raw_value(PALLET_ETHEREUM_SCHEMA.into(), "0x3".into()); self } @@ -16,21 +16,23 @@ impl Processor { self.process_ethereum_schema(); // Storage items. - // https://github.com/paritytech/frontier/blob/aca04f2269a9d6da2011f0c04069f0354fab01a1/frame/evm/src/lib.rs#L495-L502 + // https://github.dev/darwinia-network/frontier/blob/darwinia-v0.12.5/frame/evm/src/lib.rs#L407 let mut account_codes = Map::default(); let mut account_storages = Map::default(); log::info!("take `EVM::AccountCodes` and `EVM::AccountStorages`"); self.solo_state - .take_raw(&item_key(b"EVM", b"AccountCodes"), &mut account_codes, |key, from| { + .take_raw_map(&item_key(b"EVM", b"AccountCodes"), &mut account_codes, |key, from| { replace_first_match(key, from, &item_key(b"Evm", b"AccountCodes")) }) - .take_raw(&item_key(b"EVM", b"AccountStorages"), &mut account_storages, |key, from| { - replace_first_match(key, from, &item_key(b"Evm", b"AccountStorages")) - }); + .take_raw_map( + &item_key(b"EVM", b"AccountStorages"), + &mut account_storages, + |key, from| replace_first_match(key, from, &item_key(b"Evm", b"AccountStorages")), + ); log::info!("set `Evm::AccountCodes` and `Evm::AccountStorages`"); - self.shell_state.insert_raw(account_codes).insert_raw(account_storages); + self.shell_state.insert_raw_key_map(account_codes).insert_raw_key_map(account_storages); self } diff --git a/tool/state-processor/src/main.rs b/tool/state-processor/src/main.rs index 60a594a2f..e8b5a6d29 100644 --- a/tool/state-processor/src/main.rs +++ b/tool/state-processor/src/main.rs @@ -1,8 +1,12 @@ mod balances; mod evm; +mod staking; mod system; mod vesting; +mod adjust; +use adjust::*; + mod type_registry; use type_registry::*; @@ -12,10 +16,12 @@ use std::{ fs::File, io::{Read, Write}, mem, + sync::RwLock, }; // crates.io use anyhow::Result; use fxhash::FxHashMap; +use once_cell::sync::Lazy; use parity_scale_codec::{Decode, Encode}; use serde::de::DeserializeOwned; // hack-ink @@ -23,6 +29,8 @@ use subspector::ChainSpec; type Map = FxHashMap; +static NOW: Lazy> = Lazy::new(|| RwLock::new(0)); + fn main() -> Result<()> { env::set_var("RUST_LOG", "state_processor"); pretty_env_logger::init(); @@ -51,7 +59,13 @@ impl Processor { } fn process(mut self) -> Result<()> { - self.process_system().process_vesting().process_evm(); + self.solo_state.get_value(b"System", b"Number", "", &mut *NOW.write().unwrap()); + + let _guard = NOW.read().unwrap(); + + assert!(*_guard != 0); + + self.process_system().process_vesting().process_staking().process_evm(); self.save() } @@ -76,59 +90,33 @@ impl State { Ok(Self(from_file::(path)?.genesis.raw.top)) } - #[allow(unused)] - fn prune(&mut self, pallet: &[u8], items: Option<&[&[u8]]>) -> &mut Self { - // Prune specific storages. - if let Some(items) = items { - for item in items { - let k = item_key(pallet, item); - - self.0.remove(&k).or_else(|| { - log::warn!( - "`{}::{}: {k}` not found", - String::from_utf8_lossy(pallet), - String::from_utf8_lossy(item) - ); - - None - }); - } - } - // Prune entire pallet. - else { - let prefix = pallet_key(pallet); - let mut pruned = false; - - self.0.retain(|full_key, _| { - if full_key.starts_with(&prefix) { - pruned = true; - - false - } else { - true - } - }); + fn insert_raw_key_raw_value(&mut self, key: String, value: String) -> &mut Self { + self.0.insert(key, value); - if !pruned { - log::warn!("`{}: {prefix}` not found", String::from_utf8_lossy(pallet)); - } - } + self + } + + fn insert_raw_key_value(&mut self, key: String, value: E) -> &mut Self + where + E: Encode, + { + self.0.insert(key, encode_value(value)); self } - fn take_raw( + fn take_raw_map( &mut self, prefix: &str, buffer: &mut Map, - preprocess_key: F, + process_key: F, ) -> &mut Self where F: Fn(&str, &str) -> String, { self.0.retain(|k, v| { if k.starts_with(prefix) { - buffer.insert(preprocess_key(k, prefix), v.to_owned()); + buffer.insert(process_key(k, prefix), v.to_owned()); false } else { @@ -139,7 +127,7 @@ impl State { self } - fn insert_raw(&mut self, pairs: Map) -> &mut Self { + fn insert_raw_key_map(&mut self, pairs: Map) -> &mut Self { pairs.into_iter().for_each(|(k, v)| { if self.0.contains_key(&k) { log::error!("key({k}) has already existed, overriding"); @@ -151,41 +139,74 @@ impl State { self } - fn take_value(&mut self, pallet: &[u8], item: &[u8], value: &mut D) -> &mut Self + fn get_value(&self, pallet: &[u8], item: &[u8], hash: &str, value: &mut D) -> &Self where D: Decode, { - let key = item_key(pallet, item); + let key = full_key(pallet, item, hash); + + if let Some(v) = self.0.get(&key) { + match decode(v) { + Ok(v) => *value = v, + Err(e) => log::warn!( + "failed to decode `{}::{}::{hash}({v})`, due to `{e}`", + String::from_utf8_lossy(pallet), + String::from_utf8_lossy(item), + ), + } + } + + self + } + + fn take_value(&mut self, pallet: &[u8], item: &[u8], hash: &str, value: &mut D) -> &mut Self + where + D: Decode, + { + let key = full_key(pallet, item, hash); if let Some(v) = self.0.remove(&key) { match decode(&v) { Ok(v) => *value = v, - Err(e) => log::warn!("failed to decode `{key}:{v}`, due to `{e}`"), + Err(e) => log::warn!( + "failed to decode `{}::{}::{hash}({v})`, due to `{e}`", + String::from_utf8_lossy(pallet), + String::from_utf8_lossy(item) + ), } } self } + fn insert_value(&mut self, pallet: &[u8], item: &[u8], hash: &str, value: E) -> &mut Self + where + E: Encode, + { + self.0.insert(full_key(pallet, item, hash), encode_value(value)); + + self + } + fn take_map( &mut self, pallet: &[u8], item: &[u8], buffer: &mut Map, - preprocess_key: F, + process_key: F, ) -> &mut Self where D: Decode, F: Fn(&str, &str) -> String, { let len = buffer.len(); - let item_key = item_key(pallet, item); + let prefix = item_key(pallet, item); self.0.retain(|full_key, v| { - if full_key.starts_with(&item_key) { + if full_key.starts_with(&prefix) { match decode(v) { Ok(v) => { - buffer.insert(preprocess_key(full_key, &item_key), v); + buffer.insert(process_key(full_key, &prefix), v); }, Err(e) => log::warn!("failed to decode `{full_key}:{v}`, due to `{e}`"), } @@ -206,6 +227,22 @@ impl State { self } + + fn insert_map(&mut self, pairs: Map, process_key: F) -> &mut Self + where + E: Encode, + F: Fn(&str) -> String, + { + pairs.into_iter().for_each(|(k, v)| { + self.0.insert(process_key(&k), encode_value(v)); + }); + + self + } + + // fn transfer(&mut self, from: &str, to: &str, amount: u128) {} + + // fn inc_consumers(&mut self, who: &str) {} } fn from_file(path: &str) -> Result @@ -269,10 +306,6 @@ fn get_last_64(key: &str) -> String { format!("0x{}", &key[key.len() - 64..]) } -fn identity(key: &str, _: &str) -> String { - key.into() -} - fn replace_first_match(key: &str, from: &str, to: &str) -> String { key.replacen(from, to, 1) } diff --git a/tool/state-processor/src/staking/README.md b/tool/state-processor/src/staking/README.md new file mode 100644 index 000000000..deffe19ba --- /dev/null +++ b/tool/state-processor/src/staking/README.md @@ -0,0 +1,4 @@ +### Process steps +- take solo `Staking::Bonded`, `Staking::Ledger`, `Staking::RingPool`, `Staking::KtonPool` and `Staking::LivingTime` +- adjust decimals and block number, convert ledger, adjust unstaking duration then set `AccountMigration::Ledgers` and `AccountMigration::Deposits` +- set `Staking::RingPool` and `Staking::KtonPool` diff --git a/tool/state-processor/src/staking/mod.rs b/tool/state-processor/src/staking/mod.rs new file mode 100644 index 000000000..a6b6d5b4c --- /dev/null +++ b/tool/state-processor/src/staking/mod.rs @@ -0,0 +1,113 @@ +// darwinia +use crate::*; + +impl Processor { + pub fn process_staking(&mut self) -> &mut Self { + // Storage items. + // https://github.dev/darwinia-network/darwinia-common/blob/darwinia-v0.12.5/frame/staking/src/lib.rs#L560 + let mut bonded = >::default(); + let mut ledgers = >::default(); + let mut ring_pool_storage = u128::default(); + let mut kton_pool_storage = u128::default(); + let mut ring_pool = u128::default(); + let mut kton_pool = u128::default(); + let mut elapsed_time = u64::default(); + + log::info!("take solo `Staking::Bonded`, `Staking::Ledger`, `Staking::RingPool`, `Staking::KtonPool` and `Staking::LivingTime`"); + self.solo_state + .take_raw_map(&item_key(b"Staking", b"Bonded"), &mut bonded, get_identity_key) + .take_map(b"Staking", b"Ledger", &mut ledgers, get_identity_key) + .take_value(b"Staking", b"RingPool", "", &mut ring_pool_storage) + .take_value(b"Staking", b"KtonPool", "", &mut kton_pool_storage) + .take_value(b"Staking", b"LivingTime", "", &mut elapsed_time); + + log::info!("set `Staking::Bonded`"); + self.shell_state.insert_raw_key_map(bonded); + + log::info!("adjust decimals and block number, convert ledger, adjust unstaking duration then set `AccountMigration::Ledgers` and `AccountMigration::Deposits`"); + { + let staking_ik = item_key(b"AccountMigration", b"Ledgers"); + let deposit_ik = item_key(b"AccountMigration", b"Deposits"); + + ledgers.into_iter().for_each(|(_, mut v)| { + v.adjust(); + + let hash_k = array_bytes::bytes2hex("", subhasher::blake2_128_concat(v.stash)); + let deposit_k = format!("{deposit_ik}{hash_k}"); + let staking_k = format!("{staking_ik}{hash_k}"); + let mut staked_deposits = Vec::default(); + + if !v.deposit_items.is_empty() { + let mut deposit_ring = u128::default(); + + self.shell_state.insert_raw_key_value( + deposit_k, + v.deposit_items + .into_iter() + .enumerate() + .map(|(i, d)| { + let id = i as _; + + staked_deposits.push(id); + deposit_ring += d.value; + + Deposit { + id, + value: d.value, + expired_time: d.expire_time as _, + in_use: true, + } + }) + .collect::>(), + ); + } + + ring_pool += v.active; + kton_pool += v.active_kton; + + self.shell_state.insert_raw_key_value( + staking_k, + Ledger { + staked_ring: v.active, + staked_kton: v.active_kton, + staked_deposits, + unstaking_ring: v + .ring_staking_lock + .unbondings + .into_iter() + .map(|u| (u.amount, u.until)) + .collect(), + unstaking_kton: v + .kton_staking_lock + .unbondings + .into_iter() + .map(|u| (u.amount, u.until)) + .collect(), + unstaking_deposits: Default::default(), + }, + ); + }); + } + + ring_pool_storage.adjust(); + kton_pool_storage.adjust(); + + log::info!("`ring_pool({ring_pool})`"); + log::info!("`ring_pool_storage({ring_pool_storage})`"); + log::info!("`kton_pool({kton_pool})`"); + log::info!("`kton_pool_storage({kton_pool_storage})`"); + + log::info!("set `Staking::RingPool` and `Staking::KtonPool`"); + self.shell_state.insert_value(b"Staking", b"RingPool", "", ring_pool).insert_value( + b"Staking", + b"KtonPool", + "", + kton_pool, + ); + + log::info!("set `Staking::ElapsedTime`"); + self.shell_state.insert_value(b"Staking", b"ElapsedTime", "", elapsed_time as u128); + + self + } +} diff --git a/tool/state-processor/src/system/README.md b/tool/state-processor/src/system/README.md index 0d8a4e446..af67521d6 100644 --- a/tool/state-processor/src/system/README.md +++ b/tool/state-processor/src/system/README.md @@ -34,3 +34,4 @@ - special accounts - TODO - parachain backing account 0x8c585F9791EE5b4B23fe82888cE576DBB69607eB - bridge root account 0x726f6f7400000000000000000000000000000000 + - pallet accounts diff --git a/tool/state-processor/src/system/mod.rs b/tool/state-processor/src/system/mod.rs index 8d27cb23f..8b4604ceb 100644 --- a/tool/state-processor/src/system/mod.rs +++ b/tool/state-processor/src/system/mod.rs @@ -1,10 +1,5 @@ -// crates.io -use array_bytes::bytes2hex; // darwinia use crate::*; -// parity -use frame_support::{Blake2_128Concat, StorageHasher}; -use sp_core::H160; #[derive(Debug)] pub struct AccountAll { @@ -22,11 +17,9 @@ pub struct AccountAll { } impl Processor { - // System storage items. - // https://github.com/paritytech/substrate/blob/polkadot-v0.9.16/frame/system/src/lib.rs#L545-L639 - // Balances storage items. - // https://github.com/paritytech/substrate/blob/polkadot-v0.9.16/frame/balances/src/lib.rs#L486-L535 pub fn process_system(&mut self) -> &mut Self { + // System storage items. + // https://github.dev/darwinia-network/substrate/blob/darwinia-v0.12.5/frame/system/src/lib.rs#L545 let solo_account_infos = self.process_solo_account_infos(); let para_account_infos = self.process_para_account_infos(); let (ring_total_issuance_storage, kton_total_issuance_storage) = self.process_balances(); @@ -88,15 +81,15 @@ impl Processor { ring_total_issuance += v.data.reserved; }); + log::info!("`ring_total_issuance({ring_total_issuance})`"); + log::info!("`ring_total_issuance_storage({ring_total_issuance_storage})`"); + log::info!("set `Balances::TotalIssuance`"); - log::info!("ring_total_issuance({ring_total_issuance})"); - log::info!("ring_total_issuance_storage({ring_total_issuance_storage})"); - self.shell_state - .0 - .insert(item_key(b"Balances", b"TotalIssuance"), encode_value(ring_total_issuance)); - - log::info!("kton_total_issuance({kton_total_issuance})"); - log::info!("kton_total_issuance_storage({kton_total_issuance_storage})"); + self.shell_state.insert_value(b"Balances", b"TotalIssuance", "", ring_total_issuance); + + log::info!("`kton_total_issuance({kton_total_issuance})`"); + log::info!("`kton_total_issuance_storage({kton_total_issuance_storage})`"); + // TODO: set KTON total issuance log::info!("update ring misc frozen and fee frozen"); @@ -117,26 +110,23 @@ impl Processor { }, }; - match is_evm_addr(&key) { - (true, addr) => { - self.shell_state.0.insert( - full_key( - b"System", - b"Account", - &bytes2hex("", &Blake2_128Concat::hash(&addr.encode())), - ), - encode_value(a), - ); - // TODO: migrate kton balances. - }, - (false, None) => { - a.nonce = 0; + if let Some(k) = try_get_evm_address(&key) { + self.shell_state.insert_value( + b"System", + b"Account", + &array_bytes::bytes2hex("", subhasher::blake2_128_concat(k)), + a, + ); + // TODO: migrate kton balances. + } else { + a.nonce = 0; - self.shell_state - .0 - .insert(full_key(b"AccountMigration", b"Accounts", &key), encode_value(a)); - }, - _ => unreachable!(), + self.shell_state.insert_value( + b"AccountMigration", + b"Accounts", + &array_bytes::bytes2hex("", subhasher::blake2_128_concat(k)), + a, + ); } }); @@ -154,13 +144,8 @@ impl Processor { .take_map(b"Ethereum", b"RemainingRingBalance", &mut remaining_ring, get_hashed_key) .take_map(b"Ethereum", b"RemainingKtonBalance", &mut remaining_kton, get_hashed_key); - log::info!("adjust solo balance decimals"); - account_infos.iter_mut().for_each(|(_, v)| { - v.data.free *= GWEI; - v.data.reserved *= GWEI; - v.data.free_kton_or_misc_frozen *= GWEI; - v.data.reserved_kton_or_fee_frozen *= GWEI; - }); + log::info!("adjust solo `AccountData`s"); + account_infos.iter_mut().for_each(|(_, v)| v.data.adjust()); log::info!("merge solo remaining balances"); remaining_ring.into_iter().for_each(|(k, v)| { @@ -197,28 +182,25 @@ impl Processor { } } -// Returns true if the key is an EVM account key and the associated address, otherwise, returns None -fn is_evm_addr(key: &str) -> (bool, Option) { +fn try_get_evm_address(key: &str) -> Option<[u8; 20]> { let k = array_bytes::hex2bytes_unchecked(key); if k.starts_with(b"dvm:") && k[1..31].iter().fold(k[0], |checksum, &b| checksum ^ b) == k[31] { - return (true, Some(H160::from_slice(&k[11..31]))); + Some(array_bytes::slice2array_unchecked(&k[11..31])) + } else { + None } - (false, None) } #[test] fn verify_evm_address_checksum_should_work() { - // std - use std::str::FromStr; - // subalfred key 5ELRpquT7C3mWtjerpPfdmaGoSh12BL2gFCv2WczEcv6E1zL // sub-seed // public-key 0x64766d3a00000000000000b7de7f8c52ac75e036d05fda53a75cf12714a76973 // Substrate 5ELRpquT7C3mWtjerpPfdmaGoSh12BL2gFCv2WczEcv6E1zL - assert!(is_evm_addr("0x64766d3a00000000000000b7de7f8c52ac75e036d05fda53a75cf12714a76973").0); assert_eq!( - is_evm_addr("0x64766d3a00000000000000b7de7f8c52ac75e036d05fda53a75cf12714a76973").1, - H160::from_str("b7de7f8c52ac75e036d05fda53a75cf12714a769").ok(), + try_get_evm_address("0x64766d3a00000000000000b7de7f8c52ac75e036d05fda53a75cf12714a76973") + .unwrap(), + array_bytes::hex2array_unchecked::<_, 20>("0xb7de7f8c52ac75e036d05fda53a75cf12714a769") ); } diff --git a/tool/state-processor/src/type_registry.rs b/tool/state-processor/src/type_registry.rs index 4379e9d5d..750da96d3 100644 --- a/tool/state-processor/src/type_registry.rs +++ b/tool/state-processor/src/type_registry.rs @@ -32,3 +32,55 @@ pub enum Reasons { Misc = 1, All = 2, } + +#[derive(Debug, Encode, Decode)] +pub struct Deposit { + pub id: u8, + pub value: u128, + pub expired_time: u128, + pub in_use: bool, +} + +#[derive(Debug, Encode, Decode)] +pub struct StakingLedger { + pub stash: [u8; 32], + #[codec(compact)] + pub active: u128, + #[codec(compact)] + pub active_deposit_ring: u128, + #[codec(compact)] + pub active_kton: u128, + pub deposit_items: Vec, + pub ring_staking_lock: StakingLock, + pub kton_staking_lock: StakingLock, + pub claimed_rewards: Vec, +} +#[derive(Debug, Encode, Decode)] +pub struct TimeDepositItem { + #[codec(compact)] + pub value: u128, + #[codec(compact)] + pub start_time: u64, + #[codec(compact)] + pub expire_time: u64, +} +#[derive(Debug, Encode, Decode)] +pub struct StakingLock { + pub staking_amount: u128, + pub unbondings: Vec, +} +#[derive(Debug, Encode, Decode)] +pub struct Unbonding { + pub amount: u128, + pub until: u32, +} + +#[derive(Debug, Encode, Decode)] +pub struct Ledger { + pub staked_ring: u128, + pub staked_kton: u128, + pub staked_deposits: Vec, + pub unstaking_ring: Vec<(u128, u32)>, + pub unstaking_kton: Vec<(u128, u32)>, + pub unstaking_deposits: Vec<(u8, u32)>, +} diff --git a/tool/state-processor/src/vesting/mod.rs b/tool/state-processor/src/vesting/mod.rs index 8a698139a..015953ea1 100644 --- a/tool/state-processor/src/vesting/mod.rs +++ b/tool/state-processor/src/vesting/mod.rs @@ -4,15 +4,20 @@ use crate::*; impl Processor { pub fn process_vesting(&mut self) -> &mut Self { // Storage items. - // https://github.dev/paritytech/substrate/blob/19162e43be45817b44c7d48e50d03f074f60fbf4/frame/vesting/src/lib.rs#L188-L196 + // https://github.dev/darwinia-network/substrate/blob/darwinia-v0.12.5/frame/vesting/src/lib.rs#L188 let mut vestings = Map::default(); + // TODO: adjust decimals + // TODO: adjust block number log::info!("take solo `Vesting::Vesting`"); - self.solo_state.take_raw(&item_key(b"Vesting", b"Vesting"), &mut vestings, |key, from| { - replace_first_match(key, from, &item_key(b"AccountMigration", b"Vestings")) - }); + self.solo_state.take_raw_map( + &item_key(b"Vesting", b"Vesting"), + &mut vestings, + |key, from| replace_first_match(key, from, &item_key(b"AccountMigration", b"Vestings")), + ); + log::info!("set `Vesting::Vesting`"); - self.shell_state.insert_raw(vestings); + self.shell_state.insert_raw_key_map(vestings); self } From 7fd05bce556324eff6f65e11cdbaebc636db8aca Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Tue, 20 Dec 2022 18:14:14 +0800 Subject: [PATCH 054/189] Fix vesting processor (#144) * Fix vesting processor Signed-off-by: Xavier Lau * Format Signed-off-by: Xavier Lau --- tool/state-processor/src/adjust.rs | 10 ++++++++++ tool/state-processor/src/type_registry.rs | 7 +++++++ tool/state-processor/src/vesting/README.md | 1 + tool/state-processor/src/vesting/mod.rs | 21 +++++++++++---------- 4 files changed, 29 insertions(+), 10 deletions(-) diff --git a/tool/state-processor/src/adjust.rs b/tool/state-processor/src/adjust.rs index 59b9485ce..5b3c8d724 100644 --- a/tool/state-processor/src/adjust.rs +++ b/tool/state-processor/src/adjust.rs @@ -33,6 +33,16 @@ impl Adjust for BalanceLock { } } +impl Adjust for VestingInfo { + fn adjust(&mut self) { + self.locked.adjust(); + self.per_block *= 2; + self.per_block.adjust(); + self.starting_block = + self.starting_block.checked_sub(*NOW.read().unwrap()).unwrap_or_default(); + } +} + impl Adjust for StakingLedger { fn adjust(&mut self) { self.active.adjust(); diff --git a/tool/state-processor/src/type_registry.rs b/tool/state-processor/src/type_registry.rs index 750da96d3..b5e1c877d 100644 --- a/tool/state-processor/src/type_registry.rs +++ b/tool/state-processor/src/type_registry.rs @@ -33,6 +33,13 @@ pub enum Reasons { All = 2, } +#[derive(Debug, Encode, Decode)] +pub struct VestingInfo { + pub locked: u128, + pub per_block: u128, + pub starting_block: u32, +} + #[derive(Debug, Encode, Decode)] pub struct Deposit { pub id: u8, diff --git a/tool/state-processor/src/vesting/README.md b/tool/state-processor/src/vesting/README.md index 7088a5e46..66df48663 100644 --- a/tool/state-processor/src/vesting/README.md +++ b/tool/state-processor/src/vesting/README.md @@ -2,4 +2,5 @@ > There are only 3 vesting records on Crab and 1 vesting record on Darwinia. - take solo `Vesting::Vesting` +- adjust solo `VestingInfo`s - set `AccountMigration::Vestings` diff --git a/tool/state-processor/src/vesting/mod.rs b/tool/state-processor/src/vesting/mod.rs index 015953ea1..5a49b8dd6 100644 --- a/tool/state-processor/src/vesting/mod.rs +++ b/tool/state-processor/src/vesting/mod.rs @@ -5,19 +5,20 @@ impl Processor { pub fn process_vesting(&mut self) -> &mut Self { // Storage items. // https://github.dev/darwinia-network/substrate/blob/darwinia-v0.12.5/frame/vesting/src/lib.rs#L188 - let mut vestings = Map::default(); + let mut vestings = >::default(); - // TODO: adjust decimals - // TODO: adjust block number log::info!("take solo `Vesting::Vesting`"); - self.solo_state.take_raw_map( - &item_key(b"Vesting", b"Vesting"), - &mut vestings, - |key, from| replace_first_match(key, from, &item_key(b"AccountMigration", b"Vestings")), - ); + self.solo_state.take_map(b"Vesting", b"Vesting", &mut vestings, get_hashed_key); - log::info!("set `Vesting::Vesting`"); - self.shell_state.insert_raw_key_map(vestings); + log::info!("adjust solo `VestingInfo`s"); + vestings.iter_mut().for_each(|(_, v)| v.adjust()); + + log::info!("set `AccountMigration::Vestings`"); + { + let ik = item_key(b"AccountMigration", b"Vestings"); + + self.shell_state.insert_map(vestings, |h| format!("{ik}{h}")); + } self } From c9fdfa170501648102bd0137c0437e367e743770 Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Tue, 20 Dec 2022 19:32:54 +0800 Subject: [PATCH 055/189] Update KTON owner (#145) --- Cargo.lock | 1 + node/src/chain_spec/crab.rs | 2 +- node/src/chain_spec/darwinia.rs | 2 +- node/src/chain_spec/pangolin.rs | 2 +- node/src/command.rs | 4 ++-- pallet/staking/src/lib.rs | 2 +- runtime/common/Cargo.toml | 16 +++++++++++----- runtime/common/src/gov_origin.rs | 6 ++++++ runtime/crab/src/pallets/deposit.rs | 2 +- runtime/darwinia/src/pallets/deposit.rs | 2 +- runtime/pangolin/src/pallets/deposit.rs | 2 +- 11 files changed, 27 insertions(+), 14 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7c0035acf..d10cd2db0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2324,6 +2324,7 @@ dependencies = [ name = "darwinia-common-runtime" version = "6.0.0" dependencies = [ + "account", "bp-darwinia-core", "dc-primitives", "frame-support", diff --git a/node/src/chain_spec/crab.rs b/node/src/chain_spec/crab.rs index caf865dd4..1416d37b6 100644 --- a/node/src/chain_spec/crab.rs +++ b/node/src/chain_spec/crab.rs @@ -232,7 +232,7 @@ fn testnet_genesis( }, transaction_payment: Default::default(), assets: AssetsConfig { - assets: vec![(AssetIds::CKton as _, array_bytes::hex_n_into_unchecked(ALITH), true, 1)], + assets: vec![(AssetIds::CKton as _, ROOT, true, 1)], metadata: vec![( AssetIds::CKton as _, b"Crab Commitment Token".to_vec(), diff --git a/node/src/chain_spec/darwinia.rs b/node/src/chain_spec/darwinia.rs index ea3ed8dc7..9e95dacb9 100644 --- a/node/src/chain_spec/darwinia.rs +++ b/node/src/chain_spec/darwinia.rs @@ -232,7 +232,7 @@ fn testnet_genesis( }, transaction_payment: Default::default(), assets: AssetsConfig { - assets: vec![(AssetIds::Kton as _, array_bytes::hex_n_into_unchecked(ALITH), true, 1)], + assets: vec![(AssetIds::Kton as _, ROOT, true, 1)], metadata: vec![( AssetIds::Kton as _, b"Darwinia Commitment Token".to_vec(), diff --git a/node/src/chain_spec/pangolin.rs b/node/src/chain_spec/pangolin.rs index 2694b8331..58ce0c9c4 100644 --- a/node/src/chain_spec/pangolin.rs +++ b/node/src/chain_spec/pangolin.rs @@ -156,7 +156,7 @@ pub fn genesis_config() -> ChainSpec { assets: AssetsConfig { assets: vec![( AssetIds::PKton as _, - array_bytes::hex_n_into_unchecked(ALITH), + ROOT, true, 1, )], diff --git a/node/src/command.rs b/node/src/command.rs index c0a7e4baa..f7b472b3a 100644 --- a/node/src/command.rs +++ b/node/src/command.rs @@ -594,7 +594,7 @@ pub fn run() -> Result<()> { SubstrateCli::create_configuration(&polkadot_cli, &polkadot_cli, tokio_handle) .map_err(|err| format!("Relay chain argument error: {}", err))?; - return if chain_spec.is_crab() { + if chain_spec.is_crab() { service::start_parachain_node::( config, polkadot_config, @@ -630,7 +630,7 @@ pub fn run() -> Result<()> { .await .map(|r| r.0) .map_err(Into::into) - }; + } }) }, } diff --git a/pallet/staking/src/lib.rs b/pallet/staking/src/lib.rs index 041ce026e..dbfd80656 100644 --- a/pallet/staking/src/lib.rs +++ b/pallet/staking/src/lib.rs @@ -270,7 +270,7 @@ pub mod pallet { /// Stakers' exposure. #[pallet::storage] #[pallet::unbounded] - #[pallet::getter(fn exposure)] + #[pallet::getter(fn exposure_of)] pub type Exposures = StorageMap<_, Twox64Concat, T::AccountId, Exposure>; diff --git a/runtime/common/Cargo.toml b/runtime/common/Cargo.toml index 3bd45cee5..9815fc937 100644 --- a/runtime/common/Cargo.toml +++ b/runtime/common/Cargo.toml @@ -19,16 +19,19 @@ dc-primitives = { default-features = false, path = "../../core/primitives" } # darwinia-messages-substrate bp-darwinia-core = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } +# moonbeam +account = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.30" } + # polkadot xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" } xcm-executor = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" } # substrate -frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-collective = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-io = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-collective = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-io = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } [features] default = ["std"] @@ -39,6 +42,9 @@ std = [ # darwinia "dc-primitives/std", + # moonbeam + "account/std", + # polkadot "xcm/std", "xcm-executor/std", diff --git a/runtime/common/src/gov_origin.rs b/runtime/common/src/gov_origin.rs index 1d34450f1..78b4f404c 100644 --- a/runtime/common/src/gov_origin.rs +++ b/runtime/common/src/gov_origin.rs @@ -18,6 +18,8 @@ // darwinia use dc_primitives::AccountId; +// moonbeam +use account::AccountId20; // substrate use frame_support::traits::EitherOfDiverse; use frame_system::EnsureRoot; @@ -39,3 +41,7 @@ pub type RootOrAtLeastThreeFifth = pub type RootOrAll = EitherOfDiverse>; + +/// An [`AccountId20`] generated from b"root". +pub const ROOT: AccountId20 = + AccountId20([0x72, 0x6f, 0x6f, 0x74, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]); diff --git a/runtime/crab/src/pallets/deposit.rs b/runtime/crab/src/pallets/deposit.rs index 0ed9b9bfb..696b789e8 100644 --- a/runtime/crab/src/pallets/deposit.rs +++ b/runtime/crab/src/pallets/deposit.rs @@ -24,7 +24,7 @@ impl darwinia_deposit::Minting for CKtonMinting { type AccountId = AccountId; fn mint(beneficiary: &Self::AccountId, amount: Balance) -> sp_runtime::DispatchResult { - Assets::mint(RuntimeOrigin::root(), AssetIds::CKton as AssetId, *beneficiary, amount) + Assets::mint(RuntimeOrigin::signed(ROOT), AssetIds::CKton as AssetId, *beneficiary, amount) } } diff --git a/runtime/darwinia/src/pallets/deposit.rs b/runtime/darwinia/src/pallets/deposit.rs index 84dc288c3..4c46dd164 100644 --- a/runtime/darwinia/src/pallets/deposit.rs +++ b/runtime/darwinia/src/pallets/deposit.rs @@ -24,7 +24,7 @@ impl darwinia_deposit::Minting for KtonMinting { type AccountId = AccountId; fn mint(beneficiary: &Self::AccountId, amount: Balance) -> sp_runtime::DispatchResult { - Assets::mint(RuntimeOrigin::root(), AssetIds::Kton as AssetId, *beneficiary, amount) + Assets::mint(RuntimeOrigin::signed(ROOT), AssetIds::Kton as AssetId, *beneficiary, amount) } } diff --git a/runtime/pangolin/src/pallets/deposit.rs b/runtime/pangolin/src/pallets/deposit.rs index 023819bc4..aacc925bd 100644 --- a/runtime/pangolin/src/pallets/deposit.rs +++ b/runtime/pangolin/src/pallets/deposit.rs @@ -24,7 +24,7 @@ impl darwinia_deposit::Minting for PKtonMinting { type AccountId = AccountId; fn mint(beneficiary: &Self::AccountId, amount: Balance) -> sp_runtime::DispatchResult { - Assets::mint(RuntimeOrigin::root(), AssetIds::PKton as AssetId, *beneficiary, amount) + Assets::mint(RuntimeOrigin::signed(ROOT), AssetIds::PKton as AssetId, *beneficiary, amount) } } From acc0c608f77571806a29fe3341adbed6fc0d4bf4 Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Wed, 21 Dec 2022 12:01:37 +0800 Subject: [PATCH 056/189] Add genesis (#148) * Add genesis * Fix compile --- node/src/chain_spec/crab.rs | 11 ++++++++++- node/src/chain_spec/darwinia.rs | 11 ++++++++++- node/src/chain_spec/pangolin.rs | 18 +++++++++++------- 3 files changed, 31 insertions(+), 9 deletions(-) diff --git a/node/src/chain_spec/crab.rs b/node/src/chain_spec/crab.rs index 1416d37b6..e0d725a2d 100644 --- a/node/src/chain_spec/crab.rs +++ b/node/src/chain_spec/crab.rs @@ -153,7 +153,16 @@ pub fn genesis_config() -> ChainSpec { // Monetary stuff. balances: Default::default(), transaction_payment: Default::default(), - assets: Default::default(), + assets: AssetsConfig { + assets: vec![(AssetIds::CKton as _, ROOT, true, 1)], + metadata: vec![( + AssetIds::CKton as _, + b"Crab Commitment Token".to_vec(), + b"CKTON".to_vec(), + 18, + )], + ..Default::default() + }, // Consensus stuff. staking: StakingConfig { diff --git a/node/src/chain_spec/darwinia.rs b/node/src/chain_spec/darwinia.rs index 9e95dacb9..5d521aa6e 100644 --- a/node/src/chain_spec/darwinia.rs +++ b/node/src/chain_spec/darwinia.rs @@ -153,7 +153,16 @@ pub fn genesis_config() -> ChainSpec { // Monetary stuff. balances: Default::default(), transaction_payment: Default::default(), - assets: Default::default(), + assets: AssetsConfig { + assets: vec![(AssetIds::Kton as _, ROOT, true, 1)], + metadata: vec![( + AssetIds::Kton as _, + b"Darwinia Commitment Token".to_vec(), + b"KTON".to_vec(), + 18, + )], + ..Default::default() + }, // Consensus stuff. staking: StakingConfig { diff --git a/node/src/chain_spec/pangolin.rs b/node/src/chain_spec/pangolin.rs index 58ce0c9c4..ce9e28c94 100644 --- a/node/src/chain_spec/pangolin.rs +++ b/node/src/chain_spec/pangolin.rs @@ -154,12 +154,7 @@ pub fn genesis_config() -> ChainSpec { balances: Default::default(), transaction_payment: Default::default(), assets: AssetsConfig { - assets: vec![( - AssetIds::PKton as _, - ROOT, - true, - 1, - )], + assets: vec![(AssetIds::PKton as _, ROOT, true, 1)], metadata: vec![( AssetIds::PKton as _, b"Pangolin Commitment Token".to_vec(), @@ -239,7 +234,16 @@ fn testnet_genesis( balances: endowed_accounts.iter().cloned().map(|k| (k, 100_000_000 * UNIT)).collect(), }, transaction_payment: Default::default(), - assets: Default::default(), + assets: AssetsConfig { + assets: vec![(AssetIds::PKton as _, ROOT, true, 1)], + metadata: vec![( + AssetIds::PKton as _, + b"Pangolin Commitment Token".to_vec(), + b"PKTON".to_vec(), + 18, + )], + ..Default::default() + }, // Consensus stuff. staking: StakingConfig { From e4cf09ae5e524ee6251eda83bba53f13eb7745a5 Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Wed, 21 Dec 2022 13:13:13 +0800 Subject: [PATCH 057/189] Clippy (#150) --- core/inflation/src/test.rs | 1 + pallet/deposit/tests/tests.rs | 6 +++--- pallet/message-transact/src/mock.rs | 2 +- pallet/message-transact/src/tests/mod.rs | 2 +- pallet/staking/tests/mock.rs | 4 ++-- pallet/staking/tests/tests.rs | 10 +++++----- precompile/assets/src/mock.rs | 3 +-- precompile/assets/src/tests.rs | 12 ++++++------ tool/state-processor/src/main.rs | 6 ------ 9 files changed, 20 insertions(+), 26 deletions(-) diff --git a/core/inflation/src/test.rs b/core/inflation/src/test.rs index 30ae1e7f9..cb9f057cc 100644 --- a/core/inflation/src/test.rs +++ b/core/inflation/src/test.rs @@ -23,6 +23,7 @@ use crate::*; fn inflate_should_work() { let max = 10_000_000_000_u128 * UNIT; let init = 2_000_000_000_u128 * UNIT; + #[allow(clippy::approx_constant)] let rates = [ 4_f64, 5.37, 6.15, 6.56, 6.74, 6.76, 6.66, 6.5, 6.28, 6.04, 5.79, 5.52, 5.26, 4.99, 4.74, 4.49, 4.25, 4.03, 3.81, 3.6, 3.4, 3.21, 3.04, 2.87, 2.71, 2.55, 2.41, 2.27, 2.14, 2.02, diff --git a/pallet/deposit/tests/tests.rs b/pallet/deposit/tests/tests.rs index e1de4b34e..f7ceba134 100644 --- a/pallet/deposit/tests/tests.rs +++ b/pallet/deposit/tests/tests.rs @@ -253,13 +253,13 @@ fn claim_should_work() { assert!(Deposit::deposit_of(&1).is_none()); assert_ok!(Deposit::lock(RuntimeOrigin::signed(1), UNIT, 1)); - assert!(!Deposit::deposit_of(&1).is_none()); + assert!(Deposit::deposit_of(&1).is_some()); efflux(MILLISECS_PER_MONTH - 1); assert_eq!(System::account(&1).consumers, 1); assert_ok!(Deposit::claim(RuntimeOrigin::signed(1))); assert_eq!(System::account(&1).consumers, 1); - assert!(!Deposit::deposit_of(&1).is_none()); + assert!(Deposit::deposit_of(&1).is_some()); efflux(MILLISECS_PER_MONTH); assert_eq!(System::account(&1).consumers, 1); @@ -273,7 +273,7 @@ fn claim_should_work() { assert_eq!(System::account(&1).consumers, 1); assert_ok!(Deposit::claim(RuntimeOrigin::signed(1))); assert_eq!(System::account(&1).consumers, 1); - assert!(!Deposit::deposit_of(&1).is_none()); + assert!(Deposit::deposit_of(&1).is_some()); assert_ok!(Deposit::unstake(&1, 0)); assert_eq!(System::account(&1).consumers, 1); diff --git a/pallet/message-transact/src/mock.rs b/pallet/message-transact/src/mock.rs index 0960d5f1a..42935ab8a 100644 --- a/pallet/message-transact/src/mock.rs +++ b/pallet/message-transact/src/mock.rs @@ -165,7 +165,7 @@ impl CallValidate for MockCallValidator { match call { RuntimeCall::MessageTransact(crate::Call::message_transact { transaction: tx }) => { let total_payment = crate::total_payment::((&**tx).into()); - let relayer = pallet_evm::Pallet::::account_basic(&relayer_account).0; + let relayer = pallet_evm::Pallet::::account_basic(relayer_account).0; ensure!(relayer.balance >= total_payment, "Insufficient balance"); Ok(()) diff --git a/pallet/message-transact/src/tests/mod.rs b/pallet/message-transact/src/tests/mod.rs index 96480153c..bfd1d22d2 100644 --- a/pallet/message-transact/src/tests/mod.rs +++ b/pallet/message-transact/src/tests/mod.rs @@ -89,7 +89,7 @@ impl LegacyUnsignedTransaction { fn signing_hash(&self) -> H256 { let mut stream = RlpStream::new(); self.signing_rlp_append(&mut stream); - H256::from_slice(&Keccak256::digest(&stream.out()).as_slice()) + H256::from_slice(Keccak256::digest(&stream.out()).as_slice()) } pub fn sign(&self, key: &H256) -> Transaction { diff --git a/pallet/staking/tests/mock.rs b/pallet/staking/tests/mock.rs index dbb9cfdca..bfdc1c79b 100644 --- a/pallet/staking/tests/mock.rs +++ b/pallet/staking/tests/mock.rs @@ -154,7 +154,7 @@ impl pallet_session::SessionHandler for TestSessionHandler { &[sp_runtime::testing::UintAuthorityId::ID]; fn on_genesis_session(keys: &[(u32, Ks)]) { - SessionHandlerCollators::set(keys.into_iter().map(|(a, _)| *a).collect::>()) + SessionHandlerCollators::set(keys.iter().map(|(a, _)| *a).collect::>()) } fn on_new_session( @@ -163,7 +163,7 @@ impl pallet_session::SessionHandler for TestSessionHandler { _: &[(u32, Ks)], ) { SessionChangeBlock::set(System::block_number()); - SessionHandlerCollators::set(keys.into_iter().map(|(a, _)| *a).collect::>()) + SessionHandlerCollators::set(keys.iter().map(|(a, _)| *a).collect::>()) } fn on_before_session_ending() {} diff --git a/pallet/staking/tests/tests.rs b/pallet/staking/tests/tests.rs index 09735d826..9cf59111c 100644 --- a/pallet/staking/tests/tests.rs +++ b/pallet/staking/tests/tests.rs @@ -111,7 +111,7 @@ fn unstake_should_work() { assert_eq!( Staking::ledger_of(1).unwrap(), Ledger { - staked_ring: 1 * UNIT, + staked_ring: UNIT, staked_kton: 2 * UNIT, staked_deposits: BoundedVec::truncate_from(vec![0, 1, 2]), unstaking_ring: BoundedVec::truncate_from(vec![(UNIT, 4)]), @@ -125,8 +125,8 @@ fn unstake_should_work() { assert_eq!( Staking::ledger_of(1).unwrap(), Ledger { - staked_ring: 1 * UNIT, - staked_kton: 1 * UNIT, + staked_ring: UNIT, + staked_kton: UNIT, staked_deposits: BoundedVec::truncate_from(vec![0, 1, 2]), unstaking_ring: BoundedVec::truncate_from(vec![(UNIT, 4)]), unstaking_kton: BoundedVec::truncate_from(vec![(UNIT, 5)]), @@ -140,8 +140,8 @@ fn unstake_should_work() { assert_eq!( Staking::ledger_of(1).unwrap(), Ledger { - staked_ring: 1 * UNIT, - staked_kton: 1 * UNIT, + staked_ring: UNIT, + staked_kton: UNIT, staked_deposits: BoundedVec::truncate_from(vec![1, 2]), unstaking_ring: BoundedVec::truncate_from(vec![(UNIT, 4)]), unstaking_kton: BoundedVec::truncate_from(vec![(UNIT, 5)]), diff --git a/precompile/assets/src/mock.rs b/precompile/assets/src/mock.rs index 2eceda295..6f9e38f7c 100644 --- a/precompile/assets/src/mock.rs +++ b/precompile/assets/src/mock.rs @@ -142,8 +142,7 @@ fn addr(a: u64) -> H160 { pub struct AssetIdConverter; impl AccountToAssetId for AssetIdConverter { fn account_to_asset_id(account_id: AccountId) -> AssetId { - let addr: H160 = account_id.into(); - addr.to_low_u64_be() + account_id.to_low_u64_be() } } diff --git a/precompile/assets/src/tests.rs b/precompile/assets/src/tests.rs index 5317d5896..5b7d4e647 100644 --- a/precompile/assets/src/tests.rs +++ b/precompile/assets/src/tests.rs @@ -308,8 +308,8 @@ fn transfer_not_enough_founds() { InternalCall::transfer { to: Address(Charlie.into()), value: 50.into() }, ) .execute_reverts(|output| { - from_utf8(&output).unwrap().contains("Dispatched call failed with error: ") - && from_utf8(&output).unwrap().contains("BalanceLow") + from_utf8(output).unwrap().contains("Dispatched call failed with error: ") + && from_utf8(output).unwrap().contains("BalanceLow") }); }); } @@ -665,8 +665,8 @@ fn freeze() { InternalCall::transfer { to: Address(Alice.into()), value: 400.into() }, ) .execute_reverts(|output| { - from_utf8(&output).unwrap().contains("Dispatched call failed with error: ") - && from_utf8(&output).unwrap().contains("Frozen") + from_utf8(output).unwrap().contains("Dispatched call failed with error: ") + && from_utf8(output).unwrap().contains("Frozen") }); }); } @@ -753,8 +753,8 @@ fn transfer_ownership() { InternalCall::transfer_ownership { owner: Address(Bob.into()) }, ) .execute_reverts(|output| { - from_utf8(&output).unwrap().contains("Dispatched call failed with error: ") - && from_utf8(&output).unwrap().contains("NoPermission") + from_utf8(output).unwrap().contains("Dispatched call failed with error: ") + && from_utf8(output).unwrap().contains("NoPermission") }); precompiles() diff --git a/tool/state-processor/src/main.rs b/tool/state-processor/src/main.rs index e8b5a6d29..f375bb67b 100644 --- a/tool/state-processor/src/main.rs +++ b/tool/state-processor/src/main.rs @@ -259,12 +259,6 @@ where Ok(serde_json::from_slice(&v)?) } -fn pallet_key(pallet: &[u8]) -> String { - let prefix = subhasher::twox128(pallet); - - array_bytes::bytes2hex("0x", prefix) -} - fn item_key(pallet: &[u8], item: &[u8]) -> String { let k = substorager::storage_key(pallet, item); From 893a46e9b9930f9defdc56619e043e422211a415 Mon Sep 17 00:00:00 2001 From: bear Date: Wed, 21 Dec 2022 13:13:35 +0800 Subject: [PATCH 058/189] Fix revert (#149) Co-authored-by: Xavier Lau --- runtime/crab/src/pallets/evm.rs | 6 +++--- runtime/darwinia/src/pallets/evm.rs | 6 +++--- runtime/pangolin/src/pallets/evm.rs | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/runtime/crab/src/pallets/evm.rs b/runtime/crab/src/pallets/evm.rs index 06766c029..749bb6be6 100644 --- a/runtime/crab/src/pallets/evm.rs +++ b/runtime/crab/src/pallets/evm.rs @@ -121,15 +121,15 @@ where // darwinia use darwinia_precompile_assets::AccountToAssetId; - let (code_address, caller) = (handle.code_address(), handle.context().caller); + let (code_addr, context_addr) = (handle.code_address(), handle.context().address); // Filter known precompile addresses except Ethereum officials - if self.is_precompile(code_address) && code_address > addr(9) && code_address != caller { + if self.is_precompile(code_addr) && code_addr > addr(9) && code_addr != context_addr { return Some(Err(precompile_utils::revert( "cannot be called with DELEGATECALL or CALLCODE", ))); }; - match code_address { + match code_addr { // Ethereum precompiles: a if a == addr(1) => Some(pallet_evm_precompile_simple::ECRecover::execute(handle)), a if a == addr(2) => Some(pallet_evm_precompile_simple::Sha256::execute(handle)), diff --git a/runtime/darwinia/src/pallets/evm.rs b/runtime/darwinia/src/pallets/evm.rs index d3e94bec0..7737ad08a 100644 --- a/runtime/darwinia/src/pallets/evm.rs +++ b/runtime/darwinia/src/pallets/evm.rs @@ -121,15 +121,15 @@ where // darwinia use darwinia_precompile_assets::AccountToAssetId; - let (code_address, caller) = (handle.code_address(), handle.context().caller); + let (code_addr, context_addr) = (handle.code_address(), handle.context().address); // Filter known precompile addresses except Ethereum officials - if self.is_precompile(code_address) && code_address > addr(9) && code_address != caller { + if self.is_precompile(code_addr) && code_addr > addr(9) && code_addr != context_addr { return Some(Err(precompile_utils::revert( "cannot be called with DELEGATECALL or CALLCODE", ))); }; - match code_address { + match code_addr { // Ethereum precompiles: a if a == addr(1) => Some(pallet_evm_precompile_simple::ECRecover::execute(handle)), a if a == addr(2) => Some(pallet_evm_precompile_simple::Sha256::execute(handle)), diff --git a/runtime/pangolin/src/pallets/evm.rs b/runtime/pangolin/src/pallets/evm.rs index 051329ca2..f08c57f64 100644 --- a/runtime/pangolin/src/pallets/evm.rs +++ b/runtime/pangolin/src/pallets/evm.rs @@ -121,15 +121,15 @@ where // darwinia use darwinia_precompile_assets::AccountToAssetId; - let (code_address, caller) = (handle.code_address(), handle.context().caller); + let (code_addr, context_addr) = (handle.code_address(), handle.context().address); // Filter known precompile addresses except Ethereum officials - if self.is_precompile(code_address) && code_address > addr(9) && code_address != caller { + if self.is_precompile(code_addr) && code_addr > addr(9) && code_addr != context_addr { return Some(Err(precompile_utils::revert( "cannot be called with DELEGATECALL or CALLCODE", ))); }; - match code_address { + match code_addr { // Ethereum precompiles: a if a == addr(1) => Some(pallet_evm_precompile_simple::ECRecover::execute(handle)), a if a == addr(2) => Some(pallet_evm_precompile_simple::Sha256::execute(handle)), From 22e95f732edd79386a554ff52e5eb6a3a1b7a729 Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Wed, 21 Dec 2022 17:14:13 +0800 Subject: [PATCH 059/189] Fix hash key (#152) --- tool/state-processor/src/system/mod.rs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/tool/state-processor/src/system/mod.rs b/tool/state-processor/src/system/mod.rs index 8b4604ceb..812a4d25c 100644 --- a/tool/state-processor/src/system/mod.rs +++ b/tool/state-processor/src/system/mod.rs @@ -121,12 +121,7 @@ impl Processor { } else { a.nonce = 0; - self.shell_state.insert_value( - b"AccountMigration", - b"Accounts", - &array_bytes::bytes2hex("", subhasher::blake2_128_concat(k)), - a, - ); + self.shell_state.insert_value(b"AccountMigration", b"Accounts", &k, a); } }); From 08b703a75e657a120b6701a5781bdbbd88e6a617 Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Wed, 21 Dec 2022 17:23:22 +0800 Subject: [PATCH 060/189] Process indices & more utility fns (#151) * More tools * Process indices * More error logs Signed-off-by: Xavier Lau Signed-off-by: Xavier Lau --- tool/state-processor/src/indices/README.md | 3 ++ tool/state-processor/src/indices/mod.rs | 22 ++++++++ tool/state-processor/src/main.rs | 61 ++++++++++++++++++++-- tool/state-processor/src/staking/mod.rs | 2 +- tool/state-processor/src/system/mod.rs | 2 +- tool/state-processor/src/type_registry.rs | 25 +++++---- 6 files changed, 98 insertions(+), 17 deletions(-) create mode 100644 tool/state-processor/src/indices/README.md create mode 100644 tool/state-processor/src/indices/mod.rs diff --git a/tool/state-processor/src/indices/README.md b/tool/state-processor/src/indices/README.md new file mode 100644 index 000000000..de0265283 --- /dev/null +++ b/tool/state-processor/src/indices/README.md @@ -0,0 +1,3 @@ +### Process steps +- take solo `Indices::Accounts` +- adjust the reserved's decimals then free solo `Indices` reservations diff --git a/tool/state-processor/src/indices/mod.rs b/tool/state-processor/src/indices/mod.rs new file mode 100644 index 000000000..499e401a4 --- /dev/null +++ b/tool/state-processor/src/indices/mod.rs @@ -0,0 +1,22 @@ +// darwinia +use crate::*; + +impl Processor { + pub fn process_indices(&mut self) -> &mut Self { + // Storage items. + // https://github.dev/darwinia-network/substrate/blob/darwinia-v0.12.5/frame/indices/src/lib.rs#L291 + let mut accounts = >::default(); + + log::info!("take solo `Indices::Accounts`"); + self.solo_state.take_map(b"Indices", b"Accounts", &mut accounts, get_identity_key); + + // https://github.dev/darwinia-network/substrate/blob/darwinia-v0.12.5/frame/indices/src/lib.rs#L154 + log::info!("adjust the reserved's decimals then free solo `Indices` reservations"); + accounts.into_iter().for_each(|(_, (a, mut v, _))| { + v.adjust(); + self.shell_state.unreserve(a, v); + }); + + self + } +} diff --git a/tool/state-processor/src/main.rs b/tool/state-processor/src/main.rs index f375bb67b..35a5fc250 100644 --- a/tool/state-processor/src/main.rs +++ b/tool/state-processor/src/main.rs @@ -1,5 +1,6 @@ mod balances; mod evm; +mod indices; mod staking; mod system; mod vesting; @@ -65,7 +66,7 @@ impl Processor { assert!(*_guard != 0); - self.process_system().process_vesting().process_staking().process_evm(); + self.process_system().process_indices().process_vesting().process_staking().process_evm(); self.save() } @@ -148,12 +149,18 @@ impl State { if let Some(v) = self.0.get(&key) { match decode(v) { Ok(v) => *value = v, - Err(e) => log::warn!( + Err(e) => log::error!( "failed to decode `{}::{}::{hash}({v})`, due to `{e}`", String::from_utf8_lossy(pallet), String::from_utf8_lossy(item), ), } + } else { + log::error!( + "key not found `{}::{}::{hash}`", + String::from_utf8_lossy(pallet), + String::from_utf8_lossy(item), + ); } self @@ -168,12 +175,18 @@ impl State { if let Some(v) = self.0.remove(&key) { match decode(&v) { Ok(v) => *value = v, - Err(e) => log::warn!( + Err(e) => log::error!( "failed to decode `{}::{}::{hash}({v})`, due to `{e}`", String::from_utf8_lossy(pallet), String::from_utf8_lossy(item) ), } + } else { + log::error!( + "key not found `{}::{}::{hash}`", + String::from_utf8_lossy(pallet), + String::from_utf8_lossy(item), + ); } self @@ -188,6 +201,22 @@ impl State { self } + fn mutate_value(&mut self, pallet: &[u8], item: &[u8], hash: &str, f: F) -> &mut Self + where + D: Default + Encode + Decode, + F: FnOnce(&mut D), + { + let mut v = D::default(); + + self.get_value(pallet, item, hash, &mut v); + + f(&mut v); + + self.insert_value(pallet, item, hash, v); + + self + } + fn take_map( &mut self, pallet: &[u8], @@ -208,7 +237,7 @@ impl State { Ok(v) => { buffer.insert(process_key(full_key, &prefix), v); }, - Err(e) => log::warn!("failed to decode `{full_key}:{v}`, due to `{e}`"), + Err(e) => log::error!("failed to decode `{full_key}:{v}`, due to `{e}`"), } false @@ -240,9 +269,24 @@ impl State { self } + // fn inc_consumers(&mut self, who: &str) {} + // fn transfer(&mut self, from: &str, to: &str, amount: u128) {} - // fn inc_consumers(&mut self, who: &str) {} + fn unreserve(&mut self, who: A, amount: u128) + where + A: AsRef<[u8]>, + { + self.mutate_value( + b"System", + b"Account", + &blake2_128_concat_to_string(who), + |a: &mut AccountInfo| { + a.data.free += amount; + a.data.reserved -= amount; + }, + ); + } } fn from_file(path: &str) -> Result @@ -303,3 +347,10 @@ fn get_last_64(key: &str) -> String { fn replace_first_match(key: &str, from: &str, to: &str) -> String { key.replacen(from, to, 1) } + +fn blake2_128_concat_to_string(data: D) -> String +where + D: AsRef<[u8]>, +{ + array_bytes::bytes2hex("", subhasher::blake2_128_concat(data)) +} diff --git a/tool/state-processor/src/staking/mod.rs b/tool/state-processor/src/staking/mod.rs index a6b6d5b4c..672e1983f 100644 --- a/tool/state-processor/src/staking/mod.rs +++ b/tool/state-processor/src/staking/mod.rs @@ -32,7 +32,7 @@ impl Processor { ledgers.into_iter().for_each(|(_, mut v)| { v.adjust(); - let hash_k = array_bytes::bytes2hex("", subhasher::blake2_128_concat(v.stash)); + let hash_k = blake2_128_concat_to_string(v.stash); let deposit_k = format!("{deposit_ik}{hash_k}"); let staking_k = format!("{staking_ik}{hash_k}"); let mut staked_deposits = Vec::default(); diff --git a/tool/state-processor/src/system/mod.rs b/tool/state-processor/src/system/mod.rs index 812a4d25c..fef0c78d0 100644 --- a/tool/state-processor/src/system/mod.rs +++ b/tool/state-processor/src/system/mod.rs @@ -114,7 +114,7 @@ impl Processor { self.shell_state.insert_value( b"System", b"Account", - &array_bytes::bytes2hex("", subhasher::blake2_128_concat(k)), + &blake2_128_concat_to_string(k), a, ); // TODO: migrate kton balances. diff --git a/tool/state-processor/src/type_registry.rs b/tool/state-processor/src/type_registry.rs index b5e1c877d..ef2170053 100644 --- a/tool/state-processor/src/type_registry.rs +++ b/tool/state-processor/src/type_registry.rs @@ -3,7 +3,7 @@ use parity_scale_codec::{Decode, Encode}; pub const GWEI: u128 = 1_000_000_000; -#[derive(Debug, Encode, Decode)] +#[derive(Default, Debug, Encode, Decode)] pub struct AccountInfo { pub nonce: u32, pub consumers: u32, @@ -11,7 +11,7 @@ pub struct AccountInfo { pub sufficients: u32, pub data: AccountData, } -#[derive(Debug, Encode, Decode)] +#[derive(Default, Debug, Encode, Decode)] pub struct AccountData { pub free: u128, pub reserved: u128, @@ -19,7 +19,7 @@ pub struct AccountData { pub reserved_kton_or_fee_frozen: u128, } -#[derive(Debug, Encode, Decode)] +#[derive(Default, Debug, Encode, Decode)] pub struct BalanceLock { pub id: [u8; 8], pub amount: u128, @@ -32,15 +32,20 @@ pub enum Reasons { Misc = 1, All = 2, } +impl Default for Reasons { + fn default() -> Self { + Self::All + } +} -#[derive(Debug, Encode, Decode)] +#[derive(Default, Debug, Encode, Decode)] pub struct VestingInfo { pub locked: u128, pub per_block: u128, pub starting_block: u32, } -#[derive(Debug, Encode, Decode)] +#[derive(Default, Debug, Encode, Decode)] pub struct Deposit { pub id: u8, pub value: u128, @@ -48,7 +53,7 @@ pub struct Deposit { pub in_use: bool, } -#[derive(Debug, Encode, Decode)] +#[derive(Default, Debug, Encode, Decode)] pub struct StakingLedger { pub stash: [u8; 32], #[codec(compact)] @@ -62,7 +67,7 @@ pub struct StakingLedger { pub kton_staking_lock: StakingLock, pub claimed_rewards: Vec, } -#[derive(Debug, Encode, Decode)] +#[derive(Default, Debug, Encode, Decode)] pub struct TimeDepositItem { #[codec(compact)] pub value: u128, @@ -71,18 +76,18 @@ pub struct TimeDepositItem { #[codec(compact)] pub expire_time: u64, } -#[derive(Debug, Encode, Decode)] +#[derive(Default, Debug, Encode, Decode)] pub struct StakingLock { pub staking_amount: u128, pub unbondings: Vec, } -#[derive(Debug, Encode, Decode)] +#[derive(Default, Debug, Encode, Decode)] pub struct Unbonding { pub amount: u128, pub until: u32, } -#[derive(Debug, Encode, Decode)] +#[derive(Default, Debug, Encode, Decode)] pub struct Ledger { pub staked_ring: u128, pub staked_kton: u128, From 8b46c6cefa47b7e4b402a60124bcacc5d3860779 Mon Sep 17 00:00:00 2001 From: bear Date: Thu, 22 Dec 2022 13:22:21 +0800 Subject: [PATCH 061/189] Fix contract account `sufficients` (#146) * Update sufficient * Inc sufficient for contract account * Fix * Use new style --- tool/state-processor/src/main.rs | 4 ++++ tool/state-processor/src/system/mod.rs | 11 +++++++++++ 2 files changed, 15 insertions(+) diff --git a/tool/state-processor/src/main.rs b/tool/state-processor/src/main.rs index 35a5fc250..40a5c0a04 100644 --- a/tool/state-processor/src/main.rs +++ b/tool/state-processor/src/main.rs @@ -269,6 +269,10 @@ impl State { self } + fn contains_key(&self, key: &str) -> bool { + self.0.contains_key(key) + } + // fn inc_consumers(&mut self, who: &str) {} // fn transfer(&mut self, from: &str, to: &str, amount: u128) {} diff --git a/tool/state-processor/src/system/mod.rs b/tool/state-processor/src/system/mod.rs index fef0c78d0..047917bbe 100644 --- a/tool/state-processor/src/system/mod.rs +++ b/tool/state-processor/src/system/mod.rs @@ -111,6 +111,17 @@ impl Processor { }; if let Some(k) = try_get_evm_address(&key) { + // If the evm account is a contract contract with sufficients, then we should + // increase the sufficients by one. + if self.solo_state.contains_key(&full_key( + b"EVM", + b"AccountCodes", + &blake2_128_concat_to_string(k), + )) && a.sufficients == 0 + { + a.sufficients += 1; + } + self.shell_state.insert_value( b"System", b"Account", From 5138fd08b2ac43005dcd021d24c9b1ec34a74d16 Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Thu, 22 Dec 2022 14:06:29 +0800 Subject: [PATCH 062/189] Fix type & code optimization (#154) * Fix type & code optimization * Use `u16` to bypass the https://github.com/polkadot-js/apps/issues/8591 --- pallet/deposit/src/lib.rs | 14 ++++++------ precompile/staking/Cargo.toml | 7 +++--- precompile/staking/src/lib.rs | 40 +++++++++++++++-------------------- 3 files changed, 29 insertions(+), 32 deletions(-) diff --git a/pallet/deposit/src/lib.rs b/pallet/deposit/src/lib.rs index 40c572213..5d17a611f 100644 --- a/pallet/deposit/src/lib.rs +++ b/pallet/deposit/src/lib.rs @@ -52,12 +52,6 @@ use frame_support::{ use frame_system::pallet_prelude::*; use sp_runtime::traits::AccountIdConversion; -/// Deposit identifier. -/// -/// It's not a global-unique identifier. -/// It's only used for distinguishing the deposits under a specific account. -pub type DepositId = u8; - /// Milliseconds per month. pub const MILLISECS_PER_MONTH: Moment = MILLISECS_PER_YEAR / 12; @@ -70,6 +64,14 @@ pub trait Minting { fn mint(beneficiary: &Self::AccountId, amount: Balance) -> DispatchResult; } +/// Deposit identifier. +/// +/// It's not a global-unique identifier. +/// It's only used for distinguishing the deposits under a specific account. +// https://github.com/polkadot-js/apps/issues/8591 +// pub type DepositId = u8; +pub type DepositId = u16; + /// Deposit. #[derive(PartialEq, Eq, Encode, Decode, MaxEncodedLen, TypeInfo, RuntimeDebug)] pub struct Deposit { diff --git a/precompile/staking/Cargo.toml b/precompile/staking/Cargo.toml index bec082f49..a20f3d0db 100644 --- a/precompile/staking/Cargo.toml +++ b/precompile/staking/Cargo.toml @@ -15,8 +15,7 @@ fp-evm = { default-features = false, git = "https://github.com/paritytech/fr pallet-evm = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } # darwinia -darwinia-staking = { default-features = false, path = "../../pallet/staking"} -darwinia-deposit = { default-features = false, path = "../../pallet/deposit"} +darwinia-staking = { default-features = false, path = "../../pallet/staking" } # moonbeam precompile-utils = { default-features = false, git = "https://github.com/darwinia-network/moonbeam.git", branch = "polkadot-v0.9.30" } @@ -33,6 +32,9 @@ sp-std = { default-features = false, git = "https://github.com/paritytech codec = { package = "parity-scale-codec", version = "3.2" } scale-info = { version = "2.3", features = ["derive"] } +# darwinia +darwinia-deposit = { path = "../../pallet/deposit" } + # moonbeam precompile-utils = { git = "https://github.com/darwinia-network/moonbeam.git", branch = "polkadot-v0.9.30", features = ["testing"] } @@ -52,7 +54,6 @@ std = [ # darwinia "darwinia-staking/std", - "darwinia-deposit/std", # moonbeam "precompile-utils/std", diff --git a/precompile/staking/src/lib.rs b/precompile/staking/src/lib.rs index 6319054f9..8476f4ea3 100644 --- a/precompile/staking/src/lib.rs +++ b/precompile/staking/src/lib.rs @@ -23,10 +23,9 @@ mod mock; #[cfg(test)] mod tests; -// std +// core use core::marker::PhantomData; // darwinia -use darwinia_deposit::DepositId; use darwinia_staking::Stake; // moonbeam use precompile_utils::prelude::*; @@ -39,34 +38,29 @@ use sp_core::{H160, U256}; use sp_runtime::Perbill; use sp_std::vec::Vec; -/// AccountId of the runtime. -type AccountIdOf = ::AccountId; - -/// DepositId of the runtime. -type DepositIdOf = <::Deposit as Stake>::Item; - pub struct Staking(PhantomData); #[precompile_utils::precompile] impl Staking where Runtime: darwinia_staking::Config + pallet_evm::Config, - Runtime::RuntimeCall: Dispatchable + GetDispatchInfo, - Runtime::RuntimeCall: From>, - <::RuntimeCall as Dispatchable>::RuntimeOrigin: OriginTrait, + Runtime::RuntimeCall: GetDispatchInfo + + Dispatchable + + From>, ::RuntimeOrigin: From>, - AccountIdOf: From, - DepositIdOf: From, + ::AccountId: From, + <::RuntimeCall as Dispatchable>::RuntimeOrigin: OriginTrait, + <::Deposit as Stake>::Item: From, { #[precompile::public("stake(uint256,uint256,uint8[])")] fn stake( handle: &mut impl PrecompileHandle, ring_amount: U256, kton_amount: U256, - deposits: Vec, + deposits: Vec, ) -> EvmResult { - let origin: AccountIdOf = handle.context().caller.into(); - let deposits: Vec> = deposits.into_iter().map(|i| i.into()).collect(); + let origin = handle.context().caller.into(); + let deposits = deposits.into_iter().map(|i| i.into()).collect(); RuntimeHelper::::try_dispatch( handle, @@ -85,10 +79,10 @@ where handle: &mut impl PrecompileHandle, ring_amount: U256, kton_amount: U256, - deposits: Vec, + deposits: Vec, ) -> EvmResult { - let origin: AccountIdOf = handle.context().caller.into(); - let deposits: Vec> = deposits.into_iter().map(|i| i.into()).collect(); + let origin = handle.context().caller.into(); + let deposits = deposits.into_iter().map(|i| i.into()).collect(); RuntimeHelper::::try_dispatch( handle, @@ -104,7 +98,7 @@ where #[precompile::public("claim()")] fn claim(handle: &mut impl PrecompileHandle) -> EvmResult { - let origin: AccountIdOf = handle.context().caller.into(); + let origin = handle.context().caller.into(); RuntimeHelper::::try_dispatch( handle, @@ -116,7 +110,7 @@ where #[precompile::public("collect(uint32)")] fn collect(handle: &mut impl PrecompileHandle, commission: u32) -> EvmResult { - let origin: AccountIdOf = handle.context().caller.into(); + let origin = handle.context().caller.into(); RuntimeHelper::::try_dispatch( handle, @@ -131,7 +125,7 @@ where #[precompile::public("nominate(address)")] fn nominate(handle: &mut impl PrecompileHandle, target: Address) -> EvmResult { let target: H160 = target.into(); - let origin: AccountIdOf = handle.context().caller.into(); + let origin = handle.context().caller.into(); RuntimeHelper::::try_dispatch( handle, @@ -143,7 +137,7 @@ where #[precompile::public("chill()")] fn chill(handle: &mut impl PrecompileHandle) -> EvmResult { - let origin: AccountIdOf = handle.context().caller.into(); + let origin = handle.context().caller.into(); RuntimeHelper::::try_dispatch( handle, From 49ff38cc1efefd1e76b3692eedff6cc4d89f9b7c Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Thu, 22 Dec 2022 17:09:19 +0800 Subject: [PATCH 063/189] Fix bonded prefix (#155) * Fix bonded prefix * Restore * Fix --- precompile/staking/src/lib.rs | 6 +++--- tool/state-processor/src/staking/mod.rs | 4 +++- tool/state-processor/src/type_registry.rs | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/precompile/staking/src/lib.rs b/precompile/staking/src/lib.rs index 8476f4ea3..6d70e1624 100644 --- a/precompile/staking/src/lib.rs +++ b/precompile/staking/src/lib.rs @@ -50,14 +50,14 @@ where ::RuntimeOrigin: From>, ::AccountId: From, <::RuntimeCall as Dispatchable>::RuntimeOrigin: OriginTrait, - <::Deposit as Stake>::Item: From, + <::Deposit as Stake>::Item: From, { #[precompile::public("stake(uint256,uint256,uint8[])")] fn stake( handle: &mut impl PrecompileHandle, ring_amount: U256, kton_amount: U256, - deposits: Vec, + deposits: Vec, ) -> EvmResult { let origin = handle.context().caller.into(); let deposits = deposits.into_iter().map(|i| i.into()).collect(); @@ -79,7 +79,7 @@ where handle: &mut impl PrecompileHandle, ring_amount: U256, kton_amount: U256, - deposits: Vec, + deposits: Vec, ) -> EvmResult { let origin = handle.context().caller.into(); let deposits = deposits.into_iter().map(|i| i.into()).collect(); diff --git a/tool/state-processor/src/staking/mod.rs b/tool/state-processor/src/staking/mod.rs index 672e1983f..bf2a09968 100644 --- a/tool/state-processor/src/staking/mod.rs +++ b/tool/state-processor/src/staking/mod.rs @@ -15,7 +15,9 @@ impl Processor { log::info!("take solo `Staking::Bonded`, `Staking::Ledger`, `Staking::RingPool`, `Staking::KtonPool` and `Staking::LivingTime`"); self.solo_state - .take_raw_map(&item_key(b"Staking", b"Bonded"), &mut bonded, get_identity_key) + .take_raw_map(&item_key(b"Staking", b"Bonded"), &mut bonded, |key, from| { + replace_first_match(key, from, &item_key(b"AccountMigration", b"Bonded")) + }) .take_map(b"Staking", b"Ledger", &mut ledgers, get_identity_key) .take_value(b"Staking", b"RingPool", "", &mut ring_pool_storage) .take_value(b"Staking", b"KtonPool", "", &mut kton_pool_storage) diff --git a/tool/state-processor/src/type_registry.rs b/tool/state-processor/src/type_registry.rs index ef2170053..9f0b7b6ee 100644 --- a/tool/state-processor/src/type_registry.rs +++ b/tool/state-processor/src/type_registry.rs @@ -91,8 +91,8 @@ pub struct Unbonding { pub struct Ledger { pub staked_ring: u128, pub staked_kton: u128, - pub staked_deposits: Vec, + pub staked_deposits: Vec, pub unstaking_ring: Vec<(u128, u32)>, pub unstaking_kton: Vec<(u128, u32)>, - pub unstaking_deposits: Vec<(u8, u32)>, + pub unstaking_deposits: Vec<(u16, u32)>, } From 56164de21e61f991f348acffa4be43e43089c5e8 Mon Sep 17 00:00:00 2001 From: bear Date: Thu, 22 Dec 2022 17:16:42 +0800 Subject: [PATCH 064/189] Update type (#156) --- tool/state-processor/src/type_registry.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tool/state-processor/src/type_registry.rs b/tool/state-processor/src/type_registry.rs index 9f0b7b6ee..1f82c7d1d 100644 --- a/tool/state-processor/src/type_registry.rs +++ b/tool/state-processor/src/type_registry.rs @@ -47,7 +47,7 @@ pub struct VestingInfo { #[derive(Default, Debug, Encode, Decode)] pub struct Deposit { - pub id: u8, + pub id: u16, pub value: u128, pub expired_time: u128, pub in_use: bool, From e775dcd406bdb38b1e41afa67f27552db619ef1d Mon Sep 17 00:00:00 2001 From: bear Date: Fri, 23 Dec 2022 10:19:55 +0800 Subject: [PATCH 065/189] Kton state migrate (#137) * Step 1 * Step 2 * Step 3 * Step 4 * Finish processor side * Add runtime side * Add metadata insert * Fix approvals inc * Fresh new details * Use Vec * Adapt new way * Code clean * Remove `sp-core` * Fix todo and review * Fix link and format --- Cargo.lock | 1 + pallet/account-migration/Cargo.toml | 2 + pallet/account-migration/src/lib.rs | 60 +++++++++++++- tool/state-processor/Cargo.lock | 57 +++++++++++++ tool/state-processor/Cargo.toml | 1 + tool/state-processor/src/system/README.md | 13 +-- tool/state-processor/src/system/mod.rs | 99 +++++++++++++++++++++-- tool/state-processor/src/type_registry.rs | 60 ++++++++++++++ 8 files changed, 281 insertions(+), 12 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d10cd2db0..8577fbe39 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2309,6 +2309,7 @@ dependencies = [ "dc-primitives", "frame-support", "frame-system", + "pallet-assets", "pallet-balances", "pallet-vesting", "parity-scale-codec", diff --git a/pallet/account-migration/Cargo.toml b/pallet/account-migration/Cargo.toml index ce1ea7764..a993aa93c 100644 --- a/pallet/account-migration/Cargo.toml +++ b/pallet/account-migration/Cargo.toml @@ -22,6 +22,7 @@ dc-primitives = { default-features = false, path = "../../core/primitives" } # substrate frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-assets = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } pallet-balances = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } pallet-vesting = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } @@ -47,6 +48,7 @@ std = [ # paritytech "frame-support/std", "frame-system/std", + "pallet-assets/std", "pallet-balances/std", "pallet-vesting/std", "sp-core/std", diff --git a/pallet/account-migration/src/lib.rs b/pallet/account-migration/src/lib.rs index 9a297e8e5..3e641e893 100644 --- a/pallet/account-migration/src/lib.rs +++ b/pallet/account-migration/src/lib.rs @@ -54,11 +54,13 @@ use darwinia_staking::Ledger; use dc_primitives::{AccountId as AccountId20, Balance, BlockNumber, Index}; // substrate use frame_support::{ - log, + log, migration, pallet_prelude::*, traits::{Currency, ExistenceRequirement::KeepAlive, LockableCurrency, WithdrawReasons}, + StorageHasher, }; use frame_system::{pallet_prelude::*, AccountInfo}; +use pallet_assets::AssetAccount; use pallet_balances::AccountData; use pallet_vesting::VestingInfo; use sp_core::sr25519::{Public, Signature}; @@ -118,6 +120,14 @@ pub mod pallet { pub type Accounts = StorageMap<_, Blake2_128Concat, AccountId32, AccountInfo>>; + /// [`pallet_asset::AssetAccount`] data. + /// + /// https://github.dev/paritytech/substrate/blob/polkadot-v0.9.30/frame/assets/src/types.rs#L115 + #[pallet::storage] + #[pallet::getter(fn kton_account_of)] + pub type KtonAccounts = + StorageMap<_, Blake2_128Concat, AccountId32, AssetAccount>; + /// [`pallet_vesting::Vesting`] data. /// /// @@ -203,6 +213,54 @@ pub mod pallet { >::insert(to, l); } + if let Some(a) = KtonAccounts::::take(&from) { + frame_system::Pallet::::inc_sufficients(&to); + + migration::put_storage_value( + b"Assets", + b"Account", + &[ + Blake2_128Concat::hash(&1026u64.encode()), + Blake2_128Concat::hash(&to.encode()), + ] + .concat(), + a.encode(), + ); + // The upstream structure cannot be accessed due to permission restrictions. + #[derive(Debug, Encode, Decode)] + pub struct AssetDetails { + pub owner: AccountId20, + pub issuer: AccountId20, + pub admin: AccountId20, + pub freezer: AccountId20, + pub supply: u128, + pub deposit: u128, + pub min_balance: u128, + pub is_sufficient: bool, + pub accounts: u32, + pub sufficients: u32, + pub approvals: u32, + pub is_frozen: bool, + } + + if let Some(mut asset_details) = migration::get_storage_value::( + b"Assets", + b"Asset", + &Blake2_128Concat::hash(&1026u64.encode()), + ) { + asset_details.accounts += 1; + asset_details.sufficients += 1; + + // Fresh to new details + migration::put_storage_value( + b"Assets", + b"Asset", + &Blake2_128Concat::hash(&1026u64.encode()), + asset_details.encode(), + ); + } + } + Self::deposit_event(Event::Migrated { from, to }); Ok(()) diff --git a/tool/state-processor/Cargo.lock b/tool/state-processor/Cargo.lock index c2153177b..36390ca6f 100644 --- a/tool/state-processor/Cargo.lock +++ b/tool/state-processor/Cargo.lock @@ -152,6 +152,18 @@ dependencies = [ "termcolor", ] +[[package]] +name = "fixed-hash" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "835c052cb0c08c1acf6ffd71c022172e18723949c8282f2b9f27efbc51e64534" +dependencies = [ + "byteorder", + "rand", + "rustc-hex", + "static_assertions", +] + [[package]] name = "funty" version = "2.0.0" @@ -197,6 +209,12 @@ dependencies = [ "libc", ] +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + [[package]] name = "humantime" version = "1.3.0" @@ -206,6 +224,15 @@ dependencies = [ "quick-error", ] +[[package]] +name = "impl-codec" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba6a270039626615617f3f36d15fc827041df3b78c439da2cadfa47455a77f2f" +dependencies = [ + "parity-scale-codec", +] + [[package]] name = "impl-trait-for-tuples" version = "0.2.2" @@ -298,6 +325,17 @@ dependencies = [ "log", ] +[[package]] +name = "primitive-types" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f3486ccba82358b11a77516035647c34ba167dfa53312630de83b12bd4f3d66" +dependencies = [ + "fixed-hash", + "impl-codec", + "uint", +] + [[package]] name = "proc-macro-crate" version = "1.2.1" @@ -386,6 +424,12 @@ version = "0.6.28" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" +[[package]] +name = "rustc-hex" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" + [[package]] name = "ryu" version = "1.0.11" @@ -445,6 +489,7 @@ dependencies = [ "once_cell", "parity-scale-codec", "pretty_env_logger", + "primitive-types", "serde", "serde_json", "subhasher", @@ -570,6 +615,18 @@ version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" +[[package]] +name = "uint" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76f64bba2c53b04fcab63c01a7d7427eadc821e3bc48c34dc9ba29c501164b52" +dependencies = [ + "byteorder", + "crunchy", + "hex", + "static_assertions", +] + [[package]] name = "unicode-ident" version = "1.0.5" diff --git a/tool/state-processor/Cargo.toml b/tool/state-processor/Cargo.toml index 02e52387d..b12f4dcbe 100644 --- a/tool/state-processor/Cargo.toml +++ b/tool/state-processor/Cargo.toml @@ -13,6 +13,7 @@ log = { version = "0.4" } once_cell = { version = "1.16" } parity-scale-codec = { version = "3.2", features = ["derive"] } pretty_env_logger = { version = "0.4" } +primitive-types = { version = "0.12.1", features = ["codec"] } serde = { version = "1.0" } serde_json = { version = "1.0" } diff --git a/tool/state-processor/src/system/README.md b/tool/state-processor/src/system/README.md index af67521d6..52423c5c3 100644 --- a/tool/state-processor/src/system/README.md +++ b/tool/state-processor/src/system/README.md @@ -19,16 +19,19 @@ - remove para backing account - TODO - check remaining sum - TODO - XCM relate - TODO -- set KTON total issuances - TODO - - compare the calculated one with the storage one - - check remaining sum - TODO +- create KTON asset details - set accounts - if is EVM address + - insert to `Assets::Account` and `Assets::Approvals`(update kton asset details) - insert to `System::Account` - if is Substrate address - reset the nonce - - insert to `AccountMigration::Accounts` - - calculate misc frozen and fee frozen + - insert to `AccountMigration::KtonAccounts` + - insert to `AccountMigration::Accounts`\ +- set KTON total issuances + - compare the calculated one with the storage one + - check remaining sum - TODO +- set `Assets::Metadata` - some remaining accounts, bridge endpoint accounts - TODO - special accounts - TODO diff --git a/tool/state-processor/src/system/mod.rs b/tool/state-processor/src/system/mod.rs index 047917bbe..4441b2bff 100644 --- a/tool/state-processor/src/system/mod.rs +++ b/tool/state-processor/src/system/mod.rs @@ -1,5 +1,6 @@ // darwinia use crate::*; +use subhasher::blake2_128_concat; #[derive(Debug)] pub struct AccountAll { @@ -87,14 +88,24 @@ impl Processor { log::info!("set `Balances::TotalIssuance`"); self.shell_state.insert_value(b"Balances", b"TotalIssuance", "", ring_total_issuance); - log::info!("`kton_total_issuance({kton_total_issuance})`"); - log::info!("`kton_total_issuance_storage({kton_total_issuance_storage})`"); + let mut kton_details = AssetDetails { + owner: ROOT, + issuer: ROOT, + admin: ROOT, + freezer: ROOT, + supply: kton_total_issuance, + deposit: 0, + min_balance: 1, // The same as the value in the runtime. + is_sufficient: true, // The same as the value in the runtime. + sufficients: 0, + accounts: 0, + approvals: 0, + is_frozen: false, + }; - // TODO: set KTON total issuance - - log::info!("update ring misc frozen and fee frozen"); log::info!("set `System::Account`"); log::info!("set `Balances::Locks`"); + log::info!("set `Assets::Account` and `Assets::Approvals`"); accounts.into_iter().for_each(|(k, v)| { let key = get_last_64(&k); let mut a = AccountInfo { @@ -122,20 +133,96 @@ impl Processor { a.sufficients += 1; } + if v.kton != 0 || v.kton_reserved != 0 { + let aa = AssetAccount { + balance: v.kton, + is_frozen: false, + reason: ExistenceReason::Sufficient, + extra: (), + }; + + a.sufficients += 1; + kton_details.accounts += 1; + kton_details.sufficients += 1; + // Note: this is double map structure in the pallet-assets. + self.shell_state.insert_value( + b"Assets", + b"Account", + &format!( + "{}{}", + array_bytes::bytes2hex("", blake2_128_concat(&KTON_ID.encode())), + array_bytes::bytes2hex("", blake2_128_concat(&k.encode())), + ), + &aa, + ); + + // https://github.dev/darwinia-network/darwinia-common/blob/6a9392cfb9fe2c99b1c2b47d0c36125d61991bb7/frame/dvm/evm/precompiles/kton/src/lib.rs#L72 + let mut approves = Map::::default(); + self.solo_state.take_map( + b"KtonERC20", + b"Approves", + &mut approves, + get_hashed_key, + ); + approves.iter().for_each(|(k, v)| { + kton_details.approvals += 1; + self.shell_state.insert_value( + b"Assets", + b"Approvals", + &k, + Approval { amount: v.as_u128(), deposit: 0 }, + ); + }); + } + self.shell_state.insert_value( b"System", b"Account", &blake2_128_concat_to_string(k), a, ); - // TODO: migrate kton balances. } else { a.nonce = 0; + if v.kton != 0 || v.kton_reserved != 0 { + let aa = AssetAccount { + balance: v.kton, + is_frozen: false, + reason: ExistenceReason::Sufficient, + extra: (), + }; + + self.shell_state.insert_value(b"AccountMigration", b"KtonAccounts", &k, &aa); + } + self.shell_state.insert_value(b"AccountMigration", b"Accounts", &k, a); } }); + log::info!("set `Assets::Asset`"); + log::info!("kton_total_issuance({kton_total_issuance})"); + log::info!("kton_total_issuance_storage({kton_total_issuance_storage})"); + self.shell_state.insert_value( + b"Assets", + b"Asset", + &array_bytes::bytes2hex("", blake2_128_concat(&KTON_ID.encode())), + kton_details, + ); + + log::info!("set `Assets::Metadata`"); + self.shell_state.insert_value( + b"Assets", + b"Metadata", + &array_bytes::bytes2hex("", blake2_128_concat(&KTON_ID.encode())), + AssetMetadata { + deposit: 0, + name: b"Darwinia Commitment Token".to_vec(), + symbol: b"KTON".to_vec(), + decimals: 18, + is_frozen: false, + }, + ); + self } diff --git a/tool/state-processor/src/type_registry.rs b/tool/state-processor/src/type_registry.rs index 1f82c7d1d..dd2abf298 100644 --- a/tool/state-processor/src/type_registry.rs +++ b/tool/state-processor/src/type_registry.rs @@ -2,6 +2,9 @@ use parity_scale_codec::{Decode, Encode}; pub const GWEI: u128 = 1_000_000_000; +pub const KTON_ID: u64 = 1026; +// https://github.dev/darwinia-network/darwinia-2.0/blob/c9fdfa170501648102bd0137c0437e367e743770/runtime/common/src/gov_origin.rs#L46 +pub const ROOT: [u8; 20] = [0x72, 0x6f, 0x6f, 0x74, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; #[derive(Default, Debug, Encode, Decode)] pub struct AccountInfo { @@ -25,6 +28,7 @@ pub struct BalanceLock { pub amount: u128, pub reasons: Reasons, } + #[allow(clippy::unnecessary_cast)] #[derive(Debug, PartialEq, Eq, Encode, Decode)] pub enum Reasons { @@ -96,3 +100,59 @@ pub struct Ledger { pub unstaking_kton: Vec<(u128, u32)>, pub unstaking_deposits: Vec<(u16, u32)>, } + +// https://github.dev/paritytech/substrate/blob/polkadot-v0.9.30/frame/assets/src/types.rs#L33 +#[derive(Debug, Encode, Decode)] +pub struct AssetDetails { + pub owner: [u8; 20], + pub issuer: [u8; 20], + pub admin: [u8; 20], + pub freezer: [u8; 20], + pub supply: u128, + pub deposit: u128, + pub min_balance: u128, + pub is_sufficient: bool, + pub accounts: u32, + pub sufficients: u32, + pub approvals: u32, + pub is_frozen: bool, +} + +// https://github.dev/paritytech/substrate/blob/polkadot-v0.9.30/frame/assets/src/types.rs#L115 +#[derive(Debug, Encode, Decode)] +pub struct AssetAccount { + pub balance: u128, + pub is_frozen: bool, + pub reason: ExistenceReason, + pub extra: (), +} + +// https://github.dev/paritytech/substrate/blob/polkadot-v0.9.30/frame/assets/src/types.rs#L88 +#[derive(Debug, Encode, Decode)] +pub enum ExistenceReason { + #[codec(index = 0)] + Consumer, + #[codec(index = 1)] + Sufficient, + #[codec(index = 2)] + DepositHeld(u128), + #[codec(index = 3)] + DepositRefunded, +} + +// https://github.dev/paritytech/substrate/blob/polkadot-v0.9.30/frame/assets/src/types.rs#L73 +#[derive(Debug, Encode, Decode)] +pub struct Approval { + pub amount: u128, + pub deposit: u128, +} + +// https://github.dev/paritytech/substrate/blob/polkadot-v0.9.30/frame/assets/src/types.rs#L127 +#[derive(Clone, Encode, Decode)] +pub struct AssetMetadata { + pub deposit: u128, + pub name: Vec, + pub symbol: Vec, + pub decimals: u8, + pub is_frozen: bool, +} From 5c1e385f5fed9df071cccafd35ae9b9b38c82b7a Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Sun, 25 Dec 2022 23:20:25 +0800 Subject: [PATCH 066/189] Cross compile support (#159) --- .maintain/docker/ubuntu-latest | 3 +++ Cross.toml | 8 ++++++++ 2 files changed, 11 insertions(+) create mode 100644 .maintain/docker/ubuntu-latest create mode 100644 Cross.toml diff --git a/.maintain/docker/ubuntu-latest b/.maintain/docker/ubuntu-latest new file mode 100644 index 000000000..f918d3bdc --- /dev/null +++ b/.maintain/docker/ubuntu-latest @@ -0,0 +1,3 @@ +FROM ubuntu:latest + +RUN apt-get -y update && apt-get -y install clang gcc g++ llvm make git protobuf-compiler diff --git a/Cross.toml b/Cross.toml new file mode 100644 index 000000000..8688ec6ce --- /dev/null +++ b/Cross.toml @@ -0,0 +1,8 @@ +[build] +default-target = "x86_64-unknown-linux-gnu" + + [build.env] + passthrough = ["WASM_BUILD_WORKSPACE_HINT"] + +[target.x86_64-unknown-linux-gnu] +image = "ubuntu-latest" From 5c4a9c0e3eb53a558fb7ae8d112717f7dc88cd1c Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Mon, 26 Dec 2022 19:06:23 +0800 Subject: [PATCH 067/189] Improve deposit (#160) * Improve deposit * Test more cases * Fix tests --- pallet/deposit/src/lib.rs | 112 +++++++++++++++++++----- pallet/deposit/tests/mock.rs | 17 +++- pallet/deposit/tests/tests.rs | 53 ++++++++++- pallet/staking/src/lib.rs | 8 +- pallet/staking/tests/mock.rs | 17 +++- precompile/deposit/src/mock.rs | 10 ++- precompile/staking/src/mock.rs | 10 ++- runtime/crab/src/pallets/deposit.rs | 14 ++- runtime/darwinia/src/pallets/deposit.rs | 18 +++- runtime/pangolin/src/pallets/deposit.rs | 14 ++- 10 files changed, 228 insertions(+), 45 deletions(-) diff --git a/pallet/deposit/src/lib.rs b/pallet/deposit/src/lib.rs index 5d17a611f..02de5689d 100644 --- a/pallet/deposit/src/lib.rs +++ b/pallet/deposit/src/lib.rs @@ -55,13 +55,16 @@ use sp_runtime::traits::AccountIdConversion; /// Milliseconds per month. pub const MILLISECS_PER_MONTH: Moment = MILLISECS_PER_YEAR / 12; -/// Asset's minting API. -pub trait Minting { +/// Simple asset APIs. +pub trait SimpleAsset { /// Account type. type AccountId; /// Mint API. fn mint(beneficiary: &Self::AccountId, amount: Balance) -> DispatchResult; + + /// Burn API. + fn burn(who: &Self::AccountId, amount: Balance) -> DispatchResult; } /// Deposit identifier. @@ -79,6 +82,8 @@ pub struct Deposit { pub id: DepositId, /// Deposited RING. pub value: Balance, + /// Start timestamp. + pub start_time: Moment, /// Expired timestamp. pub expired_time: Moment, /// Deposit state. @@ -102,7 +107,7 @@ pub mod pallet { type Ring: Currency; /// KTON asset. - type Kton: Minting; + type Kton: SimpleAsset; /// Minimum amount to lock at least. #[pallet::constant] @@ -115,10 +120,28 @@ pub mod pallet { type MaxDeposits: Get; } + #[allow(missing_docs)] #[pallet::event] - // TODO: event? - // #[pallet::generate_deposit(pub(super) fn deposit_event)] - pub enum Event {} + #[pallet::generate_deposit(pub(super) fn deposit_event)] + pub enum Event { + /// A new deposit has been created. + DepositCreated { + owner: T::AccountId, + deposit_id: DepositId, + value: Balance, + start_time: Moment, + expired_time: Moment, + kton_reward: Balance, + }, + /// An expired deposit has been claimed. + DepositClaimed { owner: T::AccountId, deposit_id: DepositId }, + /// An unexpired deposit has been claimed by paying the KTON penalty. + DepositClaimedWithPenalty { + owner: T::AccountId, + deposit_id: DepositId, + kton_penalty: Balance, + }, + } #[pallet::error] pub enum Error { @@ -136,6 +159,8 @@ pub mod pallet { DepositInUse, /// Deposit is not in use. DepositNotInUse, + /// Deposit is already expired. + DepositAlreadyExpired, } /// All deposits. @@ -169,7 +194,7 @@ pub mod pallet { Err(>::ExceedMaxDeposits)?; } - >::try_mutate(&who, |ds| { + let (deposit_id, start_time, expired_time) = >::try_mutate(&who, |ds| { let ds = if let Some(ds) = ds { ds } else { @@ -190,25 +215,32 @@ pub mod pallet { Continue(c) => c, Break(b) => b, }; + let start_time = T::UnixTime::now().as_millis(); + let expired_time = start_time + MILLISECS_PER_MONTH * months as Moment; ds.try_insert( id as _, - Deposit { - id, - value: amount, - expired_time: T::UnixTime::now().as_millis() - + MILLISECS_PER_MONTH * months as Moment, - in_use: false, - }, + Deposit { id, value: amount, start_time, expired_time, in_use: false }, ) .map_err(|_| >::ExceedMaxDeposits)?; - DispatchResult::Ok(()) + >::Ok((id, start_time, expired_time)) })?; + T::Ring::transfer(&who, &account_id(), amount, KeepAlive)?; - T::Kton::mint(&who, dc_inflation::deposit_interest(amount, months))?; - // TODO: event? + let kton_reward = dc_inflation::deposit_interest(amount, months); + + T::Kton::mint(&who, kton_reward)?; + + Self::deposit_event(Event::DepositCreated { + owner: who, + deposit_id, + value: amount, + start_time, + expired_time, + kton_reward, + }); Ok(()) } @@ -226,6 +258,11 @@ pub mod pallet { if d.expired_time <= now && !d.in_use { claimed += d.value; + Self::deposit_event(Event::DepositClaimed { + owner: who.clone(), + deposit_id: d.id, + }); + false } else { true @@ -243,12 +280,47 @@ pub mod pallet { T::Ring::transfer(&account_id(), &who, claimed, AllowDeath)?; - // TODO: event? - Ok(()) } - // TODO: claim_with_penalty + /// Claim the unexpired-locked RING by paying the KTON penalty. + #[pallet::weight(0)] + pub fn claim_with_penalty(origin: OriginFor, id: DepositId) -> DispatchResult { + let who = ensure_signed(origin)?; + let d = >::try_mutate(&who, |maybe_ds| { + let ds = maybe_ds.as_mut().ok_or(>::DepositNotFound)?; + let d = ds + .remove(ds.iter().position(|d| d.id == id).ok_or(>::DepositNotFound)?); + + if ds.is_empty() { + >::dec_consumers(&who); + + *maybe_ds = None; + } + + >::Ok(d) + })?; + let now = T::UnixTime::now().as_millis(); + + if d.expired_time <= now { + Err(>::DepositAlreadyExpired)?; + } + + let promise_m = (d.expired_time - d.start_time) / MILLISECS_PER_MONTH; + let elapsed_m = (now - d.start_time) / MILLISECS_PER_MONTH; + let kton_penalty = dc_inflation::deposit_interest(d.value, promise_m as _) + .saturating_sub(dc_inflation::deposit_interest(d.value, elapsed_m as _)) + .max(1) * 3; + + T::Kton::burn(&who, kton_penalty)?; + Self::deposit_event(Event::DepositClaimedWithPenalty { + owner: who, + deposit_id: id, + kton_penalty, + }); + + Ok(()) + } } } pub use pallet::*; diff --git a/pallet/deposit/tests/mock.rs b/pallet/deposit/tests/mock.rs index 6e5675cad..06d3a808d 100644 --- a/pallet/deposit/tests/mock.rs +++ b/pallet/deposit/tests/mock.rs @@ -82,16 +82,27 @@ impl pallet_assets::Config for Runtime { type WeightInfo = (); } -pub enum KtonMinting {} -impl darwinia_deposit::Minting for KtonMinting { +pub enum KtonAsset {} +impl darwinia_deposit::SimpleAsset for KtonAsset { type AccountId = u32; fn mint(beneficiary: &Self::AccountId, amount: Balance) -> sp_runtime::DispatchResult { Assets::mint(RuntimeOrigin::signed(0), 0, *beneficiary, amount) } + + fn burn( + who: &Self::AccountId, + amount: Balance, + ) -> sp_runtime::DispatchResult { + if Assets::balance(0, who) < amount { + Err(>::BalanceLow)?; + } + + Assets::burn(RuntimeOrigin::signed(0), 0, *who, amount) + } } impl darwinia_deposit::Config for Runtime { - type Kton = KtonMinting; + type Kton = KtonAsset; type MaxDeposits = frame_support::traits::ConstU32<16>; type MinLockingAmount = frame_support::traits::ConstU128; type Ring = Balances; diff --git a/pallet/deposit/tests/tests.rs b/pallet/deposit/tests/tests.rs index f7ceba134..3b46999b6 100644 --- a/pallet/deposit/tests/tests.rs +++ b/pallet/deposit/tests/tests.rs @@ -64,28 +64,38 @@ fn unique_identity_should_work() { assert_eq!( Deposit::deposit_of(&1).unwrap().as_slice(), &[ - DepositS { id: 0, value: UNIT, expired_time: MILLISECS_PER_MONTH, in_use: false }, + DepositS { + id: 0, + value: UNIT, + start_time: 0, + expired_time: MILLISECS_PER_MONTH, + in_use: false + }, DepositS { id: 1, value: 2 * UNIT, + start_time: 0, expired_time: 2 * MILLISECS_PER_MONTH, in_use: false }, DepositS { id: 2, value: 3 * UNIT, + start_time: 0, expired_time: MILLISECS_PER_MONTH, in_use: false }, DepositS { id: 3, value: 4 * UNIT, + start_time: 0, expired_time: 2 * MILLISECS_PER_MONTH, in_use: false }, DepositS { id: 4, value: 5 * UNIT, + start_time: 0, expired_time: MILLISECS_PER_MONTH, in_use: false } @@ -102,18 +112,21 @@ fn unique_identity_should_work() { DepositS { id: 0, value: 6 * UNIT, + start_time: MILLISECS_PER_MONTH, expired_time: 2 * MILLISECS_PER_MONTH, in_use: false }, DepositS { id: 1, value: 2 * UNIT, + start_time: 0, expired_time: 2 * MILLISECS_PER_MONTH, in_use: false }, DepositS { id: 3, value: 4 * UNIT, + start_time: 0, expired_time: 2 * MILLISECS_PER_MONTH, in_use: false }, @@ -127,24 +140,28 @@ fn unique_identity_should_work() { DepositS { id: 0, value: 6 * UNIT, + start_time: MILLISECS_PER_MONTH, expired_time: 2 * MILLISECS_PER_MONTH, in_use: false }, DepositS { id: 1, value: 2 * UNIT, + start_time: 0, expired_time: 2 * MILLISECS_PER_MONTH, in_use: false }, DepositS { id: 2, value: 7 * UNIT, + start_time: MILLISECS_PER_MONTH, expired_time: 2 * MILLISECS_PER_MONTH, in_use: false }, DepositS { id: 3, value: 4 * UNIT, + start_time: 0, expired_time: 2 * MILLISECS_PER_MONTH, in_use: false }, @@ -158,30 +175,35 @@ fn unique_identity_should_work() { DepositS { id: 0, value: 6 * UNIT, + start_time: MILLISECS_PER_MONTH, expired_time: 2 * MILLISECS_PER_MONTH, in_use: false }, DepositS { id: 1, value: 2 * UNIT, + start_time: 0, expired_time: 2 * MILLISECS_PER_MONTH, in_use: false }, DepositS { id: 2, value: 7 * UNIT, + start_time: MILLISECS_PER_MONTH, expired_time: 2 * MILLISECS_PER_MONTH, in_use: false }, DepositS { id: 3, value: 4 * UNIT, + start_time: 0, expired_time: 2 * MILLISECS_PER_MONTH, in_use: false }, DepositS { id: 4, value: 8 * UNIT, + start_time: MILLISECS_PER_MONTH, expired_time: 2 * MILLISECS_PER_MONTH, in_use: false }, @@ -203,6 +225,7 @@ fn expire_time_should_work() { .map(|i| DepositS { id: i - 1, value: UNIT, + start_time: (i - 1) as Moment * MILLISECS_PER_MONTH, expired_time: i as Moment * MILLISECS_PER_MONTH, in_use: false }) @@ -282,3 +305,31 @@ fn claim_should_work() { assert!(Deposit::deposit_of(&1).is_none()); }); } + +#[test] +fn claim_with_penalty_should_work() { + new_test_ext().execute_with(|| { + assert!(Deposit::deposit_of(&1).is_none()); + assert_ok!(Deposit::lock(RuntimeOrigin::signed(1), UNIT, 1)); + assert!(Deposit::deposit_of(&1).is_some()); + + assert_noop!( + Deposit::claim_with_penalty(RuntimeOrigin::signed(1), 0), + >::BalanceLow + ); + + assert_ok!(KtonAsset::mint(&1, UNIT)); + assert_ok!(Deposit::claim_with_penalty(RuntimeOrigin::signed(1), 0)); + assert_eq!(Assets::balance(0, 1), 999_984_771_573_604_062); + assert!(Deposit::deposit_of(&1).is_none()); + + assert_ok!(Deposit::lock(RuntimeOrigin::signed(1), UNIT, 1)); + efflux(MILLISECS_PER_MONTH); + assert!(Deposit::deposit_of(&1).is_some()); + + assert_noop!( + Deposit::claim_with_penalty(RuntimeOrigin::signed(1), 0), + >::DepositAlreadyExpired + ); + }); +} diff --git a/pallet/staking/src/lib.rs b/pallet/staking/src/lib.rs index dbfd80656..6912238c0 100644 --- a/pallet/staking/src/lib.rs +++ b/pallet/staking/src/lib.rs @@ -390,7 +390,7 @@ pub mod pallet { DispatchResult::Ok(()) })?; - Self::deposit_event(Event::::Staked { + Self::deposit_event(Event::Staked { staker: who, ring_amount, kton_amount, @@ -784,7 +784,7 @@ pub mod pallet { if let Ok(_i) = T::RingCurrency::deposit_into_existing(&c, c_commission_payout) { actual_payout += c_commission_payout; - Self::deposit_event(Event::::Payout { + Self::deposit_event(Event::Payout { staker: c, ring_amount: c_commission_payout, }); @@ -799,7 +799,7 @@ pub mod pallet { { actual_payout += n_payout; - Self::deposit_event(Event::::Payout { + Self::deposit_event(Event::Payout { staker: n_exposure.who, ring_amount: n_payout, }); @@ -893,7 +893,7 @@ where let collators = Self::elect(); - Self::deposit_event(Event::::Elected { collators: collators.clone() }); + Self::deposit_event(Event::Elected { collators: collators.clone() }); Some(collators) } diff --git a/pallet/staking/tests/mock.rs b/pallet/staking/tests/mock.rs index bfdc1c79b..8358b0e8a 100644 --- a/pallet/staking/tests/mock.rs +++ b/pallet/staking/tests/mock.rs @@ -97,16 +97,27 @@ impl frame_support::traits::UnixTime for Time { Time::get() } } -pub enum KtonMinting {} -impl darwinia_deposit::Minting for KtonMinting { +pub enum KtonAsset {} +impl darwinia_deposit::SimpleAsset for KtonAsset { type AccountId = u32; fn mint(beneficiary: &Self::AccountId, amount: Balance) -> sp_runtime::DispatchResult { Assets::mint(RuntimeOrigin::signed(0), 0, *beneficiary, amount) } + + fn burn( + who: &Self::AccountId, + amount: Balance, + ) -> sp_runtime::DispatchResult { + if Assets::balance(0, who) < amount { + Err(>::BalanceLow)?; + } + + Assets::burn(RuntimeOrigin::signed(0), 0, *who, amount) + } } impl darwinia_deposit::Config for Runtime { - type Kton = KtonMinting; + type Kton = KtonAsset; type MaxDeposits = frame_support::traits::ConstU32<16>; type MinLockingAmount = frame_support::traits::ConstU128; type Ring = Balances; diff --git a/precompile/deposit/src/mock.rs b/precompile/deposit/src/mock.rs index be699ad57..0761e5898 100644 --- a/precompile/deposit/src/mock.rs +++ b/precompile/deposit/src/mock.rs @@ -93,17 +93,21 @@ impl pallet_timestamp::Config for TestRuntime { type WeightInfo = (); } -pub enum KtonMinting {} -impl darwinia_deposit::Minting for KtonMinting { +pub enum KtonAsset {} +impl darwinia_deposit::SimpleAsset for KtonAsset { type AccountId = AccountId; fn mint(_beneficiary: &Self::AccountId, _amount: Balance) -> sp_runtime::DispatchResult { Ok(()) } + + fn burn(who: &Self::AccountId, amount: Balance) -> sp_runtime::DispatchResult { + Ok(()) + } } impl darwinia_deposit::Config for TestRuntime { - type Kton = KtonMinting; + type Kton = KtonAsset; type MaxDeposits = frame_support::traits::ConstU32<16>; type MinLockingAmount = frame_support::traits::ConstU128<100>; type Ring = Balances; diff --git a/precompile/staking/src/mock.rs b/precompile/staking/src/mock.rs index d7ad75908..10ebd68c7 100644 --- a/precompile/staking/src/mock.rs +++ b/precompile/staking/src/mock.rs @@ -95,17 +95,21 @@ impl pallet_timestamp::Config for TestRuntime { type WeightInfo = (); } -pub enum KtonMinting {} -impl darwinia_deposit::Minting for KtonMinting { +pub enum KtonAsset {} +impl darwinia_deposit::SimpleAsset for KtonAsset { type AccountId = AccountId; fn mint(_beneficiary: &Self::AccountId, _amount: Balance) -> sp_runtime::DispatchResult { Ok(()) } + + fn burn(who: &Self::AccountId, amount: Balance) -> sp_runtime::DispatchResult { + Ok(()) + } } impl darwinia_deposit::Config for TestRuntime { - type Kton = KtonMinting; + type Kton = KtonAsset; type MaxDeposits = frame_support::traits::ConstU32<16>; type MinLockingAmount = frame_support::traits::ConstU128<100>; type Ring = Balances; diff --git a/runtime/crab/src/pallets/deposit.rs b/runtime/crab/src/pallets/deposit.rs index 696b789e8..c0c7ab85f 100644 --- a/runtime/crab/src/pallets/deposit.rs +++ b/runtime/crab/src/pallets/deposit.rs @@ -20,11 +20,21 @@ use crate::*; pub enum CKtonMinting {} -impl darwinia_deposit::Minting for CKtonMinting { +impl darwinia_deposit::SimpleAsset for CKtonMinting { type AccountId = AccountId; fn mint(beneficiary: &Self::AccountId, amount: Balance) -> sp_runtime::DispatchResult { - Assets::mint(RuntimeOrigin::signed(ROOT), AssetIds::CKton as AssetId, *beneficiary, amount) + Assets::mint(RuntimeOrigin::signed(ROOT), AssetIds::CKton as _, *beneficiary, amount) + } + + fn burn(who: &Self::AccountId, amount: Balance) -> sp_runtime::DispatchResult { + let asset_id = AssetIds::CKton as _; + + if Assets::balance(asset_id, who) < amount { + Err(>::BalanceLow)?; + } + + Assets::burn(RuntimeOrigin::signed(ROOT), asset_id, *who, amount) } } diff --git a/runtime/darwinia/src/pallets/deposit.rs b/runtime/darwinia/src/pallets/deposit.rs index 4c46dd164..95904729c 100644 --- a/runtime/darwinia/src/pallets/deposit.rs +++ b/runtime/darwinia/src/pallets/deposit.rs @@ -19,17 +19,27 @@ // darwinia use crate::*; -pub enum KtonMinting {} -impl darwinia_deposit::Minting for KtonMinting { +pub enum KtonAsset {} +impl darwinia_deposit::SimpleAsset for KtonAsset { type AccountId = AccountId; fn mint(beneficiary: &Self::AccountId, amount: Balance) -> sp_runtime::DispatchResult { - Assets::mint(RuntimeOrigin::signed(ROOT), AssetIds::Kton as AssetId, *beneficiary, amount) + Assets::mint(RuntimeOrigin::signed(ROOT), AssetIds::Kton as _, *beneficiary, amount) + } + + fn burn(who: &Self::AccountId, amount: Balance) -> sp_runtime::DispatchResult { + let asset_id = AssetIds::Kton as _; + + if Assets::balance(asset_id, who) < amount { + Err(>::BalanceLow)?; + } + + Assets::burn(RuntimeOrigin::signed(ROOT), asset_id, *who, amount) } } impl darwinia_deposit::Config for Runtime { - type Kton = KtonMinting; + type Kton = KtonAsset; type MaxDeposits = frame_support::traits::ConstU32<16>; type MinLockingAmount = frame_support::traits::ConstU128; type Ring = Balances; diff --git a/runtime/pangolin/src/pallets/deposit.rs b/runtime/pangolin/src/pallets/deposit.rs index aacc925bd..5793f7187 100644 --- a/runtime/pangolin/src/pallets/deposit.rs +++ b/runtime/pangolin/src/pallets/deposit.rs @@ -20,11 +20,21 @@ use crate::*; pub enum PKtonMinting {} -impl darwinia_deposit::Minting for PKtonMinting { +impl darwinia_deposit::SimpleAsset for PKtonMinting { type AccountId = AccountId; fn mint(beneficiary: &Self::AccountId, amount: Balance) -> sp_runtime::DispatchResult { - Assets::mint(RuntimeOrigin::signed(ROOT), AssetIds::PKton as AssetId, *beneficiary, amount) + Assets::mint(RuntimeOrigin::signed(ROOT), AssetIds::PKton as _, *beneficiary, amount) + } + + fn burn(who: &Self::AccountId, amount: Balance) -> sp_runtime::DispatchResult { + let asset_id = AssetIds::PKton as _; + + if Assets::balance(asset_id, who) < amount { + Err(>::BalanceLow)?; + } + + Assets::burn(RuntimeOrigin::signed(ROOT), asset_id, *who, amount) } } From d8885cd4432ad40140e15a1ced4caf58ca5eb440 Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Tue, 27 Dec 2022 13:40:47 +0800 Subject: [PATCH 068/189] Some fixes (#162) --- .maintain/docker/ubuntu-latest | 3 - .maintain/docker/ubuntu:20.04 | 3 + Cargo.lock | 193 +++++++++++++++++---------------- Cross.toml | 2 +- precompile/deposit/src/mock.rs | 4 +- precompile/staking/src/mock.rs | 4 +- 6 files changed, 109 insertions(+), 100 deletions(-) delete mode 100644 .maintain/docker/ubuntu-latest create mode 100644 .maintain/docker/ubuntu:20.04 diff --git a/.maintain/docker/ubuntu-latest b/.maintain/docker/ubuntu-latest deleted file mode 100644 index f918d3bdc..000000000 --- a/.maintain/docker/ubuntu-latest +++ /dev/null @@ -1,3 +0,0 @@ -FROM ubuntu:latest - -RUN apt-get -y update && apt-get -y install clang gcc g++ llvm make git protobuf-compiler diff --git a/.maintain/docker/ubuntu:20.04 b/.maintain/docker/ubuntu:20.04 new file mode 100644 index 000000000..635567f3c --- /dev/null +++ b/.maintain/docker/ubuntu:20.04 @@ -0,0 +1,3 @@ +FROM ubuntu:20.04 + +RUN apt-get -y update && apt-get -y install clang gcc g++ llvm libssl-dev libudev-dev make git protobuf-compiler diff --git a/Cargo.lock b/Cargo.lock index 8577fbe39..8c5b6a8c3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -152,9 +152,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.66" +version = "1.0.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "216261ddc8289130e551ddcd5ce8a064710c0d064a4d2895c67151c92b5443f6" +checksum = "2cb2f989d18dd141ab8ae82f64d1a8cdd37e0840f73a406896cf5e99502fab61" [[package]] name = "approx" @@ -365,9 +365,9 @@ checksum = "7a40729d2133846d9ed0ea60a8b9541bccddab49cd30f0715a1da672fe9a2524" [[package]] name = "async-trait" -version = "0.1.59" +version = "0.1.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31e6e93155431f3931513b243d371981bb2770112b370c82745a1d19d2f99364" +checksum = "677d1d8ab452a3936018a687b20e6f7cf5363d713b732b8884001317b0e48aa3" dependencies = [ "proc-macro2", "quote", @@ -399,7 +399,7 @@ version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" dependencies = [ - "hermit-abi", + "hermit-abi 0.1.19", "libc", "winapi", ] @@ -630,9 +630,9 @@ dependencies = [ [[package]] name = "blake2" -version = "0.10.5" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b12e5fd123190ce1c2e559308a94c9bacad77907d4c6005d9e58fe1a0689e55e" +checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" dependencies = [ "digest 0.10.6", ] @@ -1011,7 +1011,7 @@ checksum = "4acbb09d9ee8e23699b9634375c72795d095bf268439da88562cf9b501f181fa" dependencies = [ "camino", "cargo-platform", - "semver 1.0.14", + "semver 1.0.16", "serde", "serde_json", ] @@ -2175,9 +2175,9 @@ dependencies = [ [[package]] name = "cxx" -version = "1.0.83" +version = "1.0.85" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdf07d07d6531bfcdbe9b8b739b104610c6508dcc4d63b410585faf338241daf" +checksum = "5add3fc1717409d029b20c5b6903fc0c0b02fa6741d820054f4a2efa5e5816fd" dependencies = [ "cc", "cxxbridge-flags", @@ -2187,9 +2187,9 @@ dependencies = [ [[package]] name = "cxx-build" -version = "1.0.83" +version = "1.0.85" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2eb5b96ecdc99f72657332953d4d9c50135af1bac34277801cc3937906ebd39" +checksum = "b4c87959ba14bc6fbc61df77c3fcfe180fc32b93538c4f1031dd802ccb5f2ff0" dependencies = [ "cc", "codespan-reporting", @@ -2202,15 +2202,15 @@ dependencies = [ [[package]] name = "cxxbridge-flags" -version = "1.0.83" +version = "1.0.85" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac040a39517fd1674e0f32177648334b0f4074625b5588a64519804ba0553b12" +checksum = "69a3e162fde4e594ed2b07d0f83c6c67b745e7f28ce58c6df5e6b6bef99dfb59" [[package]] name = "cxxbridge-macro" -version = "1.0.83" +version = "1.0.85" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1362b0ddcfc4eb0a1f57b68bd77dd99f0e826958a96abd0ae9bd092e114ffed6" +checksum = "3e7e2adeb6a0d4a282e581096b06e1791532b7d576dcde5ccd9382acf55db8e6" dependencies = [ "proc-macro2", "quote", @@ -2785,9 +2785,9 @@ checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" [[package]] name = "dtoa" -version = "1.0.4" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8a6eee2d5d0d113f015688310da018bd1d864d86bd567c8fca9c266889e1bfa" +checksum = "c00704156a7de8df8da0911424e30c2049957b0a714542a44e05fe693dd85313" [[package]] name = "dyn-clonable" @@ -2812,9 +2812,9 @@ dependencies = [ [[package]] name = "dyn-clone" -version = "1.0.9" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f94fa09c2aeea5b8839e414b7b841bf429fd25b9c522116ac97ee87856d88b2" +checksum = "c9b0705efd4599c15a38151f4721f7bc388306f61084d3bfd50bd07fbca5cb60" [[package]] name = "ecdsa" @@ -2929,9 +2929,9 @@ dependencies = [ [[package]] name = "enumn" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "038b1afa59052df211f9efd58f8b1d84c242935ede1c3dbaed26b018a9e06ae2" +checksum = "e88bcb3a067a6555d577aba299e75eff9942da276e6506fc6274327daa026132" dependencies = [ "proc-macro2", "quote", @@ -4088,9 +4088,9 @@ dependencies = [ [[package]] name = "handlebars" -version = "4.3.5" +version = "4.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "433e4ab33f1213cdc25b5fa45c76881240cfe79284cf2b395e8b9e312a30a2fd" +checksum = "035ef95d03713f2c347a72547b7cd38cbc9af7cd51e6099fb62d586d4a6dee3a" dependencies = [ "log", "pest", @@ -4139,6 +4139,15 @@ dependencies = [ "libc", ] +[[package]] +name = "hermit-abi" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" +dependencies = [ + "libc", +] + [[package]] name = "hex" version = "0.4.3" @@ -4493,9 +4502,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.4" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4217ad341ebadf8d8e724e264f13e593e0648f5b3e94b3896a5df283be015ecc" +checksum = "fad582f4b9e86b6caa621cabeb0963332d92eea04729ab12892c2533951e6440" [[package]] name = "jobserver" @@ -4851,9 +4860,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.138" +version = "0.2.139" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db6d7e329c562c5dfab7a46a2afabc8b987ab9a4834c9d1ca04dc54c1546cef8" +checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79" [[package]] name = "libloading" @@ -5545,9 +5554,9 @@ dependencies = [ [[package]] name = "link-cplusplus" -version = "1.0.7" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9272ab7b96c9046fbc5bc56c06c117cb639fe2d509df0c421cad82d2915cf369" +checksum = "ecd207c9c713c34f95a097a5b029ac2ce6010530c7b49d7fea24d977dede04f5" dependencies = [ "cc", ] @@ -6158,11 +6167,11 @@ dependencies = [ [[package]] name = "num_cpus" -version = "1.14.0" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6058e64324c71e02bc2b150e4f3bc8286db6c83092132ffa3f6b1eab0f9def5" +checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b" dependencies = [ - "hermit-abi", + "hermit-abi 0.2.6", "libc", ] @@ -7685,9 +7694,9 @@ dependencies = [ [[package]] name = "paste" -version = "1.0.10" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf1c2c742266c2f1041c914ba65355a83ae8747b05f208319784083583494b4b" +checksum = "d01a5bd0424d00070b0098dd17ebca6f961a959dead1dbcbbbc1d1cd8d3deeba" [[package]] name = "pbkdf2" @@ -7721,9 +7730,9 @@ checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" [[package]] name = "pest" -version = "2.5.1" +version = "2.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc8bed3549e0f9b0a2a78bf7c0018237a2cdf085eecbbc048e52612438e4e9d0" +checksum = "0f6e86fb9e7026527a0d46bc308b841d73170ef8f443e1807f6ef88526a816d4" dependencies = [ "thiserror", "ucd-trie", @@ -7731,9 +7740,9 @@ dependencies = [ [[package]] name = "pest_derive" -version = "2.5.1" +version = "2.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdc078600d06ff90d4ed238f0119d84ab5d43dbaad278b0e33a8820293b32344" +checksum = "96504449aa860c8dcde14f9fba5c58dc6658688ca1fe363589d6327b8662c603" dependencies = [ "pest", "pest_generator", @@ -7741,9 +7750,9 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.5.1" +version = "2.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28a1af60b1c4148bb269006a750cff8e2ea36aff34d2d96cf7be0b14d1bed23c" +checksum = "798e0220d1111ae63d66cb66a5dcb3fc2d986d520b98e49e1852bfdb11d7c5e7" dependencies = [ "pest", "pest_meta", @@ -7754,9 +7763,9 @@ dependencies = [ [[package]] name = "pest_meta" -version = "2.5.1" +version = "2.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fec8605d59fc2ae0c6c1aefc0c7c7a9769732017c0ce07f7a9cfffa7b4404f20" +checksum = "984298b75898e30a843e278a9f2452c31e349a073a0ce6fd950a12a74464e065" dependencies = [ "once_cell", "pest", @@ -9065,9 +9074,9 @@ dependencies = [ [[package]] name = "prettyplease" -version = "0.1.21" +version = "0.1.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c142c0e46b57171fe0c528bee8c5b7569e80f0c17e377cd0e30ea57dbc11bb51" +checksum = "2c8992a85d8e93a28bdf76137db888d3874e3b230dee5ed8bebac4c9f7617773" dependencies = [ "proc-macro2", "syn", @@ -9150,9 +9159,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.47" +version = "1.0.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ea3d908b0e36316caf9e9e2c4625cdde190a7e6f440d794667ed17a1855e725" +checksum = "57a8eca9f9c4ffde41714334dee777596264c7825420f521abc92b5b5deb63a5" dependencies = [ "unicode-ident", ] @@ -9206,12 +9215,12 @@ dependencies = [ [[package]] name = "prost" -version = "0.11.3" +version = "0.11.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0b18e655c21ff5ac2084a5ad0611e827b3f92badf79f4910b5a5c58f4d87ff0" +checksum = "c01db6702aa05baa3f57dec92b8eeeeb4cb19e894e73996b32a4093289e54592" dependencies = [ "bytes", - "prost-derive 0.11.2", + "prost-derive 0.11.5", ] [[package]] @@ -9238,9 +9247,9 @@ dependencies = [ [[package]] name = "prost-build" -version = "0.11.4" +version = "0.11.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "276470f7f281b0ed53d2ae42dd52b4a8d08853a3c70e7fe95882acbb98a6ae94" +checksum = "cb5320c680de74ba083512704acb90fe00f28f79207286a848e730c45dd73ed6" dependencies = [ "bytes", "heck", @@ -9250,8 +9259,8 @@ dependencies = [ "multimap", "petgraph", "prettyplease", - "prost 0.11.3", - "prost-types 0.11.2", + "prost 0.11.5", + "prost-types 0.11.5", "regex", "syn", "tempfile", @@ -9286,9 +9295,9 @@ dependencies = [ [[package]] name = "prost-derive" -version = "0.11.2" +version = "0.11.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "164ae68b6587001ca506d3bf7f1000bfa248d0e1217b618108fba4ec1d0cc306" +checksum = "c8842bad1a5419bca14eac663ba798f6bc19c413c2fdceb5f3ba3b0932d96720" dependencies = [ "anyhow", "itertools", @@ -9309,12 +9318,12 @@ dependencies = [ [[package]] name = "prost-types" -version = "0.11.2" +version = "0.11.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "747761bc3dc48f9a34553bf65605cf6cb6288ba219f3450b4275dbd81539551a" +checksum = "017f79637768cde62820bc2d4fe0e45daaa027755c323ad077767c6c5f173091" dependencies = [ "bytes", - "prost 0.11.3", + "prost 0.11.5", ] [[package]] @@ -9345,9 +9354,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.21" +version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179" +checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b" dependencies = [ "proc-macro2", ] @@ -9521,18 +9530,18 @@ dependencies = [ [[package]] name = "ref-cast" -version = "1.0.13" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53b15debb4f9d60d767cd8ca9ef7abb2452922f3214671ff052defc7f3502c44" +checksum = "8c78fb8c9293bcd48ef6fce7b4ca950ceaf21210de6e105a883ee280c0f7b9ed" dependencies = [ "ref-cast-impl", ] [[package]] name = "ref-cast-impl" -version = "1.0.13" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abfa8511e9e94fd3de6585a3d3cd00e01ed556dc9814829280af0e8dc72a8f36" +checksum = "9f9c0c92af03644e4806106281fe2e068ac5bc0ae74a707266d06ea27bccee5f" dependencies = [ "proc-macro2", "quote", @@ -9835,7 +9844,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" dependencies = [ - "semver 1.0.14", + "semver 1.0.16", ] [[package]] @@ -9901,9 +9910,9 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.9" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97477e48b4cf8603ad5f7aaf897467cf42ab4218a38ef76fb14c2d6773a6d6a8" +checksum = "5583e89e108996506031660fe09baa5011b9dd0341b89029313006d1fb508d70" [[package]] name = "rw-stream-sink" @@ -9918,9 +9927,9 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.11" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09" +checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde" [[package]] name = "salsa20" @@ -10520,8 +10529,8 @@ dependencies = [ "futures", "libp2p", "log", - "prost 0.11.3", - "prost-build 0.11.4", + "prost 0.11.5", + "prost-build 0.11.5", "sc-client-api", "sc-network-common", "sp-blockchain", @@ -11057,9 +11066,9 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] name = "scratch" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8132065adcfd6e02db789d9285a0deb2f3fcb04002865ab67d5fb103533898" +checksum = "ddccb15bcce173023b3fedd9436f882a0739b8dfb45e4f6b6002bee5929f61b2" [[package]] name = "sct" @@ -11145,9 +11154,9 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.14" +version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e25dfac463d778e353db5be2449d1cce89bd6fd23c9f1ea21310ce6e5a1b29c4" +checksum = "58bc9567378fc7690d6b2addae4e60ac2eeea07becb2c64b9f218b53865cba2a" dependencies = [ "serde", ] @@ -11160,18 +11169,18 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.150" +version = "1.0.151" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e326c9ec8042f1b5da33252c8a37e9ffbd2c9bef0155215b6e6c80c790e05f91" +checksum = "97fed41fc1a24994d044e6db6935e69511a1153b52c15eb42493b26fa87feba0" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.150" +version = "1.0.151" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42a3df25b0713732468deadad63ab9da1f1fd75a48a15024b50363f128db627e" +checksum = "255abe9a125a985c05190d687b320c12f9b1f0b99445e608c21ba0782c719ad8" dependencies = [ "proc-macro2", "quote", @@ -11180,9 +11189,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.89" +version = "1.0.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "020ff22c755c2ed3f8cf162dbb41a7268d934702f3ed3631656ea597e08fc3db" +checksum = "877c235533714907a8c2464236f5c4b2a17262ef1bd71f38f35ea592c8da6883" dependencies = [ "itoa", "ryu", @@ -12455,9 +12464,9 @@ checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" [[package]] name = "syn" -version = "1.0.105" +version = "1.0.107" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60b9b43d45702de4c839cb9b51d9f529c5dd26a4aff255b42b1ebc03e88ee908" +checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5" dependencies = [ "proc-macro2", "quote", @@ -12550,18 +12559,18 @@ checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d" [[package]] name = "thiserror" -version = "1.0.37" +version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10deb33631e3c9018b9baf9dcbbc4f737320d2b576bac10f6aefa048fa407e3e" +checksum = "6a9cd18aa97d5c45c6603caea1da6628790b37f7a34b6ca89522331c5180fed0" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.37" +version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "982d17546b47146b28f7c22e3d08465f6b8903d0ea13c1660d9d84a6e7adcdbb" +checksum = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f" dependencies = [ "proc-macro2", "quote", @@ -12972,9 +12981,9 @@ dependencies = [ [[package]] name = "tt-call" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e66dcbec4290c69dd03c57e76c2469ea5c7ce109c6dd4351c13055cf71ea055" +checksum = "f4f195fd851901624eee5a58c4bb2b4f06399148fcd0ed336e6f1cb60a9881df" [[package]] name = "twox-hash" @@ -13038,9 +13047,9 @@ checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992" [[package]] name = "unicode-ident" -version = "1.0.5" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ceab39d59e4c9499d4e5a8ee0e2735b891bb7308ac83dfb4e80cad195c9f6f3" +checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc" [[package]] name = "unicode-normalization" diff --git a/Cross.toml b/Cross.toml index 8688ec6ce..3b5c1a4c2 100644 --- a/Cross.toml +++ b/Cross.toml @@ -5,4 +5,4 @@ default-target = "x86_64-unknown-linux-gnu" passthrough = ["WASM_BUILD_WORKSPACE_HINT"] [target.x86_64-unknown-linux-gnu] -image = "ubuntu-latest" +image = "ubuntu:20.04" diff --git a/precompile/deposit/src/mock.rs b/precompile/deposit/src/mock.rs index 0761e5898..280fa7fef 100644 --- a/precompile/deposit/src/mock.rs +++ b/precompile/deposit/src/mock.rs @@ -97,11 +97,11 @@ pub enum KtonAsset {} impl darwinia_deposit::SimpleAsset for KtonAsset { type AccountId = AccountId; - fn mint(_beneficiary: &Self::AccountId, _amount: Balance) -> sp_runtime::DispatchResult { + fn mint(_: &Self::AccountId, _: Balance) -> sp_runtime::DispatchResult { Ok(()) } - fn burn(who: &Self::AccountId, amount: Balance) -> sp_runtime::DispatchResult { + fn burn(_: &Self::AccountId, _: Balance) -> sp_runtime::DispatchResult { Ok(()) } } diff --git a/precompile/staking/src/mock.rs b/precompile/staking/src/mock.rs index 10ebd68c7..63f65ad21 100644 --- a/precompile/staking/src/mock.rs +++ b/precompile/staking/src/mock.rs @@ -99,11 +99,11 @@ pub enum KtonAsset {} impl darwinia_deposit::SimpleAsset for KtonAsset { type AccountId = AccountId; - fn mint(_beneficiary: &Self::AccountId, _amount: Balance) -> sp_runtime::DispatchResult { + fn mint(_: &Self::AccountId, _: Balance) -> sp_runtime::DispatchResult { Ok(()) } - fn burn(who: &Self::AccountId, amount: Balance) -> sp_runtime::DispatchResult { + fn burn(_: &Self::AccountId, _: Balance) -> sp_runtime::DispatchResult { Ok(()) } } From 7a322a73fe8767a12f9d233d0b605c390824f765 Mon Sep 17 00:00:00 2001 From: fewensa <37804932+fewensa@users.noreply.github.com> Date: Tue, 27 Dec 2022 14:32:33 +0800 Subject: [PATCH 069/189] Improve config for pallet_bridge_grandpa (#161) * Update max bridged authorities follow https://github.com/paritytech/parity-bridges-common/blob/c28b3ff66c29c6c9d9955583b50c2114de14e98c/primitives/chain-rococo/src/lib.rs#L45-L48 * Update max bridged header size to 65536 * Update weight info follow https://github.com/paritytech/parity-bridges-common/blob/c28b3ff66c29c6c9d9955583b50c2114de14e98c/bin/millau/runtime/src/lib.rs#L431 * Keep WeightInfo to () * Code Clean --- runtime/crab/src/pallets/bridge_grandpa.rs | 4 ++-- runtime/darwinia/src/pallets/bridge_grandpa.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/runtime/crab/src/pallets/bridge_grandpa.rs b/runtime/crab/src/pallets/bridge_grandpa.rs index 986228c63..4f342cf79 100644 --- a/runtime/crab/src/pallets/bridge_grandpa.rs +++ b/runtime/crab/src/pallets/bridge_grandpa.rs @@ -26,8 +26,8 @@ pub type PolkadotHeadersToKeep = ConstU32<500>; impl pallet_bridge_grandpa::Config for Runtime { type BridgedChain = bp_darwinia::DarwiniaLike; type HeadersToKeep = PolkadotHeadersToKeep; - type MaxBridgedAuthorities = (); - type MaxBridgedHeaderSize = (); + type MaxBridgedAuthorities = ConstU32<100_000>; + type MaxBridgedHeaderSize = ConstU32<65536>; type MaxRequests = ConstU32<50>; type WeightInfo = (); } diff --git a/runtime/darwinia/src/pallets/bridge_grandpa.rs b/runtime/darwinia/src/pallets/bridge_grandpa.rs index e1a8b7358..65c4edb50 100644 --- a/runtime/darwinia/src/pallets/bridge_grandpa.rs +++ b/runtime/darwinia/src/pallets/bridge_grandpa.rs @@ -26,8 +26,8 @@ pub type KusamaHeadersToKeep = ConstU32<500>; impl pallet_bridge_grandpa::Config for Runtime { type BridgedChain = bp_crab::DarwiniaLike; type HeadersToKeep = KusamaHeadersToKeep; - type MaxBridgedAuthorities = (); - type MaxBridgedHeaderSize = (); + type MaxBridgedAuthorities = ConstU32<100_000>; + type MaxBridgedHeaderSize = ConstU32<65536>; type MaxRequests = ConstU32<50>; type WeightInfo = (); } From a29b2cc61a7883b86a17567bace0d8d2de7cbc23 Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Wed, 28 Dec 2022 12:08:23 +0800 Subject: [PATCH 070/189] Improve kton migration (#163) * Improve kton migration * Typo * Doc * Name * Fix * Fix --- pallet/account-migration/src/lib.rs | 89 +++++++---------- tool/state-processor/src/system/README.md | 6 +- tool/state-processor/src/system/mod.rs | 90 +++++++---------- tool/state-processor/src/type_registry.rs | 112 +++++++++++----------- 4 files changed, 127 insertions(+), 170 deletions(-) diff --git a/pallet/account-migration/src/lib.rs b/pallet/account-migration/src/lib.rs index 3e641e893..de5f4bc48 100644 --- a/pallet/account-migration/src/lib.rs +++ b/pallet/account-migration/src/lib.rs @@ -51,7 +51,7 @@ mod tests; // darwinia use darwinia_deposit::Deposit; use darwinia_staking::Ledger; -use dc_primitives::{AccountId as AccountId20, Balance, BlockNumber, Index}; +use dc_primitives::{AccountId as AccountId20, AssetId, Balance, BlockNumber, Index}; // substrate use frame_support::{ log, migration, @@ -59,13 +59,15 @@ use frame_support::{ traits::{Currency, ExistenceRequirement::KeepAlive, LockableCurrency, WithdrawReasons}, StorageHasher, }; -use frame_system::{pallet_prelude::*, AccountInfo}; -use pallet_assets::AssetAccount; +use frame_system::{pallet_prelude::*, AccountInfo, RawOrigin}; use pallet_balances::AccountData; use pallet_vesting::VestingInfo; use sp_core::sr25519::{Public, Signature}; use sp_io::hashing; -use sp_runtime::{traits::Verify, AccountId32}; +use sp_runtime::{ + traits::{IdentityLookup, Verify}, + AccountId32, +}; use sp_std::prelude::*; type Message = [u8; 32]; @@ -84,7 +86,9 @@ pub mod pallet { BlockNumber = BlockNumber, AccountId = AccountId20, AccountData = AccountData, - > + pallet_balances::Config + Lookup = IdentityLookup, + > + pallet_assets::Config + + pallet_balances::Config + pallet_vesting::Config> + darwinia_deposit::Config + darwinia_staking::Config @@ -123,10 +127,10 @@ pub mod pallet { /// [`pallet_asset::AssetAccount`] data. /// /// https://github.dev/paritytech/substrate/blob/polkadot-v0.9.30/frame/assets/src/types.rs#L115 + // The size of `pallet_asset::AssetAccount` is 64 bytes. #[pallet::storage] #[pallet::getter(fn kton_account_of)] - pub type KtonAccounts = - StorageMap<_, Blake2_128Concat, AccountId32, AssetAccount>; + pub type KtonAccounts = StorageMap<_, Blake2_128Concat, AccountId32, [u8; 64]>; /// [`pallet_vesting::Vesting`] data. /// @@ -175,6 +179,18 @@ pub mod pallet { >::insert(to, account); + if let Some(a) = >::take(&from) { + migration::put_storage_value( + b"Assets", + b"Account", + &[ + Blake2_128Concat::hash(&1026_u64.encode()), + Blake2_128Concat::hash(&to.encode()), + ] + .concat(), + a, + ); + } if let Some(v) = >::get(&from) { let locked = v.iter().map(|v| v.locked()).sum(); @@ -203,64 +219,23 @@ pub mod pallet { ); } + let staking_pot = darwinia_staking::account_id(); + as Currency<_>>::transfer( &to, - &darwinia_staking::account_id(), + &staking_pot, l.staked_ring + l.unstaking_ring.iter().map(|(r, _)| r).sum::(), KeepAlive, )?; - // TODO: kton transfer + >::transfer( + RawOrigin::Signed(to).into(), + 1026_u64, + staking_pot, + l.staked_kton + l.unstaking_kton.iter().map(|(k, _)| k).sum::(), + )?; >::insert(to, l); } - if let Some(a) = KtonAccounts::::take(&from) { - frame_system::Pallet::::inc_sufficients(&to); - - migration::put_storage_value( - b"Assets", - b"Account", - &[ - Blake2_128Concat::hash(&1026u64.encode()), - Blake2_128Concat::hash(&to.encode()), - ] - .concat(), - a.encode(), - ); - // The upstream structure cannot be accessed due to permission restrictions. - #[derive(Debug, Encode, Decode)] - pub struct AssetDetails { - pub owner: AccountId20, - pub issuer: AccountId20, - pub admin: AccountId20, - pub freezer: AccountId20, - pub supply: u128, - pub deposit: u128, - pub min_balance: u128, - pub is_sufficient: bool, - pub accounts: u32, - pub sufficients: u32, - pub approvals: u32, - pub is_frozen: bool, - } - - if let Some(mut asset_details) = migration::get_storage_value::( - b"Assets", - b"Asset", - &Blake2_128Concat::hash(&1026u64.encode()), - ) { - asset_details.accounts += 1; - asset_details.sufficients += 1; - - // Fresh to new details - migration::put_storage_value( - b"Assets", - b"Asset", - &Blake2_128Concat::hash(&1026u64.encode()), - asset_details.encode(), - ); - } - } - Self::deposit_event(Event::Migrated { from, to }); Ok(()) diff --git a/tool/state-processor/src/system/README.md b/tool/state-processor/src/system/README.md index 52423c5c3..79df61a65 100644 --- a/tool/state-processor/src/system/README.md +++ b/tool/state-processor/src/system/README.md @@ -22,13 +22,13 @@ - create KTON asset details - set accounts - if is EVM address - - insert to `Assets::Account` and `Assets::Approvals`(update kton asset details) + - insert to `Assets::Account` (update kton asset details) - insert to `System::Account` - if is Substrate address - reset the nonce - insert to `AccountMigration::KtonAccounts` - - insert to `AccountMigration::Accounts`\ -- set KTON total issuances + - insert to `AccountMigration::Accounts` +- set KTON total issuances - compare the calculated one with the storage one - check remaining sum - TODO - set `Assets::Metadata` diff --git a/tool/state-processor/src/system/mod.rs b/tool/state-processor/src/system/mod.rs index 4441b2bff..4ba55fd45 100644 --- a/tool/state-processor/src/system/mod.rs +++ b/tool/state-processor/src/system/mod.rs @@ -1,10 +1,8 @@ // darwinia use crate::*; -use subhasher::blake2_128_concat; #[derive(Debug)] pub struct AccountAll { - pub key: String, pub nonce: u32, pub consumers: u32, pub providers: u32, @@ -31,10 +29,13 @@ impl Processor { log::info!("build accounts"); log::info!("calculate total issuance"); solo_account_infos.into_iter().for_each(|(k, v)| { + if v.data.reserved_kton_or_fee_frozen != 0 { + log::error!("there shouldn't be any reserved kton on account({k})"); + } + accounts.insert( - k.clone(), + k, AccountAll { - key: k, nonce: v.nonce, // --- // TODO: check if we could ignore para's. @@ -54,18 +55,16 @@ impl Processor { ring_total_issuance += v.data.free; ring_total_issuance += v.data.reserved; kton_total_issuance += v.data.free_kton_or_misc_frozen; - kton_total_issuance += v.data.reserved_kton_or_fee_frozen; }); para_account_infos.into_iter().for_each(|(k, v)| { accounts - .entry(k.clone()) + .entry(k) .and_modify(|a| { a.nonce = v.nonce.max(a.nonce); a.ring += v.data.free; a.ring_reserved += v.data.reserved; }) .or_insert(AccountAll { - key: k, nonce: v.nonce, consumers: v.consumers, providers: v.providers, @@ -88,6 +87,9 @@ impl Processor { log::info!("set `Balances::TotalIssuance`"); self.shell_state.insert_value(b"Balances", b"TotalIssuance", "", ring_total_issuance); + log::info!("`kton_total_issuance({kton_total_issuance})`"); + log::info!("`kton_total_issuance_storage({kton_total_issuance_storage})`"); + let mut kton_details = AssetDetails { owner: ROOT, issuer: ROOT, @@ -103,9 +105,7 @@ impl Processor { is_frozen: false, }; - log::info!("set `System::Account`"); - log::info!("set `Balances::Locks`"); - log::info!("set `Assets::Account` and `Assets::Approvals`"); + log::info!("fix `EVM::AccountCodes`'s `sufficients` and set `Assets::Account`, `System::Account`, `AccountMigration::KtonAccounts` and `AccountMigration::Accounts`"); accounts.into_iter().for_each(|(k, v)| { let key = get_last_64(&k); let mut a = AccountInfo { @@ -133,46 +133,17 @@ impl Processor { a.sufficients += 1; } - if v.kton != 0 || v.kton_reserved != 0 { - let aa = AssetAccount { - balance: v.kton, - is_frozen: false, - reason: ExistenceReason::Sufficient, - extra: (), - }; - - a.sufficients += 1; - kton_details.accounts += 1; - kton_details.sufficients += 1; - // Note: this is double map structure in the pallet-assets. + if v.kton != 0 { self.shell_state.insert_value( b"Assets", b"Account", &format!( "{}{}", - array_bytes::bytes2hex("", blake2_128_concat(&KTON_ID.encode())), - array_bytes::bytes2hex("", blake2_128_concat(&k.encode())), + blake2_128_concat_to_string(KTON_ID.encode()), + blake2_128_concat_to_string(k.encode()), ), - &aa, - ); - - // https://github.dev/darwinia-network/darwinia-common/blob/6a9392cfb9fe2c99b1c2b47d0c36125d61991bb7/frame/dvm/evm/precompiles/kton/src/lib.rs#L72 - let mut approves = Map::::default(); - self.solo_state.take_map( - b"KtonERC20", - b"Approves", - &mut approves, - get_hashed_key, + new_kton_account(&mut a, &mut kton_details, v.kton), ); - approves.iter().for_each(|(k, v)| { - kton_details.approvals += 1; - self.shell_state.insert_value( - b"Assets", - b"Approvals", - &k, - Approval { amount: v.as_u128(), deposit: 0 }, - ); - }); } self.shell_state.insert_value( @@ -184,15 +155,13 @@ impl Processor { } else { a.nonce = 0; - if v.kton != 0 || v.kton_reserved != 0 { - let aa = AssetAccount { - balance: v.kton, - is_frozen: false, - reason: ExistenceReason::Sufficient, - extra: (), - }; - - self.shell_state.insert_value(b"AccountMigration", b"KtonAccounts", &k, &aa); + if v.kton != 0 { + self.shell_state.insert_value( + b"AccountMigration", + b"KtonAccounts", + &k, + new_kton_account(&mut a, &mut kton_details, v.kton), + ); } self.shell_state.insert_value(b"AccountMigration", b"Accounts", &k, a); @@ -205,7 +174,7 @@ impl Processor { self.shell_state.insert_value( b"Assets", b"Asset", - &array_bytes::bytes2hex("", blake2_128_concat(&KTON_ID.encode())), + &blake2_128_concat_to_string(KTON_ID.encode()), kton_details, ); @@ -213,9 +182,10 @@ impl Processor { self.shell_state.insert_value( b"Assets", b"Metadata", - &array_bytes::bytes2hex("", blake2_128_concat(&KTON_ID.encode())), + &blake2_128_concat_to_string(KTON_ID.encode()), AssetMetadata { deposit: 0, + // TODO: different runtime name: b"Darwinia Commitment Token".to_vec(), symbol: b"KTON".to_vec(), decimals: 18, @@ -285,6 +255,18 @@ fn try_get_evm_address(key: &str) -> Option<[u8; 20]> { } } +fn new_kton_account( + account_info: &mut AccountInfo, + asset_details: &mut AssetDetails, + balance: u128, +) -> AssetAccount { + account_info.sufficients += 1; + asset_details.accounts += 1; + asset_details.sufficients += 1; + + AssetAccount { balance, is_frozen: false, reason: ExistenceReason::Sufficient, extra: () } +} + #[test] fn verify_evm_address_checksum_should_work() { // subalfred key 5ELRpquT7C3mWtjerpPfdmaGoSh12BL2gFCv2WczEcv6E1zL diff --git a/tool/state-processor/src/type_registry.rs b/tool/state-processor/src/type_registry.rs index dd2abf298..2c689d9a5 100644 --- a/tool/state-processor/src/type_registry.rs +++ b/tool/state-processor/src/type_registry.rs @@ -42,6 +42,62 @@ impl Default for Reasons { } } +// https://github.dev/paritytech/substrate/blob/polkadot-v0.9.30/frame/assets/src/types.rs#L33 +#[derive(Debug, Encode, Decode)] +pub struct AssetDetails { + pub owner: [u8; 20], + pub issuer: [u8; 20], + pub admin: [u8; 20], + pub freezer: [u8; 20], + pub supply: u128, + pub deposit: u128, + pub min_balance: u128, + pub is_sufficient: bool, + pub accounts: u32, + pub sufficients: u32, + pub approvals: u32, + pub is_frozen: bool, +} + +// https://github.dev/paritytech/substrate/blob/polkadot-v0.9.30/frame/assets/src/types.rs#L115 +#[derive(Debug, Encode, Decode)] +pub struct AssetAccount { + pub balance: u128, + pub is_frozen: bool, + pub reason: ExistenceReason, + pub extra: (), +} + +// https://github.dev/paritytech/substrate/blob/polkadot-v0.9.30/frame/assets/src/types.rs#L88 +#[derive(Debug, Encode, Decode)] +pub enum ExistenceReason { + #[codec(index = 0)] + Consumer, + #[codec(index = 1)] + Sufficient, + #[codec(index = 2)] + DepositHeld(u128), + #[codec(index = 3)] + DepositRefunded, +} + +// https://github.dev/paritytech/substrate/blob/polkadot-v0.9.30/frame/assets/src/types.rs#L73 +#[derive(Debug, Encode, Decode)] +pub struct Approval { + pub amount: u128, + pub deposit: u128, +} + +// https://github.dev/paritytech/substrate/blob/polkadot-v0.9.30/frame/assets/src/types.rs#L127 +#[derive(Clone, Encode, Decode)] +pub struct AssetMetadata { + pub deposit: u128, + pub name: Vec, + pub symbol: Vec, + pub decimals: u8, + pub is_frozen: bool, +} + #[derive(Default, Debug, Encode, Decode)] pub struct VestingInfo { pub locked: u128, @@ -100,59 +156,3 @@ pub struct Ledger { pub unstaking_kton: Vec<(u128, u32)>, pub unstaking_deposits: Vec<(u16, u32)>, } - -// https://github.dev/paritytech/substrate/blob/polkadot-v0.9.30/frame/assets/src/types.rs#L33 -#[derive(Debug, Encode, Decode)] -pub struct AssetDetails { - pub owner: [u8; 20], - pub issuer: [u8; 20], - pub admin: [u8; 20], - pub freezer: [u8; 20], - pub supply: u128, - pub deposit: u128, - pub min_balance: u128, - pub is_sufficient: bool, - pub accounts: u32, - pub sufficients: u32, - pub approvals: u32, - pub is_frozen: bool, -} - -// https://github.dev/paritytech/substrate/blob/polkadot-v0.9.30/frame/assets/src/types.rs#L115 -#[derive(Debug, Encode, Decode)] -pub struct AssetAccount { - pub balance: u128, - pub is_frozen: bool, - pub reason: ExistenceReason, - pub extra: (), -} - -// https://github.dev/paritytech/substrate/blob/polkadot-v0.9.30/frame/assets/src/types.rs#L88 -#[derive(Debug, Encode, Decode)] -pub enum ExistenceReason { - #[codec(index = 0)] - Consumer, - #[codec(index = 1)] - Sufficient, - #[codec(index = 2)] - DepositHeld(u128), - #[codec(index = 3)] - DepositRefunded, -} - -// https://github.dev/paritytech/substrate/blob/polkadot-v0.9.30/frame/assets/src/types.rs#L73 -#[derive(Debug, Encode, Decode)] -pub struct Approval { - pub amount: u128, - pub deposit: u128, -} - -// https://github.dev/paritytech/substrate/blob/polkadot-v0.9.30/frame/assets/src/types.rs#L127 -#[derive(Clone, Encode, Decode)] -pub struct AssetMetadata { - pub deposit: u128, - pub name: Vec, - pub symbol: Vec, - pub decimals: u8, - pub is_frozen: bool, -} From 85b70e26fda2d0836b6c4565cb820ff1d30ddbe0 Mon Sep 17 00:00:00 2001 From: Guantong Date: Thu, 29 Dec 2022 14:51:29 +0800 Subject: [PATCH 071/189] Use `DealWithFees` in `transaction_payment` (#164) --- runtime/crab/src/pallets/transaction_payment.rs | 3 ++- runtime/darwinia/src/pallets/transaction_payment.rs | 3 ++- runtime/pangolin/src/pallets/transaction_payment.rs | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/runtime/crab/src/pallets/transaction_payment.rs b/runtime/crab/src/pallets/transaction_payment.rs index 691273b7b..85b2d11c5 100644 --- a/runtime/crab/src/pallets/transaction_payment.rs +++ b/runtime/crab/src/pallets/transaction_payment.rs @@ -23,7 +23,8 @@ impl pallet_transaction_payment::Config for Runtime { type FeeMultiplierUpdate = polkadot_runtime_common::SlowAdjustingFeeUpdate; // Relay Chain `TransactionByteFee` / 10 type LengthToFee = ConstantMultiplier>; - type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter; + type OnChargeTransaction = + pallet_transaction_payment::CurrencyAdapter>; type OperationalFeeMultiplier = sp_runtime::traits::ConstU8<5>; type RuntimeEvent = RuntimeEvent; type WeightToFee = WeightToFee; diff --git a/runtime/darwinia/src/pallets/transaction_payment.rs b/runtime/darwinia/src/pallets/transaction_payment.rs index 691273b7b..85b2d11c5 100644 --- a/runtime/darwinia/src/pallets/transaction_payment.rs +++ b/runtime/darwinia/src/pallets/transaction_payment.rs @@ -23,7 +23,8 @@ impl pallet_transaction_payment::Config for Runtime { type FeeMultiplierUpdate = polkadot_runtime_common::SlowAdjustingFeeUpdate; // Relay Chain `TransactionByteFee` / 10 type LengthToFee = ConstantMultiplier>; - type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter; + type OnChargeTransaction = + pallet_transaction_payment::CurrencyAdapter>; type OperationalFeeMultiplier = sp_runtime::traits::ConstU8<5>; type RuntimeEvent = RuntimeEvent; type WeightToFee = WeightToFee; diff --git a/runtime/pangolin/src/pallets/transaction_payment.rs b/runtime/pangolin/src/pallets/transaction_payment.rs index 691273b7b..85b2d11c5 100644 --- a/runtime/pangolin/src/pallets/transaction_payment.rs +++ b/runtime/pangolin/src/pallets/transaction_payment.rs @@ -23,7 +23,8 @@ impl pallet_transaction_payment::Config for Runtime { type FeeMultiplierUpdate = polkadot_runtime_common::SlowAdjustingFeeUpdate; // Relay Chain `TransactionByteFee` / 10 type LengthToFee = ConstantMultiplier>; - type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter; + type OnChargeTransaction = + pallet_transaction_payment::CurrencyAdapter>; type OperationalFeeMultiplier = sp_runtime::traits::ConstU8<5>; type RuntimeEvent = RuntimeEvent; type WeightToFee = WeightToFee; From 77c678888870fc6674f9965d1b7165d8f9dfc997 Mon Sep 17 00:00:00 2001 From: bear Date: Fri, 30 Dec 2022 00:15:50 +0800 Subject: [PATCH 072/189] Add `claim_with_penalty` interface (#165) --- pallet/deposit/tests/mock.rs | 5 +---- pallet/staking/src/lib.rs | 7 +------ pallet/staking/tests/mock.rs | 5 +---- precompile/deposit/src/lib.rs | 13 +++++++++++++ precompile/deposit/src/tests.rs | 19 +++++++++++++++++++ 5 files changed, 35 insertions(+), 14 deletions(-) diff --git a/pallet/deposit/tests/mock.rs b/pallet/deposit/tests/mock.rs index 06d3a808d..eb346fa1d 100644 --- a/pallet/deposit/tests/mock.rs +++ b/pallet/deposit/tests/mock.rs @@ -90,10 +90,7 @@ impl darwinia_deposit::SimpleAsset for KtonAsset { Assets::mint(RuntimeOrigin::signed(0), 0, *beneficiary, amount) } - fn burn( - who: &Self::AccountId, - amount: Balance, - ) -> sp_runtime::DispatchResult { + fn burn(who: &Self::AccountId, amount: Balance) -> sp_runtime::DispatchResult { if Assets::balance(0, who) < amount { Err(>::BalanceLow)?; } diff --git a/pallet/staking/src/lib.rs b/pallet/staking/src/lib.rs index 6912238c0..f9b5e1a9b 100644 --- a/pallet/staking/src/lib.rs +++ b/pallet/staking/src/lib.rs @@ -390,12 +390,7 @@ pub mod pallet { DispatchResult::Ok(()) })?; - Self::deposit_event(Event::Staked { - staker: who, - ring_amount, - kton_amount, - deposits, - }); + Self::deposit_event(Event::Staked { staker: who, ring_amount, kton_amount, deposits }); Ok(()) } diff --git a/pallet/staking/tests/mock.rs b/pallet/staking/tests/mock.rs index 8358b0e8a..0cd35e4f1 100644 --- a/pallet/staking/tests/mock.rs +++ b/pallet/staking/tests/mock.rs @@ -105,10 +105,7 @@ impl darwinia_deposit::SimpleAsset for KtonAsset { Assets::mint(RuntimeOrigin::signed(0), 0, *beneficiary, amount) } - fn burn( - who: &Self::AccountId, - amount: Balance, - ) -> sp_runtime::DispatchResult { + fn burn(who: &Self::AccountId, amount: Balance) -> sp_runtime::DispatchResult { if Assets::balance(0, who) < amount { Err(>::BalanceLow)?; } diff --git a/precompile/deposit/src/lib.rs b/precompile/deposit/src/lib.rs index bb7846b1a..9ea8eafec 100644 --- a/precompile/deposit/src/lib.rs +++ b/precompile/deposit/src/lib.rs @@ -74,4 +74,17 @@ where Ok(true) } + + #[precompile::public("claim_with_penalty(uint8)")] + fn claim_with_penalty(handle: &mut impl PrecompileHandle, id: u8) -> EvmResult { + let origin: AccountIdOf = handle.context().caller.into(); + + RuntimeHelper::::try_dispatch( + handle, + Some(origin).into(), + darwinia_deposit::Call::::claim_with_penalty { id: id.into() }, + )?; + + Ok(true) + } } diff --git a/precompile/deposit/src/tests.rs b/precompile/deposit/src/tests.rs index a3aa84119..84b837db4 100644 --- a/precompile/deposit/src/tests.rs +++ b/precompile/deposit/src/tests.rs @@ -36,6 +36,7 @@ fn precompiles() -> TestPrecompiles { fn selectors() { assert!(PCall::lock_selectors().contains(&0x998e4242)); assert!(PCall::claim_selectors().contains(&0x4e71d92d)); + assert!(PCall::claim_with_penalty_selectors().contains(&0xfa04a9bf)); } #[test] @@ -56,3 +57,21 @@ fn lock_and_claim() { assert!(Deposit::deposit_of(&alice).is_none()); }); } + +#[test] +fn claim_with_penalty() { + let alice: H160 = Alice.into(); + ExtBuilder::default().with_balances(vec![(alice, 300)]).build().execute_with(|| { + // lock + precompiles() + .prepare_test(alice, Precompile, PCall::lock { amount: 200.into(), months: 1 }) + .execute_returns(EvmDataWriter::new().write(true).build()); + assert!(Deposit::deposit_of(&alice).is_some()); + + // claim with penalty + precompiles() + .prepare_test(alice, Precompile, PCall::claim_with_penalty { id: 0 }) + .execute_returns(EvmDataWriter::new().write(true).build()); + assert!(Deposit::deposit_of(&alice).is_none()); + }); +} From 60766d0adbb6df598086fea2d9686c0d0a6dca1a Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Fri, 30 Dec 2022 16:27:20 +0800 Subject: [PATCH 073/189] Handle different account types (#168) * Handle different account types * Format --- tool/state-processor/src/main.rs | 25 ++++++++++++++++--------- tool/state-processor/src/system/mod.rs | 2 +- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/tool/state-processor/src/main.rs b/tool/state-processor/src/main.rs index 40a5c0a04..abf65add3 100644 --- a/tool/state-processor/src/main.rs +++ b/tool/state-processor/src/main.rs @@ -281,15 +281,17 @@ impl State { where A: AsRef<[u8]>, { - self.mutate_value( - b"System", - b"Account", - &blake2_128_concat_to_string(who), - |a: &mut AccountInfo| { - a.data.free += amount; - a.data.reserved -= amount; - }, - ); + let who = who.as_ref(); + let (p, i) = if is_evm_address(who) { + (&b"System"[..], &b"Account"[..]) + } else { + (&b"AccountMigration"[..], &b"Accounts"[..]) + }; + + self.mutate_value(p, i, &blake2_128_concat_to_string(who), |a: &mut AccountInfo| { + a.data.free += amount; + a.data.reserved -= amount; + }); } } @@ -358,3 +360,8 @@ where { array_bytes::bytes2hex("", subhasher::blake2_128_concat(data)) } + +fn is_evm_address(address: &[u8]) -> bool { + address.starts_with(b"dvm:") + && address[1..31].iter().fold(address[0], |checksum, &b| checksum ^ b) == address[31] +} diff --git a/tool/state-processor/src/system/mod.rs b/tool/state-processor/src/system/mod.rs index 4ba55fd45..2c92d5233 100644 --- a/tool/state-processor/src/system/mod.rs +++ b/tool/state-processor/src/system/mod.rs @@ -248,7 +248,7 @@ impl Processor { fn try_get_evm_address(key: &str) -> Option<[u8; 20]> { let k = array_bytes::hex2bytes_unchecked(key); - if k.starts_with(b"dvm:") && k[1..31].iter().fold(k[0], |checksum, &b| checksum ^ b) == k[31] { + if is_evm_address(&k) { Some(array_bytes::slice2array_unchecked(&k[11..31])) } else { None From d21847efe7c62878e08849dd6651b93520ecaa65 Mon Sep 17 00:00:00 2001 From: bear Date: Tue, 3 Jan 2023 11:36:19 +0800 Subject: [PATCH 074/189] State process test (#153) * First commit * Add balance test * Try fix * test total_issuance * Test the kton part removed * Add evm related test * Assert evm account storages * Update evm storage tests * Add vesting info test * Add indices test * Add staking test * Add staking test 2 * Fix tests * Add deposit items test * Finish staking test * Add tests for assets * Test kton transfer to asset pallet * Test kton total issuance * Fix todo * Add parachain support * Remove ignored case * Add combine solo,para account tests * Code clean * Add filter * Refactor the test * Ignore two cases * Rwrite all tests * Update evm codes test * Code format * Fix indices tests * Remove debug line * Format * Format * Fix review Co-authored-by: Xavier Lau --- tool/state-processor/src/main.rs | 17 +- tool/state-processor/src/system/mod.rs | 9 +- tool/state-processor/src/tests.rs | 686 ++++++++++++++++++++++ tool/state-processor/src/type_registry.rs | 15 +- 4 files changed, 714 insertions(+), 13 deletions(-) create mode 100644 tool/state-processor/src/tests.rs diff --git a/tool/state-processor/src/main.rs b/tool/state-processor/src/main.rs index abf65add3..19c3c751f 100644 --- a/tool/state-processor/src/main.rs +++ b/tool/state-processor/src/main.rs @@ -11,6 +11,9 @@ use adjust::*; mod type_registry; use type_registry::*; +#[cfg(test)] +mod tests; + // std use std::{ env, @@ -85,7 +88,7 @@ impl Processor { } } -struct State(Map); +pub struct State(Map); impl State { fn from_file(path: &str) -> Result { Ok(Self(from_file::(path)?.genesis.raw.top)) @@ -277,18 +280,18 @@ impl State { // fn transfer(&mut self, from: &str, to: &str, amount: u128) {} - fn unreserve(&mut self, who: A, amount: u128) + fn unreserve(&mut self, account_id_32: A, amount: u128) where A: AsRef<[u8]>, { - let who = who.as_ref(); - let (p, i) = if is_evm_address(who) { - (&b"System"[..], &b"Account"[..]) + let account_id_32 = account_id_32.as_ref(); + let (p, i, h) = if is_evm_address(account_id_32) { + (&b"System"[..], &b"Account"[..], &account_id_32[11..31]) } else { - (&b"AccountMigration"[..], &b"Accounts"[..]) + (&b"AccountMigration"[..], &b"Accounts"[..], account_id_32) }; - self.mutate_value(p, i, &blake2_128_concat_to_string(who), |a: &mut AccountInfo| { + self.mutate_value(p, i, &blake2_128_concat_to_string(h), |a: &mut AccountInfo| { a.data.free += amount; a.data.reserved -= amount; }); diff --git a/tool/state-processor/src/system/mod.rs b/tool/state-processor/src/system/mod.rs index 2c92d5233..6ece1ef31 100644 --- a/tool/state-processor/src/system/mod.rs +++ b/tool/state-processor/src/system/mod.rs @@ -211,8 +211,12 @@ impl Processor { account_infos.iter_mut().for_each(|(_, v)| v.data.adjust()); log::info!("merge solo remaining balances"); + let (mut total_remaining_ring, mut total_remaining_kton) = + (u128::default(), u128::default()); + remaining_ring.into_iter().for_each(|(k, v)| { if let Some(a) = account_infos.get_mut(&k) { + total_remaining_ring += v; a.data.free += v; } else { log::error!( @@ -223,14 +227,17 @@ impl Processor { }); remaining_kton.into_iter().for_each(|(k, v)| { if let Some(a) = account_infos.get_mut(&k) { + total_remaining_kton += v; a.data.free_kton_or_misc_frozen += v; } else { log::error!( "`Account({})` not found while merging `RemainingKtonBalance`", - get_last_64(&k) + get_last_64(&k), ); } }); + log::info!("total_remaining_ring({total_remaining_ring})"); + log::info!("total_remaining_kton({total_remaining_kton})"); account_infos } diff --git a/tool/state-processor/src/tests.rs b/tool/state-processor/src/tests.rs new file mode 100644 index 000000000..eb60d8a9f --- /dev/null +++ b/tool/state-processor/src/tests.rs @@ -0,0 +1,686 @@ +// crates.io +use array_bytes::hex_n_into_unchecked; +use parity_scale_codec::Encode; +use primitive_types::H256; +// darwinia +use crate::*; + +struct Tester { + // solo chain + solo_accounts: Map, + solo_remaining_ring: Map, + solo_remaining_kton: Map, + solo_evm_codes: Map>, + // para chain + para_accounts: Map, + // processed + migration_accounts: Map, + migration_kton_accounts: Map, + shell_system_accounts: Map, + shell_evm_codes: Map>, + + solo_state: State, + para_state: State, + shell_state: State, +} + +fn get_last_64(key: &str, _: &str) -> String { + format!("0x{}", &key[key.len() - 64..]) +} + +fn get_last_40(key: &str, _: &str) -> String { + format!("0x{}", &key[key.len() - 40..]) +} + +fn twox64_concat_to_string(data: D) -> String +where + D: AsRef<[u8]>, +{ + array_bytes::bytes2hex("", subhasher::twox64_concat(data)) +} + +impl Tester { + fn new() -> Self { + // This test is only used to ensure the correctness of the state processor and is only + // applicable to Crab, Crab Parachain. + let mut solo_state = State::from_file("test-data/crab.json").unwrap(); + let mut para_state = State::from_file("test-data/crab-parachain.json").unwrap(); + let mut shell_state = State::from_file("test-data/processed.json").unwrap(); + + // solo chain + let mut solo_accounts = >::default(); + let mut solo_remaining_ring = >::default(); + let mut solo_remaining_kton = >::default(); + let mut solo_evm_codes = >>::default(); + solo_state + .take_map(b"System", b"Account", &mut solo_accounts, get_last_64) + .take_map(b"Ethereum", b"RemainingRingBalance", &mut solo_remaining_ring, get_last_64) + .take_map(b"Ethereum", b"RemainingKtonBalance", &mut solo_remaining_kton, get_last_64) + .take_map(b"EVM", b"AccountCodes", &mut solo_evm_codes, get_last_40); + + // para chain + let mut para_accounts = >::default(); + para_state.take_map(b"System", b"Account", &mut para_accounts, get_last_64); + + // processed + let mut shell_system_accounts = >::default(); + let mut shell_evm_codes = >>::default(); + let mut migration_accounts = >::default(); + let mut migration_kton_accounts = >::default(); + shell_state + .take_map(b"System", b"Account", &mut shell_system_accounts, get_last_40) + .take_map( + b"AccountMigration", + b"KtonAccounts", + &mut migration_kton_accounts, + get_last_64, + ) + .take_map(b"AccountMigration", b"Accounts", &mut migration_accounts, get_last_64) + .take_map(b"Evm", b"AccountCodes", &mut shell_evm_codes, get_last_40); + + Self { + solo_accounts, + solo_remaining_ring, + solo_remaining_kton, + solo_evm_codes, + + para_accounts, + + migration_accounts, + migration_kton_accounts, + shell_system_accounts, + shell_evm_codes, + + solo_state, + para_state, + shell_state, + } + } +} + +fn run_test(test: T) +where + T: FnOnce(&Tester) + std::panic::UnwindSafe, +{ + let tester = Tester::new(); + let result = std::panic::catch_unwind(|| test(&tester)); + assert!(result.is_ok()) +} + +// --- System & Balances & Assets --- + +#[test] +fn solo_chain_substrate_account_adjust() { + run_test(|tester| { + let test_addr = "0xf4171e1b64c96cc17f601f28d002cb5fcd27eab8b6585e296f4652be5bf05550"; + + let solo_account = tester.solo_accounts.get(test_addr).unwrap(); + assert_ne!(solo_account.nonce, 0); + assert_ne!(solo_account.consumers, 0); + assert_ne!(solo_account.providers, 0); + assert_eq!(solo_account.sufficients, 0); + assert_ne!(solo_account.data.free, 0); + assert_ne!(solo_account.data.free_kton_or_misc_frozen, 0); + + // after migrate + + let migrated_account = tester.migration_accounts.get(test_addr).unwrap(); + assert_eq!(solo_account.consumers, migrated_account.consumers); + assert_eq!(solo_account.providers, migrated_account.providers); + assert_eq!(solo_account.sufficients + 1, migrated_account.sufficients); + // nonce reset + assert_eq!(migrated_account.nonce, 0); + // decimal adjust + assert_eq!(solo_account.data.free * GWEI, migrated_account.data.free); + // the kton part has been removed. + assert_eq!(migrated_account.data.free_kton_or_misc_frozen, 0); + // the kton part moved to the asset pallet + let asset_account = tester.migration_kton_accounts.get(test_addr).unwrap(); + assert_eq!(asset_account.balance, solo_account.data.free_kton_or_misc_frozen * GWEI); + assert!(!asset_account.is_frozen); + }); +} + +#[test] +fn solo_chain_substrate_account_adjust_with_remaining_balance() { + run_test(|tester| { + let test_addr = "0xfe129f56cc498227acacc4231f70ae15a2f4e8f9ccfa51f4de268c75516fa350"; + + let solo_account = tester.solo_accounts.get(test_addr).unwrap(); + let remaining_balance = tester.solo_remaining_ring.get(test_addr).unwrap(); + assert_ne!(*remaining_balance, 0); + + // after migrate + + let migrated_account = tester.migration_accounts.get(test_addr).unwrap(); + assert_eq!(migrated_account.data.free, solo_account.data.free * GWEI + remaining_balance); + }); +} + +#[test] +fn combine_solo_account_with_para_account() { + run_test(|tester| { + let test_addr = "0x2a997fbf3423723ab73fae76567b320de6979664cb3287c0e6ce24099d0eff68"; + + // solo + let solo_account = tester.solo_accounts.get(test_addr).unwrap(); + let remaining_balance = tester.solo_remaining_ring.get(test_addr).unwrap(); + assert_ne!(solo_account.nonce, 0); + // para + let para_account = tester.para_accounts.get(test_addr).unwrap(); + assert_ne!(para_account.nonce, 0); + + // after migrate + + let migrated_account = tester.migration_accounts.get(test_addr).unwrap(); + assert_eq!( + migrated_account.data.free, + solo_account.data.free * GWEI + remaining_balance + para_account.data.free + ); + // reset the nonce + assert_eq!(migrated_account.nonce, 0); + }); +} + +#[test] +fn evm_account_adjust() { + run_test(|tester| { + let test_addr = "0x64766d3a00000000000000aef71b03670f1c52cd3d8efc2ced3ad68ad91e33f3"; + + let solo_account = tester.solo_accounts.get(test_addr).unwrap(); + assert_ne!(solo_account.nonce, 0); + assert_ne!(solo_account.data.free, 0); + assert_ne!(solo_account.data.free_kton_or_misc_frozen, 0); + let solo_remaining_kton = tester.solo_remaining_kton.get(test_addr).unwrap(); + assert_ne!(*solo_remaining_kton, 0); + + // after migrate + + let migrate_addr = "0xaef71b03670f1c52cd3d8efc2ced3ad68ad91e33"; + let migrated_account = tester.shell_system_accounts.get(migrate_addr).unwrap(); + // nonce doesn't changed. + assert_eq!(migrated_account.nonce, solo_account.nonce); + assert_eq!(migrated_account.consumers, solo_account.consumers); + assert_eq!(migrated_account.providers, solo_account.providers); + // sufficient increase by one because of the asset pallet. + assert_eq!(migrated_account.sufficients, solo_account.sufficients + 1); + assert_eq!(migrated_account.data.free, solo_account.data.free * GWEI); + assert_eq!(migrated_account.data.free_kton_or_misc_frozen, 0); + + // the kton part moved to the asset pallet + let mut asset_account = AssetAccount::default(); + let migrate_addr: [u8; 20] = + hex_n_into_unchecked::<_, _, 20>("0xaef71b03670f1c52cd3d8efc2ced3ad68ad91e33"); + tester.shell_state.get_value( + b"Assets", + b"Account", + &format!( + "{}{}", + blake2_128_concat_to_string(KTON_ID.encode()), + blake2_128_concat_to_string(migrate_addr.encode()), + ), + &mut asset_account, + ); + assert_eq!( + asset_account.balance, + solo_account.data.free_kton_or_misc_frozen * GWEI + solo_remaining_kton + ); + assert!(!asset_account.is_frozen); + }); +} + +#[test] +fn evm_contract_account_adjust_sufficients() { + run_test(|tester| { + let test_addr = "0x64766d3a000000000000000050f880c35c31c13bfd9cbb7d28aafaeca3abd2d0"; + let solo_account = tester.solo_accounts.get(test_addr).unwrap(); + assert_eq!(solo_account.sufficients, 0); + + // after migrated + + let migrate_addr = "0x0050f880c35c31c13bfd9cbb7d28aafaeca3abd2"; + let migrated_account = tester.shell_system_accounts.get(migrate_addr).unwrap(); + assert_eq!(migrated_account.sufficients, 1); + }); +} + +#[test] +fn ring_total_issuance() { + run_test(|tester| { + let mut solo_issuance = u128::default(); + let mut para_issuance = u128::default(); + + tester.solo_state.get_value(b"Balances", b"TotalIssuance", "", &mut solo_issuance); + assert_ne!(solo_issuance, 0); + tester.para_state.get_value(b"Balances", b"TotalIssuance", "", &mut para_issuance); + assert_ne!(para_issuance, 0); + + // after migrate + let mut migrated_total_issuance = u128::default(); + tester.shell_state.get_value( + b"Balances", + b"TotalIssuance", + "", + &mut migrated_total_issuance, + ); + + assert!(migrated_total_issuance - (solo_issuance * GWEI + para_issuance) < 200 * GWEI); + }); +} + +#[test] +fn kton_total_issuance() { + run_test(|tester| { + let mut total_issuance = u128::default(); + tester.solo_state.get_value(b"Kton", b"TotalIssuance", "", &mut total_issuance); + assert_ne!(total_issuance, 0); + + // after migrate + let mut migrated_total_issuance = u128::default(); + tester.shell_state.get_value( + b"Balances", + b"TotalIssuance", + "", + &mut migrated_total_issuance, + ); + + let mut details = AssetDetails::default(); + tester.shell_state.get_value( + b"Assets", + b"Asset", + &blake2_128_concat_to_string(KTON_ID.encode()), + &mut details, + ); + assert!(details.supply - total_issuance * GWEI < 200 * GWEI); + }); +} + +#[test] +fn asset_creation() { + run_test(|tester| { + let mut details = AssetDetails::default(); + tester.shell_state.get_value( + b"Assets", + b"Asset", + &blake2_128_concat_to_string(KTON_ID.encode()), + &mut details, + ); + assert!(details.accounts > 0); + assert!(details.supply != 0); + assert_eq!(details.min_balance, 1); + assert_eq!(details.sufficients, details.accounts); + }); +} + +#[test] +fn asset_metadata() { + run_test(|tester| { + let mut metadata = AssetMetadata::default(); + tester.shell_state.get_value( + b"Assets", + b"Metadata", + &blake2_128_concat_to_string(KTON_ID.encode()), + &mut metadata, + ); + assert_eq!(metadata.decimals, 18); + assert_eq!(metadata.symbol, b"KTON".to_vec()); + assert_eq!(metadata.name, b"Darwinia Commitment Token".to_vec()); + }); +} + +// --- EVM & Ethereum --- + +#[test] +fn evm_code_migrate() { + run_test(|tester| { + { + let test_addr = "0x0050f880c35c31c13bfd9cbb7d28aafaeca3abd2"; + + let code = tester.solo_evm_codes.get(test_addr).unwrap(); + assert_ne!(code.len(), 0); + + // after migrate + + let migrated_code = tester.shell_evm_codes.get(test_addr).unwrap(); + assert_eq!(*code, *migrated_code); + } + + { + assert_eq!(tester.solo_evm_codes, tester.shell_evm_codes); + } + }); +} + +#[test] +fn evm_account_storage_migrate() { + run_test(|tester| { + // https://crab.subscan.io/account/0x0050f880c35c31c13bfd9cbb7d28aafaeca3abd2 + let test_addr: [u8; 20] = + hex_n_into_unchecked::<_, _, 20>("0x0050f880c35c31c13bfd9cbb7d28aafaeca3abd2"); + + let storage_item_len = tester.solo_state.0.iter().fold(0u32, |sum, (k, _)| { + if k.starts_with(&full_key( + b"EVM", + b"AccountStorages", + &blake2_128_concat_to_string(test_addr.encode()), + )) { + sum + 1 + } else { + sum + } + }); + assert_ne!(storage_item_len, 0); + + let storage_key: [u8; 32] = hex_n_into_unchecked::<_, _, 32>( + "0x2093bcd1218dc1519493ee712ddfee3f4ced2d74096331d39d4247147baf17e2", + ); + let mut storage_value = H256::zero(); + tester.solo_state.get_value( + b"EVM", + b"AccountStorages", + &format!( + "{}{}", + &blake2_128_concat_to_string(test_addr.encode()), + &blake2_128_concat_to_string(storage_key), + ), + &mut storage_value, + ); + assert_ne!(storage_value, H256::zero()); + + // after migrate + let migrated_storage_item_len = tester.shell_state.0.iter().fold(0u32, |sum, (k, _)| { + if k.starts_with(&full_key( + b"Evm", + b"AccountStorages", + &blake2_128_concat_to_string(test_addr.encode()), + )) { + sum + 1 + } else { + sum + } + }); + assert_eq!(storage_item_len, migrated_storage_item_len); + + let mut migrated_storage_value = H256::zero(); + tester.shell_state.get_value( + b"Evm", + b"AccountStorages", + &format!( + "{}{}", + &blake2_128_concat_to_string(test_addr.encode()), + &blake2_128_concat_to_string(storage_key), + ), + &mut migrated_storage_value, + ); + assert_eq!(storage_value, migrated_storage_value); + }); +} + +// --- Staking --- + +#[test] +fn bonded_migrate() { + run_test(|tester| { + // https://crab.subscan.io/account/5FxS8ugbXi4WijFuNS45Wg3Z5QsdN8hLZMmo71afoW8hJP67 + let test_addr: [u8; 32] = hex_n_into_unchecked::<_, _, 32>( + "0xac288b0d41a3dcb69b025f51d9ad76ee088339f1c27708e164f9b019c584897d", + ); + + let mut controller = [0u8; 32]; + tester.solo_state.get_value( + b"Staking", + b"Bonded", + &twox64_concat_to_string(test_addr.encode()), + &mut controller, + ); + assert_ne!(controller, [0u8; 32]); + + // after migrate + let mut migrated_controller = [0u8; 32]; + tester.shell_state.get_value( + b"AccountMigration", + b"Bonded", + &twox64_concat_to_string(test_addr.encode()), + &mut migrated_controller, + ); + assert_eq!(migrated_controller, controller); + }); +} + +#[test] +fn deposit_items_migrate() { + run_test(|tester| { + // https://crab.subscan.io/account/5Dfh9agy74KFmdYqxNGEWae9fE9pdzYnyCUJKqK47Ac64zqM + let test_addr: [u8; 32] = hex_n_into_unchecked::<_, _, 32>( + "0x46eb701bdc7f74ffda9c4335d82b3ae8d4e52c5ac630e50d68ab99822e29b3f6", + ); + + let mut ledger = StakingLedger::default(); + tester.solo_state.get_value( + b"Staking", + b"Ledger", + &blake2_128_concat_to_string(test_addr.encode()), + &mut ledger, + ); + assert_ne!(ledger.deposit_items.len(), 0); + let deposits_sum: u128 = ledger.deposit_items.iter().map(|i| i.value).sum(); + + // after migrate + let mut migrated_deposits = Vec::::new(); + tester.shell_state.get_value( + b"AccountMigration", + b"Deposits", + &blake2_128_concat_to_string(test_addr.encode()), + &mut migrated_deposits, + ); + assert_eq!(migrated_deposits.len(), ledger.deposit_items.len()); + ledger.deposit_items.iter().zip(migrated_deposits.iter()).for_each(|(old, new)| { + assert_eq!(new.value, old.value * GWEI); + assert_eq!(new.expired_time, old.expire_time as u128); + assert!(new.in_use); + }); + let migrated_deposits_sum: u128 = migrated_deposits.iter().map(|i| i.value).sum(); + assert_eq!(migrated_deposits_sum, deposits_sum * GWEI); + }); +} + +#[test] +fn ledgers_staked_value_migrate() { + run_test(|tester| { + // https://crab.subscan.io/account/5Dfh9agy74KFmdYqxNGEWae9fE9pdzYnyCUJKqK47Ac64zqM + let test_addr: [u8; 32] = hex_n_into_unchecked::<_, _, 32>( + "0x46eb701bdc7f74ffda9c4335d82b3ae8d4e52c5ac630e50d68ab99822e29b3f6", + ); + + let mut ledger = StakingLedger::default(); + tester.solo_state.get_value( + b"Staking", + b"Ledger", + &blake2_128_concat_to_string(test_addr.encode()), + &mut ledger, + ); + assert_ne!(ledger.active, 0); + assert_ne!(ledger.active_kton, 0); + + // after migrate + let mut migrated_ledger = Ledger::default(); + tester.shell_state.get_value( + b"AccountMigration", + b"Ledgers", + &blake2_128_concat_to_string(test_addr.encode()), + &mut migrated_ledger, + ); + assert_eq!(migrated_ledger.staked_ring, ledger.active * GWEI); + assert_eq!(migrated_ledger.staked_kton, ledger.active_kton * GWEI); + }); +} + +#[test] +fn ledgers_unbondings_migrate() { + run_test(|tester| { + // https://crab.subscan.io/account/5FGL7pMZFZK4zWX2y3CRABeqMpMjBq77LhfYipWoBAT9gJsa + let test_addr: [u8; 32] = hex_n_into_unchecked::<_, _, 32>( + "0x8d92774046fd3dc60d41825023506ad5ad91bd0d66e9c1df325fc3cf89c2d317", + ); + + let mut ledger = StakingLedger::default(); + tester.solo_state.get_value( + b"Staking", + b"Ledger", + &blake2_128_concat_to_string(test_addr.encode()), + &mut ledger, + ); + assert_ne!(ledger.ring_staking_lock.unbondings.len(), 0); + + // after migrate + let mut migrated_ledger = Ledger::default(); + tester.shell_state.get_value( + b"AccountMigration", + b"Ledgers", + &blake2_128_concat_to_string(test_addr.encode()), + &mut migrated_ledger, + ); + ledger + .ring_staking_lock + .unbondings + .iter() + .zip(migrated_ledger.unstaking_ring.iter()) + .for_each(|(old, (amount, util))| { + assert_eq!(*amount, old.amount * GWEI); + assert!(*util < old.until); + }); + }); +} + +#[test] +fn ring_pool_migrate() { + run_test(|tester| { + let mut ring_pool = u128::default(); + tester.solo_state.get_value(b"Staking", b"RingPool", "", &mut ring_pool); + assert_ne!(ring_pool, 0); + + // after migrate + let mut migrated_ring_pool = u128::default(); + tester.shell_state.get_value(b"Staking", b"RingPool", "", &mut migrated_ring_pool); + assert_eq!(migrated_ring_pool, ring_pool * GWEI); + }); +} + +#[test] +fn kton_pool_migrate() { + run_test(|tester| { + let mut kton_pool = u128::default(); + tester.solo_state.get_value(b"Staking", b"KtonPool", "", &mut kton_pool); + assert_ne!(kton_pool, 0); + + // after migrate + let mut migrated_kton_pool = u128::default(); + tester.shell_state.get_value(b"Staking", b"KtonPool", "", &mut migrated_kton_pool); + assert_eq!(migrated_kton_pool, kton_pool * GWEI); + }); +} + +#[test] +fn elapsed_time_migrate() { + run_test(|tester| { + let mut elapsed_time = u64::default(); + tester.solo_state.get_value(b"Staking", b"LivingTime", "", &mut elapsed_time); + assert_ne!(elapsed_time, 0); + + // after migrate + let mut migrated_elapsed_time = u128::default(); + tester.shell_state.get_value(b"Staking", b"ElapsedTime", "", &mut migrated_elapsed_time); + assert_eq!(migrated_elapsed_time, elapsed_time as u128); + }); +} + +// --- Vesting --- +#[test] +fn vesting_info_adjust() { + run_test(|tester| { + // https://crab.subscan.io/account/5EFJA3K6uRfkLxqjhHyrkJoQjfhmhyVyVEG5XtPPBM6yCCxM + let test_addr: [u8; 32] = hex_n_into_unchecked::<_, _, 32>( + "0x608c62275934b164899ca6270c4b89c5d84b2390d4316fda980cd1b3acfad525", + ); + + let mut vesting_info = VestingInfo::default(); + tester.solo_state.get_value( + b"Vesting", + b"Vesting", + &blake2_128_concat_to_string(test_addr.encode()), + &mut vesting_info, + ); + assert_ne!(vesting_info.locked, 0); + assert_ne!(vesting_info.starting_block, 0); + + // after migrate + let mut migrated_vesting_info = VestingInfo::default(); + tester.shell_state.get_value( + b"AccountMigration", + b"Vestings", + &blake2_128_concat_to_string(test_addr.encode()), + &mut migrated_vesting_info, + ); + + assert_eq!(migrated_vesting_info.locked, vesting_info.locked * GWEI); + assert_eq!(migrated_vesting_info.per_block, vesting_info.per_block * GWEI * 2); + assert!(migrated_vesting_info.starting_block < vesting_info.starting_block); + }); +} + +// --- Indices --- + +#[test] +fn indices_adjust_evm_account() { + run_test(|tester| { + // https://crab.subscan.io/account/5ELRpquT7C3mWtjes9CNUiDpW1x3VwQYK7ZWq3kiH91UMftL + let test_addr = "0x64766d3a00000000000000c7912465c55be41bd09325b393f4fbea73f26d473b"; + + let solo_account = tester.solo_accounts.get(test_addr).unwrap(); + let remaining_balance = tester.solo_remaining_ring.get(test_addr).unwrap(); + assert_ne!(solo_account.data.reserved, 0); + + let mut index = ([0u8; 32], 0u128, false); + tester.solo_state.get_value( + b"Indices", + b"Accounts", + &blake2_128_concat_to_string(850_770_432u32.encode()), + &mut index, + ); + + // after migrated + + let migrated_account = "0xc7912465c55be41bd09325b393f4fbea73f26d47"; + let migrated_account = tester.shell_system_accounts.get(migrated_account).unwrap(); + + assert_eq!( + migrated_account.data.free, + (solo_account.data.free + index.1) * GWEI + remaining_balance + ); + assert_eq!(migrated_account.data.reserved, (solo_account.data.reserved - index.1) * GWEI); + }); +} + +#[test] +fn indices_adjust_substrate_account() { + run_test(|tester| { + // https://crab.subscan.io/account/5HgCRABJyoNTd1UsRwzErffZPDDfdYL3b1y3fZpG8hBScHC2 + let test_addr = "0xf83ee607164969887eaecab7e058ab3ba0f64c0cfe3f0b575fe45562cfc36bd5"; + + let solo_account = tester.solo_accounts.get(test_addr).unwrap(); + assert_ne!(solo_account.data.reserved, 0); + + let mut index = ([0u8; 32], 0u128, false); + tester.solo_state.get_value( + b"Indices", + b"Accounts", + &blake2_128_concat_to_string(1u32.encode()), + &mut index, + ); + + // after migrated + let migrated_account = tester.migration_accounts.get(test_addr).unwrap(); + assert_eq!(migrated_account.data.free, (solo_account.data.free + index.1) * GWEI); + assert_eq!(migrated_account.data.reserved, (solo_account.data.reserved - index.1) * GWEI); + }); +} diff --git a/tool/state-processor/src/type_registry.rs b/tool/state-processor/src/type_registry.rs index 2c689d9a5..93898ff7c 100644 --- a/tool/state-processor/src/type_registry.rs +++ b/tool/state-processor/src/type_registry.rs @@ -6,7 +6,7 @@ pub const KTON_ID: u64 = 1026; // https://github.dev/darwinia-network/darwinia-2.0/blob/c9fdfa170501648102bd0137c0437e367e743770/runtime/common/src/gov_origin.rs#L46 pub const ROOT: [u8; 20] = [0x72, 0x6f, 0x6f, 0x74, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; -#[derive(Default, Debug, Encode, Decode)] +#[derive(Default, Debug, PartialEq, Eq, Encode, Decode)] pub struct AccountInfo { pub nonce: u32, pub consumers: u32, @@ -14,7 +14,7 @@ pub struct AccountInfo { pub sufficients: u32, pub data: AccountData, } -#[derive(Default, Debug, Encode, Decode)] +#[derive(Default, Debug, PartialEq, Eq, Encode, Decode)] pub struct AccountData { pub free: u128, pub reserved: u128, @@ -43,7 +43,7 @@ impl Default for Reasons { } // https://github.dev/paritytech/substrate/blob/polkadot-v0.9.30/frame/assets/src/types.rs#L33 -#[derive(Debug, Encode, Decode)] +#[derive(Default, Debug, Encode, Decode)] pub struct AssetDetails { pub owner: [u8; 20], pub issuer: [u8; 20], @@ -60,7 +60,7 @@ pub struct AssetDetails { } // https://github.dev/paritytech/substrate/blob/polkadot-v0.9.30/frame/assets/src/types.rs#L115 -#[derive(Debug, Encode, Decode)] +#[derive(Default, Debug, Encode, Decode)] pub struct AssetAccount { pub balance: u128, pub is_frozen: bool, @@ -80,6 +80,11 @@ pub enum ExistenceReason { #[codec(index = 3)] DepositRefunded, } +impl Default for ExistenceReason { + fn default() -> Self { + ExistenceReason::Sufficient + } +} // https://github.dev/paritytech/substrate/blob/polkadot-v0.9.30/frame/assets/src/types.rs#L73 #[derive(Debug, Encode, Decode)] @@ -89,7 +94,7 @@ pub struct Approval { } // https://github.dev/paritytech/substrate/blob/polkadot-v0.9.30/frame/assets/src/types.rs#L127 -#[derive(Clone, Encode, Decode)] +#[derive(Clone, Default, Encode, Decode)] pub struct AssetMetadata { pub deposit: u128, pub name: Vec, From 114f3fe5eff9f0be1f7bd9cb5943c77061b98fce Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Tue, 3 Jan 2023 11:36:34 +0800 Subject: [PATCH 075/189] Happy new year (#170) * Happy new year * Fix --- .maintain/license-header | 2 +- core/inflation/src/lib.rs | 2 +- core/inflation/src/test.rs | 2 +- core/primitives/src/lib.rs | 2 +- core/types/src/lib.rs | 2 +- node/build.rs | 2 +- node/src/chain_spec/crab.rs | 2 +- node/src/chain_spec/darwinia.rs | 2 +- node/src/chain_spec/mod.rs | 2 +- node/src/chain_spec/pangolin.rs | 2 +- node/src/cli.rs | 2 +- node/src/command.rs | 2 +- node/src/frontier_service.rs | 2 +- node/src/main.rs | 2 +- node/src/rpc.rs | 2 +- node/src/service/executors.rs | 2 +- node/src/service/instant_finalize.rs | 2 +- node/src/service/mod.rs | 2 +- pallet/account-migration/src/lib.rs | 2 +- pallet/account-migration/src/tests.rs | 2 +- pallet/deposit/src/lib.rs | 2 +- pallet/deposit/tests/mock.rs | 2 +- pallet/deposit/tests/tests.rs | 2 +- pallet/message-transact/src/lib.rs | 2 +- pallet/message-transact/src/mock.rs | 2 +- pallet/message-transact/src/tests/eip1559.rs | 2 +- pallet/message-transact/src/tests/eip2930.rs | 2 +- pallet/message-transact/src/tests/legacy.rs | 2 +- pallet/message-transact/src/tests/mod.rs | 2 +- pallet/staking/src/lib.rs | 2 +- pallet/staking/tests/mock.rs | 2 +- pallet/staking/tests/tests.rs | 2 +- precompile/assets/src/lib.rs | 2 +- precompile/assets/src/mock.rs | 2 +- precompile/assets/src/tests.rs | 2 +- precompile/bls12-381/src/lib.rs | 2 +- precompile/deposit/src/lib.rs | 2 +- precompile/deposit/src/mock.rs | 2 +- precompile/deposit/src/tests.rs | 2 +- precompile/staking/src/lib.rs | 2 +- precompile/staking/src/mock.rs | 2 +- precompile/staking/src/tests.rs | 2 +- precompile/state-storage/src/lib.rs | 2 +- precompile/state-storage/src/mock.rs | 2 +- precompile/state-storage/src/tests.rs | 2 +- runtime/common/src/gov_origin.rs | 2 +- runtime/common/src/lib.rs | 2 +- runtime/common/src/xcm_configs.rs | 2 +- runtime/crab/build.rs | 2 +- runtime/crab/src/bridges_message/darwinia.rs | 2 +- runtime/crab/src/bridges_message/mod.rs | 2 +- runtime/crab/src/lib.rs | 2 +- runtime/crab/src/pallets/assets.rs | 2 +- runtime/crab/src/pallets/aura.rs | 2 +- runtime/crab/src/pallets/aura_ext.rs | 2 +- runtime/crab/src/pallets/authorship.rs | 2 +- runtime/crab/src/pallets/balances.rs | 2 +- runtime/crab/src/pallets/base_fee.rs | 2 +- runtime/crab/src/pallets/bridge_dispatch.rs | 2 +- runtime/crab/src/pallets/bridge_grandpa.rs | 2 +- runtime/crab/src/pallets/bridge_messages.rs | 2 +- runtime/crab/src/pallets/bridge_parachains.rs | 2 +- runtime/crab/src/pallets/collective.rs | 2 +- runtime/crab/src/pallets/democracy.rs | 2 +- runtime/crab/src/pallets/deposit.rs | 2 +- runtime/crab/src/pallets/dmp_queue.rs | 2 +- runtime/crab/src/pallets/elections_phragmen.rs | 2 +- runtime/crab/src/pallets/ethereum.rs | 2 +- runtime/crab/src/pallets/evm.rs | 2 +- runtime/crab/src/pallets/fee_market.rs | 2 +- runtime/crab/src/pallets/identity.rs | 2 +- runtime/crab/src/pallets/membership.rs | 2 +- runtime/crab/src/pallets/message_transact.rs | 2 +- runtime/crab/src/pallets/migrate.rs | 2 +- runtime/crab/src/pallets/mod.rs | 2 +- runtime/crab/src/pallets/multisig.rs | 2 +- runtime/crab/src/pallets/parachain_info_.rs | 2 +- runtime/crab/src/pallets/parachain_system.rs | 2 +- runtime/crab/src/pallets/polkadot_xcm.rs | 2 +- runtime/crab/src/pallets/preimage.rs | 2 +- runtime/crab/src/pallets/proxy.rs | 2 +- runtime/crab/src/pallets/scheduler.rs | 2 +- runtime/crab/src/pallets/session.rs | 2 +- runtime/crab/src/pallets/staking.rs | 2 +- runtime/crab/src/pallets/sudo.rs | 2 +- runtime/crab/src/pallets/system.rs | 2 +- runtime/crab/src/pallets/timestamp.rs | 2 +- runtime/crab/src/pallets/tips.rs | 2 +- runtime/crab/src/pallets/transaction_payment.rs | 2 +- runtime/crab/src/pallets/treasury.rs | 2 +- runtime/crab/src/pallets/utility.rs | 2 +- runtime/crab/src/pallets/vesting.rs | 2 +- runtime/crab/src/pallets/xcmp_queue.rs | 2 +- runtime/crab/src/weights/cumulus_pallet_xcmp_queue.rs | 2 +- runtime/crab/src/weights/frame_system.rs | 2 +- runtime/crab/src/weights/mod.rs | 2 +- runtime/crab/src/weights/pallet_balances.rs | 2 +- runtime/crab/src/weights/pallet_session.rs | 2 +- runtime/crab/src/weights/pallet_timestamp.rs | 2 +- runtime/darwinia/build.rs | 2 +- runtime/darwinia/src/bridges_message/crab.rs | 2 +- runtime/darwinia/src/bridges_message/mod.rs | 2 +- runtime/darwinia/src/lib.rs | 2 +- runtime/darwinia/src/pallets/assets.rs | 2 +- runtime/darwinia/src/pallets/aura.rs | 2 +- runtime/darwinia/src/pallets/aura_ext.rs | 2 +- runtime/darwinia/src/pallets/authorship.rs | 2 +- runtime/darwinia/src/pallets/balances.rs | 2 +- runtime/darwinia/src/pallets/base_fee.rs | 2 +- runtime/darwinia/src/pallets/bridge_dispatch.rs | 2 +- runtime/darwinia/src/pallets/bridge_grandpa.rs | 2 +- runtime/darwinia/src/pallets/bridge_messages.rs | 2 +- runtime/darwinia/src/pallets/bridge_parachains.rs | 2 +- runtime/darwinia/src/pallets/collective.rs | 2 +- runtime/darwinia/src/pallets/democracy.rs | 2 +- runtime/darwinia/src/pallets/deposit.rs | 2 +- runtime/darwinia/src/pallets/dmp_queue.rs | 2 +- runtime/darwinia/src/pallets/elections_phragmen.rs | 2 +- runtime/darwinia/src/pallets/ethereum.rs | 2 +- runtime/darwinia/src/pallets/evm.rs | 2 +- runtime/darwinia/src/pallets/fee_market.rs | 2 +- runtime/darwinia/src/pallets/identity.rs | 2 +- runtime/darwinia/src/pallets/membership.rs | 2 +- runtime/darwinia/src/pallets/message_transact.rs | 2 +- runtime/darwinia/src/pallets/migrate.rs | 2 +- runtime/darwinia/src/pallets/mod.rs | 2 +- runtime/darwinia/src/pallets/multisig.rs | 2 +- runtime/darwinia/src/pallets/parachain_info_.rs | 2 +- runtime/darwinia/src/pallets/parachain_system.rs | 2 +- runtime/darwinia/src/pallets/polkadot_xcm.rs | 2 +- runtime/darwinia/src/pallets/preimage.rs | 2 +- runtime/darwinia/src/pallets/proxy.rs | 2 +- runtime/darwinia/src/pallets/scheduler.rs | 2 +- runtime/darwinia/src/pallets/session.rs | 2 +- runtime/darwinia/src/pallets/staking.rs | 2 +- runtime/darwinia/src/pallets/sudo.rs | 2 +- runtime/darwinia/src/pallets/system.rs | 2 +- runtime/darwinia/src/pallets/timestamp.rs | 2 +- runtime/darwinia/src/pallets/tips.rs | 2 +- runtime/darwinia/src/pallets/transaction_payment.rs | 2 +- runtime/darwinia/src/pallets/treasury.rs | 2 +- runtime/darwinia/src/pallets/utility.rs | 2 +- runtime/darwinia/src/pallets/vesting.rs | 2 +- runtime/darwinia/src/pallets/xcmp_queue.rs | 2 +- runtime/darwinia/src/weights/cumulus_pallet_xcmp_queue.rs | 2 +- runtime/darwinia/src/weights/frame_system.rs | 2 +- runtime/darwinia/src/weights/mod.rs | 2 +- runtime/darwinia/src/weights/pallet_balances.rs | 2 +- runtime/darwinia/src/weights/pallet_session.rs | 2 +- runtime/darwinia/src/weights/pallet_timestamp.rs | 2 +- runtime/pangolin/build.rs | 2 +- runtime/pangolin/src/lib.rs | 2 +- runtime/pangolin/src/pallets/assets.rs | 2 +- runtime/pangolin/src/pallets/aura.rs | 2 +- runtime/pangolin/src/pallets/aura_ext.rs | 2 +- runtime/pangolin/src/pallets/authorship.rs | 2 +- runtime/pangolin/src/pallets/balances.rs | 2 +- runtime/pangolin/src/pallets/base_fee.rs | 2 +- runtime/pangolin/src/pallets/collective.rs | 2 +- runtime/pangolin/src/pallets/democracy.rs | 2 +- runtime/pangolin/src/pallets/deposit.rs | 2 +- runtime/pangolin/src/pallets/dmp_queue.rs | 2 +- runtime/pangolin/src/pallets/elections_phragmen.rs | 2 +- runtime/pangolin/src/pallets/ethereum.rs | 2 +- runtime/pangolin/src/pallets/evm.rs | 2 +- runtime/pangolin/src/pallets/identity.rs | 2 +- runtime/pangolin/src/pallets/membership.rs | 2 +- runtime/pangolin/src/pallets/message_transact.rs | 2 +- runtime/pangolin/src/pallets/migrate.rs | 2 +- runtime/pangolin/src/pallets/mod.rs | 2 +- runtime/pangolin/src/pallets/multisig.rs | 2 +- runtime/pangolin/src/pallets/parachain_info_.rs | 2 +- runtime/pangolin/src/pallets/parachain_system.rs | 2 +- runtime/pangolin/src/pallets/polkadot_xcm.rs | 2 +- runtime/pangolin/src/pallets/preimage.rs | 2 +- runtime/pangolin/src/pallets/proxy.rs | 2 +- runtime/pangolin/src/pallets/scheduler.rs | 2 +- runtime/pangolin/src/pallets/session.rs | 2 +- runtime/pangolin/src/pallets/staking.rs | 2 +- runtime/pangolin/src/pallets/sudo.rs | 2 +- runtime/pangolin/src/pallets/system.rs | 2 +- runtime/pangolin/src/pallets/timestamp.rs | 2 +- runtime/pangolin/src/pallets/tips.rs | 2 +- runtime/pangolin/src/pallets/transaction_payment.rs | 2 +- runtime/pangolin/src/pallets/treasury.rs | 2 +- runtime/pangolin/src/pallets/utility.rs | 2 +- runtime/pangolin/src/pallets/vesting.rs | 2 +- runtime/pangolin/src/pallets/xcmp_queue.rs | 2 +- runtime/pangolin/src/weights/cumulus_pallet_xcmp_queue.rs | 2 +- runtime/pangolin/src/weights/frame_system.rs | 2 +- runtime/pangolin/src/weights/mod.rs | 2 +- runtime/pangolin/src/weights/pallet_balances.rs | 2 +- runtime/pangolin/src/weights/pallet_session.rs | 2 +- runtime/pangolin/src/weights/pallet_timestamp.rs | 2 +- 194 files changed, 194 insertions(+), 194 deletions(-) diff --git a/.maintain/license-header b/.maintain/license-header index c89e30c59..16acc9046 100644 --- a/.maintain/license-header +++ b/.maintain/license-header @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/core/inflation/src/lib.rs b/core/inflation/src/lib.rs index bc7858955..328abd65c 100644 --- a/core/inflation/src/lib.rs +++ b/core/inflation/src/lib.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/core/inflation/src/test.rs b/core/inflation/src/test.rs index cb9f057cc..8fff6d4af 100644 --- a/core/inflation/src/test.rs +++ b/core/inflation/src/test.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/core/primitives/src/lib.rs b/core/primitives/src/lib.rs index 6590dcf2e..6b89d621e 100644 --- a/core/primitives/src/lib.rs +++ b/core/primitives/src/lib.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/core/types/src/lib.rs b/core/types/src/lib.rs index 195d2e2d0..8fa7ccc0d 100644 --- a/core/types/src/lib.rs +++ b/core/types/src/lib.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/node/build.rs b/node/build.rs index 5aa5f33a2..ce774bebf 100644 --- a/node/build.rs +++ b/node/build.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/node/src/chain_spec/crab.rs b/node/src/chain_spec/crab.rs index e0d725a2d..88eacdf42 100644 --- a/node/src/chain_spec/crab.rs +++ b/node/src/chain_spec/crab.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/node/src/chain_spec/darwinia.rs b/node/src/chain_spec/darwinia.rs index 5d521aa6e..e8204b747 100644 --- a/node/src/chain_spec/darwinia.rs +++ b/node/src/chain_spec/darwinia.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/node/src/chain_spec/mod.rs b/node/src/chain_spec/mod.rs index 35b7c37d3..bac865f6b 100644 --- a/node/src/chain_spec/mod.rs +++ b/node/src/chain_spec/mod.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/node/src/chain_spec/pangolin.rs b/node/src/chain_spec/pangolin.rs index ce9e28c94..25d1239b8 100644 --- a/node/src/chain_spec/pangolin.rs +++ b/node/src/chain_spec/pangolin.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/node/src/cli.rs b/node/src/cli.rs index 89aeca2a2..085a2a70a 100644 --- a/node/src/cli.rs +++ b/node/src/cli.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/node/src/command.rs b/node/src/command.rs index f7b472b3a..c3488be36 100644 --- a/node/src/command.rs +++ b/node/src/command.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/node/src/frontier_service.rs b/node/src/frontier_service.rs index c2f75a2e6..16ab6bc12 100644 --- a/node/src/frontier_service.rs +++ b/node/src/frontier_service.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/node/src/main.rs b/node/src/main.rs index f9a813ef0..074e4c24f 100644 --- a/node/src/main.rs +++ b/node/src/main.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/node/src/rpc.rs b/node/src/rpc.rs index 638cc8ca2..638eee3e1 100644 --- a/node/src/rpc.rs +++ b/node/src/rpc.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/node/src/service/executors.rs b/node/src/service/executors.rs index d11a4cded..c1a20db53 100644 --- a/node/src/service/executors.rs +++ b/node/src/service/executors.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/node/src/service/instant_finalize.rs b/node/src/service/instant_finalize.rs index 3b7de65d7..2e1ca2a52 100644 --- a/node/src/service/instant_finalize.rs +++ b/node/src/service/instant_finalize.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/node/src/service/mod.rs b/node/src/service/mod.rs index 35f42d160..b9c2bf7a7 100644 --- a/node/src/service/mod.rs +++ b/node/src/service/mod.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/pallet/account-migration/src/lib.rs b/pallet/account-migration/src/lib.rs index de5f4bc48..e9d652445 100644 --- a/pallet/account-migration/src/lib.rs +++ b/pallet/account-migration/src/lib.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/pallet/account-migration/src/tests.rs b/pallet/account-migration/src/tests.rs index 0bc157675..be89f89e3 100644 --- a/pallet/account-migration/src/tests.rs +++ b/pallet/account-migration/src/tests.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/pallet/deposit/src/lib.rs b/pallet/deposit/src/lib.rs index 02de5689d..aa3a8ad84 100644 --- a/pallet/deposit/src/lib.rs +++ b/pallet/deposit/src/lib.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/pallet/deposit/tests/mock.rs b/pallet/deposit/tests/mock.rs index eb346fa1d..e99f1ad9f 100644 --- a/pallet/deposit/tests/mock.rs +++ b/pallet/deposit/tests/mock.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/pallet/deposit/tests/tests.rs b/pallet/deposit/tests/tests.rs index 3b46999b6..4c672489f 100644 --- a/pallet/deposit/tests/tests.rs +++ b/pallet/deposit/tests/tests.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/pallet/message-transact/src/lib.rs b/pallet/message-transact/src/lib.rs index f0b535192..bfefcacfe 100644 --- a/pallet/message-transact/src/lib.rs +++ b/pallet/message-transact/src/lib.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/pallet/message-transact/src/mock.rs b/pallet/message-transact/src/mock.rs index 42935ab8a..58a753df5 100644 --- a/pallet/message-transact/src/mock.rs +++ b/pallet/message-transact/src/mock.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/pallet/message-transact/src/tests/eip1559.rs b/pallet/message-transact/src/tests/eip1559.rs index f326c162e..8247ce601 100644 --- a/pallet/message-transact/src/tests/eip1559.rs +++ b/pallet/message-transact/src/tests/eip1559.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/pallet/message-transact/src/tests/eip2930.rs b/pallet/message-transact/src/tests/eip2930.rs index 2e880b2cc..1bbf012ad 100644 --- a/pallet/message-transact/src/tests/eip2930.rs +++ b/pallet/message-transact/src/tests/eip2930.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/pallet/message-transact/src/tests/legacy.rs b/pallet/message-transact/src/tests/legacy.rs index e6653e5b2..23fd87595 100644 --- a/pallet/message-transact/src/tests/legacy.rs +++ b/pallet/message-transact/src/tests/legacy.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/pallet/message-transact/src/tests/mod.rs b/pallet/message-transact/src/tests/mod.rs index bfd1d22d2..9119ddef2 100644 --- a/pallet/message-transact/src/tests/mod.rs +++ b/pallet/message-transact/src/tests/mod.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/pallet/staking/src/lib.rs b/pallet/staking/src/lib.rs index f9b5e1a9b..3377c43eb 100644 --- a/pallet/staking/src/lib.rs +++ b/pallet/staking/src/lib.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/pallet/staking/tests/mock.rs b/pallet/staking/tests/mock.rs index 0cd35e4f1..695478476 100644 --- a/pallet/staking/tests/mock.rs +++ b/pallet/staking/tests/mock.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/pallet/staking/tests/tests.rs b/pallet/staking/tests/tests.rs index 9cf59111c..8a7c36e61 100644 --- a/pallet/staking/tests/tests.rs +++ b/pallet/staking/tests/tests.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/precompile/assets/src/lib.rs b/precompile/assets/src/lib.rs index 07be5077f..8e14a735f 100644 --- a/precompile/assets/src/lib.rs +++ b/precompile/assets/src/lib.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/precompile/assets/src/mock.rs b/precompile/assets/src/mock.rs index 6f9e38f7c..b594a280c 100644 --- a/precompile/assets/src/mock.rs +++ b/precompile/assets/src/mock.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/precompile/assets/src/tests.rs b/precompile/assets/src/tests.rs index 5b7d4e647..5858987b5 100644 --- a/precompile/assets/src/tests.rs +++ b/precompile/assets/src/tests.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/precompile/bls12-381/src/lib.rs b/precompile/bls12-381/src/lib.rs index 8ac02bbe4..7016a9153 100644 --- a/precompile/bls12-381/src/lib.rs +++ b/precompile/bls12-381/src/lib.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/precompile/deposit/src/lib.rs b/precompile/deposit/src/lib.rs index 9ea8eafec..0e4b6c9e2 100644 --- a/precompile/deposit/src/lib.rs +++ b/precompile/deposit/src/lib.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/precompile/deposit/src/mock.rs b/precompile/deposit/src/mock.rs index 280fa7fef..6fbc0cc5d 100644 --- a/precompile/deposit/src/mock.rs +++ b/precompile/deposit/src/mock.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/precompile/deposit/src/tests.rs b/precompile/deposit/src/tests.rs index 84b837db4..2a2d3f36f 100644 --- a/precompile/deposit/src/tests.rs +++ b/precompile/deposit/src/tests.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/precompile/staking/src/lib.rs b/precompile/staking/src/lib.rs index 6d70e1624..62658ad4e 100644 --- a/precompile/staking/src/lib.rs +++ b/precompile/staking/src/lib.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/precompile/staking/src/mock.rs b/precompile/staking/src/mock.rs index 63f65ad21..879e35dfb 100644 --- a/precompile/staking/src/mock.rs +++ b/precompile/staking/src/mock.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/precompile/staking/src/tests.rs b/precompile/staking/src/tests.rs index 65cebb7ac..af6e625b1 100644 --- a/precompile/staking/src/tests.rs +++ b/precompile/staking/src/tests.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/precompile/state-storage/src/lib.rs b/precompile/state-storage/src/lib.rs index 22c564b5e..5eb34cf30 100644 --- a/precompile/state-storage/src/lib.rs +++ b/precompile/state-storage/src/lib.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/precompile/state-storage/src/mock.rs b/precompile/state-storage/src/mock.rs index 492513528..b080d2ebc 100644 --- a/precompile/state-storage/src/mock.rs +++ b/precompile/state-storage/src/mock.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/precompile/state-storage/src/tests.rs b/precompile/state-storage/src/tests.rs index b73a2b2a2..52241bad2 100644 --- a/precompile/state-storage/src/tests.rs +++ b/precompile/state-storage/src/tests.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/common/src/gov_origin.rs b/runtime/common/src/gov_origin.rs index 78b4f404c..d000b4d5f 100644 --- a/runtime/common/src/gov_origin.rs +++ b/runtime/common/src/gov_origin.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/common/src/lib.rs b/runtime/common/src/lib.rs index 63fbc1757..9f2a3e448 100644 --- a/runtime/common/src/lib.rs +++ b/runtime/common/src/lib.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/common/src/xcm_configs.rs b/runtime/common/src/xcm_configs.rs index 489ff60d0..c60aa7dc9 100644 --- a/runtime/common/src/xcm_configs.rs +++ b/runtime/common/src/xcm_configs.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/crab/build.rs b/runtime/crab/build.rs index e5513c875..4a1101a97 100644 --- a/runtime/crab/build.rs +++ b/runtime/crab/build.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/crab/src/bridges_message/darwinia.rs b/runtime/crab/src/bridges_message/darwinia.rs index 20ea1e71f..f6cfcb873 100644 --- a/runtime/crab/src/bridges_message/darwinia.rs +++ b/runtime/crab/src/bridges_message/darwinia.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/crab/src/bridges_message/mod.rs b/runtime/crab/src/bridges_message/mod.rs index f3c0116ff..9f0804635 100644 --- a/runtime/crab/src/bridges_message/mod.rs +++ b/runtime/crab/src/bridges_message/mod.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/crab/src/lib.rs b/runtime/crab/src/lib.rs index 6e8cdab54..c8fc52b32 100644 --- a/runtime/crab/src/lib.rs +++ b/runtime/crab/src/lib.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/crab/src/pallets/assets.rs b/runtime/crab/src/pallets/assets.rs index a456fa09e..cd21cc493 100644 --- a/runtime/crab/src/pallets/assets.rs +++ b/runtime/crab/src/pallets/assets.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/crab/src/pallets/aura.rs b/runtime/crab/src/pallets/aura.rs index a185eb060..acb41b680 100644 --- a/runtime/crab/src/pallets/aura.rs +++ b/runtime/crab/src/pallets/aura.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/crab/src/pallets/aura_ext.rs b/runtime/crab/src/pallets/aura_ext.rs index 77c924dab..d36000a52 100644 --- a/runtime/crab/src/pallets/aura_ext.rs +++ b/runtime/crab/src/pallets/aura_ext.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/crab/src/pallets/authorship.rs b/runtime/crab/src/pallets/authorship.rs index d2a61afc7..6b92a8a19 100644 --- a/runtime/crab/src/pallets/authorship.rs +++ b/runtime/crab/src/pallets/authorship.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/crab/src/pallets/balances.rs b/runtime/crab/src/pallets/balances.rs index 2dbd63977..94a42eac2 100644 --- a/runtime/crab/src/pallets/balances.rs +++ b/runtime/crab/src/pallets/balances.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/crab/src/pallets/base_fee.rs b/runtime/crab/src/pallets/base_fee.rs index a7807d403..d1da68d2c 100644 --- a/runtime/crab/src/pallets/base_fee.rs +++ b/runtime/crab/src/pallets/base_fee.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/crab/src/pallets/bridge_dispatch.rs b/runtime/crab/src/pallets/bridge_dispatch.rs index 807c64239..8fb3d7a7e 100644 --- a/runtime/crab/src/pallets/bridge_dispatch.rs +++ b/runtime/crab/src/pallets/bridge_dispatch.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/crab/src/pallets/bridge_grandpa.rs b/runtime/crab/src/pallets/bridge_grandpa.rs index 4f342cf79..617528b92 100644 --- a/runtime/crab/src/pallets/bridge_grandpa.rs +++ b/runtime/crab/src/pallets/bridge_grandpa.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/crab/src/pallets/bridge_messages.rs b/runtime/crab/src/pallets/bridge_messages.rs index 3070cf0cd..afeb6ab58 100644 --- a/runtime/crab/src/pallets/bridge_messages.rs +++ b/runtime/crab/src/pallets/bridge_messages.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/crab/src/pallets/bridge_parachains.rs b/runtime/crab/src/pallets/bridge_parachains.rs index 3c0190d20..a5ece216c 100644 --- a/runtime/crab/src/pallets/bridge_parachains.rs +++ b/runtime/crab/src/pallets/bridge_parachains.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/crab/src/pallets/collective.rs b/runtime/crab/src/pallets/collective.rs index 6d4a215a7..7dfbc2623 100644 --- a/runtime/crab/src/pallets/collective.rs +++ b/runtime/crab/src/pallets/collective.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/crab/src/pallets/democracy.rs b/runtime/crab/src/pallets/democracy.rs index a54d9d4f4..b996f322f 100644 --- a/runtime/crab/src/pallets/democracy.rs +++ b/runtime/crab/src/pallets/democracy.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/crab/src/pallets/deposit.rs b/runtime/crab/src/pallets/deposit.rs index c0c7ab85f..2f4082800 100644 --- a/runtime/crab/src/pallets/deposit.rs +++ b/runtime/crab/src/pallets/deposit.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/crab/src/pallets/dmp_queue.rs b/runtime/crab/src/pallets/dmp_queue.rs index 6f0829542..d31b45437 100644 --- a/runtime/crab/src/pallets/dmp_queue.rs +++ b/runtime/crab/src/pallets/dmp_queue.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/crab/src/pallets/elections_phragmen.rs b/runtime/crab/src/pallets/elections_phragmen.rs index f637a0b98..133b89054 100644 --- a/runtime/crab/src/pallets/elections_phragmen.rs +++ b/runtime/crab/src/pallets/elections_phragmen.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/crab/src/pallets/ethereum.rs b/runtime/crab/src/pallets/ethereum.rs index 074feb5ba..8d53d1276 100644 --- a/runtime/crab/src/pallets/ethereum.rs +++ b/runtime/crab/src/pallets/ethereum.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/crab/src/pallets/evm.rs b/runtime/crab/src/pallets/evm.rs index 749bb6be6..9f07703cb 100644 --- a/runtime/crab/src/pallets/evm.rs +++ b/runtime/crab/src/pallets/evm.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/crab/src/pallets/fee_market.rs b/runtime/crab/src/pallets/fee_market.rs index 93f24583e..db790349b 100644 --- a/runtime/crab/src/pallets/fee_market.rs +++ b/runtime/crab/src/pallets/fee_market.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/crab/src/pallets/identity.rs b/runtime/crab/src/pallets/identity.rs index 6ed7cbfd7..b12f0b3a9 100644 --- a/runtime/crab/src/pallets/identity.rs +++ b/runtime/crab/src/pallets/identity.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/crab/src/pallets/membership.rs b/runtime/crab/src/pallets/membership.rs index 2e5c3e9dc..3064d4b5e 100644 --- a/runtime/crab/src/pallets/membership.rs +++ b/runtime/crab/src/pallets/membership.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/crab/src/pallets/message_transact.rs b/runtime/crab/src/pallets/message_transact.rs index 3ab8d65fa..99077281e 100644 --- a/runtime/crab/src/pallets/message_transact.rs +++ b/runtime/crab/src/pallets/message_transact.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/crab/src/pallets/migrate.rs b/runtime/crab/src/pallets/migrate.rs index f2fd2b38b..1797da2ec 100644 --- a/runtime/crab/src/pallets/migrate.rs +++ b/runtime/crab/src/pallets/migrate.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/crab/src/pallets/mod.rs b/runtime/crab/src/pallets/mod.rs index ed2a23a2f..8849eddbb 100644 --- a/runtime/crab/src/pallets/mod.rs +++ b/runtime/crab/src/pallets/mod.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/crab/src/pallets/multisig.rs b/runtime/crab/src/pallets/multisig.rs index 0322271ae..9f4ad225e 100644 --- a/runtime/crab/src/pallets/multisig.rs +++ b/runtime/crab/src/pallets/multisig.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/crab/src/pallets/parachain_info_.rs b/runtime/crab/src/pallets/parachain_info_.rs index ff727f636..aed03fc0e 100644 --- a/runtime/crab/src/pallets/parachain_info_.rs +++ b/runtime/crab/src/pallets/parachain_info_.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/crab/src/pallets/parachain_system.rs b/runtime/crab/src/pallets/parachain_system.rs index a97fd540a..42af96265 100644 --- a/runtime/crab/src/pallets/parachain_system.rs +++ b/runtime/crab/src/pallets/parachain_system.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/crab/src/pallets/polkadot_xcm.rs b/runtime/crab/src/pallets/polkadot_xcm.rs index e2cd39280..9d3dcc7f1 100644 --- a/runtime/crab/src/pallets/polkadot_xcm.rs +++ b/runtime/crab/src/pallets/polkadot_xcm.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/crab/src/pallets/preimage.rs b/runtime/crab/src/pallets/preimage.rs index 69fff06fc..4fa3a5843 100644 --- a/runtime/crab/src/pallets/preimage.rs +++ b/runtime/crab/src/pallets/preimage.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/crab/src/pallets/proxy.rs b/runtime/crab/src/pallets/proxy.rs index 172ea4e89..7f24a7d91 100644 --- a/runtime/crab/src/pallets/proxy.rs +++ b/runtime/crab/src/pallets/proxy.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/crab/src/pallets/scheduler.rs b/runtime/crab/src/pallets/scheduler.rs index 17aded6e8..ea698235d 100644 --- a/runtime/crab/src/pallets/scheduler.rs +++ b/runtime/crab/src/pallets/scheduler.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/crab/src/pallets/session.rs b/runtime/crab/src/pallets/session.rs index 3e16fbf61..b606487ec 100644 --- a/runtime/crab/src/pallets/session.rs +++ b/runtime/crab/src/pallets/session.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/crab/src/pallets/staking.rs b/runtime/crab/src/pallets/staking.rs index b6dc61e3a..cd548aba7 100644 --- a/runtime/crab/src/pallets/staking.rs +++ b/runtime/crab/src/pallets/staking.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/crab/src/pallets/sudo.rs b/runtime/crab/src/pallets/sudo.rs index e66cda23f..fbefaf4c7 100644 --- a/runtime/crab/src/pallets/sudo.rs +++ b/runtime/crab/src/pallets/sudo.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/crab/src/pallets/system.rs b/runtime/crab/src/pallets/system.rs index bb07e9fea..990a59ce1 100644 --- a/runtime/crab/src/pallets/system.rs +++ b/runtime/crab/src/pallets/system.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/crab/src/pallets/timestamp.rs b/runtime/crab/src/pallets/timestamp.rs index 9bf543250..3443326fa 100644 --- a/runtime/crab/src/pallets/timestamp.rs +++ b/runtime/crab/src/pallets/timestamp.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/crab/src/pallets/tips.rs b/runtime/crab/src/pallets/tips.rs index 83f8cfb89..6500a1b3a 100644 --- a/runtime/crab/src/pallets/tips.rs +++ b/runtime/crab/src/pallets/tips.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/crab/src/pallets/transaction_payment.rs b/runtime/crab/src/pallets/transaction_payment.rs index 85b2d11c5..970135a54 100644 --- a/runtime/crab/src/pallets/transaction_payment.rs +++ b/runtime/crab/src/pallets/transaction_payment.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/crab/src/pallets/treasury.rs b/runtime/crab/src/pallets/treasury.rs index 901df24b5..3febca02f 100644 --- a/runtime/crab/src/pallets/treasury.rs +++ b/runtime/crab/src/pallets/treasury.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/crab/src/pallets/utility.rs b/runtime/crab/src/pallets/utility.rs index 8bcc96517..2c0f49ddf 100644 --- a/runtime/crab/src/pallets/utility.rs +++ b/runtime/crab/src/pallets/utility.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/crab/src/pallets/vesting.rs b/runtime/crab/src/pallets/vesting.rs index 406b6956f..0ab19e7ff 100644 --- a/runtime/crab/src/pallets/vesting.rs +++ b/runtime/crab/src/pallets/vesting.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/crab/src/pallets/xcmp_queue.rs b/runtime/crab/src/pallets/xcmp_queue.rs index 24be8be1a..e90975a6c 100644 --- a/runtime/crab/src/pallets/xcmp_queue.rs +++ b/runtime/crab/src/pallets/xcmp_queue.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/crab/src/weights/cumulus_pallet_xcmp_queue.rs b/runtime/crab/src/weights/cumulus_pallet_xcmp_queue.rs index d018169e2..3271b31e4 100644 --- a/runtime/crab/src/weights/cumulus_pallet_xcmp_queue.rs +++ b/runtime/crab/src/weights/cumulus_pallet_xcmp_queue.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/crab/src/weights/frame_system.rs b/runtime/crab/src/weights/frame_system.rs index b074be2fc..2361f7517 100644 --- a/runtime/crab/src/weights/frame_system.rs +++ b/runtime/crab/src/weights/frame_system.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/crab/src/weights/mod.rs b/runtime/crab/src/weights/mod.rs index 5856c3a7f..caf9386da 100644 --- a/runtime/crab/src/weights/mod.rs +++ b/runtime/crab/src/weights/mod.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/crab/src/weights/pallet_balances.rs b/runtime/crab/src/weights/pallet_balances.rs index 830c7c8cb..f7acd35fb 100644 --- a/runtime/crab/src/weights/pallet_balances.rs +++ b/runtime/crab/src/weights/pallet_balances.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/crab/src/weights/pallet_session.rs b/runtime/crab/src/weights/pallet_session.rs index f776ff689..25b1d6d3e 100644 --- a/runtime/crab/src/weights/pallet_session.rs +++ b/runtime/crab/src/weights/pallet_session.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/crab/src/weights/pallet_timestamp.rs b/runtime/crab/src/weights/pallet_timestamp.rs index fba28a6b0..7f420bd5a 100644 --- a/runtime/crab/src/weights/pallet_timestamp.rs +++ b/runtime/crab/src/weights/pallet_timestamp.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/darwinia/build.rs b/runtime/darwinia/build.rs index e5513c875..4a1101a97 100644 --- a/runtime/darwinia/build.rs +++ b/runtime/darwinia/build.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/darwinia/src/bridges_message/crab.rs b/runtime/darwinia/src/bridges_message/crab.rs index b3772962d..174adaf12 100644 --- a/runtime/darwinia/src/bridges_message/crab.rs +++ b/runtime/darwinia/src/bridges_message/crab.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/darwinia/src/bridges_message/mod.rs b/runtime/darwinia/src/bridges_message/mod.rs index fd58eaf04..b50130153 100644 --- a/runtime/darwinia/src/bridges_message/mod.rs +++ b/runtime/darwinia/src/bridges_message/mod.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/darwinia/src/lib.rs b/runtime/darwinia/src/lib.rs index 1afd451c0..f41f17891 100644 --- a/runtime/darwinia/src/lib.rs +++ b/runtime/darwinia/src/lib.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/darwinia/src/pallets/assets.rs b/runtime/darwinia/src/pallets/assets.rs index 7b4fdd01b..5fe0af1ca 100644 --- a/runtime/darwinia/src/pallets/assets.rs +++ b/runtime/darwinia/src/pallets/assets.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/darwinia/src/pallets/aura.rs b/runtime/darwinia/src/pallets/aura.rs index a185eb060..acb41b680 100644 --- a/runtime/darwinia/src/pallets/aura.rs +++ b/runtime/darwinia/src/pallets/aura.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/darwinia/src/pallets/aura_ext.rs b/runtime/darwinia/src/pallets/aura_ext.rs index 77c924dab..d36000a52 100644 --- a/runtime/darwinia/src/pallets/aura_ext.rs +++ b/runtime/darwinia/src/pallets/aura_ext.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/darwinia/src/pallets/authorship.rs b/runtime/darwinia/src/pallets/authorship.rs index d2a61afc7..6b92a8a19 100644 --- a/runtime/darwinia/src/pallets/authorship.rs +++ b/runtime/darwinia/src/pallets/authorship.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/darwinia/src/pallets/balances.rs b/runtime/darwinia/src/pallets/balances.rs index 2dbd63977..94a42eac2 100644 --- a/runtime/darwinia/src/pallets/balances.rs +++ b/runtime/darwinia/src/pallets/balances.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/darwinia/src/pallets/base_fee.rs b/runtime/darwinia/src/pallets/base_fee.rs index a7807d403..d1da68d2c 100644 --- a/runtime/darwinia/src/pallets/base_fee.rs +++ b/runtime/darwinia/src/pallets/base_fee.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/darwinia/src/pallets/bridge_dispatch.rs b/runtime/darwinia/src/pallets/bridge_dispatch.rs index 05e210ceb..978cf7f13 100644 --- a/runtime/darwinia/src/pallets/bridge_dispatch.rs +++ b/runtime/darwinia/src/pallets/bridge_dispatch.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/darwinia/src/pallets/bridge_grandpa.rs b/runtime/darwinia/src/pallets/bridge_grandpa.rs index 65c4edb50..3068ce427 100644 --- a/runtime/darwinia/src/pallets/bridge_grandpa.rs +++ b/runtime/darwinia/src/pallets/bridge_grandpa.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/darwinia/src/pallets/bridge_messages.rs b/runtime/darwinia/src/pallets/bridge_messages.rs index 6cba09dad..c24285a3e 100644 --- a/runtime/darwinia/src/pallets/bridge_messages.rs +++ b/runtime/darwinia/src/pallets/bridge_messages.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/darwinia/src/pallets/bridge_parachains.rs b/runtime/darwinia/src/pallets/bridge_parachains.rs index 810f25788..903590829 100644 --- a/runtime/darwinia/src/pallets/bridge_parachains.rs +++ b/runtime/darwinia/src/pallets/bridge_parachains.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/darwinia/src/pallets/collective.rs b/runtime/darwinia/src/pallets/collective.rs index 6d4a215a7..7dfbc2623 100644 --- a/runtime/darwinia/src/pallets/collective.rs +++ b/runtime/darwinia/src/pallets/collective.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/darwinia/src/pallets/democracy.rs b/runtime/darwinia/src/pallets/democracy.rs index a54d9d4f4..b996f322f 100644 --- a/runtime/darwinia/src/pallets/democracy.rs +++ b/runtime/darwinia/src/pallets/democracy.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/darwinia/src/pallets/deposit.rs b/runtime/darwinia/src/pallets/deposit.rs index 95904729c..34a0f3e5e 100644 --- a/runtime/darwinia/src/pallets/deposit.rs +++ b/runtime/darwinia/src/pallets/deposit.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/darwinia/src/pallets/dmp_queue.rs b/runtime/darwinia/src/pallets/dmp_queue.rs index 6f0829542..d31b45437 100644 --- a/runtime/darwinia/src/pallets/dmp_queue.rs +++ b/runtime/darwinia/src/pallets/dmp_queue.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/darwinia/src/pallets/elections_phragmen.rs b/runtime/darwinia/src/pallets/elections_phragmen.rs index f637a0b98..133b89054 100644 --- a/runtime/darwinia/src/pallets/elections_phragmen.rs +++ b/runtime/darwinia/src/pallets/elections_phragmen.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/darwinia/src/pallets/ethereum.rs b/runtime/darwinia/src/pallets/ethereum.rs index 074feb5ba..8d53d1276 100644 --- a/runtime/darwinia/src/pallets/ethereum.rs +++ b/runtime/darwinia/src/pallets/ethereum.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/darwinia/src/pallets/evm.rs b/runtime/darwinia/src/pallets/evm.rs index 7737ad08a..8578cc1b7 100644 --- a/runtime/darwinia/src/pallets/evm.rs +++ b/runtime/darwinia/src/pallets/evm.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/darwinia/src/pallets/fee_market.rs b/runtime/darwinia/src/pallets/fee_market.rs index a41ae8a8a..d6c60ccb7 100644 --- a/runtime/darwinia/src/pallets/fee_market.rs +++ b/runtime/darwinia/src/pallets/fee_market.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/darwinia/src/pallets/identity.rs b/runtime/darwinia/src/pallets/identity.rs index 6ed7cbfd7..b12f0b3a9 100644 --- a/runtime/darwinia/src/pallets/identity.rs +++ b/runtime/darwinia/src/pallets/identity.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/darwinia/src/pallets/membership.rs b/runtime/darwinia/src/pallets/membership.rs index 2e5c3e9dc..3064d4b5e 100644 --- a/runtime/darwinia/src/pallets/membership.rs +++ b/runtime/darwinia/src/pallets/membership.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/darwinia/src/pallets/message_transact.rs b/runtime/darwinia/src/pallets/message_transact.rs index 3ab8d65fa..99077281e 100644 --- a/runtime/darwinia/src/pallets/message_transact.rs +++ b/runtime/darwinia/src/pallets/message_transact.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/darwinia/src/pallets/migrate.rs b/runtime/darwinia/src/pallets/migrate.rs index f2fd2b38b..1797da2ec 100644 --- a/runtime/darwinia/src/pallets/migrate.rs +++ b/runtime/darwinia/src/pallets/migrate.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/darwinia/src/pallets/mod.rs b/runtime/darwinia/src/pallets/mod.rs index ed2a23a2f..8849eddbb 100644 --- a/runtime/darwinia/src/pallets/mod.rs +++ b/runtime/darwinia/src/pallets/mod.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/darwinia/src/pallets/multisig.rs b/runtime/darwinia/src/pallets/multisig.rs index 0322271ae..9f4ad225e 100644 --- a/runtime/darwinia/src/pallets/multisig.rs +++ b/runtime/darwinia/src/pallets/multisig.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/darwinia/src/pallets/parachain_info_.rs b/runtime/darwinia/src/pallets/parachain_info_.rs index ff727f636..aed03fc0e 100644 --- a/runtime/darwinia/src/pallets/parachain_info_.rs +++ b/runtime/darwinia/src/pallets/parachain_info_.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/darwinia/src/pallets/parachain_system.rs b/runtime/darwinia/src/pallets/parachain_system.rs index a97fd540a..42af96265 100644 --- a/runtime/darwinia/src/pallets/parachain_system.rs +++ b/runtime/darwinia/src/pallets/parachain_system.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/darwinia/src/pallets/polkadot_xcm.rs b/runtime/darwinia/src/pallets/polkadot_xcm.rs index 83478be91..b135b513b 100644 --- a/runtime/darwinia/src/pallets/polkadot_xcm.rs +++ b/runtime/darwinia/src/pallets/polkadot_xcm.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/darwinia/src/pallets/preimage.rs b/runtime/darwinia/src/pallets/preimage.rs index 69fff06fc..4fa3a5843 100644 --- a/runtime/darwinia/src/pallets/preimage.rs +++ b/runtime/darwinia/src/pallets/preimage.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/darwinia/src/pallets/proxy.rs b/runtime/darwinia/src/pallets/proxy.rs index 172ea4e89..7f24a7d91 100644 --- a/runtime/darwinia/src/pallets/proxy.rs +++ b/runtime/darwinia/src/pallets/proxy.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/darwinia/src/pallets/scheduler.rs b/runtime/darwinia/src/pallets/scheduler.rs index 17aded6e8..ea698235d 100644 --- a/runtime/darwinia/src/pallets/scheduler.rs +++ b/runtime/darwinia/src/pallets/scheduler.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/darwinia/src/pallets/session.rs b/runtime/darwinia/src/pallets/session.rs index 3e16fbf61..b606487ec 100644 --- a/runtime/darwinia/src/pallets/session.rs +++ b/runtime/darwinia/src/pallets/session.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/darwinia/src/pallets/staking.rs b/runtime/darwinia/src/pallets/staking.rs index 7db320a45..f247cb021 100644 --- a/runtime/darwinia/src/pallets/staking.rs +++ b/runtime/darwinia/src/pallets/staking.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/darwinia/src/pallets/sudo.rs b/runtime/darwinia/src/pallets/sudo.rs index e66cda23f..fbefaf4c7 100644 --- a/runtime/darwinia/src/pallets/sudo.rs +++ b/runtime/darwinia/src/pallets/sudo.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/darwinia/src/pallets/system.rs b/runtime/darwinia/src/pallets/system.rs index bb07e9fea..990a59ce1 100644 --- a/runtime/darwinia/src/pallets/system.rs +++ b/runtime/darwinia/src/pallets/system.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/darwinia/src/pallets/timestamp.rs b/runtime/darwinia/src/pallets/timestamp.rs index 9bf543250..3443326fa 100644 --- a/runtime/darwinia/src/pallets/timestamp.rs +++ b/runtime/darwinia/src/pallets/timestamp.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/darwinia/src/pallets/tips.rs b/runtime/darwinia/src/pallets/tips.rs index 83f8cfb89..6500a1b3a 100644 --- a/runtime/darwinia/src/pallets/tips.rs +++ b/runtime/darwinia/src/pallets/tips.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/darwinia/src/pallets/transaction_payment.rs b/runtime/darwinia/src/pallets/transaction_payment.rs index 85b2d11c5..970135a54 100644 --- a/runtime/darwinia/src/pallets/transaction_payment.rs +++ b/runtime/darwinia/src/pallets/transaction_payment.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/darwinia/src/pallets/treasury.rs b/runtime/darwinia/src/pallets/treasury.rs index 901df24b5..3febca02f 100644 --- a/runtime/darwinia/src/pallets/treasury.rs +++ b/runtime/darwinia/src/pallets/treasury.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/darwinia/src/pallets/utility.rs b/runtime/darwinia/src/pallets/utility.rs index 8bcc96517..2c0f49ddf 100644 --- a/runtime/darwinia/src/pallets/utility.rs +++ b/runtime/darwinia/src/pallets/utility.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/darwinia/src/pallets/vesting.rs b/runtime/darwinia/src/pallets/vesting.rs index 406b6956f..0ab19e7ff 100644 --- a/runtime/darwinia/src/pallets/vesting.rs +++ b/runtime/darwinia/src/pallets/vesting.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/darwinia/src/pallets/xcmp_queue.rs b/runtime/darwinia/src/pallets/xcmp_queue.rs index 24be8be1a..e90975a6c 100644 --- a/runtime/darwinia/src/pallets/xcmp_queue.rs +++ b/runtime/darwinia/src/pallets/xcmp_queue.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/darwinia/src/weights/cumulus_pallet_xcmp_queue.rs b/runtime/darwinia/src/weights/cumulus_pallet_xcmp_queue.rs index d018169e2..3271b31e4 100644 --- a/runtime/darwinia/src/weights/cumulus_pallet_xcmp_queue.rs +++ b/runtime/darwinia/src/weights/cumulus_pallet_xcmp_queue.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/darwinia/src/weights/frame_system.rs b/runtime/darwinia/src/weights/frame_system.rs index b074be2fc..2361f7517 100644 --- a/runtime/darwinia/src/weights/frame_system.rs +++ b/runtime/darwinia/src/weights/frame_system.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/darwinia/src/weights/mod.rs b/runtime/darwinia/src/weights/mod.rs index 5856c3a7f..caf9386da 100644 --- a/runtime/darwinia/src/weights/mod.rs +++ b/runtime/darwinia/src/weights/mod.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/darwinia/src/weights/pallet_balances.rs b/runtime/darwinia/src/weights/pallet_balances.rs index 830c7c8cb..f7acd35fb 100644 --- a/runtime/darwinia/src/weights/pallet_balances.rs +++ b/runtime/darwinia/src/weights/pallet_balances.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/darwinia/src/weights/pallet_session.rs b/runtime/darwinia/src/weights/pallet_session.rs index f776ff689..25b1d6d3e 100644 --- a/runtime/darwinia/src/weights/pallet_session.rs +++ b/runtime/darwinia/src/weights/pallet_session.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/darwinia/src/weights/pallet_timestamp.rs b/runtime/darwinia/src/weights/pallet_timestamp.rs index fba28a6b0..7f420bd5a 100644 --- a/runtime/darwinia/src/weights/pallet_timestamp.rs +++ b/runtime/darwinia/src/weights/pallet_timestamp.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/pangolin/build.rs b/runtime/pangolin/build.rs index e5513c875..4a1101a97 100644 --- a/runtime/pangolin/build.rs +++ b/runtime/pangolin/build.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/pangolin/src/lib.rs b/runtime/pangolin/src/lib.rs index 74406598d..453796a2b 100644 --- a/runtime/pangolin/src/lib.rs +++ b/runtime/pangolin/src/lib.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/pangolin/src/pallets/assets.rs b/runtime/pangolin/src/pallets/assets.rs index dde186c4a..1102b75dd 100644 --- a/runtime/pangolin/src/pallets/assets.rs +++ b/runtime/pangolin/src/pallets/assets.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/pangolin/src/pallets/aura.rs b/runtime/pangolin/src/pallets/aura.rs index a185eb060..acb41b680 100644 --- a/runtime/pangolin/src/pallets/aura.rs +++ b/runtime/pangolin/src/pallets/aura.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/pangolin/src/pallets/aura_ext.rs b/runtime/pangolin/src/pallets/aura_ext.rs index 77c924dab..d36000a52 100644 --- a/runtime/pangolin/src/pallets/aura_ext.rs +++ b/runtime/pangolin/src/pallets/aura_ext.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/pangolin/src/pallets/authorship.rs b/runtime/pangolin/src/pallets/authorship.rs index d2a61afc7..6b92a8a19 100644 --- a/runtime/pangolin/src/pallets/authorship.rs +++ b/runtime/pangolin/src/pallets/authorship.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/pangolin/src/pallets/balances.rs b/runtime/pangolin/src/pallets/balances.rs index 2dbd63977..94a42eac2 100644 --- a/runtime/pangolin/src/pallets/balances.rs +++ b/runtime/pangolin/src/pallets/balances.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/pangolin/src/pallets/base_fee.rs b/runtime/pangolin/src/pallets/base_fee.rs index a7807d403..d1da68d2c 100644 --- a/runtime/pangolin/src/pallets/base_fee.rs +++ b/runtime/pangolin/src/pallets/base_fee.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/pangolin/src/pallets/collective.rs b/runtime/pangolin/src/pallets/collective.rs index 6d4a215a7..7dfbc2623 100644 --- a/runtime/pangolin/src/pallets/collective.rs +++ b/runtime/pangolin/src/pallets/collective.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/pangolin/src/pallets/democracy.rs b/runtime/pangolin/src/pallets/democracy.rs index a54d9d4f4..b996f322f 100644 --- a/runtime/pangolin/src/pallets/democracy.rs +++ b/runtime/pangolin/src/pallets/democracy.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/pangolin/src/pallets/deposit.rs b/runtime/pangolin/src/pallets/deposit.rs index 5793f7187..2febd939d 100644 --- a/runtime/pangolin/src/pallets/deposit.rs +++ b/runtime/pangolin/src/pallets/deposit.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/pangolin/src/pallets/dmp_queue.rs b/runtime/pangolin/src/pallets/dmp_queue.rs index 6f0829542..d31b45437 100644 --- a/runtime/pangolin/src/pallets/dmp_queue.rs +++ b/runtime/pangolin/src/pallets/dmp_queue.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/pangolin/src/pallets/elections_phragmen.rs b/runtime/pangolin/src/pallets/elections_phragmen.rs index f637a0b98..133b89054 100644 --- a/runtime/pangolin/src/pallets/elections_phragmen.rs +++ b/runtime/pangolin/src/pallets/elections_phragmen.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/pangolin/src/pallets/ethereum.rs b/runtime/pangolin/src/pallets/ethereum.rs index 074feb5ba..8d53d1276 100644 --- a/runtime/pangolin/src/pallets/ethereum.rs +++ b/runtime/pangolin/src/pallets/ethereum.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/pangolin/src/pallets/evm.rs b/runtime/pangolin/src/pallets/evm.rs index f08c57f64..0174f96c2 100644 --- a/runtime/pangolin/src/pallets/evm.rs +++ b/runtime/pangolin/src/pallets/evm.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/pangolin/src/pallets/identity.rs b/runtime/pangolin/src/pallets/identity.rs index 6ed7cbfd7..b12f0b3a9 100644 --- a/runtime/pangolin/src/pallets/identity.rs +++ b/runtime/pangolin/src/pallets/identity.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/pangolin/src/pallets/membership.rs b/runtime/pangolin/src/pallets/membership.rs index 2e5c3e9dc..3064d4b5e 100644 --- a/runtime/pangolin/src/pallets/membership.rs +++ b/runtime/pangolin/src/pallets/membership.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/pangolin/src/pallets/message_transact.rs b/runtime/pangolin/src/pallets/message_transact.rs index 3ab8d65fa..99077281e 100644 --- a/runtime/pangolin/src/pallets/message_transact.rs +++ b/runtime/pangolin/src/pallets/message_transact.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/pangolin/src/pallets/migrate.rs b/runtime/pangolin/src/pallets/migrate.rs index f2fd2b38b..1797da2ec 100644 --- a/runtime/pangolin/src/pallets/migrate.rs +++ b/runtime/pangolin/src/pallets/migrate.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/pangolin/src/pallets/mod.rs b/runtime/pangolin/src/pallets/mod.rs index 8ffa23449..a1a9c5694 100644 --- a/runtime/pangolin/src/pallets/mod.rs +++ b/runtime/pangolin/src/pallets/mod.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/pangolin/src/pallets/multisig.rs b/runtime/pangolin/src/pallets/multisig.rs index 0322271ae..9f4ad225e 100644 --- a/runtime/pangolin/src/pallets/multisig.rs +++ b/runtime/pangolin/src/pallets/multisig.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/pangolin/src/pallets/parachain_info_.rs b/runtime/pangolin/src/pallets/parachain_info_.rs index ff727f636..aed03fc0e 100644 --- a/runtime/pangolin/src/pallets/parachain_info_.rs +++ b/runtime/pangolin/src/pallets/parachain_info_.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/pangolin/src/pallets/parachain_system.rs b/runtime/pangolin/src/pallets/parachain_system.rs index a97fd540a..42af96265 100644 --- a/runtime/pangolin/src/pallets/parachain_system.rs +++ b/runtime/pangolin/src/pallets/parachain_system.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/pangolin/src/pallets/polkadot_xcm.rs b/runtime/pangolin/src/pallets/polkadot_xcm.rs index 0164d8693..528bfc531 100644 --- a/runtime/pangolin/src/pallets/polkadot_xcm.rs +++ b/runtime/pangolin/src/pallets/polkadot_xcm.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/pangolin/src/pallets/preimage.rs b/runtime/pangolin/src/pallets/preimage.rs index 69fff06fc..4fa3a5843 100644 --- a/runtime/pangolin/src/pallets/preimage.rs +++ b/runtime/pangolin/src/pallets/preimage.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/pangolin/src/pallets/proxy.rs b/runtime/pangolin/src/pallets/proxy.rs index 172ea4e89..7f24a7d91 100644 --- a/runtime/pangolin/src/pallets/proxy.rs +++ b/runtime/pangolin/src/pallets/proxy.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/pangolin/src/pallets/scheduler.rs b/runtime/pangolin/src/pallets/scheduler.rs index 17aded6e8..ea698235d 100644 --- a/runtime/pangolin/src/pallets/scheduler.rs +++ b/runtime/pangolin/src/pallets/scheduler.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/pangolin/src/pallets/session.rs b/runtime/pangolin/src/pallets/session.rs index 3e16fbf61..b606487ec 100644 --- a/runtime/pangolin/src/pallets/session.rs +++ b/runtime/pangolin/src/pallets/session.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/pangolin/src/pallets/staking.rs b/runtime/pangolin/src/pallets/staking.rs index d2b40f445..e78df2672 100644 --- a/runtime/pangolin/src/pallets/staking.rs +++ b/runtime/pangolin/src/pallets/staking.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/pangolin/src/pallets/sudo.rs b/runtime/pangolin/src/pallets/sudo.rs index e66cda23f..fbefaf4c7 100644 --- a/runtime/pangolin/src/pallets/sudo.rs +++ b/runtime/pangolin/src/pallets/sudo.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/pangolin/src/pallets/system.rs b/runtime/pangolin/src/pallets/system.rs index bb07e9fea..990a59ce1 100644 --- a/runtime/pangolin/src/pallets/system.rs +++ b/runtime/pangolin/src/pallets/system.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/pangolin/src/pallets/timestamp.rs b/runtime/pangolin/src/pallets/timestamp.rs index 9bf543250..3443326fa 100644 --- a/runtime/pangolin/src/pallets/timestamp.rs +++ b/runtime/pangolin/src/pallets/timestamp.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/pangolin/src/pallets/tips.rs b/runtime/pangolin/src/pallets/tips.rs index 83f8cfb89..6500a1b3a 100644 --- a/runtime/pangolin/src/pallets/tips.rs +++ b/runtime/pangolin/src/pallets/tips.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/pangolin/src/pallets/transaction_payment.rs b/runtime/pangolin/src/pallets/transaction_payment.rs index 85b2d11c5..970135a54 100644 --- a/runtime/pangolin/src/pallets/transaction_payment.rs +++ b/runtime/pangolin/src/pallets/transaction_payment.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/pangolin/src/pallets/treasury.rs b/runtime/pangolin/src/pallets/treasury.rs index 901df24b5..3febca02f 100644 --- a/runtime/pangolin/src/pallets/treasury.rs +++ b/runtime/pangolin/src/pallets/treasury.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/pangolin/src/pallets/utility.rs b/runtime/pangolin/src/pallets/utility.rs index 8bcc96517..2c0f49ddf 100644 --- a/runtime/pangolin/src/pallets/utility.rs +++ b/runtime/pangolin/src/pallets/utility.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/pangolin/src/pallets/vesting.rs b/runtime/pangolin/src/pallets/vesting.rs index 406b6956f..0ab19e7ff 100644 --- a/runtime/pangolin/src/pallets/vesting.rs +++ b/runtime/pangolin/src/pallets/vesting.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/pangolin/src/pallets/xcmp_queue.rs b/runtime/pangolin/src/pallets/xcmp_queue.rs index 24be8be1a..e90975a6c 100644 --- a/runtime/pangolin/src/pallets/xcmp_queue.rs +++ b/runtime/pangolin/src/pallets/xcmp_queue.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/pangolin/src/weights/cumulus_pallet_xcmp_queue.rs b/runtime/pangolin/src/weights/cumulus_pallet_xcmp_queue.rs index d018169e2..3271b31e4 100644 --- a/runtime/pangolin/src/weights/cumulus_pallet_xcmp_queue.rs +++ b/runtime/pangolin/src/weights/cumulus_pallet_xcmp_queue.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/pangolin/src/weights/frame_system.rs b/runtime/pangolin/src/weights/frame_system.rs index b074be2fc..2361f7517 100644 --- a/runtime/pangolin/src/weights/frame_system.rs +++ b/runtime/pangolin/src/weights/frame_system.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/pangolin/src/weights/mod.rs b/runtime/pangolin/src/weights/mod.rs index 5856c3a7f..caf9386da 100644 --- a/runtime/pangolin/src/weights/mod.rs +++ b/runtime/pangolin/src/weights/mod.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/pangolin/src/weights/pallet_balances.rs b/runtime/pangolin/src/weights/pallet_balances.rs index 830c7c8cb..f7acd35fb 100644 --- a/runtime/pangolin/src/weights/pallet_balances.rs +++ b/runtime/pangolin/src/weights/pallet_balances.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/pangolin/src/weights/pallet_session.rs b/runtime/pangolin/src/weights/pallet_session.rs index f776ff689..25b1d6d3e 100644 --- a/runtime/pangolin/src/weights/pallet_session.rs +++ b/runtime/pangolin/src/weights/pallet_session.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify diff --git a/runtime/pangolin/src/weights/pallet_timestamp.rs b/runtime/pangolin/src/weights/pallet_timestamp.rs index fba28a6b0..7f420bd5a 100644 --- a/runtime/pangolin/src/weights/pallet_timestamp.rs +++ b/runtime/pangolin/src/weights/pallet_timestamp.rs @@ -1,6 +1,6 @@ // This file is part of Darwinia. // -// Copyright (C) 2018-2022 Darwinia Network +// Copyright (C) 2018-2023 Darwinia Network // SPDX-License-Identifier: GPL-3.0 // // Darwinia is free software: you can redistribute it and/or modify From 431c1b13b23af14cf1a14ce00f06e6502b788498 Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Wed, 4 Jan 2023 11:35:12 +0800 Subject: [PATCH 076/189] Process proxy and support generic runtime (#172) * Format * Process proxy and support generic runtime * Format * Format * Fixes --- pallet/account-migration/Cargo.toml | 4 +- pallet/account-migration/src/lib.rs | 6 +- pallet/message-transact/Cargo.toml | 12 ++-- runtime/crab/src/lib.rs | 5 +- runtime/darwinia/src/lib.rs | 5 +- runtime/pangolin/src/lib.rs | 5 +- tool/state-processor/src/balances/mod.rs | 2 +- tool/state-processor/src/configuration.rs | 37 +++++++++++ tool/state-processor/src/evm/mod.rs | 2 +- tool/state-processor/src/indices/mod.rs | 2 +- tool/state-processor/src/main.rs | 76 +++++++++++++++-------- tool/state-processor/src/proxy/README.md | 3 + tool/state-processor/src/proxy/mod.rs | 29 +++++++++ tool/state-processor/src/staking/mod.rs | 2 +- tool/state-processor/src/system/mod.rs | 10 +-- tool/state-processor/src/tests.rs | 10 +-- tool/state-processor/src/type_registry.rs | 5 -- tool/state-processor/src/vesting/mod.rs | 2 +- 18 files changed, 147 insertions(+), 70 deletions(-) create mode 100644 tool/state-processor/src/configuration.rs create mode 100644 tool/state-processor/src/proxy/README.md create mode 100644 tool/state-processor/src/proxy/mod.rs diff --git a/pallet/account-migration/Cargo.toml b/pallet/account-migration/Cargo.toml index a993aa93c..db1b78f78 100644 --- a/pallet/account-migration/Cargo.toml +++ b/pallet/account-migration/Cargo.toml @@ -11,8 +11,8 @@ version = "6.0.0" [dependencies] # crates.io -codec = { default-features = false, package = "parity-scale-codec", version = "3.2", features = ["derive"] } -scale-info = { default-features = false, version = "2.3", features = ["derive"] } +codec = { package = "parity-scale-codec", version = "3.2", default-features = false, features = ["derive"] } +scale-info = { version = "2.3", default-features = false, features = ["derive"] } # darwinia darwinia-deposit = { default-features = false, path = "../deposit" } diff --git a/pallet/account-migration/src/lib.rs b/pallet/account-migration/src/lib.rs index e9d652445..c558bf0d9 100644 --- a/pallet/account-migration/src/lib.rs +++ b/pallet/account-migration/src/lib.rs @@ -43,8 +43,6 @@ #![cfg_attr(not(feature = "std"), no_std)] #![deny(missing_docs)] -// TODO: update weight - #[cfg(test)] mod tests; @@ -127,10 +125,10 @@ pub mod pallet { /// [`pallet_asset::AssetAccount`] data. /// /// https://github.dev/paritytech/substrate/blob/polkadot-v0.9.30/frame/assets/src/types.rs#L115 - // The size of `pallet_asset::AssetAccount` is 64 bytes. + // The size of encoded `pallet_asset::AssetAccount` is 18 bytes. #[pallet::storage] #[pallet::getter(fn kton_account_of)] - pub type KtonAccounts = StorageMap<_, Blake2_128Concat, AccountId32, [u8; 64]>; + pub type KtonAccounts = StorageMap<_, Blake2_128Concat, AccountId32, [u8; 18]>; /// [`pallet_vesting::Vesting`] data. /// diff --git a/pallet/message-transact/Cargo.toml b/pallet/message-transact/Cargo.toml index a8bc117f1..5c535e409 100644 --- a/pallet/message-transact/Cargo.toml +++ b/pallet/message-transact/Cargo.toml @@ -11,9 +11,9 @@ version = "6.0.0" [dependencies] # crates.io -codec = { default-features = false, package = "parity-scale-codec", version = "3.2.1", features = ["derive"] } -ethereum = { default-features = false, version = "0.12.0", features = ["with-codec"] } -scale-info = { default-features = false, version = "2.3.0", features = ["derive"] } +codec = { package = "parity-scale-codec", version = "3.2.1", default-features = false, features = ["derive"] } +ethereum = { version = "0.12.0", default-features = false, features = ["with-codec"] } +scale-info = { version = "2.3.0", default-features = false, features = ["derive"] } # frontier fp-ethereum = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } @@ -31,22 +31,22 @@ sp-std = { default-features = false, git = "https://github.com/paritytech array-bytes = { version = "4.1" } libsecp256k1 = { version = "0.5", features = ["static-context", "hmac"] } rlp = { version = "0.5" } -sha3 = { version = "0.9" } +sha3 = { version = "0.9" } # darwinia -pallet-bridge-dispatch = { git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } bp-message-dispatch = { git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } bp-runtime = { git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } +pallet-bridge-dispatch = { git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } # frontier fp-self-contained = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +pallet-ethereum = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } # moonbeam precompile-utils = { git = "https://github.com/darwinia-network/moonbeam.git", branch = "polkadot-v0.9.30", features = ["testing"] } # substrate pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-ethereum = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } diff --git a/runtime/crab/src/lib.rs b/runtime/crab/src/lib.rs index c8fc52b32..faa76b12a 100644 --- a/runtime/crab/src/lib.rs +++ b/runtime/crab/src/lib.rs @@ -52,15 +52,12 @@ use frame_support::{ }; use frame_system::EnsureRoot; use sp_core::{crypto::KeyTypeId, OpaqueMetadata, H160, H256, U256}; -#[cfg(any(feature = "std", test))] -pub use sp_runtime::BuildStorage; use sp_runtime::{ generic, traits::Block as BlockT, transaction_validity::{TransactionSource, TransactionValidity}, - ApplyExtrinsicResult, + ApplyExtrinsicResult, Perbill, Permill, }; -pub use sp_runtime::{MultiAddress, Perbill, Permill}; use sp_std::prelude::*; #[cfg(feature = "std")] use sp_version::NativeVersion; diff --git a/runtime/darwinia/src/lib.rs b/runtime/darwinia/src/lib.rs index f41f17891..2347a540b 100644 --- a/runtime/darwinia/src/lib.rs +++ b/runtime/darwinia/src/lib.rs @@ -52,15 +52,12 @@ use frame_support::{ }; use frame_system::EnsureRoot; use sp_core::{crypto::KeyTypeId, OpaqueMetadata, H160, H256, U256}; -#[cfg(any(feature = "std", test))] -pub use sp_runtime::BuildStorage; use sp_runtime::{ generic, traits::Block as BlockT, transaction_validity::{TransactionSource, TransactionValidity}, - ApplyExtrinsicResult, + ApplyExtrinsicResult, MultiAddress, Perbill, Permill, }; -pub use sp_runtime::{MultiAddress, Perbill, Permill}; use sp_std::prelude::*; #[cfg(feature = "std")] use sp_version::NativeVersion; diff --git a/runtime/pangolin/src/lib.rs b/runtime/pangolin/src/lib.rs index 453796a2b..dc6fd927a 100644 --- a/runtime/pangolin/src/lib.rs +++ b/runtime/pangolin/src/lib.rs @@ -49,15 +49,12 @@ use frame_support::{ }; use frame_system::EnsureRoot; use sp_core::{crypto::KeyTypeId, OpaqueMetadata, H160, H256, U256}; -#[cfg(any(feature = "std", test))] -pub use sp_runtime::BuildStorage; use sp_runtime::{ generic, traits::Block as BlockT, transaction_validity::{TransactionSource, TransactionValidity}, - ApplyExtrinsicResult, + ApplyExtrinsicResult, Perbill, Permill, }; -pub use sp_runtime::{MultiAddress, Perbill, Permill}; use sp_std::prelude::*; #[cfg(feature = "std")] use sp_version::NativeVersion; diff --git a/tool/state-processor/src/balances/mod.rs b/tool/state-processor/src/balances/mod.rs index ae5f0d075..83328bdcb 100644 --- a/tool/state-processor/src/balances/mod.rs +++ b/tool/state-processor/src/balances/mod.rs @@ -3,7 +3,7 @@ use crate::*; type Locks = Vec; -impl Processor { +impl Processor { pub fn process_balances(&mut self) -> (u128, u128) { // Balances storage items. // https://github.dev/darwinia-network/substrate/blob/darwinia-v0.12.5/frame/balances/src/lib.rs#L486 diff --git a/tool/state-processor/src/configuration.rs b/tool/state-processor/src/configuration.rs new file mode 100644 index 000000000..f02e49d52 --- /dev/null +++ b/tool/state-processor/src/configuration.rs @@ -0,0 +1,37 @@ +pub const GWEI: u128 = 1_000_000_000; +pub const KTON_ID: u64 = 1026; +// https://github.dev/darwinia-network/darwinia-2.0/blob/c9fdfa170501648102bd0137c0437e367e743770/runtime/common/src/gov_origin.rs#L46 +pub const ROOT: [u8; 20] = [0x72, 0x6f, 0x6f, 0x74, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; + +pub trait Configurable { + const NAME: &'static str; + + const KTON_NAME: &'static [u8]; + const KTON_SYMBOL: &'static [u8]; +} +impl Configurable for () { + const KTON_NAME: &'static [u8] = b""; + const KTON_SYMBOL: &'static [u8] = b""; + const NAME: &'static str = ""; +} + +pub struct Darwinia; +impl Configurable for Darwinia { + const KTON_NAME: &'static [u8] = b"Darwinia Commitment Token"; + const KTON_SYMBOL: &'static [u8] = b"KTON"; + const NAME: &'static str = "darwinia"; +} + +pub struct Crab; +impl Configurable for Crab { + const KTON_NAME: &'static [u8] = b"Crab Commitment Token"; + const KTON_SYMBOL: &'static [u8] = b"CKTON"; + const NAME: &'static str = "crab"; +} + +pub struct Pangolin; +impl Configurable for Pangolin { + const KTON_NAME: &'static [u8] = b"Pangolin Commitment Token"; + const KTON_SYMBOL: &'static [u8] = b"PKTON"; + const NAME: &'static str = "pangolin"; +} diff --git a/tool/state-processor/src/evm/mod.rs b/tool/state-processor/src/evm/mod.rs index db5fb61ed..c222179aa 100644 --- a/tool/state-processor/src/evm/mod.rs +++ b/tool/state-processor/src/evm/mod.rs @@ -4,7 +4,7 @@ use crate::*; // https://github.dev/paritytech/frontier/blob/polkadot-v0.9.30/primitives/storage/src/lib.rs#L23 const PALLET_ETHEREUM_SCHEMA: &str = "0x3a657468657265756d5f736368656d61"; -impl Processor { +impl Processor { fn process_ethereum_schema(&mut self) -> &mut Self { log::info!("set `PALLET_ETHEREUM_SCHEMA`"); self.shell_state.insert_raw_key_raw_value(PALLET_ETHEREUM_SCHEMA.into(), "0x3".into()); diff --git a/tool/state-processor/src/indices/mod.rs b/tool/state-processor/src/indices/mod.rs index 499e401a4..c9222fed1 100644 --- a/tool/state-processor/src/indices/mod.rs +++ b/tool/state-processor/src/indices/mod.rs @@ -1,7 +1,7 @@ // darwinia use crate::*; -impl Processor { +impl Processor { pub fn process_indices(&mut self) -> &mut Self { // Storage items. // https://github.dev/darwinia-network/substrate/blob/darwinia-v0.12.5/frame/indices/src/lib.rs#L291 diff --git a/tool/state-processor/src/main.rs b/tool/state-processor/src/main.rs index 19c3c751f..3b8d0eeba 100644 --- a/tool/state-processor/src/main.rs +++ b/tool/state-processor/src/main.rs @@ -1,12 +1,15 @@ mod balances; mod evm; mod indices; +mod proxy; mod staking; mod system; mod vesting; mod adjust; use adjust::*; +mod configuration; +use configuration::*; mod type_registry; use type_registry::*; @@ -19,6 +22,7 @@ use std::{ env, fs::File, io::{Read, Write}, + marker::PhantomData, mem, sync::RwLock, }; @@ -39,25 +43,32 @@ fn main() -> Result<()> { env::set_var("RUST_LOG", "state_processor"); pretty_env_logger::init(); - Processor::new()?.process()?; + >::new()?.process()?; Ok(()) } -struct Processor { - solo_state: State, - para_state: State, - shell_state: State, +struct Processor { + solo_state: State, + para_state: State<()>, + shell_state: State<()>, shell_chain_spec: ChainSpec, } -impl Processor { +impl Processor +where + S: Configurable, +{ fn new() -> Result { - let mut shell_chain_spec = from_file::("test-data/shell.json")?; + let mut shell_chain_spec = + from_file::(&format!("test-data/{}-shell.json", S::NAME))?; Ok(Self { - solo_state: State::from_file("test-data/solo.json")?, - para_state: State::from_file("test-data/para.json")?, - shell_state: State(mem::take(&mut shell_chain_spec.genesis.raw.top)), + solo_state: State::from_file(&format!("test-data/{}-solo.json", S::NAME))?, + para_state: State::from_file(&format!("test-data/{}-para.json", S::NAME))?, + shell_state: State { + map: mem::take(&mut shell_chain_spec.genesis.raw.top), + _runtime: Default::default(), + }, shell_chain_spec, }) } @@ -69,7 +80,12 @@ impl Processor { assert!(*_guard != 0); - self.process_system().process_indices().process_vesting().process_staking().process_evm(); + self.process_system() + .process_indices() + .process_vesting() + .process_proxy() + .process_staking() + .process_evm(); self.save() } @@ -77,9 +93,9 @@ impl Processor { fn save(mut self) -> Result<()> { log::info!("saving processed chain spec"); - mem::swap(&mut self.shell_state.0, &mut self.shell_chain_spec.genesis.raw.top); + mem::swap(&mut self.shell_state.map, &mut self.shell_chain_spec.genesis.raw.top); - let mut f = File::create("test-data/processed.json")?; + let mut f = File::create(format!("test-data/{}-processed.json", S::NAME))?; let v = serde_json::to_vec(&self.shell_chain_spec)?; f.write_all(&v)?; @@ -88,14 +104,20 @@ impl Processor { } } -pub struct State(Map); -impl State { +pub struct State { + map: Map, + _runtime: PhantomData, +} +impl State { fn from_file(path: &str) -> Result { - Ok(Self(from_file::(path)?.genesis.raw.top)) + Ok(Self { + map: from_file::(path)?.genesis.raw.top, + _runtime: >::default(), + }) } fn insert_raw_key_raw_value(&mut self, key: String, value: String) -> &mut Self { - self.0.insert(key, value); + self.map.insert(key, value); self } @@ -104,7 +126,7 @@ impl State { where E: Encode, { - self.0.insert(key, encode_value(value)); + self.map.insert(key, encode_value(value)); self } @@ -118,7 +140,7 @@ impl State { where F: Fn(&str, &str) -> String, { - self.0.retain(|k, v| { + self.map.retain(|k, v| { if k.starts_with(prefix) { buffer.insert(process_key(k, prefix), v.to_owned()); @@ -133,11 +155,11 @@ impl State { fn insert_raw_key_map(&mut self, pairs: Map) -> &mut Self { pairs.into_iter().for_each(|(k, v)| { - if self.0.contains_key(&k) { + if self.map.contains_key(&k) { log::error!("key({k}) has already existed, overriding"); } - self.0.insert(k, v); + self.map.insert(k, v); }); self @@ -149,7 +171,7 @@ impl State { { let key = full_key(pallet, item, hash); - if let Some(v) = self.0.get(&key) { + if let Some(v) = self.map.get(&key) { match decode(v) { Ok(v) => *value = v, Err(e) => log::error!( @@ -175,7 +197,7 @@ impl State { { let key = full_key(pallet, item, hash); - if let Some(v) = self.0.remove(&key) { + if let Some(v) = self.map.remove(&key) { match decode(&v) { Ok(v) => *value = v, Err(e) => log::error!( @@ -199,7 +221,7 @@ impl State { where E: Encode, { - self.0.insert(full_key(pallet, item, hash), encode_value(value)); + self.map.insert(full_key(pallet, item, hash), encode_value(value)); self } @@ -234,7 +256,7 @@ impl State { let len = buffer.len(); let prefix = item_key(pallet, item); - self.0.retain(|full_key, v| { + self.map.retain(|full_key, v| { if full_key.starts_with(&prefix) { match decode(v) { Ok(v) => { @@ -266,14 +288,14 @@ impl State { F: Fn(&str) -> String, { pairs.into_iter().for_each(|(k, v)| { - self.0.insert(process_key(&k), encode_value(v)); + self.map.insert(process_key(&k), encode_value(v)); }); self } fn contains_key(&self, key: &str) -> bool { - self.0.contains_key(key) + self.map.contains_key(key) } // fn inc_consumers(&mut self, who: &str) {} diff --git a/tool/state-processor/src/proxy/README.md b/tool/state-processor/src/proxy/README.md new file mode 100644 index 000000000..2a700b22d --- /dev/null +++ b/tool/state-processor/src/proxy/README.md @@ -0,0 +1,3 @@ +### Process steps +- take solo `Proxy::Proxies` +- adjust the reserved's decimals then free solo `Proxies` reservations diff --git a/tool/state-processor/src/proxy/mod.rs b/tool/state-processor/src/proxy/mod.rs new file mode 100644 index 000000000..e64ec7769 --- /dev/null +++ b/tool/state-processor/src/proxy/mod.rs @@ -0,0 +1,29 @@ +// darwinia +use crate::*; + +impl Processor { + pub fn process_proxy(&mut self) -> &mut Self { + // Storage items. + // https://github.dev/darwinia-network/substrate/blob/darwinia-v0.12.5/frame/proxy/src/lib.rs#L599 + // Skip the `Announcements`. + // Need to make sure the storage is empty. + // + // The size of encoded `pallet_proxy::ProxyDefinition` is 37 bytes. + let mut proxies = , u128)>>::default(); + + log::info!("take solo `Proxy::Proxies`"); + self.solo_state.take_map(b"Proxy", b"Proxies", &mut proxies, get_identity_key); + + // https://github.dev/darwinia-network/substrate/blob/darwinia-v0.12.5/frame/proxy/src/lib.rs#L735 + log::info!("adjust the reserved's decimals then free solo `Proxies` reservations"); + proxies.into_iter().for_each(|(a, (_, mut v))| { + v.adjust(); + self.shell_state.unreserve(array_bytes::hex2bytes_unchecked(get_last_64(&a)), v); + }); + + // Skip the parachain part. + // Need to make sure the storage is empty. + + self + } +} diff --git a/tool/state-processor/src/staking/mod.rs b/tool/state-processor/src/staking/mod.rs index bf2a09968..f4060b4bd 100644 --- a/tool/state-processor/src/staking/mod.rs +++ b/tool/state-processor/src/staking/mod.rs @@ -1,7 +1,7 @@ // darwinia use crate::*; -impl Processor { +impl Processor { pub fn process_staking(&mut self) -> &mut Self { // Storage items. // https://github.dev/darwinia-network/darwinia-common/blob/darwinia-v0.12.5/frame/staking/src/lib.rs#L560 diff --git a/tool/state-processor/src/system/mod.rs b/tool/state-processor/src/system/mod.rs index 6ece1ef31..4b5309d8e 100644 --- a/tool/state-processor/src/system/mod.rs +++ b/tool/state-processor/src/system/mod.rs @@ -15,7 +15,10 @@ pub struct AccountAll { pub kton_locks: Vec, } -impl Processor { +impl Processor +where + S: Configurable, +{ pub fn process_system(&mut self) -> &mut Self { // System storage items. // https://github.dev/darwinia-network/substrate/blob/darwinia-v0.12.5/frame/system/src/lib.rs#L545 @@ -185,9 +188,8 @@ impl Processor { &blake2_128_concat_to_string(KTON_ID.encode()), AssetMetadata { deposit: 0, - // TODO: different runtime - name: b"Darwinia Commitment Token".to_vec(), - symbol: b"KTON".to_vec(), + name: S::KTON_NAME.to_vec(), + symbol: S::KTON_SYMBOL.to_vec(), decimals: 18, is_frozen: false, }, diff --git a/tool/state-processor/src/tests.rs b/tool/state-processor/src/tests.rs index eb60d8a9f..7201a8fec 100644 --- a/tool/state-processor/src/tests.rs +++ b/tool/state-processor/src/tests.rs @@ -19,9 +19,9 @@ struct Tester { shell_system_accounts: Map, shell_evm_codes: Map>, - solo_state: State, - para_state: State, - shell_state: State, + solo_state: State, + para_state: State<()>, + shell_state: State<()>, } fn get_last_64(key: &str, _: &str) -> String { @@ -358,7 +358,7 @@ fn evm_account_storage_migrate() { let test_addr: [u8; 20] = hex_n_into_unchecked::<_, _, 20>("0x0050f880c35c31c13bfd9cbb7d28aafaeca3abd2"); - let storage_item_len = tester.solo_state.0.iter().fold(0u32, |sum, (k, _)| { + let storage_item_len = tester.solo_state.map.iter().fold(0u32, |sum, (k, _)| { if k.starts_with(&full_key( b"EVM", b"AccountStorages", @@ -388,7 +388,7 @@ fn evm_account_storage_migrate() { assert_ne!(storage_value, H256::zero()); // after migrate - let migrated_storage_item_len = tester.shell_state.0.iter().fold(0u32, |sum, (k, _)| { + let migrated_storage_item_len = tester.shell_state.map.iter().fold(0u32, |sum, (k, _)| { if k.starts_with(&full_key( b"Evm", b"AccountStorages", diff --git a/tool/state-processor/src/type_registry.rs b/tool/state-processor/src/type_registry.rs index 93898ff7c..d2c2d459b 100644 --- a/tool/state-processor/src/type_registry.rs +++ b/tool/state-processor/src/type_registry.rs @@ -1,11 +1,6 @@ // crates.io use parity_scale_codec::{Decode, Encode}; -pub const GWEI: u128 = 1_000_000_000; -pub const KTON_ID: u64 = 1026; -// https://github.dev/darwinia-network/darwinia-2.0/blob/c9fdfa170501648102bd0137c0437e367e743770/runtime/common/src/gov_origin.rs#L46 -pub const ROOT: [u8; 20] = [0x72, 0x6f, 0x6f, 0x74, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; - #[derive(Default, Debug, PartialEq, Eq, Encode, Decode)] pub struct AccountInfo { pub nonce: u32, diff --git a/tool/state-processor/src/vesting/mod.rs b/tool/state-processor/src/vesting/mod.rs index 5a49b8dd6..d0d72a361 100644 --- a/tool/state-processor/src/vesting/mod.rs +++ b/tool/state-processor/src/vesting/mod.rs @@ -1,7 +1,7 @@ // darwinia use crate::*; -impl Processor { +impl Processor { pub fn process_vesting(&mut self) -> &mut Self { // Storage items. // https://github.dev/darwinia-network/substrate/blob/darwinia-v0.12.5/frame/vesting/src/lib.rs#L188 From 015eed1796b1d34f95a74ae8552a55fabf231517 Mon Sep 17 00:00:00 2001 From: Guantong Date: Wed, 4 Jan 2023 13:12:25 +0800 Subject: [PATCH 077/189] Adjust XCM trader (#143) * init LocalAssetTrader * LocalAssetTrader * Update trader for pangolin & crab * format * Update comments * Update logs * format * Format * Simplify code Co-authored-by: fisher Co-authored-by: Xavier Lau --- Cargo.lock | 2 + runtime/common/Cargo.toml | 14 +-- runtime/common/src/xcm_configs.rs | 94 ++++++++++++++++++-- runtime/crab/src/pallets/polkadot_xcm.rs | 26 +++++- runtime/darwinia/src/pallets/polkadot_xcm.rs | 26 +++++- runtime/pangolin/src/pallets/mod.rs | 1 + runtime/pangolin/src/pallets/polkadot_xcm.rs | 26 +++++- 7 files changed, 167 insertions(+), 22 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8c5b6a8c3..75c4a101b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2333,8 +2333,10 @@ dependencies = [ "pallet-collective", "parity-scale-codec", "sp-io", + "sp-runtime", "sp-std", "xcm", + "xcm-builder", "xcm-executor", ] diff --git a/runtime/common/Cargo.toml b/runtime/common/Cargo.toml index 9815fc937..6a8206c45 100644 --- a/runtime/common/Cargo.toml +++ b/runtime/common/Cargo.toml @@ -24,14 +24,16 @@ account = { default-features = false, git = "https://github.com/darwinia-network # polkadot xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" } +xcm-builder = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" } xcm-executor = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" } # substrate -frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-collective = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-io = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-collective = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-io = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } [features] default = ["std"] @@ -47,6 +49,7 @@ std = [ # polkadot "xcm/std", + "xcm-builder/std", "xcm-executor/std", # substrate @@ -54,5 +57,6 @@ std = [ "frame-system/std", "pallet-collective/std", "sp-io/std", + "sp-runtime/std", "sp-std/std", ] diff --git a/runtime/common/src/xcm_configs.rs b/runtime/common/src/xcm_configs.rs index c60aa7dc9..9c690a3d8 100644 --- a/runtime/common/src/xcm_configs.rs +++ b/runtime/common/src/xcm_configs.rs @@ -23,12 +23,23 @@ use codec::Encode; // darwinia use dc_primitives::GWEI; // polkadot -use xcm::latest::{prelude::*, Weight as XCMWeight}; -use xcm_executor::traits::{Convert, ShouldExecute}; +use xcm::latest::{prelude::*, Weight as XcmWeight}; +use xcm_builder::TakeRevenue; +use xcm_executor::{ + traits::{Convert, ShouldExecute, WeightTrader}, + Assets, +}; // substrate -use frame_support::{log, traits::ConstU128}; +use frame_support::{ + log, + traits::{ + tokens::currency::Currency as CurrencyT, ConstU128, Get, OnUnbalanced as OnUnbalancedT, + }, + weights::{Weight, WeightToFee as WeightToFeeT}, +}; use sp_io::hashing::blake2_256; -use sp_std::borrow::Borrow; +use sp_runtime::traits::{SaturatedConversion, Saturating, Zero}; +use sp_std::{borrow::Borrow, result::Result}; /// Base balance required for the XCM unit weight. pub type XcmBaseWeightFee = ConstU128; @@ -60,8 +71,8 @@ where fn should_execute( origin: &MultiLocation, message: &mut Xcm, - max_weight: XCMWeight, - weight_credit: &mut XCMWeight, + max_weight: XcmWeight, + weight_credit: &mut XcmWeight, ) -> Result<(), ()> { Deny::should_execute(origin, message, max_weight, weight_credit)?; Allow::should_execute(origin, message, max_weight, weight_credit) @@ -75,8 +86,8 @@ impl ShouldExecute for DenyReserveTransferToRelayChain { origin: &MultiLocation, message: &mut Xcm, - _max_weight: XCMWeight, - _weight_credit: &mut XCMWeight, + _max_weight: XcmWeight, + _weight_credit: &mut XcmWeight, ) -> Result<(), ()> { if message.0.iter().any(|inst| { matches!( @@ -126,3 +137,70 @@ impl + Into<[u8; 20]> + Clone> Convert, + AssetId: Get, + AccountId, + Currency: CurrencyT, + OnUnbalanced: OnUnbalancedT, + R: TakeRevenue, +>( + XcmWeight, + Currency::Balance, + PhantomData<(WeightToFee, AssetId, AccountId, Currency, OnUnbalanced, R)>, +); +impl< + WeightToFee: WeightToFeeT, + AssetId: Get, + AccountId, + Currency: CurrencyT, + OnUnbalanced: OnUnbalancedT, + R: TakeRevenue, + > WeightTrader for LocalAssetTrader +{ + fn new() -> Self { + Self(0, Zero::zero(), PhantomData) + } + + fn buy_weight(&mut self, weight: XcmWeight, payment: Assets) -> Result { + log::trace!(target: "xcm::weight", "LocalAssetTrader::buy_weight weight: {:?}, payment: {:?}", weight, payment); + let amount = WeightToFee::weight_to_fee(&Weight::from_ref_time(weight)); + let u128_amount: u128 = amount.try_into().map_err(|_| XcmError::Overflow)?; + let required: MultiAsset = (Concrete(AssetId::get()), u128_amount).into(); + let unused = payment.checked_sub(required.clone()).map_err(|_| XcmError::TooExpensive)?; + self.0 = self.0.saturating_add(weight); + self.1 = self.1.saturating_add(amount); + R::take_revenue(required); + Ok(unused) + } + + fn refund_weight(&mut self, weight: XcmWeight) -> Option { + log::trace!(target: "xcm::weight", "LocalAssetTrader::refund_weight weight: {:?}", weight); + let weight = weight.min(self.0); + let amount = WeightToFee::weight_to_fee(&Weight::from_ref_time(weight)); + self.0 -= weight; + self.1 = self.1.saturating_sub(amount); + let amount: u128 = amount.saturated_into(); + if amount > 0 { + Some((AssetId::get(), amount).into()) + } else { + None + } + } +} +impl< + WeightToFee: WeightToFeeT, + AssetId: Get, + AccountId, + Currency: CurrencyT, + OnUnbalanced: OnUnbalancedT, + R: TakeRevenue, + > Drop for LocalAssetTrader +{ + fn drop(&mut self) { + OnUnbalanced::on_unbalanced(Currency::issue(self.1)); + } +} diff --git a/runtime/crab/src/pallets/polkadot_xcm.rs b/runtime/crab/src/pallets/polkadot_xcm.rs index 9d3dcc7f1..5046b8de2 100644 --- a/runtime/crab/src/pallets/polkadot_xcm.rs +++ b/runtime/crab/src/pallets/polkadot_xcm.rs @@ -18,6 +18,8 @@ // darwinia use crate::*; +// substrate +use frame_support::traits::Currency; /// Means for transacting assets on this chain. pub type LocalAssetTransactor = xcm_builder::CurrencyAdapter< @@ -98,6 +100,25 @@ frame_support::parameter_types! { pub UnitWeightCost: u64 = 1_000_000_000; } +pub struct ToTreasury; +impl xcm_builder::TakeRevenue for ToTreasury { + fn take_revenue(revenue: xcm::latest::prelude::MultiAsset) { + if let xcm::latest::prelude::MultiAsset { + id: xcm::latest::prelude::Concrete(_location), + fun: xcm::latest::prelude::Fungible(amount), + } = revenue + { + let treasury_account = Treasury::account_id(); + let _ = Balances::deposit_creating(&treasury_account, amount); + + frame_support::log::trace!( + target: "xcm::weight", + "LocalAssetTrader::to_treasury amount: {amount:?}, treasury: {treasury_account:?}" + ); + } + } +} + pub struct XcmExecutorConfig; impl xcm_executor::Config for XcmExecutorConfig { type AssetClaims = PolkadotXcm; @@ -113,12 +134,13 @@ impl xcm_executor::Config for XcmExecutorConfig { type ResponseHandler = PolkadotXcm; type RuntimeCall = RuntimeCall; type SubscriptionService = PolkadotXcm; - type Trader = xcm_builder::UsingComponents< + type Trader = xcm_configs::LocalAssetTrader< ConstantMultiplier, AnchoringSelfReserve, AccountId, Balances, DealWithFees, + ToTreasury, >; type Weigher = xcm_builder::FixedWeightBounds; type XcmSender = XcmRouter; @@ -147,8 +169,6 @@ impl pallet_xcm::Config for Runtime { type SendXcmOrigin = xcm_builder::EnsureXcmOrigin; type Weigher = xcm_builder::FixedWeightBounds; type XcmExecuteFilter = frame_support::traits::Everything; - // ^ Disable dispatchable execute on the XCM pallet. - // Needs to be `Everything` for local testing. type XcmExecutor = xcm_executor::XcmExecutor; type XcmReserveTransferFilter = frame_support::traits::Everything; type XcmRouter = XcmRouter; diff --git a/runtime/darwinia/src/pallets/polkadot_xcm.rs b/runtime/darwinia/src/pallets/polkadot_xcm.rs index b135b513b..907858780 100644 --- a/runtime/darwinia/src/pallets/polkadot_xcm.rs +++ b/runtime/darwinia/src/pallets/polkadot_xcm.rs @@ -18,6 +18,8 @@ // darwinia use crate::*; +// substrate +use frame_support::traits::Currency; /// Means for transacting assets on this chain. pub type LocalAssetTransactor = xcm_builder::CurrencyAdapter< @@ -98,6 +100,25 @@ frame_support::parameter_types! { pub UnitWeightCost: u64 = 1_000_000_000; } +pub struct ToTreasury; +impl xcm_builder::TakeRevenue for ToTreasury { + fn take_revenue(revenue: xcm::latest::prelude::MultiAsset) { + if let xcm::latest::prelude::MultiAsset { + id: xcm::latest::prelude::Concrete(_location), + fun: xcm::latest::prelude::Fungible(amount), + } = revenue + { + let treasury_account = Treasury::account_id(); + let _ = Balances::deposit_creating(&treasury_account, amount); + + frame_support::log::trace!( + target: "xcm::weight", + "LocalAssetTrader::to_treasury amount: {amount:?}, treasury: {treasury_account:?}" + ); + } + } +} + pub struct XcmExecutorConfig; impl xcm_executor::Config for XcmExecutorConfig { type AssetClaims = PolkadotXcm; @@ -113,12 +134,13 @@ impl xcm_executor::Config for XcmExecutorConfig { type ResponseHandler = PolkadotXcm; type RuntimeCall = RuntimeCall; type SubscriptionService = PolkadotXcm; - type Trader = xcm_builder::UsingComponents< + type Trader = xcm_configs::LocalAssetTrader< ConstantMultiplier, AnchoringSelfReserve, AccountId, Balances, DealWithFees, + ToTreasury, >; type Weigher = xcm_builder::FixedWeightBounds; type XcmSender = XcmRouter; @@ -147,8 +169,6 @@ impl pallet_xcm::Config for Runtime { type SendXcmOrigin = xcm_builder::EnsureXcmOrigin; type Weigher = xcm_builder::FixedWeightBounds; type XcmExecuteFilter = frame_support::traits::Everything; - // ^ Disable dispatchable execute on the XCM pallet. - // Needs to be `Everything` for local testing. type XcmExecutor = xcm_executor::XcmExecutor; type XcmReserveTransferFilter = frame_support::traits::Everything; type XcmRouter = XcmRouter; diff --git a/runtime/pangolin/src/pallets/mod.rs b/runtime/pangolin/src/pallets/mod.rs index a1a9c5694..496d6304b 100644 --- a/runtime/pangolin/src/pallets/mod.rs +++ b/runtime/pangolin/src/pallets/mod.rs @@ -69,6 +69,7 @@ mod elections_phragmen; mod membership; mod treasury; +pub use treasury::*; mod tips; diff --git a/runtime/pangolin/src/pallets/polkadot_xcm.rs b/runtime/pangolin/src/pallets/polkadot_xcm.rs index 528bfc531..7a0c8f6d4 100644 --- a/runtime/pangolin/src/pallets/polkadot_xcm.rs +++ b/runtime/pangolin/src/pallets/polkadot_xcm.rs @@ -18,6 +18,8 @@ // darwinia use crate::*; +// substrate +use frame_support::traits::Currency; /// Means for transacting assets on this chain. pub type LocalAssetTransactor = xcm_builder::CurrencyAdapter< @@ -98,6 +100,25 @@ frame_support::parameter_types! { pub UnitWeightCost: u64 = 1_000_000_000; } +pub struct ToTreasury; +impl xcm_builder::TakeRevenue for ToTreasury { + fn take_revenue(revenue: xcm::latest::prelude::MultiAsset) { + if let xcm::latest::prelude::MultiAsset { + id: xcm::latest::prelude::Concrete(_location), + fun: xcm::latest::prelude::Fungible(amount), + } = revenue + { + let treasury_account = Treasury::account_id(); + let _ = Balances::deposit_creating(&treasury_account, amount); + + frame_support::log::trace!( + target: "xcm::weight", + "LocalAssetTrader::to_treasury amount: {amount:?}, treasury: {treasury_account:?}" + ); + } + } +} + pub struct XcmExecutorConfig; impl xcm_executor::Config for XcmExecutorConfig { type AssetClaims = PolkadotXcm; @@ -113,12 +134,13 @@ impl xcm_executor::Config for XcmExecutorConfig { type ResponseHandler = PolkadotXcm; type RuntimeCall = RuntimeCall; type SubscriptionService = PolkadotXcm; - type Trader = xcm_builder::UsingComponents< + type Trader = xcm_configs::LocalAssetTrader< ConstantMultiplier, AnchoringSelfReserve, AccountId, Balances, DealWithFees, + ToTreasury, >; type Weigher = xcm_builder::FixedWeightBounds; type XcmSender = XcmRouter; @@ -147,8 +169,6 @@ impl pallet_xcm::Config for Runtime { type SendXcmOrigin = xcm_builder::EnsureXcmOrigin; type Weigher = xcm_builder::FixedWeightBounds; type XcmExecuteFilter = frame_support::traits::Everything; - // ^ Disable dispatchable execute on the XCM pallet. - // Needs to be `Everything` for local testing. type XcmExecutor = xcm_executor::XcmExecutor; type XcmReserveTransferFilter = frame_support::traits::Everything; type XcmRouter = XcmRouter; From 2e78ca7741263f536ba08ff73ec590c2bf0475bc Mon Sep 17 00:00:00 2001 From: Guantong Date: Wed, 4 Jan 2023 15:24:47 +0800 Subject: [PATCH 078/189] Adjust common functions (#167) * WeightToFee * darwinia_deposit * Move darwinia_deposit to primitives * fix review * remove unused smallvec --- Cargo.lock | 4 +--- runtime/common/Cargo.toml | 3 ++- runtime/common/src/lib.rs | 47 +++++++++++++++++++++++++++++++++++++ runtime/crab/Cargo.toml | 1 - runtime/crab/src/lib.rs | 41 +------------------------------- runtime/darwinia/Cargo.toml | 1 - runtime/darwinia/src/lib.rs | 43 ++------------------------------- runtime/pangolin/Cargo.toml | 1 - runtime/pangolin/src/lib.rs | 41 +------------------------------- 9 files changed, 54 insertions(+), 128 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 75c4a101b..8b0a2668a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1416,7 +1416,6 @@ dependencies = [ "polkadot-runtime-common", "precompile-utils", "scale-info", - "smallvec", "sp-api", "sp-block-builder", "sp-consensus-aura", @@ -2332,6 +2331,7 @@ dependencies = [ "frame-system", "pallet-collective", "parity-scale-codec", + "smallvec", "sp-io", "sp-runtime", "sp-std", @@ -2572,7 +2572,6 @@ dependencies = [ "polkadot-runtime-common", "precompile-utils", "scale-info", - "smallvec", "sp-api", "sp-block-builder", "sp-consensus-aura", @@ -7510,7 +7509,6 @@ dependencies = [ "polkadot-runtime-common", "precompile-utils", "scale-info", - "smallvec", "sp-api", "sp-block-builder", "sp-consensus-aura", diff --git a/runtime/common/Cargo.toml b/runtime/common/Cargo.toml index 6a8206c45..f6419615e 100644 --- a/runtime/common/Cargo.toml +++ b/runtime/common/Cargo.toml @@ -11,7 +11,8 @@ version = "6.0.0" [dependencies] # crates.io -codec = { package = "parity-scale-codec", version = "3.2", default-features = false } +codec = { package = "parity-scale-codec", version = "3.2", default-features = false } +smallvec = { version = "1.10" } # darwinia dc-primitives = { default-features = false, path = "../../core/primitives" } diff --git a/runtime/common/src/lib.rs b/runtime/common/src/lib.rs index 9f2a3e448..55431448b 100644 --- a/runtime/common/src/lib.rs +++ b/runtime/common/src/lib.rs @@ -27,6 +27,17 @@ pub use bp_darwinia_core as bp_crab; pub use bp_darwinia_core as bp_darwinia; pub use bp_darwinia_core as bp_pangolin; +// darwinia +use dc_primitives::*; +// substrate +use frame_support::{ + sp_runtime::Perbill, + weights::{ + constants::ExtrinsicBaseWeight, WeightToFeeCoefficient, WeightToFeeCoefficients, + WeightToFeePolynomial, + }, +}; + #[macro_export] macro_rules! fast_runtime_or_not { ($name:ident, $development_type:ty, $production_type:ty) => { @@ -36,3 +47,39 @@ macro_rules! fast_runtime_or_not { type $name = $production_type; }; } + +/// Handles converting a weight scalar to a fee value, based on the scale and granularity of the +/// node's balance type. +/// +/// This should typically create a mapping between the following ranges: +/// - `[0, MAXIMUM_BLOCK_WEIGHT]` +/// - `[Balance::min, Balance::max]` +/// +/// Yet, it can be used for any other sort of change to weight-fee. Some examples being: +/// - Setting it to `0` will essentially disable the weight fee. +/// - Setting it to `1` will cause the literal `#[weight = x]` values to be charged. +pub struct WeightToFee; +impl WeightToFeePolynomial for WeightToFee { + type Balance = Balance; + + fn polynomial() -> WeightToFeeCoefficients { + // in Rococo, extrinsic base weight (smallest non-zero weight) is mapped to 1 MILLIUNIT: + // here, we map to 1/10 of that, or 1/10 MILLIUNIT + let p = MILLIUNIT / 10; + let q = 100 * Balance::from(ExtrinsicBaseWeight::get().ref_time()); + smallvec::smallvec![WeightToFeeCoefficient { + degree: 1, + negative: false, + coeff_frac: Perbill::from_rational(p % q, q), + coeff_integer: p / q, + }] + } +} + +/// Deposit calculator for Darwinia. +/// 100 UNIT for the base fee, 102.4 UNIT/MB. +pub const fn darwinia_deposit(items: u32, bytes: u32) -> Balance { + // First try. + items as Balance * 100 * UNIT + (bytes as Balance) * 100 * MICROUNIT + // items as Balance * 100 * UNIT + (bytes as Balance) * 100 * MILLIUNIT +} diff --git a/runtime/crab/Cargo.toml b/runtime/crab/Cargo.toml index e918c0331..403596853 100644 --- a/runtime/crab/Cargo.toml +++ b/runtime/crab/Cargo.toml @@ -16,7 +16,6 @@ substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", bran # crates.io codec = { package = "parity-scale-codec", version = "3.2", default-features = false, features = ["derive"] } scale-info = { version = "2.3", default-features = false, features = ["derive"] } -smallvec = { version = "1.10" } static_assertions = { version = "1.1" } # crates.io optional array-bytes = { version = "6.0", optional = true } diff --git a/runtime/crab/src/lib.rs b/runtime/crab/src/lib.rs index faa76b12a..898374178 100644 --- a/runtime/crab/src/lib.rs +++ b/runtime/crab/src/lib.rs @@ -45,10 +45,7 @@ use xcm_executor::XcmExecutor; use frame_support::{ dispatch::DispatchClass, traits::{Imbalance, OnUnbalanced}, - weights::{ - ConstantMultiplier, Weight, WeightToFeeCoefficient, WeightToFeeCoefficients, - WeightToFeePolynomial, - }, + weights::{ConstantMultiplier, Weight}, }; use frame_system::EnsureRoot; use sp_core::{crypto::KeyTypeId, OpaqueMetadata, H160, H256, U256}; @@ -114,14 +111,6 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { state_version: 0, }; -/// Deposit calculator for Darwinia. -/// 100 UNIT for the base fee, 102.4 UNIT/MB. -pub const fn darwinia_deposit(items: u32, bytes: u32) -> Balance { - // First try. - items as Balance * 100 * UNIT + (bytes as Balance) * 100 * MICROUNIT - // items as Balance * 100 * UNIT + (bytes as Balance) * 100 * MILLIUNIT -} - // TODO: move to impl.rs pub struct DealWithFees(sp_std::marker::PhantomData); impl frame_support::traits::OnUnbalanced> @@ -218,34 +207,6 @@ impl fp_self_contained::SelfContainedCall for RuntimeCall { } } -/// Handles converting a weight scalar to a fee value, based on the scale and granularity of the -/// node's balance type. -/// -/// This should typically create a mapping between the following ranges: -/// - `[0, MAXIMUM_BLOCK_WEIGHT]` -/// - `[Balance::min, Balance::max]` -/// -/// Yet, it can be used for any other sort of change to weight-fee. Some examples being: -/// - Setting it to `0` will essentially disable the weight fee. -/// - Setting it to `1` will cause the literal `#[weight = x]` values to be charged. -pub struct WeightToFee; -impl WeightToFeePolynomial for WeightToFee { - type Balance = Balance; - - fn polynomial() -> WeightToFeeCoefficients { - // in Rococo, extrinsic base weight (smallest non-zero weight) is mapped to 1 MILLIUNIT: - // here, we map to 1/10 of that, or 1/10 MILLIUNIT - let p = MILLIUNIT / 10; - let q = 100 * Balance::from(weights::ExtrinsicBaseWeight::get().ref_time()); - smallvec::smallvec![WeightToFeeCoefficient { - degree: 1, - negative: false, - coeff_frac: Perbill::from_rational(p % q, q), - coeff_integer: p / q, - }] - } -} - /// The version information used to identify this runtime when compiled natively. #[cfg(feature = "std")] pub fn native_version() -> NativeVersion { diff --git a/runtime/darwinia/Cargo.toml b/runtime/darwinia/Cargo.toml index 10cd885a5..8a1d9792e 100644 --- a/runtime/darwinia/Cargo.toml +++ b/runtime/darwinia/Cargo.toml @@ -16,7 +16,6 @@ substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", bran # crates.io codec = { package = "parity-scale-codec", version = "3.2", default-features = false, features = ["derive"] } scale-info = { version = "2.3", default-features = false, features = ["derive"] } -smallvec = { version = "1.10" } static_assertions = { version = "1.1" } # crates.io optional array-bytes = { version = "6.0", optional = true } diff --git a/runtime/darwinia/src/lib.rs b/runtime/darwinia/src/lib.rs index 2347a540b..10df130b5 100644 --- a/runtime/darwinia/src/lib.rs +++ b/runtime/darwinia/src/lib.rs @@ -45,10 +45,7 @@ use xcm_executor::XcmExecutor; use frame_support::{ dispatch::DispatchClass, traits::{Imbalance, OnUnbalanced}, - weights::{ - ConstantMultiplier, Weight, WeightToFeeCoefficient, WeightToFeeCoefficients, - WeightToFeePolynomial, - }, + weights::{ConstantMultiplier, Weight}, }; use frame_system::EnsureRoot; use sp_core::{crypto::KeyTypeId, OpaqueMetadata, H160, H256, U256}; @@ -56,7 +53,7 @@ use sp_runtime::{ generic, traits::Block as BlockT, transaction_validity::{TransactionSource, TransactionValidity}, - ApplyExtrinsicResult, MultiAddress, Perbill, Permill, + ApplyExtrinsicResult, Perbill, Permill, }; use sp_std::prelude::*; #[cfg(feature = "std")] @@ -114,14 +111,6 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { state_version: 0, }; -/// Deposit calculator for Darwinia. -/// 100 UNIT for the base fee, 102.4 UNIT/MB. -pub const fn darwinia_deposit(items: u32, bytes: u32) -> Balance { - // First try. - items as Balance * 100 * UNIT + (bytes as Balance) * 100 * MICROUNIT - // items as Balance * 100 * UNIT + (bytes as Balance) * 100 * MILLIUNIT -} - // TODO: move to impl.rs pub struct DealWithFees(sp_std::marker::PhantomData); impl frame_support::traits::OnUnbalanced> @@ -218,34 +207,6 @@ impl fp_self_contained::SelfContainedCall for RuntimeCall { } } -/// Handles converting a weight scalar to a fee value, based on the scale and granularity of the -/// node's balance type. -/// -/// This should typically create a mapping between the following ranges: -/// - `[0, MAXIMUM_BLOCK_WEIGHT]` -/// - `[Balance::min, Balance::max]` -/// -/// Yet, it can be used for any other sort of change to weight-fee. Some examples being: -/// - Setting it to `0` will essentially disable the weight fee. -/// - Setting it to `1` will cause the literal `#[weight = x]` values to be charged. -pub struct WeightToFee; -impl WeightToFeePolynomial for WeightToFee { - type Balance = Balance; - - fn polynomial() -> WeightToFeeCoefficients { - // in Rococo, extrinsic base weight (smallest non-zero weight) is mapped to 1 MILLIUNIT: - // here, we map to 1/10 of that, or 1/10 MILLIUNIT - let p = MILLIUNIT / 10; - let q = 100 * Balance::from(weights::ExtrinsicBaseWeight::get().ref_time()); - smallvec::smallvec![WeightToFeeCoefficient { - degree: 1, - negative: false, - coeff_frac: Perbill::from_rational(p % q, q), - coeff_integer: p / q, - }] - } -} - /// The version information used to identify this runtime when compiled natively. #[cfg(feature = "std")] pub fn native_version() -> NativeVersion { diff --git a/runtime/pangolin/Cargo.toml b/runtime/pangolin/Cargo.toml index 5e2edabc7..111bc3c1f 100644 --- a/runtime/pangolin/Cargo.toml +++ b/runtime/pangolin/Cargo.toml @@ -16,7 +16,6 @@ substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", bran # crates.io codec = { package = "parity-scale-codec", version = "3.2", default-features = false, features = ["derive"] } scale-info = { version = "2.3", default-features = false, features = ["derive"] } -smallvec = { version = "1.10" } static_assertions = { version = "1.1" } # crates.io optional array-bytes = { version = "6.0", optional = true } diff --git a/runtime/pangolin/src/lib.rs b/runtime/pangolin/src/lib.rs index dc6fd927a..31c079a23 100644 --- a/runtime/pangolin/src/lib.rs +++ b/runtime/pangolin/src/lib.rs @@ -42,10 +42,7 @@ use xcm_executor::XcmExecutor; use frame_support::{ dispatch::DispatchClass, traits::{Imbalance, OnUnbalanced}, - weights::{ - ConstantMultiplier, Weight, WeightToFeeCoefficient, WeightToFeeCoefficients, - WeightToFeePolynomial, - }, + weights::{ConstantMultiplier, Weight}, }; use frame_system::EnsureRoot; use sp_core::{crypto::KeyTypeId, OpaqueMetadata, H160, H256, U256}; @@ -111,14 +108,6 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { state_version: 0, }; -/// Deposit calculator for Darwinia. -/// 100 UNIT for the base fee, 102.4 UNIT/MB. -pub const fn darwinia_deposit(items: u32, bytes: u32) -> Balance { - // First try. - items as Balance * 100 * UNIT + (bytes as Balance) * 100 * MICROUNIT - // items as Balance * 100 * UNIT + (bytes as Balance) * 100 * MILLIUNIT -} - // TODO: move to impl.rs pub struct DealWithFees(sp_std::marker::PhantomData); impl frame_support::traits::OnUnbalanced> @@ -215,34 +204,6 @@ impl fp_self_contained::SelfContainedCall for RuntimeCall { } } -/// Handles converting a weight scalar to a fee value, based on the scale and granularity of the -/// node's balance type. -/// -/// This should typically create a mapping between the following ranges: -/// - `[0, MAXIMUM_BLOCK_WEIGHT]` -/// - `[Balance::min, Balance::max]` -/// -/// Yet, it can be used for any other sort of change to weight-fee. Some examples being: -/// - Setting it to `0` will essentially disable the weight fee. -/// - Setting it to `1` will cause the literal `#[weight = x]` values to be charged. -pub struct WeightToFee; -impl WeightToFeePolynomial for WeightToFee { - type Balance = Balance; - - fn polynomial() -> WeightToFeeCoefficients { - // in Rococo, extrinsic base weight (smallest non-zero weight) is mapped to 1 MILLIUNIT: - // here, we map to 1/10 of that, or 1/10 MILLIUNIT - let p = MILLIUNIT / 10; - let q = 100 * Balance::from(weights::ExtrinsicBaseWeight::get().ref_time()); - smallvec::smallvec![WeightToFeeCoefficient { - degree: 1, - negative: false, - coeff_frac: Perbill::from_rational(p % q, q), - coeff_integer: p / q, - }] - } -} - /// The version information used to identify this runtime when compiled natively. #[cfg(feature = "std")] pub fn native_version() -> NativeVersion { From 7a77e003820a05793cf0f0c1ee1eba645dc89639 Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Wed, 4 Jan 2023 17:54:01 +0800 Subject: [PATCH 079/189] Pangolin2 preparation (#174) * New data path * Simplify staking migration * Refactor * Build spec automatically * Download specs automatically * Use `take` * Remove unnecessary doc --- node/src/chain_spec/crab.rs | 2 - node/src/chain_spec/darwinia.rs | 2 - node/src/chain_spec/pangolin.rs | 2 - pallet/account-migration/src/lib.rs | 14 +- tool/state-processor/.gitignore | 3 + tool/state-processor/Cargo.lock | 423 +++++++++++++++++++++ tool/state-processor/Cargo.toml | 3 + tool/state-processor/src/main.rs | 395 +------------------ tool/state-processor/src/processor.rs | 316 +++++++++++++++ tool/state-processor/src/staking/README.md | 2 +- tool/state-processor/src/staking/mod.rs | 9 +- tool/state-processor/src/system/mod.rs | 2 + tool/state-processor/src/util.rs | 95 +++++ 13 files changed, 868 insertions(+), 400 deletions(-) create mode 100644 tool/state-processor/src/processor.rs create mode 100644 tool/state-processor/src/util.rs diff --git a/node/src/chain_spec/crab.rs b/node/src/chain_spec/crab.rs index 88eacdf42..f426e3112 100644 --- a/node/src/chain_spec/crab.rs +++ b/node/src/chain_spec/crab.rs @@ -138,9 +138,7 @@ pub fn local_config() -> ChainSpec { pub fn genesis_config() -> ChainSpec { // TODO: update this before final release ChainSpec::from_genesis( - // Name "Crab2", - // ID "crab2", ChainType::Live, move || { diff --git a/node/src/chain_spec/darwinia.rs b/node/src/chain_spec/darwinia.rs index e8204b747..e35d3156b 100644 --- a/node/src/chain_spec/darwinia.rs +++ b/node/src/chain_spec/darwinia.rs @@ -138,9 +138,7 @@ pub fn local_config() -> ChainSpec { pub fn genesis_config() -> ChainSpec { // TODO: update this before final release ChainSpec::from_genesis( - // Name "Darwinia2", - // ID "darwinia2", ChainType::Live, move || { diff --git a/node/src/chain_spec/pangolin.rs b/node/src/chain_spec/pangolin.rs index 25d1239b8..c8ddf4d02 100644 --- a/node/src/chain_spec/pangolin.rs +++ b/node/src/chain_spec/pangolin.rs @@ -138,9 +138,7 @@ pub fn local_config() -> ChainSpec { pub fn genesis_config() -> ChainSpec { // TODO: update this before final release ChainSpec::from_genesis( - // Name "Pangolin2", - // ID "pangolin2", ChainType::Live, move || { diff --git a/pallet/account-migration/src/lib.rs b/pallet/account-migration/src/lib.rs index c558bf0d9..f39b1cf51 100644 --- a/pallet/account-migration/src/lib.rs +++ b/pallet/account-migration/src/lib.rs @@ -145,20 +145,12 @@ pub mod pallet { #[pallet::getter(fn deposit_of)] pub type Deposits = StorageMap<_, Blake2_128Concat, AccountId32, Vec>; - /// [`darwinia_staking::Bonded`] data. - /// - /// - #[pallet::storage] - #[pallet::getter(fn bonded)] - pub type Bonded = StorageMap<_, Twox64Concat, AccountId32, AccountId32>; - /// [`darwinia_staking::Ledgers`] data. #[pallet::storage] #[pallet::getter(fn ledger_of)] pub type Ledgers = StorageMap<_, Blake2_128Concat, AccountId32, Ledger>; // TODO: identity storages - // TODO: proxy storages #[pallet::call] impl Pallet { @@ -189,7 +181,7 @@ pub mod pallet { a, ); } - if let Some(v) = >::get(&from) { + if let Some(v) = >::take(&from) { let locked = v.iter().map(|v| v.locked()).sum(); >::insert( @@ -203,8 +195,8 @@ pub mod pallet { // https://github.dev/paritytech/substrate/blob/19162e43be45817b44c7d48e50d03f074f60fbf4/frame/vesting/src/lib.rs#L86 >::set_lock(*b"vesting ", &to, locked, reasons); } - if let Some(l) = >::get(&from).and_then(>::get) { - if let Some(ds) = >::get(&from) { + if let Some(l) = >::take(&from) { + if let Some(ds) = >::take(&from) { as Currency<_>>::transfer( &to, &darwinia_deposit::account_id(), diff --git a/tool/state-processor/.gitignore b/tool/state-processor/.gitignore index a9a20e83c..2988f7b78 100644 --- a/tool/state-processor/.gitignore +++ b/tool/state-processor/.gitignore @@ -11,5 +11,8 @@ target ## npm node_modules +# Data +data + # Test data test-data diff --git a/tool/state-processor/Cargo.lock b/tool/state-processor/Cargo.lock index 36390ca6f..145cc8075 100644 --- a/tool/state-processor/Cargo.lock +++ b/tool/state-processor/Cargo.lock @@ -2,6 +2,12 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "adler" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" + [[package]] name = "aho-corasick" version = "0.7.20" @@ -49,6 +55,18 @@ dependencies = [ "winapi", ] +[[package]] +name = "base64" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + [[package]] name = "bitvec" version = "1.0.1" @@ -80,6 +98,12 @@ dependencies = [ "generic-array", ] +[[package]] +name = "bumpalo" +version = "3.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "572f695136211188308f16ad2ca5c851a712c464060ae6974944458eb83880ba" + [[package]] name = "byte-slice-cast" version = "1.2.2" @@ -92,6 +116,15 @@ version = "1.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" +[[package]] +name = "cc" +version = "1.0.78" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a20104e2335ce8a659d6dd92a51a767a0c062599c73b343fd152cb401e828c3d" +dependencies = [ + "jobserver", +] + [[package]] name = "cfg-if" version = "1.0.0" @@ -113,6 +146,15 @@ dependencies = [ "libc", ] +[[package]] +name = "crc32fast" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" +dependencies = [ + "cfg-if", +] + [[package]] name = "crunchy" version = "0.2.2" @@ -152,6 +194,18 @@ dependencies = [ "termcolor", ] +[[package]] +name = "filetime" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e884668cd0c7480504233e951174ddc3b382f7c2666e3b7310b5c4e7b0c37f9" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "windows-sys", +] + [[package]] name = "fixed-hash" version = "0.8.0" @@ -164,6 +218,25 @@ dependencies = [ "static_assertions", ] +[[package]] +name = "flate2" +version = "1.0.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8a2db397cb1c8772f31494cb8917e48cd1e64f0fa7efac59fbd741a0a8ce841" +dependencies = [ + "crc32fast", + "miniz_oxide", +] + +[[package]] +name = "form_urlencoded" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9c384f161156f5260c24a097c56119f9be8c798586aecc13afbcbe7b7e26bf8" +dependencies = [ + "percent-encoding", +] + [[package]] name = "funty" version = "2.0.0" @@ -224,6 +297,16 @@ dependencies = [ "quick-error", ] +[[package]] +name = "idna" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e14ddfc70884202db2244c223200c204c2bda1bc6e0998d11b5e024d657209e6" +dependencies = [ + "unicode-bidi", + "unicode-normalization", +] + [[package]] name = "impl-codec" version = "0.6.0" @@ -250,6 +333,24 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4217ad341ebadf8d8e724e264f13e593e0648f5b3e94b3896a5df283be015ecc" +[[package]] +name = "jobserver" +version = "0.1.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "068b1ee6743e4d11fb9c6a1e6064b3693a1b600e7f5f5988047d98b3dc9fb90b" +dependencies = [ + "libc", +] + +[[package]] +name = "js-sys" +version = "0.3.60" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49409df3e3bf0856b916e2ceaca09ee28e6871cf7d9ce97a692cacfdb2a25a47" +dependencies = [ + "wasm-bindgen", +] + [[package]] name = "libc" version = "0.2.138" @@ -271,6 +372,15 @@ version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" +[[package]] +name = "miniz_oxide" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b275950c28b37e794e8c55d88aeb5e139d0ce23fdbbeda68f8d7174abdf9e8fa" +dependencies = [ + "adler", +] + [[package]] name = "nodrop" version = "0.1.14" @@ -309,6 +419,12 @@ dependencies = [ "syn", ] +[[package]] +name = "percent-encoding" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" + [[package]] name = "ppv-lite86" version = "0.2.17" @@ -407,6 +523,15 @@ dependencies = [ "getrandom", ] +[[package]] +name = "redox_syscall" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" +dependencies = [ + "bitflags", +] + [[package]] name = "regex" version = "1.7.0" @@ -424,18 +549,55 @@ version = "0.6.28" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" +[[package]] +name = "ring" +version = "0.16.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" +dependencies = [ + "cc", + "libc", + "once_cell", + "spin", + "untrusted", + "web-sys", + "winapi", +] + [[package]] name = "rustc-hex" version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" +[[package]] +name = "rustls" +version = "0.20.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "539a2bfe908f471bfa933876bd1eb6a19cf2176d375f82ef7f99530a40e48c2c" +dependencies = [ + "log", + "ring", + "sct", + "webpki", +] + [[package]] name = "ryu" version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09" +[[package]] +name = "sct" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4" +dependencies = [ + "ring", + "untrusted", +] + [[package]] name = "serde" version = "1.0.150" @@ -478,6 +640,12 @@ dependencies = [ "digest", ] +[[package]] +name = "spin" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" + [[package]] name = "state-processor" version = "0.0.0" @@ -495,6 +663,9 @@ dependencies = [ "subhasher", "subspector", "substorager", + "tar", + "ureq", + "zstd", ] [[package]] @@ -551,6 +722,17 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" +[[package]] +name = "tar" +version = "0.4.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b55807c0344e1e6c04d7c965f5289c39a8d94ae23ed5c0b57aabac549f871c6" +dependencies = [ + "filetime", + "libc", + "xattr", +] + [[package]] name = "termcolor" version = "1.1.3" @@ -589,6 +771,21 @@ dependencies = [ "crunchy", ] +[[package]] +name = "tinyvec" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +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 = "toml" version = "0.5.10" @@ -627,12 +824,60 @@ dependencies = [ "static_assertions", ] +[[package]] +name = "unicode-bidi" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992" + [[package]] name = "unicode-ident" version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6ceab39d59e4c9499d4e5a8ee0e2735b891bb7308ac83dfb4e80cad195c9f6f3" +[[package]] +name = "unicode-normalization" +version = "0.1.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "untrusted" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" + +[[package]] +name = "ureq" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "733b5ad78377302af52c0dbcb2623d78fe50e4b3bf215948ff29e9ee031d8566" +dependencies = [ + "base64", + "flate2", + "log", + "once_cell", + "rustls", + "url", + "webpki", + "webpki-roots", +] + +[[package]] +name = "url" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d68c799ae75762b8c3fe375feb6600ef5602c883c5d21eb51c09f22b83c4643" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", +] + [[package]] name = "version_check" version = "0.9.4" @@ -645,6 +890,89 @@ version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" +[[package]] +name = "wasm-bindgen" +version = "0.2.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eaf9f5aceeec8be17c128b2e93e031fb8a4d469bb9c4ae2d7dc1888b26887268" +dependencies = [ + "cfg-if", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c8ffb332579b0557b52d268b91feab8df3615f265d5270fec2a8c95b17c1142" +dependencies = [ + "bumpalo", + "log", + "once_cell", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "052be0f94026e6cbc75cdefc9bae13fd6052cdcaf532fa6c45e7ae33a1e6c810" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07bc0c051dc5f23e307b13285f9d75df86bfdf816c5721e573dec1f9b8aa193c" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f" + +[[package]] +name = "web-sys" +version = "0.3.60" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bcda906d8be16e728fd5adc5b729afad4e444e106ab28cd1c7256e54fa61510f" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "webpki" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f095d78192e208183081cc07bc5515ef55216397af48b873e5edcd72637fa1bd" +dependencies = [ + "ring", + "untrusted", +] + +[[package]] +name = "webpki-roots" +version = "0.22.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c71e40d7d2c34a5106301fb632274ca37242cd0c9d3e64dbece371a40a2d87" +dependencies = [ + "webpki", +] + [[package]] name = "winapi" version = "0.3.9" @@ -676,6 +1004,63 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows-sys" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d2aa71f6f0cbe00ae5167d90ef3cfe66527d6f613ca78ac8024c3ccab9a19e" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4" + +[[package]] +name = "windows_i686_gnu" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbeae19f6716841636c28d695375df17562ca208b2b7d0dc47635a50ae6c5de7" + +[[package]] +name = "windows_i686_msvc" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84c12f65daa39dd2babe6e442988fc329d6243fdce47d7d2d155b8d874862246" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf7b1b21b5362cbc318f686150e5bcea75ecedc74dd157d874d754a2ca44b0ed" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09d525d2ba30eeb3297665bd434a54297e4170c7f1a44cad4ef58095b4cd2028" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5" + [[package]] name = "wyz" version = "0.5.1" @@ -684,3 +1069,41 @@ checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" dependencies = [ "tap", ] + +[[package]] +name = "xattr" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d1526bbe5aaeb5eb06885f4d987bcdfa5e23187055de9b83fe00156a821fabc" +dependencies = [ + "libc", +] + +[[package]] +name = "zstd" +version = "0.12.1+zstd.1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c947d2adc84ff9a59f2e3c03b81aa4128acf28d6ad7d56273f7e8af14e47bea" +dependencies = [ + "zstd-safe", +] + +[[package]] +name = "zstd-safe" +version = "6.0.2+zstd.1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6cf39f730b440bab43da8fb5faf5f254574462f73f260f85f7987f32154ff17" +dependencies = [ + "libc", + "zstd-sys", +] + +[[package]] +name = "zstd-sys" +version = "2.0.4+zstd.1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fa202f2ef00074143e219d15b62ffc317d17cc33909feac471c044087cad7b0" +dependencies = [ + "cc", + "libc", +] diff --git a/tool/state-processor/Cargo.toml b/tool/state-processor/Cargo.toml index b12f4dcbe..09c0b5b9c 100644 --- a/tool/state-processor/Cargo.toml +++ b/tool/state-processor/Cargo.toml @@ -16,6 +16,9 @@ pretty_env_logger = { version = "0.4" } primitive-types = { version = "0.12.1", features = ["codec"] } serde = { version = "1.0" } serde_json = { version = "1.0" } +tar = { version = "0.4" } +ureq = { version = "2.6" } +zstd = { version = "0.12" } # hack-ink subhasher = { git = "https://github.com/hack-ink/subalfred" } diff --git a/tool/state-processor/src/main.rs b/tool/state-processor/src/main.rs index 3b8d0eeba..76f52e0b5 100644 --- a/tool/state-processor/src/main.rs +++ b/tool/state-processor/src/main.rs @@ -1,392 +1,39 @@ -mod balances; -mod evm; -mod indices; -mod proxy; -mod staking; -mod system; -mod vesting; +// Processor components. +mod processor; +use processor::*; +mod util; +use util::*; +// Runtime configurations. mod adjust; use adjust::*; mod configuration; use configuration::*; - mod type_registry; use type_registry::*; +// Runtime pallets. +mod balances; +mod evm; +mod indices; +mod proxy; +mod staking; +mod system; +mod vesting; + #[cfg(test)] mod tests; -// std -use std::{ - env, - fs::File, - io::{Read, Write}, - marker::PhantomData, - mem, - sync::RwLock, -}; -// crates.io -use anyhow::Result; -use fxhash::FxHashMap; -use once_cell::sync::Lazy; -use parity_scale_codec::{Decode, Encode}; -use serde::de::DeserializeOwned; -// hack-ink -use subspector::ChainSpec; - -type Map = FxHashMap; - -static NOW: Lazy> = Lazy::new(|| RwLock::new(0)); +pub type StdResult = std::result::Result; +pub type Result = anyhow::Result; fn main() -> Result<()> { - env::set_var("RUST_LOG", "state_processor"); + std::env::set_var("RUST_LOG", "state_processor"); pretty_env_logger::init(); - >::new()?.process()?; + // >::new()?.process()?; + // >::new()?.process()?; + >::new()?.process()?; Ok(()) } - -struct Processor { - solo_state: State, - para_state: State<()>, - shell_state: State<()>, - shell_chain_spec: ChainSpec, -} -impl Processor -where - S: Configurable, -{ - fn new() -> Result { - let mut shell_chain_spec = - from_file::(&format!("test-data/{}-shell.json", S::NAME))?; - - Ok(Self { - solo_state: State::from_file(&format!("test-data/{}-solo.json", S::NAME))?, - para_state: State::from_file(&format!("test-data/{}-para.json", S::NAME))?, - shell_state: State { - map: mem::take(&mut shell_chain_spec.genesis.raw.top), - _runtime: Default::default(), - }, - shell_chain_spec, - }) - } - - fn process(mut self) -> Result<()> { - self.solo_state.get_value(b"System", b"Number", "", &mut *NOW.write().unwrap()); - - let _guard = NOW.read().unwrap(); - - assert!(*_guard != 0); - - self.process_system() - .process_indices() - .process_vesting() - .process_proxy() - .process_staking() - .process_evm(); - - self.save() - } - - fn save(mut self) -> Result<()> { - log::info!("saving processed chain spec"); - - mem::swap(&mut self.shell_state.map, &mut self.shell_chain_spec.genesis.raw.top); - - let mut f = File::create(format!("test-data/{}-processed.json", S::NAME))?; - let v = serde_json::to_vec(&self.shell_chain_spec)?; - - f.write_all(&v)?; - - Ok(()) - } -} - -pub struct State { - map: Map, - _runtime: PhantomData, -} -impl State { - fn from_file(path: &str) -> Result { - Ok(Self { - map: from_file::(path)?.genesis.raw.top, - _runtime: >::default(), - }) - } - - fn insert_raw_key_raw_value(&mut self, key: String, value: String) -> &mut Self { - self.map.insert(key, value); - - self - } - - fn insert_raw_key_value(&mut self, key: String, value: E) -> &mut Self - where - E: Encode, - { - self.map.insert(key, encode_value(value)); - - self - } - - fn take_raw_map( - &mut self, - prefix: &str, - buffer: &mut Map, - process_key: F, - ) -> &mut Self - where - F: Fn(&str, &str) -> String, - { - self.map.retain(|k, v| { - if k.starts_with(prefix) { - buffer.insert(process_key(k, prefix), v.to_owned()); - - false - } else { - true - } - }); - - self - } - - fn insert_raw_key_map(&mut self, pairs: Map) -> &mut Self { - pairs.into_iter().for_each(|(k, v)| { - if self.map.contains_key(&k) { - log::error!("key({k}) has already existed, overriding"); - } - - self.map.insert(k, v); - }); - - self - } - - fn get_value(&self, pallet: &[u8], item: &[u8], hash: &str, value: &mut D) -> &Self - where - D: Decode, - { - let key = full_key(pallet, item, hash); - - if let Some(v) = self.map.get(&key) { - match decode(v) { - Ok(v) => *value = v, - Err(e) => log::error!( - "failed to decode `{}::{}::{hash}({v})`, due to `{e}`", - String::from_utf8_lossy(pallet), - String::from_utf8_lossy(item), - ), - } - } else { - log::error!( - "key not found `{}::{}::{hash}`", - String::from_utf8_lossy(pallet), - String::from_utf8_lossy(item), - ); - } - - self - } - - fn take_value(&mut self, pallet: &[u8], item: &[u8], hash: &str, value: &mut D) -> &mut Self - where - D: Decode, - { - let key = full_key(pallet, item, hash); - - if let Some(v) = self.map.remove(&key) { - match decode(&v) { - Ok(v) => *value = v, - Err(e) => log::error!( - "failed to decode `{}::{}::{hash}({v})`, due to `{e}`", - String::from_utf8_lossy(pallet), - String::from_utf8_lossy(item) - ), - } - } else { - log::error!( - "key not found `{}::{}::{hash}`", - String::from_utf8_lossy(pallet), - String::from_utf8_lossy(item), - ); - } - - self - } - - fn insert_value(&mut self, pallet: &[u8], item: &[u8], hash: &str, value: E) -> &mut Self - where - E: Encode, - { - self.map.insert(full_key(pallet, item, hash), encode_value(value)); - - self - } - - fn mutate_value(&mut self, pallet: &[u8], item: &[u8], hash: &str, f: F) -> &mut Self - where - D: Default + Encode + Decode, - F: FnOnce(&mut D), - { - let mut v = D::default(); - - self.get_value(pallet, item, hash, &mut v); - - f(&mut v); - - self.insert_value(pallet, item, hash, v); - - self - } - - fn take_map( - &mut self, - pallet: &[u8], - item: &[u8], - buffer: &mut Map, - process_key: F, - ) -> &mut Self - where - D: Decode, - F: Fn(&str, &str) -> String, - { - let len = buffer.len(); - let prefix = item_key(pallet, item); - - self.map.retain(|full_key, v| { - if full_key.starts_with(&prefix) { - match decode(v) { - Ok(v) => { - buffer.insert(process_key(full_key, &prefix), v); - }, - Err(e) => log::error!("failed to decode `{full_key}:{v}`, due to `{e}`"), - } - - false - } else { - true - } - }); - - if buffer.len() == len { - log::info!( - "no new item inserted for {}::{}", - String::from_utf8_lossy(pallet), - String::from_utf8_lossy(item) - ); - } - - self - } - - fn insert_map(&mut self, pairs: Map, process_key: F) -> &mut Self - where - E: Encode, - F: Fn(&str) -> String, - { - pairs.into_iter().for_each(|(k, v)| { - self.map.insert(process_key(&k), encode_value(v)); - }); - - self - } - - fn contains_key(&self, key: &str) -> bool { - self.map.contains_key(key) - } - - // fn inc_consumers(&mut self, who: &str) {} - - // fn transfer(&mut self, from: &str, to: &str, amount: u128) {} - - fn unreserve(&mut self, account_id_32: A, amount: u128) - where - A: AsRef<[u8]>, - { - let account_id_32 = account_id_32.as_ref(); - let (p, i, h) = if is_evm_address(account_id_32) { - (&b"System"[..], &b"Account"[..], &account_id_32[11..31]) - } else { - (&b"AccountMigration"[..], &b"Accounts"[..], account_id_32) - }; - - self.mutate_value(p, i, &blake2_128_concat_to_string(h), |a: &mut AccountInfo| { - a.data.free += amount; - a.data.reserved -= amount; - }); - } -} - -fn from_file(path: &str) -> Result -where - D: DeserializeOwned, -{ - log::info!("load data from {path:?}"); - - let mut f = File::open(path)?; - let mut v = Vec::new(); - - f.read_to_end(&mut v)?; - - Ok(serde_json::from_slice(&v)?) -} - -fn item_key(pallet: &[u8], item: &[u8]) -> String { - let k = substorager::storage_key(pallet, item); - - array_bytes::bytes2hex("0x", &k.0) -} - -fn full_key(pallet: &[u8], item: &[u8], hash: &str) -> String { - format!("{}{hash}", item_key(pallet, item)) -} - -fn encode_value(v: V) -> String -where - V: Encode, -{ - array_bytes::bytes2hex("0x", &v.encode()) -} - -fn decode(hex: &str) -> Result -where - D: Decode, -{ - let v = array_bytes::hex2bytes(hex).map_err(|e| anyhow::anyhow!("{e:?}"))?; - - Ok(D::decode(&mut &*v)?) -} - -// twox128(pallet) + twox128(item) -> twox128(pallet) + twox128(item) -fn get_identity_key(key: &str, _: &str) -> String { - key.into() -} - -// twox128(pallet) + twox128(item) + *(item_key) -> *(item_key) -fn get_hashed_key(full_key: &str, item_key: &str) -> String { - full_key.trim_start_matches(item_key).into() -} - -// twox128(pallet) + twox128(item) + *_concat(account_id_32) -> account_id_32 -fn get_last_64(key: &str) -> String { - format!("0x{}", &key[key.len() - 64..]) -} - -fn replace_first_match(key: &str, from: &str, to: &str) -> String { - key.replacen(from, to, 1) -} - -fn blake2_128_concat_to_string(data: D) -> String -where - D: AsRef<[u8]>, -{ - array_bytes::bytes2hex("", subhasher::blake2_128_concat(data)) -} - -fn is_evm_address(address: &[u8]) -> bool { - address.starts_with(b"dvm:") - && address[1..31].iter().fold(address[0], |checksum, &b| checksum ^ b) == address[31] -} diff --git a/tool/state-processor/src/processor.rs b/tool/state-processor/src/processor.rs new file mode 100644 index 000000000..4fb1e3977 --- /dev/null +++ b/tool/state-processor/src/processor.rs @@ -0,0 +1,316 @@ +// std +use std::{ + fs::File, + io::{Read, Write}, + marker::PhantomData, + mem, + sync::RwLock, +}; +// darwinia +use crate::*; +// crates.io +use anyhow::Result; +use fxhash::FxHashMap; +use once_cell::sync::Lazy; +use parity_scale_codec::{Decode, Encode}; +use serde::de::DeserializeOwned; +// hack-ink +use subspector::ChainSpec; + +pub type Map = FxHashMap; + +pub static NOW: Lazy> = Lazy::new(|| RwLock::new(0)); + +pub struct Processor { + pub solo_state: State, + pub para_state: State<()>, + pub shell_state: State<()>, + pub shell_chain_spec: ChainSpec, +} +impl Processor +where + S: Configurable, +{ + pub fn new() -> Result { + build_spec(S::NAME)?; + download_specs(S::NAME)?; + + let mut shell_chain_spec = from_file::(&format!("data/{}-shell.json", S::NAME))?; + + Ok(Self { + solo_state: State::from_file(&format!("data/{}-solo.json", S::NAME))?, + para_state: State::from_file(&format!("data/{}-para.json", S::NAME))?, + shell_state: State { + map: mem::take(&mut shell_chain_spec.genesis.raw.top), + _runtime: Default::default(), + }, + shell_chain_spec, + }) + } + + pub fn process(mut self) -> Result<()> { + self.solo_state.get_value(b"System", b"Number", "", &mut *NOW.write().unwrap()); + + let _guard = NOW.read().unwrap(); + + assert!(*_guard != 0); + + self.process_system() + .process_indices() + .process_vesting() + .process_proxy() + .process_staking() + .process_evm(); + + self.save() + } + + pub fn save(mut self) -> Result<()> { + log::info!("saving processed chain spec"); + + mem::swap(&mut self.shell_state.map, &mut self.shell_chain_spec.genesis.raw.top); + + let mut f = File::create(format!("data/{}-processed.json", S::NAME))?; + let v = serde_json::to_vec(&self.shell_chain_spec)?; + + f.write_all(&v)?; + + Ok(()) + } +} + +pub struct State { + map: Map, + _runtime: PhantomData, +} +impl State { + pub fn from_file(path: &str) -> Result { + Ok(Self { + map: from_file::(path)?.genesis.raw.top, + _runtime: >::default(), + }) + } + + pub fn insert_raw_key_raw_value(&mut self, key: String, value: String) -> &mut Self { + self.map.insert(key, value); + + self + } + + pub fn insert_raw_key_value(&mut self, key: String, value: E) -> &mut Self + where + E: Encode, + { + self.map.insert(key, encode_value(value)); + + self + } + + pub fn take_raw_map( + &mut self, + prefix: &str, + buffer: &mut Map, + process_key: F, + ) -> &mut Self + where + F: Fn(&str, &str) -> String, + { + self.map.retain(|k, v| { + if k.starts_with(prefix) { + buffer.insert(process_key(k, prefix), v.to_owned()); + + false + } else { + true + } + }); + + self + } + + pub fn insert_raw_key_map(&mut self, pairs: Map) -> &mut Self { + pairs.into_iter().for_each(|(k, v)| { + if self.map.contains_key(&k) { + log::error!("key({k}) has already existed, overriding"); + } + + self.map.insert(k, v); + }); + + self + } + + pub fn get_value(&self, pallet: &[u8], item: &[u8], hash: &str, value: &mut D) -> &Self + where + D: Decode, + { + let key = full_key(pallet, item, hash); + + if let Some(v) = self.map.get(&key) { + match decode(v) { + Ok(v) => *value = v, + Err(e) => log::error!( + "failed to decode `{}::{}::{hash}({v})`, due to `{e}`", + String::from_utf8_lossy(pallet), + String::from_utf8_lossy(item), + ), + } + } else { + log::error!( + "key not found `{}::{}::{hash}`", + String::from_utf8_lossy(pallet), + String::from_utf8_lossy(item), + ); + } + + self + } + + pub fn take_value( + &mut self, + pallet: &[u8], + item: &[u8], + hash: &str, + value: &mut D, + ) -> &mut Self + where + D: Decode, + { + let key = full_key(pallet, item, hash); + + if let Some(v) = self.map.remove(&key) { + match decode(&v) { + Ok(v) => *value = v, + Err(e) => log::error!( + "failed to decode `{}::{}::{hash}({v})`, due to `{e}`", + String::from_utf8_lossy(pallet), + String::from_utf8_lossy(item) + ), + } + } else { + log::error!( + "key not found `{}::{}::{hash}`", + String::from_utf8_lossy(pallet), + String::from_utf8_lossy(item), + ); + } + + self + } + + pub fn insert_value(&mut self, pallet: &[u8], item: &[u8], hash: &str, value: E) -> &mut Self + where + E: Encode, + { + self.map.insert(full_key(pallet, item, hash), encode_value(value)); + + self + } + + pub fn mutate_value(&mut self, pallet: &[u8], item: &[u8], hash: &str, f: F) -> &mut Self + where + D: Default + Encode + Decode, + F: FnOnce(&mut D), + { + let mut v = D::default(); + + self.get_value(pallet, item, hash, &mut v); + + f(&mut v); + + self.insert_value(pallet, item, hash, v); + + self + } + + pub fn take_map( + &mut self, + pallet: &[u8], + item: &[u8], + buffer: &mut Map, + process_key: F, + ) -> &mut Self + where + D: Decode, + F: Fn(&str, &str) -> String, + { + let len = buffer.len(); + let prefix = item_key(pallet, item); + + self.map.retain(|full_key, v| { + if full_key.starts_with(&prefix) { + match decode(v) { + Ok(v) => { + buffer.insert(process_key(full_key, &prefix), v); + }, + Err(e) => log::error!("failed to decode `{full_key}:{v}`, due to `{e}`"), + } + + false + } else { + true + } + }); + + if buffer.len() == len { + log::info!( + "no new item inserted for {}::{}", + String::from_utf8_lossy(pallet), + String::from_utf8_lossy(item) + ); + } + + self + } + + pub fn insert_map(&mut self, pairs: Map, process_key: F) -> &mut Self + where + E: Encode, + F: Fn(&str) -> String, + { + pairs.into_iter().for_each(|(k, v)| { + self.map.insert(process_key(&k), encode_value(v)); + }); + + self + } + + pub fn contains_key(&self, key: &str) -> bool { + self.map.contains_key(key) + } + + // pub fn inc_consumers(&mut self, who: &str) {} + + // pub fn transfer(&mut self, from: &str, to: &str, amount: u128) {} + + pub fn unreserve(&mut self, account_id_32: A, amount: u128) + where + A: AsRef<[u8]>, + { + let account_id_32 = account_id_32.as_ref(); + let (p, i, h) = if is_evm_address(account_id_32) { + (&b"System"[..], &b"Account"[..], &account_id_32[11..31]) + } else { + (&b"AccountMigration"[..], &b"Accounts"[..], account_id_32) + }; + + self.mutate_value(p, i, &blake2_128_concat_to_string(h), |a: &mut AccountInfo| { + a.data.free += amount; + a.data.reserved -= amount; + }); + } +} + +pub fn from_file(path: &str) -> Result +where + D: DeserializeOwned, +{ + log::info!("load data from {path:?}"); + + let mut f = File::open(path)?; + let mut v = Vec::new(); + + f.read_to_end(&mut v)?; + + Ok(serde_json::from_slice(&v)?) +} diff --git a/tool/state-processor/src/staking/README.md b/tool/state-processor/src/staking/README.md index deffe19ba..4726c829d 100644 --- a/tool/state-processor/src/staking/README.md +++ b/tool/state-processor/src/staking/README.md @@ -1,4 +1,4 @@ ### Process steps -- take solo `Staking::Bonded`, `Staking::Ledger`, `Staking::RingPool`, `Staking::KtonPool` and `Staking::LivingTime` +- take solo `Staking::Ledger`, `Staking::RingPool`, `Staking::KtonPool` and `Staking::LivingTime` - adjust decimals and block number, convert ledger, adjust unstaking duration then set `AccountMigration::Ledgers` and `AccountMigration::Deposits` - set `Staking::RingPool` and `Staking::KtonPool` diff --git a/tool/state-processor/src/staking/mod.rs b/tool/state-processor/src/staking/mod.rs index f4060b4bd..908ae41d6 100644 --- a/tool/state-processor/src/staking/mod.rs +++ b/tool/state-processor/src/staking/mod.rs @@ -5,7 +5,6 @@ impl Processor { pub fn process_staking(&mut self) -> &mut Self { // Storage items. // https://github.dev/darwinia-network/darwinia-common/blob/darwinia-v0.12.5/frame/staking/src/lib.rs#L560 - let mut bonded = >::default(); let mut ledgers = >::default(); let mut ring_pool_storage = u128::default(); let mut kton_pool_storage = u128::default(); @@ -13,19 +12,13 @@ impl Processor { let mut kton_pool = u128::default(); let mut elapsed_time = u64::default(); - log::info!("take solo `Staking::Bonded`, `Staking::Ledger`, `Staking::RingPool`, `Staking::KtonPool` and `Staking::LivingTime`"); + log::info!("take solo `Staking::Ledger`, `Staking::RingPool`, `Staking::KtonPool` and `Staking::LivingTime`"); self.solo_state - .take_raw_map(&item_key(b"Staking", b"Bonded"), &mut bonded, |key, from| { - replace_first_match(key, from, &item_key(b"AccountMigration", b"Bonded")) - }) .take_map(b"Staking", b"Ledger", &mut ledgers, get_identity_key) .take_value(b"Staking", b"RingPool", "", &mut ring_pool_storage) .take_value(b"Staking", b"KtonPool", "", &mut kton_pool_storage) .take_value(b"Staking", b"LivingTime", "", &mut elapsed_time); - log::info!("set `Staking::Bonded`"); - self.shell_state.insert_raw_key_map(bonded); - log::info!("adjust decimals and block number, convert ledger, adjust unstaking duration then set `AccountMigration::Ledgers` and `AccountMigration::Deposits`"); { let staking_ik = item_key(b"AccountMigration", b"Ledgers"); diff --git a/tool/state-processor/src/system/mod.rs b/tool/state-processor/src/system/mod.rs index 4b5309d8e..ae5ce2106 100644 --- a/tool/state-processor/src/system/mod.rs +++ b/tool/state-processor/src/system/mod.rs @@ -1,3 +1,5 @@ +// crates.io +use parity_scale_codec::Encode; // darwinia use crate::*; diff --git a/tool/state-processor/src/util.rs b/tool/state-processor/src/util.rs new file mode 100644 index 000000000..ec3365fe8 --- /dev/null +++ b/tool/state-processor/src/util.rs @@ -0,0 +1,95 @@ +// std +use std::{ + fs::File, + process::{Command, Stdio}, +}; +// crates.io +use parity_scale_codec::{Decode, Encode}; +use tar::Archive; +use zstd::Decoder; +// darwinia +use crate::*; + +pub fn item_key(pallet: &[u8], item: &[u8]) -> String { + let k = substorager::storage_key(pallet, item); + + array_bytes::bytes2hex("0x", &k.0) +} + +pub fn full_key(pallet: &[u8], item: &[u8], hash: &str) -> String { + format!("{}{hash}", item_key(pallet, item)) +} + +pub fn encode_value(v: V) -> String +where + V: Encode, +{ + array_bytes::bytes2hex("0x", &v.encode()) +} + +pub fn decode(hex: &str) -> Result +where + D: Decode, +{ + let v = array_bytes::hex2bytes(hex).map_err(|e| anyhow::anyhow!("{e:?}"))?; + + Ok(D::decode(&mut &*v)?) +} + +// twox128(pallet) + twox128(item) -> twox128(pallet) + twox128(item) +pub fn get_identity_key(key: &str, _: &str) -> String { + key.into() +} + +// twox128(pallet) + twox128(item) + *(item_key) -> *(item_key) +pub fn get_hashed_key(full_key: &str, item_key: &str) -> String { + full_key.trim_start_matches(item_key).into() +} + +// twox128(pallet) + twox128(item) + *_concat(account_id_32) -> account_id_32 +pub fn get_last_64(key: &str) -> String { + format!("0x{}", &key[key.len() - 64..]) +} + +pub fn replace_first_match(key: &str, from: &str, to: &str) -> String { + key.replacen(from, to, 1) +} + +pub fn blake2_128_concat_to_string(data: D) -> String +where + D: AsRef<[u8]>, +{ + array_bytes::bytes2hex("", subhasher::blake2_128_concat(data)) +} + +pub fn is_evm_address(address: &[u8]) -> bool { + address.starts_with(b"dvm:") + && address[1..31].iter().fold(address[0], |checksum, &b| checksum ^ b) == address[31] +} + +pub fn build_spec(chain: &str) -> Result<()> { + Command::new("../../target/release/darwinia") + .args(["build-spec", "--chain", &format!("{chain}-genesis")]) + .stdout(Stdio::from(File::create(format!("data/{chain}-shell.json"))?)) + .output()?; + + Ok(()) +} + +pub fn download_specs(chain: &str) -> Result<()> { + let decoder = Decoder::new( + ureq::get(&format!( + "https://github.com/darwinia-network/darwinia-2.0/releases/download/{chain}2/{chain}-state.tar.zst" + )) + .call()? + .into_reader(), + )?; + + for e in Archive::new(decoder).entries()? { + let mut e = e?; + + e.unpack(format!("data/{}", e.path()?.to_string_lossy()))?; + } + + Ok(()) +} From 459becae40f6c83bec618ba614d23e3df0a345bc Mon Sep 17 00:00:00 2001 From: bear Date: Thu, 5 Jan 2023 07:04:47 +0800 Subject: [PATCH 080/189] Add darwinia dispatch precompile (#173) * Add darwinia dispatch * Fix test Co-authored-by: Xavier Lau Co-authored-by: fisher --- Cargo.lock | 35 +++++------ precompile/dispatch/Cargo.toml | 37 ++++++++++++ precompile/dispatch/src/lib.rs | 93 +++++++++++++++++++++++++++++ precompile/state-storage/Cargo.toml | 2 +- runtime/crab/Cargo.toml | 4 +- runtime/crab/src/pallets/evm.rs | 2 +- runtime/darwinia/Cargo.toml | 4 +- runtime/darwinia/src/pallets/evm.rs | 2 +- runtime/pangolin/Cargo.toml | 6 +- runtime/pangolin/src/pallets/evm.rs | 2 +- 10 files changed, 159 insertions(+), 28 deletions(-) create mode 100644 precompile/dispatch/Cargo.toml create mode 100644 precompile/dispatch/src/lib.rs diff --git a/Cargo.lock b/Cargo.lock index 8b0a2668a..6a5ffc839 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -15,7 +15,7 @@ dependencies = [ [[package]] name = "account" version = "0.1.1" -source = "git+https://github.com/darwinia-network/moonbeam?branch=polkadot-v0.9.30#9d31c6120bb0f317053da9cac7fe7cd2a44f844c" +source = "git+https://github.com/darwinia-network/moonbeam.git?branch=polkadot-v0.9.30#9d31c6120bb0f317053da9cac7fe7cd2a44f844c" dependencies = [ "blake2-rfc", "hex", @@ -1361,6 +1361,7 @@ dependencies = [ "darwinia-precompile-assets", "darwinia-precompile-bls12-381", "darwinia-precompile-deposit", + "darwinia-precompile-dispatch", "darwinia-precompile-staking", "darwinia-precompile-state-storage", "darwinia-staking", @@ -1390,7 +1391,6 @@ dependencies = [ "pallet-evm", "pallet-evm-precompile-blake2", "pallet-evm-precompile-bn128", - "pallet-evm-precompile-dispatch", "pallet-evm-precompile-modexp", "pallet-evm-precompile-simple", "pallet-fee-market", @@ -2451,6 +2451,17 @@ dependencies = [ "sp-std", ] +[[package]] +name = "darwinia-precompile-dispatch" +version = "6.0.0" +dependencies = [ + "fp-evm", + "frame-support", + "pallet-evm", + "precompile-utils", + "sp-std", +] + [[package]] name = "darwinia-precompile-staking" version = "6.0.0" @@ -2517,6 +2528,7 @@ dependencies = [ "darwinia-precompile-assets", "darwinia-precompile-bls12-381", "darwinia-precompile-deposit", + "darwinia-precompile-dispatch", "darwinia-precompile-staking", "darwinia-precompile-state-storage", "darwinia-staking", @@ -2546,7 +2558,6 @@ dependencies = [ "pallet-evm", "pallet-evm-precompile-blake2", "pallet-evm-precompile-bn128", - "pallet-evm-precompile-dispatch", "pallet-evm-precompile-modexp", "pallet-evm-precompile-simple", "pallet-fee-market", @@ -6785,16 +6796,6 @@ dependencies = [ "substrate-bn", ] -[[package]] -name = "pallet-evm-precompile-dispatch" -version = "2.0.0-dev" -source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.30#1bd889c001b2a4735777160354cb57b8c17cf756" -dependencies = [ - "fp-evm", - "frame-support", - "pallet-evm", -] - [[package]] name = "pallet-evm-precompile-modexp" version = "2.0.0-dev" @@ -7455,6 +7456,7 @@ dependencies = [ "darwinia-precompile-assets", "darwinia-precompile-bls12-381", "darwinia-precompile-deposit", + "darwinia-precompile-dispatch", "darwinia-precompile-staking", "darwinia-precompile-state-storage", "darwinia-staking", @@ -7483,7 +7485,6 @@ dependencies = [ "pallet-evm", "pallet-evm-precompile-blake2", "pallet-evm-precompile-bn128", - "pallet-evm-precompile-dispatch", "pallet-evm-precompile-modexp", "pallet-evm-precompile-simple", "pallet-fee-market", @@ -9025,7 +9026,7 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "precompile-utils" version = "0.1.0" -source = "git+https://github.com/darwinia-network/moonbeam?branch=polkadot-v0.9.30#9d31c6120bb0f317053da9cac7fe7cd2a44f844c" +source = "git+https://github.com/darwinia-network/moonbeam.git?branch=polkadot-v0.9.30#9d31c6120bb0f317053da9cac7fe7cd2a44f844c" dependencies = [ "affix", "evm", @@ -9051,7 +9052,7 @@ dependencies = [ [[package]] name = "precompile-utils-macro" version = "0.1.0" -source = "git+https://github.com/darwinia-network/moonbeam?branch=polkadot-v0.9.30#9d31c6120bb0f317053da9cac7fe7cd2a44f844c" +source = "git+https://github.com/darwinia-network/moonbeam.git?branch=polkadot-v0.9.30#9d31c6120bb0f317053da9cac7fe7cd2a44f844c" dependencies = [ "case", "num_enum", @@ -13924,7 +13925,7 @@ dependencies = [ [[package]] name = "xcm-primitives" version = "0.1.0" -source = "git+https://github.com/darwinia-network/moonbeam?branch=polkadot-v0.9.30#9d31c6120bb0f317053da9cac7fe7cd2a44f844c" +source = "git+https://github.com/darwinia-network/moonbeam.git?branch=polkadot-v0.9.30#9d31c6120bb0f317053da9cac7fe7cd2a44f844c" dependencies = [ "ethereum", "ethereum-types", diff --git a/precompile/dispatch/Cargo.toml b/precompile/dispatch/Cargo.toml new file mode 100644 index 000000000..1b9d9e0a3 --- /dev/null +++ b/precompile/dispatch/Cargo.toml @@ -0,0 +1,37 @@ +[package] +authors = ["Darwinia Network "] +description = "Call dispatch precompile for EVM pallet." +edition = "2021" +homepage = "https://darwinia.network" +license = "GPL-3.0" +name = "darwinia-precompile-dispatch" +readme = "README.md" +repository = "https://github.com/darwinia-network/darwinia" +version = "6.0.0" + +[dependencies] +# frontier +fp-evm = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +pallet-evm = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } + +# moonbeam +precompile-utils = { default-features = false, git = "https://github.com/darwinia-network/moonbeam.git", branch = "polkadot-v0.9.30" } + +# substrate +frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } + +[features] +default = ["std"] +std = [ + # frontier + "fp-evm/std", + "pallet-evm/std", + + # moonbeam + "precompile-utils/std", + + # substrate + "frame-support/std", + "sp-std/std", +] diff --git a/precompile/dispatch/src/lib.rs b/precompile/dispatch/src/lib.rs new file mode 100644 index 000000000..695f7fcdb --- /dev/null +++ b/precompile/dispatch/src/lib.rs @@ -0,0 +1,93 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +#![cfg_attr(not(feature = "std"), no_std)] + +extern crate alloc; + +// std +use alloc::format; +use core::marker::PhantomData; +// frontier +use fp_evm::{ExitError, PrecompileFailure}; +// moonbeam +use frame_support::{ + codec::{Decode, DecodeLimit as _}, + dispatch::{DispatchClass, Dispatchable, GetDispatchInfo, Pays, PostDispatchInfo}, + traits::{ConstU32, Get}, +}; +use pallet_evm::{AddressMapping, GasWeightMapping}; +use precompile_utils::prelude::*; + +// `DecodeLimit` specifies the max depth a call can use when decoding, as unbounded depth +// can be used to overflow the stack. +// Default value is 8, which is the same as in XCM call decoding. +pub struct Dispatch> { + _marker: PhantomData<(T, DecodeLimit)>, +} + +#[precompile_utils::precompile] +impl Dispatch +where + T: pallet_evm::Config, + T::RuntimeCall: Dispatchable + GetDispatchInfo + Decode, + ::RuntimeOrigin: From>, + DecodeLimit: Get, +{ + #[precompile::public("execute(bytes)")] + fn execute( + handle: &mut impl PrecompileHandle, + encoded_call: UnboundedBytes, + ) -> EvmResult { + let target_gas = handle.gas_limit(); + let context = handle.context(); + + let call = T::RuntimeCall::decode_with_depth_limit( + DecodeLimit::get(), + &mut encoded_call.as_bytes(), + ) + .map_err(|_| revert("decode failed"))?; + let info = call.get_dispatch_info(); + + let valid_call = info.pays_fee == Pays::Yes && info.class == DispatchClass::Normal; + if !valid_call { + return Err(revert("invalid call")); + } + + if let Some(gas) = target_gas { + let valid_weight = + info.weight.ref_time() <= T::GasWeightMapping::gas_to_weight(gas, false).ref_time(); + if !valid_weight { + return Err(PrecompileFailure::Error { exit_status: ExitError::OutOfGas }); + } + } + + let origin = T::AddressMapping::into_account_id(context.caller); + match call.dispatch(Some(origin).into()) { + Ok(post_info) => { + let cost = T::GasWeightMapping::weight_to_gas( + post_info.actual_weight.unwrap_or(info.weight), + ); + + handle.record_cost(cost)?; + Ok(true) + }, + Err(e) => Err(revert(format!("dispatch failed: {}", <&'static str>::from(e)))), + } + } +} diff --git a/precompile/state-storage/Cargo.toml b/precompile/state-storage/Cargo.toml index 45d396d96..5c9d35e54 100644 --- a/precompile/state-storage/Cargo.toml +++ b/precompile/state-storage/Cargo.toml @@ -1,6 +1,6 @@ [package] authors = ["Darwinia Network "] -description = "State storage precompiles for EVM pallet." +description = "State storage precompile for EVM pallet." edition = "2021" homepage = "https://darwinia.network" license = "GPL-3.0" diff --git a/runtime/crab/Cargo.toml b/runtime/crab/Cargo.toml index 403596853..3901f1ee6 100644 --- a/runtime/crab/Cargo.toml +++ b/runtime/crab/Cargo.toml @@ -41,6 +41,7 @@ darwinia-message-transact = { default-features = false, path = "../../pa darwinia-precompile-assets = { default-features = false, path = "../../precompile/assets" } darwinia-precompile-bls12-381 = { default-features = false, path = "../../precompile/bls12-381" } darwinia-precompile-deposit = { default-features = false, path = "../../precompile/deposit" } +darwinia-precompile-dispatch = { default-features = false, path = "../../precompile/dispatch" } darwinia-precompile-staking = { default-features = false, path = "../../precompile/staking" } darwinia-precompile-state-storage = { default-features = false, path = "../../precompile/state-storage" } darwinia-staking = { default-features = false, path = "../../pallet/staking" } @@ -66,7 +67,6 @@ pallet-ethereum = { default-features = false, features = ["forbid pallet-evm = { default-features = false, features = ["forbid-evm-reentrancy"], git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } pallet-evm-precompile-blake2 = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } pallet-evm-precompile-bn128 = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } -pallet-evm-precompile-dispatch = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } pallet-evm-precompile-modexp = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } pallet-evm-precompile-simple = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } @@ -155,6 +155,7 @@ std = [ "darwinia-precompile-bls12-381/std", "darwinia-precompile-staking/std", "darwinia-precompile-deposit/std", + "darwinia-precompile-dispatch/std", "darwinia-precompile-state-storage/std", "darwinia-staking/std", "dc-primitives/std", @@ -179,7 +180,6 @@ std = [ "pallet-evm/std", "pallet-evm-precompile-blake2/std", "pallet-evm-precompile-bn128/std", - "pallet-evm-precompile-dispatch/std", "pallet-evm-precompile-modexp/std", "pallet-evm-precompile-simple/std", diff --git a/runtime/crab/src/pallets/evm.rs b/runtime/crab/src/pallets/evm.rs index 9f07703cb..d9eb03a20 100644 --- a/runtime/crab/src/pallets/evm.rs +++ b/runtime/crab/src/pallets/evm.rs @@ -146,7 +146,7 @@ where darwinia_precompile_state_storage::EthereumStorageFilter, >>::execute(handle)), a if a == addr(1025) => - Some(>::execute(handle)), + Some(>::execute(handle)), // [1026, 1536) reserved for assets precompiles. a if (1026..1536).contains(&AssetIdConverter::account_to_asset_id(a.into())) => Some(>::execute( diff --git a/runtime/darwinia/Cargo.toml b/runtime/darwinia/Cargo.toml index 8a1d9792e..5857cd7bd 100644 --- a/runtime/darwinia/Cargo.toml +++ b/runtime/darwinia/Cargo.toml @@ -41,6 +41,7 @@ darwinia-message-transact = { default-features = false, path = "../../pa darwinia-precompile-assets = { default-features = false, path = "../../precompile/assets" } darwinia-precompile-bls12-381 = { default-features = false, path = "../../precompile/bls12-381" } darwinia-precompile-deposit = { default-features = false, path = "../../precompile/deposit" } +darwinia-precompile-dispatch = { default-features = false, path = "../../precompile/dispatch" } darwinia-precompile-staking = { default-features = false, path = "../../precompile/staking" } darwinia-precompile-state-storage = { default-features = false, path = "../../precompile/state-storage" } darwinia-staking = { default-features = false, path = "../../pallet/staking" } @@ -66,7 +67,6 @@ pallet-ethereum = { default-features = false, features = ["forbid pallet-evm = { default-features = false, features = ["forbid-evm-reentrancy"], git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } pallet-evm-precompile-blake2 = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } pallet-evm-precompile-bn128 = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } -pallet-evm-precompile-dispatch = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } pallet-evm-precompile-modexp = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } pallet-evm-precompile-simple = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } @@ -155,6 +155,7 @@ std = [ "darwinia-precompile-bls12-381/std", "darwinia-precompile-staking/std", "darwinia-precompile-deposit/std", + "darwinia-precompile-dispatch/std", "darwinia-precompile-state-storage/std", "darwinia-staking/std", "dc-primitives/std", @@ -179,7 +180,6 @@ std = [ "pallet-evm/std", "pallet-evm-precompile-blake2/std", "pallet-evm-precompile-bn128/std", - "pallet-evm-precompile-dispatch/std", "pallet-evm-precompile-modexp/std", "pallet-evm-precompile-simple/std", diff --git a/runtime/darwinia/src/pallets/evm.rs b/runtime/darwinia/src/pallets/evm.rs index 8578cc1b7..8132d2706 100644 --- a/runtime/darwinia/src/pallets/evm.rs +++ b/runtime/darwinia/src/pallets/evm.rs @@ -146,7 +146,7 @@ where darwinia_precompile_state_storage::EthereumStorageFilter, >>::execute(handle)), a if a == addr(1025) => - Some(>::execute(handle)), + Some(>::execute(handle)), // [1026, 1536) reserved for assets precompiles. a if (1026..1536).contains(&AssetIdConverter::account_to_asset_id(a.into())) => Some(>::execute( diff --git a/runtime/pangolin/Cargo.toml b/runtime/pangolin/Cargo.toml index 111bc3c1f..e1a608fbf 100644 --- a/runtime/pangolin/Cargo.toml +++ b/runtime/pangolin/Cargo.toml @@ -41,6 +41,7 @@ darwinia-message-transact = { default-features = false, path = "../../pa darwinia-precompile-assets = { default-features = false, path = "../../precompile/assets" } darwinia-precompile-bls12-381 = { default-features = false, path = "../../precompile/bls12-381" } darwinia-precompile-deposit = { default-features = false, path = "../../precompile/deposit" } +darwinia-precompile-dispatch = { default-features = false, path = "../../precompile/dispatch" } darwinia-precompile-staking = { default-features = false, path = "../../precompile/staking" } darwinia-precompile-state-storage = { default-features = false, path = "../../precompile/state-storage" } darwinia-staking = { default-features = false, path = "../../pallet/staking" } @@ -65,7 +66,6 @@ pallet-ethereum = { default-features = false, features = ["forbid pallet-evm = { default-features = false, features = ["forbid-evm-reentrancy"], git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } pallet-evm-precompile-blake2 = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } pallet-evm-precompile-bn128 = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } -pallet-evm-precompile-dispatch = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } pallet-evm-precompile-modexp = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } pallet-evm-precompile-simple = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } @@ -152,8 +152,9 @@ std = [ "darwinia-message-transact/std", "darwinia-precompile-assets/std", "darwinia-precompile-bls12-381/std", - "darwinia-precompile-staking/std", "darwinia-precompile-deposit/std", + "darwinia-precompile-dispatch/std", + "darwinia-precompile-staking/std", "darwinia-precompile-state-storage/std", "darwinia-staking/std", "dc-primitives/std", @@ -177,7 +178,6 @@ std = [ "pallet-evm/std", "pallet-evm-precompile-blake2/std", "pallet-evm-precompile-bn128/std", - "pallet-evm-precompile-dispatch/std", "pallet-evm-precompile-modexp/std", "pallet-evm-precompile-simple/std", diff --git a/runtime/pangolin/src/pallets/evm.rs b/runtime/pangolin/src/pallets/evm.rs index 0174f96c2..597d6bb6b 100644 --- a/runtime/pangolin/src/pallets/evm.rs +++ b/runtime/pangolin/src/pallets/evm.rs @@ -146,7 +146,7 @@ where darwinia_precompile_state_storage::EthereumStorageFilter, >>::execute(handle)), a if a == addr(1025) => - Some(>::execute(handle)), + Some(>::execute(handle)), // [1026, 1536) reserved for assets precompiles. a if (1026..1536).contains(&AssetIdConverter::account_to_asset_id(a.into())) => Some(>::execute( From 702cdea2573a3436a59f558c3452993dff6249dc Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Thu, 5 Jan 2023 11:16:34 +0800 Subject: [PATCH 081/189] Process sudo (#177) * Process sudo * Add testing key --- Cargo.lock | 8 ++++---- node/src/chain_spec/crab.rs | 2 +- node/src/chain_spec/darwinia.rs | 2 +- node/src/chain_spec/pangolin.rs | 2 +- tool/state-processor/src/main.rs | 1 + tool/state-processor/src/processor.rs | 1 + tool/state-processor/src/sudo/mod.rs | 17 +++++++++++++++++ 7 files changed, 26 insertions(+), 7 deletions(-) create mode 100644 tool/state-processor/src/sudo/mod.rs diff --git a/Cargo.lock b/Cargo.lock index 6a5ffc839..af602e5cc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -15,7 +15,7 @@ dependencies = [ [[package]] name = "account" version = "0.1.1" -source = "git+https://github.com/darwinia-network/moonbeam.git?branch=polkadot-v0.9.30#9d31c6120bb0f317053da9cac7fe7cd2a44f844c" +source = "git+https://github.com/darwinia-network/moonbeam?branch=polkadot-v0.9.30#9d31c6120bb0f317053da9cac7fe7cd2a44f844c" dependencies = [ "blake2-rfc", "hex", @@ -9026,7 +9026,7 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "precompile-utils" version = "0.1.0" -source = "git+https://github.com/darwinia-network/moonbeam.git?branch=polkadot-v0.9.30#9d31c6120bb0f317053da9cac7fe7cd2a44f844c" +source = "git+https://github.com/darwinia-network/moonbeam?branch=polkadot-v0.9.30#9d31c6120bb0f317053da9cac7fe7cd2a44f844c" dependencies = [ "affix", "evm", @@ -9052,7 +9052,7 @@ dependencies = [ [[package]] name = "precompile-utils-macro" version = "0.1.0" -source = "git+https://github.com/darwinia-network/moonbeam.git?branch=polkadot-v0.9.30#9d31c6120bb0f317053da9cac7fe7cd2a44f844c" +source = "git+https://github.com/darwinia-network/moonbeam?branch=polkadot-v0.9.30#9d31c6120bb0f317053da9cac7fe7cd2a44f844c" dependencies = [ "case", "num_enum", @@ -13925,7 +13925,7 @@ dependencies = [ [[package]] name = "xcm-primitives" version = "0.1.0" -source = "git+https://github.com/darwinia-network/moonbeam.git?branch=polkadot-v0.9.30#9d31c6120bb0f317053da9cac7fe7cd2a44f844c" +source = "git+https://github.com/darwinia-network/moonbeam?branch=polkadot-v0.9.30#9d31c6120bb0f317053da9cac7fe7cd2a44f844c" dependencies = [ "ethereum", "ethereum-types", diff --git a/node/src/chain_spec/crab.rs b/node/src/chain_spec/crab.rs index f426e3112..88c0b8276 100644 --- a/node/src/chain_spec/crab.rs +++ b/node/src/chain_spec/crab.rs @@ -188,7 +188,7 @@ pub fn genesis_config() -> ChainSpec { treasury: Default::default(), // Utility stuff. - sudo: Default::default(), + sudo: SudoConfig { key: Some(array_bytes::hex_n_into_unchecked(ALITH)) }, vesting: Default::default(), // XCM stuff. diff --git a/node/src/chain_spec/darwinia.rs b/node/src/chain_spec/darwinia.rs index e35d3156b..65d80f487 100644 --- a/node/src/chain_spec/darwinia.rs +++ b/node/src/chain_spec/darwinia.rs @@ -188,7 +188,7 @@ pub fn genesis_config() -> ChainSpec { treasury: Default::default(), // Utility stuff. - sudo: Default::default(), + sudo: SudoConfig { key: Some(array_bytes::hex_n_into_unchecked(ALITH)) }, vesting: Default::default(), // XCM stuff. diff --git a/node/src/chain_spec/pangolin.rs b/node/src/chain_spec/pangolin.rs index c8ddf4d02..50164a3a6 100644 --- a/node/src/chain_spec/pangolin.rs +++ b/node/src/chain_spec/pangolin.rs @@ -188,7 +188,7 @@ pub fn genesis_config() -> ChainSpec { treasury: Default::default(), // Utility stuff. - sudo: Default::default(), + sudo: SudoConfig { key: Some(array_bytes::hex_n_into_unchecked(ALITH)) }, vesting: Default::default(), // XCM stuff. diff --git a/tool/state-processor/src/main.rs b/tool/state-processor/src/main.rs index 76f52e0b5..fd9df8d2c 100644 --- a/tool/state-processor/src/main.rs +++ b/tool/state-processor/src/main.rs @@ -18,6 +18,7 @@ mod evm; mod indices; mod proxy; mod staking; +mod sudo; mod system; mod vesting; diff --git a/tool/state-processor/src/processor.rs b/tool/state-processor/src/processor.rs index 4fb1e3977..07efbcda6 100644 --- a/tool/state-processor/src/processor.rs +++ b/tool/state-processor/src/processor.rs @@ -59,6 +59,7 @@ where .process_indices() .process_vesting() .process_proxy() + .process_sudo() .process_staking() .process_evm(); diff --git a/tool/state-processor/src/sudo/mod.rs b/tool/state-processor/src/sudo/mod.rs new file mode 100644 index 000000000..a13d8eb88 --- /dev/null +++ b/tool/state-processor/src/sudo/mod.rs @@ -0,0 +1,17 @@ +// darwinia +use crate::*; + +impl Processor { + pub fn process_sudo(&mut self) -> &mut Self { + // Storage items. + // https://github.dev/darwinia-network/substrate/blob/darwinia-v0.12.5/frame/sudo/src/lib.rs#L268 + // + // The new sudo key will be set on the genesis side. + // We just need to kill the old keys. + log::info!("drain solo and para `Sudo::Key`"); + self.solo_state.take_value(b"Sudo", b"Key", "", &mut [0_u8; 32]); + self.para_state.take_value(b"Sudo", b"Key", "", &mut [0_u8; 32]); + + self + } +} From 511c26e4d28af9916707d11fc7eb33cfd461753e Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Thu, 5 Jan 2023 12:25:28 +0800 Subject: [PATCH 082/189] Fixes (#179) * Fix * Bump to fix * Fix genesis * Fix build spec * Test env --- node/src/chain_spec/crab.rs | 6 ++- node/src/chain_spec/darwinia.rs | 6 ++- node/src/chain_spec/pangolin.rs | 6 ++- tool/state-processor/Cargo.lock | 62 +++++++++++++-------------- tool/state-processor/src/main.rs | 2 +- tool/state-processor/src/processor.rs | 13 ++++++ tool/state-processor/src/util.rs | 17 +++++++- 7 files changed, 72 insertions(+), 40 deletions(-) diff --git a/node/src/chain_spec/crab.rs b/node/src/chain_spec/crab.rs index 88c0b8276..0582a5492 100644 --- a/node/src/chain_spec/crab.rs +++ b/node/src/chain_spec/crab.rs @@ -149,7 +149,9 @@ pub fn genesis_config() -> ChainSpec { parachain_info: ParachainInfoConfig { parachain_id: 2105.into() }, // Monetary stuff. - balances: Default::default(), + balances: BalancesConfig { + balances: vec![(array_bytes::hex_n_into_unchecked(ALITH), UNIT)], + }, transaction_payment: Default::default(), assets: AssetsConfig { assets: vec![(AssetIds::CKton as _, ROOT, true, 1)], @@ -167,7 +169,7 @@ pub fn genesis_config() -> ChainSpec { now: SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_millis(), elapsed_time: 0, collator_count: 3, - collators: Vec::new(), + collators: vec![(array_bytes::hex_n_into_unchecked(ALITH), UNIT)], }, session: SessionConfig { keys: vec![( diff --git a/node/src/chain_spec/darwinia.rs b/node/src/chain_spec/darwinia.rs index 65d80f487..4b19167d4 100644 --- a/node/src/chain_spec/darwinia.rs +++ b/node/src/chain_spec/darwinia.rs @@ -149,7 +149,9 @@ pub fn genesis_config() -> ChainSpec { parachain_info: ParachainInfoConfig { parachain_id: 2046.into() }, // Monetary stuff. - balances: Default::default(), + balances: BalancesConfig { + balances: vec![(array_bytes::hex_n_into_unchecked(ALITH), UNIT)], + }, transaction_payment: Default::default(), assets: AssetsConfig { assets: vec![(AssetIds::Kton as _, ROOT, true, 1)], @@ -167,7 +169,7 @@ pub fn genesis_config() -> ChainSpec { now: SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_millis(), elapsed_time: 0, collator_count: 3, - collators: Vec::new(), + collators: vec![(array_bytes::hex_n_into_unchecked(ALITH), UNIT)], }, session: SessionConfig { keys: vec![( diff --git a/node/src/chain_spec/pangolin.rs b/node/src/chain_spec/pangolin.rs index 50164a3a6..5241b95c7 100644 --- a/node/src/chain_spec/pangolin.rs +++ b/node/src/chain_spec/pangolin.rs @@ -149,7 +149,9 @@ pub fn genesis_config() -> ChainSpec { parachain_info: ParachainInfoConfig { parachain_id: 2105.into() }, // Monetary stuff. - balances: Default::default(), + balances: BalancesConfig { + balances: vec![(array_bytes::hex_n_into_unchecked(ALITH), UNIT)], + }, transaction_payment: Default::default(), assets: AssetsConfig { assets: vec![(AssetIds::PKton as _, ROOT, true, 1)], @@ -167,7 +169,7 @@ pub fn genesis_config() -> ChainSpec { now: SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_millis(), elapsed_time: 0, collator_count: 3, - collators: Vec::new(), + collators: vec![(array_bytes::hex_n_into_unchecked(ALITH), UNIT)], }, session: SessionConfig { keys: vec![( diff --git a/tool/state-processor/Cargo.lock b/tool/state-processor/Cargo.lock index 145cc8075..3b052ae95 100644 --- a/tool/state-processor/Cargo.lock +++ b/tool/state-processor/Cargo.lock @@ -19,9 +19,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.66" +version = "1.0.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "216261ddc8289130e551ddcd5ce8a064710c0d064a4d2895c67151c92b5443f6" +checksum = "2cb2f989d18dd141ab8ae82f64d1a8cdd37e0840f73a406896cf5e99502fab61" [[package]] name = "array-bytes" @@ -329,9 +329,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.4" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4217ad341ebadf8d8e724e264f13e593e0648f5b3e94b3896a5df283be015ecc" +checksum = "fad582f4b9e86b6caa621cabeb0963332d92eea04729ab12892c2533951e6440" [[package]] name = "jobserver" @@ -353,9 +353,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.138" +version = "0.2.139" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db6d7e329c562c5dfab7a46a2afabc8b987ab9a4834c9d1ca04dc54c1546cef8" +checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79" [[package]] name = "log" @@ -389,9 +389,9 @@ checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" [[package]] name = "once_cell" -version = "1.16.0" +version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860" +checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66" [[package]] name = "parity-scale-codec" @@ -465,9 +465,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.47" +version = "1.0.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ea3d908b0e36316caf9e9e2c4625cdde190a7e6f440d794667ed17a1855e725" +checksum = "57a8eca9f9c4ffde41714334dee777596264c7825420f521abc92b5b5deb63a5" dependencies = [ "unicode-ident", ] @@ -480,9 +480,9 @@ checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" [[package]] name = "quote" -version = "1.0.21" +version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179" +checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b" dependencies = [ "proc-macro2", ] @@ -584,9 +584,9 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.11" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09" +checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde" [[package]] name = "sct" @@ -600,18 +600,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.150" +version = "1.0.152" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e326c9ec8042f1b5da33252c8a37e9ffbd2c9bef0155215b6e6c80c790e05f91" +checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.150" +version = "1.0.152" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42a3df25b0713732468deadad63ab9da1f1fd75a48a15024b50363f128db627e" +checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e" dependencies = [ "proc-macro2", "quote", @@ -620,9 +620,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.89" +version = "1.0.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "020ff22c755c2ed3f8cf162dbb41a7268d934702f3ed3631656ea597e08fc3db" +checksum = "877c235533714907a8c2464236f5c4b2a17262ef1bd71f38f35ea592c8da6883" dependencies = [ "itoa", "ryu", @@ -677,7 +677,7 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] name = "subhasher" version = "0.9.0-rc20" -source = "git+https://github.com/hack-ink/subalfred#4514b3728e2a8250354ea6dc4a3b12f79f436419" +source = "git+https://github.com/hack-ink/subalfred#f1a80ef1a41111d2cd85dc08db1726d1f6c98bab" dependencies = [ "blake2-rfc", "byteorder", @@ -689,7 +689,7 @@ dependencies = [ [[package]] name = "subspector" version = "0.9.0-rc20" -source = "git+https://github.com/hack-ink/subalfred#4514b3728e2a8250354ea6dc4a3b12f79f436419" +source = "git+https://github.com/hack-ink/subalfred#f1a80ef1a41111d2cd85dc08db1726d1f6c98bab" dependencies = [ "fxhash", "serde", @@ -699,7 +699,7 @@ dependencies = [ [[package]] name = "substorager" version = "0.9.0-rc20" -source = "git+https://github.com/hack-ink/subalfred#4514b3728e2a8250354ea6dc4a3b12f79f436419" +source = "git+https://github.com/hack-ink/subalfred#f1a80ef1a41111d2cd85dc08db1726d1f6c98bab" dependencies = [ "array-bytes", "subhasher", @@ -707,9 +707,9 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.105" +version = "1.0.107" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60b9b43d45702de4c839cb9b51d9f529c5dd26a4aff255b42b1ebc03e88ee908" +checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5" dependencies = [ "proc-macro2", "quote", @@ -744,18 +744,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.37" +version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10deb33631e3c9018b9baf9dcbbc4f737320d2b576bac10f6aefa048fa407e3e" +checksum = "6a9cd18aa97d5c45c6603caea1da6628790b37f7a34b6ca89522331c5180fed0" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.37" +version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "982d17546b47146b28f7c22e3d08465f6b8903d0ea13c1660d9d84a6e7adcdbb" +checksum = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f" dependencies = [ "proc-macro2", "quote", @@ -832,9 +832,9 @@ checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992" [[package]] name = "unicode-ident" -version = "1.0.5" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ceab39d59e4c9499d4e5a8ee0e2735b891bb7308ac83dfb4e80cad195c9f6f3" +checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc" [[package]] name = "unicode-normalization" diff --git a/tool/state-processor/src/main.rs b/tool/state-processor/src/main.rs index fd9df8d2c..e29387ed2 100644 --- a/tool/state-processor/src/main.rs +++ b/tool/state-processor/src/main.rs @@ -34,7 +34,7 @@ fn main() -> Result<()> { // >::new()?.process()?; // >::new()?.process()?; - >::new()?.process()?; + >::new()?.test().process()?; Ok(()) } diff --git a/tool/state-processor/src/processor.rs b/tool/state-processor/src/processor.rs index 07efbcda6..208ca8a51 100644 --- a/tool/state-processor/src/processor.rs +++ b/tool/state-processor/src/processor.rs @@ -14,6 +14,7 @@ use fxhash::FxHashMap; use once_cell::sync::Lazy; use parity_scale_codec::{Decode, Encode}; use serde::de::DeserializeOwned; +use serde_json::Value; // hack-ink use subspector::ChainSpec; @@ -26,6 +27,7 @@ pub struct Processor { pub para_state: State<()>, pub shell_state: State<()>, pub shell_chain_spec: ChainSpec, + pub test: bool, } impl Processor where @@ -45,9 +47,16 @@ where _runtime: Default::default(), }, shell_chain_spec, + test: false, }) } + pub fn test(mut self) -> Self { + self.test = true; + + self + } + pub fn process(mut self) -> Result<()> { self.solo_state.get_value(b"System", b"Number", "", &mut *NOW.write().unwrap()); @@ -71,6 +80,10 @@ where mem::swap(&mut self.shell_state.map, &mut self.shell_chain_spec.genesis.raw.top); + if self.test { + self.shell_chain_spec.extensions["relay_chain"] = Value::String("rococo-local".into()); + } + let mut f = File::create(format!("data/{}-processed.json", S::NAME))?; let v = serde_json::to_vec(&self.shell_chain_spec)?; diff --git a/tool/state-processor/src/util.rs b/tool/state-processor/src/util.rs index ec3365fe8..d99489209 100644 --- a/tool/state-processor/src/util.rs +++ b/tool/state-processor/src/util.rs @@ -1,6 +1,7 @@ // std use std::{ fs::File, + path::Path, process::{Command, Stdio}, }; // crates.io @@ -68,8 +69,20 @@ pub fn is_evm_address(address: &[u8]) -> bool { } pub fn build_spec(chain: &str) -> Result<()> { - Command::new("../../target/release/darwinia") - .args(["build-spec", "--chain", &format!("{chain}-genesis")]) + let mut path = "../../target/release/darwinia"; + + if !Path::new(path).is_file() { + path = "../../target/x86_64-unknown-linux-gnu/release/darwinia"; + } + + Command::new(path) + .args([ + "build-spec", + "--raw", + "--disable-default-bootnode", + "--chain", + &format!("{chain}-genesis"), + ]) .stdout(Stdio::from(File::create(format!("data/{chain}-shell.json"))?)) .output()?; From 0a7b51082d630c74cff68b660ae3f9c43f532423 Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Thu, 5 Jan 2023 15:24:48 +0800 Subject: [PATCH 083/189] Fund Alith (#182) * Fund Alith * Use local chain type --- node/src/chain_spec/crab.rs | 4 ++-- node/src/chain_spec/darwinia.rs | 4 ++-- node/src/chain_spec/pangolin.rs | 4 ++-- tool/state-processor/src/processor.rs | 1 + 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/node/src/chain_spec/crab.rs b/node/src/chain_spec/crab.rs index 0582a5492..bdbaf49c6 100644 --- a/node/src/chain_spec/crab.rs +++ b/node/src/chain_spec/crab.rs @@ -136,7 +136,7 @@ pub fn local_config() -> ChainSpec { } pub fn genesis_config() -> ChainSpec { - // TODO: update this before final release + // TODO: update this before the final release ChainSpec::from_genesis( "Crab2", "crab2", @@ -150,7 +150,7 @@ pub fn genesis_config() -> ChainSpec { // Monetary stuff. balances: BalancesConfig { - balances: vec![(array_bytes::hex_n_into_unchecked(ALITH), UNIT)], + balances: vec![(array_bytes::hex_n_into_unchecked(ALITH), 100_000_000 * UNIT)], }, transaction_payment: Default::default(), assets: AssetsConfig { diff --git a/node/src/chain_spec/darwinia.rs b/node/src/chain_spec/darwinia.rs index 4b19167d4..485b3fd12 100644 --- a/node/src/chain_spec/darwinia.rs +++ b/node/src/chain_spec/darwinia.rs @@ -136,7 +136,7 @@ pub fn local_config() -> ChainSpec { } pub fn genesis_config() -> ChainSpec { - // TODO: update this before final release + // TODO: update this before the final release ChainSpec::from_genesis( "Darwinia2", "darwinia2", @@ -150,7 +150,7 @@ pub fn genesis_config() -> ChainSpec { // Monetary stuff. balances: BalancesConfig { - balances: vec![(array_bytes::hex_n_into_unchecked(ALITH), UNIT)], + balances: vec![(array_bytes::hex_n_into_unchecked(ALITH), 100_000_000 * UNIT)], }, transaction_payment: Default::default(), assets: AssetsConfig { diff --git a/node/src/chain_spec/pangolin.rs b/node/src/chain_spec/pangolin.rs index 5241b95c7..0a0bd1e68 100644 --- a/node/src/chain_spec/pangolin.rs +++ b/node/src/chain_spec/pangolin.rs @@ -136,7 +136,7 @@ pub fn local_config() -> ChainSpec { } pub fn genesis_config() -> ChainSpec { - // TODO: update this before final release + // TODO: update this before the final release ChainSpec::from_genesis( "Pangolin2", "pangolin2", @@ -150,7 +150,7 @@ pub fn genesis_config() -> ChainSpec { // Monetary stuff. balances: BalancesConfig { - balances: vec![(array_bytes::hex_n_into_unchecked(ALITH), UNIT)], + balances: vec![(array_bytes::hex_n_into_unchecked(ALITH), 100_000_000 * UNIT)], }, transaction_payment: Default::default(), assets: AssetsConfig { diff --git a/tool/state-processor/src/processor.rs b/tool/state-processor/src/processor.rs index 208ca8a51..db3beaa4f 100644 --- a/tool/state-processor/src/processor.rs +++ b/tool/state-processor/src/processor.rs @@ -81,6 +81,7 @@ where mem::swap(&mut self.shell_state.map, &mut self.shell_chain_spec.genesis.raw.top); if self.test { + self.shell_chain_spec.chain_type = "Local".into(); self.shell_chain_spec.extensions["relay_chain"] = Value::String("rococo-local".into()); } From 95ef1e9c7a6419aa541c0d5b392454b2295b25fa Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Thu, 5 Jan 2023 15:56:19 +0800 Subject: [PATCH 084/189] Optional download (#183) --- tool/state-processor/src/processor.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tool/state-processor/src/processor.rs b/tool/state-processor/src/processor.rs index db3beaa4f..b5e4c3f23 100644 --- a/tool/state-processor/src/processor.rs +++ b/tool/state-processor/src/processor.rs @@ -4,6 +4,7 @@ use std::{ io::{Read, Write}, marker::PhantomData, mem, + path::Path, sync::RwLock, }; // darwinia @@ -35,13 +36,18 @@ where { pub fn new() -> Result { build_spec(S::NAME)?; - download_specs(S::NAME)?; let mut shell_chain_spec = from_file::(&format!("data/{}-shell.json", S::NAME))?; + let solo_path = format!("data/{}-solo.json", S::NAME); + let para_path = format!("data/{}-para.json", S::NAME); + + if !Path::new(&solo_path).is_file() || !Path::new(¶_path).is_file() { + download_specs(S::NAME)?; + } Ok(Self { - solo_state: State::from_file(&format!("data/{}-solo.json", S::NAME))?, - para_state: State::from_file(&format!("data/{}-para.json", S::NAME))?, + solo_state: State::from_file(&solo_path)?, + para_state: State::from_file(¶_path)?, shell_state: State { map: mem::take(&mut shell_chain_spec.genesis.raw.top), _runtime: Default::default(), From 5bb61bfc479562ba40573e8eee2cdfadeaee7003 Mon Sep 17 00:00:00 2001 From: bear Date: Fri, 6 Jan 2023 03:16:48 +0800 Subject: [PATCH 085/189] Fix processor tests (#175) * Fix test * Fix test * Delete sudo and metadata --- tool/state-processor/src/main.rs | 1 - tool/state-processor/src/processor.rs | 3 +- tool/state-processor/src/sudo/mod.rs | 17 --------- tool/state-processor/src/system/README.md | 1 - tool/state-processor/src/system/mod.rs | 14 ------- tool/state-processor/src/tests.rs | 46 +++-------------------- 6 files changed, 6 insertions(+), 76 deletions(-) delete mode 100644 tool/state-processor/src/sudo/mod.rs diff --git a/tool/state-processor/src/main.rs b/tool/state-processor/src/main.rs index e29387ed2..79a52845e 100644 --- a/tool/state-processor/src/main.rs +++ b/tool/state-processor/src/main.rs @@ -18,7 +18,6 @@ mod evm; mod indices; mod proxy; mod staking; -mod sudo; mod system; mod vesting; diff --git a/tool/state-processor/src/processor.rs b/tool/state-processor/src/processor.rs index b5e4c3f23..ad28ab8d8 100644 --- a/tool/state-processor/src/processor.rs +++ b/tool/state-processor/src/processor.rs @@ -74,7 +74,6 @@ where .process_indices() .process_vesting() .process_proxy() - .process_sudo() .process_staking() .process_evm(); @@ -101,7 +100,7 @@ where } pub struct State { - map: Map, + pub map: Map, _runtime: PhantomData, } impl State { diff --git a/tool/state-processor/src/sudo/mod.rs b/tool/state-processor/src/sudo/mod.rs deleted file mode 100644 index a13d8eb88..000000000 --- a/tool/state-processor/src/sudo/mod.rs +++ /dev/null @@ -1,17 +0,0 @@ -// darwinia -use crate::*; - -impl Processor { - pub fn process_sudo(&mut self) -> &mut Self { - // Storage items. - // https://github.dev/darwinia-network/substrate/blob/darwinia-v0.12.5/frame/sudo/src/lib.rs#L268 - // - // The new sudo key will be set on the genesis side. - // We just need to kill the old keys. - log::info!("drain solo and para `Sudo::Key`"); - self.solo_state.take_value(b"Sudo", b"Key", "", &mut [0_u8; 32]); - self.para_state.take_value(b"Sudo", b"Key", "", &mut [0_u8; 32]); - - self - } -} diff --git a/tool/state-processor/src/system/README.md b/tool/state-processor/src/system/README.md index 79df61a65..8eb034bde 100644 --- a/tool/state-processor/src/system/README.md +++ b/tool/state-processor/src/system/README.md @@ -31,7 +31,6 @@ - set KTON total issuances - compare the calculated one with the storage one - check remaining sum - TODO -- set `Assets::Metadata` - some remaining accounts, bridge endpoint accounts - TODO - special accounts - TODO diff --git a/tool/state-processor/src/system/mod.rs b/tool/state-processor/src/system/mod.rs index ae5ce2106..2b2fa4296 100644 --- a/tool/state-processor/src/system/mod.rs +++ b/tool/state-processor/src/system/mod.rs @@ -183,20 +183,6 @@ where kton_details, ); - log::info!("set `Assets::Metadata`"); - self.shell_state.insert_value( - b"Assets", - b"Metadata", - &blake2_128_concat_to_string(KTON_ID.encode()), - AssetMetadata { - deposit: 0, - name: S::KTON_NAME.to_vec(), - symbol: S::KTON_SYMBOL.to_vec(), - decimals: 18, - is_frozen: false, - }, - ); - self } diff --git a/tool/state-processor/src/tests.rs b/tool/state-processor/src/tests.rs index 7201a8fec..071250ff7 100644 --- a/tool/state-processor/src/tests.rs +++ b/tool/state-processor/src/tests.rs @@ -32,20 +32,13 @@ fn get_last_40(key: &str, _: &str) -> String { format!("0x{}", &key[key.len() - 40..]) } -fn twox64_concat_to_string(data: D) -> String -where - D: AsRef<[u8]>, -{ - array_bytes::bytes2hex("", subhasher::twox64_concat(data)) -} - impl Tester { fn new() -> Self { // This test is only used to ensure the correctness of the state processor and is only // applicable to Crab, Crab Parachain. - let mut solo_state = State::from_file("test-data/crab.json").unwrap(); - let mut para_state = State::from_file("test-data/crab-parachain.json").unwrap(); - let mut shell_state = State::from_file("test-data/processed.json").unwrap(); + let mut solo_state = State::from_file("data/crab-solo.json").unwrap(); + let mut para_state = State::from_file("data/crab-para.json").unwrap(); + let mut shell_state = State::from_file("data/crab-processed.json").unwrap(); // solo chain let mut solo_accounts = >::default(); @@ -323,8 +316,8 @@ fn asset_metadata() { &mut metadata, ); assert_eq!(metadata.decimals, 18); - assert_eq!(metadata.symbol, b"KTON".to_vec()); - assert_eq!(metadata.name, b"Darwinia Commitment Token".to_vec()); + assert_eq!(metadata.symbol, b"CKTON".to_vec()); + assert_eq!(metadata.name, b"Crab Commitment Token".to_vec()); }); } @@ -418,35 +411,6 @@ fn evm_account_storage_migrate() { // --- Staking --- -#[test] -fn bonded_migrate() { - run_test(|tester| { - // https://crab.subscan.io/account/5FxS8ugbXi4WijFuNS45Wg3Z5QsdN8hLZMmo71afoW8hJP67 - let test_addr: [u8; 32] = hex_n_into_unchecked::<_, _, 32>( - "0xac288b0d41a3dcb69b025f51d9ad76ee088339f1c27708e164f9b019c584897d", - ); - - let mut controller = [0u8; 32]; - tester.solo_state.get_value( - b"Staking", - b"Bonded", - &twox64_concat_to_string(test_addr.encode()), - &mut controller, - ); - assert_ne!(controller, [0u8; 32]); - - // after migrate - let mut migrated_controller = [0u8; 32]; - tester.shell_state.get_value( - b"AccountMigration", - b"Bonded", - &twox64_concat_to_string(test_addr.encode()), - &mut migrated_controller, - ); - assert_eq!(migrated_controller, controller); - }); -} - #[test] fn deposit_items_migrate() { run_test(|tester| { From b57fb01dfb4c0c9bbd6dac3e72bd1ab8ee309fb1 Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Fri, 6 Jan 2023 11:29:19 +0800 Subject: [PATCH 086/189] ECDSA authority (#184) * Add message gadget * Fix compile * Fix mock * Fix test * Add ecdsa-authority * License --- Cargo.lock | 56 ++ node/src/chain_spec/crab.rs | 4 + node/src/chain_spec/darwinia.rs | 4 + node/src/chain_spec/pangolin.rs | 4 + pallet/deposit/tests/mock.rs | 8 +- pallet/ecdsa-authority/Cargo.toml | 53 ++ pallet/ecdsa-authority/src/lib.rs | 567 ++++++++++++++++++ pallet/ecdsa-authority/src/primitives.rs | 140 +++++ pallet/ecdsa-authority/src/weights.rs | 20 + pallet/ecdsa-authority/tests/mock.rs | 180 ++++++ pallet/ecdsa-authority/tests/tests.rs | 532 ++++++++++++++++ pallet/message-gadget/Cargo.toml | 52 ++ pallet/message-gadget/src/lib.rs | 109 ++++ pallet/message-gadget/tests/tests.rs | 157 +++++ pallet/message-transact/Cargo.toml | 6 +- pallet/message-transact/src/mock.rs | 3 +- pallet/staking/src/lib.rs | 5 +- pallet/staking/tests/mock.rs | 14 +- runtime/crab/Cargo.toml | 22 +- runtime/crab/src/lib.rs | 2 + .../{migrate.rs => account_migration.rs} | 0 runtime/crab/src/pallets/ecdsa_authority.rs | 39 ++ runtime/crab/src/pallets/message_gadget.rs | 22 + runtime/crab/src/pallets/mod.rs | 6 +- runtime/darwinia/Cargo.toml | 22 +- runtime/darwinia/src/lib.rs | 2 + .../{migrate.rs => account_migration.rs} | 0 .../darwinia/src/pallets/ecdsa_authority.rs | 39 ++ .../darwinia/src/pallets/message_gadget.rs | 22 + runtime/darwinia/src/pallets/mod.rs | 6 +- runtime/pangolin/Cargo.toml | 22 +- runtime/pangolin/src/lib.rs | 2 + .../{migrate.rs => account_migration.rs} | 2 +- .../pangolin/src/pallets/ecdsa_authority.rs | 39 ++ .../pangolin/src/pallets/message_gadget.rs | 22 + runtime/pangolin/src/pallets/mod.rs | 6 +- 36 files changed, 2141 insertions(+), 48 deletions(-) create mode 100644 pallet/ecdsa-authority/Cargo.toml create mode 100644 pallet/ecdsa-authority/src/lib.rs create mode 100644 pallet/ecdsa-authority/src/primitives.rs create mode 100644 pallet/ecdsa-authority/src/weights.rs create mode 100644 pallet/ecdsa-authority/tests/mock.rs create mode 100644 pallet/ecdsa-authority/tests/tests.rs create mode 100644 pallet/message-gadget/Cargo.toml create mode 100644 pallet/message-gadget/src/lib.rs create mode 100644 pallet/message-gadget/tests/tests.rs rename runtime/crab/src/pallets/{migrate.rs => account_migration.rs} (100%) create mode 100644 runtime/crab/src/pallets/ecdsa_authority.rs create mode 100644 runtime/crab/src/pallets/message_gadget.rs rename runtime/darwinia/src/pallets/{migrate.rs => account_migration.rs} (100%) create mode 100644 runtime/darwinia/src/pallets/ecdsa_authority.rs create mode 100644 runtime/darwinia/src/pallets/message_gadget.rs rename runtime/pangolin/src/pallets/{migrate.rs => account_migration.rs} (93%) create mode 100644 runtime/pangolin/src/pallets/ecdsa_authority.rs create mode 100644 runtime/pangolin/src/pallets/message_gadget.rs diff --git a/Cargo.lock b/Cargo.lock index af602e5cc..c13c49a45 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1357,6 +1357,8 @@ dependencies = [ "darwinia-account-migration", "darwinia-common-runtime", "darwinia-deposit", + "darwinia-ecdsa-authority", + "darwinia-message-gadget", "darwinia-message-transact", "darwinia-precompile-assets", "darwinia-precompile-bls12-381", @@ -2360,6 +2362,43 @@ dependencies = [ "sp-std", ] +[[package]] +name = "darwinia-ecdsa-authority" +version = "2.10.1" +dependencies = [ + "array-bytes 6.0.0", + "dc-primitives", + "ethabi", + "frame-support", + "frame-system", + "libsecp256k1 0.7.1", + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", + "sp-version", +] + +[[package]] +name = "darwinia-message-gadget" +version = "6.0.0" +dependencies = [ + "array-bytes 6.0.0", + "frame-support", + "frame-system", + "pallet-balances", + "pallet-evm", + "pallet-timestamp", + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", +] + [[package]] name = "darwinia-message-transact" version = "6.0.0" @@ -2524,6 +2563,8 @@ dependencies = [ "darwinia-account-migration", "darwinia-common-runtime", "darwinia-deposit", + "darwinia-ecdsa-authority", + "darwinia-message-gadget", "darwinia-message-transact", "darwinia-precompile-assets", "darwinia-precompile-bls12-381", @@ -3003,6 +3044,19 @@ dependencies = [ "libc", ] +[[package]] +name = "ethabi" +version = "17.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4966fba78396ff92db3b817ee71143eccd98acf0f876b8d600e585a670c5d1b" +dependencies = [ + "ethereum-types", + "hex", + "sha3 0.10.6", + "thiserror", + "uint", +] + [[package]] name = "ethbloom" version = "0.12.1" @@ -7452,6 +7506,8 @@ dependencies = [ "darwinia-account-migration", "darwinia-common-runtime", "darwinia-deposit", + "darwinia-ecdsa-authority", + "darwinia-message-gadget", "darwinia-message-transact", "darwinia-precompile-assets", "darwinia-precompile-bls12-381", diff --git a/node/src/chain_spec/crab.rs b/node/src/chain_spec/crab.rs index bdbaf49c6..c0a065ff1 100644 --- a/node/src/chain_spec/crab.rs +++ b/node/src/chain_spec/crab.rs @@ -180,6 +180,8 @@ pub fn genesis_config() -> ChainSpec { }, aura: Default::default(), aura_ext: Default::default(), + message_gadget: Default::default(), + ecdsa_authority: Default::default(), // Governance stuff. democracy: Default::default(), @@ -272,6 +274,8 @@ fn testnet_genesis( }, aura: Default::default(), aura_ext: Default::default(), + message_gadget: Default::default(), + ecdsa_authority: Default::default(), // Governance stuff. democracy: Default::default(), diff --git a/node/src/chain_spec/darwinia.rs b/node/src/chain_spec/darwinia.rs index 485b3fd12..070f54540 100644 --- a/node/src/chain_spec/darwinia.rs +++ b/node/src/chain_spec/darwinia.rs @@ -180,6 +180,8 @@ pub fn genesis_config() -> ChainSpec { }, aura: Default::default(), aura_ext: Default::default(), + message_gadget: Default::default(), + ecdsa_authority: Default::default(), // Governance stuff. democracy: Default::default(), @@ -272,6 +274,8 @@ fn testnet_genesis( }, aura: Default::default(), aura_ext: Default::default(), + message_gadget: Default::default(), + ecdsa_authority: Default::default(), // Governance stuff. democracy: Default::default(), diff --git a/node/src/chain_spec/pangolin.rs b/node/src/chain_spec/pangolin.rs index 0a0bd1e68..f799a3185 100644 --- a/node/src/chain_spec/pangolin.rs +++ b/node/src/chain_spec/pangolin.rs @@ -180,6 +180,8 @@ pub fn genesis_config() -> ChainSpec { }, aura: Default::default(), aura_ext: Default::default(), + message_gadget: Default::default(), + ecdsa_authority: Default::default(), // Governance stuff. democracy: Default::default(), @@ -266,6 +268,8 @@ fn testnet_genesis( }, aura: Default::default(), aura_ext: Default::default(), + message_gadget: Default::default(), + ecdsa_authority: Default::default(), // Governance stuff. democracy: Default::default(), diff --git a/pallet/deposit/tests/mock.rs b/pallet/deposit/tests/mock.rs index e99f1ad9f..971e29270 100644 --- a/pallet/deposit/tests/mock.rs +++ b/pallet/deposit/tests/mock.rs @@ -18,6 +18,9 @@ // darwinia use dc_types::{AssetId, Balance, Moment, UNIT}; +// substrate +use frame_support::traits::GenesisBuild; +use sp_io::TestExternalities; impl frame_system::Config for Runtime { type AccountData = pallet_balances::AccountData; @@ -125,10 +128,7 @@ pub fn efflux(milli_secs: Moment) { Timestamp::set_timestamp(Timestamp::now() + milli_secs); } -pub fn new_test_ext() -> sp_io::TestExternalities { - // substrate - use frame_support::traits::GenesisBuild; - +pub fn new_test_ext() -> TestExternalities { let mut storage = frame_system::GenesisConfig::default().build_storage::().unwrap(); pallet_balances::GenesisConfig:: { diff --git a/pallet/ecdsa-authority/Cargo.toml b/pallet/ecdsa-authority/Cargo.toml new file mode 100644 index 000000000..59d7b8111 --- /dev/null +++ b/pallet/ecdsa-authority/Cargo.toml @@ -0,0 +1,53 @@ +[package] +authors = ["Darwinia Network "] +description = "Relayer Authorities Protocal Implementation" +edition = "2021" +homepage = "https://darwinia.network" +license = "GPL-3.0" +name = "darwinia-ecdsa-authority" +readme = "README.md" +repository = "https://github.com/darwinia-network/darwinia-common" +version = "2.10.1" + +[dependencies] +# crates.io +codec = { package = "parity-scale-codec", version = "3.2", default-features = false, features = ["derive"] } +ethabi = { version = "17.0", default-features = false } +scale-info = { version = "2.3", default-features = false } + +# darwinia +dc-primitives = { default-features = false, path = "../../core/primitives" } + +# substrate +frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-io = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } + +[dev-dependencies] +array-bytes = { version = "6.0" } +libsecp256k1 = { version = "0.7" } +sp-version = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } + +[features] +default = ["std"] + +std = [ + # crates.io + "codec/std", + "ethabi/std", + "scale-info/std", + + # darwinia + "dc-primitives/std", + + # substrate + "frame-support/std", + "frame-system/std", + "sp-core/std", + "sp-runtime/std", + "sp-std/std", + "sp-io/std", +] diff --git a/pallet/ecdsa-authority/src/lib.rs b/pallet/ecdsa-authority/src/lib.rs new file mode 100644 index 000000000..9a6c04227 --- /dev/null +++ b/pallet/ecdsa-authority/src/lib.rs @@ -0,0 +1,567 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! # Relay Authorities Module +//! Works with https://github.com/darwinia-network/darwinia-messages-sol/pull/217 + +#![cfg_attr(not(feature = "std"), no_std)] +#![allow(clippy::type_complexity)] + +pub mod primitives; +use primitives::*; + +mod weights; +pub use weights::WeightInfo; + +// crates.io +use ethabi::Token; +// darwinia +use dc_primitives::AccountId; +// substrate +use frame_support::{pallet_prelude::*, traits::Get}; +use frame_system::pallet_prelude::*; +use sp_runtime::{ + traits::{SaturatedConversion, Saturating, Zero}, + Perbill, +}; +use sp_std::prelude::*; + +#[frame_support::pallet] +pub mod pallet { + // darwinia + use crate::*; + + #[pallet::config] + pub trait Config: frame_system::Config { + /// Override the [`frame_system::Config::RuntimeEvent`]. + type RuntimeEvent: From> + IsType<::RuntimeEvent>; + + /// Weight. + type WeightInfo: WeightInfo; + + /// The maximum number of authorities. + #[pallet::constant] + type MaxAuthorities: Get; + /// Chain's ID, which is using for constructing the message. (follow EIP-712 SPEC) + #[pallet::constant] + type ChainId: Get; + + /// The signing threshold. + /// + /// Once `signatures_count / authorities_count >= threshold`, we say the message is trusted. + #[pallet::constant] + type SignThreshold: Get; + + /// The interval of checking the message root. + /// This must be shorter than [`Config::MaxPendingPeriod`]. + #[pallet::constant] + type SyncInterval: Get; + + /// How long should we wait for the message root to be signed. + /// + /// If the collecting new message root signatures process takes more than + /// `MaxPendingPeriod`, we will drop the root. And update the root with a new one. + #[pallet::constant] + type MaxPendingPeriod: Get; + + /// The Darwinia message root. + /// + /// If it changed, it means there are some new messages which are waiting for relaying. + type MessageRoot: Get>; + } + + #[pallet::event] + #[pallet::generate_deposit(pub(super) fn deposit_event)] + pub enum Event { + /// Authorities changed. Collecting authorities change signatures. + CollectingAuthoritiesChangeSignatures { message: Hash }, + /// Collected enough authorities change signatures. + CollectedEnoughAuthoritiesChangeSignatures { + operation: Operation, + new_threshold: Option, + message: Hash, + signatures: Vec<(T::AccountId, Signature)>, + }, + /// New message root found. Collecting new message root signatures. + CollectingNewMessageRootSignatures { message: Hash }, + /// Collected enough new message root signatures. + CollectedEnoughNewMessageRootSignatures { + commitment: Commitment, + message: Hash, + signatures: Vec<(T::AccountId, Signature)>, + }, + } + + #[pallet::error] + pub enum Error { + /// The authority is already existed. + AuthorityExisted, + /// Too many authorities. + TooManyAuthorities, + /// This is not an authority. + NotAuthority, + /// Require at least one authority. Not allow to decrease below one. + AtLeastOneAuthority, + /// Currently, the authorities is changing. + OnAuthoritiesChange, + /// Didn't find any authorities changes to sign. + NoAuthoritiesChange, + /// Didn't find any new message root to sign. + NoNewMessageRoot, + /// Failed to verify the signature. + BadSignature, + /// This authority had already finished his duty. + AlreadySubmitted, + } + + /// The current active authorities. + #[pallet::storage] + #[pallet::getter(fn authorities)] + pub type Authorities = + StorageValue<_, BoundedVec, ValueQuery>; + + /// The incoming authorities. + #[pallet::storage] + #[pallet::getter(fn next_authorities)] + pub type NextAuthorities = + StorageValue<_, BoundedVec, ValueQuery>; + + /// The nonce of the current active authorities. AKA term/session/era. + #[pallet::storage] + #[pallet::getter(fn nonce)] + pub type Nonce = StorageValue<_, u32, ValueQuery>; + + /// The authorities change waiting for signing. + #[pallet::storage] + #[pallet::getter(fn authorities_change_to_sign)] + pub type AuthoritiesChangeToSign = StorageValue< + _, + // TODO: use struct + ( + Operation, + Option, + Hash, + BoundedVec<(T::AccountId, Signature), T::MaxAuthorities>, + ), + OptionQuery, + >; + + /// The new message root waiting for signing. + #[pallet::storage] + #[pallet::getter(fn new_message_root_to_sign)] + pub type NewMessageRootToSign = StorageValue< + _, + // TODO: use struct + (Commitment, Hash, BoundedVec<(T::AccountId, Signature), T::MaxAuthorities>), + OptionQuery, + >; + + /// Record the previous message root. + /// + /// Use for checking if the message root getter get the same message root as the previous one. + /// And if this is empty, it means the message root is require to be relayed. + #[pallet::storage] + #[pallet::getter(fn previous_message_root)] + pub type PreviousMessageRoot = StorageValue<_, (T::BlockNumber, Hash), OptionQuery>; + + #[pallet::genesis_config] + pub struct GenesisConfig + where + T: Config, + { + pub authorities: Vec, + } + #[cfg(feature = "std")] + impl Default for GenesisConfig + where + T: Config, + { + fn default() -> Self { + GenesisConfig { authorities: Vec::new() } + } + } + #[pallet::genesis_build] + impl GenesisBuild for GenesisConfig { + fn build(&self) { + >::put(BoundedVec::try_from(self.authorities.clone()).unwrap()); + >::put(BoundedVec::try_from(self.authorities.clone()).unwrap()); + } + } + + #[pallet::pallet] + #[pallet::without_storage_info] + pub struct Pallet(PhantomData); + #[pallet::hooks] + impl Hooks for Pallet { + fn on_initialize(now: T::BlockNumber) -> Weight { + if (now % T::SyncInterval::get()).is_zero() { + if let Some(message_root) = Self::try_update_message_root(now, false) { + Self::on_new_message_root(now, message_root); + } + } + + // TODO: weight + Default::default() + } + } + #[pallet::call] + impl Pallet { + /// Add a authority and trigger `on_authorities_change`. + /// + /// Not allow to call while authorities is changing. + /// This will insert new authority into the index 0 of authorities. + #[pallet::weight(10_000_000)] + #[frame_support::transactional] + pub fn add_authority(origin: OriginFor, new: T::AccountId) -> DispatchResult { + ensure_root(origin)?; + + Self::ensure_not_on_authorities_change()?; + + let authorities_count = >::try_mutate(|authorities| { + if authorities.contains(&new) { + return Err(>::AuthorityExisted)?; + } + + authorities.try_insert(0, new).map_err(|_| >::TooManyAuthorities)?; + + Ok::<_, DispatchError>(authorities.len() as u32) + })?; + + Self::on_authorities_change(Operation::AddMember { new }, authorities_count); + + Ok(()) + } + + /// Remove a authority and trigger `on_authorities_change`. + /// + /// Not allow to call while authorities is changing. + #[pallet::weight(10_000_000)] + #[frame_support::transactional] + pub fn remove_authority(origin: OriginFor, old: T::AccountId) -> DispatchResult { + ensure_root(origin)?; + + Self::ensure_not_on_authorities_change()?; + + let (authorities_count, pre) = >::try_mutate(|authorities| { + let i = + authorities.iter().position(|a| a == &old).ok_or(>::NotAuthority)?; + + if authorities.len() == 1 { + return Err(>::AtLeastOneAuthority)?; + } + + authorities.remove(i); + + Ok::<_, DispatchError>(( + authorities.len() as u32, + if i == 0 { AUTHORITY_SENTINEL.into() } else { authorities[i - 1] }, + )) + })?; + + Self::on_authorities_change(Operation::RemoveMember { pre, old }, authorities_count); + + Ok(()) + } + + /// Swap the old authority with the new authority and trigger `on_authorities_change`. + /// + /// Not allow to call while authorities is changing. + #[pallet::weight(10_000_000)] + #[frame_support::transactional] + pub fn swap_authority( + origin: OriginFor, + old: T::AccountId, + new: T::AccountId, + ) -> DispatchResult { + ensure_root(origin)?; + + Self::ensure_not_on_authorities_change()?; + + let (authorities_count, pre) = >::try_mutate(|authorities| { + let i = + authorities.iter().position(|a| a == &old).ok_or(>::NotAuthority)?; + + authorities[i] = new; + + Ok::<_, DispatchError>(( + authorities.len() as u32, + if i == 0 { AUTHORITY_SENTINEL.into() } else { authorities[i - 1] }, + )) + })?; + + Self::on_authorities_change( + Operation::SwapMembers { pre, old, new }, + authorities_count, + ); + + Ok(()) + } + + /// Submit the authorities change signature. + /// + /// Free to submit the first-correct signature. + #[pallet::weight(10_000_000)] + #[frame_support::transactional] + pub fn submit_authorities_change_signature( + origin: OriginFor, + signature: Signature, + ) -> DispatchResultWithPostInfo { + let who = ensure_signed(origin)?; + + let authorities = Self::ensure_authority(&who)?; + let mut authorities_change_to_sign = + >::get().ok_or(>::NoAuthoritiesChange)?; + let (_, _, message, collected) = &mut authorities_change_to_sign; + + Self::ensure_not_submitted(&who, collected)?; + + ensure!( + Sign::verify_signature(&signature.0, &message.0, &who.0), + >::BadSignature + ); + + collected.try_push((who, signature)).map_err(|_| >::TooManyAuthorities)?; + + if Self::check_threshold(collected.len() as _, authorities.len() as _) { + Self::apply_next_authorities(); + + let (operation, new_threshold, message, collected) = authorities_change_to_sign; + + Self::deposit_event(Event::::CollectedEnoughAuthoritiesChangeSignatures { + operation, + new_threshold, + message, + signatures: collected.to_vec(), + }); + + let now = >::block_number(); + + if let Some(message_root) = Self::try_update_message_root(now, true) { + Self::on_new_message_root(now, message_root); + } + } else { + >::put(authorities_change_to_sign); + } + + Ok(Pays::No.into()) + } + + /// Submit the new message root signature. + /// + /// Free to submit the first-correct signature. + #[pallet::weight(10_000_000)] + #[frame_support::transactional] + pub fn submit_new_message_root_signature( + origin: OriginFor, + signature: Signature, + ) -> DispatchResultWithPostInfo { + let who = ensure_signed(origin)?; + + let authorities = Self::ensure_authority(&who)?; + let mut new_message_root_to_sign = + >::get().ok_or(>::NoNewMessageRoot)?; + let (_, message, collected) = &mut new_message_root_to_sign; + + Self::ensure_not_submitted(&who, collected)?; + + ensure!( + Sign::verify_signature(&signature.0, &message.0, &who.0), + >::BadSignature + ); + + collected.try_push((who, signature)).map_err(|_| >::TooManyAuthorities)?; + + if Self::check_threshold(collected.len() as _, authorities.len() as _) { + >::kill(); + + let (commitment, message, collected) = new_message_root_to_sign; + + Self::deposit_event(Event::::CollectedEnoughNewMessageRootSignatures { + commitment, + message, + signatures: collected.to_vec(), + }); + } else { + >::put(new_message_root_to_sign); + } + + Ok(Pays::No.into()) + } + } + impl Pallet { + fn ensure_authority( + address: &T::AccountId, + ) -> Result, DispatchError> { + let authorities = >::get(); + + ensure!(authorities.iter().any(|a| a == address), >::NotAuthority); + + Ok(authorities) + } + + fn ensure_not_on_authorities_change() -> DispatchResult { + ensure!(!>::exists(), >::OnAuthoritiesChange); + + Ok(()) + } + + fn ensure_not_submitted( + who: &T::AccountId, + collected: &[(T::AccountId, Signature)], + ) -> DispatchResult { + ensure!(!collected.iter().any(|(a, _)| a == who), >::AlreadySubmitted); + + Ok(()) + } + + pub fn calculate_threshold(x: u32) -> u32 { + T::SignThreshold::get().mul_ceil(x) + } + + fn on_authorities_change(operation: Operation, authorities_count: u32) { + let (authorities_changes, new_threshold) = { + match operation { + Operation::AddMember { new } => { + let new_threshold = Self::calculate_threshold(authorities_count); + + ( + ethabi::encode(&[ + Token::Address(new.0.into()), + Token::Uint(new_threshold.into()), + ]), + Some(new_threshold), + ) + }, + Operation::RemoveMember { pre, old } => { + let new_threshold = Self::calculate_threshold(authorities_count); + + ( + ethabi::encode(&[ + Token::Address(pre.0.into()), + Token::Address(old.0.into()), + Token::Uint(new_threshold.into()), + ]), + Some(new_threshold), + ) + }, + Operation::SwapMembers { pre, old, new } => ( + ethabi::encode(&[ + Token::Address(pre.0.into()), + Token::Address(old.0.into()), + Token::Address(new.0.into()), + ]), + None, + ), + } + }; + let message = Sign::eth_signable_message( + T::ChainId::get(), + T::Version::get().spec_name.as_ref(), + ðabi::encode(&[ + Token::FixedBytes(RELAY_TYPE_HASH.into()), + Token::FixedBytes(operation.id().into()), + Token::Bytes(authorities_changes), + Token::Uint(>::get().into()), + ]), + ); + + >::put(( + operation, + new_threshold, + message, + BoundedVec::default(), + )); + + Self::deposit_event(Event::::CollectingAuthoritiesChangeSignatures { message }); + } + + fn check_threshold(p: u32, q: u32) -> bool { + Perbill::from_rational(p, q) >= T::SignThreshold::get() + } + + pub fn apply_next_authorities() { + >::kill(); + >::put(>::get()); + >::mutate(|nonce| *nonce += 1); + } + + fn try_update_message_root(at: T::BlockNumber, force: bool) -> Option { + // Not allow to relay the messages if the new authorities set is not verified. + if Self::ensure_not_on_authorities_change().is_err() { + return None; + } + + let message_root = T::MessageRoot::get()?; + + >::try_mutate(|maybe_previous_message_root| { + if force { + *maybe_previous_message_root = Some((at, message_root)); + + return Ok(message_root); + } + + // Only if the chain is still collecting signatures will enter this condition. + if let Some((recorded_at, previous_message_root)) = maybe_previous_message_root { + // If this is a new root. + if &message_root != previous_message_root { + // Update the root with a new one if exceed the max pending period. + // Also update the recorded time. + if at.saturating_sub(*recorded_at) > T::MaxPendingPeriod::get() { + *recorded_at = at; + *previous_message_root = message_root; + + return Ok(message_root); + } + } + } else { + // If no previous message root is recorded, starting to relay the incoming + // messages. + *maybe_previous_message_root = Some((at, message_root)); + + return Ok(message_root); + } + + Err(()) + }) + .ok() + } + + fn on_new_message_root(at: T::BlockNumber, message_root: Hash) { + let commitment = Commitment { + block_number: at.saturated_into::(), + message_root, + nonce: >::get(), + }; + let message = Sign::eth_signable_message( + T::ChainId::get(), + T::Version::get().spec_name.as_ref(), + ðabi::encode(&[ + Token::FixedBytes(COMMIT_TYPE_HASH.into()), + Token::Uint(commitment.block_number.into()), + Token::FixedBytes(commitment.message_root.as_ref().into()), + Token::Uint(commitment.nonce.into()), + ]), + ); + + >::put((commitment, message, BoundedVec::default())); + + Self::deposit_event(Event::::CollectingNewMessageRootSignatures { message }); + } + } +} +pub use pallet::*; diff --git a/pallet/ecdsa-authority/src/primitives.rs b/pallet/ecdsa-authority/src/primitives.rs new file mode 100644 index 000000000..0da3b7ab5 --- /dev/null +++ b/pallet/ecdsa-authority/src/primitives.rs @@ -0,0 +1,140 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +pub use sp_core::{ecdsa::Signature, H160 as Address, H256 as Hash}; + +// crates.io +use codec::{Decode, Encode}; +use scale_info::TypeInfo; +// substrate +use sp_io::{crypto, hashing}; +use sp_runtime::RuntimeDebug; + +// address(0x1) +pub const AUTHORITY_SENTINEL: [u8; 20] = + [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]; +// keccak256("ChangeRelayer(bytes4 sig,bytes params,uint256 nonce)"); +// 0x30a82982a8d5050d1c83bbea574aea301a4d317840a8c4734a308ffaa6a63bc8 +pub(crate) const RELAY_TYPE_HASH: [u8; 32] = [ + 48, 168, 41, 130, 168, 213, 5, 13, 28, 131, 187, 234, 87, 74, 234, 48, 26, 77, 49, 120, 64, + 168, 196, 115, 74, 48, 143, 250, 166, 166, 59, 200, +]; +// keccak256("Commitment(uint32 block_number,bytes32 message_root,uint256 nonce)"); +// 0xaca824a0c4edb3b2c17f33fea9cb21b33c7ee16c8e634c36b3bf851c9de7a223 +pub(crate) const COMMIT_TYPE_HASH: [u8; 32] = [ + 172, 168, 36, 160, 196, 237, 179, 178, 193, 127, 51, 254, 169, 203, 33, 179, 60, 126, 225, 108, + 142, 99, 76, 54, 179, 191, 133, 28, 157, 231, 162, 35, +]; + +pub(crate) enum Sign {} +impl Sign { + fn hash(data: &[u8]) -> [u8; 32] { + hashing::keccak_256(data) + } + + pub(crate) fn eth_signable_message(chain_id: u64, spec_name: &[u8], data: &[u8]) -> Hash { + // \x19\x01 + keccack256(ChainIDSpecName::ecdsa-authority) + struct_hash + Hash(Self::hash( + &[ + b"\x19\x01".as_slice(), + &Self::hash(&[&chain_id.to_le_bytes(), spec_name, b"::ecdsa-authority"].concat()), + &Self::hash(data), + ] + .concat(), + )) + } + + pub(crate) fn verify_signature( + signature: &[u8; 65], + message: &[u8; 32], + address: &[u8], + ) -> bool { + if let Ok(public_key) = crypto::secp256k1_ecdsa_recover(signature, message) { + &Self::hash(&public_key)[12..] == address + } else { + false + } + } +} + +#[derive(Clone, PartialEq, Eq, Encode, Decode, RuntimeDebug, TypeInfo)] +pub enum Operation { + AddMember { new: A }, + RemoveMember { pre: A, old: A }, + SwapMembers { pre: A, old: A, new: A }, +} +impl Operation { + pub(crate) fn id(&self) -> [u8; 4] { + match self { + // bytes4(keccak256("add_relayer(address,uint256)")) + // 0xb7aafe32 + Self::AddMember { .. } => [183, 170, 254, 50], + // bytes4(keccak256("remove_relayer(address,address,uint256)")) + // 0x8621d1fa + Self::RemoveMember { .. } => [134, 33, 209, 250], + // bytes4(keccak256("swap_relayer(address,address,address)")) + // 0xcb76085b + Self::SwapMembers { .. } => [203, 118, 8, 91], + } + } +} + +#[derive(Clone, PartialEq, Eq, Encode, Decode, RuntimeDebug, TypeInfo)] +pub struct Commitment { + pub block_number: u32, + pub message_root: Hash, + pub nonce: u32, +} + +#[test] +fn eth_signable_message() { + assert_eq!( + array_bytes::bytes2hex("0x", &Sign::eth_signable_message(46, b"Darwinia", &[0; 32])), + "0xb492857010088b0dff298645e9105549d088aab7bcb20cf5a3d0bc17dce91045" + ); + assert_eq!( + array_bytes::bytes2hex("0x", &Sign::hash(b"46Darwinia::ecdsa-authority")), + "0xf8a76f5ceeff36d74ff99c4efc0077bcc334721f17d1d5f17cfca78455967e1e" + ); + + let data = array_bytes::hex2bytes_unchecked("0x30a82982a8d5050d1c83bbea574aea301a4d317840a8c4734a308ffaa6a63bc8cb76085b00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000100000000000000000000000068898db1012808808c903f390909c52d9f7067490000000000000000000000004cdc1dbbd754ea539f1ffaea91f1b6c4b8dd14bd"); + assert_eq!( + array_bytes::bytes2hex("0x", &Sign::eth_signable_message(45, b"Pangoro", &data)), + "0x4bddffe492f1091c1902d1952fc4673b12915f4b22822c6c84eacad574f11f2e" + ); + + let operation = Operation::SwapMembers { + pre: AUTHORITY_SENTINEL, + old: AUTHORITY_SENTINEL, + new: AUTHORITY_SENTINEL, + }; + let encoded = ethabi::encode(&[ + ethabi::Token::FixedBytes(RELAY_TYPE_HASH.into()), + ethabi::Token::FixedBytes(operation.id().into()), + ethabi::Token::Bytes(ethabi::encode(&[ + ethabi::Token::Address(AUTHORITY_SENTINEL.into()), + ethabi::Token::Address(AUTHORITY_SENTINEL.into()), + ethabi::Token::Address(AUTHORITY_SENTINEL.into()), + ])), + ethabi::Token::Uint(0.into()), + ]); + assert_eq!( + array_bytes::bytes2hex("0x", &Sign::eth_signable_message(45, b"Pangoro", &encoded)), + "0xe328aa10278425238407d49104ac5a55fd68e7f378b327c902d4d5035cfcfedf" + ); +} diff --git a/pallet/ecdsa-authority/src/weights.rs b/pallet/ecdsa-authority/src/weights.rs new file mode 100644 index 000000000..eff819a3c --- /dev/null +++ b/pallet/ecdsa-authority/src/weights.rs @@ -0,0 +1,20 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +pub trait WeightInfo {} +impl WeightInfo for () {} diff --git a/pallet/ecdsa-authority/tests/mock.rs b/pallet/ecdsa-authority/tests/mock.rs new file mode 100644 index 000000000..8a2afa14f --- /dev/null +++ b/pallet/ecdsa-authority/tests/mock.rs @@ -0,0 +1,180 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// std +use std::iter; +// crates.io +use libsecp256k1::{Message, PublicKey, SecretKey}; +// darwinia +use darwinia_ecdsa_authority::{primitives::*, *}; +use dc_primitives::AccountId; +// substrate +use frame_support::traits::{GenesisBuild, OnInitialize}; +use sp_io::{hashing, TestExternalities}; + +frame_support::parameter_types! { + pub Version: sp_version::RuntimeVersion = sp_version::RuntimeVersion { + spec_name: sp_runtime::RuntimeString::Owned("Darwinia".into()), + ..Default::default() + }; +} +impl frame_system::Config for Runtime { + type AccountData = (); + type AccountId = AccountId; + type BaseCallFilter = frame_support::traits::Everything; + type BlockHashCount = (); + type BlockLength = (); + type BlockNumber = u64; + type BlockWeights = (); + type DbWeight = (); + type Hash = sp_core::H256; + type Hashing = sp_runtime::traits::BlakeTwo256; + type Header = sp_runtime::testing::Header; + type Index = u64; + type Lookup = sp_runtime::traits::IdentityLookup; + type MaxConsumers = frame_support::traits::ConstU32<16>; + type OnKilledAccount = (); + type OnNewAccount = (); + type OnSetCode = (); + type PalletInfo = PalletInfo; + type RuntimeCall = RuntimeCall; + type RuntimeEvent = RuntimeEvent; + type RuntimeOrigin = RuntimeOrigin; + type SS58Prefix = (); + type SystemWeightInfo = (); + type Version = Version; +} + +frame_support::parameter_types! { + pub const SignThreshold: sp_runtime::Perbill = sp_runtime::Perbill::from_percent(60); + pub static MessageRoot: Option = Some(Default::default()); +} +impl Config for Runtime { + type ChainId = frame_support::traits::ConstU64<46>; + type MaxAuthorities = frame_support::traits::ConstU32<3>; + type MaxPendingPeriod = frame_support::traits::ConstU64<5>; + type MessageRoot = MessageRoot; + type RuntimeEvent = RuntimeEvent; + type SignThreshold = SignThreshold; + type SyncInterval = frame_support::traits::ConstU64<3>; + type WeightInfo = (); +} + +frame_support::construct_runtime! { + pub enum Runtime + where + Block = frame_system::mocking::MockBlock, + NodeBlock = frame_system::mocking::MockBlock, + UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic, + { + System: frame_system, + EcdsaAuthority: darwinia_ecdsa_authority, + } +} + +#[derive(Default)] +pub struct ExtBuilder { + authorities: Vec, +} +impl ExtBuilder { + pub fn authorities(mut self, authorities: Vec) -> Self { + self.authorities = authorities; + + self + } + + pub fn build(self) -> TestExternalities { + let Self { authorities } = self; + let mut storage = + frame_system::GenesisConfig::default().build_storage::().unwrap(); + + darwinia_ecdsa_authority::GenesisConfig:: { authorities } + .assimilate_storage(&mut storage) + .unwrap(); + + let mut ext = TestExternalities::from(storage); + + ext.execute_with(|| { + System::set_block_number(1); + >::on_initialize(1); + }); + + ext + } +} + +pub fn account_id_of(id: u8) -> AccountId { + Address::repeat_byte(id).0.into() +} + +pub fn gen_pair(byte: u8) -> (SecretKey, AccountId) { + let seed = iter::repeat(byte).take(32).collect::>(); + let secret_key = SecretKey::parse_slice(&seed).unwrap(); + let public_key = PublicKey::from_secret_key(&secret_key).serialize(); + let address = + array_bytes::slice_n_into_unchecked(&hashing::keccak_256(&public_key[1..65])[12..]); + + (secret_key, address) +} + +pub fn sign(secret_key: &SecretKey, message: &[u8; 32]) -> Signature { + let (sig, recovery_id) = libsecp256k1::sign(&Message::parse(message), secret_key); + let mut signature = [0u8; 65]; + + signature[0..64].copy_from_slice(&sig.serialize()[..]); + signature[64] = recovery_id.serialize(); + + Signature(signature) +} + +pub fn presume_authority_change_succeed() { + EcdsaAuthority::apply_next_authorities(); +} + +pub fn message_root_of(byte: u8) -> Hash { + Hash::repeat_byte(byte) +} + +pub fn new_message_root(byte: u8) { + MESSAGE_ROOT.with(|v| *v.borrow_mut() = Some(message_root_of(byte))); +} + +pub fn run_to_block(n: u64) { + for b in System::block_number() + 1..=n { + System::set_block_number(b); + >::on_initialize(b); + } +} + +pub fn ecdsa_authority_events() -> Vec> { + fn events() -> Vec { + let events = System::events().into_iter().map(|evt| evt.event).collect::>(); + + System::reset_events(); + + events + } + + events() + .into_iter() + .filter_map(|e| match e { + RuntimeEvent::EcdsaAuthority(e) => Some(e), + _ => None, + }) + .collect::>() +} diff --git a/pallet/ecdsa-authority/tests/tests.rs b/pallet/ecdsa-authority/tests/tests.rs new file mode 100644 index 000000000..ee63e1214 --- /dev/null +++ b/pallet/ecdsa-authority/tests/tests.rs @@ -0,0 +1,532 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +mod mock; +use mock::*; + +// darwinia +use darwinia_ecdsa_authority::{primitives::*, *}; +// substrate +use frame_support::{ + assert_noop, assert_ok, + dispatch::{Pays, PostDispatchInfo}, + traits::Get, + BoundedVec, +}; +use sp_runtime::DispatchError; + +#[test] +fn calculate_threshold() { + ExtBuilder::default().build().execute_with(|| { + for (expected, i) in [(1, 1), (2, 2), (2, 3), (3, 4), (3, 5), (4, 6)] { + assert_eq!(EcdsaAuthority::calculate_threshold(i), expected); + } + }); +} + +#[test] +fn add_authority() { + let a_0 = account_id_of(0); + + ExtBuilder::default().build().execute_with(|| { + assert!(EcdsaAuthority::authorities().is_empty()); + assert!(EcdsaAuthority::next_authorities().is_empty()); + assert_eq!(EcdsaAuthority::nonce(), 0); + assert_ok!(EcdsaAuthority::add_authority(RuntimeOrigin::root(), a_0)); + assert!(EcdsaAuthority::authorities().is_empty()); + assert_eq!(EcdsaAuthority::next_authorities(), vec![a_0]); + assert_eq!(EcdsaAuthority::nonce(), 0); + let message = array_bytes::hex_n_into_unchecked( + "0x5c883184c9c53c59857253454df1b4813e8b3fb28648beb85555d58d1e801e14", + ); + assert_eq!( + EcdsaAuthority::authorities_change_to_sign(), + Some((Operation::AddMember { new: a_0 }, Some(1), message, Default::default())) + ); + assert_eq!( + ecdsa_authority_events(), + vec![Event::CollectingAuthoritiesChangeSignatures { message }] + ); + + // Case 1. + assert_noop!( + EcdsaAuthority::add_authority(RuntimeOrigin::root(), a_0), + >::OnAuthoritiesChange + ); + presume_authority_change_succeed(); + assert_eq!(EcdsaAuthority::authorities(), vec![a_0]); + assert_eq!(EcdsaAuthority::nonce(), 1); + + // Case 2. + assert_noop!( + EcdsaAuthority::add_authority(RuntimeOrigin::signed(Default::default()), a_0), + DispatchError::BadOrigin + ); + + // Case 3. + assert_noop!( + EcdsaAuthority::add_authority(RuntimeOrigin::root(), a_0), + >::AuthorityExisted + ); + + // Case 4. + (1..::MaxAuthorities::get()).for_each(|i| { + assert_ok!(EcdsaAuthority::add_authority(RuntimeOrigin::root(), account_id_of(i as _))); + presume_authority_change_succeed(); + assert_eq!(EcdsaAuthority::nonce(), 1 + i); + }); + assert_noop!( + EcdsaAuthority::add_authority( + RuntimeOrigin::root(), + account_id_of(<::MaxAuthorities as Get>::get() as _) + ), + >::TooManyAuthorities + ); + + // Check order. + assert_eq!( + EcdsaAuthority::authorities(), + (0..::MaxAuthorities::get()) + .rev() + .map(|i| account_id_of(i as _)) + .collect::>() + ); + }); +} + +#[test] +fn remove_authority() { + let a_1 = account_id_of(1); + let a_2 = account_id_of(2); + + ExtBuilder::default().authorities(vec![a_1, a_2]).build().execute_with(|| { + assert_eq!(EcdsaAuthority::authorities(), vec![a_1, a_2]); + assert_eq!(EcdsaAuthority::next_authorities(), vec![a_1, a_2]); + assert_eq!(EcdsaAuthority::nonce(), 0); + assert_ok!(EcdsaAuthority::remove_authority(RuntimeOrigin::root(), a_1)); + assert_eq!(EcdsaAuthority::authorities(), vec![a_1, a_2]); + assert_eq!(EcdsaAuthority::next_authorities(), vec![a_2]); + assert_eq!(EcdsaAuthority::nonce(), 0); + let message = array_bytes::hex_n_into_unchecked( + "0x76139aa9d1c7b35fc744b10444898ee5703e3f77406b926f903006436b7930c7", + ); + assert_eq!( + EcdsaAuthority::authorities_change_to_sign(), + Some(( + Operation::RemoveMember { pre: AUTHORITY_SENTINEL.into(), old: a_1 }, + Some(1), + message, + Default::default() + )) + ); + assert_eq!( + ecdsa_authority_events(), + vec![Event::CollectingAuthoritiesChangeSignatures { message }] + ); + + // Case 1. + assert_noop!( + EcdsaAuthority::add_authority(RuntimeOrigin::root(), a_1), + >::OnAuthoritiesChange + ); + presume_authority_change_succeed(); + assert_eq!(EcdsaAuthority::authorities(), vec![a_2]); + assert_eq!(EcdsaAuthority::nonce(), 1); + + // Case 2. + assert_noop!( + EcdsaAuthority::remove_authority(RuntimeOrigin::signed(Default::default()), a_2), + DispatchError::BadOrigin + ); + + // Case 3. + assert_noop!( + EcdsaAuthority::remove_authority(RuntimeOrigin::root(), a_1), + >::NotAuthority + ); + + // Case 4. + assert_noop!( + EcdsaAuthority::remove_authority(RuntimeOrigin::root(), a_2), + >::AtLeastOneAuthority + ); + }); +} + +#[test] +fn swap_authority() { + let a_1 = account_id_of(1); + let a_2 = account_id_of(2); + + ExtBuilder::default().authorities(vec![a_1]).build().execute_with(|| { + assert_eq!(EcdsaAuthority::authorities(), vec![a_1]); + assert_eq!(EcdsaAuthority::next_authorities(), vec![a_1]); + assert_eq!(EcdsaAuthority::nonce(), 0); + assert_ok!(EcdsaAuthority::swap_authority(RuntimeOrigin::root(), a_1, a_2)); + assert_eq!(EcdsaAuthority::authorities(), vec![a_1]); + assert_eq!(EcdsaAuthority::next_authorities(), vec![a_2]); + assert_eq!(EcdsaAuthority::nonce(), 0); + let message = array_bytes::hex_n_into_unchecked( + "0x30effc17a3fcf9b3079168c2c2be54b6d9fbdfd7077c9d844ec241dd70dd0507", + ); + assert_eq!( + EcdsaAuthority::authorities_change_to_sign(), + Some(( + Operation::SwapMembers { pre: AUTHORITY_SENTINEL.into(), old: a_1, new: a_2 }, + None, + message, + Default::default() + )) + ); + assert_eq!( + ecdsa_authority_events(), + vec![Event::CollectingAuthoritiesChangeSignatures { message }] + ); + + // Case 1. + assert_noop!( + EcdsaAuthority::swap_authority(RuntimeOrigin::root(), a_2, a_1), + >::OnAuthoritiesChange + ); + presume_authority_change_succeed(); + assert_eq!(EcdsaAuthority::authorities(), vec![a_2]); + assert_eq!(EcdsaAuthority::nonce(), 1); + + // Case 2. + assert_noop!( + EcdsaAuthority::swap_authority(RuntimeOrigin::signed(Default::default()), a_2, a_1), + DispatchError::BadOrigin + ); + + // Case 3. + assert_noop!( + EcdsaAuthority::swap_authority(RuntimeOrigin::root(), a_1, a_2), + >::NotAuthority + ); + }); +} + +#[test] +fn sync_interval_and_max_pending_period() { + ExtBuilder::default().build().execute_with(|| { + // Check new message root while reaching the sync interval checkpoint. + (2..::SyncInterval::get()).for_each(|i| { + run_to_block(i as _); + assert!(EcdsaAuthority::new_message_root_to_sign().is_none()); + }); + run_to_block(::SyncInterval::get()); + let message = array_bytes::hex_n_into_unchecked( + "0x742776a31e49b3f5a2a15a6781eb99f96e8116bfc67aae652a08b9b1235146d2", + ); + assert_eq!( + EcdsaAuthority::new_message_root_to_sign(), + Some(( + Commitment { + block_number: System::block_number() as _, + message_root: Default::default(), + nonce: 0 + }, + message, + Default::default() + )) + ); + assert_eq!( + ecdsa_authority_events(), + vec![Event::CollectingNewMessageRootSignatures { message }] + ); + + // Use a new message root while exceeding the max pending period. + new_message_root(1); + let offset = System::block_number() + 1; + (offset..offset + <::MaxPendingPeriod as Get>::get()).for_each( + |i| { + run_to_block(i); + assert_eq!( + EcdsaAuthority::new_message_root_to_sign(), + Some(( + Commitment { block_number: 3, message_root: Default::default(), nonce: 0 }, + message, + Default::default() + )) + ); + }, + ); + run_to_block(offset + <::MaxPendingPeriod as Get>::get()); + let message = array_bytes::hex_n_into_unchecked( + "0xafd9fc3dc135079be23746b4beb27255e5d3b4c5f3d05db766af751c0ed97920", + ); + assert_eq!( + EcdsaAuthority::new_message_root_to_sign(), + Some(( + Commitment { block_number: 9, message_root: message_root_of(1), nonce: 0 }, + message, + Default::default() + )) + ); + + // Not allow to update the message root while authorities changing. + assert_ok!(EcdsaAuthority::add_authority(RuntimeOrigin::root(), Default::default())); + new_message_root(2); + let offset = System::block_number() + 1; + (offset..=offset + <::MaxPendingPeriod as Get>::get()).for_each( + |i| { + run_to_block(i); + assert_eq!( + EcdsaAuthority::new_message_root_to_sign(), + Some(( + Commitment { block_number: 9, message_root: message_root_of(1), nonce: 0 }, + message, + Default::default() + )) + ); + }, + ); + }); +} + +#[test] +fn submit_authorities_change_signature() { + let (k_1, a_1) = gen_pair(1); + let (k_2, a_2) = gen_pair(2); + let (_, a_3) = gen_pair(3); + + ExtBuilder::default().authorities(vec![a_1, a_2]).build().execute_with(|| { + // Case 1. + assert_noop!( + EcdsaAuthority::submit_authorities_change_signature( + RuntimeOrigin::signed(a_1), + Default::default(), + ), + >::NoAuthoritiesChange + ); + + assert_ok!(EcdsaAuthority::add_authority(RuntimeOrigin::root(), a_3)); + let operation = Operation::AddMember { new: a_3 }; + let message = array_bytes::hex_n_into_unchecked( + "0x3ad89c7824d6e83c180482c888a0af99baa95ce17a39285d6f943df5d95e7759", + ); + assert_eq!( + EcdsaAuthority::authorities_change_to_sign(), + Some((operation.clone(), Some(2), message, Default::default())) + ); + assert_eq!( + ecdsa_authority_events(), + vec![Event::CollectingAuthoritiesChangeSignatures { message }] + ); + + // Case 2. + assert_noop!( + EcdsaAuthority::submit_authorities_change_signature( + RuntimeOrigin::signed(a_1), + Default::default(), + ), + >::BadSignature + ); + + let nonce = EcdsaAuthority::nonce(); + let s_1 = sign(&k_1, &message.0); + assert_eq!(EcdsaAuthority::nonce(), nonce); + assert_ok!(EcdsaAuthority::submit_authorities_change_signature( + RuntimeOrigin::signed(a_1), + s_1.clone(), + )); + assert_eq!( + EcdsaAuthority::authorities_change_to_sign(), + Some(( + operation.clone(), + Some(2), + message, + BoundedVec::try_from(vec![(a_1, s_1.clone())]).unwrap() + )) + ); + + let s_2 = sign(&k_2, &message.0); + assert_ok!(EcdsaAuthority::submit_authorities_change_signature( + RuntimeOrigin::signed(a_2), + s_2.clone(), + )); + assert_eq!(EcdsaAuthority::nonce(), nonce + 1); + assert!(EcdsaAuthority::authorities_change_to_sign().is_none()); + assert_eq!( + ecdsa_authority_events(), + vec![ + Event::CollectedEnoughAuthoritiesChangeSignatures { + operation, + new_threshold: Some(2), + message, + signatures: vec![(a_1, s_1), (a_2, s_2)] + }, + Event::CollectingNewMessageRootSignatures { + message: array_bytes::hex_n_into_unchecked( + "0xe7bded73843f446f46b42ee0e0cc435f4f66fbcedf36c635c437a4d63bb44696" + ) + } + ] + ); + }); +} + +#[test] +fn submit_new_message_root_signature() { + let (k_1, a_1) = gen_pair(1); + let (k_2, a_2) = gen_pair(2); + let (k_3, a_3) = gen_pair(3); + + ExtBuilder::default().authorities(vec![a_1, a_2]).build().execute_with(|| { + // Case 1. + assert_noop!( + EcdsaAuthority::submit_new_message_root_signature( + RuntimeOrigin::signed(a_1), + Default::default(), + ), + >::NoNewMessageRoot + ); + + run_to_block(<::SyncInterval as Get>::get()); + let message = array_bytes::hex_n_into_unchecked( + "0x742776a31e49b3f5a2a15a6781eb99f96e8116bfc67aae652a08b9b1235146d2", + ); + assert_eq!( + EcdsaAuthority::new_message_root_to_sign(), + Some(( + Commitment { + block_number: System::block_number() as _, + message_root: Default::default(), + nonce: 0 + }, + message, + Default::default() + )) + ); + assert_eq!( + ecdsa_authority_events(), + vec![Event::CollectingNewMessageRootSignatures { message }] + ); + + // Case 2. + assert_noop!( + EcdsaAuthority::submit_new_message_root_signature( + RuntimeOrigin::signed(a_1), + Default::default(), + ), + >::BadSignature + ); + + // Case 3. + let s_3 = sign(&k_3, &message.0); + assert_noop!( + EcdsaAuthority::submit_new_message_root_signature(RuntimeOrigin::signed(a_3), s_3,), + >::NotAuthority + ); + + let nonce = EcdsaAuthority::nonce(); + let s_1 = sign(&k_1, &message.0); + assert_eq!(EcdsaAuthority::nonce(), nonce); + assert_ok!(EcdsaAuthority::submit_new_message_root_signature( + RuntimeOrigin::signed(a_1), + s_1.clone(), + )); + assert_eq!( + EcdsaAuthority::new_message_root_to_sign(), + Some(( + Commitment { + block_number: System::block_number() as _, + message_root: Default::default(), + nonce: 0 + }, + message, + BoundedVec::try_from(vec![(a_1, s_1.clone())]).unwrap() + )) + ); + + let s_2 = sign(&k_2, &message.0); + assert_ok!(EcdsaAuthority::submit_new_message_root_signature( + RuntimeOrigin::signed(a_2), + s_2.clone(), + )); + assert_eq!(EcdsaAuthority::nonce(), nonce); + assert!(EcdsaAuthority::new_message_root_to_sign().is_none()); + assert_eq!( + ecdsa_authority_events(), + vec![Event::CollectedEnoughNewMessageRootSignatures { + commitment: Commitment { + block_number: System::block_number() as _, + message_root: Default::default(), + nonce: EcdsaAuthority::nonce() + }, + message, + signatures: vec![(a_1, s_1), (a_2, s_2)] + }] + ); + }); +} + +#[test] +fn tx_fee() { + let (k_1, a_1) = gen_pair(1); + let (_, a_2) = gen_pair(2); + + ExtBuilder::default().authorities(vec![a_1, a_2]).build().execute_with(|| { + (2..::SyncInterval::get()).for_each(|n| run_to_block(n as _)); + run_to_block(<::SyncInterval as Get>::get()); + let message = array_bytes::hex_n_into_unchecked( + "0x742776a31e49b3f5a2a15a6781eb99f96e8116bfc67aae652a08b9b1235146d2", + ); + + // Free for first-correct signature. + assert_eq!( + EcdsaAuthority::submit_new_message_root_signature( + RuntimeOrigin::signed(a_1), + sign(&k_1, &message), + ), + Ok(PostDispatchInfo { actual_weight: None, pays_fee: Pays::No }) + ); + + // Forbidden for submitting multiple times once the previous one succeeds. + assert_noop!( + EcdsaAuthority::submit_new_message_root_signature( + RuntimeOrigin::signed(a_1), + Default::default(), + ), + >::AlreadySubmitted + ); + + assert_ok!(EcdsaAuthority::remove_authority(RuntimeOrigin::root(), a_1)); + let message = array_bytes::hex_n_into_unchecked( + "0x24956af4b0842e1caec63782602c5a94089ba7c8ab8bd12d4243bb1a893b8af0", + ); + + // Free for first-correct signature. + assert_eq!( + EcdsaAuthority::submit_authorities_change_signature( + RuntimeOrigin::signed(a_1), + sign(&k_1, &message), + ), + Ok(PostDispatchInfo { actual_weight: None, pays_fee: Pays::No }) + ); + + // Forbidden for submitting multiple times once the previous one succeeds. + assert_noop!( + EcdsaAuthority::submit_authorities_change_signature( + RuntimeOrigin::signed(a_1), + Default::default(), + ), + >::AlreadySubmitted + ); + }); +} diff --git a/pallet/message-gadget/Cargo.toml b/pallet/message-gadget/Cargo.toml new file mode 100644 index 000000000..dae9a92d4 --- /dev/null +++ b/pallet/message-gadget/Cargo.toml @@ -0,0 +1,52 @@ +[package] +authors = ["Darwinia Network "] +description = "Darwinia messages gadget." +edition = "2021" +homepage = "https://darwinia.network" +license = "GPL-3.0" +name = "darwinia-message-gadget" +readme = "README.md" +repository = "https://github.com/darwinia-network/darwinia" +version = "6.0.0" + +[dependencies] +# crates.io +codec = { package = "parity-scale-codec", version = "3.2", default-features = false } +scale-info = { version = "2.3", default-features = false, features = ["derive"] } + +# frontier +pallet-evm = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } + +# paritytech +frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-io = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } + +[dev-dependencies] +# crates.io +array-bytes = { version = "6.0" } + +# substrate +pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } + +[features] +default = ["std"] + +std = [ + # crates.io + "codec/std", + "scale-info/std", + + # frontier + "pallet-evm/std", + + # paritytech + "frame-support/std", + "frame-system/std", + "sp-core/std", + "sp-io/std", +] diff --git a/pallet/message-gadget/src/lib.rs b/pallet/message-gadget/src/lib.rs new file mode 100644 index 000000000..ed0a1ec2a --- /dev/null +++ b/pallet/message-gadget/src/lib.rs @@ -0,0 +1,109 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +#![cfg_attr(not(feature = "std"), no_std)] + +// core +use core::marker::PhantomData; +// frontier +use pallet_evm::Runner; +// substrate +use frame_support::{log, pallet_prelude::*, traits::Get}; +use frame_system::pallet_prelude::*; +use sp_core::{H160, H256}; +use sp_io::hashing; +use sp_std::vec; + +#[frame_support::pallet] +pub mod pallet { + // darwinia + use crate::*; + + #[pallet::config] + pub trait Config: frame_system::Config {} + + #[pallet::storage] + #[pallet::getter(fn commitment_contract)] + pub type CommitmentContract = StorageValue<_, H160, ValueQuery>; + + #[cfg_attr(feature = "std", derive(Default))] + #[pallet::genesis_config] + pub struct GenesisConfig { + pub commitment_contract: H160, + } + #[pallet::genesis_build] + impl GenesisBuild for GenesisConfig { + fn build(&self) { + >::put(H160::default()); + } + } + + #[pallet::pallet] + pub struct Pallet(_); + #[pallet::call] + impl Pallet { + #[pallet::weight(0)] + pub fn set_commitment_contract( + origin: OriginFor, + commitment_contract: H160, + ) -> DispatchResultWithPostInfo { + ensure_root(origin)?; + + >::put(commitment_contract); + + Ok(().into()) + } + } +} +pub use pallet::*; + +pub struct MessageRootGetter(PhantomData); +impl Get> for MessageRootGetter +where + T: Config + pallet_evm::Config, +{ + fn get() -> Option { + if let Ok(info) = ::Runner::call( + H160::default(), + >::get(), + hashing::keccak_256(b"commitment()")[..4].to_vec(), + 0.into(), + 1_000_000_000_000, + None, + None, + None, + vec![], + false, + false, + ::config(), + ) { + let raw_message_root = info.value; + if raw_message_root.len() != 32 { + log::warn!( + "[pallet::message-gadget] invalid raw message root: {:?}, return.", + raw_message_root + ); + + return None; + } + return Some(H256::from_slice(&raw_message_root)); + } + + None + } +} diff --git a/pallet/message-gadget/tests/tests.rs b/pallet/message-gadget/tests/tests.rs new file mode 100644 index 000000000..800626b49 --- /dev/null +++ b/pallet/message-gadget/tests/tests.rs @@ -0,0 +1,157 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use darwinia_message_gadget::*; + +impl frame_system::Config for Runtime { + type AccountData = pallet_balances::AccountData; + type AccountId = sp_core::H160; + type BaseCallFilter = frame_support::traits::Everything; + type BlockHashCount = (); + type BlockLength = (); + type BlockNumber = u64; + type BlockWeights = (); + type DbWeight = (); + type Hash = sp_core::H256; + type Hashing = sp_runtime::traits::BlakeTwo256; + type Header = sp_runtime::testing::Header; + type Index = u64; + type Lookup = sp_runtime::traits::IdentityLookup; + type MaxConsumers = frame_support::traits::ConstU32<16>; + type OnKilledAccount = (); + type OnNewAccount = (); + type OnSetCode = (); + type PalletInfo = PalletInfo; + type RuntimeCall = RuntimeCall; + type RuntimeEvent = RuntimeEvent; + type RuntimeOrigin = RuntimeOrigin; + type SS58Prefix = (); + type SystemWeightInfo = (); + type Version = (); +} + +impl pallet_timestamp::Config for Runtime { + type MinimumPeriod = (); + type Moment = u128; + type OnTimestampSet = (); + type WeightInfo = (); +} + +impl pallet_balances::Config for Runtime { + type AccountStore = System; + type Balance = u128; + type DustRemoval = (); + type ExistentialDeposit = frame_support::traits::ConstU128<0>; + type MaxLocks = (); + type MaxReserves = (); + type ReserveIdentifier = [u8; 8]; + type RuntimeEvent = RuntimeEvent; + type WeightInfo = (); +} + +impl pallet_evm::Config for Runtime { + type AddressMapping = pallet_evm::IdentityAddressMapping; + type BlockGasLimit = (); + type BlockHashMapping = pallet_evm::SubstrateBlockHashMapping; + type CallOrigin = pallet_evm::EnsureAddressRoot; + type ChainId = (); + type Currency = Balances; + type FeeCalculator = (); + type FindAuthor = (); + type GasWeightMapping = pallet_evm::FixedGasWeightMapping; + type OnChargeTransaction = (); + type PrecompilesType = (); + type PrecompilesValue = (); + type Runner = pallet_evm::runner::stack::Runner; + type RuntimeEvent = RuntimeEvent; + type WeightPerGas = (); + type WithdrawOrigin = pallet_evm::EnsureAddressNever; +} + +impl darwinia_message_gadget::Config for Runtime {} + +frame_support::construct_runtime! { + pub enum Runtime where + Block = frame_system::mocking::MockBlock, + NodeBlock = frame_system::mocking::MockBlock, + UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic, + { + System: frame_system, + Timestamp: pallet_timestamp, + Balances: pallet_balances, + Evm: pallet_evm, + MessageGadget: darwinia_message_gadget, + } +} + +pub fn new_test_ext() -> sp_io::TestExternalities { + frame_system::GenesisConfig::default().build_storage::().unwrap().into() +} + +#[test] +fn message_root_getter_should_work() { + // std + use std::str::FromStr; + // frontier + use pallet_evm::{FeeCalculator, Runner}; + // substrate + use frame_support::traits::Get; + use sp_core::{H160, H256, U256}; + + new_test_ext().execute_with(|| assert_eq!(>::get(), None)); + new_test_ext().execute_with(|| { + // pragma solidity ^0.8.0; + // + // contract MessageRootGetter { + // function commitment() public returns (bool) { + // return true; + // } + // } + const CONTRACT_CODE: &str = "0x608060405234801561001057600080fd5b5060b88061001f6000396000f3fe6080604052348015600f57600080fd5b506004361060285760003560e01c80631303a48414602d575b600080fd5b60336047565b604051603e9190605d565b60405180910390f35b60006001905090565b6057816076565b82525050565b6000602082019050607060008301846050565b92915050565b6000811515905091905056fea26469706673582212205edcbb73cc70f096b015d00b65ed893df280a01c9e90e964e8bb39957d6d3c9d64736f6c63430008070033"; + + let res = ::Runner::create( + H160::from_str("1000000000000000000000000000000000000001").unwrap(), + array_bytes::hex2bytes_unchecked(CONTRACT_CODE), + U256::zero(), + U256::from(300_000_000).low_u64(), + // TODO: not sure + Some(::FeeCalculator::min_gas_price().0), + None, + Some(U256::from(1)), + vec![], + // TODO: not sure + true, + // TODO: not sure + false, + ::config(), + ); + let contract_address = res.unwrap().value; + + >::put(contract_address); + + assert_eq!(MessageGadget::commitment_contract(), contract_address); + assert_eq!( + >::get(), + Some(H256::from_slice(&[ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 1 + ])) + ); + }); +} diff --git a/pallet/message-transact/Cargo.toml b/pallet/message-transact/Cargo.toml index 5c535e409..df35eefde 100644 --- a/pallet/message-transact/Cargo.toml +++ b/pallet/message-transact/Cargo.toml @@ -11,9 +11,9 @@ version = "6.0.0" [dependencies] # crates.io -codec = { package = "parity-scale-codec", version = "3.2.1", default-features = false, features = ["derive"] } -ethereum = { version = "0.12.0", default-features = false, features = ["with-codec"] } -scale-info = { version = "2.3.0", default-features = false, features = ["derive"] } +codec = { package = "parity-scale-codec", version = "3.2", default-features = false, features = ["derive"] } +ethereum = { version = "0.12", default-features = false, features = ["with-codec"] } +scale-info = { version = "2.3", default-features = false, features = ["derive"] } # frontier fp-ethereum = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } diff --git a/pallet/message-transact/src/mock.rs b/pallet/message-transact/src/mock.rs index 58a753df5..ea496d865 100644 --- a/pallet/message-transact/src/mock.rs +++ b/pallet/message-transact/src/mock.rs @@ -23,7 +23,6 @@ use codec::{Decode, Encode}; use sha3::{Digest, Keccak256}; // frontier use pallet_ethereum::IntermediateStateRoot; -use pallet_evm::IdentityAddressMapping; // substrate use frame_support::{ dispatch::RawOrigin, @@ -118,7 +117,7 @@ impl FeeCalculator for FixedGasPrice { } impl pallet_evm::Config for TestRuntime { - type AddressMapping = IdentityAddressMapping; + type AddressMapping = pallet_evm::IdentityAddressMapping; type BlockGasLimit = BlockGasLimit; type BlockHashMapping = pallet_evm::SubstrateBlockHashMapping; type CallOrigin = pallet_evm::EnsureAddressRoot; diff --git a/pallet/staking/src/lib.rs b/pallet/staking/src/lib.rs index 3377c43eb..8df3ac792 100644 --- a/pallet/staking/src/lib.rs +++ b/pallet/staking/src/lib.rs @@ -314,7 +314,10 @@ pub mod pallet { pub collators: Vec<(T::AccountId, Balance)>, } #[cfg(feature = "std")] - impl Default for GenesisConfig { + impl Default for GenesisConfig + where + T: Config, + { fn default() -> Self { GenesisConfig { now: 0, elapsed_time: 0, collator_count: 0, collators: Vec::new() } } diff --git a/pallet/staking/tests/mock.rs b/pallet/staking/tests/mock.rs index 695478476..5fc0f8cd0 100644 --- a/pallet/staking/tests/mock.rs +++ b/pallet/staking/tests/mock.rs @@ -17,8 +17,11 @@ // along with Darwinia. If not, see . // darwinia +use darwinia_staking::*; use dc_types::{AssetId, Balance, Moment, UNIT}; // substrate +use frame_support::traits::{GenesisBuild, OnInitialize}; +use sp_io::TestExternalities; use sp_runtime::RuntimeAppPublic; impl frame_system::Config for Runtime { @@ -239,7 +242,7 @@ frame_support::construct_runtime!( pub trait ZeroDefault { fn default() -> Self; } -impl ZeroDefault for darwinia_staking::Ledger { +impl ZeroDefault for Ledger { fn default() -> Self { Self { staked_ring: Default::default(), @@ -268,7 +271,7 @@ impl Efflux { fn initialize_block(number: u64) { System::set_block_number(number); Efflux::time(1); - >::on_initialize(number); + >::on_initialize(number); } #[derive(Default)] @@ -282,10 +285,7 @@ impl ExtBuilder { self } - pub fn build(self) -> sp_io::TestExternalities { - // substrate - use frame_support::traits::GenesisBuild; - + pub fn build(self) -> TestExternalities { let _ = pretty_env_logger::try_init(); let mut storage = frame_system::GenesisConfig::default().build_storage::().unwrap(); @@ -309,7 +309,7 @@ impl ExtBuilder { .assimilate_storage(&mut storage) .unwrap(); - let mut ext = sp_io::TestExternalities::from(storage); + let mut ext = TestExternalities::from(storage); ext.execute_with(|| initialize_block(1)); diff --git a/runtime/crab/Cargo.toml b/runtime/crab/Cargo.toml index 3901f1ee6..b61443dee 100644 --- a/runtime/crab/Cargo.toml +++ b/runtime/crab/Cargo.toml @@ -37,6 +37,8 @@ cumulus-pallet-session-benchmarking = { optional = true, default-features = fals darwinia-account-migration = { default-features = false, path = "../../pallet/account-migration" } darwinia-common-runtime = { default-features = false, path = "../common" } darwinia-deposit = { default-features = false, path = "../../pallet/deposit" } +darwinia-ecdsa-authority = { default-features = false, path = "../../pallet/ecdsa-authority" } +darwinia-message-gadget = { default-features = false, path = "../../pallet/message-gadget" } darwinia-message-transact = { default-features = false, path = "../../pallet/message-transact" } darwinia-precompile-assets = { default-features = false, path = "../../precompile/assets" } darwinia-precompile-bls12-381 = { default-features = false, path = "../../precompile/bls12-381" } @@ -60,15 +62,15 @@ pallet-bridge-parachains = { default-features = false, git = "https://github.com pallet-fee-market = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } # frontier -fp-rpc = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } -fp-self-contained = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } -pallet-base-fee = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } -pallet-ethereum = { default-features = false, features = ["forbid-evm-reentrancy"], git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } -pallet-evm = { default-features = false, features = ["forbid-evm-reentrancy"], git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } -pallet-evm-precompile-blake2 = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } -pallet-evm-precompile-bn128 = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } -pallet-evm-precompile-modexp = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } -pallet-evm-precompile-simple = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +fp-rpc = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +fp-self-contained = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +pallet-base-fee = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +pallet-ethereum = { default-features = false, features = ["forbid-evm-reentrancy"], git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +pallet-evm = { default-features = false, features = ["forbid-evm-reentrancy"], git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +pallet-evm-precompile-blake2 = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +pallet-evm-precompile-bn128 = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +pallet-evm-precompile-modexp = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +pallet-evm-precompile-simple = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } # moonbeam precompile-utils = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.30" } @@ -150,6 +152,8 @@ std = [ "darwinia-account-migration/std", "darwinia-common-runtime/std", "darwinia-deposit/std", + "darwinia-ecdsa-authority/std", + "darwinia-message-gadget/std", "darwinia-message-transact/std", "darwinia-precompile-assets/std", "darwinia-precompile-bls12-381/std", diff --git a/runtime/crab/src/lib.rs b/runtime/crab/src/lib.rs index 898374178..a009de430 100644 --- a/runtime/crab/src/lib.rs +++ b/runtime/crab/src/lib.rs @@ -241,6 +241,8 @@ frame_support::construct_runtime! { Session: pallet_session = 9, Aura: pallet_aura = 10, AuraExt: cumulus_pallet_aura_ext = 11, + MessageGadget: darwinia_message_gadget = 43, + EcdsaAuthority: darwinia_ecdsa_authority = 44, // Governance stuff. Democracy: pallet_democracy = 12, diff --git a/runtime/crab/src/pallets/migrate.rs b/runtime/crab/src/pallets/account_migration.rs similarity index 100% rename from runtime/crab/src/pallets/migrate.rs rename to runtime/crab/src/pallets/account_migration.rs diff --git a/runtime/crab/src/pallets/ecdsa_authority.rs b/runtime/crab/src/pallets/ecdsa_authority.rs new file mode 100644 index 000000000..05fc7dfcd --- /dev/null +++ b/runtime/crab/src/pallets/ecdsa_authority.rs @@ -0,0 +1,39 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +const MAX_PENDING_PERIOD: BlockNumber = 100; +const SYNC_INTERVAL: BlockNumber = 10; + +frame_support::parameter_types! { + pub const SignThreshold: sp_runtime::Perbill = sp_runtime::Perbill::from_percent(60); +} +static_assertions::const_assert!(MAX_PENDING_PERIOD > SYNC_INTERVAL); + +impl darwinia_ecdsa_authority::Config for Runtime { + type ChainId = ::ChainId; + type MaxAuthorities = ConstU32<3>; + type MaxPendingPeriod = ConstU32; + type MessageRoot = darwinia_message_gadget::MessageRootGetter; + type RuntimeEvent = RuntimeEvent; + type SignThreshold = SignThreshold; + type SyncInterval = ConstU32; + type WeightInfo = (); +} diff --git a/runtime/crab/src/pallets/message_gadget.rs b/runtime/crab/src/pallets/message_gadget.rs new file mode 100644 index 000000000..25cf8aeeb --- /dev/null +++ b/runtime/crab/src/pallets/message_gadget.rs @@ -0,0 +1,22 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +impl darwinia_message_gadget::Config for Runtime {} diff --git a/runtime/crab/src/pallets/mod.rs b/runtime/crab/src/pallets/mod.rs index 8849eddbb..6cfae9680 100644 --- a/runtime/crab/src/pallets/mod.rs +++ b/runtime/crab/src/pallets/mod.rs @@ -44,7 +44,7 @@ pub use assets::*; mod deposit; -mod migrate; +mod account_migration; // Consensus stuff. mod authorship; @@ -58,6 +58,10 @@ mod aura; mod aura_ext; +mod message_gadget; + +mod ecdsa_authority; + // Governance stuff. mod democracy; diff --git a/runtime/darwinia/Cargo.toml b/runtime/darwinia/Cargo.toml index 5857cd7bd..8ede78417 100644 --- a/runtime/darwinia/Cargo.toml +++ b/runtime/darwinia/Cargo.toml @@ -37,6 +37,8 @@ cumulus-pallet-session-benchmarking = { optional = true, default-features = fals darwinia-account-migration = { default-features = false, path = "../../pallet/account-migration" } darwinia-common-runtime = { default-features = false, path = "../common" } darwinia-deposit = { default-features = false, path = "../../pallet/deposit" } +darwinia-ecdsa-authority = { default-features = false, path = "../../pallet/ecdsa-authority" } +darwinia-message-gadget = { default-features = false, path = "../../pallet/message-gadget" } darwinia-message-transact = { default-features = false, path = "../../pallet/message-transact" } darwinia-precompile-assets = { default-features = false, path = "../../precompile/assets" } darwinia-precompile-bls12-381 = { default-features = false, path = "../../precompile/bls12-381" } @@ -60,15 +62,15 @@ pallet-bridge-parachains = { default-features = false, git = "https://github.com pallet-fee-market = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } # frontier -fp-rpc = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } -fp-self-contained = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } -pallet-base-fee = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } -pallet-ethereum = { default-features = false, features = ["forbid-evm-reentrancy"], git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } -pallet-evm = { default-features = false, features = ["forbid-evm-reentrancy"], git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } -pallet-evm-precompile-blake2 = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } -pallet-evm-precompile-bn128 = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } -pallet-evm-precompile-modexp = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } -pallet-evm-precompile-simple = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +fp-rpc = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +fp-self-contained = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +pallet-base-fee = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +pallet-ethereum = { default-features = false, features = ["forbid-evm-reentrancy"], git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +pallet-evm = { default-features = false, features = ["forbid-evm-reentrancy"], git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +pallet-evm-precompile-blake2 = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +pallet-evm-precompile-bn128 = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +pallet-evm-precompile-modexp = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +pallet-evm-precompile-simple = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } # moonbeam precompile-utils = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.30" } @@ -150,6 +152,8 @@ std = [ "darwinia-account-migration/std", "darwinia-common-runtime/std", "darwinia-deposit/std", + "darwinia-ecdsa-authority/std", + "darwinia-message-gadget/std", "darwinia-message-transact/std", "darwinia-precompile-assets/std", "darwinia-precompile-bls12-381/std", diff --git a/runtime/darwinia/src/lib.rs b/runtime/darwinia/src/lib.rs index 10df130b5..57e5ee4e9 100644 --- a/runtime/darwinia/src/lib.rs +++ b/runtime/darwinia/src/lib.rs @@ -241,6 +241,8 @@ frame_support::construct_runtime! { Session: pallet_session = 9, Aura: pallet_aura = 10, AuraExt: cumulus_pallet_aura_ext = 11, + MessageGadget: darwinia_message_gadget = 43, + EcdsaAuthority: darwinia_ecdsa_authority = 44, // Governance stuff. Democracy: pallet_democracy = 12, diff --git a/runtime/darwinia/src/pallets/migrate.rs b/runtime/darwinia/src/pallets/account_migration.rs similarity index 100% rename from runtime/darwinia/src/pallets/migrate.rs rename to runtime/darwinia/src/pallets/account_migration.rs diff --git a/runtime/darwinia/src/pallets/ecdsa_authority.rs b/runtime/darwinia/src/pallets/ecdsa_authority.rs new file mode 100644 index 000000000..05fc7dfcd --- /dev/null +++ b/runtime/darwinia/src/pallets/ecdsa_authority.rs @@ -0,0 +1,39 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +const MAX_PENDING_PERIOD: BlockNumber = 100; +const SYNC_INTERVAL: BlockNumber = 10; + +frame_support::parameter_types! { + pub const SignThreshold: sp_runtime::Perbill = sp_runtime::Perbill::from_percent(60); +} +static_assertions::const_assert!(MAX_PENDING_PERIOD > SYNC_INTERVAL); + +impl darwinia_ecdsa_authority::Config for Runtime { + type ChainId = ::ChainId; + type MaxAuthorities = ConstU32<3>; + type MaxPendingPeriod = ConstU32; + type MessageRoot = darwinia_message_gadget::MessageRootGetter; + type RuntimeEvent = RuntimeEvent; + type SignThreshold = SignThreshold; + type SyncInterval = ConstU32; + type WeightInfo = (); +} diff --git a/runtime/darwinia/src/pallets/message_gadget.rs b/runtime/darwinia/src/pallets/message_gadget.rs new file mode 100644 index 000000000..25cf8aeeb --- /dev/null +++ b/runtime/darwinia/src/pallets/message_gadget.rs @@ -0,0 +1,22 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +impl darwinia_message_gadget::Config for Runtime {} diff --git a/runtime/darwinia/src/pallets/mod.rs b/runtime/darwinia/src/pallets/mod.rs index 8849eddbb..6cfae9680 100644 --- a/runtime/darwinia/src/pallets/mod.rs +++ b/runtime/darwinia/src/pallets/mod.rs @@ -44,7 +44,7 @@ pub use assets::*; mod deposit; -mod migrate; +mod account_migration; // Consensus stuff. mod authorship; @@ -58,6 +58,10 @@ mod aura; mod aura_ext; +mod message_gadget; + +mod ecdsa_authority; + // Governance stuff. mod democracy; diff --git a/runtime/pangolin/Cargo.toml b/runtime/pangolin/Cargo.toml index e1a608fbf..d6908fd55 100644 --- a/runtime/pangolin/Cargo.toml +++ b/runtime/pangolin/Cargo.toml @@ -37,6 +37,8 @@ cumulus-pallet-session-benchmarking = { optional = true, default-features = fals darwinia-account-migration = { default-features = false, path = "../../pallet/account-migration" } darwinia-common-runtime = { default-features = false, path = "../common" } darwinia-deposit = { default-features = false, path = "../../pallet/deposit" } +darwinia-ecdsa-authority = { default-features = false, path = "../../pallet/ecdsa-authority" } +darwinia-message-gadget = { default-features = false, path = "../../pallet/message-gadget" } darwinia-message-transact = { default-features = false, path = "../../pallet/message-transact" } darwinia-precompile-assets = { default-features = false, path = "../../precompile/assets" } darwinia-precompile-bls12-381 = { default-features = false, path = "../../precompile/bls12-381" } @@ -59,15 +61,15 @@ pallet-bridge-messages = { default-features = false, git = "https://github.com/d pallet-fee-market = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } # frontier -fp-rpc = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } -fp-self-contained = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } -pallet-base-fee = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } -pallet-ethereum = { default-features = false, features = ["forbid-evm-reentrancy"], git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } -pallet-evm = { default-features = false, features = ["forbid-evm-reentrancy"], git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } -pallet-evm-precompile-blake2 = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } -pallet-evm-precompile-bn128 = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } -pallet-evm-precompile-modexp = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } -pallet-evm-precompile-simple = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +fp-rpc = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +fp-self-contained = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +pallet-base-fee = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +pallet-ethereum = { default-features = false, features = ["forbid-evm-reentrancy"], git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +pallet-evm = { default-features = false, features = ["forbid-evm-reentrancy"], git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +pallet-evm-precompile-blake2 = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +pallet-evm-precompile-bn128 = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +pallet-evm-precompile-modexp = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +pallet-evm-precompile-simple = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } # moonbeam precompile-utils = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.30" } @@ -149,6 +151,8 @@ std = [ "darwinia-account-migration/std", "darwinia-common-runtime/std", "darwinia-deposit/std", + "darwinia-ecdsa-authority/std", + "darwinia-message-gadget/std", "darwinia-message-transact/std", "darwinia-precompile-assets/std", "darwinia-precompile-bls12-381/std", diff --git a/runtime/pangolin/src/lib.rs b/runtime/pangolin/src/lib.rs index 31c079a23..c165e1013 100644 --- a/runtime/pangolin/src/lib.rs +++ b/runtime/pangolin/src/lib.rs @@ -238,6 +238,8 @@ frame_support::construct_runtime! { Session: pallet_session = 9, Aura: pallet_aura = 10, AuraExt: cumulus_pallet_aura_ext = 11, + MessageGadget: darwinia_message_gadget = 42, + EcdsaAuthority: darwinia_ecdsa_authority = 43, // Governance stuff. Democracy: pallet_democracy = 12, diff --git a/runtime/pangolin/src/pallets/migrate.rs b/runtime/pangolin/src/pallets/account_migration.rs similarity index 93% rename from runtime/pangolin/src/pallets/migrate.rs rename to runtime/pangolin/src/pallets/account_migration.rs index 1797da2ec..6eeca3e9c 100644 --- a/runtime/pangolin/src/pallets/migrate.rs +++ b/runtime/pangolin/src/pallets/account_migration.rs @@ -20,6 +20,6 @@ use crate::*; impl darwinia_account_migration::Config for Runtime { - type ChainId = ::ChainId; + type ChainId = ::ChainId; type RuntimeEvent = RuntimeEvent; } diff --git a/runtime/pangolin/src/pallets/ecdsa_authority.rs b/runtime/pangolin/src/pallets/ecdsa_authority.rs new file mode 100644 index 000000000..05fc7dfcd --- /dev/null +++ b/runtime/pangolin/src/pallets/ecdsa_authority.rs @@ -0,0 +1,39 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +const MAX_PENDING_PERIOD: BlockNumber = 100; +const SYNC_INTERVAL: BlockNumber = 10; + +frame_support::parameter_types! { + pub const SignThreshold: sp_runtime::Perbill = sp_runtime::Perbill::from_percent(60); +} +static_assertions::const_assert!(MAX_PENDING_PERIOD > SYNC_INTERVAL); + +impl darwinia_ecdsa_authority::Config for Runtime { + type ChainId = ::ChainId; + type MaxAuthorities = ConstU32<3>; + type MaxPendingPeriod = ConstU32; + type MessageRoot = darwinia_message_gadget::MessageRootGetter; + type RuntimeEvent = RuntimeEvent; + type SignThreshold = SignThreshold; + type SyncInterval = ConstU32; + type WeightInfo = (); +} diff --git a/runtime/pangolin/src/pallets/message_gadget.rs b/runtime/pangolin/src/pallets/message_gadget.rs new file mode 100644 index 000000000..25cf8aeeb --- /dev/null +++ b/runtime/pangolin/src/pallets/message_gadget.rs @@ -0,0 +1,22 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +impl darwinia_message_gadget::Config for Runtime {} diff --git a/runtime/pangolin/src/pallets/mod.rs b/runtime/pangolin/src/pallets/mod.rs index 496d6304b..254128833 100644 --- a/runtime/pangolin/src/pallets/mod.rs +++ b/runtime/pangolin/src/pallets/mod.rs @@ -44,7 +44,7 @@ pub use assets::*; mod deposit; -mod migrate; +mod account_migration; // Consensus stuff. mod authorship; @@ -58,6 +58,10 @@ mod aura; mod aura_ext; +mod message_gadget; + +mod ecdsa_authority; + // Governance stuff. mod democracy; From f348232baba775dda2d2bfaefccccb43782a345c Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Sat, 7 Jan 2023 05:18:47 +0800 Subject: [PATCH 087/189] Add `restake` and fix some bugs (#188) * Add `restake` and fix some bugs * More tests * More tests * Doc --- pallet/deposit/src/lib.rs | 6 +- pallet/staking/src/lib.rs | 226 +++++++++++++++++++++++++--------- pallet/staking/tests/tests.rs | 176 ++++++++++++++++++++------ 3 files changed, 303 insertions(+), 105 deletions(-) diff --git a/pallet/deposit/src/lib.rs b/pallet/deposit/src/lib.rs index aa3a8ad84..4e004a8e6 100644 --- a/pallet/deposit/src/lib.rs +++ b/pallet/deposit/src/lib.rs @@ -368,12 +368,12 @@ where { type Amount = Balance; - fn amount(who: &Self::AccountId, item: Self::Item) -> Self::Amount { - >::get(who) + fn amount(who: &Self::AccountId, item: Self::Item) -> Result { + Ok(>::get(who) .and_then(|ds| { ds.into_iter().find_map(|d| if d.id == item { Some(d.value) } else { None }) }) - .unwrap_or_default() + .ok_or(>::DepositNotFound)?) } } diff --git a/pallet/staking/src/lib.rs b/pallet/staking/src/lib.rs index 8df3ac792..1ecd660fe 100644 --- a/pallet/staking/src/lib.rs +++ b/pallet/staking/src/lib.rs @@ -95,7 +95,7 @@ pub trait StakeExt: Stake { type Amount; /// Get the staked amount. - fn amount(who: &Self::AccountId, item: Self::Item) -> Self::Amount; + fn amount(who: &Self::AccountId, item: Self::Item) -> Result; } /// A convertor from collators id. Since this pallet does not have stash/controller, this is @@ -239,6 +239,8 @@ pub mod pallet { ExceedMaxDeposits, /// Exceed maximum unstaking/unbonding count. ExceedMaxUnstakings, + /// Deposit not found. + DepositNotFound, /// You are not a staker. NotStaker, /// Target is not a collator. @@ -380,10 +382,18 @@ pub mod pallet { }; if ring_amount != 0 { - Self::stake_ring(&who, l, ring_amount)?; + Self::stake_token::>( + &who, + &mut l.staked_ring, + ring_amount, + )?; } if kton_amount != 0 { - Self::stake_kton(&who, l, kton_amount)?; + Self::stake_token::>( + &who, + &mut l.staked_kton, + kton_amount, + )?; } for d in deposits.clone() { @@ -416,10 +426,18 @@ pub mod pallet { let l = l.as_mut().ok_or(>::NotStaker)?; if ring_amount != 0 { - Self::unstake_ring(l, ring_amount)?; + Self::unstake_token::>( + &mut l.staked_ring, + &mut l.unstaking_ring, + ring_amount, + )?; } if kton_amount != 0 { - Self::unstake_kton(l, kton_amount)?; + Self::unstake_token::>( + &mut l.staked_kton, + &mut l.unstaking_kton, + kton_amount, + )?; } for d in deposits { @@ -434,6 +452,52 @@ pub mod pallet { Ok(()) } + /// Cancel the `unstake` operation. + /// + /// Re-stake the unstaking assets immediately. + #[pallet::weight(0)] + pub fn restake( + origin: OriginFor, + ring_amount: Balance, + kton_amount: Balance, + deposits: Vec>, + ) -> DispatchResult { + let who = ensure_signed(origin)?; + + if ring_amount == 0 && kton_amount == 0 && deposits.is_empty() { + return Ok(()); + } + + >::try_mutate(&who, |l| { + let l = l.as_mut().ok_or(>::NotStaker)?; + + if ring_amount != 0 { + Self::restake_token::>( + &mut l.staked_ring, + &mut l.unstaking_ring, + ring_amount, + )?; + } + if kton_amount != 0 { + Self::restake_token::>( + &mut l.staked_kton, + &mut l.unstaking_kton, + kton_amount, + )?; + } + + for d in deposits { + Self::restake_deposit(&who, l, d)?; + } + + DispatchResult::Ok(()) + })?; + + // TODO: event? + + Ok(()) + } + /// Claim the stakes from the pallet/contract account. #[pallet::weight(0)] pub fn claim(origin: OriginFor) -> DispatchResult { @@ -521,36 +585,22 @@ pub mod pallet { }) } - fn stake_ring( + fn stake_token( who: &T::AccountId, - ledger: &mut Ledger, + record: &mut Balance, amount: Balance, - ) -> DispatchResult { - T::Ring::stake(who, amount)?; - - ledger.staked_ring = ledger - .staked_ring - .checked_add(amount) - .ok_or("[pallet::staking] `u128` must not be overflowed; qed")?; - - Self::update_pool::>(true, amount)?; - - Ok(()) - } - - fn stake_kton( - who: &T::AccountId, - ledger: &mut Ledger, - amount: Balance, - ) -> DispatchResult { - T::Kton::stake(who, amount)?; + ) -> DispatchResult + where + S: Stake, + P: frame_support::StorageValue, + { + S::stake(who, amount)?; - ledger.staked_kton = ledger - .staked_kton + *record = record .checked_add(amount) .ok_or("[pallet::staking] `u128` must not be overflowed; qed")?; - Self::update_pool::>(true, amount)?; + Self::update_pool::

(true, amount)?; Ok(()) } @@ -564,69 +614,121 @@ pub mod pallet { ledger.staked_deposits.try_push(deposit).map_err(|_| >::ExceedMaxDeposits)?; - Self::update_pool::>(true, T::Deposit::amount(who, deposit))?; + Self::update_pool::>(true, T::Deposit::amount(who, deposit)?)?; Ok(()) } - fn unstake_ring(ledger: &mut Ledger, amount: Balance) -> DispatchResult { - let nr = ledger - .staked_ring + fn unstake_token

( + staked: &mut Balance, + unstaking: &mut BoundedVec<(Balance, T::BlockNumber), T::MaxUnstakings>, + amount: Balance, + ) -> DispatchResult + where + P: frame_support::StorageValue, + { + *staked = staked .checked_sub(amount) .ok_or("[pallet::staking] `u128` must not be overflowed; qed")?; - ledger.staked_ring = nr; - ledger - .unstaking_ring + unstaking .try_push(( amount, >::block_number() + T::MinStakingDuration::get(), )) .map_err(|_| >::ExceedMaxUnstakings)?; - Self::update_pool::>(false, amount)?; + Self::update_pool::

(false, amount)?; Ok(()) } - fn unstake_kton(ledger: &mut Ledger, amount: Balance) -> DispatchResult { - let nk = ledger - .staked_kton - .checked_sub(amount) - .ok_or("[pallet::staking] `u128` must not be overflowed; qed")?; - - ledger.staked_kton = nk; + fn unstake_deposit( + who: &T::AccountId, + ledger: &mut Ledger, + deposit: DepositId, + ) -> DispatchResult { ledger - .unstaking_kton + .unstaking_deposits .try_push(( - amount, + ledger.staked_deposits.remove( + ledger + .staked_deposits + .iter() + .position(|d| d == &deposit) + .ok_or(>::DepositNotFound)?, + ), >::block_number() + T::MinStakingDuration::get(), )) .map_err(|_| >::ExceedMaxUnstakings)?; - Self::update_pool::>(false, amount)?; + Self::update_pool::>(false, T::Deposit::amount(who, deposit)?)?; Ok(()) } - fn unstake_deposit( + fn restake_token

( + staked: &mut Balance, + unstaking: &mut BoundedVec<(Balance, T::BlockNumber), T::MaxUnstakings>, + mut amount: Balance, + ) -> DispatchResult + where + P: frame_support::StorageValue, + { + let mut actual_restake = 0; + + // Cancel the latest `unstake` first. + while let Some((u, _)) = unstaking.last_mut() { + if let Some(k) = u.checked_sub(amount) { + actual_restake += amount; + *u = k; + + if k == 0 { + unstaking + .pop() + .ok_or("[pallet::staking] record must exist, due to `last_mut`; qed")?; + } + + break; + } else { + actual_restake += *u; + amount -= *u; + + unstaking + .pop() + .ok_or("[pallet::staking] record must exist, due to `last_mut`; qed")?; + } + } + + *staked += actual_restake; + + Self::update_pool::

(true, actual_restake)?; + + Ok(()) + } + + fn restake_deposit( who: &T::AccountId, ledger: &mut Ledger, deposit: DepositId, ) -> DispatchResult { - let i = ledger.staked_deposits.iter().position(|d| d == &deposit).ok_or( - "[pallet::staking] deposit id must be existed, due to previous unstake OP; qed", - )?; - ledger - .unstaking_deposits - .try_push(( - ledger.staked_deposits.remove(i), - >::block_number() + T::MinStakingDuration::get(), - )) - .map_err(|_| >::ExceedMaxUnstakings)?; - - Self::update_pool::>(false, T::Deposit::amount(who, deposit))?; + .staked_deposits + .try_push( + ledger + .unstaking_deposits + .remove( + ledger + .unstaking_deposits + .iter() + .position(|(d, _)| d == &deposit) + .ok_or(>::DepositNotFound)?, + ) + .0, + ) + .map_err(|_| >::ExceedMaxDeposits)?; + + Self::update_pool::>(true, T::Deposit::amount(who, deposit)?)?; Ok(()) } @@ -721,7 +823,9 @@ pub mod pallet { l.staked_ring + l.staked_deposits .into_iter() - .fold(0, |r, d| r + T::Deposit::amount(who, d)), + // We don't care if the deposit exists here. + // It was guaranteed by the `stake`/`unstake`/`restake` functions. + .fold(0, |r, d| r + T::Deposit::amount(who, d).unwrap_or_default()), ) + Self::balance2power::>(l.staked_kton) }) .unwrap_or_default() diff --git a/pallet/staking/tests/tests.rs b/pallet/staking/tests/tests.rs index 8a7c36e61..048eb10d0 100644 --- a/pallet/staking/tests/tests.rs +++ b/pallet/staking/tests/tests.rs @@ -22,10 +22,11 @@ use mock::*; // core use core::time::Duration; // darwinia +use darwinia_deposit::Error as DepositError; use darwinia_staking::*; use dc_types::{Balance, UNIT}; // substrate -use frame_support::{assert_ok, BoundedVec}; +use frame_support::{assert_noop, assert_ok, BoundedVec}; use sp_runtime::{assert_eq_error_rate, Perbill}; #[test] @@ -54,6 +55,12 @@ fn stake_should_work() { Ledger { staked_ring: UNIT, staked_kton: UNIT, ..ZeroDefault::default() } ); + // Stake invalid deposit. + assert_noop!( + Staking::stake(RuntimeOrigin::signed(1), 0, 0, vec![0]), + >::DepositNotFound + ); + // Stake 1 deposit. assert_eq!(System::account(1).consumers, 1); assert_ok!(Deposit::lock(RuntimeOrigin::signed(1), UNIT, 1)); @@ -93,14 +100,14 @@ fn unstake_should_work() { assert_ok!(Deposit::lock(RuntimeOrigin::signed(1), UNIT, 1)); assert_ok!(Deposit::lock(RuntimeOrigin::signed(1), UNIT, 1)); assert_ok!(Deposit::lock(RuntimeOrigin::signed(1), UNIT, 1)); - assert_ok!(Staking::stake(RuntimeOrigin::signed(1), 2 * UNIT, 2 * UNIT, vec![0, 1, 2])); - assert_eq!(Balances::free_balance(1), 995 * UNIT); - assert_eq!(Assets::balance(0, 1), 998 * UNIT + 22_842_639_593_907); + assert_ok!(Staking::stake(RuntimeOrigin::signed(1), 3 * UNIT, 3 * UNIT, vec![0, 1, 2])); + assert_eq!(Balances::free_balance(1), 994 * UNIT); + assert_eq!(Assets::balance(0, 1), 997 * UNIT + 22_842_639_593_907); assert_eq!( Staking::ledger_of(1).unwrap(), Ledger { - staked_ring: 2 * UNIT, - staked_kton: 2 * UNIT, + staked_ring: 3 * UNIT, + staked_kton: 3 * UNIT, staked_deposits: BoundedVec::truncate_from(vec![0, 1, 2]), ..ZeroDefault::default() } @@ -111,8 +118,8 @@ fn unstake_should_work() { assert_eq!( Staking::ledger_of(1).unwrap(), Ledger { - staked_ring: UNIT, - staked_kton: 2 * UNIT, + staked_ring: 2 * UNIT, + staked_kton: 3 * UNIT, staked_deposits: BoundedVec::truncate_from(vec![0, 1, 2]), unstaking_ring: BoundedVec::truncate_from(vec![(UNIT, 4)]), ..ZeroDefault::default() @@ -125,8 +132,8 @@ fn unstake_should_work() { assert_eq!( Staking::ledger_of(1).unwrap(), Ledger { - staked_ring: UNIT, - staked_kton: UNIT, + staked_ring: 2 * UNIT, + staked_kton: 2 * UNIT, staked_deposits: BoundedVec::truncate_from(vec![0, 1, 2]), unstaking_ring: BoundedVec::truncate_from(vec![(UNIT, 4)]), unstaking_kton: BoundedVec::truncate_from(vec![(UNIT, 5)]), @@ -134,39 +141,134 @@ fn unstake_should_work() { } ); + // Unstake invalid deposit. + assert_noop!( + Staking::unstake(RuntimeOrigin::signed(1), 0, 0, vec![3]), + >::DepositNotFound + ); + // Unstake 1 deposit. Efflux::block(1); - assert_ok!(Staking::unstake(RuntimeOrigin::signed(1), 0, 0, vec![0])); + assert_ok!(Staking::unstake(RuntimeOrigin::signed(1), 0, 0, vec![1])); assert_eq!( Staking::ledger_of(1).unwrap(), Ledger { - staked_ring: UNIT, - staked_kton: UNIT, - staked_deposits: BoundedVec::truncate_from(vec![1, 2]), + staked_ring: 2 * UNIT, + staked_kton: 2 * UNIT, + staked_deposits: BoundedVec::truncate_from(vec![0, 2]), unstaking_ring: BoundedVec::truncate_from(vec![(UNIT, 4)]), unstaking_kton: BoundedVec::truncate_from(vec![(UNIT, 5)]), - unstaking_deposits: BoundedVec::truncate_from(vec![(0, 6)]) + unstaking_deposits: BoundedVec::truncate_from(vec![(1, 6)]) } ); - // Unstake 1 RING, 1 KTON and 2 deposits. + // Unstake 2 RING, 2 KTON and 2 deposits. Efflux::block(1); - assert_ok!(Staking::unstake(RuntimeOrigin::signed(1), UNIT, UNIT, vec![1, 2])); + assert_ok!(Staking::unstake(RuntimeOrigin::signed(1), 2 * UNIT, 2 * UNIT, vec![0, 2])); assert_eq!( Staking::ledger_of(1).unwrap(), Ledger { - staked_ring: 0, - staked_kton: 0, - staked_deposits: Default::default(), - unstaking_ring: BoundedVec::truncate_from(vec![(UNIT, 4), (UNIT, 7)]), - unstaking_kton: BoundedVec::truncate_from(vec![(UNIT, 5), (UNIT, 7)]), - unstaking_deposits: BoundedVec::truncate_from(vec![(0, 6), (1, 7), (2, 7)]) + unstaking_ring: BoundedVec::truncate_from(vec![(UNIT, 4), (2 * UNIT, 7)]), + unstaking_kton: BoundedVec::truncate_from(vec![(UNIT, 5), (2 * UNIT, 7)]), + unstaking_deposits: BoundedVec::truncate_from(vec![(1, 6), (0, 7), (2, 7)]), + ..ZeroDefault::default() } ); // Keep the stakes for at least `MinStakingDuration`. - assert_eq!(Balances::free_balance(1), 995 * UNIT); - assert_eq!(Assets::balance(0, 1), 998 * UNIT + 22_842_639_593_907); + assert_eq!(Balances::free_balance(1), 994 * UNIT); + assert_eq!(Assets::balance(0, 1), 997 * UNIT + 22_842_639_593_907); + }); +} + +#[test] +fn restake_should_work() { + ExtBuilder::default().build().execute_with(|| { + assert_ok!(Deposit::lock(RuntimeOrigin::signed(1), UNIT, 1)); + assert_ok!(Deposit::lock(RuntimeOrigin::signed(1), UNIT, 1)); + assert_ok!(Deposit::lock(RuntimeOrigin::signed(1), UNIT, 1)); + assert_ok!(Staking::stake(RuntimeOrigin::signed(1), 3 * UNIT, 3 * UNIT, vec![0, 1, 2])); + assert_ok!(Staking::unstake(RuntimeOrigin::signed(1), UNIT, UNIT, vec![0, 1, 2])); + Efflux::block(1); + assert_ok!(Staking::unstake(RuntimeOrigin::signed(1), UNIT, UNIT, Vec::new())); + Efflux::block(1); + assert_ok!(Staking::unstake(RuntimeOrigin::signed(1), UNIT, UNIT, Vec::new())); + assert_eq!(Balances::free_balance(1), 994 * UNIT); + assert_eq!(Assets::balance(0, 1), 997 * UNIT + 22_842_639_593_907); + assert_eq!( + Staking::ledger_of(1).unwrap(), + Ledger { + unstaking_ring: BoundedVec::truncate_from(vec![(UNIT, 4), (UNIT, 5), (UNIT, 6)]), + unstaking_kton: BoundedVec::truncate_from(vec![(UNIT, 4), (UNIT, 5), (UNIT, 6)]), + unstaking_deposits: BoundedVec::truncate_from(vec![(0, 4), (1, 4), (2, 4)]), + ..ZeroDefault::default() + } + ); + + // Restake 1.5 RING. + assert_ok!(Staking::restake(RuntimeOrigin::signed(1), 3 * UNIT / 2, 0, Vec::new())); + assert_eq!( + Staking::ledger_of(1).unwrap(), + Ledger { + staked_ring: 3 * UNIT / 2, + unstaking_ring: BoundedVec::truncate_from(vec![(UNIT, 4), (UNIT / 2, 5)]), + unstaking_kton: BoundedVec::truncate_from(vec![(UNIT, 4), (UNIT, 5), (UNIT, 6)]), + unstaking_deposits: BoundedVec::truncate_from(vec![(0, 4), (1, 4), (2, 4)]), + ..ZeroDefault::default() + } + ); + + // Restake 1.5 KTON. + assert_ok!(Staking::restake(RuntimeOrigin::signed(1), 0, 3 * UNIT / 2, Vec::new())); + assert_eq!( + Staking::ledger_of(1).unwrap(), + Ledger { + staked_ring: 3 * UNIT / 2, + staked_kton: 3 * UNIT / 2, + unstaking_ring: BoundedVec::truncate_from(vec![(UNIT, 4), (UNIT / 2, 5)]), + unstaking_kton: BoundedVec::truncate_from(vec![(UNIT, 4), (UNIT / 2, 5)]), + unstaking_deposits: BoundedVec::truncate_from(vec![(0, 4), (1, 4), (2, 4)]), + ..ZeroDefault::default() + } + ); + + // Restake invalid deposit. + assert_noop!( + Staking::unstake(RuntimeOrigin::signed(1), 0, 0, vec![3]), + >::DepositNotFound + ); + + // Restake 1 deposit. + assert_ok!(Staking::restake(RuntimeOrigin::signed(1), 0, 0, vec![1])); + assert_eq!( + Staking::ledger_of(1).unwrap(), + Ledger { + staked_ring: 3 * UNIT / 2, + staked_kton: 3 * UNIT / 2, + staked_deposits: BoundedVec::truncate_from(vec![1]), + unstaking_ring: BoundedVec::truncate_from(vec![(UNIT, 4), (UNIT / 2, 5)]), + unstaking_kton: BoundedVec::truncate_from(vec![(UNIT, 4), (UNIT / 2, 5)]), + unstaking_deposits: BoundedVec::truncate_from(vec![(0, 4), (2, 4)]), + } + ); + + // Restake 1.5 RING, 1.5 KTON and 2 deposits. + Efflux::block(1); + assert_ok!(Staking::restake( + RuntimeOrigin::signed(1), + 3 * UNIT / 2, + 3 * UNIT / 2, + vec![0, 2] + )); + assert_eq!( + Staking::ledger_of(1).unwrap(), + Ledger { + staked_ring: 3 * UNIT, + staked_kton: 3 * UNIT, + staked_deposits: BoundedVec::truncate_from(vec![1, 0, 2]), + ..ZeroDefault::default() + } + ); }); } @@ -190,12 +292,10 @@ fn claim_should_work() { assert_eq!( Staking::ledger_of(1).unwrap(), Ledger { - staked_ring: 0, - staked_kton: 0, - staked_deposits: Default::default(), unstaking_ring: BoundedVec::truncate_from(vec![(UNIT, 4), (UNIT, 7)]), unstaking_kton: BoundedVec::truncate_from(vec![(UNIT, 5), (UNIT, 7)]), - unstaking_deposits: BoundedVec::truncate_from(vec![(0, 6), (1, 7), (2, 7)]) + unstaking_deposits: BoundedVec::truncate_from(vec![(0, 6), (1, 7), (2, 7)]), + ..ZeroDefault::default() } ); @@ -206,12 +306,10 @@ fn claim_should_work() { assert_eq!( Staking::ledger_of(1).unwrap(), Ledger { - staked_ring: 0, - staked_kton: 0, - staked_deposits: Default::default(), unstaking_ring: BoundedVec::truncate_from(vec![(UNIT, 7)]), unstaking_kton: BoundedVec::truncate_from(vec![(UNIT, 5), (UNIT, 7)]), - unstaking_deposits: BoundedVec::truncate_from(vec![(0, 6), (1, 7), (2, 7)]) + unstaking_deposits: BoundedVec::truncate_from(vec![(0, 6), (1, 7), (2, 7)]), + ..ZeroDefault::default() } ); @@ -223,12 +321,10 @@ fn claim_should_work() { assert_eq!( Staking::ledger_of(1).unwrap(), Ledger { - staked_ring: 0, - staked_kton: 0, - staked_deposits: Default::default(), unstaking_ring: BoundedVec::truncate_from(vec![(UNIT, 7)]), unstaking_kton: BoundedVec::truncate_from(vec![(UNIT, 7)]), - unstaking_deposits: BoundedVec::truncate_from(vec![(0, 6), (1, 7), (2, 7)]) + unstaking_deposits: BoundedVec::truncate_from(vec![(0, 6), (1, 7), (2, 7)]), + ..ZeroDefault::default() } ); @@ -240,12 +336,10 @@ fn claim_should_work() { assert_eq!( Staking::ledger_of(1).unwrap(), Ledger { - staked_ring: 0, - staked_kton: 0, - staked_deposits: Default::default(), unstaking_ring: BoundedVec::truncate_from(vec![(UNIT, 7)]), unstaking_kton: BoundedVec::truncate_from(vec![(UNIT, 7)]), - unstaking_deposits: BoundedVec::truncate_from(vec![(1, 7), (2, 7)]) + unstaking_deposits: BoundedVec::truncate_from(vec![(1, 7), (2, 7)]), + ..ZeroDefault::default() } ); From 82b9a73fd06f26726f17433bfd1400aa8040e01a Mon Sep 17 00:00:00 2001 From: bear Date: Mon, 9 Jan 2023 11:56:11 +0800 Subject: [PATCH 088/189] Add restake interface (#189) --- precompile/staking/src/lib.rs | 22 ++++++++++++++++++++++ precompile/staking/src/tests.rs | 19 ++++++++++++++++++- 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/precompile/staking/src/lib.rs b/precompile/staking/src/lib.rs index 62658ad4e..d5fef1e31 100644 --- a/precompile/staking/src/lib.rs +++ b/precompile/staking/src/lib.rs @@ -96,6 +96,28 @@ where Ok(true) } + #[precompile::public("restake(uint256,uint256,uint8[])")] + fn restake( + handle: &mut impl PrecompileHandle, + ring_amount: U256, + kton_amount: U256, + deposits: Vec, + ) -> EvmResult { + let origin = handle.context().caller.into(); + let deposits = deposits.into_iter().map(|i| i.into()).collect(); + + RuntimeHelper::::try_dispatch( + handle, + Some(origin).into(), + darwinia_staking::Call::::restake { + ring_amount: ring_amount.as_u128(), + kton_amount: kton_amount.as_u128(), + deposits, + }, + )?; + Ok(true) + } + #[precompile::public("claim()")] fn claim(handle: &mut impl PrecompileHandle) -> EvmResult { let origin = handle.context().caller.into(); diff --git a/precompile/staking/src/tests.rs b/precompile/staking/src/tests.rs index af6e625b1..1de3f9f8a 100644 --- a/precompile/staking/src/tests.rs +++ b/precompile/staking/src/tests.rs @@ -35,6 +35,7 @@ fn precompiles() -> TestPrecompiles { fn selectors() { assert!(PCall::stake_selectors().contains(&0x757f9b3b)); assert!(PCall::unstake_selectors().contains(&0xef20fcb3)); + assert!(PCall::restake_selectors().contains(&0x17092fcb)); assert!(PCall::claim_selectors().contains(&0x4e71d92d)); assert!(PCall::nominate_selectors().contains(&0xb332180b)); assert!(PCall::collect_selectors().contains(&0x10a66536)); @@ -42,7 +43,7 @@ fn selectors() { } #[test] -fn stake_and_unstake() { +fn stake_unstake_restake() { let alice: H160 = Alice.into(); ExtBuilder::default().with_balances(vec![(alice, 300)]).build().execute_with(|| { // stake @@ -72,6 +73,22 @@ fn stake_and_unstake() { ) .execute_returns(EvmDataWriter::new().write(true).build()); assert_eq!(Staking::ledger_of(alice).unwrap().staked_ring, 0); + assert_eq!(Staking::ledger_of(alice).unwrap().unstaking_ring.len(), 1); + + // restake + precompiles() + .prepare_test( + alice, + Precompile, + PCall::restake { + ring_amount: 200.into(), + kton_amount: U256::zero(), + deposits: vec![], + }, + ) + .execute_returns(EvmDataWriter::new().write(true).build()); + assert_eq!(Staking::ledger_of(alice).unwrap().staked_ring, 200); + assert_eq!(Staking::ledger_of(alice).unwrap().unstaking_ring.len(), 0); }); } From f720b561fb86b37ccb275431c760a9844c20000b Mon Sep 17 00:00:00 2001 From: bear Date: Mon, 9 Jan 2023 16:08:11 +0800 Subject: [PATCH 089/189] Add `Proxy` tests (#190) * Check key prefix * Add tests * Use `any` --- tool/state-processor/src/processor.rs | 4 ++++ tool/state-processor/src/proxy/mod.rs | 17 ++++++++++++----- tool/state-processor/src/tests.rs | 21 +++++++++++++++++++++ 3 files changed, 37 insertions(+), 5 deletions(-) diff --git a/tool/state-processor/src/processor.rs b/tool/state-processor/src/processor.rs index ad28ab8d8..eceff5a63 100644 --- a/tool/state-processor/src/processor.rs +++ b/tool/state-processor/src/processor.rs @@ -299,6 +299,10 @@ impl State { self.map.contains_key(key) } + pub fn starts_with(&self, key: &str) -> bool { + self.map.keys().into_iter().any(|k| k.starts_with(key)) + } + // pub fn inc_consumers(&mut self, who: &str) {} // pub fn transfer(&mut self, from: &str, to: &str, amount: u128) {} diff --git a/tool/state-processor/src/proxy/mod.rs b/tool/state-processor/src/proxy/mod.rs index e64ec7769..aa5a222d6 100644 --- a/tool/state-processor/src/proxy/mod.rs +++ b/tool/state-processor/src/proxy/mod.rs @@ -5,9 +5,14 @@ impl Processor { pub fn process_proxy(&mut self) -> &mut Self { // Storage items. // https://github.dev/darwinia-network/substrate/blob/darwinia-v0.12.5/frame/proxy/src/lib.rs#L599 - // Skip the `Announcements`. - // Need to make sure the storage is empty. - // + let announcements_key = item_key(b"Proxy", b"Announcements"); + if self.solo_state.starts_with(&announcements_key) { + log::error!("The solo chain `Proxy::Announcements` not empty"); + } + if self.para_state.starts_with(&announcements_key) { + log::error!("The para chain `Proxy::Announcements` not empty"); + } + // The size of encoded `pallet_proxy::ProxyDefinition` is 37 bytes. let mut proxies = , u128)>>::default(); @@ -21,8 +26,10 @@ impl Processor { self.shell_state.unreserve(array_bytes::hex2bytes_unchecked(get_last_64(&a)), v); }); - // Skip the parachain part. - // Need to make sure the storage is empty. + // Make sure the Proxy::Proxies storage of para chain is empty. + if self.para_state.starts_with(&item_key(b"Proxy", b"Proxies")) { + log::error!("The para chain `Proxy::Proxies` not empty"); + } self } diff --git a/tool/state-processor/src/tests.rs b/tool/state-processor/src/tests.rs index 071250ff7..bf38758c8 100644 --- a/tool/state-processor/src/tests.rs +++ b/tool/state-processor/src/tests.rs @@ -648,3 +648,24 @@ fn indices_adjust_substrate_account() { assert_eq!(migrated_account.data.reserved, (solo_account.data.reserved - index.1) * GWEI); }); } + +// --- Proxy --- + +#[test] +fn proxy_reserved_adjust() { + run_test(|tester| { + // https://crab.subscan.io/account/5EU6EEhZRbh1NQS7HRMwAogoBHWtT2eLFQWei2UZHUHJosHt + let test_addr = "0x6a4e6bef70a768785050414fcdf4d869debe5cb6336f8eeebe01f458ddbce409"; + + let solo_account = tester.solo_accounts.get(test_addr).unwrap(); + assert_ne!(solo_account.data.reserved, 0); + + // after migrated + let migrated_account = tester.migration_accounts.get(test_addr).unwrap(); + assert_eq!( + migrated_account.data.free, + (solo_account.data.free + solo_account.data.reserved) * GWEI + ); + assert_eq!(migrated_account.data.reserved, 0); + }); +} From f15a0bc992eb84483b15ec432e53e1b001d112fe Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Mon, 9 Jan 2023 18:33:39 +0800 Subject: [PATCH 090/189] Improve existing check (#191) * Improve existing check * Remove unused variable --- tool/state-processor/src/balances/mod.rs | 25 +++++++++--------------- tool/state-processor/src/processor.rs | 8 ++------ tool/state-processor/src/proxy/mod.rs | 15 +++++++------- 3 files changed, 18 insertions(+), 30 deletions(-) diff --git a/tool/state-processor/src/balances/mod.rs b/tool/state-processor/src/balances/mod.rs index 83328bdcb..996a85aef 100644 --- a/tool/state-processor/src/balances/mod.rs +++ b/tool/state-processor/src/balances/mod.rs @@ -12,7 +12,6 @@ impl Processor { let mut solo_kton_total_issuance = u128::default(); let mut solo_ring_locks = >::default(); let mut solo_kton_locks = >::default(); - let mut para_ring_locks = >::default(); let mut para_ring_total_issuance = u128::default(); log::info!("take solo `Balances::TotalIssuance`, `Kton::TotalIssuance`, `Balances::Locks` and `Kton::Locks`"); @@ -31,16 +30,16 @@ impl Processor { solo_kton_total_issuance.adjust(); log::info!("take para `Balances::TotalIssuance` and `Balances::Locks`"); - self.para_state - .take_value(b"Balances", b"TotalIssuance", "", &mut para_ring_total_issuance) - .take_map(b"Balances", b"Locks", &mut para_ring_locks, get_hashed_key); + self.para_state.take_value( + b"Balances", + b"TotalIssuance", + "", + &mut para_ring_total_issuance, + ); - log::info!("check solo ring locks, there should not be any `solo_ring_locks`"); - check_locks(solo_ring_locks); - log::info!("check solo kton locks, there should not be any `solo_kton_locks`"); - check_locks(solo_kton_locks); - log::info!("check para locks, there should not be any `para_ring_locks`"); - check_locks(para_ring_locks); + if self.para_state.exists(b"Balances", b"Locks") { + log::error!("check para `Balances::Locks`, it isn't empty"); + } (solo_ring_total_issuance + para_ring_total_issuance, solo_kton_total_issuance) } @@ -81,9 +80,3 @@ fn prune(locks: &mut Map) { !v.is_empty() }); } - -fn check_locks(locks: Map) { - locks - .into_iter() - .for_each(|(k, _)| log::error!("found unexpected locks of account({})", get_last_64(&k))); -} diff --git a/tool/state-processor/src/processor.rs b/tool/state-processor/src/processor.rs index eceff5a63..9a2bc782d 100644 --- a/tool/state-processor/src/processor.rs +++ b/tool/state-processor/src/processor.rs @@ -299,14 +299,10 @@ impl State { self.map.contains_key(key) } - pub fn starts_with(&self, key: &str) -> bool { - self.map.keys().into_iter().any(|k| k.starts_with(key)) + pub fn exists(&self, pallet: &[u8], item: &[u8]) -> bool { + self.map.keys().into_iter().any(|k| k.starts_with(&item_key(pallet, item))) } - // pub fn inc_consumers(&mut self, who: &str) {} - - // pub fn transfer(&mut self, from: &str, to: &str, amount: u128) {} - pub fn unreserve(&mut self, account_id_32: A, amount: u128) where A: AsRef<[u8]>, diff --git a/tool/state-processor/src/proxy/mod.rs b/tool/state-processor/src/proxy/mod.rs index aa5a222d6..080e6ed75 100644 --- a/tool/state-processor/src/proxy/mod.rs +++ b/tool/state-processor/src/proxy/mod.rs @@ -5,12 +5,11 @@ impl Processor { pub fn process_proxy(&mut self) -> &mut Self { // Storage items. // https://github.dev/darwinia-network/substrate/blob/darwinia-v0.12.5/frame/proxy/src/lib.rs#L599 - let announcements_key = item_key(b"Proxy", b"Announcements"); - if self.solo_state.starts_with(&announcements_key) { - log::error!("The solo chain `Proxy::Announcements` not empty"); + if self.solo_state.exists(b"Proxy", b"Announcements") { + log::error!("check solo `Proxy::Announcements`, it isn't empty"); } - if self.para_state.starts_with(&announcements_key) { - log::error!("The para chain `Proxy::Announcements` not empty"); + if self.para_state.exists(b"Proxy", b"Announcements") { + log::error!("check para `Proxy::Announcements`, it isn't empty"); } // The size of encoded `pallet_proxy::ProxyDefinition` is 37 bytes. @@ -26,9 +25,9 @@ impl Processor { self.shell_state.unreserve(array_bytes::hex2bytes_unchecked(get_last_64(&a)), v); }); - // Make sure the Proxy::Proxies storage of para chain is empty. - if self.para_state.starts_with(&item_key(b"Proxy", b"Proxies")) { - log::error!("The para chain `Proxy::Proxies` not empty"); + // Make sure the para `Proxy::Proxies` is empty. + if self.para_state.exists(b"Proxy", b"Proxies") { + log::error!("check para `Proxy::Proxies`, it isn't empty"); } self From b0686eec452a538c28dd16f77dad2d26a032c016 Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Tue, 10 Jan 2023 15:29:35 +0800 Subject: [PATCH 091/189] Modify testnet time (#192) * Improve tips * Clippy * Set testnet time to 5 mins --- pallet/ecdsa-authority/src/primitives.rs | 8 ++++---- runtime/crab/src/pallets/session.rs | 2 +- runtime/crab/src/pallets/staking.rs | 2 +- runtime/darwinia/src/pallets/session.rs | 2 +- runtime/darwinia/src/pallets/staking.rs | 2 +- runtime/pangolin/src/pallets/session.rs | 2 +- runtime/pangolin/src/pallets/staking.rs | 2 +- tool/state-processor/src/util.rs | 4 ++++ 8 files changed, 14 insertions(+), 10 deletions(-) diff --git a/pallet/ecdsa-authority/src/primitives.rs b/pallet/ecdsa-authority/src/primitives.rs index 0da3b7ab5..ad83e6b78 100644 --- a/pallet/ecdsa-authority/src/primitives.rs +++ b/pallet/ecdsa-authority/src/primitives.rs @@ -104,17 +104,17 @@ pub struct Commitment { #[test] fn eth_signable_message() { assert_eq!( - array_bytes::bytes2hex("0x", &Sign::eth_signable_message(46, b"Darwinia", &[0; 32])), + array_bytes::bytes2hex("0x", Sign::eth_signable_message(46, b"Darwinia", &[0; 32])), "0xb492857010088b0dff298645e9105549d088aab7bcb20cf5a3d0bc17dce91045" ); assert_eq!( - array_bytes::bytes2hex("0x", &Sign::hash(b"46Darwinia::ecdsa-authority")), + array_bytes::bytes2hex("0x", Sign::hash(b"46Darwinia::ecdsa-authority")), "0xf8a76f5ceeff36d74ff99c4efc0077bcc334721f17d1d5f17cfca78455967e1e" ); let data = array_bytes::hex2bytes_unchecked("0x30a82982a8d5050d1c83bbea574aea301a4d317840a8c4734a308ffaa6a63bc8cb76085b00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000100000000000000000000000068898db1012808808c903f390909c52d9f7067490000000000000000000000004cdc1dbbd754ea539f1ffaea91f1b6c4b8dd14bd"); assert_eq!( - array_bytes::bytes2hex("0x", &Sign::eth_signable_message(45, b"Pangoro", &data)), + array_bytes::bytes2hex("0x", Sign::eth_signable_message(45, b"Pangoro", &data)), "0x4bddffe492f1091c1902d1952fc4673b12915f4b22822c6c84eacad574f11f2e" ); @@ -134,7 +134,7 @@ fn eth_signable_message() { ethabi::Token::Uint(0.into()), ]); assert_eq!( - array_bytes::bytes2hex("0x", &Sign::eth_signable_message(45, b"Pangoro", &encoded)), + array_bytes::bytes2hex("0x", Sign::eth_signable_message(45, b"Pangoro", &encoded)), "0xe328aa10278425238407d49104ac5a55fd68e7f378b327c902d4d5035cfcfedf" ); } diff --git a/runtime/crab/src/pallets/session.rs b/runtime/crab/src/pallets/session.rs index b606487ec..7cdd2521f 100644 --- a/runtime/crab/src/pallets/session.rs +++ b/runtime/crab/src/pallets/session.rs @@ -25,7 +25,7 @@ sp_runtime::impl_opaque_keys! { } } -fast_runtime_or_not!(Period, ConstU32<{ 2 * MINUTES }>, ConstU32<{ 6 * HOURS }>); +fast_runtime_or_not!(Period, ConstU32<{ 5 * MINUTES }>, ConstU32<{ 6 * HOURS }>); type Offset = ConstU32<0>; diff --git a/runtime/crab/src/pallets/staking.rs b/runtime/crab/src/pallets/staking.rs index cd548aba7..7ac9221d0 100644 --- a/runtime/crab/src/pallets/staking.rs +++ b/runtime/crab/src/pallets/staking.rs @@ -19,7 +19,7 @@ // darwinia use crate::*; -fast_runtime_or_not!(MinStakingDuration, ConstU32, ConstU32<{ 14 * DAYS }>); +fast_runtime_or_not!(MinStakingDuration, ConstU32<{ 5 * MINUTES }>, ConstU32<{ 14 * DAYS }>); pub enum CrabStaking {} impl darwinia_staking::Stake for CrabStaking { diff --git a/runtime/darwinia/src/pallets/session.rs b/runtime/darwinia/src/pallets/session.rs index b606487ec..7cdd2521f 100644 --- a/runtime/darwinia/src/pallets/session.rs +++ b/runtime/darwinia/src/pallets/session.rs @@ -25,7 +25,7 @@ sp_runtime::impl_opaque_keys! { } } -fast_runtime_or_not!(Period, ConstU32<{ 2 * MINUTES }>, ConstU32<{ 6 * HOURS }>); +fast_runtime_or_not!(Period, ConstU32<{ 5 * MINUTES }>, ConstU32<{ 6 * HOURS }>); type Offset = ConstU32<0>; diff --git a/runtime/darwinia/src/pallets/staking.rs b/runtime/darwinia/src/pallets/staking.rs index f247cb021..cc1661eae 100644 --- a/runtime/darwinia/src/pallets/staking.rs +++ b/runtime/darwinia/src/pallets/staking.rs @@ -19,7 +19,7 @@ // darwinia use crate::*; -fast_runtime_or_not!(MinStakingDuration, ConstU32, ConstU32<{ 14 * DAYS }>); +fast_runtime_or_not!(MinStakingDuration, ConstU32<{ 5 * MINUTES }>, ConstU32<{ 14 * DAYS }>); pub enum RingStaking {} impl darwinia_staking::Stake for RingStaking { diff --git a/runtime/pangolin/src/pallets/session.rs b/runtime/pangolin/src/pallets/session.rs index b606487ec..7cdd2521f 100644 --- a/runtime/pangolin/src/pallets/session.rs +++ b/runtime/pangolin/src/pallets/session.rs @@ -25,7 +25,7 @@ sp_runtime::impl_opaque_keys! { } } -fast_runtime_or_not!(Period, ConstU32<{ 2 * MINUTES }>, ConstU32<{ 6 * HOURS }>); +fast_runtime_or_not!(Period, ConstU32<{ 5 * MINUTES }>, ConstU32<{ 6 * HOURS }>); type Offset = ConstU32<0>; diff --git a/runtime/pangolin/src/pallets/staking.rs b/runtime/pangolin/src/pallets/staking.rs index e78df2672..83e0ea7fa 100644 --- a/runtime/pangolin/src/pallets/staking.rs +++ b/runtime/pangolin/src/pallets/staking.rs @@ -19,7 +19,7 @@ // darwinia use crate::*; -fast_runtime_or_not!(MinStakingDuration, ConstU32, ConstU32<{ 14 * DAYS }>); +fast_runtime_or_not!(MinStakingDuration, ConstU32<{ 5 * MINUTES }>, ConstU32<{ 14 * DAYS }>); pub enum PRingStaking {} impl darwinia_staking::Stake for PRingStaking { diff --git a/tool/state-processor/src/util.rs b/tool/state-processor/src/util.rs index d99489209..7bed91667 100644 --- a/tool/state-processor/src/util.rs +++ b/tool/state-processor/src/util.rs @@ -69,6 +69,8 @@ pub fn is_evm_address(address: &[u8]) -> bool { } pub fn build_spec(chain: &str) -> Result<()> { + log::info!("build {chain} spec"); + let mut path = "../../target/release/darwinia"; if !Path::new(path).is_file() { @@ -90,6 +92,8 @@ pub fn build_spec(chain: &str) -> Result<()> { } pub fn download_specs(chain: &str) -> Result<()> { + log::info!("download {chain} spec"); + let decoder = Decoder::new( ureq::get(&format!( "https://github.com/darwinia-network/darwinia-2.0/releases/download/{chain}2/{chain}-state.tar.zst" From 756fcaff85b1ec9acd713344d1728107dd08552d Mon Sep 17 00:00:00 2001 From: bear Date: Wed, 11 Jan 2023 10:30:47 +0800 Subject: [PATCH 092/189] `account-migration` runtime tests (#169) * Add validate unsigned test * Add validation tests * Account migrate test * Fix redundant encode * Kton asset * prepare accounts * Remove migration * Pass tests * kton tests * Add staking test * Fix test * Staking test * Finish pangolin tests * Add crab and darwinia tests * Revert changes Co-authored-by: Xavier Lau --- pallet/account-migration/src/lib.rs | 23 +- runtime/crab/tests/account_migration.rs | 330 ++++++++++++++++++++ runtime/crab/tests/mock.rs | 65 ++++ runtime/darwinia/tests/account_migration.rs | 330 ++++++++++++++++++++ runtime/darwinia/tests/mock.rs | 65 ++++ runtime/pangolin/tests/account_migration.rs | 330 ++++++++++++++++++++ runtime/pangolin/tests/mock.rs | 65 ++++ 7 files changed, 1200 insertions(+), 8 deletions(-) create mode 100644 runtime/crab/tests/account_migration.rs create mode 100644 runtime/crab/tests/mock.rs create mode 100644 runtime/darwinia/tests/account_migration.rs create mode 100644 runtime/darwinia/tests/mock.rs create mode 100644 runtime/pangolin/tests/account_migration.rs create mode 100644 runtime/pangolin/tests/mock.rs diff --git a/pallet/account-migration/src/lib.rs b/pallet/account-migration/src/lib.rs index f39b1cf51..b44464923 100644 --- a/pallet/account-migration/src/lib.rs +++ b/pallet/account-migration/src/lib.rs @@ -69,6 +69,7 @@ use sp_runtime::{ use sp_std::prelude::*; type Message = [u8; 32]; +const KTON_ID: u64 = 1026; #[frame_support::pallet] pub mod pallet { @@ -174,7 +175,7 @@ pub mod pallet { b"Assets", b"Account", &[ - Blake2_128Concat::hash(&1026_u64.encode()), + Blake2_128Concat::hash(&KTON_ID.encode()), Blake2_128Concat::hash(&to.encode()), ] .concat(), @@ -210,19 +211,25 @@ pub mod pallet { } let staking_pot = darwinia_staking::account_id(); - as Currency<_>>::transfer( &to, &staking_pot, l.staked_ring + l.unstaking_ring.iter().map(|(r, _)| r).sum::(), KeepAlive, )?; - >::transfer( - RawOrigin::Signed(to).into(), - 1026_u64, - staking_pot, - l.staked_kton + l.unstaking_kton.iter().map(|(k, _)| k).sum::(), - )?; + + let sum = l.staked_kton + l.unstaking_kton.iter().map(|(k, _)| k).sum::(); + if let Some(amount) = >::maybe_balance(KTON_ID, to) { + if amount >= sum { + >::transfer( + RawOrigin::Signed(to).into(), + KTON_ID, + staking_pot, + sum, + )?; + } + } + >::insert(to, l); } diff --git a/runtime/crab/tests/account_migration.rs b/runtime/crab/tests/account_migration.rs new file mode 100644 index 000000000..3e76afa91 --- /dev/null +++ b/runtime/crab/tests/account_migration.rs @@ -0,0 +1,330 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +#![cfg(test)] + +mod mock; +use mock::*; + +// darwinia +use crab_runtime::*; +use darwinia_deposit::Deposit; +use darwinia_staking::Ledger; +use dc_primitives::AccountId; +// substrate +use frame_support::{ + assert_err, assert_ok, migration, traits::Get, Blake2_128Concat, StorageHasher, +}; +use frame_system::AccountInfo; +use pallet_assets::ExistenceReason; +use pallet_balances::AccountData; +use sp_core::{sr25519::Pair, Encode, Pair as PairT, H160}; +use sp_io::hashing::blake2_256; +use sp_runtime::{ + traits::ValidateUnsigned, + transaction_validity::{InvalidTransaction, TransactionValidityError}, + AccountId32, DispatchError, DispatchResult, +}; +use sp_version::RuntimeVersion; + +const RING_AMOUNT: u128 = 100; +const KTON_AMOUNT: u128 = 100; + +fn migrate(pair: Pair, to: AccountId, chain_id: u64, spec_name: &[u8]) -> DispatchResult { + let account_id = AccountId32::new(pair.public().0); + + let message = blake2_256( + &[ + &blake2_256(&[&chain_id.to_le_bytes(), spec_name, b"::account-migration"].concat()), + to.0.as_slice(), + ] + .concat(), + ); + let sig = pair.sign(&message); + + AccountMigration::pre_dispatch(&darwinia_account_migration::Call::migrate { + from: account_id.clone(), + to, + signature: sig.clone(), + }) + .map_err(|e| match e { + TransactionValidityError::Invalid(InvalidTransaction::Custom(e)) => + Box::leak(format!("err code: {}", e).into_boxed_str()), + e => <&'static str>::from(e), + })?; + AccountMigration::migrate(RuntimeOrigin::none(), account_id, to, sig) +} + +fn prepare_accounts(storage: bool) -> Pair { + let pair = Pair::from_seed(b"00000000000000000000000000000001"); + let account_id = AccountId32::new(pair.public().0); + + if storage { + >::insert( + account_id.clone(), + AccountInfo { + nonce: 100, + consumers: 1, + providers: 1, + sufficients: 1, + data: AccountData { free: RING_AMOUNT, ..Default::default() }, + }, + ); + + // The struct in the upstream repo is not accessible due to viable. + #[derive(Clone, Encode)] + pub struct AssetAccount { + pub balance: u128, + pub is_frozen: bool, + pub reason: ExistenceReason, + pub extra: (), + } + let asset_account = AssetAccount { + balance: KTON_AMOUNT, + is_frozen: false, + reason: ExistenceReason::::Sufficient, + extra: (), + }; + migration::put_storage_value( + b"AccountMigration", + b"KtonAccounts", + &Blake2_128Concat::hash(account_id.as_ref()), + asset_account.clone(), + ); + assert!(AccountMigration::account_of(account_id).is_some()); + } + pair +} + +#[test] +fn validate_substrate_account_not_found() { + ExtBuilder::default().build().execute_with(|| { + let to = H160::default(); + let pair = prepare_accounts(false); + + assert_err!( + migrate( + pair, + to.into(), + <::ChainId as Get>::get(), + <::Version as Get>::get() + .spec_name + .as_bytes() + ), + DispatchError::Other("err code: 1") // The migration source not exist. + ); + }); +} + +#[test] +fn validate_evm_account_already_exist() { + let to = H160::from_low_u64_be(33).into(); + ExtBuilder::default().with_balances(vec![(to, 100)]).build().execute_with(|| { + let pair = prepare_accounts(true); + + assert_err!( + migrate( + pair, + to, + <::ChainId as Get>::get(), + <::Version as Get>::get() + .spec_name + .as_bytes() + ), + DispatchError::Other("err code: 0") // To account has been used. + ); + }); +} + +#[test] +fn validate_invalid_sig() { + let to = H160::from_low_u64_be(33).into(); + ExtBuilder::default().build().execute_with(|| { + let pair = prepare_accounts(true); + + assert_err!( + migrate( + pair, + to, + <::ChainId as Get>::get() + 1, + <::Version as Get>::get() + .spec_name + .as_bytes() + ), + DispatchError::Other("err code: 2") // Invalid signature + ); + }); +} + +#[test] +fn migrate_accounts() { + let to = H160::from_low_u64_be(255).into(); + ExtBuilder::default().build().execute_with(|| { + let pair = prepare_accounts(true); + let account_id = AccountId32::new(pair.public().0); + + assert_ok!(migrate( + pair, + to, + <::ChainId as Get>::get(), + <::Version as Get>::get() + .spec_name + .as_bytes() + )); + assert_eq!(AccountMigration::account_of(account_id), None); + assert_eq!( + System::account(to), + AccountInfo { + nonce: 100, + consumers: 1, + providers: 1, + sufficients: 1, + data: AccountData { free: 100, ..Default::default() }, + } + ); + }); +} + +#[test] +fn migrate_kton_accounts() { + let to = H160::from_low_u64_be(255).into(); + ExtBuilder::default().build().execute_with(|| { + let pair = prepare_accounts(true); + let account_id = AccountId32::new(pair.public().0); + + assert_ok!(migrate( + pair, + to, + <::ChainId as Get>::get(), + <::Version as Get>::get() + .spec_name + .as_bytes() + )); + assert_eq!(AccountMigration::kton_account_of(account_id), None); + assert_eq!(Assets::maybe_balance(KTON_ID, to).unwrap(), KTON_AMOUNT); + }); +} + +#[test] +fn vesting() { + let to = H160::from_low_u64_be(255).into(); + ExtBuilder::default().build().execute_with(|| { + let pair = prepare_accounts(true); + let account_id = AccountId32::new(pair.public().0); + + // The struct in the upstream repo is not accessible due to viable. + #[derive(Encode)] + pub struct VestingInfo { + locked: u128, + per_block: u128, + starting_block: u32, + } + + migration::put_storage_value( + b"AccountMigration", + b"Vestings", + &Blake2_128Concat::hash(account_id.as_ref()), + vec![ + VestingInfo { locked: 100, per_block: 5, starting_block: 0 }, + VestingInfo { locked: 100, per_block: 5, starting_block: 0 }, + ], + ); + + assert_ok!(migrate( + pair, + to, + <::ChainId as Get>::get(), + <::Version as Get>::get() + .spec_name + .as_bytes() + )); + + assert_eq!(Vesting::vesting(to).unwrap().len(), 2); + assert_eq!(Balances::locks(to).len(), 1); + }); +} + +#[test] +fn staking() { + let init = H160::from_low_u64_be(254).into(); + let to = H160::from_low_u64_be(255).into(); + ExtBuilder::default() + .with_assets_accounts(vec![(KTON_ID, init, KTON_AMOUNT)]) + .build() + .execute_with(|| { + let pair = prepare_accounts(true); + let account_id = AccountId32::new(pair.public().0); + + >::insert( + account_id.clone(), + vec![ + Deposit { + id: 1, + value: 10, + start_time: 1000, + expired_time: 2000, + in_use: true, + }, + Deposit { + id: 2, + value: 10, + start_time: 1000, + expired_time: 2000, + in_use: true, + }, + ], + ); + + >::insert( + account_id.clone(), + Ledger { + staked_ring: 20, + staked_kton: 20, + staked_deposits: vec![].try_into().unwrap(), + unstaking_ring: vec![].try_into().unwrap(), + unstaking_kton: vec![].try_into().unwrap(), + unstaking_deposits: vec![].try_into().unwrap(), + }, + ); + + assert_ok!(migrate( + pair, + to, + <::ChainId as Get>::get(), + <::Version as Get>::get() + .spec_name + .as_bytes() + )); + + assert_eq!(Balances::free_balance(to), 60); + assert_eq!(Balances::free_balance(&darwinia_deposit::account_id::()), 20); + assert_eq!(Balances::free_balance(&darwinia_staking::account_id::()), 20); + + assert_eq!(crab_runtime::Deposit::deposit_of(to).unwrap().len(), 2); + + assert_eq!(Assets::maybe_balance(KTON_ID, to).unwrap(), 80); + assert_eq!( + Assets::maybe_balance(KTON_ID, darwinia_staking::account_id::()) + .unwrap(), + 20 + ); + + assert_eq!(crab_runtime::Staking::ledger_of(to).unwrap().staked_ring, 20); + assert_eq!(crab_runtime::Staking::ledger_of(to).unwrap().staked_kton, 20); + }); +} diff --git a/runtime/crab/tests/mock.rs b/runtime/crab/tests/mock.rs new file mode 100644 index 000000000..b67b64fa4 --- /dev/null +++ b/runtime/crab/tests/mock.rs @@ -0,0 +1,65 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crab_runtime::{Runtime, System}; +use darwinia_common_runtime::gov_origin::ROOT; +use dc_primitives::{AccountId, Balance}; +// parity +use frame_support::traits::GenesisBuild; +use sp_io::TestExternalities; + +pub(crate) const KTON_ID: u64 = 1026; + +#[derive(Default, Clone)] +pub struct ExtBuilder { + balances: Vec<(AccountId, Balance)>, + assets_accounts: Vec<(u64, AccountId, Balance)>, +} + +impl ExtBuilder { + pub fn build(&mut self) -> TestExternalities { + let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); + + pallet_balances::GenesisConfig:: { balances: self.balances.clone() } + .assimilate_storage(&mut t) + .unwrap(); + + pallet_assets::GenesisConfig:: { + assets: vec![(KTON_ID, ROOT, true, 1)], + metadata: vec![(KTON_ID, b"Test Commitment Token".to_vec(), b"TKTON".to_vec(), 18)], + accounts: self.assets_accounts.clone(), + } + .assimilate_storage(&mut t) + .unwrap(); + + let mut ext = TestExternalities::new(t); + ext.execute_with(|| System::set_block_number(1)); + ext + } + + pub fn with_balances(&mut self, balances: Vec<(AccountId, Balance)>) -> &mut Self { + self.balances = balances; + self + } + + pub fn with_assets_accounts(&mut self, accounts: Vec<(u64, AccountId, Balance)>) -> &mut Self { + self.assets_accounts = accounts; + self + } +} diff --git a/runtime/darwinia/tests/account_migration.rs b/runtime/darwinia/tests/account_migration.rs new file mode 100644 index 000000000..603f5e4d3 --- /dev/null +++ b/runtime/darwinia/tests/account_migration.rs @@ -0,0 +1,330 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +#![cfg(test)] + +mod mock; +use mock::*; + +// darwinia +use darwinia_deposit::Deposit; +use darwinia_runtime::*; +use darwinia_staking::Ledger; +use dc_primitives::AccountId; +// substrate +use frame_support::{ + assert_err, assert_ok, migration, traits::Get, Blake2_128Concat, StorageHasher, +}; +use frame_system::AccountInfo; +use pallet_assets::ExistenceReason; +use pallet_balances::AccountData; +use sp_core::{sr25519::Pair, Encode, Pair as PairT, H160}; +use sp_io::hashing::blake2_256; +use sp_runtime::{ + traits::ValidateUnsigned, + transaction_validity::{InvalidTransaction, TransactionValidityError}, + AccountId32, DispatchError, DispatchResult, +}; +use sp_version::RuntimeVersion; + +const RING_AMOUNT: u128 = 100; +const KTON_AMOUNT: u128 = 100; + +fn migrate(pair: Pair, to: AccountId, chain_id: u64, spec_name: &[u8]) -> DispatchResult { + let account_id = AccountId32::new(pair.public().0); + + let message = blake2_256( + &[ + &blake2_256(&[&chain_id.to_le_bytes(), spec_name, b"::account-migration"].concat()), + to.0.as_slice(), + ] + .concat(), + ); + let sig = pair.sign(&message); + + AccountMigration::pre_dispatch(&darwinia_account_migration::Call::migrate { + from: account_id.clone(), + to, + signature: sig.clone(), + }) + .map_err(|e| match e { + TransactionValidityError::Invalid(InvalidTransaction::Custom(e)) => + Box::leak(format!("err code: {}", e).into_boxed_str()), + e => <&'static str>::from(e), + })?; + AccountMigration::migrate(RuntimeOrigin::none(), account_id, to, sig) +} + +fn prepare_accounts(storage: bool) -> Pair { + let pair = Pair::from_seed(b"00000000000000000000000000000001"); + let account_id = AccountId32::new(pair.public().0); + + if storage { + >::insert( + account_id.clone(), + AccountInfo { + nonce: 100, + consumers: 1, + providers: 1, + sufficients: 1, + data: AccountData { free: RING_AMOUNT, ..Default::default() }, + }, + ); + + // The struct in the upstream repo is not accessible due to viable. + #[derive(Clone, Encode)] + pub struct AssetAccount { + pub balance: u128, + pub is_frozen: bool, + pub reason: ExistenceReason, + pub extra: (), + } + let asset_account = AssetAccount { + balance: KTON_AMOUNT, + is_frozen: false, + reason: ExistenceReason::::Sufficient, + extra: (), + }; + migration::put_storage_value( + b"AccountMigration", + b"KtonAccounts", + &Blake2_128Concat::hash(account_id.as_ref()), + asset_account.clone(), + ); + assert!(AccountMigration::account_of(account_id).is_some()); + } + pair +} + +#[test] +fn validate_substrate_account_not_found() { + ExtBuilder::default().build().execute_with(|| { + let to = H160::default(); + let pair = prepare_accounts(false); + + assert_err!( + migrate( + pair, + to.into(), + <::ChainId as Get>::get(), + <::Version as Get>::get() + .spec_name + .as_bytes() + ), + DispatchError::Other("err code: 1") // The migration source not exist. + ); + }); +} + +#[test] +fn validate_evm_account_already_exist() { + let to = H160::from_low_u64_be(33).into(); + ExtBuilder::default().with_balances(vec![(to, 100)]).build().execute_with(|| { + let pair = prepare_accounts(true); + + assert_err!( + migrate( + pair, + to, + <::ChainId as Get>::get(), + <::Version as Get>::get() + .spec_name + .as_bytes() + ), + DispatchError::Other("err code: 0") // To account has been used. + ); + }); +} + +#[test] +fn validate_invalid_sig() { + let to = H160::from_low_u64_be(33).into(); + ExtBuilder::default().build().execute_with(|| { + let pair = prepare_accounts(true); + + assert_err!( + migrate( + pair, + to, + <::ChainId as Get>::get() + 1, + <::Version as Get>::get() + .spec_name + .as_bytes() + ), + DispatchError::Other("err code: 2") // Invalid signature + ); + }); +} + +#[test] +fn migrate_accounts() { + let to = H160::from_low_u64_be(255).into(); + ExtBuilder::default().build().execute_with(|| { + let pair = prepare_accounts(true); + let account_id = AccountId32::new(pair.public().0); + + assert_ok!(migrate( + pair, + to, + <::ChainId as Get>::get(), + <::Version as Get>::get() + .spec_name + .as_bytes() + )); + assert_eq!(AccountMigration::account_of(account_id), None); + assert_eq!( + System::account(to), + AccountInfo { + nonce: 100, + consumers: 1, + providers: 1, + sufficients: 1, + data: AccountData { free: 100, ..Default::default() }, + } + ); + }); +} + +#[test] +fn migrate_kton_accounts() { + let to = H160::from_low_u64_be(255).into(); + ExtBuilder::default().build().execute_with(|| { + let pair = prepare_accounts(true); + let account_id = AccountId32::new(pair.public().0); + + assert_ok!(migrate( + pair, + to, + <::ChainId as Get>::get(), + <::Version as Get>::get() + .spec_name + .as_bytes() + )); + assert_eq!(AccountMigration::kton_account_of(account_id), None); + assert_eq!(Assets::maybe_balance(KTON_ID, to).unwrap(), KTON_AMOUNT); + }); +} + +#[test] +fn vesting() { + let to = H160::from_low_u64_be(255).into(); + ExtBuilder::default().build().execute_with(|| { + let pair = prepare_accounts(true); + let account_id = AccountId32::new(pair.public().0); + + // The struct in the upstream repo is not accessible due to viable. + #[derive(Encode)] + pub struct VestingInfo { + locked: u128, + per_block: u128, + starting_block: u32, + } + + migration::put_storage_value( + b"AccountMigration", + b"Vestings", + &Blake2_128Concat::hash(account_id.as_ref()), + vec![ + VestingInfo { locked: 100, per_block: 5, starting_block: 0 }, + VestingInfo { locked: 100, per_block: 5, starting_block: 0 }, + ], + ); + + assert_ok!(migrate( + pair, + to, + <::ChainId as Get>::get(), + <::Version as Get>::get() + .spec_name + .as_bytes() + )); + + assert_eq!(Vesting::vesting(to).unwrap().len(), 2); + assert_eq!(Balances::locks(to).len(), 1); + }); +} + +#[test] +fn staking() { + let init = H160::from_low_u64_be(254).into(); + let to = H160::from_low_u64_be(255).into(); + ExtBuilder::default() + .with_assets_accounts(vec![(KTON_ID, init, KTON_AMOUNT)]) + .build() + .execute_with(|| { + let pair = prepare_accounts(true); + let account_id = AccountId32::new(pair.public().0); + + >::insert( + account_id.clone(), + vec![ + Deposit { + id: 1, + value: 10, + start_time: 1000, + expired_time: 2000, + in_use: true, + }, + Deposit { + id: 2, + value: 10, + start_time: 1000, + expired_time: 2000, + in_use: true, + }, + ], + ); + + >::insert( + account_id.clone(), + Ledger { + staked_ring: 20, + staked_kton: 20, + staked_deposits: vec![].try_into().unwrap(), + unstaking_ring: vec![].try_into().unwrap(), + unstaking_kton: vec![].try_into().unwrap(), + unstaking_deposits: vec![].try_into().unwrap(), + }, + ); + + assert_ok!(migrate( + pair, + to, + <::ChainId as Get>::get(), + <::Version as Get>::get() + .spec_name + .as_bytes() + )); + + assert_eq!(Balances::free_balance(to), 60); + assert_eq!(Balances::free_balance(&darwinia_deposit::account_id::()), 20); + assert_eq!(Balances::free_balance(&darwinia_staking::account_id::()), 20); + + assert_eq!(darwinia_runtime::Deposit::deposit_of(to).unwrap().len(), 2); + + assert_eq!(Assets::maybe_balance(KTON_ID, to).unwrap(), 80); + assert_eq!( + Assets::maybe_balance(KTON_ID, darwinia_staking::account_id::()) + .unwrap(), + 20 + ); + + assert_eq!(darwinia_runtime::Staking::ledger_of(to).unwrap().staked_ring, 20); + assert_eq!(darwinia_runtime::Staking::ledger_of(to).unwrap().staked_kton, 20); + }); +} diff --git a/runtime/darwinia/tests/mock.rs b/runtime/darwinia/tests/mock.rs new file mode 100644 index 000000000..9b2503ae0 --- /dev/null +++ b/runtime/darwinia/tests/mock.rs @@ -0,0 +1,65 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use darwinia_common_runtime::gov_origin::ROOT; +use darwinia_runtime::{Runtime, System}; +use dc_primitives::{AccountId, Balance}; +// parity +use frame_support::traits::GenesisBuild; +use sp_io::TestExternalities; + +pub(crate) const KTON_ID: u64 = 1026; + +#[derive(Default, Clone)] +pub struct ExtBuilder { + balances: Vec<(AccountId, Balance)>, + assets_accounts: Vec<(u64, AccountId, Balance)>, +} + +impl ExtBuilder { + pub fn build(&mut self) -> TestExternalities { + let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); + + pallet_balances::GenesisConfig:: { balances: self.balances.clone() } + .assimilate_storage(&mut t) + .unwrap(); + + pallet_assets::GenesisConfig:: { + assets: vec![(KTON_ID, ROOT, true, 1)], + metadata: vec![(KTON_ID, b"Test Commitment Token".to_vec(), b"TKTON".to_vec(), 18)], + accounts: self.assets_accounts.clone(), + } + .assimilate_storage(&mut t) + .unwrap(); + + let mut ext = TestExternalities::new(t); + ext.execute_with(|| System::set_block_number(1)); + ext + } + + pub fn with_balances(&mut self, balances: Vec<(AccountId, Balance)>) -> &mut Self { + self.balances = balances; + self + } + + pub fn with_assets_accounts(&mut self, accounts: Vec<(u64, AccountId, Balance)>) -> &mut Self { + self.assets_accounts = accounts; + self + } +} diff --git a/runtime/pangolin/tests/account_migration.rs b/runtime/pangolin/tests/account_migration.rs new file mode 100644 index 000000000..5edf31de6 --- /dev/null +++ b/runtime/pangolin/tests/account_migration.rs @@ -0,0 +1,330 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +#![cfg(test)] + +mod mock; +use mock::*; + +// darwinia +use darwinia_deposit::Deposit; +use darwinia_staking::Ledger; +use dc_primitives::AccountId; +use pangolin_runtime::*; +// substrate +use frame_support::{ + assert_err, assert_ok, migration, traits::Get, Blake2_128Concat, StorageHasher, +}; +use frame_system::AccountInfo; +use pallet_assets::ExistenceReason; +use pallet_balances::AccountData; +use sp_core::{sr25519::Pair, Encode, Pair as PairT, H160}; +use sp_io::hashing::blake2_256; +use sp_runtime::{ + traits::ValidateUnsigned, + transaction_validity::{InvalidTransaction, TransactionValidityError}, + AccountId32, DispatchError, DispatchResult, +}; +use sp_version::RuntimeVersion; + +const RING_AMOUNT: u128 = 100; +const KTON_AMOUNT: u128 = 100; + +fn migrate(pair: Pair, to: AccountId, chain_id: u64, spec_name: &[u8]) -> DispatchResult { + let account_id = AccountId32::new(pair.public().0); + + let message = blake2_256( + &[ + &blake2_256(&[&chain_id.to_le_bytes(), spec_name, b"::account-migration"].concat()), + to.0.as_slice(), + ] + .concat(), + ); + let sig = pair.sign(&message); + + AccountMigration::pre_dispatch(&darwinia_account_migration::Call::migrate { + from: account_id.clone(), + to, + signature: sig.clone(), + }) + .map_err(|e| match e { + TransactionValidityError::Invalid(InvalidTransaction::Custom(e)) => + Box::leak(format!("err code: {}", e).into_boxed_str()), + e => <&'static str>::from(e), + })?; + AccountMigration::migrate(RuntimeOrigin::none(), account_id, to, sig) +} + +fn prepare_accounts(storage: bool) -> Pair { + let pair = Pair::from_seed(b"00000000000000000000000000000001"); + let account_id = AccountId32::new(pair.public().0); + + if storage { + >::insert( + account_id.clone(), + AccountInfo { + nonce: 100, + consumers: 1, + providers: 1, + sufficients: 1, + data: AccountData { free: RING_AMOUNT, ..Default::default() }, + }, + ); + + // The struct in the upstream repo is not accessible due to viable. + #[derive(Clone, Encode)] + pub struct AssetAccount { + pub balance: u128, + pub is_frozen: bool, + pub reason: ExistenceReason, + pub extra: (), + } + let asset_account = AssetAccount { + balance: KTON_AMOUNT, + is_frozen: false, + reason: ExistenceReason::::Sufficient, + extra: (), + }; + migration::put_storage_value( + b"AccountMigration", + b"KtonAccounts", + &Blake2_128Concat::hash(account_id.as_ref()), + asset_account.clone(), + ); + assert!(AccountMigration::account_of(account_id).is_some()); + } + pair +} + +#[test] +fn validate_substrate_account_not_found() { + ExtBuilder::default().build().execute_with(|| { + let to = H160::default(); + let pair = prepare_accounts(false); + + assert_err!( + migrate( + pair, + to.into(), + <::ChainId as Get>::get(), + <::Version as Get>::get() + .spec_name + .as_bytes() + ), + DispatchError::Other("err code: 1") // The migration source not exist. + ); + }); +} + +#[test] +fn validate_evm_account_already_exist() { + let to = H160::from_low_u64_be(33).into(); + ExtBuilder::default().with_balances(vec![(to, 100)]).build().execute_with(|| { + let pair = prepare_accounts(true); + + assert_err!( + migrate( + pair, + to, + <::ChainId as Get>::get(), + <::Version as Get>::get() + .spec_name + .as_bytes() + ), + DispatchError::Other("err code: 0") // To account has been used. + ); + }); +} + +#[test] +fn validate_invalid_sig() { + let to = H160::from_low_u64_be(33).into(); + ExtBuilder::default().build().execute_with(|| { + let pair = prepare_accounts(true); + + assert_err!( + migrate( + pair, + to, + <::ChainId as Get>::get() + 1, + <::Version as Get>::get() + .spec_name + .as_bytes() + ), + DispatchError::Other("err code: 2") // Invalid signature + ); + }); +} + +#[test] +fn migrate_accounts() { + let to = H160::from_low_u64_be(255).into(); + ExtBuilder::default().build().execute_with(|| { + let pair = prepare_accounts(true); + let account_id = AccountId32::new(pair.public().0); + + assert_ok!(migrate( + pair, + to, + <::ChainId as Get>::get(), + <::Version as Get>::get() + .spec_name + .as_bytes() + )); + assert_eq!(AccountMigration::account_of(account_id), None); + assert_eq!( + System::account(to), + AccountInfo { + nonce: 100, + consumers: 1, + providers: 1, + sufficients: 1, + data: AccountData { free: 100, ..Default::default() }, + } + ); + }); +} + +#[test] +fn migrate_kton_accounts() { + let to = H160::from_low_u64_be(255).into(); + ExtBuilder::default().build().execute_with(|| { + let pair = prepare_accounts(true); + let account_id = AccountId32::new(pair.public().0); + + assert_ok!(migrate( + pair, + to, + <::ChainId as Get>::get(), + <::Version as Get>::get() + .spec_name + .as_bytes() + )); + assert_eq!(AccountMigration::kton_account_of(account_id), None); + assert_eq!(Assets::maybe_balance(KTON_ID, to).unwrap(), KTON_AMOUNT); + }); +} + +#[test] +fn vesting() { + let to = H160::from_low_u64_be(255).into(); + ExtBuilder::default().build().execute_with(|| { + let pair = prepare_accounts(true); + let account_id = AccountId32::new(pair.public().0); + + // The struct in the upstream repo is not accessible due to viable. + #[derive(Encode)] + pub struct VestingInfo { + locked: u128, + per_block: u128, + starting_block: u32, + } + + migration::put_storage_value( + b"AccountMigration", + b"Vestings", + &Blake2_128Concat::hash(account_id.as_ref()), + vec![ + VestingInfo { locked: 100, per_block: 5, starting_block: 0 }, + VestingInfo { locked: 100, per_block: 5, starting_block: 0 }, + ], + ); + + assert_ok!(migrate( + pair, + to, + <::ChainId as Get>::get(), + <::Version as Get>::get() + .spec_name + .as_bytes() + )); + + assert_eq!(Vesting::vesting(to).unwrap().len(), 2); + assert_eq!(Balances::locks(to).len(), 1); + }); +} + +#[test] +fn staking() { + let init = H160::from_low_u64_be(254).into(); + let to = H160::from_low_u64_be(255).into(); + ExtBuilder::default() + .with_assets_accounts(vec![(KTON_ID, init, KTON_AMOUNT)]) + .build() + .execute_with(|| { + let pair = prepare_accounts(true); + let account_id = AccountId32::new(pair.public().0); + + >::insert( + account_id.clone(), + vec![ + Deposit { + id: 1, + value: 10, + start_time: 1000, + expired_time: 2000, + in_use: true, + }, + Deposit { + id: 2, + value: 10, + start_time: 1000, + expired_time: 2000, + in_use: true, + }, + ], + ); + + >::insert( + account_id.clone(), + Ledger { + staked_ring: 20, + staked_kton: 20, + staked_deposits: vec![].try_into().unwrap(), + unstaking_ring: vec![].try_into().unwrap(), + unstaking_kton: vec![].try_into().unwrap(), + unstaking_deposits: vec![].try_into().unwrap(), + }, + ); + + assert_ok!(migrate( + pair, + to, + <::ChainId as Get>::get(), + <::Version as Get>::get() + .spec_name + .as_bytes() + )); + + assert_eq!(Balances::free_balance(to), 60); + assert_eq!(Balances::free_balance(&darwinia_deposit::account_id::()), 20); + assert_eq!(Balances::free_balance(&darwinia_staking::account_id::()), 20); + + assert_eq!(pangolin_runtime::Deposit::deposit_of(to).unwrap().len(), 2); + + assert_eq!(Assets::maybe_balance(KTON_ID, to).unwrap(), 80); + assert_eq!( + Assets::maybe_balance(KTON_ID, darwinia_staking::account_id::()) + .unwrap(), + 20 + ); + + assert_eq!(pangolin_runtime::Staking::ledger_of(to).unwrap().staked_ring, 20); + assert_eq!(pangolin_runtime::Staking::ledger_of(to).unwrap().staked_kton, 20); + }); +} diff --git a/runtime/pangolin/tests/mock.rs b/runtime/pangolin/tests/mock.rs new file mode 100644 index 000000000..bf14d351e --- /dev/null +++ b/runtime/pangolin/tests/mock.rs @@ -0,0 +1,65 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use darwinia_common_runtime::gov_origin::ROOT; +use dc_primitives::{AccountId, Balance}; +use pangolin_runtime::{Runtime, System}; +// parity +use frame_support::traits::GenesisBuild; +use sp_io::TestExternalities; + +pub(crate) const KTON_ID: u64 = 1026; + +#[derive(Default, Clone)] +pub struct ExtBuilder { + balances: Vec<(AccountId, Balance)>, + assets_accounts: Vec<(u64, AccountId, Balance)>, +} + +impl ExtBuilder { + pub fn build(&mut self) -> TestExternalities { + let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); + + pallet_balances::GenesisConfig:: { balances: self.balances.clone() } + .assimilate_storage(&mut t) + .unwrap(); + + pallet_assets::GenesisConfig:: { + assets: vec![(KTON_ID, ROOT, true, 1)], + metadata: vec![(KTON_ID, b"Test Commitment Token".to_vec(), b"TKTON".to_vec(), 18)], + accounts: self.assets_accounts.clone(), + } + .assimilate_storage(&mut t) + .unwrap(); + + let mut ext = TestExternalities::new(t); + ext.execute_with(|| System::set_block_number(1)); + ext + } + + pub fn with_balances(&mut self, balances: Vec<(AccountId, Balance)>) -> &mut Self { + self.balances = balances; + self + } + + pub fn with_assets_accounts(&mut self, accounts: Vec<(u64, AccountId, Balance)>) -> &mut Self { + self.assets_accounts = accounts; + self + } +} From db360811ff1c160676e9c8e16dc75a729235f8bf Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Wed, 11 Jan 2023 15:58:56 +0800 Subject: [PATCH 093/189] Human readable sign message (#195) * Human readable sign message * Update spec --- Cargo.lock | 1 - pallet/account-migration/Cargo.toml | 2 - pallet/account-migration/src/lib.rs | 44 +++++++------------ pallet/account-migration/src/tests.rs | 35 +++++---------- runtime/crab/src/pallets/account_migration.rs | 1 - .../darwinia/src/pallets/account_migration.rs | 1 - .../pangolin/src/pallets/account_migration.rs | 1 - 7 files changed, 28 insertions(+), 57 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c13c49a45..0e1ae127f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2316,7 +2316,6 @@ dependencies = [ "parity-scale-codec", "scale-info", "sp-core", - "sp-io", "sp-keyring", "sp-runtime", "sp-std", diff --git a/pallet/account-migration/Cargo.toml b/pallet/account-migration/Cargo.toml index db1b78f78..3ad71d51a 100644 --- a/pallet/account-migration/Cargo.toml +++ b/pallet/account-migration/Cargo.toml @@ -26,7 +26,6 @@ pallet-assets = { default-features = false, git = "https://github.com/parityte pallet-balances = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } pallet-vesting = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-io = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } @@ -52,7 +51,6 @@ std = [ "pallet-balances/std", "pallet-vesting/std", "sp-core/std", - "sp-io/std", "sp-runtime/std", "sp-std/std", ] diff --git a/pallet/account-migration/src/lib.rs b/pallet/account-migration/src/lib.rs index b44464923..dccfd7988 100644 --- a/pallet/account-migration/src/lib.rs +++ b/pallet/account-migration/src/lib.rs @@ -61,20 +61,18 @@ use frame_system::{pallet_prelude::*, AccountInfo, RawOrigin}; use pallet_balances::AccountData; use pallet_vesting::VestingInfo; use sp_core::sr25519::{Public, Signature}; -use sp_io::hashing; use sp_runtime::{ traits::{IdentityLookup, Verify}, AccountId32, }; use sp_std::prelude::*; -type Message = [u8; 32]; -const KTON_ID: u64 = 1026; - #[frame_support::pallet] pub mod pallet { use super::*; + const KTON_ID: u64 = 1026; + #[pallet::pallet] pub struct Pallet(PhantomData); @@ -94,9 +92,6 @@ pub mod pallet { { /// Override the [`frame_system::Config::RuntimeEvent`]. type RuntimeEvent: From + IsType<::RuntimeEvent>; - /// Chain's ID, which is used for constructing the message. (follow EIP-712 SPEC) - #[pallet::constant] - type ChainId: Get; } #[allow(missing_docs)] @@ -263,11 +258,7 @@ pub mod pallet { return InvalidTransaction::Custom(E_ACCOUNT_ALREADY_EXISTED).into(); } - let message = sr25519_signable_message( - T::ChainId::get(), - T::Version::get().spec_name.as_ref(), - to, - ); + let message = sr25519_signable_message(T::Version::get().spec_name.as_ref(), to); if verify_sr25519_signature(from, &message, signature) { ValidTransaction::with_tag_prefix("account-migration") @@ -284,25 +275,22 @@ pub mod pallet { } pub use pallet::*; -fn sr25519_signable_message( - chain_id: u64, - spec_name: &[u8], - account_id_20: &AccountId20, -) -> Message { - hashing::blake2_256( - &[ - &hashing::blake2_256( - &[&chain_id.to_le_bytes(), spec_name, b"::account-migration"].concat(), - ), - account_id_20.0.as_slice(), - ] - .concat(), - ) +fn sr25519_signable_message(spec_name: &[u8], account_id_20: &AccountId20) -> Vec { + [ + b"I authorize the migration to ", + account_id_20.0.as_slice(), + b", an unused address on ", + spec_name, + b". Sign this message to authorize using the Substrate key associated with the account on ", + &spec_name[..spec_name.len() - 1], + b" that you wish to migrate.", + ] + .concat() } fn verify_sr25519_signature( public_key: &AccountId32, - message: &Message, + message: &[u8], signature: &Signature, ) -> bool { // Actually, `&[u8]` is `[u8; 32]` here. @@ -313,5 +301,5 @@ fn verify_sr25519_signature( return false; }; - signature.verify(message.as_slice(), public_key) + signature.verify(message, public_key) } diff --git a/pallet/account-migration/src/tests.rs b/pallet/account-migration/src/tests.rs index be89f89e3..849820ca8 100644 --- a/pallet/account-migration/src/tests.rs +++ b/pallet/account-migration/src/tests.rs @@ -23,35 +23,24 @@ use sp_keyring::sr25519::Keyring; #[test] fn sr25519_signable_message_should_work() { - [(46_u64, b"Darwinia2".as_slice()), (44, b"Crab2"), (43, b"Pangolin2")] - .iter() - .zip([ - [ - 75, 134, 66, 181, 153, 10, 7, 244, 225, 154, 100, 68, 239, 19, 129, 51, 181, 78, - 66, 254, 167, 54, 211, 20, 171, 68, 160, 46, 216, 98, 9, 44, - ], - [ - 171, 8, 180, 157, 214, 41, 236, 80, 127, 218, 216, 136, 239, 56, 153, 31, 128, 168, - 154, 112, 70, 245, 19, 68, 53, 29, 49, 95, 238, 209, 238, 129, - ], - [ - 251, 70, 107, 65, 22, 164, 1, 85, 114, 150, 161, 208, 235, 131, 15, 111, 154, 207, - 193, 216, 110, 54, 58, 177, 15, 99, 104, 179, 13, 30, 55, 205, - ], - ]) - .for_each(|((chain_id, spec_name), message)| { - assert_eq!( - sr25519_signable_message(*chain_id, spec_name, &Default::default()), - message - ); - }); + ["Darwinia2", "Crab2", "Pangolin2"].iter().for_each(|s| { + assert_eq!( + sr25519_signable_message(s.as_bytes(), &Default::default()), + format!( + "I authorize the migration to {}, an unused address on {}. Sign this message to authorize using the Substrate key associated with the account on {} that you wish to migrate.", + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", + s, + &s[..s.len() - 1], + ).as_bytes() + ); + }); } #[test] fn verify_sr25519_signature_should_work() { Keyring::iter().enumerate().for_each(|(i, from)| { let to = [i as _; 20]; - let message = sr25519_signable_message(46, b"Darwinia2", &to.into()); + let message = sr25519_signable_message(b"Darwinia2", &to.into()); let signature = from.sign(&message); assert!(verify_sr25519_signature(&from.public().0.into(), &message, &signature)); diff --git a/runtime/crab/src/pallets/account_migration.rs b/runtime/crab/src/pallets/account_migration.rs index 1797da2ec..5e230b464 100644 --- a/runtime/crab/src/pallets/account_migration.rs +++ b/runtime/crab/src/pallets/account_migration.rs @@ -20,6 +20,5 @@ use crate::*; impl darwinia_account_migration::Config for Runtime { - type ChainId = ::ChainId; type RuntimeEvent = RuntimeEvent; } diff --git a/runtime/darwinia/src/pallets/account_migration.rs b/runtime/darwinia/src/pallets/account_migration.rs index 1797da2ec..5e230b464 100644 --- a/runtime/darwinia/src/pallets/account_migration.rs +++ b/runtime/darwinia/src/pallets/account_migration.rs @@ -20,6 +20,5 @@ use crate::*; impl darwinia_account_migration::Config for Runtime { - type ChainId = ::ChainId; type RuntimeEvent = RuntimeEvent; } diff --git a/runtime/pangolin/src/pallets/account_migration.rs b/runtime/pangolin/src/pallets/account_migration.rs index 6eeca3e9c..5e230b464 100644 --- a/runtime/pangolin/src/pallets/account_migration.rs +++ b/runtime/pangolin/src/pallets/account_migration.rs @@ -20,6 +20,5 @@ use crate::*; impl darwinia_account_migration::Config for Runtime { - type ChainId = ::ChainId; type RuntimeEvent = RuntimeEvent; } From 7982fa778cd7a75c3078585dc37188a868ad6af0 Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Wed, 11 Jan 2023 20:01:04 +0800 Subject: [PATCH 094/189] Update proxy filter (#197) --- node/src/chain_spec/crab.rs | 4 +- node/src/chain_spec/darwinia.rs | 4 +- node/src/chain_spec/pangolin.rs | 4 +- runtime/crab/src/lib.rs | 2 +- runtime/crab/src/pallets/mod.rs | 4 +- runtime/crab/src/pallets/proxy.rs | 59 +++++++++++++++++++++++---- runtime/darwinia/src/lib.rs | 2 +- runtime/darwinia/src/pallets/mod.rs | 4 +- runtime/darwinia/src/pallets/proxy.rs | 59 +++++++++++++++++++++++---- runtime/pangolin/src/lib.rs | 2 +- runtime/pangolin/src/pallets/mod.rs | 4 +- runtime/pangolin/src/pallets/proxy.rs | 48 ++++++++++++++++++---- 12 files changed, 160 insertions(+), 36 deletions(-) diff --git a/node/src/chain_spec/crab.rs b/node/src/chain_spec/crab.rs index c0a065ff1..ae9ebf56a 100644 --- a/node/src/chain_spec/crab.rs +++ b/node/src/chain_spec/crab.rs @@ -163,6 +163,7 @@ pub fn genesis_config() -> ChainSpec { )], ..Default::default() }, + vesting: Default::default(), // Consensus stuff. staking: StakingConfig { @@ -193,7 +194,6 @@ pub fn genesis_config() -> ChainSpec { // Utility stuff. sudo: SudoConfig { key: Some(array_bytes::hex_n_into_unchecked(ALITH)) }, - vesting: Default::default(), // XCM stuff. polkadot_xcm: PolkadotXcmConfig { safe_xcm_version: Some(SAFE_XCM_VERSION) }, @@ -252,6 +252,7 @@ fn testnet_genesis( )], ..Default::default() }, + vesting: Default::default(), // Consensus stuff. staking: StakingConfig { @@ -287,7 +288,6 @@ fn testnet_genesis( // Utility stuff. sudo: SudoConfig { key: Some(array_bytes::hex_n_into_unchecked(ALITH)) }, - vesting: Default::default(), // XCM stuff. polkadot_xcm: PolkadotXcmConfig { safe_xcm_version: Some(SAFE_XCM_VERSION) }, diff --git a/node/src/chain_spec/darwinia.rs b/node/src/chain_spec/darwinia.rs index 070f54540..1752cecdc 100644 --- a/node/src/chain_spec/darwinia.rs +++ b/node/src/chain_spec/darwinia.rs @@ -163,6 +163,7 @@ pub fn genesis_config() -> ChainSpec { )], ..Default::default() }, + vesting: Default::default(), // Consensus stuff. staking: StakingConfig { @@ -193,7 +194,6 @@ pub fn genesis_config() -> ChainSpec { // Utility stuff. sudo: SudoConfig { key: Some(array_bytes::hex_n_into_unchecked(ALITH)) }, - vesting: Default::default(), // XCM stuff. polkadot_xcm: PolkadotXcmConfig { safe_xcm_version: Some(SAFE_XCM_VERSION) }, @@ -252,6 +252,7 @@ fn testnet_genesis( )], ..Default::default() }, + vesting: Default::default(), // Consensus stuff. staking: StakingConfig { @@ -287,7 +288,6 @@ fn testnet_genesis( // Utility stuff. sudo: SudoConfig { key: Some(array_bytes::hex_n_into_unchecked(ALITH)) }, - vesting: Default::default(), // XCM stuff. polkadot_xcm: PolkadotXcmConfig { safe_xcm_version: Some(SAFE_XCM_VERSION) }, diff --git a/node/src/chain_spec/pangolin.rs b/node/src/chain_spec/pangolin.rs index f799a3185..9e5e54925 100644 --- a/node/src/chain_spec/pangolin.rs +++ b/node/src/chain_spec/pangolin.rs @@ -163,6 +163,7 @@ pub fn genesis_config() -> ChainSpec { )], ..Default::default() }, + vesting: Default::default(), // Consensus stuff. staking: StakingConfig { @@ -193,7 +194,6 @@ pub fn genesis_config() -> ChainSpec { // Utility stuff. sudo: SudoConfig { key: Some(array_bytes::hex_n_into_unchecked(ALITH)) }, - vesting: Default::default(), // XCM stuff. polkadot_xcm: PolkadotXcmConfig { safe_xcm_version: Some(SAFE_XCM_VERSION) }, @@ -246,6 +246,7 @@ fn testnet_genesis( )], ..Default::default() }, + vesting: Default::default(), // Consensus stuff. staking: StakingConfig { @@ -281,7 +282,6 @@ fn testnet_genesis( // Utility stuff. sudo: SudoConfig { key: Some(array_bytes::hex_n_into_unchecked(ALITH)) }, - vesting: Default::default(), // XCM stuff. polkadot_xcm: PolkadotXcmConfig { safe_xcm_version: Some(SAFE_XCM_VERSION) }, diff --git a/runtime/crab/src/lib.rs b/runtime/crab/src/lib.rs index a009de430..1a9efa5c1 100644 --- a/runtime/crab/src/lib.rs +++ b/runtime/crab/src/lib.rs @@ -232,6 +232,7 @@ frame_support::construct_runtime! { Balances: pallet_balances = 5, TransactionPayment: pallet_transaction_payment = 6, Assets: pallet_assets = 34, + Vesting: pallet_vesting = 20, Deposit: darwinia_deposit = 40, AccountMigration: darwinia_account_migration = 41, @@ -255,7 +256,6 @@ frame_support::construct_runtime! { // Utility stuff. Sudo: pallet_sudo = 19, - Vesting: pallet_vesting = 20, Utility: pallet_utility = 21, Identity: pallet_identity = 22, Scheduler: pallet_scheduler = 23, diff --git a/runtime/crab/src/pallets/mod.rs b/runtime/crab/src/pallets/mod.rs index 6cfae9680..ebfd94629 100644 --- a/runtime/crab/src/pallets/mod.rs +++ b/runtime/crab/src/pallets/mod.rs @@ -42,6 +42,8 @@ mod transaction_payment; mod assets; pub use assets::*; +mod vesting; + mod deposit; mod account_migration; @@ -79,8 +81,6 @@ mod tips; // Utility stuff. mod sudo; -mod vesting; - mod utility; mod identity; diff --git a/runtime/crab/src/pallets/proxy.rs b/runtime/crab/src/pallets/proxy.rs index 7f24a7d91..8017c8bd0 100644 --- a/runtime/crab/src/pallets/proxy.rs +++ b/runtime/crab/src/pallets/proxy.rs @@ -37,8 +37,11 @@ pub enum ProxyType { Any, NonTransfer, Governance, + Staking, IdentityJudgement, - EthereumBridge, + CancelProxy, + EcdsaBridge, + SubstrateBridge, } impl Default for ProxyType { fn default() -> Self { @@ -46,14 +49,56 @@ impl Default for ProxyType { } } impl frame_support::traits::InstanceFilter for ProxyType { - // TODO: configure filter - fn filter(&self, _c: &RuntimeCall) -> bool { + fn filter(&self, c: &RuntimeCall) -> bool { match self { ProxyType::Any => true, - ProxyType::NonTransfer => true, - ProxyType::Governance => true, - ProxyType::IdentityJudgement => true, - ProxyType::EthereumBridge => true, + ProxyType::NonTransfer => !matches!( + c, + RuntimeCall::Balances(..) + | RuntimeCall::Assets(..) + | RuntimeCall::Vesting(pallet_vesting::Call::vested_transfer { .. }) + | RuntimeCall::Deposit(..) + | RuntimeCall::Staking(..) + // Might contains transfer { + | RuntimeCall::Utility(..) + | RuntimeCall::Proxy(..) + | RuntimeCall::Multisig(..) + | RuntimeCall::PolkadotXcm(..) + | RuntimeCall::Ethereum(..) // } + ), + ProxyType::Governance => matches!( + c, + RuntimeCall::Democracy(..) + | RuntimeCall::Council(..) + | RuntimeCall::TechnicalCommittee(..) + | RuntimeCall::PhragmenElection(..) + | RuntimeCall::Treasury(..) + | RuntimeCall::Tips(..) + ), + ProxyType::Staking => { + matches!( + c, + RuntimeCall::Session(..) | RuntimeCall::Deposit(..) | RuntimeCall::Staking(..) + ) + }, + ProxyType::IdentityJudgement => + matches!(c, RuntimeCall::Identity(pallet_identity::Call::provide_judgement { .. })), + ProxyType::CancelProxy => { + matches!(c, RuntimeCall::Proxy(pallet_proxy::Call::reject_announcement { .. })) + }, + ProxyType::EcdsaBridge => { + matches!(c, RuntimeCall::EcdsaAuthority(..)) + }, + ProxyType::SubstrateBridge => { + matches!( + c, + RuntimeCall::BridgePolkadotGrandpa(..) + | RuntimeCall::BridgePolkadotParachain(..) + | RuntimeCall::BridgeDarwiniaMessages(..) + | RuntimeCall::BridgeDarwiniaDispatch(..) + | RuntimeCall::DarwiniaFeeMarket(..) + ) + }, } } diff --git a/runtime/darwinia/src/lib.rs b/runtime/darwinia/src/lib.rs index 57e5ee4e9..f45610bee 100644 --- a/runtime/darwinia/src/lib.rs +++ b/runtime/darwinia/src/lib.rs @@ -232,6 +232,7 @@ frame_support::construct_runtime! { Balances: pallet_balances = 5, TransactionPayment: pallet_transaction_payment = 6, Assets: pallet_assets = 34, + Vesting: pallet_vesting = 20, Deposit: darwinia_deposit = 40, AccountMigration: darwinia_account_migration = 41, @@ -255,7 +256,6 @@ frame_support::construct_runtime! { // Utility stuff. Sudo: pallet_sudo = 19, - Vesting: pallet_vesting = 20, Utility: pallet_utility = 21, Identity: pallet_identity = 22, Scheduler: pallet_scheduler = 23, diff --git a/runtime/darwinia/src/pallets/mod.rs b/runtime/darwinia/src/pallets/mod.rs index 6cfae9680..ebfd94629 100644 --- a/runtime/darwinia/src/pallets/mod.rs +++ b/runtime/darwinia/src/pallets/mod.rs @@ -42,6 +42,8 @@ mod transaction_payment; mod assets; pub use assets::*; +mod vesting; + mod deposit; mod account_migration; @@ -79,8 +81,6 @@ mod tips; // Utility stuff. mod sudo; -mod vesting; - mod utility; mod identity; diff --git a/runtime/darwinia/src/pallets/proxy.rs b/runtime/darwinia/src/pallets/proxy.rs index 7f24a7d91..3c5f767be 100644 --- a/runtime/darwinia/src/pallets/proxy.rs +++ b/runtime/darwinia/src/pallets/proxy.rs @@ -37,8 +37,11 @@ pub enum ProxyType { Any, NonTransfer, Governance, + Staking, IdentityJudgement, - EthereumBridge, + CancelProxy, + EcdsaBridge, + SubstrateBridge, } impl Default for ProxyType { fn default() -> Self { @@ -46,14 +49,56 @@ impl Default for ProxyType { } } impl frame_support::traits::InstanceFilter for ProxyType { - // TODO: configure filter - fn filter(&self, _c: &RuntimeCall) -> bool { + fn filter(&self, c: &RuntimeCall) -> bool { match self { ProxyType::Any => true, - ProxyType::NonTransfer => true, - ProxyType::Governance => true, - ProxyType::IdentityJudgement => true, - ProxyType::EthereumBridge => true, + ProxyType::NonTransfer => !matches!( + c, + RuntimeCall::Balances(..) + | RuntimeCall::Assets(..) + | RuntimeCall::Vesting(pallet_vesting::Call::vested_transfer { .. }) + | RuntimeCall::Deposit(..) + | RuntimeCall::Staking(..) + // Might contains transfer { + | RuntimeCall::Utility(..) + | RuntimeCall::Proxy(..) + | RuntimeCall::Multisig(..) + | RuntimeCall::PolkadotXcm(..) + | RuntimeCall::Ethereum(..) // } + ), + ProxyType::Governance => matches!( + c, + RuntimeCall::Democracy(..) + | RuntimeCall::Council(..) + | RuntimeCall::TechnicalCommittee(..) + | RuntimeCall::PhragmenElection(..) + | RuntimeCall::Treasury(..) + | RuntimeCall::Tips(..) + ), + ProxyType::Staking => { + matches!( + c, + RuntimeCall::Session(..) | RuntimeCall::Deposit(..) | RuntimeCall::Staking(..) + ) + }, + ProxyType::IdentityJudgement => + matches!(c, RuntimeCall::Identity(pallet_identity::Call::provide_judgement { .. })), + ProxyType::CancelProxy => { + matches!(c, RuntimeCall::Proxy(pallet_proxy::Call::reject_announcement { .. })) + }, + ProxyType::EcdsaBridge => { + matches!(c, RuntimeCall::EcdsaAuthority(..)) + }, + ProxyType::SubstrateBridge => { + matches!( + c, + RuntimeCall::BridgeKusamaGrandpa(..) + | RuntimeCall::BridgeKusamaParachain(..) + | RuntimeCall::BridgeCrabMessages(..) + | RuntimeCall::BridgeCrabDispatch(..) + | RuntimeCall::CrabFeeMarket(..) + ) + }, } } diff --git a/runtime/pangolin/src/lib.rs b/runtime/pangolin/src/lib.rs index c165e1013..01202daf4 100644 --- a/runtime/pangolin/src/lib.rs +++ b/runtime/pangolin/src/lib.rs @@ -229,6 +229,7 @@ frame_support::construct_runtime! { Balances: pallet_balances = 5, TransactionPayment: pallet_transaction_payment = 6, Assets: pallet_assets = 34, + Vesting: pallet_vesting = 20, Deposit: darwinia_deposit = 40, AccountMigration: darwinia_account_migration = 41, @@ -252,7 +253,6 @@ frame_support::construct_runtime! { // Utility stuff. Sudo: pallet_sudo = 19, - Vesting: pallet_vesting = 20, Utility: pallet_utility = 21, Identity: pallet_identity = 22, Scheduler: pallet_scheduler = 23, diff --git a/runtime/pangolin/src/pallets/mod.rs b/runtime/pangolin/src/pallets/mod.rs index 254128833..ce3faff96 100644 --- a/runtime/pangolin/src/pallets/mod.rs +++ b/runtime/pangolin/src/pallets/mod.rs @@ -42,6 +42,8 @@ mod transaction_payment; mod assets; pub use assets::*; +mod vesting; + mod deposit; mod account_migration; @@ -80,8 +82,6 @@ mod tips; // Utility stuff. mod sudo; -mod vesting; - mod utility; mod identity; diff --git a/runtime/pangolin/src/pallets/proxy.rs b/runtime/pangolin/src/pallets/proxy.rs index 7f24a7d91..fe3843ca0 100644 --- a/runtime/pangolin/src/pallets/proxy.rs +++ b/runtime/pangolin/src/pallets/proxy.rs @@ -37,8 +37,10 @@ pub enum ProxyType { Any, NonTransfer, Governance, + Staking, IdentityJudgement, - EthereumBridge, + CancelProxy, + EcdsaBridge, } impl Default for ProxyType { fn default() -> Self { @@ -46,14 +48,46 @@ impl Default for ProxyType { } } impl frame_support::traits::InstanceFilter for ProxyType { - // TODO: configure filter - fn filter(&self, _c: &RuntimeCall) -> bool { + fn filter(&self, c: &RuntimeCall) -> bool { match self { ProxyType::Any => true, - ProxyType::NonTransfer => true, - ProxyType::Governance => true, - ProxyType::IdentityJudgement => true, - ProxyType::EthereumBridge => true, + ProxyType::NonTransfer => !matches!( + c, + RuntimeCall::Balances(..) + | RuntimeCall::Assets(..) + | RuntimeCall::Vesting(pallet_vesting::Call::vested_transfer { .. }) + | RuntimeCall::Deposit(..) + | RuntimeCall::Staking(..) + // Might contains transfer { + | RuntimeCall::Utility(..) + | RuntimeCall::Proxy(..) + | RuntimeCall::Multisig(..) + | RuntimeCall::PolkadotXcm(..) + | RuntimeCall::Ethereum(..) // } + ), + ProxyType::Governance => matches!( + c, + RuntimeCall::Democracy(..) + | RuntimeCall::Council(..) + | RuntimeCall::TechnicalCommittee(..) + | RuntimeCall::PhragmenElection(..) + | RuntimeCall::Treasury(..) + | RuntimeCall::Tips(..) + ), + ProxyType::Staking => { + matches!( + c, + RuntimeCall::Session(..) | RuntimeCall::Deposit(..) | RuntimeCall::Staking(..) + ) + }, + ProxyType::IdentityJudgement => + matches!(c, RuntimeCall::Identity(pallet_identity::Call::provide_judgement { .. })), + ProxyType::CancelProxy => { + matches!(c, RuntimeCall::Proxy(pallet_proxy::Call::reject_announcement { .. })) + }, + ProxyType::EcdsaBridge => { + matches!(c, RuntimeCall::EcdsaAuthority(..)) + }, } } From 0fae7a10dfb8d1b824351653b1cd15e17bacc273 Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Thu, 12 Jan 2023 01:46:16 +0800 Subject: [PATCH 095/189] Use features check action (#198) Signed-off-by: Xavier Lau Signed-off-by: Xavier Lau --- .github/workflows/checks.yml | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 1b889092a..8f3351088 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -95,25 +95,15 @@ jobs: features-checks: name: Task check features if: github.event_name == 'push' || !github.event.pull_request.draft + strategy: + matrix: + runtime: [runtime/darwinia, runtime/crab, runtime/pangolin] runs-on: ubuntu-latest steps: - - name: Install Rust ${{ env.RUST_TOOLCHAIN }} toolchain - uses: actions-rs/toolchain@v1 + - name: Check ${{ matrix.runtime }} + uses: hack-ink/subalfred-check-features-action@v0.1.5 with: - toolchain: ${{ env.RUST_TOOLCHAIN }} - default: true - - name: Install Subalfred - run: | - curl -L ${{ env.SUBALFRED_LINK }} | zstd -o subalfred -d - chmod u+x subalfred - sudo mv subalfred /usr/bin - sudo chmod u+x /usr/bin/subalfred - - name: Fetch latest code - uses: actions/checkout@v3 - - name: Check - run: | - unset RUSTC_WRAPPER - subalfred check features runtime/darwinia + path: ${{ matrix.runtime }} runtime-checks: name: Task check runtime From 943d7c4b9cb689e7d69106d1298f5d49bb78bcd4 Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Thu, 12 Jan 2023 14:57:36 +0800 Subject: [PATCH 096/189] Merge collator payout (#200) * Merge collator payout * Bump runtime version * Improve code * Doc --- pallet/staking/src/lib.rs | 27 ++++++++++++++------------- runtime/pangolin/src/lib.rs | 2 +- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/pallet/staking/src/lib.rs b/pallet/staking/src/lib.rs index 1ecd660fe..ff4a29832 100644 --- a/pallet/staking/src/lib.rs +++ b/pallet/staking/src/lib.rs @@ -875,29 +875,24 @@ pub mod pallet { continue; }; let c_total_payout = Perbill::from_rational(p, total_points) * payout; - let c_commission_payout = commission * c_total_payout; - let n_payout = c_total_payout - c_commission_payout; + let mut c_payout = commission * c_total_payout; + let n_payout = c_total_payout - c_payout; let Some(c_exposure) = >::get(&c) else { log::error!("[pallet::staking] exposure({c:?}) must be found; qed"); continue; }; - if let Ok(_i) = T::RingCurrency::deposit_into_existing(&c, c_commission_payout) { - actual_payout += c_commission_payout; - - Self::deposit_event(Event::Payout { - staker: c, - ring_amount: c_commission_payout, - }); - } - for n_exposure in c_exposure.nominators { let n_payout = Perbill::from_rational(n_exposure.value, c_exposure.total) * n_payout; - if let Ok(_i) = - T::RingCurrency::deposit_into_existing(&n_exposure.who, n_payout) + if c == n_exposure.who { + // If the collator nominated themselves. + + c_payout += n_payout; + } else if T::RingCurrency::deposit_into_existing(&n_exposure.who, n_payout) + .is_ok() { actual_payout += n_payout; @@ -907,6 +902,12 @@ pub mod pallet { }); } } + + if T::RingCurrency::deposit_into_existing(&c, c_payout).is_ok() { + actual_payout += c_payout; + + Self::deposit_event(Event::Payout { staker: c, ring_amount: c_payout }); + } } T::RewardRemainder::on_unbalanced(T::RingCurrency::issue(inflation - actual_payout)); diff --git a/runtime/pangolin/src/lib.rs b/runtime/pangolin/src/lib.rs index 01202daf4..a4b055299 100644 --- a/runtime/pangolin/src/lib.rs +++ b/runtime/pangolin/src/lib.rs @@ -101,7 +101,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: sp_runtime::create_runtime_str!("Pangolin2"), impl_name: sp_runtime::create_runtime_str!("DarwiniaOfficialRust"), authoring_version: 0, - spec_version: 6_0_0_0, + spec_version: 6_0_0_1, impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 0, From c9f54e3c39bd227104a7dbae0e59bdc587e2ec43 Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Thu, 12 Jan 2023 22:06:36 +0800 Subject: [PATCH 097/189] Refactor runtime tests (#204) --- Cargo.lock | 3 + node/src/chain_spec/crab.rs | 1 - node/src/chain_spec/darwinia.rs | 1 - node/src/chain_spec/pangolin.rs | 1 - pallet/account-migration/src/lib.rs | 3 +- runtime/common/Cargo.toml | 14 +- runtime/common/src/lib.rs | 3 + runtime/common/src/test.rs | 310 ++++++++++++++++++ runtime/crab/Cargo.toml | 6 + runtime/crab/src/lib.rs | 3 +- runtime/crab/tests/account_migration.rs | 330 -------------------- runtime/crab/tests/mock.rs | 40 +-- runtime/crab/tests/tests.rs | 3 + runtime/darwinia/Cargo.toml | 6 + runtime/darwinia/src/lib.rs | 3 +- runtime/darwinia/tests/account_migration.rs | 330 -------------------- runtime/darwinia/tests/mock.rs | 40 +-- runtime/darwinia/tests/tests.rs | 3 + runtime/pangolin/Cargo.toml | 6 + runtime/pangolin/src/lib.rs | 3 +- runtime/pangolin/tests/account_migration.rs | 330 -------------------- runtime/pangolin/tests/mock.rs | 40 +-- runtime/pangolin/tests/tests.rs | 3 + 23 files changed, 416 insertions(+), 1066 deletions(-) create mode 100644 runtime/common/src/test.rs delete mode 100644 runtime/crab/tests/account_migration.rs create mode 100644 runtime/crab/tests/tests.rs delete mode 100644 runtime/darwinia/tests/account_migration.rs create mode 100644 runtime/darwinia/tests/tests.rs delete mode 100644 runtime/pangolin/tests/account_migration.rs create mode 100644 runtime/pangolin/tests/tests.rs diff --git a/Cargo.lock b/Cargo.lock index 0e1ae127f..e40761dbe 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1424,6 +1424,7 @@ dependencies = [ "sp-core", "sp-inherents", "sp-io", + "sp-keyring", "sp-offchain", "sp-runtime", "sp-session", @@ -2629,6 +2630,7 @@ dependencies = [ "sp-core", "sp-inherents", "sp-io", + "sp-keyring", "sp-offchain", "sp-runtime", "sp-session", @@ -7571,6 +7573,7 @@ dependencies = [ "sp-core", "sp-inherents", "sp-io", + "sp-keyring", "sp-offchain", "sp-runtime", "sp-session", diff --git a/node/src/chain_spec/crab.rs b/node/src/chain_spec/crab.rs index ae9ebf56a..f04cd8b46 100644 --- a/node/src/chain_spec/crab.rs +++ b/node/src/chain_spec/crab.rs @@ -29,7 +29,6 @@ use cumulus_primitives_core::ParaId; // darwinia use super::*; use crab_runtime::*; -use dc_primitives::*; // frontier use fp_evm::GenesisAccount; // substrate diff --git a/node/src/chain_spec/darwinia.rs b/node/src/chain_spec/darwinia.rs index 1752cecdc..4c7f20b75 100644 --- a/node/src/chain_spec/darwinia.rs +++ b/node/src/chain_spec/darwinia.rs @@ -29,7 +29,6 @@ use cumulus_primitives_core::ParaId; // darwinia use super::*; use darwinia_runtime::*; -use dc_primitives::*; // frontier use fp_evm::GenesisAccount; // substrate diff --git a/node/src/chain_spec/pangolin.rs b/node/src/chain_spec/pangolin.rs index 9e5e54925..c3801eb0f 100644 --- a/node/src/chain_spec/pangolin.rs +++ b/node/src/chain_spec/pangolin.rs @@ -28,7 +28,6 @@ use std::{ use cumulus_primitives_core::ParaId; // darwinia use super::*; -use dc_primitives::*; use pangolin_runtime::*; // frontier use fp_evm::GenesisAccount; diff --git a/pallet/account-migration/src/lib.rs b/pallet/account-migration/src/lib.rs index dccfd7988..95bf67bb1 100644 --- a/pallet/account-migration/src/lib.rs +++ b/pallet/account-migration/src/lib.rs @@ -275,7 +275,8 @@ pub mod pallet { } pub use pallet::*; -fn sr25519_signable_message(spec_name: &[u8], account_id_20: &AccountId20) -> Vec { +/// Build a Darwinia account migration message. +pub fn sr25519_signable_message(spec_name: &[u8], account_id_20: &AccountId20) -> Vec { [ b"I authorize the migration to ", account_id_20.0.as_slice(), diff --git a/runtime/common/Cargo.toml b/runtime/common/Cargo.toml index f6419615e..6783afc30 100644 --- a/runtime/common/Cargo.toml +++ b/runtime/common/Cargo.toml @@ -29,12 +29,12 @@ xcm-builder = { default-features = false, git = "https://github.com/paritytech/ xcm-executor = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" } # substrate -frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-collective = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-io = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-collective = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-io = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } [features] default = ["std"] @@ -61,3 +61,5 @@ std = [ "sp-runtime/std", "sp-std/std", ] + +test = [] diff --git a/runtime/common/src/lib.rs b/runtime/common/src/lib.rs index 55431448b..155449da8 100644 --- a/runtime/common/src/lib.rs +++ b/runtime/common/src/lib.rs @@ -27,6 +27,9 @@ pub use bp_darwinia_core as bp_crab; pub use bp_darwinia_core as bp_darwinia; pub use bp_darwinia_core as bp_pangolin; +// #[cfg(feature = "test")] +pub mod test; + // darwinia use dc_primitives::*; // substrate diff --git a/runtime/common/src/test.rs b/runtime/common/src/test.rs new file mode 100644 index 000000000..d64250990 --- /dev/null +++ b/runtime/common/src/test.rs @@ -0,0 +1,310 @@ +#[macro_export] +macro_rules! impl_account_migration_tests { + () => { + mod account_migration { + // darwinia + use super::mock::*; + use darwinia_deposit::Deposit as DepositS; + use darwinia_staking::Ledger; + // substrate + use frame_support::{ + assert_err, assert_ok, migration, traits::Get, Blake2_128Concat, StorageHasher, + }; + use frame_system::AccountInfo; + use pallet_assets::ExistenceReason; + use pallet_balances::AccountData; + use sp_core::{sr25519::Pair, Encode, Pair as PairT, H160}; + use sp_keyring::sr25519::Keyring; + use sp_runtime::{ + traits::ValidateUnsigned, + transaction_validity::{InvalidTransaction, TransactionValidityError}, + AccountId32, DispatchError, + }; + use sp_version::RuntimeVersion; + + const RING_AMOUNT: u128 = 100; + const KTON_AMOUNT: u128 = 100; + + #[derive(Debug, PartialEq, Eq)] + enum E { + T(TransactionValidityError), + D(DispatchError), + } + use E::*; + impl From for E { + fn from(t: TransactionValidityError) -> Self { + T(t) + } + } + impl From for E { + fn from(d: DispatchError) -> Self { + D(d) + } + } + + // This struct is private in `pallet-assets`. + #[derive(Encode)] + struct AssetAccount { + balance: u128, + is_frozen: bool, + reason: ExistenceReason, + extra: (), + } + + // This struct is private in `pallet-vesting`. + #[derive(Encode)] + struct VestingInfo { + locked: u128, + per_block: u128, + starting_block: u32, + } + + fn alice() -> (Pair, AccountId32) { + let pair = Keyring::Alice.pair(); + let public_key = AccountId32::new(pair.public().0); + + (pair, public_key) + } + + fn invalid_transaction(code: u8) -> E { + T(TransactionValidityError::Invalid(InvalidTransaction::Custom(code))) + } + + fn preset_state_of(who: &Pair) { + let account_id_32 = AccountId32::new(who.public().0); + let asset_account = AssetAccount { + balance: KTON_AMOUNT, + is_frozen: false, + reason: ExistenceReason::::Sufficient, + extra: (), + }; + + assert!(AccountMigration::account_of(&account_id_32).is_none()); + assert!(AccountMigration::kton_account_of(&account_id_32).is_none()); + + >::insert( + &account_id_32, + AccountInfo { + nonce: 100, + consumers: 1, + providers: 1, + sufficients: 1, + data: AccountData { free: RING_AMOUNT, ..Default::default() }, + }, + ); + migration::put_storage_value( + b"AccountMigration", + b"KtonAccounts", + &Blake2_128Concat::hash(account_id_32.as_ref()), + asset_account, + ); + assert!(AccountMigration::account_of(&account_id_32).is_some()); + assert!(AccountMigration::kton_account_of(&account_id_32).is_some()); + } + + fn migrate(from: Pair, to: AccountId) -> Result<(), E> { + let message = darwinia_account_migration::sr25519_signable_message( + <::Version as Get>::get() + .spec_name + .as_bytes(), + &to, + ); + let sig = from.sign(&message); + let from_pk = AccountId32::new(from.public().0); + + AccountMigration::pre_dispatch(&darwinia_account_migration::Call::migrate { + from: from_pk.clone(), + to, + signature: sig.clone(), + })?; + AccountMigration::migrate(RuntimeOrigin::none(), from_pk, to, sig)?; + + Ok(()) + } + + #[test] + fn validate_substrate_account_not_found() { + ExtBuilder::default().build().execute_with(|| { + let (from, _) = alice(); + let to = AccountId::default(); + + // Migration source doesn't exist. + assert_err!(migrate(from, to), invalid_transaction(1)); + }); + } + + #[test] + fn validate_evm_account_already_exist() { + let (from, _) = alice(); + let to = H160::from_low_u64_be(33).into(); + + ExtBuilder::default().with_balances(vec![(to, RING_AMOUNT)]).build().execute_with( + || { + preset_state_of(&from); + + // Migration target has already been migrated. + assert_err!(migrate(from, to), invalid_transaction(0)); + }, + ); + } + + #[test] + fn validate_invalid_sig() { + let (from, from_pk) = alice(); + let to = H160::from_low_u64_be(33).into(); + let message = darwinia_account_migration::sr25519_signable_message(b"?", &to); + let sig = from.sign(&message); + + ExtBuilder::default().build().execute_with(|| { + preset_state_of(&from); + + assert_err!( + AccountMigration::pre_dispatch( + &darwinia_account_migration::Call::migrate { + from: from_pk.clone(), + to, + signature: sig.clone(), + } + ) + .map_err(E::from), + invalid_transaction(2) + ); + }); + } + + #[test] + fn migrate_accounts_should_work() { + let (from, from_pk) = alice(); + let to = H160::from_low_u64_be(255).into(); + + ExtBuilder::default().build().execute_with(|| { + preset_state_of(&from); + + assert_ok!(migrate(from, to)); + assert_eq!(AccountMigration::account_of(from_pk), None); + assert_eq!( + System::account(to), + AccountInfo { + nonce: 100, + consumers: 1, + providers: 1, + sufficients: 1, + data: AccountData { free: RING_AMOUNT, ..Default::default() }, + } + ); + }); + } + + #[test] + fn migrate_kton_accounts_should_work() { + let (from, from_pk) = alice(); + let to = H160::from_low_u64_be(255).into(); + + ExtBuilder::default().build().execute_with(|| { + preset_state_of(&from); + + assert_ok!(migrate(from, to)); + assert_eq!(AccountMigration::kton_account_of(from_pk), None); + assert_eq!( + Assets::maybe_balance(KTON_ID, to).unwrap(), + KTON_AMOUNT + ); + }); + } + + #[test] + fn vesting_should_work() { + let (from, from_pk) = alice(); + let to = H160::from_low_u64_be(255).into(); + + ExtBuilder::default().build().execute_with(|| { + preset_state_of(&from); + + migration::put_storage_value( + b"AccountMigration", + b"Vestings", + &Blake2_128Concat::hash(from_pk.as_ref()), + vec![ + VestingInfo { locked: 100, per_block: 5, starting_block: 0 }, + VestingInfo { locked: 100, per_block: 5, starting_block: 0 }, + ], + ); + assert!(Vesting::vesting(to).is_none()); + assert!(Balances::locks(to).is_empty()); + + assert_ok!(migrate(from, to)); + assert_eq!(Vesting::vesting(to).unwrap().len(), 2); + assert_eq!(Balances::locks(to).len(), 1); + }); + } + + #[test] + fn staking_should_work() { + let (from, from_pk) = alice(); + let init = H160::from_low_u64_be(254).into(); + let to = H160::from_low_u64_be(255).into(); + + ExtBuilder::default() + .with_assets_accounts(vec![(KTON_ID, init, KTON_AMOUNT)]) + .build() + .execute_with(|| { + preset_state_of(&from); + + >::insert( + &from_pk, + vec![ + DepositS { + id: 1, + value: 10, + start_time: 1000, + expired_time: 2000, + in_use: true, + }, + DepositS { + id: 2, + value: 10, + start_time: 1000, + expired_time: 2000, + in_use: true, + }, + ], + ); + >::insert( + &from_pk, + Ledger { + staked_ring: 20, + staked_kton: 20, + staked_deposits: Default::default(), + unstaking_ring: Default::default(), + unstaking_kton: Default::default(), + unstaking_deposits: Default::default(), + }, + ); + + assert_ok!(migrate(from, to)); + assert_eq!(Balances::free_balance(to), 60); + assert_eq!( + Balances::free_balance(&darwinia_deposit::account_id::()), + 20 + ); + assert_eq!( + Balances::free_balance(&darwinia_staking::account_id::()), + 20 + ); + assert_eq!(Deposit::deposit_of(to).unwrap().len(), 2); + assert_eq!(Assets::maybe_balance(KTON_ID, to).unwrap(), 80); + assert_eq!( + Assets::maybe_balance( + KTON_ID, + darwinia_staking::account_id::() + ) + .unwrap(), + 20 + ); + assert_eq!(Staking::ledger_of(to).unwrap().staked_ring, 20); + assert_eq!(Staking::ledger_of(to).unwrap().staked_kton, 20); + }); + } + } + }; +} diff --git a/runtime/crab/Cargo.toml b/runtime/crab/Cargo.toml index b61443dee..5fdef26a1 100644 --- a/runtime/crab/Cargo.toml +++ b/runtime/crab/Cargo.toml @@ -128,6 +128,12 @@ frame-benchmarking = { optional = true, default-features = false, git = " frame-system-benchmarking = { optional = true, default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } frame-try-runtime = { optional = true, default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +[dev-dependencies] +# darwinia +darwinia-common-runtime = { features = ["test"], path = "../common" } +# substrate +sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } + [features] default = ["std"] std = [ diff --git a/runtime/crab/src/lib.rs b/runtime/crab/src/lib.rs index 1a9efa5c1..64fb84e1e 100644 --- a/runtime/crab/src/lib.rs +++ b/runtime/crab/src/lib.rs @@ -33,12 +33,11 @@ pub use bridges_message::*; mod weights; pub use darwinia_common_runtime::*; +pub use dc_primitives::*; pub use sp_consensus_aura::sr25519::AuthorityId as AuraId; // cumulus use cumulus_pallet_parachain_system::RelayNumberStrictlyIncreases; -// darwinia -use dc_primitives::*; // polkadot use xcm_executor::XcmExecutor; // substrate diff --git a/runtime/crab/tests/account_migration.rs b/runtime/crab/tests/account_migration.rs deleted file mode 100644 index 3e76afa91..000000000 --- a/runtime/crab/tests/account_migration.rs +++ /dev/null @@ -1,330 +0,0 @@ -// This file is part of Darwinia. -// -// Copyright (C) 2018-2022 Darwinia Network -// SPDX-License-Identifier: GPL-3.0 -// -// Darwinia is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// Darwinia 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 Darwinia. If not, see . - -#![cfg(test)] - -mod mock; -use mock::*; - -// darwinia -use crab_runtime::*; -use darwinia_deposit::Deposit; -use darwinia_staking::Ledger; -use dc_primitives::AccountId; -// substrate -use frame_support::{ - assert_err, assert_ok, migration, traits::Get, Blake2_128Concat, StorageHasher, -}; -use frame_system::AccountInfo; -use pallet_assets::ExistenceReason; -use pallet_balances::AccountData; -use sp_core::{sr25519::Pair, Encode, Pair as PairT, H160}; -use sp_io::hashing::blake2_256; -use sp_runtime::{ - traits::ValidateUnsigned, - transaction_validity::{InvalidTransaction, TransactionValidityError}, - AccountId32, DispatchError, DispatchResult, -}; -use sp_version::RuntimeVersion; - -const RING_AMOUNT: u128 = 100; -const KTON_AMOUNT: u128 = 100; - -fn migrate(pair: Pair, to: AccountId, chain_id: u64, spec_name: &[u8]) -> DispatchResult { - let account_id = AccountId32::new(pair.public().0); - - let message = blake2_256( - &[ - &blake2_256(&[&chain_id.to_le_bytes(), spec_name, b"::account-migration"].concat()), - to.0.as_slice(), - ] - .concat(), - ); - let sig = pair.sign(&message); - - AccountMigration::pre_dispatch(&darwinia_account_migration::Call::migrate { - from: account_id.clone(), - to, - signature: sig.clone(), - }) - .map_err(|e| match e { - TransactionValidityError::Invalid(InvalidTransaction::Custom(e)) => - Box::leak(format!("err code: {}", e).into_boxed_str()), - e => <&'static str>::from(e), - })?; - AccountMigration::migrate(RuntimeOrigin::none(), account_id, to, sig) -} - -fn prepare_accounts(storage: bool) -> Pair { - let pair = Pair::from_seed(b"00000000000000000000000000000001"); - let account_id = AccountId32::new(pair.public().0); - - if storage { - >::insert( - account_id.clone(), - AccountInfo { - nonce: 100, - consumers: 1, - providers: 1, - sufficients: 1, - data: AccountData { free: RING_AMOUNT, ..Default::default() }, - }, - ); - - // The struct in the upstream repo is not accessible due to viable. - #[derive(Clone, Encode)] - pub struct AssetAccount { - pub balance: u128, - pub is_frozen: bool, - pub reason: ExistenceReason, - pub extra: (), - } - let asset_account = AssetAccount { - balance: KTON_AMOUNT, - is_frozen: false, - reason: ExistenceReason::::Sufficient, - extra: (), - }; - migration::put_storage_value( - b"AccountMigration", - b"KtonAccounts", - &Blake2_128Concat::hash(account_id.as_ref()), - asset_account.clone(), - ); - assert!(AccountMigration::account_of(account_id).is_some()); - } - pair -} - -#[test] -fn validate_substrate_account_not_found() { - ExtBuilder::default().build().execute_with(|| { - let to = H160::default(); - let pair = prepare_accounts(false); - - assert_err!( - migrate( - pair, - to.into(), - <::ChainId as Get>::get(), - <::Version as Get>::get() - .spec_name - .as_bytes() - ), - DispatchError::Other("err code: 1") // The migration source not exist. - ); - }); -} - -#[test] -fn validate_evm_account_already_exist() { - let to = H160::from_low_u64_be(33).into(); - ExtBuilder::default().with_balances(vec![(to, 100)]).build().execute_with(|| { - let pair = prepare_accounts(true); - - assert_err!( - migrate( - pair, - to, - <::ChainId as Get>::get(), - <::Version as Get>::get() - .spec_name - .as_bytes() - ), - DispatchError::Other("err code: 0") // To account has been used. - ); - }); -} - -#[test] -fn validate_invalid_sig() { - let to = H160::from_low_u64_be(33).into(); - ExtBuilder::default().build().execute_with(|| { - let pair = prepare_accounts(true); - - assert_err!( - migrate( - pair, - to, - <::ChainId as Get>::get() + 1, - <::Version as Get>::get() - .spec_name - .as_bytes() - ), - DispatchError::Other("err code: 2") // Invalid signature - ); - }); -} - -#[test] -fn migrate_accounts() { - let to = H160::from_low_u64_be(255).into(); - ExtBuilder::default().build().execute_with(|| { - let pair = prepare_accounts(true); - let account_id = AccountId32::new(pair.public().0); - - assert_ok!(migrate( - pair, - to, - <::ChainId as Get>::get(), - <::Version as Get>::get() - .spec_name - .as_bytes() - )); - assert_eq!(AccountMigration::account_of(account_id), None); - assert_eq!( - System::account(to), - AccountInfo { - nonce: 100, - consumers: 1, - providers: 1, - sufficients: 1, - data: AccountData { free: 100, ..Default::default() }, - } - ); - }); -} - -#[test] -fn migrate_kton_accounts() { - let to = H160::from_low_u64_be(255).into(); - ExtBuilder::default().build().execute_with(|| { - let pair = prepare_accounts(true); - let account_id = AccountId32::new(pair.public().0); - - assert_ok!(migrate( - pair, - to, - <::ChainId as Get>::get(), - <::Version as Get>::get() - .spec_name - .as_bytes() - )); - assert_eq!(AccountMigration::kton_account_of(account_id), None); - assert_eq!(Assets::maybe_balance(KTON_ID, to).unwrap(), KTON_AMOUNT); - }); -} - -#[test] -fn vesting() { - let to = H160::from_low_u64_be(255).into(); - ExtBuilder::default().build().execute_with(|| { - let pair = prepare_accounts(true); - let account_id = AccountId32::new(pair.public().0); - - // The struct in the upstream repo is not accessible due to viable. - #[derive(Encode)] - pub struct VestingInfo { - locked: u128, - per_block: u128, - starting_block: u32, - } - - migration::put_storage_value( - b"AccountMigration", - b"Vestings", - &Blake2_128Concat::hash(account_id.as_ref()), - vec![ - VestingInfo { locked: 100, per_block: 5, starting_block: 0 }, - VestingInfo { locked: 100, per_block: 5, starting_block: 0 }, - ], - ); - - assert_ok!(migrate( - pair, - to, - <::ChainId as Get>::get(), - <::Version as Get>::get() - .spec_name - .as_bytes() - )); - - assert_eq!(Vesting::vesting(to).unwrap().len(), 2); - assert_eq!(Balances::locks(to).len(), 1); - }); -} - -#[test] -fn staking() { - let init = H160::from_low_u64_be(254).into(); - let to = H160::from_low_u64_be(255).into(); - ExtBuilder::default() - .with_assets_accounts(vec![(KTON_ID, init, KTON_AMOUNT)]) - .build() - .execute_with(|| { - let pair = prepare_accounts(true); - let account_id = AccountId32::new(pair.public().0); - - >::insert( - account_id.clone(), - vec![ - Deposit { - id: 1, - value: 10, - start_time: 1000, - expired_time: 2000, - in_use: true, - }, - Deposit { - id: 2, - value: 10, - start_time: 1000, - expired_time: 2000, - in_use: true, - }, - ], - ); - - >::insert( - account_id.clone(), - Ledger { - staked_ring: 20, - staked_kton: 20, - staked_deposits: vec![].try_into().unwrap(), - unstaking_ring: vec![].try_into().unwrap(), - unstaking_kton: vec![].try_into().unwrap(), - unstaking_deposits: vec![].try_into().unwrap(), - }, - ); - - assert_ok!(migrate( - pair, - to, - <::ChainId as Get>::get(), - <::Version as Get>::get() - .spec_name - .as_bytes() - )); - - assert_eq!(Balances::free_balance(to), 60); - assert_eq!(Balances::free_balance(&darwinia_deposit::account_id::()), 20); - assert_eq!(Balances::free_balance(&darwinia_staking::account_id::()), 20); - - assert_eq!(crab_runtime::Deposit::deposit_of(to).unwrap().len(), 2); - - assert_eq!(Assets::maybe_balance(KTON_ID, to).unwrap(), 80); - assert_eq!( - Assets::maybe_balance(KTON_ID, darwinia_staking::account_id::()) - .unwrap(), - 20 - ); - - assert_eq!(crab_runtime::Staking::ledger_of(to).unwrap().staked_ring, 20); - assert_eq!(crab_runtime::Staking::ledger_of(to).unwrap().staked_kton, 20); - }); -} diff --git a/runtime/crab/tests/mock.rs b/runtime/crab/tests/mock.rs index b67b64fa4..5419a06e2 100644 --- a/runtime/crab/tests/mock.rs +++ b/runtime/crab/tests/mock.rs @@ -16,50 +16,50 @@ // You should have received a copy of the GNU General Public License // along with Darwinia. If not, see . -// darwinia -use crab_runtime::{Runtime, System}; -use darwinia_common_runtime::gov_origin::ROOT; -use dc_primitives::{AccountId, Balance}; -// parity +pub use crab_runtime::*; + +// substrate use frame_support::traits::GenesisBuild; use sp_io::TestExternalities; -pub(crate) const KTON_ID: u64 = 1026; +pub const KTON_ID: u64 = AssetIds::CKton as _; -#[derive(Default, Clone)] +#[derive(Clone, Default)] pub struct ExtBuilder { balances: Vec<(AccountId, Balance)>, assets_accounts: Vec<(u64, AccountId, Balance)>, } - impl ExtBuilder { + pub fn with_balances(&mut self, balances: Vec<(AccountId, Balance)>) -> &mut Self { + self.balances = balances; + + self + } + + pub fn with_assets_accounts(&mut self, accounts: Vec<(u64, AccountId, Balance)>) -> &mut Self { + self.assets_accounts = accounts; + + self + } + pub fn build(&mut self) -> TestExternalities { let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); pallet_balances::GenesisConfig:: { balances: self.balances.clone() } .assimilate_storage(&mut t) .unwrap(); - pallet_assets::GenesisConfig:: { assets: vec![(KTON_ID, ROOT, true, 1)], - metadata: vec![(KTON_ID, b"Test Commitment Token".to_vec(), b"TKTON".to_vec(), 18)], + metadata: vec![(KTON_ID, b"Crab Commitment Token".to_vec(), b"CKTON".to_vec(), 18)], accounts: self.assets_accounts.clone(), } .assimilate_storage(&mut t) .unwrap(); let mut ext = TestExternalities::new(t); - ext.execute_with(|| System::set_block_number(1)); - ext - } - pub fn with_balances(&mut self, balances: Vec<(AccountId, Balance)>) -> &mut Self { - self.balances = balances; - self - } + ext.execute_with(|| System::set_block_number(1)); - pub fn with_assets_accounts(&mut self, accounts: Vec<(u64, AccountId, Balance)>) -> &mut Self { - self.assets_accounts = accounts; - self + ext } } diff --git a/runtime/crab/tests/tests.rs b/runtime/crab/tests/tests.rs new file mode 100644 index 000000000..43b5d3724 --- /dev/null +++ b/runtime/crab/tests/tests.rs @@ -0,0 +1,3 @@ +pub mod mock; + +darwinia_common_runtime::impl_account_migration_tests! {} diff --git a/runtime/darwinia/Cargo.toml b/runtime/darwinia/Cargo.toml index 8ede78417..9b687de83 100644 --- a/runtime/darwinia/Cargo.toml +++ b/runtime/darwinia/Cargo.toml @@ -128,6 +128,12 @@ frame-benchmarking = { optional = true, default-features = false, git = " frame-system-benchmarking = { optional = true, default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } frame-try-runtime = { optional = true, default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +[dev-dependencies] +# darwinia +darwinia-common-runtime = { features = ["test"], path = "../common" } +# substrate +sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } + [features] default = ["std"] std = [ diff --git a/runtime/darwinia/src/lib.rs b/runtime/darwinia/src/lib.rs index f45610bee..2f8a5d9cb 100644 --- a/runtime/darwinia/src/lib.rs +++ b/runtime/darwinia/src/lib.rs @@ -33,12 +33,11 @@ pub use bridges_message::*; mod weights; pub use darwinia_common_runtime::*; +pub use dc_primitives::*; pub use sp_consensus_aura::sr25519::AuthorityId as AuraId; // cumulus use cumulus_pallet_parachain_system::RelayNumberStrictlyIncreases; -// darwinia -use dc_primitives::*; // polkadot use xcm_executor::XcmExecutor; // substrate diff --git a/runtime/darwinia/tests/account_migration.rs b/runtime/darwinia/tests/account_migration.rs deleted file mode 100644 index 603f5e4d3..000000000 --- a/runtime/darwinia/tests/account_migration.rs +++ /dev/null @@ -1,330 +0,0 @@ -// This file is part of Darwinia. -// -// Copyright (C) 2018-2022 Darwinia Network -// SPDX-License-Identifier: GPL-3.0 -// -// Darwinia is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// Darwinia 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 Darwinia. If not, see . - -#![cfg(test)] - -mod mock; -use mock::*; - -// darwinia -use darwinia_deposit::Deposit; -use darwinia_runtime::*; -use darwinia_staking::Ledger; -use dc_primitives::AccountId; -// substrate -use frame_support::{ - assert_err, assert_ok, migration, traits::Get, Blake2_128Concat, StorageHasher, -}; -use frame_system::AccountInfo; -use pallet_assets::ExistenceReason; -use pallet_balances::AccountData; -use sp_core::{sr25519::Pair, Encode, Pair as PairT, H160}; -use sp_io::hashing::blake2_256; -use sp_runtime::{ - traits::ValidateUnsigned, - transaction_validity::{InvalidTransaction, TransactionValidityError}, - AccountId32, DispatchError, DispatchResult, -}; -use sp_version::RuntimeVersion; - -const RING_AMOUNT: u128 = 100; -const KTON_AMOUNT: u128 = 100; - -fn migrate(pair: Pair, to: AccountId, chain_id: u64, spec_name: &[u8]) -> DispatchResult { - let account_id = AccountId32::new(pair.public().0); - - let message = blake2_256( - &[ - &blake2_256(&[&chain_id.to_le_bytes(), spec_name, b"::account-migration"].concat()), - to.0.as_slice(), - ] - .concat(), - ); - let sig = pair.sign(&message); - - AccountMigration::pre_dispatch(&darwinia_account_migration::Call::migrate { - from: account_id.clone(), - to, - signature: sig.clone(), - }) - .map_err(|e| match e { - TransactionValidityError::Invalid(InvalidTransaction::Custom(e)) => - Box::leak(format!("err code: {}", e).into_boxed_str()), - e => <&'static str>::from(e), - })?; - AccountMigration::migrate(RuntimeOrigin::none(), account_id, to, sig) -} - -fn prepare_accounts(storage: bool) -> Pair { - let pair = Pair::from_seed(b"00000000000000000000000000000001"); - let account_id = AccountId32::new(pair.public().0); - - if storage { - >::insert( - account_id.clone(), - AccountInfo { - nonce: 100, - consumers: 1, - providers: 1, - sufficients: 1, - data: AccountData { free: RING_AMOUNT, ..Default::default() }, - }, - ); - - // The struct in the upstream repo is not accessible due to viable. - #[derive(Clone, Encode)] - pub struct AssetAccount { - pub balance: u128, - pub is_frozen: bool, - pub reason: ExistenceReason, - pub extra: (), - } - let asset_account = AssetAccount { - balance: KTON_AMOUNT, - is_frozen: false, - reason: ExistenceReason::::Sufficient, - extra: (), - }; - migration::put_storage_value( - b"AccountMigration", - b"KtonAccounts", - &Blake2_128Concat::hash(account_id.as_ref()), - asset_account.clone(), - ); - assert!(AccountMigration::account_of(account_id).is_some()); - } - pair -} - -#[test] -fn validate_substrate_account_not_found() { - ExtBuilder::default().build().execute_with(|| { - let to = H160::default(); - let pair = prepare_accounts(false); - - assert_err!( - migrate( - pair, - to.into(), - <::ChainId as Get>::get(), - <::Version as Get>::get() - .spec_name - .as_bytes() - ), - DispatchError::Other("err code: 1") // The migration source not exist. - ); - }); -} - -#[test] -fn validate_evm_account_already_exist() { - let to = H160::from_low_u64_be(33).into(); - ExtBuilder::default().with_balances(vec![(to, 100)]).build().execute_with(|| { - let pair = prepare_accounts(true); - - assert_err!( - migrate( - pair, - to, - <::ChainId as Get>::get(), - <::Version as Get>::get() - .spec_name - .as_bytes() - ), - DispatchError::Other("err code: 0") // To account has been used. - ); - }); -} - -#[test] -fn validate_invalid_sig() { - let to = H160::from_low_u64_be(33).into(); - ExtBuilder::default().build().execute_with(|| { - let pair = prepare_accounts(true); - - assert_err!( - migrate( - pair, - to, - <::ChainId as Get>::get() + 1, - <::Version as Get>::get() - .spec_name - .as_bytes() - ), - DispatchError::Other("err code: 2") // Invalid signature - ); - }); -} - -#[test] -fn migrate_accounts() { - let to = H160::from_low_u64_be(255).into(); - ExtBuilder::default().build().execute_with(|| { - let pair = prepare_accounts(true); - let account_id = AccountId32::new(pair.public().0); - - assert_ok!(migrate( - pair, - to, - <::ChainId as Get>::get(), - <::Version as Get>::get() - .spec_name - .as_bytes() - )); - assert_eq!(AccountMigration::account_of(account_id), None); - assert_eq!( - System::account(to), - AccountInfo { - nonce: 100, - consumers: 1, - providers: 1, - sufficients: 1, - data: AccountData { free: 100, ..Default::default() }, - } - ); - }); -} - -#[test] -fn migrate_kton_accounts() { - let to = H160::from_low_u64_be(255).into(); - ExtBuilder::default().build().execute_with(|| { - let pair = prepare_accounts(true); - let account_id = AccountId32::new(pair.public().0); - - assert_ok!(migrate( - pair, - to, - <::ChainId as Get>::get(), - <::Version as Get>::get() - .spec_name - .as_bytes() - )); - assert_eq!(AccountMigration::kton_account_of(account_id), None); - assert_eq!(Assets::maybe_balance(KTON_ID, to).unwrap(), KTON_AMOUNT); - }); -} - -#[test] -fn vesting() { - let to = H160::from_low_u64_be(255).into(); - ExtBuilder::default().build().execute_with(|| { - let pair = prepare_accounts(true); - let account_id = AccountId32::new(pair.public().0); - - // The struct in the upstream repo is not accessible due to viable. - #[derive(Encode)] - pub struct VestingInfo { - locked: u128, - per_block: u128, - starting_block: u32, - } - - migration::put_storage_value( - b"AccountMigration", - b"Vestings", - &Blake2_128Concat::hash(account_id.as_ref()), - vec![ - VestingInfo { locked: 100, per_block: 5, starting_block: 0 }, - VestingInfo { locked: 100, per_block: 5, starting_block: 0 }, - ], - ); - - assert_ok!(migrate( - pair, - to, - <::ChainId as Get>::get(), - <::Version as Get>::get() - .spec_name - .as_bytes() - )); - - assert_eq!(Vesting::vesting(to).unwrap().len(), 2); - assert_eq!(Balances::locks(to).len(), 1); - }); -} - -#[test] -fn staking() { - let init = H160::from_low_u64_be(254).into(); - let to = H160::from_low_u64_be(255).into(); - ExtBuilder::default() - .with_assets_accounts(vec![(KTON_ID, init, KTON_AMOUNT)]) - .build() - .execute_with(|| { - let pair = prepare_accounts(true); - let account_id = AccountId32::new(pair.public().0); - - >::insert( - account_id.clone(), - vec![ - Deposit { - id: 1, - value: 10, - start_time: 1000, - expired_time: 2000, - in_use: true, - }, - Deposit { - id: 2, - value: 10, - start_time: 1000, - expired_time: 2000, - in_use: true, - }, - ], - ); - - >::insert( - account_id.clone(), - Ledger { - staked_ring: 20, - staked_kton: 20, - staked_deposits: vec![].try_into().unwrap(), - unstaking_ring: vec![].try_into().unwrap(), - unstaking_kton: vec![].try_into().unwrap(), - unstaking_deposits: vec![].try_into().unwrap(), - }, - ); - - assert_ok!(migrate( - pair, - to, - <::ChainId as Get>::get(), - <::Version as Get>::get() - .spec_name - .as_bytes() - )); - - assert_eq!(Balances::free_balance(to), 60); - assert_eq!(Balances::free_balance(&darwinia_deposit::account_id::()), 20); - assert_eq!(Balances::free_balance(&darwinia_staking::account_id::()), 20); - - assert_eq!(darwinia_runtime::Deposit::deposit_of(to).unwrap().len(), 2); - - assert_eq!(Assets::maybe_balance(KTON_ID, to).unwrap(), 80); - assert_eq!( - Assets::maybe_balance(KTON_ID, darwinia_staking::account_id::()) - .unwrap(), - 20 - ); - - assert_eq!(darwinia_runtime::Staking::ledger_of(to).unwrap().staked_ring, 20); - assert_eq!(darwinia_runtime::Staking::ledger_of(to).unwrap().staked_kton, 20); - }); -} diff --git a/runtime/darwinia/tests/mock.rs b/runtime/darwinia/tests/mock.rs index 9b2503ae0..ce94f4be4 100644 --- a/runtime/darwinia/tests/mock.rs +++ b/runtime/darwinia/tests/mock.rs @@ -16,50 +16,50 @@ // You should have received a copy of the GNU General Public License // along with Darwinia. If not, see . -// darwinia -use darwinia_common_runtime::gov_origin::ROOT; -use darwinia_runtime::{Runtime, System}; -use dc_primitives::{AccountId, Balance}; -// parity +pub use darwinia_runtime::*; + +// substrate use frame_support::traits::GenesisBuild; use sp_io::TestExternalities; -pub(crate) const KTON_ID: u64 = 1026; +pub const KTON_ID: u64 = AssetIds::Kton as _; -#[derive(Default, Clone)] +#[derive(Clone, Default)] pub struct ExtBuilder { balances: Vec<(AccountId, Balance)>, assets_accounts: Vec<(u64, AccountId, Balance)>, } - impl ExtBuilder { + pub fn with_balances(&mut self, balances: Vec<(AccountId, Balance)>) -> &mut Self { + self.balances = balances; + + self + } + + pub fn with_assets_accounts(&mut self, accounts: Vec<(u64, AccountId, Balance)>) -> &mut Self { + self.assets_accounts = accounts; + + self + } + pub fn build(&mut self) -> TestExternalities { let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); pallet_balances::GenesisConfig:: { balances: self.balances.clone() } .assimilate_storage(&mut t) .unwrap(); - pallet_assets::GenesisConfig:: { assets: vec![(KTON_ID, ROOT, true, 1)], - metadata: vec![(KTON_ID, b"Test Commitment Token".to_vec(), b"TKTON".to_vec(), 18)], + metadata: vec![(KTON_ID, b"Darwinia Commitment Token".to_vec(), b"KTON".to_vec(), 18)], accounts: self.assets_accounts.clone(), } .assimilate_storage(&mut t) .unwrap(); let mut ext = TestExternalities::new(t); - ext.execute_with(|| System::set_block_number(1)); - ext - } - pub fn with_balances(&mut self, balances: Vec<(AccountId, Balance)>) -> &mut Self { - self.balances = balances; - self - } + ext.execute_with(|| System::set_block_number(1)); - pub fn with_assets_accounts(&mut self, accounts: Vec<(u64, AccountId, Balance)>) -> &mut Self { - self.assets_accounts = accounts; - self + ext } } diff --git a/runtime/darwinia/tests/tests.rs b/runtime/darwinia/tests/tests.rs new file mode 100644 index 000000000..43b5d3724 --- /dev/null +++ b/runtime/darwinia/tests/tests.rs @@ -0,0 +1,3 @@ +pub mod mock; + +darwinia_common_runtime::impl_account_migration_tests! {} diff --git a/runtime/pangolin/Cargo.toml b/runtime/pangolin/Cargo.toml index d6908fd55..aa619b242 100644 --- a/runtime/pangolin/Cargo.toml +++ b/runtime/pangolin/Cargo.toml @@ -127,6 +127,12 @@ frame-benchmarking = { optional = true, default-features = false, git = " frame-system-benchmarking = { optional = true, default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } frame-try-runtime = { optional = true, default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +[dev-dependencies] +# darwinia +darwinia-common-runtime = { features = ["test"], path = "../common" } +# substrate +sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } + [features] default = ["std"] std = [ diff --git a/runtime/pangolin/src/lib.rs b/runtime/pangolin/src/lib.rs index a4b055299..0ffadeb46 100644 --- a/runtime/pangolin/src/lib.rs +++ b/runtime/pangolin/src/lib.rs @@ -30,12 +30,11 @@ pub use pallets::*; mod weights; pub use darwinia_common_runtime::*; +pub use dc_primitives::*; pub use sp_consensus_aura::sr25519::AuthorityId as AuraId; // cumulus use cumulus_pallet_parachain_system::RelayNumberStrictlyIncreases; -// darwinia -use dc_primitives::*; // polkadot use xcm_executor::XcmExecutor; // substrate diff --git a/runtime/pangolin/tests/account_migration.rs b/runtime/pangolin/tests/account_migration.rs deleted file mode 100644 index 5edf31de6..000000000 --- a/runtime/pangolin/tests/account_migration.rs +++ /dev/null @@ -1,330 +0,0 @@ -// This file is part of Darwinia. -// -// Copyright (C) 2018-2022 Darwinia Network -// SPDX-License-Identifier: GPL-3.0 -// -// Darwinia is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// Darwinia 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 Darwinia. If not, see . - -#![cfg(test)] - -mod mock; -use mock::*; - -// darwinia -use darwinia_deposit::Deposit; -use darwinia_staking::Ledger; -use dc_primitives::AccountId; -use pangolin_runtime::*; -// substrate -use frame_support::{ - assert_err, assert_ok, migration, traits::Get, Blake2_128Concat, StorageHasher, -}; -use frame_system::AccountInfo; -use pallet_assets::ExistenceReason; -use pallet_balances::AccountData; -use sp_core::{sr25519::Pair, Encode, Pair as PairT, H160}; -use sp_io::hashing::blake2_256; -use sp_runtime::{ - traits::ValidateUnsigned, - transaction_validity::{InvalidTransaction, TransactionValidityError}, - AccountId32, DispatchError, DispatchResult, -}; -use sp_version::RuntimeVersion; - -const RING_AMOUNT: u128 = 100; -const KTON_AMOUNT: u128 = 100; - -fn migrate(pair: Pair, to: AccountId, chain_id: u64, spec_name: &[u8]) -> DispatchResult { - let account_id = AccountId32::new(pair.public().0); - - let message = blake2_256( - &[ - &blake2_256(&[&chain_id.to_le_bytes(), spec_name, b"::account-migration"].concat()), - to.0.as_slice(), - ] - .concat(), - ); - let sig = pair.sign(&message); - - AccountMigration::pre_dispatch(&darwinia_account_migration::Call::migrate { - from: account_id.clone(), - to, - signature: sig.clone(), - }) - .map_err(|e| match e { - TransactionValidityError::Invalid(InvalidTransaction::Custom(e)) => - Box::leak(format!("err code: {}", e).into_boxed_str()), - e => <&'static str>::from(e), - })?; - AccountMigration::migrate(RuntimeOrigin::none(), account_id, to, sig) -} - -fn prepare_accounts(storage: bool) -> Pair { - let pair = Pair::from_seed(b"00000000000000000000000000000001"); - let account_id = AccountId32::new(pair.public().0); - - if storage { - >::insert( - account_id.clone(), - AccountInfo { - nonce: 100, - consumers: 1, - providers: 1, - sufficients: 1, - data: AccountData { free: RING_AMOUNT, ..Default::default() }, - }, - ); - - // The struct in the upstream repo is not accessible due to viable. - #[derive(Clone, Encode)] - pub struct AssetAccount { - pub balance: u128, - pub is_frozen: bool, - pub reason: ExistenceReason, - pub extra: (), - } - let asset_account = AssetAccount { - balance: KTON_AMOUNT, - is_frozen: false, - reason: ExistenceReason::::Sufficient, - extra: (), - }; - migration::put_storage_value( - b"AccountMigration", - b"KtonAccounts", - &Blake2_128Concat::hash(account_id.as_ref()), - asset_account.clone(), - ); - assert!(AccountMigration::account_of(account_id).is_some()); - } - pair -} - -#[test] -fn validate_substrate_account_not_found() { - ExtBuilder::default().build().execute_with(|| { - let to = H160::default(); - let pair = prepare_accounts(false); - - assert_err!( - migrate( - pair, - to.into(), - <::ChainId as Get>::get(), - <::Version as Get>::get() - .spec_name - .as_bytes() - ), - DispatchError::Other("err code: 1") // The migration source not exist. - ); - }); -} - -#[test] -fn validate_evm_account_already_exist() { - let to = H160::from_low_u64_be(33).into(); - ExtBuilder::default().with_balances(vec![(to, 100)]).build().execute_with(|| { - let pair = prepare_accounts(true); - - assert_err!( - migrate( - pair, - to, - <::ChainId as Get>::get(), - <::Version as Get>::get() - .spec_name - .as_bytes() - ), - DispatchError::Other("err code: 0") // To account has been used. - ); - }); -} - -#[test] -fn validate_invalid_sig() { - let to = H160::from_low_u64_be(33).into(); - ExtBuilder::default().build().execute_with(|| { - let pair = prepare_accounts(true); - - assert_err!( - migrate( - pair, - to, - <::ChainId as Get>::get() + 1, - <::Version as Get>::get() - .spec_name - .as_bytes() - ), - DispatchError::Other("err code: 2") // Invalid signature - ); - }); -} - -#[test] -fn migrate_accounts() { - let to = H160::from_low_u64_be(255).into(); - ExtBuilder::default().build().execute_with(|| { - let pair = prepare_accounts(true); - let account_id = AccountId32::new(pair.public().0); - - assert_ok!(migrate( - pair, - to, - <::ChainId as Get>::get(), - <::Version as Get>::get() - .spec_name - .as_bytes() - )); - assert_eq!(AccountMigration::account_of(account_id), None); - assert_eq!( - System::account(to), - AccountInfo { - nonce: 100, - consumers: 1, - providers: 1, - sufficients: 1, - data: AccountData { free: 100, ..Default::default() }, - } - ); - }); -} - -#[test] -fn migrate_kton_accounts() { - let to = H160::from_low_u64_be(255).into(); - ExtBuilder::default().build().execute_with(|| { - let pair = prepare_accounts(true); - let account_id = AccountId32::new(pair.public().0); - - assert_ok!(migrate( - pair, - to, - <::ChainId as Get>::get(), - <::Version as Get>::get() - .spec_name - .as_bytes() - )); - assert_eq!(AccountMigration::kton_account_of(account_id), None); - assert_eq!(Assets::maybe_balance(KTON_ID, to).unwrap(), KTON_AMOUNT); - }); -} - -#[test] -fn vesting() { - let to = H160::from_low_u64_be(255).into(); - ExtBuilder::default().build().execute_with(|| { - let pair = prepare_accounts(true); - let account_id = AccountId32::new(pair.public().0); - - // The struct in the upstream repo is not accessible due to viable. - #[derive(Encode)] - pub struct VestingInfo { - locked: u128, - per_block: u128, - starting_block: u32, - } - - migration::put_storage_value( - b"AccountMigration", - b"Vestings", - &Blake2_128Concat::hash(account_id.as_ref()), - vec![ - VestingInfo { locked: 100, per_block: 5, starting_block: 0 }, - VestingInfo { locked: 100, per_block: 5, starting_block: 0 }, - ], - ); - - assert_ok!(migrate( - pair, - to, - <::ChainId as Get>::get(), - <::Version as Get>::get() - .spec_name - .as_bytes() - )); - - assert_eq!(Vesting::vesting(to).unwrap().len(), 2); - assert_eq!(Balances::locks(to).len(), 1); - }); -} - -#[test] -fn staking() { - let init = H160::from_low_u64_be(254).into(); - let to = H160::from_low_u64_be(255).into(); - ExtBuilder::default() - .with_assets_accounts(vec![(KTON_ID, init, KTON_AMOUNT)]) - .build() - .execute_with(|| { - let pair = prepare_accounts(true); - let account_id = AccountId32::new(pair.public().0); - - >::insert( - account_id.clone(), - vec![ - Deposit { - id: 1, - value: 10, - start_time: 1000, - expired_time: 2000, - in_use: true, - }, - Deposit { - id: 2, - value: 10, - start_time: 1000, - expired_time: 2000, - in_use: true, - }, - ], - ); - - >::insert( - account_id.clone(), - Ledger { - staked_ring: 20, - staked_kton: 20, - staked_deposits: vec![].try_into().unwrap(), - unstaking_ring: vec![].try_into().unwrap(), - unstaking_kton: vec![].try_into().unwrap(), - unstaking_deposits: vec![].try_into().unwrap(), - }, - ); - - assert_ok!(migrate( - pair, - to, - <::ChainId as Get>::get(), - <::Version as Get>::get() - .spec_name - .as_bytes() - )); - - assert_eq!(Balances::free_balance(to), 60); - assert_eq!(Balances::free_balance(&darwinia_deposit::account_id::()), 20); - assert_eq!(Balances::free_balance(&darwinia_staking::account_id::()), 20); - - assert_eq!(pangolin_runtime::Deposit::deposit_of(to).unwrap().len(), 2); - - assert_eq!(Assets::maybe_balance(KTON_ID, to).unwrap(), 80); - assert_eq!( - Assets::maybe_balance(KTON_ID, darwinia_staking::account_id::()) - .unwrap(), - 20 - ); - - assert_eq!(pangolin_runtime::Staking::ledger_of(to).unwrap().staked_ring, 20); - assert_eq!(pangolin_runtime::Staking::ledger_of(to).unwrap().staked_kton, 20); - }); -} diff --git a/runtime/pangolin/tests/mock.rs b/runtime/pangolin/tests/mock.rs index bf14d351e..6daa27e82 100644 --- a/runtime/pangolin/tests/mock.rs +++ b/runtime/pangolin/tests/mock.rs @@ -16,50 +16,50 @@ // You should have received a copy of the GNU General Public License // along with Darwinia. If not, see . -// darwinia -use darwinia_common_runtime::gov_origin::ROOT; -use dc_primitives::{AccountId, Balance}; -use pangolin_runtime::{Runtime, System}; -// parity +pub use pangolin_runtime::*; + +// substrate use frame_support::traits::GenesisBuild; use sp_io::TestExternalities; -pub(crate) const KTON_ID: u64 = 1026; +pub const KTON_ID: u64 = AssetIds::PKton as _; -#[derive(Default, Clone)] +#[derive(Clone, Default)] pub struct ExtBuilder { balances: Vec<(AccountId, Balance)>, assets_accounts: Vec<(u64, AccountId, Balance)>, } - impl ExtBuilder { + pub fn with_balances(&mut self, balances: Vec<(AccountId, Balance)>) -> &mut Self { + self.balances = balances; + + self + } + + pub fn with_assets_accounts(&mut self, accounts: Vec<(u64, AccountId, Balance)>) -> &mut Self { + self.assets_accounts = accounts; + + self + } + pub fn build(&mut self) -> TestExternalities { let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); pallet_balances::GenesisConfig:: { balances: self.balances.clone() } .assimilate_storage(&mut t) .unwrap(); - pallet_assets::GenesisConfig:: { assets: vec![(KTON_ID, ROOT, true, 1)], - metadata: vec![(KTON_ID, b"Test Commitment Token".to_vec(), b"TKTON".to_vec(), 18)], + metadata: vec![(KTON_ID, b"Pangolin Commitment Token".to_vec(), b"PKTON".to_vec(), 18)], accounts: self.assets_accounts.clone(), } .assimilate_storage(&mut t) .unwrap(); let mut ext = TestExternalities::new(t); - ext.execute_with(|| System::set_block_number(1)); - ext - } - pub fn with_balances(&mut self, balances: Vec<(AccountId, Balance)>) -> &mut Self { - self.balances = balances; - self - } + ext.execute_with(|| System::set_block_number(1)); - pub fn with_assets_accounts(&mut self, accounts: Vec<(u64, AccountId, Balance)>) -> &mut Self { - self.assets_accounts = accounts; - self + ext } } diff --git a/runtime/pangolin/tests/tests.rs b/runtime/pangolin/tests/tests.rs new file mode 100644 index 000000000..43b5d3724 --- /dev/null +++ b/runtime/pangolin/tests/tests.rs @@ -0,0 +1,3 @@ +pub mod mock; + +darwinia_common_runtime::impl_account_migration_tests! {} From 9c05f5519286d269b17110b153619d7bf8f69fb4 Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Fri, 13 Jan 2023 11:44:52 +0800 Subject: [PATCH 098/189] Test only code (#206) --- runtime/common/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/common/src/lib.rs b/runtime/common/src/lib.rs index 155449da8..4a070a3ef 100644 --- a/runtime/common/src/lib.rs +++ b/runtime/common/src/lib.rs @@ -27,7 +27,7 @@ pub use bp_darwinia_core as bp_crab; pub use bp_darwinia_core as bp_darwinia; pub use bp_darwinia_core as bp_pangolin; -// #[cfg(feature = "test")] +#[cfg(feature = "test")] pub mod test; // darwinia From 93171659c4f68fd27ae1dd2ab05159b7538294a8 Mon Sep 17 00:00:00 2001 From: bear Date: Fri, 13 Jan 2023 17:59:43 +0800 Subject: [PATCH 099/189] Fix precompiles genesis (#207) * Tweak the genesis config * Add tests --- node/src/chain_spec/crab.rs | 29 +++++++++++++++++------------ node/src/chain_spec/darwinia.rs | 29 +++++++++++++++++------------ node/src/chain_spec/pangolin.rs | 29 +++++++++++++++++------------ runtime/common/src/test.rs | 5 +---- tool/state-processor/src/tests.rs | 16 +++++++++++++++- 5 files changed, 67 insertions(+), 41 deletions(-) diff --git a/node/src/chain_spec/crab.rs b/node/src/chain_spec/crab.rs index f04cd8b46..071eb1d77 100644 --- a/node/src/chain_spec/crab.rs +++ b/node/src/chain_spec/crab.rs @@ -199,7 +199,23 @@ pub fn genesis_config() -> ChainSpec { // EVM stuff. ethereum: Default::default(), - evm: Default::default(), + evm: EvmConfig { + accounts: { + BTreeMap::from_iter( + CrabPrecompiles::::used_addresses().iter().map(|p| { + ( + p.to_owned(), + GenesisAccount { + nonce: Default::default(), + balance: Default::default(), + storage: Default::default(), + code: REVERT_BYTECODE.to_vec(), + }, + ) + }), + ) + }, + }, base_fee: Default::default(), // S2S stuff. @@ -310,17 +326,6 @@ fn testnet_genesis( ) }) .chain([ - // Testing account. - ( - H160::from_str("0x6be02d1d3665660d22ff9624b7be0551ee1ac91b") - .unwrap(), - GenesisAccount { - balance: (10_000_000 * UNIT).into(), - code: Default::default(), - nonce: Default::default(), - storage: Default::default(), - }, - ), // Benchmarking account. ( H160::from_str("1000000000000000000000000000000000000001").unwrap(), diff --git a/node/src/chain_spec/darwinia.rs b/node/src/chain_spec/darwinia.rs index 4c7f20b75..bb2607779 100644 --- a/node/src/chain_spec/darwinia.rs +++ b/node/src/chain_spec/darwinia.rs @@ -199,7 +199,23 @@ pub fn genesis_config() -> ChainSpec { // EVM stuff. ethereum: Default::default(), - evm: Default::default(), + evm: EvmConfig { + accounts: { + BTreeMap::from_iter( + DarwiniaPrecompiles::::used_addresses().iter().map(|p| { + ( + p.to_owned(), + GenesisAccount { + nonce: Default::default(), + balance: Default::default(), + storage: Default::default(), + code: REVERT_BYTECODE.to_vec(), + }, + ) + }), + ) + }, + }, base_fee: Default::default(), // S2S stuff. @@ -310,17 +326,6 @@ fn testnet_genesis( ) }) .chain([ - // Testing account. - ( - H160::from_str("0x6be02d1d3665660d22ff9624b7be0551ee1ac91b") - .unwrap(), - GenesisAccount { - balance: (10_000_000 * UNIT).into(), - code: Default::default(), - nonce: Default::default(), - storage: Default::default(), - }, - ), // Benchmarking account. ( H160::from_str("1000000000000000000000000000000000000001").unwrap(), diff --git a/node/src/chain_spec/pangolin.rs b/node/src/chain_spec/pangolin.rs index c3801eb0f..d178d9008 100644 --- a/node/src/chain_spec/pangolin.rs +++ b/node/src/chain_spec/pangolin.rs @@ -199,7 +199,23 @@ pub fn genesis_config() -> ChainSpec { // EVM stuff. ethereum: Default::default(), - evm: Default::default(), + evm: EvmConfig { + accounts: { + BTreeMap::from_iter( + PangolinPrecompiles::::used_addresses().iter().map(|p| { + ( + p.to_owned(), + GenesisAccount { + nonce: Default::default(), + balance: Default::default(), + storage: Default::default(), + code: REVERT_BYTECODE.to_vec(), + }, + ) + }), + ) + }, + }, base_fee: Default::default(), } }, @@ -304,17 +320,6 @@ fn testnet_genesis( ) }) .chain([ - // Testing account. - ( - H160::from_str("0x6be02d1d3665660d22ff9624b7be0551ee1ac91b") - .unwrap(), - GenesisAccount { - balance: (10_000_000 * UNIT).into(), - code: Default::default(), - nonce: Default::default(), - storage: Default::default(), - }, - ), // Benchmarking account. ( H160::from_str("1000000000000000000000000000000000000001").unwrap(), diff --git a/runtime/common/src/test.rs b/runtime/common/src/test.rs index d64250990..4c16c241a 100644 --- a/runtime/common/src/test.rs +++ b/runtime/common/src/test.rs @@ -205,10 +205,7 @@ macro_rules! impl_account_migration_tests { assert_ok!(migrate(from, to)); assert_eq!(AccountMigration::kton_account_of(from_pk), None); - assert_eq!( - Assets::maybe_balance(KTON_ID, to).unwrap(), - KTON_AMOUNT - ); + assert_eq!(Assets::maybe_balance(KTON_ID, to).unwrap(), KTON_AMOUNT); }); } diff --git a/tool/state-processor/src/tests.rs b/tool/state-processor/src/tests.rs index bf38758c8..92bd01f76 100644 --- a/tool/state-processor/src/tests.rs +++ b/tool/state-processor/src/tests.rs @@ -339,7 +339,21 @@ fn evm_code_migrate() { } { - assert_eq!(tester.solo_evm_codes, tester.shell_evm_codes); + tester.solo_evm_codes.iter().for_each(|(k, v)| { + assert_eq!(tester.shell_evm_codes.get(k), Some(v)); + }); + } + }); +} + +#[test] +fn precompiles_code_should_work() { + run_test(|tester| { + let addrs = ["001", "009", "400", "402", "600", "601"]; + + for i in addrs { + let addr = format!("{}{i}", "0x0000000000000000000000000000000000000"); + assert_eq!(tester.shell_evm_codes.get(&addr), Some(&[96, 0, 96, 0, 253].to_vec())); } }); } From 0c7cfa0cdbf21615dd599cb5fe94a1f33ccab9cd Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Sat, 14 Jan 2023 02:26:25 +0800 Subject: [PATCH 100/189] Use check runtime action (#208) * Use check runtime action * Try * Try Signed-off-by: Xavier Lau * Test all runtimes Signed-off-by: Xavier Lau * Done * Remove compress step * Remove unused env var Signed-off-by: Xavier Lau --- .github/workflows/checks.yml | 95 +++++++----------------------------- 1 file changed, 17 insertions(+), 78 deletions(-) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 8f3351088..0e2529179 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -23,7 +23,6 @@ on: env: GITHUB_CACHE_VERSION: 0 - RUST_TOOLCHAIN: nightly RUST_BACKTRACE: full RUSTC_WRAPPER: sccache @@ -31,8 +30,6 @@ env: SCCACHE_VERSION: v0.3.0 SCCACHE_DIR: /home/runner/.cache/sccache - SUBALFRED_LINK: https://github.com/hack-ink/subalfred/releases/latest/download/subalfred-x86_64-unknown-linux-gnu.zst - jobs: basic-checks: name: Task ${{ matrix.action }} darwinia @@ -41,15 +38,9 @@ jobs: strategy: matrix: action: [build, test] - steps: - name: Setup build environment run: sudo apt install -y protobuf-compiler - - name: Install Rust ${{ env.RUST_TOOLCHAIN }} toolchain - uses: actions-rs/toolchain@v1 - with: - toolchain: ${{ env.RUST_TOOLCHAIN }} - default: true - name: Install Sccache run: | export SCCACHE_FILE=sccache-${{ env.SCCACHE_VERSION }}-x86_64-unknown-linux-musl @@ -78,17 +69,15 @@ jobs: with: command: ${{ matrix.action }} args: --release --locked --features all-native - - name: Compress + - name: Change path if: matrix.action != 'test' - run: | - mv target/release/darwinia . - tar cf darwinia.tar.zst darwinia -I pzstd + run: mv target/release/darwinia . - name: Upload if: matrix.action != 'test' uses: actions/upload-artifact@v2 with: name: darwinia - path: darwinia.tar.zst + path: darwinia - name: Shrink cache run: .github/shrink-cache.sh @@ -106,75 +95,25 @@ jobs: path: ${{ matrix.runtime }} runtime-checks: - name: Task check runtime + name: Task check runtimes if: github.event_name == 'push' || !github.event.pull_request.draft + strategy: + matrix: + target: + [ + { chain: darwinia-dev, compare-with: "https://rpc.polkadot.io" }, + { chain: crab-dev, compare-with: "https://rpc.polkadot.io" }, + { chain: pangolin-dev, compare-with: "https://rpc.polkadot.io" }, + ] needs: [basic-checks] runs-on: ubuntu-latest steps: - - name: Install Subalfred - run: | - curl -L ${{ env.SUBALFRED_LINK }} | zstd -o subalfred -d - chmod u+x subalfred - sudo mv subalfred /usr/bin - sudo chmod u+x /usr/bin/subalfred - - name: Download darwinia - uses: actions/download-artifact@v2 + - name: Check ${{ matrix.target.chain }} + uses: hack-ink/subalfred-check-runtime-action@v0.1.8 with: - name: darwinia - - name: Install darwinia - run: | - tar xf darwinia.tar.zst -I pzstd - sudo mv darwinia /usr/bin - - id: check-crab-runtime-version - name: Check Crab runtime version - run: | - OUTPUT=$(subalfred check runtime --executable darwinia --chain crab-dev --live https://rpc.polkadot.io --property version) - OUTPUT="${OUTPUT//'%'/'%25'}​" - OUTPUT="${OUTPUT//$'\n'/'%0A'}" - OUTPUT="${OUTPUT//$'\r'/'%0D'}" - echo "::set-output name=check-crab-runtime-version::$OUTPUT" - - id: check-crab-runtime-storage - name: Check Crab runtime storage - run: | - OUTPUT=$(subalfred check runtime --executable darwinia --chain crab-dev --live https://rpc.polkadot.io --property storage) - OUTPUT="${OUTPUT//'%'/'%25'}​" - OUTPUT="${OUTPUT//$'\n'/'%0A'}" - OUTPUT="${OUTPUT//$'\r'/'%0D'}" - echo "::set-output name=check-crab-runtime-storage::$OUTPUT" - - id: check-darwinia-runtime-version - name: Check Darwinia runtime version - run: | - OUTPUT=$(subalfred check runtime --executable darwinia --chain darwinia-dev --live https://rpc.polkadot.io --property version) - OUTPUT="${OUTPUT//'%'/'%25'}​" - OUTPUT="${OUTPUT//$'\n'/'%0A'}" - OUTPUT="${OUTPUT//$'\r'/'%0D'}" - echo "::set-output name=check-darwinia-runtime-version::$OUTPUT" - - id: check-darwinia-runtime-storage - name: Check Darwinia runtime storage - run: | - OUTPUT=$(subalfred check runtime --executable darwinia --chain darwinia-dev --live https://rpc.polkadot.io --property storage) - OUTPUT="${OUTPUT//'%'/'%25'}​" - OUTPUT="${OUTPUT//$'\n'/'%0A'}" - OUTPUT="${OUTPUT//$'\r'/'%0D'}" - echo "::set-output name=check-darwinia-runtime-storage::$OUTPUT" - - if: github.ref != 'refs/heads/master' - uses: marocchino/sticky-pull-request-comment@v2 - with: - append: true - message: | -

- Commit ${{ github.event.pull_request.head.sha }} - - **Darwinia** - > Check Runtime Version - ```diff - ${{ steps.check-darwinia-runtime-version.outputs.check-darwinia-runtime-version }} - ``` - > Check Storage Prefix - ```diff - ${{ steps.check-darwinia-runtime-storage.outputs.check-darwinia-runtime-storage }} - ``` -
+ uploaded-artifact: darwinia + chain: ${{ matrix.target.chain }} + compare-with: ${{ matrix.target.compare-with }} checks-cleaning: name: Task checks cleaning From a32342f9ddbd26a68f48c8add964e667cf8e3b60 Mon Sep 17 00:00:00 2001 From: Guantong Date: Mon, 16 Jan 2023 10:03:57 +0800 Subject: [PATCH 101/189] To `polkadot-v0.9.33` and some other changes (#171) * Anchor polkadot-v0.9.33 * Companion for paritytech/cumulus#1685 * Companion for paritytech/cumulus#1585 * Companion for paritytech/cumulus#1745 * Companion for paritytech/cumulus#1759 * Companion for paritytech/cumulus#1782 * Companion for paritytech/cumulus#1793 * Companion for paritytech/cumulus#1808 * Temp use prepare branch of messages-substrate * Use darwinia fork frontier * Use correct moonbeam substrate commit * Correct bp-darwinia-core std * Use prepare moonbeam v0.9.33 * Update ethereum to 0.14.0 * Companion for paritytech/substrate#11649, paritytech/polkadot#5729 democracy * Companion for paritytech/substrate#11649, paritytech/polkadot#5729 scheduler * Companion for paritytech/substrate#11649, paritytech/polkadot#5729 preimage * Companion for paritytech/substrate#12109 * Type create origin * Format * Fix type CreateOrigin * Format * Companion for paritytech/frontier#935 * Fix compile * Fix service * Format * `Frontier` upgrade (#196) * Delete BaseFee * Fix todo * Update prepare branch * Fix mock * Add pallet-evm-precompile-dispatch/std * Format * Format * Correct version after merge * Fix review * Fix review * Fix CI test * Fix compile after merge Co-authored-by: bear --- Cargo.lock | 2178 +++++++++--------- core/inflation/Cargo.toml | 2 +- core/primitives/Cargo.toml | 7 +- node/Cargo.toml | 136 +- node/src/chain_spec/crab.rs | 2 - node/src/chain_spec/darwinia.rs | 2 - node/src/chain_spec/pangolin.rs | 2 - node/src/cli.rs | 27 +- node/src/command.rs | 52 +- node/src/service/mod.rs | 58 +- pallet/account-migration/Cargo.toml | 18 +- pallet/deposit/Cargo.toml | 18 +- pallet/deposit/tests/mock.rs | 3 + pallet/ecdsa-authority/Cargo.toml | 14 +- pallet/message-gadget/Cargo.toml | 18 +- pallet/message-transact/Cargo.toml | 40 +- pallet/message-transact/src/tests/eip1559.rs | 3 +- pallet/message-transact/src/tests/eip2930.rs | 2 +- pallet/message-transact/src/tests/legacy.rs | 2 +- pallet/staking/Cargo.toml | 24 +- pallet/staking/tests/mock.rs | 3 + precompile/assets/Cargo.toml | 28 +- precompile/assets/src/mock.rs | 3 + precompile/bls12-381/Cargo.toml | 24 +- precompile/deposit/Cargo.toml | 24 +- precompile/dispatch/Cargo.toml | 37 - precompile/dispatch/src/lib.rs | 93 - precompile/staking/Cargo.toml | 26 +- precompile/state-storage/Cargo.toml | 24 +- runtime/common/Cargo.toml | 25 +- runtime/crab/Cargo.toml | 167 +- runtime/crab/src/lib.rs | 9 +- runtime/crab/src/pallets/assets.rs | 7 +- runtime/crab/src/pallets/base_fee.rs | 47 - runtime/crab/src/pallets/democracy.rs | 6 +- runtime/crab/src/pallets/evm.rs | 2 +- runtime/crab/src/pallets/mod.rs | 2 - runtime/crab/src/pallets/multisig.rs | 2 +- runtime/crab/src/pallets/preimage.rs | 3 +- runtime/crab/src/pallets/scheduler.rs | 3 +- runtime/crab/src/pallets/system.rs | 5 +- runtime/crab/src/pallets/vesting.rs | 6 + runtime/darwinia/Cargo.toml | 167 +- runtime/darwinia/src/lib.rs | 10 +- runtime/darwinia/src/pallets/assets.rs | 7 +- runtime/darwinia/src/pallets/base_fee.rs | 47 - runtime/darwinia/src/pallets/democracy.rs | 6 +- runtime/darwinia/src/pallets/evm.rs | 2 +- runtime/darwinia/src/pallets/mod.rs | 2 - runtime/darwinia/src/pallets/multisig.rs | 2 +- runtime/darwinia/src/pallets/preimage.rs | 3 +- runtime/darwinia/src/pallets/scheduler.rs | 3 +- runtime/darwinia/src/pallets/system.rs | 5 +- runtime/darwinia/src/pallets/vesting.rs | 6 + runtime/pangolin/Cargo.toml | 165 +- runtime/pangolin/src/lib.rs | 10 +- runtime/pangolin/src/pallets/assets.rs | 7 +- runtime/pangolin/src/pallets/base_fee.rs | 47 - runtime/pangolin/src/pallets/democracy.rs | 6 +- runtime/pangolin/src/pallets/evm.rs | 2 +- runtime/pangolin/src/pallets/mod.rs | 2 - runtime/pangolin/src/pallets/multisig.rs | 2 +- runtime/pangolin/src/pallets/preimage.rs | 3 +- runtime/pangolin/src/pallets/scheduler.rs | 3 +- runtime/pangolin/src/pallets/system.rs | 5 +- runtime/pangolin/src/pallets/vesting.rs | 6 + 66 files changed, 1677 insertions(+), 1995 deletions(-) delete mode 100644 precompile/dispatch/Cargo.toml delete mode 100644 precompile/dispatch/src/lib.rs delete mode 100644 runtime/crab/src/pallets/base_fee.rs delete mode 100644 runtime/darwinia/src/pallets/base_fee.rs delete mode 100644 runtime/pangolin/src/pallets/base_fee.rs diff --git a/Cargo.lock b/Cargo.lock index e40761dbe..174ba26f3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -15,17 +15,17 @@ dependencies = [ [[package]] name = "account" version = "0.1.1" -source = "git+https://github.com/darwinia-network/moonbeam?branch=polkadot-v0.9.30#9d31c6120bb0f317053da9cac7fe7cd2a44f844c" +source = "git+https://github.com/darwinia-network/moonbeam?branch=polkadot-v0.9.33#4ea11a7b2b71e0f4f6d100f5fa04e0f3ea285895" dependencies = [ "blake2-rfc", "hex", - "impl-serde", - "libsecp256k1 0.6.0", + "impl-serde 0.3.2", + "libsecp256k1 0.7.1", "log", "parity-scale-codec", "scale-info", "serde", - "sha3 0.9.1", + "sha3 0.10.6", "sp-core", "sp-io", "sp-runtime", @@ -72,8 +72,8 @@ version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e8b47f52ea9bae42228d07ec09eb676433d7c4ed1ebdf0f1d1c29ed446f1ab8" dependencies = [ - "cfg-if 1.0.0", - "cipher 0.3.0", + "cfg-if", + "cipher", "cpufeatures", "opaque-debug 0.3.0", ] @@ -86,7 +86,7 @@ checksum = "df5f85a83a7d8b0442b6aa7b504b8212c1733da07b98aae43d4bc21b2cb3cdf6" dependencies = [ "aead", "aes", - "cipher 0.3.0", + "cipher", "ctr", "ghash", "subtle", @@ -306,7 +306,7 @@ dependencies = [ "async-lock", "autocfg", "blocking", - "cfg-if 1.0.0", + "cfg-if", "event-listener", "futures-lite", "libc", @@ -344,9 +344,9 @@ dependencies = [ [[package]] name = "async-std-resolver" -version = "0.21.2" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f2f8a4a203be3325981310ab243a28e6e4ea55b6519bffce05d41ab60e09ad8" +checksum = "6ba50e24d9ee0a8950d3d03fc6d0dd10aa14b5de3b101949b4e160f7fee7c723" dependencies = [ "async-std", "async-trait", @@ -406,9 +406,9 @@ dependencies = [ [[package]] name = "auto_impl" -version = "0.5.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7862e21c893d65a1650125d157eaeec691439379a1cee17ee49031b79236ada4" +checksum = "8a8c1df849285fbacd587de7818cc7d13be6cd2cbcd47a04fb1801b0e2706e33" dependencies = [ "proc-macro-error", "proc-macro2", @@ -444,7 +444,7 @@ checksum = "233d376d6d185f2a3093e58f283f60f880315b6c60075b01f36b3b85154564ca" dependencies = [ "addr2line 0.19.0", "cc", - "cfg-if 1.0.0", + "cfg-if", "libc", "miniz_oxide", "object 0.30.0", @@ -499,7 +499,7 @@ dependencies = [ [[package]] name = "beefy-gadget" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "array-bytes 4.2.0", "async-trait", @@ -536,7 +536,7 @@ dependencies = [ [[package]] name = "beefy-gadget-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "beefy-gadget", "beefy-primitives", @@ -556,32 +556,30 @@ dependencies = [ [[package]] name = "beefy-merkle-tree" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "beefy-primitives", "sp-api", + "sp-runtime", ] [[package]] name = "beefy-primitives" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "parity-scale-codec", "scale-info", + "serde", "sp-api", "sp-application-crypto", "sp-core", + "sp-io", + "sp-mmr-primitives", "sp-runtime", "sp-std", ] -[[package]] -name = "bimap" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc0455254eb5c6964c4545d8bac815e1a1be4f3afe0ae695ea539c12d728d44b" - [[package]] name = "bincode" version = "1.3.3" @@ -593,9 +591,9 @@ dependencies = [ [[package]] name = "bindgen" -version = "0.59.2" +version = "0.60.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bd2a9a458e8f4304c52c43ebb0cfbd520289f8379a52e329a38afda99bf8eb8" +checksum = "062dddbc1ba4aca46de6338e2bf87771414c335f7b2f2036e8f3e9befebf88e6" dependencies = [ "bitflags", "cexpr", @@ -678,7 +676,7 @@ dependencies = [ "arrayref", "arrayvec 0.7.2", "cc", - "cfg-if 1.0.0", + "cfg-if", "constant_time_eq 0.2.4", "digest 0.10.6", ] @@ -755,7 +753,7 @@ dependencies = [ [[package]] name = "bp-darwinia-core" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.30#dd55c3dbc30f54e93fc231e9161a810153a8c266" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.33#f98feb62bcf0a0e5b4b971e9ba22640e4bce625f" dependencies = [ "account", "bp-messages", @@ -772,7 +770,7 @@ dependencies = [ [[package]] name = "bp-header-chain" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.30#dd55c3dbc30f54e93fc231e9161a810153a8c266" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.33#f98feb62bcf0a0e5b4b971e9ba22640e4bce625f" dependencies = [ "bp-runtime", "finality-grandpa", @@ -789,7 +787,7 @@ dependencies = [ [[package]] name = "bp-message-dispatch" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.30#dd55c3dbc30f54e93fc231e9161a810153a8c266" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.33#f98feb62bcf0a0e5b4b971e9ba22640e4bce625f" dependencies = [ "bp-runtime", "frame-support", @@ -802,7 +800,7 @@ dependencies = [ [[package]] name = "bp-messages" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.30#dd55c3dbc30f54e93fc231e9161a810153a8c266" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.33#f98feb62bcf0a0e5b4b971e9ba22640e4bce625f" dependencies = [ "bitvec", "bp-runtime", @@ -819,7 +817,7 @@ dependencies = [ [[package]] name = "bp-parachains" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.30#dd55c3dbc30f54e93fc231e9161a810153a8c266" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.33#f98feb62bcf0a0e5b4b971e9ba22640e4bce625f" dependencies = [ "bp-polkadot-core", "bp-runtime", @@ -832,7 +830,7 @@ dependencies = [ [[package]] name = "bp-polkadot-core" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.30#dd55c3dbc30f54e93fc231e9161a810153a8c266" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.33#f98feb62bcf0a0e5b4b971e9ba22640e4bce625f" dependencies = [ "bp-messages", "bp-runtime", @@ -852,7 +850,7 @@ dependencies = [ [[package]] name = "bp-runtime" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.30#dd55c3dbc30f54e93fc231e9161a810153a8c266" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.33#f98feb62bcf0a0e5b4b971e9ba22640e4bce625f" dependencies = [ "frame-support", "frame-system", @@ -873,7 +871,7 @@ dependencies = [ [[package]] name = "bp-test-utils" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.30#dd55c3dbc30f54e93fc231e9161a810153a8c266" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.33#f98feb62bcf0a0e5b4b971e9ba22640e4bce625f" dependencies = [ "bp-header-chain", "ed25519-dalek", @@ -888,8 +886,9 @@ dependencies = [ [[package]] name = "bridge-runtime-common" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.30#dd55c3dbc30f54e93fc231e9161a810153a8c266" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.33#f98feb62bcf0a0e5b4b971e9ba22640e4bce625f" dependencies = [ + "bp-header-chain", "bp-message-dispatch", "bp-messages", "bp-parachains", @@ -1049,12 +1048,6 @@ dependencies = [ "smallvec", ] -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -1073,8 +1066,8 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c80e5460aa66fe3b91d40bcbdab953a597b60053e34d684ac6903f863b680a6" dependencies = [ - "cfg-if 1.0.0", - "cipher 0.3.0", + "cfg-if", + "cipher", "cpufeatures", "zeroize", ] @@ -1087,7 +1080,7 @@ checksum = "a18446b09be63d457bbec447509e85f662f32952b035ce892290396bc0b0cff5" dependencies = [ "aead", "chacha20", - "cipher 0.3.0", + "cipher", "poly1305", "zeroize", ] @@ -1129,23 +1122,13 @@ dependencies = [ "generic-array 0.14.6", ] -[[package]] -name = "cipher" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1873270f8f7942c191139cb8a40fd228da6c3fd2fc376d7e92d47aa14aeb59e" -dependencies = [ - "crypto-common", - "inout", -] - [[package]] name = "ckb-merkle-mountain-range" -version = "0.3.2" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f061f97d64fd1822664bdfb722f7ae5469a97b77567390f7442be5b5dc82a5b" +checksum = "56ccb671c5921be8a84686e6212ca184cb1d7c51cadcdbfcbd1cc3f042f5dfb8" dependencies = [ - "cfg-if 0.1.10", + "cfg-if", ] [[package]] @@ -1156,31 +1139,29 @@ checksum = "fa2e27ae6ab525c3d369ded447057bca5438d86dc3a68f6faafb8269ba82ebf3" dependencies = [ "glob", "libc", - "libloading 0.7.4", + "libloading", ] [[package]] name = "clap" -version = "3.2.23" +version = "4.0.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71655c45cb9845d3270c9d6df84ebe72b4dad3c2ba3f7023ad47c144e4e473a5" +checksum = "a7db700bc935f9e43e88d00b0850dae18a63773cfbec6d8e070fccf7fef89a39" dependencies = [ - "atty", "bitflags", "clap_derive", "clap_lex", - "indexmap", + "is-terminal", "once_cell", "strsim", "termcolor", - "textwrap", ] [[package]] name = "clap_derive" -version = "3.2.18" +version = "4.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea0c8bce528c4be4da13ea6fead8965e95b6073585a2f05204bd8f4119f82a65" +checksum = "0177313f9f02afc995627906bbd8967e2be069f5261954222dac78290c2b9014" dependencies = [ "heck", "proc-macro-error", @@ -1191,22 +1172,13 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.2.4" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2850f2f5a82cbf437dd5af4d49848fbdfc27c157c3d010345776f952765261c5" +checksum = "0d4198f73e42b4936b35b5bb248d81d2b595ecb170da0bac7655c54eedfa8da8" dependencies = [ "os_str_bytes", ] -[[package]] -name = "cmake" -version = "0.1.49" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db34956e100b30725f2eb215f90d4871051239535632f84fea3bc92722c66b7c" -dependencies = [ - "cc", -] - [[package]] name = "coarsetime" version = "0.1.22" @@ -1264,9 +1236,9 @@ dependencies = [ [[package]] name = "const-oid" -version = "0.7.1" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4c78c047431fee22c1a7bb92e00ad095a02a983affe4d8a72e2a2c62c1b94f3" +checksum = "cec318a675afcb6a1ea1d4340e2d377e56e47c266f28043ceccbf4412ddfdd3b" [[package]] name = "constant_time_eq" @@ -1323,7 +1295,7 @@ version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eeaa953eaad386a53111e47172c2fedba671e5684c8dd601a5f474f4f118710f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] @@ -1363,7 +1335,6 @@ dependencies = [ "darwinia-precompile-assets", "darwinia-precompile-bls12-381", "darwinia-precompile-deposit", - "darwinia-precompile-dispatch", "darwinia-precompile-staking", "darwinia-precompile-state-storage", "darwinia-staking", @@ -1381,7 +1352,6 @@ dependencies = [ "pallet-aura", "pallet-authorship", "pallet-balances", - "pallet-base-fee", "pallet-bridge-dispatch", "pallet-bridge-grandpa", "pallet-bridge-messages", @@ -1393,6 +1363,7 @@ dependencies = [ "pallet-evm", "pallet-evm-precompile-blake2", "pallet-evm-precompile-bn128", + "pallet-evm-precompile-dispatch", "pallet-evm-precompile-modexp", "pallet-evm-precompile-simple", "pallet-fee-market", @@ -1543,7 +1514,7 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] @@ -1552,7 +1523,7 @@ version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2dd04ddaf88237dc3b8d8f9a3c1004b506b54b3313403944054d23c0870c521" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "crossbeam-utils", ] @@ -1562,7 +1533,7 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "715e8152b692bba2d374b53d4875445368fdf21a94751410af607a5ac677d1fc" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "crossbeam-epoch", "crossbeam-utils", ] @@ -1574,7 +1545,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "01a9af1f4c2ef74bb8aa1f7e19706bc72d03598c8a570bb5de72243c7a9d9d5a" dependencies = [ "autocfg", - "cfg-if 1.0.0", + "cfg-if", "crossbeam-utils", "memoffset 0.7.1", "scopeguard", @@ -1586,7 +1557,7 @@ version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d1cfb3ea8a53f37c40dea2c7bedcbd88bdfae54f5e2175d6ecaff1c988353add" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "crossbeam-utils", ] @@ -1596,7 +1567,7 @@ version = "0.8.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4fb766fa798726286dbbb842f174001dab8abc7b627a1dd86e0b7222a95d929f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] @@ -1607,9 +1578,9 @@ checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" [[package]] name = "crypto-bigint" -version = "0.3.2" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03c6a1d5fa1de37e071642dfa44ec552ca5b299adb128fab16138e24b548fd21" +checksum = "ef2b4b23cddf68b89b8f8069890e8c270d54e2d5fe1b143820234805e4cb17ef" dependencies = [ "generic-array 0.14.6", "rand_core 0.6.4", @@ -1663,24 +1634,13 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "049bb91fb4aaf0e3c7efa6cd5ef877dbbbd15b39dad06d9948de4ec8a75761ea" dependencies = [ - "cipher 0.3.0", -] - -[[package]] -name = "cuckoofilter" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b810a8449931679f64cd7eef1bbd0fa315801b6d5d9cdc1ace2804d6529eee18" -dependencies = [ - "byteorder", - "fnv", - "rand 0.7.3", + "cipher", ] [[package]] name = "cumulus-client-cli" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.30#7b1fc0ed107fe42bb7e6a5dfefb586f4c3ae4328" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.33#27721d794ee63aae42317a7eeda21595dd3200d9" dependencies = [ "clap", "parity-scale-codec", @@ -1695,12 +1655,11 @@ dependencies = [ [[package]] name = "cumulus-client-collator" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.30#7b1fc0ed107fe42bb7e6a5dfefb586f4c3ae4328" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.33#27721d794ee63aae42317a7eeda21595dd3200d9" dependencies = [ "cumulus-client-consensus-common", "cumulus-client-network", "cumulus-primitives-core", - "cumulus-relay-chain-interface", "futures", "parity-scale-codec", "parking_lot 0.12.1", @@ -1719,7 +1678,7 @@ dependencies = [ [[package]] name = "cumulus-client-consensus-aura" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.30#7b1fc0ed107fe42bb7e6a5dfefb586f4c3ae4328" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.33#27721d794ee63aae42317a7eeda21595dd3200d9" dependencies = [ "async-trait", "cumulus-client-consensus-common", @@ -1748,7 +1707,7 @@ dependencies = [ [[package]] name = "cumulus-client-consensus-common" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.30#7b1fc0ed107fe42bb7e6a5dfefb586f4c3ae4328" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.33#27721d794ee63aae42317a7eeda21595dd3200d9" dependencies = [ "async-trait", "cumulus-relay-chain-interface", @@ -1758,7 +1717,6 @@ dependencies = [ "polkadot-primitives", "sc-client-api", "sc-consensus", - "sp-api", "sp-blockchain", "sp-consensus", "sp-runtime", @@ -1769,11 +1727,10 @@ dependencies = [ [[package]] name = "cumulus-client-network" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.30#7b1fc0ed107fe42bb7e6a5dfefb586f4c3ae4328" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.33#27721d794ee63aae42317a7eeda21595dd3200d9" dependencies = [ "async-trait", "cumulus-relay-chain-interface", - "derive_more", "futures", "futures-timer", "parity-scale-codec", @@ -1782,7 +1739,6 @@ dependencies = [ "polkadot-parachain", "polkadot-primitives", "sc-client-api", - "sp-api", "sp-blockchain", "sp-consensus", "sp-core", @@ -1794,7 +1750,7 @@ dependencies = [ [[package]] name = "cumulus-client-pov-recovery" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.30#7b1fc0ed107fe42bb7e6a5dfefb586f4c3ae4328" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.33#27721d794ee63aae42317a7eeda21595dd3200d9" dependencies = [ "cumulus-primitives-core", "cumulus-relay-chain-interface", @@ -1808,7 +1764,6 @@ dependencies = [ "rand 0.8.5", "sc-client-api", "sc-consensus", - "sp-api", "sp-consensus", "sp-maybe-compressed-blob", "sp-runtime", @@ -1818,7 +1773,7 @@ dependencies = [ [[package]] name = "cumulus-client-service" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.30#7b1fc0ed107fe42bb7e6a5dfefb586f4c3ae4328" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.33#27721d794ee63aae42317a7eeda21595dd3200d9" dependencies = [ "cumulus-client-cli", "cumulus-client-collator", @@ -1827,34 +1782,27 @@ dependencies = [ "cumulus-primitives-core", "cumulus-relay-chain-interface", "parking_lot 0.12.1", - "polkadot-overseer", "polkadot-primitives", "sc-client-api", "sc-consensus", - "sc-consensus-babe", "sc-service", - "sc-telemetry", - "sc-tracing", "sp-api", "sp-blockchain", "sp-consensus", "sp-core", "sp-runtime", - "tracing", ] [[package]] name = "cumulus-pallet-aura-ext" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.30#7b1fc0ed107fe42bb7e6a5dfefb586f4c3ae4328" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.33#27721d794ee63aae42317a7eeda21595dd3200d9" dependencies = [ - "frame-executive", "frame-support", "frame-system", "pallet-aura", "parity-scale-codec", "scale-info", - "serde", "sp-application-crypto", "sp-consensus-aura", "sp-runtime", @@ -1864,7 +1812,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-dmp-queue" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.30#7b1fc0ed107fe42bb7e6a5dfefb586f4c3ae4328" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.33#27721d794ee63aae42317a7eeda21595dd3200d9" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -1876,13 +1824,12 @@ dependencies = [ "sp-runtime", "sp-std", "xcm", - "xcm-executor", ] [[package]] name = "cumulus-pallet-parachain-system" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.30#7b1fc0ed107fe42bb7e6a5dfefb586f4c3ae4328" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.33#27721d794ee63aae42317a7eeda21595dd3200d9" dependencies = [ "bytes", "cumulus-pallet-parachain-system-proc-macro", @@ -1893,11 +1840,9 @@ dependencies = [ "frame-system", "impl-trait-for-tuples", "log", - "pallet-balances", "parity-scale-codec", "polkadot-parachain", "scale-info", - "serde", "sp-core", "sp-externalities", "sp-inherents", @@ -1907,13 +1852,12 @@ dependencies = [ "sp-std", "sp-trie", "sp-version", - "xcm", ] [[package]] name = "cumulus-pallet-parachain-system-proc-macro" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.30#7b1fc0ed107fe42bb7e6a5dfefb586f4c3ae4328" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.33#27721d794ee63aae42317a7eeda21595dd3200d9" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -1924,7 +1868,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-session-benchmarking" version = "3.0.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.30#7b1fc0ed107fe42bb7e6a5dfefb586f4c3ae4328" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.33#27721d794ee63aae42317a7eeda21595dd3200d9" dependencies = [ "frame-benchmarking", "frame-support", @@ -1938,14 +1882,13 @@ dependencies = [ [[package]] name = "cumulus-pallet-xcm" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.30#7b1fc0ed107fe42bb7e6a5dfefb586f4c3ae4328" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.33#27721d794ee63aae42317a7eeda21595dd3200d9" dependencies = [ "cumulus-primitives-core", "frame-support", "frame-system", "parity-scale-codec", "scale-info", - "serde", "sp-io", "sp-runtime", "sp-std", @@ -1955,7 +1898,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-xcmp-queue" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.30#7b1fc0ed107fe42bb7e6a5dfefb586f4c3ae4328" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.33#27721d794ee63aae42317a7eeda21595dd3200d9" dependencies = [ "cumulus-primitives-core", "frame-benchmarking", @@ -1974,9 +1917,8 @@ dependencies = [ [[package]] name = "cumulus-primitives-core" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.30#7b1fc0ed107fe42bb7e6a5dfefb586f4c3ae4328" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.33#27721d794ee63aae42317a7eeda21595dd3200d9" dependencies = [ - "frame-support", "parity-scale-codec", "polkadot-core-primitives", "polkadot-parachain", @@ -1990,7 +1932,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-parachain-inherent" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.30#7b1fc0ed107fe42bb7e6a5dfefb586f4c3ae4328" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.33#27721d794ee63aae42317a7eeda21595dd3200d9" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -2013,7 +1955,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-timestamp" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.30#7b1fc0ed107fe42bb7e6a5dfefb586f4c3ae4328" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.33#27721d794ee63aae42317a7eeda21595dd3200d9" dependencies = [ "cumulus-primitives-core", "futures", @@ -2026,18 +1968,14 @@ dependencies = [ [[package]] name = "cumulus-primitives-utility" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.30#7b1fc0ed107fe42bb7e6a5dfefb586f4c3ae4328" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.33#27721d794ee63aae42317a7eeda21595dd3200d9" dependencies = [ "cumulus-primitives-core", "frame-support", "log", "parity-scale-codec", - "polkadot-core-primitives", - "polkadot-parachain", - "polkadot-primitives", "sp-runtime", "sp-std", - "sp-trie", "xcm", "xcm-builder", "xcm-executor", @@ -2046,7 +1984,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-inprocess-interface" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.30#7b1fc0ed107fe42bb7e6a5dfefb586f4c3ae4328" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.33#27721d794ee63aae42317a7eeda21595dd3200d9" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -2058,47 +1996,83 @@ dependencies = [ "polkadot-service", "sc-cli", "sc-client-api", - "sc-consensus-babe", - "sc-network", "sc-sysinfo", "sc-telemetry", "sc-tracing", "sp-api", - "sp-blockchain", "sp-consensus", "sp-core", "sp-runtime", "sp-state-machine", - "tracing", ] [[package]] name = "cumulus-relay-chain-interface" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.30#7b1fc0ed107fe42bb7e6a5dfefb586f4c3ae4328" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.33#27721d794ee63aae42317a7eeda21595dd3200d9" dependencies = [ "async-trait", "cumulus-primitives-core", - "derive_more", "futures", "jsonrpsee-core", "parity-scale-codec", - "parking_lot 0.12.1", "polkadot-overseer", "polkadot-service", "sc-client-api", "sp-api", "sp-blockchain", - "sp-core", - "sp-runtime", "sp-state-machine", "thiserror", ] +[[package]] +name = "cumulus-relay-chain-minimal-node" +version = "0.1.0" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.33#27721d794ee63aae42317a7eeda21595dd3200d9" +dependencies = [ + "array-bytes 4.2.0", + "async-trait", + "cumulus-primitives-core", + "cumulus-relay-chain-interface", + "cumulus-relay-chain-rpc-interface", + "futures", + "lru", + "polkadot-availability-distribution", + "polkadot-core-primitives", + "polkadot-network-bridge", + "polkadot-node-core-av-store", + "polkadot-node-network-protocol", + "polkadot-node-subsystem-util", + "polkadot-overseer", + "polkadot-primitives", + "polkadot-service", + "sc-authority-discovery", + "sc-client-api", + "sc-consensus", + "sc-keystore", + "sc-network", + "sc-network-common", + "sc-network-light", + "sc-network-sync", + "sc-service", + "sc-telemetry", + "sc-tracing", + "sc-transaction-pool", + "sc-transaction-pool-api", + "sp-api", + "sp-blockchain", + "sp-consensus", + "sp-consensus-babe", + "sp-runtime", + "tokio", + "tracing", + "url", +] + [[package]] name = "cumulus-relay-chain-rpc-interface" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.30#7b1fc0ed107fe42bb7e6a5dfefb586f4c3ae4328" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.33#27721d794ee63aae42317a7eeda21595dd3200d9" dependencies = [ "async-trait", "backoff", @@ -2108,11 +2082,12 @@ dependencies = [ "futures-timer", "jsonrpsee", "parity-scale-codec", - "parking_lot 0.12.1", "polkadot-service", "sc-client-api", "sc-rpc-api", "sp-api", + "sp-authority-discovery", + "sp-consensus-babe", "sp-core", "sp-runtime", "sp-state-machine", @@ -2125,7 +2100,7 @@ dependencies = [ [[package]] name = "cumulus-test-relay-sproof-builder" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.30#7b1fc0ed107fe42bb7e6a5dfefb586f4c3ae4328" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.33#27721d794ee63aae42317a7eeda21595dd3200d9" dependencies = [ "cumulus-primitives-core", "parity-scale-codec", @@ -2167,7 +2142,7 @@ version = "4.0.0-pre.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "67bc65846be335cb20f4e52d49a437b773a2c1fdb42b19fc84e79e6f6771536f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "fiat-crypto", "packed_simd_2", "platforms 3.0.2", @@ -2237,6 +2212,7 @@ dependencies = [ "cumulus-primitives-parachain-inherent", "cumulus-relay-chain-inprocess-interface", "cumulus-relay-chain-interface", + "cumulus-relay-chain-minimal-node", "cumulus-relay-chain-rpc-interface", "darwinia-runtime", "dc-primitives", @@ -2490,17 +2466,6 @@ dependencies = [ "sp-std", ] -[[package]] -name = "darwinia-precompile-dispatch" -version = "6.0.0" -dependencies = [ - "fp-evm", - "frame-support", - "pallet-evm", - "precompile-utils", - "sp-std", -] - [[package]] name = "darwinia-precompile-staking" version = "6.0.0" @@ -2569,7 +2534,6 @@ dependencies = [ "darwinia-precompile-assets", "darwinia-precompile-bls12-381", "darwinia-precompile-deposit", - "darwinia-precompile-dispatch", "darwinia-precompile-staking", "darwinia-precompile-state-storage", "darwinia-staking", @@ -2587,7 +2551,6 @@ dependencies = [ "pallet-aura", "pallet-authorship", "pallet-balances", - "pallet-base-fee", "pallet-bridge-dispatch", "pallet-bridge-grandpa", "pallet-bridge-messages", @@ -2599,6 +2562,7 @@ dependencies = [ "pallet-evm", "pallet-evm-precompile-blake2", "pallet-evm-precompile-bn128", + "pallet-evm-precompile-dispatch", "pallet-evm-precompile-modexp", "pallet-evm-precompile-simple", "pallet-fee-market", @@ -2720,11 +2684,12 @@ version = "6.0.0" [[package]] name = "der" -version = "0.5.1" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6919815d73839e7ad218de758883aae3a257ba6759ce7a9992501efbb53d705c" +checksum = "f1a467a65c5e759bce6e65eaf91cc29f466cdc57cb65777bd646872a8a1fd4de" dependencies = [ "const-oid", + "zeroize", ] [[package]] @@ -2751,6 +2716,12 @@ dependencies = [ "syn", ] +[[package]] +name = "difflib" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6184e33543162437515c2e2b48714794e37845ec9851711914eec9d308f6ebe8" + [[package]] name = "digest" version = "0.8.1" @@ -2795,7 +2766,7 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "339ee130d97a610ea5a5872d2bbb130fdf68884ff09d3028b81bec8a1ac23bbc" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "dirs-sys-next", ] @@ -2831,6 +2802,12 @@ dependencies = [ "quick-error", ] +[[package]] +name = "downcast" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1435fa1053d8b2fbbe9be7e97eca7f33d37b28409959813daefc1446a14247f1" + [[package]] name = "downcast-rs" version = "1.2.0" @@ -2872,9 +2849,9 @@ checksum = "c9b0705efd4599c15a38151f4721f7bc388306f61084d3bfd50bd07fbca5cb60" [[package]] name = "ecdsa" -version = "0.13.4" +version = "0.14.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0d69ae62e0ce582d56380743515fefaf1a8c70cec685d9677636d7e30ae9dc9" +checksum = "413301934810f597c1d19ca71c8710e99a3f1ba28a0d2ebc01551a2daeea3c5c" dependencies = [ "der", "elliptic-curve", @@ -2927,13 +2904,14 @@ checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797" [[package]] name = "elliptic-curve" -version = "0.11.12" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25b477563c2bfed38a3b7a60964c49e058b2510ad3f12ba3483fd8f62c2306d6" +checksum = "e7bb888ab5300a19b8e5bceef25ac745ad065f3c9f7efc6de1b91958110891d3" dependencies = [ "base16ct", "crypto-bigint", "der", + "digest 0.10.6", "ff", "generic-array 0.14.6", "group", @@ -2951,9 +2929,9 @@ checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" [[package]] name = "enum-as-inner" -version = "0.4.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21cdad81446a7f7dc43f6a77409efeb9733d2fa65553efef6018ef257c959b73" +checksum = "c9720bba047d567ffc8a3cba48bf19126600e249ab7f128e9233e6376976a116" dependencies = [ "heck", "proc-macro2", @@ -3051,7 +3029,7 @@ version = "17.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e4966fba78396ff92db3b817ee71143eccd98acf0f876b8d600e585a670c5d1b" dependencies = [ - "ethereum-types", + "ethereum-types 0.13.1", "hex", "sha3 0.10.6", "thiserror", @@ -3066,26 +3044,36 @@ checksum = "11da94e443c60508eb62cf256243a64da87304c2802ac2528847f79d750007ef" dependencies = [ "crunchy", "fixed-hash 0.7.0", + "tiny-keccak", +] + +[[package]] +name = "ethbloom" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c22d4b5885b6aa2fe5e8b9329fb8d232bf739e434e6b87347c63bdd00c120f60" +dependencies = [ + "crunchy", + "fixed-hash 0.8.0", "impl-codec", "impl-rlp", - "impl-serde", + "impl-serde 0.4.0", "scale-info", "tiny-keccak", ] [[package]] name = "ethereum" -version = "0.12.0" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23750149fe8834c0e24bb9adcbacbe06c45b9861f15df53e09f26cb7c4ab91ef" +checksum = "6a89fb87a9e103f71b903b80b670200b54cc67a07578f070681f1fffb7396fb7" dependencies = [ "bytes", - "ethereum-types", + "ethereum-types 0.14.1", "hash-db", "hash256-std-hasher", "parity-scale-codec", "rlp", - "rlp-derive", "scale-info", "serde", "sha3 0.10.6", @@ -3098,12 +3086,24 @@ version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b2827b94c556145446fcce834ca86b7abf0c39a805883fe20e72c5bfdb5a0dc6" dependencies = [ - "ethbloom", + "ethbloom 0.12.1", "fixed-hash 0.7.0", + "primitive-types 0.11.1", + "uint", +] + +[[package]] +name = "ethereum-types" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02d215cbf040552efcbe99a38372fe80ab9d00268e20012b79fcd0f073edd8ee" +dependencies = [ + "ethbloom 0.13.0", + "fixed-hash 0.8.0", "impl-codec", "impl-rlp", - "impl-serde", - "primitive-types 0.11.1", + "impl-serde 0.4.0", + "primitive-types 0.12.1", "scale-info", "uint", ] @@ -3116,9 +3116,9 @@ checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" [[package]] name = "evm" -version = "0.36.0" +version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d388bbd18050623b996cc4ba0643971e2978693ad56ca8b7603080cfa5eaf738" +checksum = "f4448c65b71e8e2b9718232d84d09045eeaaccb2320494e6bd6dbf7e58fec8ff" dependencies = [ "auto_impl", "environmental", @@ -3128,7 +3128,7 @@ dependencies = [ "evm-runtime", "log", "parity-scale-codec", - "primitive-types 0.11.1", + "primitive-types 0.12.1", "rlp", "scale-info", "serde", @@ -3137,38 +3137,38 @@ dependencies = [ [[package]] name = "evm-core" -version = "0.36.0" +version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5fb3a449a544a67c879d2f74e1c3d9022de3ec31c9a20817015816f687aa2af" +checksum = "64c51bec0eb68a891c2575c758eaaa1d61373fc51f7caaf216b1fb5c3fea3b5d" dependencies = [ "parity-scale-codec", - "primitive-types 0.11.1", + "primitive-types 0.12.1", "scale-info", "serde", ] [[package]] name = "evm-gasometer" -version = "0.36.0" +version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "170a27b6e49b8279016afffcdc6ebae9225d5acff3a546ad8589929b091e7ac5" +checksum = "a8b93c59c54fc26522d842f0e0d3f8e8be331c776df18ff3e540b53c2f64d509" dependencies = [ "environmental", "evm-core", "evm-runtime", - "primitive-types 0.11.1", + "primitive-types 0.12.1", ] [[package]] name = "evm-runtime" -version = "0.36.0" +version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d48c2545a02e3a4d1a5184a96af11037334dce947b6bdb389b3503b3a6f8dcd" +checksum = "c79b9459ce64f1a28688397c4013764ce53cd57bb84efc16b5187fa9b05b13ad" dependencies = [ "auto_impl", "environmental", "evm-core", - "primitive-types 0.11.1", + "primitive-types 0.12.1", "sha3 0.10.6", ] @@ -3255,10 +3255,10 @@ dependencies = [ [[package]] name = "fc-cli" version = "1.0.0-dev" -source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.30#1bd889c001b2a4735777160354cb57b8c17cf756" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.33#05ee2dbf537bf5bbcbc5b4785be62088034bdd58" dependencies = [ "clap", - "ethereum-types", + "ethereum-types 0.14.1", "fc-db", "fp-rpc", "fp-storage", @@ -3274,7 +3274,7 @@ dependencies = [ [[package]] name = "fc-consensus" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.30#1bd889c001b2a4735777160354cb57b8c17cf756" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.33#05ee2dbf537bf5bbcbc5b4785be62088034bdd58" dependencies = [ "async-trait", "fc-db", @@ -3293,7 +3293,7 @@ dependencies = [ [[package]] name = "fc-db" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.30#1bd889c001b2a4735777160354cb57b8c17cf756" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.33#05ee2dbf537bf5bbcbc5b4785be62088034bdd58" dependencies = [ "fp-storage", "kvdb-rocksdb", @@ -3302,6 +3302,7 @@ dependencies = [ "parity-scale-codec", "parking_lot 0.12.1", "sc-client-db", + "smallvec", "sp-blockchain", "sp-core", "sp-database", @@ -3311,7 +3312,7 @@ dependencies = [ [[package]] name = "fc-mapping-sync" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.30#1bd889c001b2a4735777160354cb57b8c17cf756" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.33#05ee2dbf537bf5bbcbc5b4785be62088034bdd58" dependencies = [ "fc-db", "fp-consensus", @@ -3328,10 +3329,10 @@ dependencies = [ [[package]] name = "fc-rpc" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.30#1bd889c001b2a4735777160354cb57b8c17cf756" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.33#05ee2dbf537bf5bbcbc5b4785be62088034bdd58" dependencies = [ "ethereum", - "ethereum-types", + "ethereum-types 0.14.1", "evm", "fc-db", "fc-rpc-core", @@ -3344,7 +3345,7 @@ dependencies = [ "jsonrpsee", "libsecp256k1 0.7.1", "log", - "lru 0.8.1", + "lru", "parity-scale-codec", "prometheus", "rand 0.8.5", @@ -3371,10 +3372,10 @@ dependencies = [ [[package]] name = "fc-rpc-core" version = "1.1.0-dev" -source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.30#1bd889c001b2a4735777160354cb57b8c17cf756" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.33#05ee2dbf537bf5bbcbc5b4785be62088034bdd58" dependencies = [ "ethereum", - "ethereum-types", + "ethereum-types 0.14.1", "jsonrpsee", "rlp", "rustc-hex", @@ -3393,9 +3394,9 @@ dependencies = [ [[package]] name = "ff" -version = "0.11.1" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "131655483be284720a17d74ff97592b8e76576dc25563148601df2d7c9080924" +checksum = "d013fc25338cc558c5c2cfbad646908fb23591e2404481826742b651c9af7160" dependencies = [ "rand_core 0.6.4", "subtle", @@ -3423,7 +3424,7 @@ version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4e884668cd0c7480504233e951174ddc3b382f7c2666e3b7310b5c4e7b0c37f9" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "libc", "redox_syscall", "windows-sys 0.42.0", @@ -3486,6 +3487,15 @@ dependencies = [ "miniz_oxide", ] +[[package]] +name = "float-cmp" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "98de4bbd547a563b716d8dfa9aad1cb19bfab00f4fa09a6a4ed21dbcf44ce9c4" +dependencies = [ + "num-traits", +] + [[package]] name = "fnv" version = "1.0.7" @@ -3495,7 +3505,7 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "fork-tree" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "parity-scale-codec", ] @@ -3512,7 +3522,7 @@ dependencies = [ [[package]] name = "fp-consensus" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.30#1bd889c001b2a4735777160354cb57b8c17cf756" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.33#05ee2dbf537bf5bbcbc5b4785be62088034bdd58" dependencies = [ "ethereum", "parity-scale-codec", @@ -3524,10 +3534,10 @@ dependencies = [ [[package]] name = "fp-ethereum" version = "1.0.0-dev" -source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.30#1bd889c001b2a4735777160354cb57b8c17cf756" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.33#05ee2dbf537bf5bbcbc5b4785be62088034bdd58" dependencies = [ "ethereum", - "ethereum-types", + "ethereum-types 0.14.1", "fp-evm", "frame-support", "num_enum", @@ -3539,7 +3549,7 @@ dependencies = [ [[package]] name = "fp-evm" version = "3.0.0-dev" -source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.30#1bd889c001b2a4735777160354cb57b8c17cf756" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.33#05ee2dbf537bf5bbcbc5b4785be62088034bdd58" dependencies = [ "evm", "frame-support", @@ -3552,10 +3562,10 @@ dependencies = [ [[package]] name = "fp-rpc" version = "3.0.0-dev" -source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.30#1bd889c001b2a4735777160354cb57b8c17cf756" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.33#05ee2dbf537bf5bbcbc5b4785be62088034bdd58" dependencies = [ "ethereum", - "ethereum-types", + "ethereum-types 0.14.1", "fp-evm", "parity-scale-codec", "scale-info", @@ -3569,7 +3579,7 @@ dependencies = [ [[package]] name = "fp-self-contained" version = "1.0.0-dev" -source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.30#1bd889c001b2a4735777160354cb57b8c17cf756" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.33#05ee2dbf537bf5bbcbc5b4785be62088034bdd58" dependencies = [ "ethereum", "frame-support", @@ -3583,16 +3593,22 @@ dependencies = [ [[package]] name = "fp-storage" version = "2.0.0" -source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.30#1bd889c001b2a4735777160354cb57b8c17cf756" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.33#05ee2dbf537bf5bbcbc5b4785be62088034bdd58" dependencies = [ "parity-scale-codec", "serde", ] +[[package]] +name = "fragile" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c2141d6d6c8512188a7891b4b01590a45f6dac67afb4f255c4124dbb86d4eaa" + [[package]] name = "frame-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "frame-support", "frame-system", @@ -3615,7 +3631,7 @@ dependencies = [ [[package]] name = "frame-benchmarking-cli" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "Inflector", "array-bytes 4.2.0", @@ -3656,6 +3672,7 @@ dependencies = [ "sp-keystore", "sp-runtime", "sp-state-machine", + "sp-std", "sp-storage", "sp-trie", "tempfile", @@ -3666,7 +3683,7 @@ dependencies = [ [[package]] name = "frame-election-provider-solution-type" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -3677,7 +3694,7 @@ dependencies = [ [[package]] name = "frame-election-provider-support" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "frame-election-provider-solution-type", "frame-support", @@ -3693,7 +3710,7 @@ dependencies = [ [[package]] name = "frame-executive" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "frame-support", "frame-system", @@ -3713,7 +3730,7 @@ version = "15.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "df6bb8542ef006ef0de09a5c4420787d79823c0ed7924225822362fd2bf2ff2d" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "parity-scale-codec", "scale-info", "serde", @@ -3722,7 +3739,7 @@ dependencies = [ [[package]] name = "frame-support" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "bitflags", "frame-metadata", @@ -3754,7 +3771,7 @@ dependencies = [ [[package]] name = "frame-support-procedural" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "Inflector", "cfg-expr", @@ -3768,7 +3785,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "frame-support-procedural-tools-derive", "proc-macro-crate", @@ -3780,7 +3797,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools-derive" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "proc-macro2", "quote", @@ -3790,7 +3807,7 @@ dependencies = [ [[package]] name = "frame-system" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "frame-support", "log", @@ -3808,7 +3825,7 @@ dependencies = [ [[package]] name = "frame-system-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "frame-benchmarking", "frame-support", @@ -3823,7 +3840,7 @@ dependencies = [ [[package]] name = "frame-system-rpc-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "parity-scale-codec", "sp-api", @@ -3832,7 +3849,7 @@ dependencies = [ [[package]] name = "frame-try-runtime" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "frame-support", "parity-scale-codec", @@ -3847,18 +3864,6 @@ version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0845fa252299212f0389d64ba26f34fa32cfe41588355f21ed507c59a0f64541" -[[package]] -name = "fs-swap" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03d47dad3685eceed8488986cad3d5027165ea5edb164331770e2059555f10a5" -dependencies = [ - "lazy_static", - "libc", - "libloading 0.5.2", - "winapi", -] - [[package]] name = "fs2" version = "0.4.3" @@ -4047,7 +4052,7 @@ version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "js-sys", "libc", "wasi 0.9.0+wasi-snapshot-preview1", @@ -4060,7 +4065,7 @@ version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "libc", "wasi 0.11.0+wasi-snapshot-preview1", ] @@ -4125,9 +4130,9 @@ dependencies = [ [[package]] name = "group" -version = "0.11.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc5ac374b108929de78460075f3dc439fa66df9d8fc77e8f12caa5165fcf0c89" +checksum = "5dfbfb3a6cfbd390d5c9564ab283a0349b9b9fcd46a706c1eb10e0db70bfbac7" dependencies = [ "ff", "rand_core 0.6.4", @@ -4227,12 +4232,6 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" -[[package]] -name = "hex_fmt" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b07f60793ff0a4d9cef0f18e63b5357e06209987153a64648c972c1e5aff336f" - [[package]] name = "hmac" version = "0.8.1" @@ -4253,6 +4252,15 @@ dependencies = [ "digest 0.9.0", ] +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest 0.10.6", +] + [[package]] name = "hmac-drbg" version = "0.3.0" @@ -4420,9 +4428,9 @@ dependencies = [ [[package]] name = "if-watch" -version = "1.1.1" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "015a7df1eb6dda30df37f34b63ada9b7b352984b0e84de2a20ed526345000791" +checksum = "065c008e570a43c00de6aed9714035e5ea6a498c255323db9091722af6ee67dd" dependencies = [ "async-io", "core-foundation", @@ -4463,6 +4471,15 @@ dependencies = [ "serde", ] +[[package]] +name = "impl-serde" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc88fc67028ae3db0c853baa36269d398d5f45b6982f95549ff5def78c935cd" +dependencies = [ + "serde", +] + [[package]] name = "impl-trait-for-tuples" version = "0.2.2" @@ -4485,22 +4502,13 @@ dependencies = [ "serde", ] -[[package]] -name = "inout" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5" -dependencies = [ - "generic-array 0.14.6", -] - [[package]] name = "instant" version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] @@ -4558,6 +4566,18 @@ version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "11b0d96e660696543b251e58030cf9787df56da39dab19ad60eae7353040917e" +[[package]] +name = "is-terminal" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28dfb6c8100ccc63462345b67d1bbc3679177c75ee4bf59bf29c8b1d110b8189" +dependencies = [ + "hermit-abi 0.2.6", + "io-lifetimes 1.0.3", + "rustix 0.36.5", + "windows-sys 0.42.0", +] + [[package]] name = "itertools" version = "0.10.5" @@ -4737,14 +4757,14 @@ dependencies = [ [[package]] name = "k256" -version = "0.10.4" +version = "0.11.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19c3a5e0a0b8450278feda242592512e09f61c72e018b8cd5c859482802daf2d" +checksum = "72c1e0b51e7ec0a97369623508396067a486bd0cbed95a2659a4b863d28cfc8b" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "ecdsa", "elliptic-curve", - "sec1", + "sha2 0.10.6", ] [[package]] @@ -4758,8 +4778,8 @@ dependencies = [ [[package]] name = "kusama-runtime" -version = "0.9.30" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +version = "0.9.33" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" dependencies = [ "beefy-primitives", "bitvec", @@ -4782,6 +4802,7 @@ dependencies = [ "pallet-bounties", "pallet-child-bounties", "pallet-collective", + "pallet-conviction-voting", "pallet-democracy", "pallet-election-provider-multi-phase", "pallet-election-provider-support-benchmarking", @@ -4801,13 +4822,14 @@ dependencies = [ "pallet-offences-benchmarking", "pallet-preimage", "pallet-proxy", + "pallet-ranked-collective", "pallet-recovery", + "pallet-referenda", "pallet-scheduler", "pallet-session", "pallet-session-benchmarking", "pallet-society", "pallet-staking", - "pallet-staking-reward-fn", "pallet-timestamp", "pallet-tips", "pallet-transaction-payment", @@ -4815,6 +4837,7 @@ dependencies = [ "pallet-treasury", "pallet-utility", "pallet-vesting", + "pallet-whitelist", "pallet-xcm", "pallet-xcm-benchmarks", "parity-scale-codec", @@ -4852,14 +4875,16 @@ dependencies = [ [[package]] name = "kusama-runtime-constants" -version = "0.9.30" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +version = "0.9.33" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" dependencies = [ "frame-support", "polkadot-primitives", "polkadot-runtime-common", "smallvec", + "sp-core", "sp-runtime", + "sp-weights", ] [[package]] @@ -4873,9 +4898,9 @@ dependencies = [ [[package]] name = "kvdb" -version = "0.11.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a301d8ecb7989d4a6e2c57a49baca77d353bdbf879909debe3f375fe25d61f86" +checksum = "585089ceadba0197ffe9af6740ab350b325e3c1f5fccfbc3522e0250c750409b" dependencies = [ "parity-util-mem", "smallvec", @@ -4883,9 +4908,9 @@ dependencies = [ [[package]] name = "kvdb-memorydb" -version = "0.11.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ece7e668abd21387aeb6628130a6f4c802787f014fa46bc83221448322250357" +checksum = "40d109c87bfb7759edd2a49b2649c1afe25af785d930ad6a38479b4dc70dd873" dependencies = [ "kvdb", "parity-util-mem", @@ -4894,15 +4919,13 @@ dependencies = [ [[package]] name = "kvdb-rocksdb" -version = "0.15.2" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca7fbdfd71cd663dceb0faf3367a99f8cf724514933e9867cec4995b6027cbc1" +checksum = "c076cc2cdbac89b9910c853a36c957d3862a779f31c2661174222cefb49ee597" dependencies = [ - "fs-swap", "kvdb", "log", "num_cpus", - "owning_ref", "parity-util-mem", "parking_lot 0.12.1", "regex", @@ -4931,23 +4954,13 @@ version = "0.2.139" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79" -[[package]] -name = "libloading" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2b111a074963af1d37a139918ac6d49ad1d0d5e47f72fd55388619691a7d753" -dependencies = [ - "cc", - "winapi", -] - [[package]] name = "libloading" version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "winapi", ] @@ -4965,9 +4978,9 @@ checksum = "348108ab3fba42ec82ff6e9564fc4ca0247bdccdc68dd8af9764bbc79c3c8ffb" [[package]] name = "libp2p" -version = "0.46.1" +version = "0.49.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81327106887e42d004fbdab1fef93675be2e2e07c1b95fce45e2cc813485611d" +checksum = "ec878fda12ebec479186b3914ebc48ff180fa4c51847e11a1a68bf65249e02c1" dependencies = [ "bytes", "futures", @@ -4975,12 +4988,8 @@ dependencies = [ "getrandom 0.2.8", "instant", "lazy_static", - "libp2p-autonat", "libp2p-core", - "libp2p-deflate", "libp2p-dns", - "libp2p-floodsub", - "libp2p-gossipsub", "libp2p-identify", "libp2p-kad", "libp2p-mdns", @@ -4988,49 +4997,24 @@ dependencies = [ "libp2p-mplex", "libp2p-noise", "libp2p-ping", - "libp2p-plaintext", - "libp2p-pnet", - "libp2p-relay", - "libp2p-rendezvous", "libp2p-request-response", "libp2p-swarm", "libp2p-swarm-derive", "libp2p-tcp", - "libp2p-uds", "libp2p-wasm-ext", "libp2p-websocket", "libp2p-yamux", "multiaddr", "parking_lot 0.12.1", "pin-project", - "rand 0.7.3", "smallvec", ] -[[package]] -name = "libp2p-autonat" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4decc51f3573653a9f4ecacb31b1b922dd20c25a6322bb15318ec04287ec46f9" -dependencies = [ - "async-trait", - "futures", - "futures-timer", - "instant", - "libp2p-core", - "libp2p-request-response", - "libp2p-swarm", - "log", - "prost 0.10.4", - "prost-build 0.10.4", - "rand 0.8.5", -] - [[package]] name = "libp2p-core" -version = "0.34.0" +version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbf9b94cefab7599b2d3dff2f93bee218c6621d68590b23ede4485813cbcece6" +checksum = "799676bb0807c788065e57551c6527d461ad572162b0519d1958946ff9e0539d" dependencies = [ "asn1_der", "bs58", @@ -5041,17 +5025,15 @@ dependencies = [ "futures-timer", "instant", "lazy_static", - "libsecp256k1 0.7.1", "log", "multiaddr", "multihash", "multistream-select", "parking_lot 0.12.1", "pin-project", - "prost 0.10.4", - "prost-build 0.10.4", + "prost", + "prost-build", "rand 0.8.5", - "ring", "rw-stream-sink", "sha2 0.10.6", "smallvec", @@ -5061,22 +5043,11 @@ dependencies = [ "zeroize", ] -[[package]] -name = "libp2p-deflate" -version = "0.34.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0183dc2a3da1fbbf85e5b6cf51217f55b14f5daea0c455a9536eef646bfec71" -dependencies = [ - "flate2", - "futures", - "libp2p-core", -] - [[package]] name = "libp2p-dns" -version = "0.34.0" +version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6cbf54723250fa5d521383be789bf60efdabe6bacfb443f87da261019a49b4b5" +checksum = "2322c9fb40d99101def6a01612ee30500c89abbbecb6297b3cd252903a4c1720" dependencies = [ "async-std-resolver", "futures", @@ -5087,57 +5058,11 @@ dependencies = [ "trust-dns-resolver", ] -[[package]] -name = "libp2p-floodsub" -version = "0.37.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98a4b6ffd53e355775d24b76f583fdda54b3284806f678499b57913adb94f231" -dependencies = [ - "cuckoofilter", - "fnv", - "futures", - "libp2p-core", - "libp2p-swarm", - "log", - "prost 0.10.4", - "prost-build 0.10.4", - "rand 0.7.3", - "smallvec", -] - -[[package]] -name = "libp2p-gossipsub" -version = "0.39.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74b4b888cfbeb1f5551acd3aa1366e01bf88ede26cc3c4645d0d2d004d5ca7b0" -dependencies = [ - "asynchronous-codec", - "base64 0.13.1", - "byteorder", - "bytes", - "fnv", - "futures", - "hex_fmt", - "instant", - "libp2p-core", - "libp2p-swarm", - "log", - "prometheus-client", - "prost 0.10.4", - "prost-build 0.10.4", - "rand 0.7.3", - "regex", - "sha2 0.10.6", - "smallvec", - "unsigned-varint", - "wasm-timer", -] - [[package]] name = "libp2p-identify" -version = "0.37.0" +version = "0.40.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c50b585518f8efd06f93ac2f976bd672e17cdac794644b3117edd078e96bda06" +checksum = "dcf9a121f699e8719bda2e6e9e9b6ddafc6cff4602471d6481c1067930ccb29b" dependencies = [ "asynchronous-codec", "futures", @@ -5145,9 +5070,9 @@ dependencies = [ "libp2p-core", "libp2p-swarm", "log", - "lru 0.7.8", - "prost 0.10.4", - "prost-build 0.10.4", + "lru", + "prost", + "prost-build", "prost-codec", "smallvec", "thiserror", @@ -5156,9 +5081,9 @@ dependencies = [ [[package]] name = "libp2p-kad" -version = "0.38.0" +version = "0.41.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "740862893bb5f06ac24acc9d49bdeadc3a5e52e51818a30a25c1f3519da2c851" +checksum = "6721c200e2021f6c3fab8b6cf0272ead8912d871610ee194ebd628cecf428f22" dependencies = [ "arrayvec 0.7.2", "asynchronous-codec", @@ -5171,9 +5096,9 @@ dependencies = [ "libp2p-core", "libp2p-swarm", "log", - "prost 0.10.4", - "prost-build 0.10.4", - "rand 0.7.3", + "prost", + "prost-build", + "rand 0.8.5", "sha2 0.10.6", "smallvec", "thiserror", @@ -5184,16 +5109,15 @@ dependencies = [ [[package]] name = "libp2p-mdns" -version = "0.38.0" +version = "0.41.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66e5e5919509603281033fd16306c61df7a4428ce274b67af5e14b07de5cdcb2" +checksum = "761704e727f7d68d58d7bc2231eafae5fc1b9814de24290f126df09d4bd37a15" dependencies = [ "async-io", "data-encoding", "dns-parser", "futures", "if-watch", - "lazy_static", "libp2p-core", "libp2p-swarm", "log", @@ -5205,25 +5129,23 @@ dependencies = [ [[package]] name = "libp2p-metrics" -version = "0.7.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef8aff4a1abef42328fbb30b17c853fff9be986dc39af17ee39f9c5f755c5e0c" +checksum = "9ee31b08e78b7b8bfd1c4204a9dd8a87b4fcdf6dafc57eb51701c1c264a81cb9" dependencies = [ "libp2p-core", - "libp2p-gossipsub", "libp2p-identify", "libp2p-kad", "libp2p-ping", - "libp2p-relay", "libp2p-swarm", "prometheus-client", ] [[package]] name = "libp2p-mplex" -version = "0.34.0" +version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61fd1b20638ec209c5075dfb2e8ce6a7ea4ec3cd3ad7b77f7a477c06d53322e2" +checksum = "692664acfd98652de739a8acbb0a0d670f1d67190a49be6b4395e22c37337d89" dependencies = [ "asynchronous-codec", "bytes", @@ -5232,16 +5154,16 @@ dependencies = [ "log", "nohash-hasher", "parking_lot 0.12.1", - "rand 0.7.3", + "rand 0.8.5", "smallvec", "unsigned-varint", ] [[package]] name = "libp2p-noise" -version = "0.37.0" +version = "0.40.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "762408cb5d84b49a600422d7f9a42c18012d8da6ebcd570f9a4a4290ba41fb6f" +checksum = "048155686bd81fe6cb5efdef0c6290f25ad32a0a42e8f4f72625cf6a505a206f" dependencies = [ "bytes", "curve25519-dalek 3.2.0", @@ -5249,8 +5171,8 @@ dependencies = [ "lazy_static", "libp2p-core", "log", - "prost 0.10.4", - "prost-build 0.10.4", + "prost", + "prost-build", "rand 0.8.5", "sha2 0.10.6", "snow", @@ -5261,105 +5183,25 @@ dependencies = [ [[package]] name = "libp2p-ping" -version = "0.37.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "100a6934ae1dbf8a693a4e7dd1d730fd60b774dafc45688ed63b554497c6c925" -dependencies = [ - "futures", - "futures-timer", - "instant", - "libp2p-core", - "libp2p-swarm", - "log", - "rand 0.7.3", - "void", -] - -[[package]] -name = "libp2p-plaintext" -version = "0.34.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be27bf0820a6238a4e06365b096d428271cce85a129cf16f2fe9eb1610c4df86" -dependencies = [ - "asynchronous-codec", - "bytes", - "futures", - "libp2p-core", - "log", - "prost 0.10.4", - "prost-build 0.10.4", - "unsigned-varint", - "void", -] - -[[package]] -name = "libp2p-pnet" -version = "0.22.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de160c5631696cea22be326c19bd9d306e254c4964945263aea10f25f6e0864e" -dependencies = [ - "futures", - "log", - "pin-project", - "rand 0.8.5", - "salsa20", - "sha3 0.10.6", -] - -[[package]] -name = "libp2p-relay" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4931547ee0cce03971ccc1733ff05bb0c4349fd89120a39e9861e2bbe18843c3" -dependencies = [ - "asynchronous-codec", - "bytes", - "either", - "futures", - "futures-timer", - "instant", - "libp2p-core", - "libp2p-swarm", - "log", - "pin-project", - "prost 0.10.4", - "prost-build 0.10.4", - "prost-codec", - "rand 0.8.5", - "smallvec", - "static_assertions", - "thiserror", - "void", -] - -[[package]] -name = "libp2p-rendezvous" -version = "0.7.0" +version = "0.40.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9511c9672ba33284838e349623319c8cad2d18cfad243ae46c6b7e8a2982ea4e" +checksum = "7228b9318d34689521349a86eb39a3c3a802c9efc99a0568062ffb80913e3f91" dependencies = [ - "asynchronous-codec", - "bimap", "futures", "futures-timer", "instant", "libp2p-core", "libp2p-swarm", "log", - "prost 0.10.4", - "prost-build 0.10.4", "rand 0.8.5", - "sha2 0.10.6", - "thiserror", - "unsigned-varint", "void", ] [[package]] name = "libp2p-request-response" -version = "0.19.0" +version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "508a189e2795d892c8f5c1fa1e9e0b1845d32d7b0b249dbf7b05b18811361843" +checksum = "8827af16a017b65311a410bb626205a9ad92ec0473967618425039fa5231adc1" dependencies = [ "async-trait", "bytes", @@ -5368,16 +5210,16 @@ dependencies = [ "libp2p-core", "libp2p-swarm", "log", - "rand 0.7.3", + "rand 0.8.5", "smallvec", "unsigned-varint", ] [[package]] name = "libp2p-swarm" -version = "0.37.0" +version = "0.40.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95ac5be6c2de2d1ff3f7693fda6faf8a827b1f3e808202277783fea9f527d114" +checksum = "46d13df7c37807965d82930c0e4b04a659efcb6cca237373b206043db5398ecf" dependencies = [ "either", "fnv", @@ -5387,7 +5229,7 @@ dependencies = [ "libp2p-core", "log", "pin-project", - "rand 0.7.3", + "rand 0.8.5", "smallvec", "thiserror", "void", @@ -5395,48 +5237,36 @@ dependencies = [ [[package]] name = "libp2p-swarm-derive" -version = "0.28.0" +version = "0.30.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f54a64b6957249e0ce782f8abf41d97f69330d02bf229f0672d864f0650cc76" +checksum = "a0eddc4497a8b5a506013c40e8189864f9c3a00db2b25671f428ae9007f3ba32" dependencies = [ + "heck", "quote", "syn", ] [[package]] name = "libp2p-tcp" -version = "0.34.0" +version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a6771dc19aa3c65d6af9a8c65222bfc8fcd446630ddca487acd161fa6096f3b" +checksum = "9839d96761491c6d3e238e70554b856956fca0ab60feb9de2cd08eed4473fa92" dependencies = [ "async-io", "futures", "futures-timer", "if-watch", - "ipnet", "libc", "libp2p-core", "log", "socket2", ] -[[package]] -name = "libp2p-uds" -version = "0.33.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d125e3e5f0d58f3c6ac21815b20cf4b6a88b8db9dc26368ea821838f4161fd4d" -dependencies = [ - "async-std", - "futures", - "libp2p-core", - "log", -] - [[package]] name = "libp2p-wasm-ext" -version = "0.34.0" +version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec894790eec3c1608f8d1a8a0bdf0dbeb79ed4de2dce964222011c2896dfa05a" +checksum = "a17b5b8e7a73e379e47b1b77f8a82c4721e97eca01abcd18e9cd91a23ca6ce97" dependencies = [ "futures", "js-sys", @@ -5448,9 +5278,9 @@ dependencies = [ [[package]] name = "libp2p-websocket" -version = "0.36.0" +version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9808e57e81be76ff841c106b4c5974fb4d41a233a7bdd2afbf1687ac6def3818" +checksum = "3758ae6f89b2531a24b6d9f5776bda6a626b60a57600d7185d43dfa75ca5ecc4" dependencies = [ "either", "futures", @@ -5467,12 +5297,13 @@ dependencies = [ [[package]] name = "libp2p-yamux" -version = "0.38.0" +version = "0.41.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6dea686217a06072033dc025631932810e2f6ad784e4fafa42e27d311c7a81c" +checksum = "0d6874d66543c4f7e26e3b8ca9a6bead351563a13ab4fafd43c7927f7c0d6c12" dependencies = [ "futures", "libp2p-core", + "log", "parking_lot 0.12.1", "thiserror", "yamux", @@ -5480,9 +5311,9 @@ dependencies = [ [[package]] name = "librocksdb-sys" -version = "0.6.1+6.28.2" +version = "0.8.0+7.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81bc587013734dadb7cf23468e531aa120788b87243648be42e2d3a072186291" +checksum = "611804e4666a25136fcc5f8cf425ab4d26c7f74ea245ffe92ea23b85b6420b5d" dependencies = [ "bindgen", "bzip2-sys", @@ -5512,25 +5343,6 @@ dependencies = [ "typenum 1.16.0 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "libsecp256k1" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9d220bc1feda2ac231cb78c3d26f27676b8cf82c96971f7aeef3d0cf2797c73" -dependencies = [ - "arrayref", - "base64 0.12.3", - "digest 0.9.0", - "hmac-drbg", - "libsecp256k1-core 0.2.2", - "libsecp256k1-gen-ecmult 0.2.1", - "libsecp256k1-gen-genmult 0.2.1", - "rand 0.7.3", - "serde", - "sha2 0.9.9", - "typenum 1.16.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "libsecp256k1" version = "0.7.1" @@ -5681,19 +5493,10 @@ version = "0.4.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "value-bag", ] -[[package]] -name = "lru" -version = "0.7.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e999beba7b6e8345721bd280141ed958096a2e4abdf74f67ff4ce49b4b54e47a" -dependencies = [ - "hashbrown", -] - [[package]] name = "lru" version = "0.8.1" @@ -5815,9 +5618,9 @@ dependencies = [ [[package]] name = "memory-db" -version = "0.29.0" +version = "0.30.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6566c70c1016f525ced45d7b7f97730a2bafb037c788211d0c186ef5b2189f0a" +checksum = "34ac11bb793c28fa095b7554466f53b3a60a2cd002afdac01bcf135cbd73a269" dependencies = [ "hash-db", "hashbrown", @@ -5830,7 +5633,7 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ce95ae042940bad7e312857b929ee3d11b8f799a80cb7b9c7ec5125516906395" dependencies = [ - "lru 0.8.1", + "lru", ] [[package]] @@ -5899,6 +5702,33 @@ dependencies = [ "windows-sys 0.42.0", ] +[[package]] +name = "mockall" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50e4a1c770583dac7ab5e2f6c139153b783a53a1bbee9729613f193e59828326" +dependencies = [ + "cfg-if", + "downcast", + "fragile", + "lazy_static", + "mockall_derive", + "predicates", + "predicates-tree", +] + +[[package]] +name = "mockall_derive" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "832663583d5fa284ca8810bf7015e46c9fff9622d3cf34bd1eea5003fec06dd0" +dependencies = [ + "cfg-if", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "multiaddr" version = "0.14.0" @@ -5967,9 +5797,9 @@ checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a" [[package]] name = "multistream-select" -version = "0.11.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "363a84be6453a70e63513660f4894ef815daf88e3356bffcda9ca27d810ce83b" +checksum = "c8552ab875c1313b97b8d20cb857b9fd63e2d1d6a0a1b53ce9821e575405f27a" dependencies = [ "bytes", "futures", @@ -5989,7 +5819,7 @@ dependencies = [ "matrixmultiply", "nalgebra-macros", "num-complex", - "num-rational 0.4.1", + "num-rational", "num-traits", "rand 0.8.5", "rand_distr", @@ -6096,7 +5926,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fa52e972a9a719cecb6864fb88568781eb706bac2cd1d4f04a648542dbf78069" dependencies = [ "bitflags", - "cfg-if 1.0.0", + "cfg-if", "libc", ] @@ -6122,28 +5952,23 @@ dependencies = [ "minimal-lexical", ] +[[package]] +name = "normalize-line-endings" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61807f77802ff30975e01f4f071c8ba10c022052f98b3294119f3e615d13e5be" + [[package]] name = "num" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "43db66d1170d347f9a065114077f7dccb00c1b9478c89384490a3425279a4606" dependencies = [ - "num-bigint 0.4.3", + "num-bigint", "num-complex", "num-integer", "num-iter", - "num-rational 0.4.1", - "num-traits", -] - -[[package]] -name = "num-bigint" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "090c7f9998ee0ff65aa5b723e4009f7b217707f1fb5ea551329cc4d6231fb304" -dependencies = [ - "autocfg", - "num-integer", + "num-rational", "num-traits", ] @@ -6198,18 +6023,6 @@ dependencies = [ "num-traits", ] -[[package]] -name = "num-rational" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c000134b5dbf44adc5cb772486d335293351644b801551abe8f75c84cfa4aef" -dependencies = [ - "autocfg", - "num-bigint 0.2.6", - "num-integer", - "num-traits", -] - [[package]] name = "num-rational" version = "0.4.1" @@ -6217,7 +6030,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" dependencies = [ "autocfg", - "num-bigint 0.4.3", + "num-bigint", "num-integer", "num-traits", ] @@ -6310,8 +6123,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "orchestra" -version = "0.0.1" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +version = "0.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0aab54694ddaa8a9b703724c6ef04272b2d27bc32d2c855aae5cdd1857216b43" dependencies = [ "async-trait", "dyn-clonable", @@ -6326,8 +6140,9 @@ dependencies = [ [[package]] name = "orchestra-proc-macro" -version = "0.0.1" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +version = "0.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a702b2f6bf592b3eb06c00d80d05afaf7a8eff6b41bb361e397d799acc21b45a" dependencies = [ "expander 0.0.6", "itertools", @@ -6350,7 +6165,7 @@ dependencies = [ [[package]] name = "orml-traits" version = "0.4.1-dev" -source = "git+https://github.com/open-web3-stack/open-runtime-module-library?branch=polkadot-v0.9.30#ae13a54dbc1a654df0e2d5e9dc18582b62716365" +source = "git+https://github.com/open-web3-stack/open-runtime-module-library?branch=polkadot-v0.9.33#dc39cfddefb10ef0de23655e2c3dcdab66a19404" dependencies = [ "frame-support", "impl-trait-for-tuples", @@ -6367,7 +6182,7 @@ dependencies = [ [[package]] name = "orml-utilities" version = "0.4.1-dev" -source = "git+https://github.com/open-web3-stack/open-runtime-module-library?branch=polkadot-v0.9.30#ae13a54dbc1a654df0e2d5e9dc18582b62716365" +source = "git+https://github.com/open-web3-stack/open-runtime-module-library?branch=polkadot-v0.9.33#dc39cfddefb10ef0de23655e2c3dcdab66a19404" dependencies = [ "frame-support", "parity-scale-codec", @@ -6383,29 +6198,20 @@ version = "6.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b7820b9daea5457c9f21c69448905d723fbd21136ccf521748f23fd49e723ee" -[[package]] -name = "owning_ref" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ff55baddef9e4ad00f88b6c743a2a8062d4c6ade126c2a528644b8e444d52ce" -dependencies = [ - "stable_deref_trait", -] - [[package]] name = "packed_simd_2" version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1914cd452d8fccd6f9db48147b29fd4ae05bea9dc5d9ad578509f72415de282" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "libm 0.1.4", ] [[package]] name = "pallet-assets" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "frame-benchmarking", "frame-support", @@ -6419,7 +6225,7 @@ dependencies = [ [[package]] name = "pallet-aura" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "frame-support", "frame-system", @@ -6435,7 +6241,7 @@ dependencies = [ [[package]] name = "pallet-authority-discovery" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "frame-support", "frame-system", @@ -6451,7 +6257,7 @@ dependencies = [ [[package]] name = "pallet-authorship" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "frame-support", "frame-system", @@ -6466,7 +6272,7 @@ dependencies = [ [[package]] name = "pallet-babe" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "frame-benchmarking", "frame-support", @@ -6490,7 +6296,7 @@ dependencies = [ [[package]] name = "pallet-bags-list" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -6510,7 +6316,7 @@ dependencies = [ [[package]] name = "pallet-balances" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "frame-benchmarking", "frame-support", @@ -6522,25 +6328,10 @@ dependencies = [ "sp-std", ] -[[package]] -name = "pallet-base-fee" -version = "1.0.0" -source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.30#1bd889c001b2a4735777160354cb57b8c17cf756" -dependencies = [ - "fp-evm", - "frame-support", - "frame-system", - "parity-scale-codec", - "scale-info", - "serde", - "sp-core", - "sp-runtime", -] - [[package]] name = "pallet-beefy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "beefy-primitives", "frame-support", @@ -6556,7 +6347,7 @@ dependencies = [ [[package]] name = "pallet-beefy-mmr" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "array-bytes 4.2.0", "beefy-merkle-tree", @@ -6579,7 +6370,7 @@ dependencies = [ [[package]] name = "pallet-bounties" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "frame-benchmarking", "frame-support", @@ -6597,7 +6388,7 @@ dependencies = [ [[package]] name = "pallet-bridge-dispatch" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.30#dd55c3dbc30f54e93fc231e9161a810153a8c266" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.33#f98feb62bcf0a0e5b4b971e9ba22640e4bce625f" dependencies = [ "bp-message-dispatch", "bp-runtime", @@ -6613,7 +6404,7 @@ dependencies = [ [[package]] name = "pallet-bridge-grandpa" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.30#dd55c3dbc30f54e93fc231e9161a810153a8c266" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.33#f98feb62bcf0a0e5b4b971e9ba22640e4bce625f" dependencies = [ "bp-header-chain", "bp-runtime", @@ -6635,7 +6426,7 @@ dependencies = [ [[package]] name = "pallet-bridge-messages" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.30#dd55c3dbc30f54e93fc231e9161a810153a8c266" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.33#f98feb62bcf0a0e5b4b971e9ba22640e4bce625f" dependencies = [ "bitvec", "bp-message-dispatch", @@ -6656,7 +6447,7 @@ dependencies = [ [[package]] name = "pallet-bridge-parachains" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.30#dd55c3dbc30f54e93fc231e9161a810153a8c266" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.33#f98feb62bcf0a0e5b4b971e9ba22640e4bce625f" dependencies = [ "bp-parachains", "bp-polkadot-core", @@ -6677,7 +6468,7 @@ dependencies = [ [[package]] name = "pallet-child-bounties" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "frame-benchmarking", "frame-support", @@ -6696,7 +6487,7 @@ dependencies = [ [[package]] name = "pallet-collective" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "frame-benchmarking", "frame-support", @@ -6710,17 +6501,36 @@ dependencies = [ "sp-std", ] +[[package]] +name = "pallet-conviction-voting" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +dependencies = [ + "assert_matches", + "frame-benchmarking", + "frame-support", + "frame-system", + "parity-scale-codec", + "scale-info", + "serde", + "sp-io", + "sp-runtime", + "sp-std", +] + [[package]] name = "pallet-democracy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "frame-benchmarking", "frame-support", "frame-system", + "log", "parity-scale-codec", "scale-info", "serde", + "sp-core", "sp-io", "sp-runtime", "sp-std", @@ -6729,7 +6539,7 @@ dependencies = [ [[package]] name = "pallet-election-provider-multi-phase" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -6753,7 +6563,7 @@ dependencies = [ [[package]] name = "pallet-election-provider-support-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -6766,7 +6576,7 @@ dependencies = [ [[package]] name = "pallet-elections-phragmen" version = "5.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "frame-benchmarking", "frame-support", @@ -6784,10 +6594,10 @@ dependencies = [ [[package]] name = "pallet-ethereum" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.30#1bd889c001b2a4735777160354cb57b8c17cf756" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.33#05ee2dbf537bf5bbcbc5b4785be62088034bdd58" dependencies = [ "ethereum", - "ethereum-types", + "ethereum-types 0.14.1", "evm", "fp-consensus", "fp-ethereum", @@ -6811,7 +6621,7 @@ dependencies = [ [[package]] name = "pallet-evm" version = "6.0.0-dev" -source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.30#1bd889c001b2a4735777160354cb57b8c17cf756" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.33#05ee2dbf537bf5bbcbc5b4785be62088034bdd58" dependencies = [ "environmental", "evm", @@ -6823,7 +6633,7 @@ dependencies = [ "log", "pallet-timestamp", "parity-scale-codec", - "primitive-types 0.11.1", + "primitive-types 0.12.1", "rlp", "scale-info", "serde", @@ -6836,7 +6646,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-blake2" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.30#1bd889c001b2a4735777160354cb57b8c17cf756" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.33#05ee2dbf537bf5bbcbc5b4785be62088034bdd58" dependencies = [ "fp-evm", ] @@ -6844,17 +6654,27 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-bn128" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.30#1bd889c001b2a4735777160354cb57b8c17cf756" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.33#05ee2dbf537bf5bbcbc5b4785be62088034bdd58" dependencies = [ "fp-evm", "sp-core", "substrate-bn", ] +[[package]] +name = "pallet-evm-precompile-dispatch" +version = "2.0.0-dev" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.33#05ee2dbf537bf5bbcbc5b4785be62088034bdd58" +dependencies = [ + "fp-evm", + "frame-support", + "pallet-evm", +] + [[package]] name = "pallet-evm-precompile-modexp" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.30#1bd889c001b2a4735777160354cb57b8c17cf756" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.33#05ee2dbf537bf5bbcbc5b4785be62088034bdd58" dependencies = [ "fp-evm", "num", @@ -6863,7 +6683,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-simple" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.30#1bd889c001b2a4735777160354cb57b8c17cf756" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.33#05ee2dbf537bf5bbcbc5b4785be62088034bdd58" dependencies = [ "fp-evm", "ripemd", @@ -6873,16 +6693,13 @@ dependencies = [ [[package]] name = "pallet-fast-unstake" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "frame-benchmarking", "frame-election-provider-support", "frame-support", "frame-system", "log", - "pallet-balances", - "pallet-staking", - "pallet-timestamp", "parity-scale-codec", "scale-info", "sp-io", @@ -6894,7 +6711,7 @@ dependencies = [ [[package]] name = "pallet-fee-market" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.30#dd55c3dbc30f54e93fc231e9161a810153a8c266" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.33#f98feb62bcf0a0e5b4b971e9ba22640e4bce625f" dependencies = [ "bp-messages", "bp-runtime", @@ -6913,7 +6730,7 @@ dependencies = [ [[package]] name = "pallet-gilt" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "frame-benchmarking", "frame-support", @@ -6928,7 +6745,7 @@ dependencies = [ [[package]] name = "pallet-grandpa" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "frame-benchmarking", "frame-support", @@ -6951,7 +6768,7 @@ dependencies = [ [[package]] name = "pallet-identity" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "enumflags2", "frame-benchmarking", @@ -6967,7 +6784,7 @@ dependencies = [ [[package]] name = "pallet-im-online" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "frame-benchmarking", "frame-support", @@ -6987,7 +6804,7 @@ dependencies = [ [[package]] name = "pallet-indices" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "frame-benchmarking", "frame-support", @@ -7004,7 +6821,7 @@ dependencies = [ [[package]] name = "pallet-membership" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "frame-benchmarking", "frame-support", @@ -7021,7 +6838,7 @@ dependencies = [ [[package]] name = "pallet-mmr" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "ckb-merkle-mountain-range", "frame-benchmarking", @@ -7039,8 +6856,9 @@ dependencies = [ [[package]] name = "pallet-mmr-rpc" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ + "anyhow", "jsonrpsee", "parity-scale-codec", "serde", @@ -7054,11 +6872,12 @@ dependencies = [ [[package]] name = "pallet-multisig" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "frame-benchmarking", "frame-support", "frame-system", + "log", "parity-scale-codec", "scale-info", "sp-io", @@ -7069,7 +6888,7 @@ dependencies = [ [[package]] name = "pallet-nomination-pools" version = "1.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "frame-support", "frame-system", @@ -7086,7 +6905,7 @@ dependencies = [ [[package]] name = "pallet-nomination-pools-benchmarking" version = "1.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -7106,7 +6925,7 @@ dependencies = [ [[package]] name = "pallet-nomination-pools-runtime-api" version = "1.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "parity-scale-codec", "sp-api", @@ -7116,7 +6935,7 @@ dependencies = [ [[package]] name = "pallet-offences" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "frame-support", "frame-system", @@ -7133,7 +6952,7 @@ dependencies = [ [[package]] name = "pallet-offences-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -7156,11 +6975,12 @@ dependencies = [ [[package]] name = "pallet-preimage" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "frame-benchmarking", "frame-support", "frame-system", + "log", "parity-scale-codec", "scale-info", "sp-core", @@ -7172,13 +6992,31 @@ dependencies = [ [[package]] name = "pallet-proxy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "parity-scale-codec", + "scale-info", + "sp-io", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "pallet-ranked-collective" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "frame-benchmarking", "frame-support", "frame-system", + "log", "parity-scale-codec", "scale-info", + "sp-arithmetic", + "sp-core", "sp-io", "sp-runtime", "sp-std", @@ -7187,7 +7025,7 @@ dependencies = [ [[package]] name = "pallet-recovery" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "frame-benchmarking", "frame-support", @@ -7199,10 +7037,28 @@ dependencies = [ "sp-std", ] +[[package]] +name = "pallet-referenda" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +dependencies = [ + "assert_matches", + "frame-benchmarking", + "frame-support", + "frame-system", + "parity-scale-codec", + "scale-info", + "serde", + "sp-arithmetic", + "sp-io", + "sp-runtime", + "sp-std", +] + [[package]] name = "pallet-scheduler" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "frame-benchmarking", "frame-support", @@ -7218,7 +7074,7 @@ dependencies = [ [[package]] name = "pallet-session" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "frame-support", "frame-system", @@ -7239,7 +7095,7 @@ dependencies = [ [[package]] name = "pallet-session-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "frame-benchmarking", "frame-support", @@ -7255,7 +7111,7 @@ dependencies = [ [[package]] name = "pallet-society" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "frame-support", "frame-system", @@ -7269,7 +7125,7 @@ dependencies = [ [[package]] name = "pallet-staking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -7292,7 +7148,7 @@ dependencies = [ [[package]] name = "pallet-staking-reward-curve" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -7303,16 +7159,33 @@ dependencies = [ [[package]] name = "pallet-staking-reward-fn" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "log", "sp-arithmetic", ] +[[package]] +name = "pallet-state-trie-migration" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", +] + [[package]] name = "pallet-sudo" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "frame-support", "frame-system", @@ -7326,7 +7199,7 @@ dependencies = [ [[package]] name = "pallet-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "frame-benchmarking", "frame-support", @@ -7344,7 +7217,7 @@ dependencies = [ [[package]] name = "pallet-tips" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "frame-benchmarking", "frame-support", @@ -7363,7 +7236,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "frame-support", "frame-system", @@ -7379,7 +7252,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "jsonrpsee", "pallet-transaction-payment-rpc-runtime-api", @@ -7389,23 +7262,25 @@ dependencies = [ "sp-core", "sp-rpc", "sp-runtime", + "sp-weights", ] [[package]] name = "pallet-transaction-payment-rpc-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "pallet-transaction-payment", "parity-scale-codec", "sp-api", "sp-runtime", + "sp-weights", ] [[package]] name = "pallet-treasury" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "frame-benchmarking", "frame-support", @@ -7422,7 +7297,7 @@ dependencies = [ [[package]] name = "pallet-utility" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "frame-benchmarking", "frame-support", @@ -7438,7 +7313,7 @@ dependencies = [ [[package]] name = "pallet-vesting" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "frame-benchmarking", "frame-support", @@ -7450,10 +7325,25 @@ dependencies = [ "sp-std", ] +[[package]] +name = "pallet-whitelist" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "parity-scale-codec", + "scale-info", + "sp-api", + "sp-runtime", + "sp-std", +] + [[package]] name = "pallet-xcm" -version = "0.9.30" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +version = "0.9.33" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" dependencies = [ "frame-support", "frame-system", @@ -7470,8 +7360,8 @@ dependencies = [ [[package]] name = "pallet-xcm-benchmarks" -version = "0.9.30" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +version = "0.9.33" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" dependencies = [ "frame-benchmarking", "frame-support", @@ -7513,7 +7403,6 @@ dependencies = [ "darwinia-precompile-assets", "darwinia-precompile-bls12-381", "darwinia-precompile-deposit", - "darwinia-precompile-dispatch", "darwinia-precompile-staking", "darwinia-precompile-state-storage", "darwinia-staking", @@ -7531,7 +7420,6 @@ dependencies = [ "pallet-aura", "pallet-authorship", "pallet-balances", - "pallet-base-fee", "pallet-bridge-dispatch", "pallet-bridge-grandpa", "pallet-bridge-messages", @@ -7542,6 +7430,7 @@ dependencies = [ "pallet-evm", "pallet-evm-precompile-blake2", "pallet-evm-precompile-bn128", + "pallet-evm-precompile-dispatch", "pallet-evm-precompile-modexp", "pallet-evm-precompile-simple", "pallet-fee-market", @@ -7591,23 +7480,22 @@ dependencies = [ [[package]] name = "parachain-info" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.30#7b1fc0ed107fe42bb7e6a5dfefb586f4c3ae4328" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.33#27721d794ee63aae42317a7eeda21595dd3200d9" dependencies = [ "cumulus-primitives-core", "frame-support", "frame-system", "parity-scale-codec", "scale-info", - "serde", ] [[package]] name = "parity-db" -version = "0.3.17" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c8fdb726a43661fa54b43e7114e6b88b2289cae388eb3ad766d9d1754d83fce" +checksum = "3a7511a0bec4a336b5929999d02b560d2439c993cccf98c26481484e811adc43" dependencies = [ - "blake2-rfc", + "blake2", "crc32fast", "fs2", "hex", @@ -7655,18 +7543,18 @@ checksum = "aa9777aa91b8ad9dd5aaa04a9b6bcb02c7f1deb952fca5a66034d5e63afc5c6f" [[package]] name = "parity-util-mem" -version = "0.11.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c32561d248d352148124f036cac253a644685a21dc9fea383eb4907d7bd35a8f" +checksum = "0d32c34f4f5ca7f9196001c0aba5a1f9a5a12382c8944b8b0f90233282d1e8f8" dependencies = [ - "cfg-if 1.0.0", - "ethereum-types", + "cfg-if", + "ethereum-types 0.14.1", "hashbrown", "impl-trait-for-tuples", - "lru 0.7.8", + "lru", "parity-util-mem-derive", "parking_lot 0.12.1", - "primitive-types 0.11.1", + "primitive-types 0.12.1", "smallvec", "winapi", ] @@ -7682,15 +7570,6 @@ dependencies = [ "synstructure", ] -[[package]] -name = "parity-wasm" -version = "0.32.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16ad52817c4d343339b3bc2e26861bd21478eda0b7509acf83505727000512ac" -dependencies = [ - "byteorder", -] - [[package]] name = "parity-wasm" version = "0.45.0" @@ -7730,7 +7609,7 @@ version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "60a2cfe6f0ad2bfc16aefa463b497d5c7a5ecd44a23efa72aa342d90177356dc" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "instant", "libc", "redox_syscall", @@ -7744,7 +7623,7 @@ version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ff9f3fef3968a3ec5945535ed654cb38ff72d7495a25619e2247fb15a2ed9ba" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "libc", "redox_syscall", "smallvec", @@ -7881,13 +7760,12 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkcs8" -version = "0.8.0" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cabda3fb821068a9a4fab19a683eac3af12edf0f34b94a8be53c4972b8149d0" +checksum = "9eca2c590a5f85da82668fa685c09ce2888b9430e83299debf1f34b65fd4a4ba" dependencies = [ "der", "spki", - "zeroize", ] [[package]] @@ -7910,8 +7788,8 @@ checksum = "e3d7ddaed09e0eb771a79ab0fd64609ba0afb0a8366421957936ad14cbd13630" [[package]] name = "polkadot-approval-distribution" -version = "0.9.30" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +version = "0.9.33" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" dependencies = [ "futures", "polkadot-node-network-protocol", @@ -7925,8 +7803,8 @@ dependencies = [ [[package]] name = "polkadot-availability-bitfield-distribution" -version = "0.9.30" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +version = "0.9.33" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" dependencies = [ "futures", "polkadot-node-network-protocol", @@ -7939,13 +7817,13 @@ dependencies = [ [[package]] name = "polkadot-availability-distribution" -version = "0.9.30" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +version = "0.9.33" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" dependencies = [ "derive_more", "fatality", "futures", - "lru 0.7.8", + "lru", "parity-scale-codec", "polkadot-erasure-coding", "polkadot-node-network-protocol", @@ -7962,12 +7840,12 @@ dependencies = [ [[package]] name = "polkadot-availability-recovery" -version = "0.9.30" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +version = "0.9.33" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" dependencies = [ "fatality", "futures", - "lru 0.7.8", + "lru", "parity-scale-codec", "polkadot-erasure-coding", "polkadot-node-network-protocol", @@ -7983,8 +7861,8 @@ dependencies = [ [[package]] name = "polkadot-cli" -version = "0.9.30" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +version = "0.9.33" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" dependencies = [ "clap", "frame-benchmarking-cli", @@ -8009,8 +7887,8 @@ dependencies = [ [[package]] name = "polkadot-client" -version = "0.9.30" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +version = "0.9.33" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" dependencies = [ "beefy-primitives", "frame-benchmarking", @@ -8051,10 +7929,11 @@ dependencies = [ [[package]] name = "polkadot-collator-protocol" -version = "0.9.30" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +version = "0.9.33" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" dependencies = [ "always-assert", + "bitvec", "fatality", "futures", "futures-timer", @@ -8072,8 +7951,8 @@ dependencies = [ [[package]] name = "polkadot-core-primitives" -version = "0.9.30" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +version = "0.9.33" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" dependencies = [ "parity-scale-codec", "parity-util-mem", @@ -8085,13 +7964,15 @@ dependencies = [ [[package]] name = "polkadot-dispute-distribution" -version = "0.9.30" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +version = "0.9.33" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" dependencies = [ "derive_more", "fatality", "futures", - "lru 0.7.8", + "futures-timer", + "indexmap", + "lru", "parity-scale-codec", "polkadot-erasure-coding", "polkadot-node-network-protocol", @@ -8108,8 +7989,8 @@ dependencies = [ [[package]] name = "polkadot-erasure-coding" -version = "0.9.30" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +version = "0.9.33" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" dependencies = [ "parity-scale-codec", "polkadot-node-primitives", @@ -8122,8 +8003,8 @@ dependencies = [ [[package]] name = "polkadot-gossip-support" -version = "0.9.30" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +version = "0.9.33" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" dependencies = [ "futures", "futures-timer", @@ -8142,8 +8023,8 @@ dependencies = [ [[package]] name = "polkadot-network-bridge" -version = "0.9.30" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +version = "0.9.33" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" dependencies = [ "always-assert", "async-trait", @@ -8166,8 +8047,8 @@ dependencies = [ [[package]] name = "polkadot-node-collation-generation" -version = "0.9.30" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +version = "0.9.33" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" dependencies = [ "futures", "parity-scale-codec", @@ -8184,15 +8065,15 @@ dependencies = [ [[package]] name = "polkadot-node-core-approval-voting" -version = "0.9.30" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +version = "0.9.33" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" dependencies = [ "bitvec", "derive_more", "futures", "futures-timer", "kvdb", - "lru 0.7.8", + "lru", "merlin", "parity-scale-codec", "polkadot-node-jaeger", @@ -8213,8 +8094,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-av-store" -version = "0.9.30" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +version = "0.9.33" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" dependencies = [ "bitvec", "futures", @@ -8233,8 +8114,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-backing" -version = "0.9.30" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +version = "0.9.33" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" dependencies = [ "bitvec", "fatality", @@ -8252,8 +8133,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-bitfield-signing" -version = "0.9.30" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +version = "0.9.33" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" dependencies = [ "futures", "polkadot-node-subsystem", @@ -8267,11 +8148,12 @@ dependencies = [ [[package]] name = "polkadot-node-core-candidate-validation" -version = "0.9.30" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +version = "0.9.33" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" dependencies = [ "async-trait", "futures", + "futures-timer", "parity-scale-codec", "polkadot-node-core-pvf", "polkadot-node-primitives", @@ -8285,8 +8167,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-chain-api" -version = "0.9.30" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +version = "0.9.33" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" dependencies = [ "futures", "polkadot-node-subsystem", @@ -8300,8 +8182,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-chain-selection" -version = "0.9.30" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +version = "0.9.33" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" dependencies = [ "futures", "futures-timer", @@ -8317,13 +8199,13 @@ dependencies = [ [[package]] name = "polkadot-node-core-dispute-coordinator" -version = "0.9.30" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +version = "0.9.33" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" dependencies = [ "fatality", "futures", "kvdb", - "lru 0.7.8", + "lru", "parity-scale-codec", "polkadot-node-primitives", "polkadot-node-subsystem", @@ -8336,8 +8218,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-parachains-inherent" -version = "0.9.30" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +version = "0.9.33" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" dependencies = [ "async-trait", "futures", @@ -8353,8 +8235,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-provisioner" -version = "0.9.30" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +version = "0.9.33" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" dependencies = [ "bitvec", "fatality", @@ -8371,8 +8253,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-pvf" -version = "0.9.30" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +version = "0.9.33" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" dependencies = [ "always-assert", "assert_matches", @@ -8403,8 +8285,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-pvf-checker" -version = "0.9.30" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +version = "0.9.33" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" dependencies = [ "futures", "polkadot-node-primitives", @@ -8419,8 +8301,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-runtime-api" -version = "0.9.30" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +version = "0.9.33" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" dependencies = [ "futures", "memory-lru", @@ -8435,8 +8317,8 @@ dependencies = [ [[package]] name = "polkadot-node-jaeger" -version = "0.9.30" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +version = "0.9.33" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" dependencies = [ "async-std", "lazy_static", @@ -8453,8 +8335,8 @@ dependencies = [ [[package]] name = "polkadot-node-metrics" -version = "0.9.30" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +version = "0.9.33" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" dependencies = [ "bs58", "futures", @@ -8472,8 +8354,8 @@ dependencies = [ [[package]] name = "polkadot-node-network-protocol" -version = "0.9.30" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +version = "0.9.33" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" dependencies = [ "async-trait", "derive_more", @@ -8495,8 +8377,8 @@ dependencies = [ [[package]] name = "polkadot-node-primitives" -version = "0.9.30" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +version = "0.9.33" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" dependencies = [ "bounded-vec", "futures", @@ -8517,8 +8399,8 @@ dependencies = [ [[package]] name = "polkadot-node-subsystem" -version = "0.9.30" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +version = "0.9.33" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" dependencies = [ "polkadot-node-jaeger", "polkadot-node-subsystem-types", @@ -8527,8 +8409,8 @@ dependencies = [ [[package]] name = "polkadot-node-subsystem-types" -version = "0.9.30" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +version = "0.9.33" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" dependencies = [ "async-trait", "derive_more", @@ -8550,8 +8432,8 @@ dependencies = [ [[package]] name = "polkadot-node-subsystem-util" -version = "0.9.30" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +version = "0.9.33" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" dependencies = [ "async-trait", "derive_more", @@ -8559,7 +8441,7 @@ dependencies = [ "futures", "itertools", "kvdb", - "lru 0.7.8", + "lru", "parity-db", "parity-scale-codec", "parity-util-mem", @@ -8583,13 +8465,13 @@ dependencies = [ [[package]] name = "polkadot-overseer" -version = "0.9.30" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +version = "0.9.33" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" dependencies = [ "async-trait", "futures", "futures-timer", - "lru 0.7.8", + "lru", "orchestra", "parity-util-mem", "parking_lot 0.12.1", @@ -8606,8 +8488,8 @@ dependencies = [ [[package]] name = "polkadot-parachain" -version = "0.9.30" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +version = "0.9.33" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" dependencies = [ "derive_more", "frame-support", @@ -8623,8 +8505,8 @@ dependencies = [ [[package]] name = "polkadot-performance-test" -version = "0.9.30" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +version = "0.9.33" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" dependencies = [ "env_logger 0.9.3", "kusama-runtime", @@ -8638,11 +8520,10 @@ dependencies = [ [[package]] name = "polkadot-primitives" -version = "0.9.30" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +version = "0.9.33" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" dependencies = [ "bitvec", - "frame-system", "hex-literal", "parity-scale-codec", "parity-util-mem", @@ -8662,14 +8543,12 @@ dependencies = [ "sp-runtime", "sp-staking", "sp-std", - "sp-trie", - "sp-version", ] [[package]] name = "polkadot-rpc" -version = "0.9.30" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +version = "0.9.33" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" dependencies = [ "beefy-gadget", "beefy-gadget-rpc", @@ -8700,8 +8579,8 @@ dependencies = [ [[package]] name = "polkadot-runtime" -version = "0.9.30" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +version = "0.9.33" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" dependencies = [ "beefy-primitives", "bitvec", @@ -8789,8 +8668,8 @@ dependencies = [ [[package]] name = "polkadot-runtime-common" -version = "0.9.30" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +version = "0.9.33" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" dependencies = [ "beefy-primitives", "bitvec", @@ -8809,6 +8688,7 @@ dependencies = [ "pallet-election-provider-multi-phase", "pallet-session", "pallet-staking", + "pallet-staking-reward-fn", "pallet-timestamp", "pallet-transaction-payment", "pallet-treasury", @@ -8836,20 +8716,22 @@ dependencies = [ [[package]] name = "polkadot-runtime-constants" -version = "0.9.30" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +version = "0.9.33" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" dependencies = [ "frame-support", "polkadot-primitives", "polkadot-runtime-common", "smallvec", + "sp-core", "sp-runtime", + "sp-weights", ] [[package]] name = "polkadot-runtime-metrics" -version = "0.9.30" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +version = "0.9.33" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" dependencies = [ "bs58", "parity-scale-codec", @@ -8860,8 +8742,8 @@ dependencies = [ [[package]] name = "polkadot-runtime-parachains" -version = "0.9.30" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +version = "0.9.33" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" dependencies = [ "bitflags", "bitvec", @@ -8903,8 +8785,8 @@ dependencies = [ [[package]] name = "polkadot-service" -version = "0.9.30" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +version = "0.9.33" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" dependencies = [ "async-trait", "beefy-gadget", @@ -8917,7 +8799,7 @@ dependencies = [ "kusama-runtime-constants", "kvdb", "kvdb-rocksdb", - "lru 0.7.8", + "lru", "pallet-babe", "pallet-im-online", "pallet-staking", @@ -9009,8 +8891,8 @@ dependencies = [ [[package]] name = "polkadot-statement-distribution" -version = "0.9.30" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +version = "0.9.33" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" dependencies = [ "arrayvec 0.5.2", "fatality", @@ -9030,8 +8912,8 @@ dependencies = [ [[package]] name = "polkadot-statement-table" -version = "0.9.30" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +version = "0.9.33" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" dependencies = [ "parity-scale-codec", "polkadot-primitives", @@ -9045,7 +8927,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "22122d5ec4f9fe1b3916419b76be1e80bcb93f618d071d2edf841b137b2a2bd6" dependencies = [ "autocfg", - "cfg-if 1.0.0", + "cfg-if", "libc", "log", "wepoll-ffi", @@ -9069,7 +8951,7 @@ version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8419d2b623c7c0896ff2d5d96e2cb4ede590fed28fcc34934f4c33c036e620a1" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "cpufeatures", "opaque-debug 0.3.0", "universal-hash", @@ -9084,14 +8966,16 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "precompile-utils" version = "0.1.0" -source = "git+https://github.com/darwinia-network/moonbeam?branch=polkadot-v0.9.30#9d31c6120bb0f317053da9cac7fe7cd2a44f844c" +source = "git+https://github.com/darwinia-network/moonbeam?branch=polkadot-v0.9.33#4ea11a7b2b71e0f4f6d100f5fa04e0f3ea285895" dependencies = [ "affix", + "derive_more", "evm", "fp-evm", "frame-support", "frame-system", "hex", + "hex-literal", "impl-trait-for-tuples", "log", "num_enum", @@ -9099,7 +8983,9 @@ dependencies = [ "parity-scale-codec", "paste", "precompile-utils-macro", - "sha3 0.9.1", + "scale-info", + "serde", + "sha3 0.10.6", "similar-asserts", "sp-core", "sp-io", @@ -9110,17 +8996,47 @@ dependencies = [ [[package]] name = "precompile-utils-macro" version = "0.1.0" -source = "git+https://github.com/darwinia-network/moonbeam?branch=polkadot-v0.9.30#9d31c6120bb0f317053da9cac7fe7cd2a44f844c" +source = "git+https://github.com/darwinia-network/moonbeam?branch=polkadot-v0.9.33#4ea11a7b2b71e0f4f6d100f5fa04e0f3ea285895" dependencies = [ "case", "num_enum", "prettyplease", "proc-macro2", "quote", - "sha3 0.8.2", + "sha3 0.10.6", "syn", ] +[[package]] +name = "predicates" +version = "2.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59230a63c37f3e18569bdb90e4a89cbf5bf8b06fea0b84e65ea10cc4df47addd" +dependencies = [ + "difflib", + "float-cmp", + "itertools", + "normalize-line-endings", + "predicates-core", + "regex", +] + +[[package]] +name = "predicates-core" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72f883590242d3c6fc5bf50299011695fa6590c2c70eac95ee1bdb9a733ad1a2" + +[[package]] +name = "predicates-tree" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54ff541861505aabf6ea722d2131ee980b8276e10a1297b94e896dd8b621850d" +dependencies = [ + "predicates-core", + "termtree", +] + [[package]] name = "pretty_env_logger" version = "0.4.0" @@ -9149,9 +9065,6 @@ checksum = "e28720988bff275df1f51b171e1b2a18c30d194c4d2b61defdacecd625a5d94a" dependencies = [ "fixed-hash 0.7.0", "impl-codec", - "impl-rlp", - "impl-serde", - "scale-info", "uint", ] @@ -9163,13 +9076,17 @@ checksum = "9f3486ccba82358b11a77516035647c34ba167dfa53312630de83b12bd4f3d66" dependencies = [ "fixed-hash 0.8.0", "impl-codec", + "impl-rlp", + "impl-serde 0.4.0", + "scale-info", "uint", ] [[package]] name = "prioritized-metered-channel" version = "0.2.0" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "382698e48a268c832d0b181ed438374a6bb708a82a8ca273bb0f61c74cf209c4" dependencies = [ "coarsetime", "crossbeam-queue", @@ -9231,7 +9148,7 @@ version = "0.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "449811d15fbdf5ceb5c1144416066429cf82316e2ec8ce0c1f6f8a02e7bbcf8c" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "fnv", "lazy_static", "memchr", @@ -9241,37 +9158,27 @@ dependencies = [ [[package]] name = "prometheus-client" -version = "0.16.0" +version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac1abe0255c04d15f571427a2d1e00099016506cf3297b53853acd2b7eb87825" +checksum = "83cd1b99916654a69008fd66b4f9397fbe08e6e51dfe23d4417acf5d3b8cb87c" dependencies = [ "dtoa", "itoa", - "owning_ref", + "parking_lot 0.12.1", "prometheus-client-derive-text-encode", ] [[package]] name = "prometheus-client-derive-text-encode" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8e12d01b9d66ad9eb4529c57666b6263fc1993cb30261d83ead658fdd932652" +checksum = "66a455fbcb954c1a7decf3c586e860fd7889cddf4b8e164be736dbac95a953cd" dependencies = [ "proc-macro2", "quote", "syn", ] -[[package]] -name = "prost" -version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71adf41db68aa0daaefc69bb30bcd68ded9b9abaad5d1fbb6304c4fb390e083e" -dependencies = [ - "bytes", - "prost-derive 0.10.1", -] - [[package]] name = "prost" version = "0.11.5" @@ -9279,29 +9186,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c01db6702aa05baa3f57dec92b8eeeeb4cb19e894e73996b32a4093289e54592" dependencies = [ "bytes", - "prost-derive 0.11.5", -] - -[[package]] -name = "prost-build" -version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ae5a4388762d5815a9fc0dea33c56b021cdc8dde0c55e0c9ca57197254b0cab" -dependencies = [ - "bytes", - "cfg-if 1.0.0", - "cmake", - "heck", - "itertools", - "lazy_static", - "log", - "multimap", - "petgraph", - "prost 0.10.4", - "prost-types 0.10.1", - "regex", - "tempfile", - "which", + "prost-derive", ] [[package]] @@ -9318,8 +9203,8 @@ dependencies = [ "multimap", "petgraph", "prettyplease", - "prost 0.11.5", - "prost-types 0.11.5", + "prost", + "prost-types", "regex", "syn", "tempfile", @@ -9328,30 +9213,17 @@ dependencies = [ [[package]] name = "prost-codec" -version = "0.1.0" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00af1e92c33b4813cc79fda3f2dbf56af5169709be0202df730e9ebc3e4cd007" +checksum = "011ae9ff8359df7915f97302d591cdd9e0e27fbd5a4ddc5bd13b71079bb20987" dependencies = [ "asynchronous-codec", "bytes", - "prost 0.10.4", + "prost", "thiserror", "unsigned-varint", ] -[[package]] -name = "prost-derive" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b670f45da57fb8542ebdbb6105a925fe571b67f9e7ed9f47a06a84e72b4e7cc" -dependencies = [ - "anyhow", - "itertools", - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "prost-derive" version = "0.11.5" @@ -9365,16 +9237,6 @@ dependencies = [ "syn", ] -[[package]] -name = "prost-types" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d0a014229361011dc8e69c8a1ec6c2e8d0f2af7c91e3ea3f5b2170298461e68" -dependencies = [ - "bytes", - "prost 0.10.4", -] - [[package]] name = "prost-types" version = "0.11.5" @@ -9382,7 +9244,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "017f79637768cde62820bc2d4fe0e45daaa027755c323ad077767c6c5f173091" dependencies = [ "bytes", - "prost 0.11.5", + "prost", ] [[package]] @@ -9648,10 +9510,9 @@ checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" [[package]] name = "remote-externalities" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "env_logger 0.9.3", - "jsonrpsee", "log", "parity-scale-codec", "serde", @@ -9660,6 +9521,7 @@ dependencies = [ "sp-io", "sp-runtime", "sp-version", + "substrate-rpc-client", ] [[package]] @@ -9683,12 +9545,12 @@ dependencies = [ [[package]] name = "rfc6979" -version = "0.1.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96ef608575f6392792f9ecf7890c00086591d29a83910939d430753f7c050525" +checksum = "7743f17af12fa0b03b803ba12cd6a8d9483a587e89c69445e3909655c0b9fabb" dependencies = [ "crypto-bigint", - "hmac 0.11.0", + "hmac 0.12.1", "zeroize", ] @@ -9723,6 +9585,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bb919243f34364b6bd2fc10ef797edbfa75f33c252e7998527479c6d6b47e1ec" dependencies = [ "bytes", + "rlp-derive", "rustc-hex", ] @@ -9739,9 +9602,9 @@ dependencies = [ [[package]] name = "rocksdb" -version = "0.18.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "620f4129485ff1a7128d184bc687470c21c7951b64779ebc9cfdad3dcd920290" +checksum = "7e9562ea1d70c0cc63a34a22d977753b50cca91cc6b6527750463bd5dd8697bc" dependencies = [ "libc", "librocksdb-sys", @@ -9749,8 +9612,8 @@ dependencies = [ [[package]] name = "rococo-runtime" -version = "0.9.30" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +version = "0.9.33" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" dependencies = [ "beefy-merkle-tree", "beefy-primitives", @@ -9789,6 +9652,7 @@ dependencies = [ "pallet-session", "pallet-society", "pallet-staking", + "pallet-state-trie-migration", "pallet-sudo", "pallet-timestamp", "pallet-tips", @@ -9833,14 +9697,16 @@ dependencies = [ [[package]] name = "rococo-runtime-constants" -version = "0.9.30" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +version = "0.9.33" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" dependencies = [ "frame-support", "polkadot-primitives", "polkadot-runtime-common", "smallvec", + "sp-core", "sp-runtime", + "sp-weights", ] [[package]] @@ -9990,15 +9856,6 @@ version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde" -[[package]] -name = "salsa20" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97a22f5af31f73a954c10289c93e8a50cc23d971e80ee446f1f6f7137a088213" -dependencies = [ - "cipher 0.4.3", -] - [[package]] name = "same-file" version = "1.0.6" @@ -10011,7 +9868,7 @@ dependencies = [ [[package]] name = "sc-allocator" version = "4.1.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "log", "sp-core", @@ -10022,7 +9879,7 @@ dependencies = [ [[package]] name = "sc-authority-discovery" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "async-trait", "futures", @@ -10031,8 +9888,8 @@ dependencies = [ "libp2p", "log", "parity-scale-codec", - "prost 0.10.4", - "prost-build 0.10.4", + "prost", + "prost-build", "rand 0.7.3", "sc-client-api", "sc-network-common", @@ -10049,7 +9906,7 @@ dependencies = [ [[package]] name = "sc-basic-authorship" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "futures", "futures-timer", @@ -10072,7 +9929,7 @@ dependencies = [ [[package]] name = "sc-block-builder" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "parity-scale-codec", "sc-client-api", @@ -10088,7 +9945,7 @@ dependencies = [ [[package]] name = "sc-chain-spec" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "impl-trait-for-tuples", "memmap2", @@ -10105,7 +9962,7 @@ dependencies = [ [[package]] name = "sc-chain-spec-derive" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -10116,7 +9973,7 @@ dependencies = [ [[package]] name = "sc-cli" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "array-bytes 4.2.0", "chrono", @@ -10156,7 +10013,7 @@ dependencies = [ [[package]] name = "sc-client-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "fnv", "futures", @@ -10184,7 +10041,7 @@ dependencies = [ [[package]] name = "sc-client-db" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "hash-db", "kvdb", @@ -10209,7 +10066,7 @@ dependencies = [ [[package]] name = "sc-consensus" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "async-trait", "futures", @@ -10233,7 +10090,7 @@ dependencies = [ [[package]] name = "sc-consensus-aura" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "async-trait", "futures", @@ -10262,19 +10119,18 @@ dependencies = [ [[package]] name = "sc-consensus-babe" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "async-trait", "fork-tree", "futures", "log", "merlin", - "num-bigint 0.2.6", - "num-rational 0.2.4", + "num-bigint", + "num-rational", "num-traits", "parity-scale-codec", "parking_lot 0.12.1", - "rand 0.7.3", "sc-client-api", "sc-consensus", "sc-consensus-epochs", @@ -10304,7 +10160,7 @@ dependencies = [ [[package]] name = "sc-consensus-babe-rpc" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "futures", "jsonrpsee", @@ -10326,7 +10182,7 @@ dependencies = [ [[package]] name = "sc-consensus-epochs" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "fork-tree", "parity-scale-codec", @@ -10339,7 +10195,7 @@ dependencies = [ [[package]] name = "sc-consensus-slots" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "async-trait", "futures", @@ -10363,10 +10219,10 @@ dependencies = [ [[package]] name = "sc-executor" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "lazy_static", - "lru 0.7.8", + "lru", "parity-scale-codec", "parking_lot 0.12.1", "sc-executor-common", @@ -10379,7 +10235,6 @@ dependencies = [ "sp-io", "sp-panic-handler", "sp-runtime-interface", - "sp-tasks", "sp-trie", "sp-version", "sp-wasm-interface", @@ -10390,7 +10245,7 @@ dependencies = [ [[package]] name = "sc-executor-common" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "environmental", "parity-scale-codec", @@ -10406,7 +10261,7 @@ dependencies = [ [[package]] name = "sc-executor-wasmi" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "log", "parity-scale-codec", @@ -10421,14 +10276,14 @@ dependencies = [ [[package]] name = "sc-executor-wasmtime" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "libc", "log", "once_cell", "parity-scale-codec", - "parity-wasm 0.45.0", + "parity-wasm", "rustix 0.35.13", "sc-allocator", "sc-executor-common", @@ -10441,7 +10296,7 @@ dependencies = [ [[package]] name = "sc-finality-grandpa" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "ahash", "array-bytes 4.2.0", @@ -10482,7 +10337,7 @@ dependencies = [ [[package]] name = "sc-finality-grandpa-rpc" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "finality-grandpa", "futures", @@ -10503,7 +10358,7 @@ dependencies = [ [[package]] name = "sc-informant" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "ansi_term", "futures", @@ -10520,7 +10375,7 @@ dependencies = [ [[package]] name = "sc-keystore" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "array-bytes 4.2.0", "async-trait", @@ -10535,7 +10390,7 @@ dependencies = [ [[package]] name = "sc-network" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "array-bytes 4.2.0", "async-trait", @@ -10553,11 +10408,11 @@ dependencies = [ "linked-hash-map", "linked_hash_set", "log", - "lru 0.7.8", + "lru", "parity-scale-codec", "parking_lot 0.12.1", "pin-project", - "prost 0.10.4", + "prost", "rand 0.7.3", "sc-block-builder", "sc-client-api", @@ -10582,14 +10437,14 @@ dependencies = [ [[package]] name = "sc-network-bitswap" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "cid", "futures", "libp2p", "log", - "prost 0.11.5", - "prost-build 0.11.5", + "prost", + "prost-build", "sc-client-api", "sc-network-common", "sp-blockchain", @@ -10602,7 +10457,7 @@ dependencies = [ [[package]] name = "sc-network-common" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "async-trait", "bitflags", @@ -10612,7 +10467,7 @@ dependencies = [ "libp2p", "linked_hash_set", "parity-scale-codec", - "prost-build 0.10.4", + "prost-build", "sc-consensus", "sc-peerset", "serde", @@ -10628,14 +10483,14 @@ dependencies = [ [[package]] name = "sc-network-gossip" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "ahash", "futures", "futures-timer", "libp2p", "log", - "lru 0.7.8", + "lru", "sc-network-common", "sc-peerset", "sp-runtime", @@ -10646,15 +10501,15 @@ dependencies = [ [[package]] name = "sc-network-light" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "array-bytes 4.2.0", "futures", "libp2p", "log", "parity-scale-codec", - "prost 0.10.4", - "prost-build 0.10.4", + "prost", + "prost-build", "sc-client-api", "sc-network-common", "sc-peerset", @@ -10667,21 +10522,23 @@ dependencies = [ [[package]] name = "sc-network-sync" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "array-bytes 4.2.0", "fork-tree", "futures", "libp2p", "log", - "lru 0.7.8", + "lru", + "mockall", "parity-scale-codec", - "prost 0.10.4", - "prost-build 0.10.4", + "prost", + "prost-build", "sc-client-api", "sc-consensus", "sc-network-common", "sc-peerset", + "sc-utils", "smallvec", "sp-arithmetic", "sp-blockchain", @@ -10695,7 +10552,7 @@ dependencies = [ [[package]] name = "sc-network-transactions" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "array-bytes 4.2.0", "futures", @@ -10714,7 +10571,7 @@ dependencies = [ [[package]] name = "sc-offchain" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "array-bytes 4.2.0", "bytes", @@ -10744,7 +10601,7 @@ dependencies = [ [[package]] name = "sc-peerset" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "futures", "libp2p", @@ -10757,7 +10614,7 @@ dependencies = [ [[package]] name = "sc-proposer-metrics" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "log", "substrate-prometheus-endpoint", @@ -10766,7 +10623,7 @@ dependencies = [ [[package]] name = "sc-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "futures", "hash-db", @@ -10796,7 +10653,7 @@ dependencies = [ [[package]] name = "sc-rpc-api" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "futures", "jsonrpsee", @@ -10819,7 +10676,7 @@ dependencies = [ [[package]] name = "sc-rpc-server" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "futures", "jsonrpsee", @@ -10829,10 +10686,29 @@ dependencies = [ "tokio", ] +[[package]] +name = "sc-rpc-spec-v2" +version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +dependencies = [ + "futures", + "hex", + "jsonrpsee", + "parity-scale-codec", + "sc-chain-spec", + "sc-transaction-pool-api", + "serde", + "sp-api", + "sp-blockchain", + "sp-core", + "sp-runtime", + "thiserror", +] + [[package]] name = "sc-service" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "async-trait", "directories", @@ -10864,6 +10740,7 @@ dependencies = [ "sc-offchain", "sc-rpc", "sc-rpc-server", + "sc-rpc-spec-v2", "sc-sysinfo", "sc-telemetry", "sc-tracing", @@ -10902,7 +10779,7 @@ dependencies = [ [[package]] name = "sc-state-db" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "log", "parity-scale-codec", @@ -10916,7 +10793,7 @@ dependencies = [ [[package]] name = "sc-sync-state-rpc" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "jsonrpsee", "parity-scale-codec", @@ -10935,7 +10812,7 @@ dependencies = [ [[package]] name = "sc-sysinfo" version = "6.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "futures", "libc", @@ -10954,7 +10831,7 @@ dependencies = [ [[package]] name = "sc-telemetry" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "chrono", "futures", @@ -10972,7 +10849,7 @@ dependencies = [ [[package]] name = "sc-tracing" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "ansi_term", "atty", @@ -11003,7 +10880,7 @@ dependencies = [ [[package]] name = "sc-tracing-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -11014,8 +10891,9 @@ dependencies = [ [[package]] name = "sc-transaction-pool" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ + "async-trait", "futures", "futures-timer", "linked-hash-map", @@ -11040,8 +10918,9 @@ dependencies = [ [[package]] name = "sc-transaction-pool-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ + "async-trait", "futures", "log", "serde", @@ -11053,7 +10932,7 @@ dependencies = [ [[package]] name = "sc-utils" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "futures", "futures-timer", @@ -11070,7 +10949,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "001cf62ece89779fd16105b5f515ad0e5cedcd5440d3dd806bb067978e7c3608" dependencies = [ "bitvec", - "cfg-if 1.0.0", + "cfg-if", "derive_more", "parity-scale-codec", "scale-info-derive", @@ -11141,10 +11020,11 @@ dependencies = [ [[package]] name = "sec1" -version = "0.2.1" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08da66b8b0965a5555b6bd6639e68ccba85e1e2506f5fbb089e93f8a04e1a2d1" +checksum = "3be24c1842290c45df0a7bf069e0c268a747ad05a192f2fd7dcfdbc1cba40928" dependencies = [ + "base16ct", "der", "generic-array 0.14.6", "pkcs8", @@ -11273,7 +11153,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "99cd6713db3cf16b6c84e06321e049a9b9f699826e16096d23bbcc44d15d51a6" dependencies = [ "block-buffer 0.9.0", - "cfg-if 1.0.0", + "cfg-if", "cpufeatures", "digest 0.9.0", "opaque-debug 0.3.0", @@ -11285,7 +11165,7 @@ version = "0.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "cpufeatures", "digest 0.10.6", ] @@ -11309,7 +11189,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" dependencies = [ "block-buffer 0.9.0", - "cfg-if 1.0.0", + "cfg-if", "cpufeatures", "digest 0.9.0", "opaque-debug 0.3.0", @@ -11321,7 +11201,7 @@ version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "cpufeatures", "digest 0.10.6", ] @@ -11397,11 +11277,11 @@ dependencies = [ [[package]] name = "signature" -version = "1.4.0" +version = "1.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02658e48d89f2bec991f9a78e69cfa4c316f8d6a6c4ec12fae1aeb263d486788" +checksum = "74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c" dependencies = [ - "digest 0.9.0", + "digest 0.10.6", "rand_core 0.6.4", ] @@ -11454,8 +11334,8 @@ checksum = "03b634d87b960ab1a38c4fe143b508576f075e7c978bfad18217645ebfdfa2ec" [[package]] name = "slot-range-helper" -version = "0.9.30" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +version = "0.9.33" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" dependencies = [ "enumn", "parity-scale-codec", @@ -11531,7 +11411,7 @@ dependencies = [ [[package]] name = "sp-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "hash-db", "log", @@ -11549,7 +11429,7 @@ dependencies = [ [[package]] name = "sp-api-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "blake2", "proc-macro-crate", @@ -11561,7 +11441,7 @@ dependencies = [ [[package]] name = "sp-application-crypto" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "parity-scale-codec", "scale-info", @@ -11574,7 +11454,7 @@ dependencies = [ [[package]] name = "sp-arithmetic" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "integer-sqrt", "num-traits", @@ -11589,7 +11469,7 @@ dependencies = [ [[package]] name = "sp-authority-discovery" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "parity-scale-codec", "scale-info", @@ -11602,7 +11482,7 @@ dependencies = [ [[package]] name = "sp-authorship" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "async-trait", "parity-scale-codec", @@ -11614,7 +11494,7 @@ dependencies = [ [[package]] name = "sp-block-builder" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "parity-scale-codec", "sp-api", @@ -11626,11 +11506,11 @@ dependencies = [ [[package]] name = "sp-blockchain" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "futures", "log", - "lru 0.7.8", + "lru", "parity-scale-codec", "parking_lot 0.12.1", "sp-api", @@ -11644,7 +11524,7 @@ dependencies = [ [[package]] name = "sp-consensus" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "async-trait", "futures", @@ -11663,7 +11543,7 @@ dependencies = [ [[package]] name = "sp-consensus-aura" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "async-trait", "parity-scale-codec", @@ -11681,7 +11561,7 @@ dependencies = [ [[package]] name = "sp-consensus-babe" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "async-trait", "merlin", @@ -11704,7 +11584,7 @@ dependencies = [ [[package]] name = "sp-consensus-slots" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "parity-scale-codec", "scale-info", @@ -11718,7 +11598,7 @@ dependencies = [ [[package]] name = "sp-consensus-vrf" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "parity-scale-codec", "scale-info", @@ -11731,7 +11611,7 @@ dependencies = [ [[package]] name = "sp-core" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "array-bytes 4.2.0", "base58", @@ -11743,16 +11623,15 @@ dependencies = [ "futures", "hash-db", "hash256-std-hasher", - "impl-serde", + "impl-serde 0.4.0", "lazy_static", "libsecp256k1 0.7.1", "log", "merlin", "num-traits", "parity-scale-codec", - "parity-util-mem", "parking_lot 0.12.1", - "primitive-types 0.11.1", + "primitive-types 0.12.1", "rand 0.7.3", "regex", "scale-info", @@ -11777,7 +11656,7 @@ dependencies = [ [[package]] name = "sp-core-hashing" version = "4.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "blake2", "byteorder", @@ -11791,7 +11670,7 @@ dependencies = [ [[package]] name = "sp-core-hashing-proc-macro" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "proc-macro2", "quote", @@ -11802,7 +11681,7 @@ dependencies = [ [[package]] name = "sp-database" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "kvdb", "parking_lot 0.12.1", @@ -11811,7 +11690,7 @@ dependencies = [ [[package]] name = "sp-debug-derive" version = "4.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "proc-macro2", "quote", @@ -11821,7 +11700,7 @@ dependencies = [ [[package]] name = "sp-externalities" version = "0.12.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "environmental", "parity-scale-codec", @@ -11832,7 +11711,7 @@ dependencies = [ [[package]] name = "sp-finality-grandpa" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "finality-grandpa", "log", @@ -11850,7 +11729,7 @@ dependencies = [ [[package]] name = "sp-inherents" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "async-trait", "impl-trait-for-tuples", @@ -11864,7 +11743,7 @@ dependencies = [ [[package]] name = "sp-io" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "bytes", "futures", @@ -11890,7 +11769,7 @@ dependencies = [ [[package]] name = "sp-keyring" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "lazy_static", "sp-core", @@ -11901,7 +11780,7 @@ dependencies = [ [[package]] name = "sp-keystore" version = "0.12.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "async-trait", "futures", @@ -11918,7 +11797,7 @@ dependencies = [ [[package]] name = "sp-maybe-compressed-blob" version = "4.1.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "thiserror", "zstd", @@ -11927,22 +11806,24 @@ dependencies = [ [[package]] name = "sp-mmr-primitives" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "log", "parity-scale-codec", + "scale-info", "serde", "sp-api", "sp-core", "sp-debug-derive", "sp-runtime", "sp-std", + "thiserror", ] [[package]] name = "sp-npos-elections" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "parity-scale-codec", "scale-info", @@ -11956,7 +11837,7 @@ dependencies = [ [[package]] name = "sp-offchain" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "sp-api", "sp-core", @@ -11966,7 +11847,7 @@ dependencies = [ [[package]] name = "sp-panic-handler" version = "4.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "backtrace", "lazy_static", @@ -11976,7 +11857,7 @@ dependencies = [ [[package]] name = "sp-rpc" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "rustc-hash", "serde", @@ -11986,7 +11867,7 @@ dependencies = [ [[package]] name = "sp-runtime" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "either", "hash256-std-hasher", @@ -12009,12 +11890,12 @@ dependencies = [ [[package]] name = "sp-runtime-interface" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "bytes", "impl-trait-for-tuples", "parity-scale-codec", - "primitive-types 0.11.1", + "primitive-types 0.12.1", "sp-externalities", "sp-runtime-interface-proc-macro", "sp-std", @@ -12027,7 +11908,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "Inflector", "proc-macro-crate", @@ -12039,7 +11920,7 @@ dependencies = [ [[package]] name = "sp-sandbox" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "log", "parity-scale-codec", @@ -12053,7 +11934,7 @@ dependencies = [ [[package]] name = "sp-session" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "parity-scale-codec", "scale-info", @@ -12067,7 +11948,7 @@ dependencies = [ [[package]] name = "sp-staking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "parity-scale-codec", "scale-info", @@ -12078,7 +11959,7 @@ dependencies = [ [[package]] name = "sp-state-machine" version = "0.12.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "hash-db", "log", @@ -12100,14 +11981,14 @@ dependencies = [ [[package]] name = "sp-std" version = "4.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" [[package]] name = "sp-storage" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ - "impl-serde", + "impl-serde 0.4.0", "parity-scale-codec", "ref-cast", "serde", @@ -12115,23 +11996,10 @@ dependencies = [ "sp-std", ] -[[package]] -name = "sp-tasks" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" -dependencies = [ - "log", - "sp-core", - "sp-externalities", - "sp-io", - "sp-runtime-interface", - "sp-std", -] - [[package]] name = "sp-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "async-trait", "futures-timer", @@ -12147,7 +12015,7 @@ dependencies = [ [[package]] name = "sp-tracing" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "parity-scale-codec", "sp-std", @@ -12159,7 +12027,7 @@ dependencies = [ [[package]] name = "sp-transaction-pool" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "sp-api", "sp-runtime", @@ -12168,7 +12036,7 @@ dependencies = [ [[package]] name = "sp-transaction-storage-proof" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "async-trait", "log", @@ -12184,13 +12052,13 @@ dependencies = [ [[package]] name = "sp-trie" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "ahash", "hash-db", "hashbrown", "lazy_static", - "lru 0.7.8", + "lru", "memory-db", "nohash-hasher", "parity-scale-codec", @@ -12207,11 +12075,11 @@ dependencies = [ [[package]] name = "sp-version" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ - "impl-serde", + "impl-serde 0.4.0", "parity-scale-codec", - "parity-wasm 0.45.0", + "parity-wasm", "scale-info", "serde", "sp-core-hashing-proc-macro", @@ -12224,7 +12092,7 @@ dependencies = [ [[package]] name = "sp-version-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "parity-scale-codec", "proc-macro2", @@ -12235,7 +12103,7 @@ dependencies = [ [[package]] name = "sp-wasm-interface" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "impl-trait-for-tuples", "log", @@ -12248,7 +12116,7 @@ dependencies = [ [[package]] name = "sp-weights" version = "4.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", @@ -12269,9 +12137,9 @@ checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" [[package]] name = "spki" -version = "0.5.4" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44d01ac02a6ccf3e07db148d2be087da624fea0221a16152ed01f0496a6b0a27" +checksum = "67cf02bbac7a337dc36e4f5a693db6c21e7863f45070f7064577eb4367a3212b" dependencies = [ "base64ct", "der", @@ -12427,7 +12295,7 @@ dependencies = [ [[package]] name = "substrate-build-script-utils" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "platforms 2.0.0", ] @@ -12446,7 +12314,7 @@ dependencies = [ [[package]] name = "substrate-frame-rpc-system" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "frame-system-rpc-runtime-api", "futures", @@ -12467,7 +12335,7 @@ dependencies = [ [[package]] name = "substrate-prometheus-endpoint" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "futures-util", "hyper", @@ -12477,10 +12345,23 @@ dependencies = [ "tokio", ] +[[package]] +name = "substrate-rpc-client" +version = "0.10.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +dependencies = [ + "async-trait", + "jsonrpsee", + "log", + "sc-rpc-api", + "serde", + "sp-runtime", +] + [[package]] name = "substrate-state-trie-migration-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "jsonrpsee", "log", @@ -12501,7 +12382,7 @@ dependencies = [ [[package]] name = "substrate-wasm-builder" version = "5.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "ansi_term", "build-helper", @@ -12512,7 +12393,7 @@ dependencies = [ "tempfile", "toml", "walkdir", - "wasm-gc-api", + "wasm-opt", ] [[package]] @@ -12583,7 +12464,7 @@ version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "fastrand", "libc", "redox_syscall", @@ -12611,10 +12492,10 @@ dependencies = [ ] [[package]] -name = "textwrap" -version = "0.16.0" +name = "termtree" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d" +checksum = "95059e91184749cb66be6dc994f67f182b6d897cb3df74a5bf66b5e709295fd8" [[package]] name = "thiserror" @@ -12675,9 +12556,9 @@ dependencies = [ [[package]] name = "tikv-jemalloc-sys" -version = "0.4.3+5.2.1-patched.2" +version = "0.5.2+5.3.0-patched" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1792ccb507d955b46af42c123ea8863668fae24d03721e40cad6a41773dbb49" +checksum = "ec45c14da997d0925c7835883e4d5c181f196fa142f8c19d7643d1e9af2592c3" dependencies = [ "cc", "fs_extra", @@ -12827,7 +12708,7 @@ version = "0.1.37" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "pin-project-lite 0.2.9", "tracing-attributes", "tracing-core", @@ -12866,8 +12747,8 @@ dependencies = [ [[package]] name = "tracing-gum" -version = "0.9.30" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +version = "0.9.33" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" dependencies = [ "polkadot-node-jaeger", "polkadot-primitives", @@ -12877,8 +12758,8 @@ dependencies = [ [[package]] name = "tracing-gum-proc-macro" -version = "0.9.30" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +version = "0.9.33" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" dependencies = [ "expander 0.0.6", "proc-macro-crate", @@ -12965,12 +12846,12 @@ dependencies = [ [[package]] name = "trust-dns-proto" -version = "0.21.2" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c31f240f59877c3d4bb3b3ea0ec5a6a0cff07323580ff8c7a605cd7d08b255d" +checksum = "4f7f83d1e4a0e4358ac54c5c3681e5d7da5efc5a7a632c90bb6d6669ddd9bc26" dependencies = [ "async-trait", - "cfg-if 1.0.0", + "cfg-if", "data-encoding", "enum-as-inner", "futures-channel", @@ -12979,30 +12860,30 @@ dependencies = [ "idna 0.2.3", "ipnet", "lazy_static", - "log", "rand 0.8.5", "smallvec", "thiserror", "tinyvec", + "tracing", "url", ] [[package]] name = "trust-dns-resolver" -version = "0.21.2" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4ba72c2ea84515690c9fcef4c6c660bb9df3036ed1051686de84605b74fd558" +checksum = "aff21aa4dcefb0a1afbfac26deb0adc93888c7d295fb63ab273ef276ba2b7cfe" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "futures-util", "ipconfig", "lazy_static", - "log", "lru-cache", "parking_lot 0.12.1", "resolv-conf", "smallvec", "thiserror", + "tracing", "trust-dns-proto", ] @@ -13015,11 +12896,10 @@ checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" [[package]] name = "try-runtime-cli" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" dependencies = [ "clap", "frame-try-runtime", - "jsonrpsee", "log", "parity-scale-codec", "remote-externalities", @@ -13035,6 +12915,8 @@ dependencies = [ "sp-runtime", "sp-state-machine", "sp-version", + "sp-weights", + "substrate-rpc-client", "zstd", ] @@ -13050,7 +12932,7 @@ version = "1.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "digest 0.10.6", "rand 0.8.5", "static_assertions", @@ -13261,7 +13143,7 @@ version = "0.2.83" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eaf9f5aceeec8be17c128b2e93e031fb8a4d469bb9c4ae2d7dc1888b26887268" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "wasm-bindgen-macro", ] @@ -13286,7 +13168,7 @@ version = "0.4.33" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "23639446165ca5a5de86ae1d8896b737ae80319560fbaa4c2887b7da6e7ebd7d" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "js-sys", "wasm-bindgen", "web-sys", @@ -13322,23 +13204,53 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f" [[package]] -name = "wasm-gc-api" -version = "0.1.11" +name = "wasm-instrument" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0c32691b6c7e6c14e7f8fd55361a9088b507aa49620fcd06c09b3a1082186b9" +checksum = "aa1dafb3e60065305741e83db35c6c2584bb3725b692b5b66148a38d72ace6cd" dependencies = [ - "log", - "parity-wasm 0.32.0", - "rustc-demangle", + "parity-wasm", ] [[package]] -name = "wasm-instrument" -version = "0.3.0" +name = "wasm-opt" +version = "0.110.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa1dafb3e60065305741e83db35c6c2584bb3725b692b5b66148a38d72ace6cd" +checksum = "b68e8037b4daf711393f4be2056246d12d975651b14d581520ad5d1f19219cec" +dependencies = [ + "anyhow", + "libc", + "strum", + "strum_macros", + "tempfile", + "thiserror", + "wasm-opt-cxx-sys", + "wasm-opt-sys", +] + +[[package]] +name = "wasm-opt-cxx-sys" +version = "0.110.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91adbad477e97bba3fbd21dd7bfb594e7ad5ceb9169ab1c93ab9cb0ada636b6f" +dependencies = [ + "anyhow", + "cxx", + "cxx-build", + "wasm-opt-sys", +] + +[[package]] +name = "wasm-opt-sys" +version = "0.110.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec4fa5a322a4e6ac22fd141f498d56afbdbf9df5debeac32380d2dcaa3e06941" dependencies = [ - "parity-wasm 0.45.0", + "anyhow", + "cc", + "cxx", + "cxx-build", + "regex", ] [[package]] @@ -13362,7 +13274,7 @@ version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "06c326c93fbf86419608361a2c925a31754cf109da1b8b55737070b4d6669422" dependencies = [ - "parity-wasm 0.45.0", + "parity-wasm", "wasmi-validation", "wasmi_core", ] @@ -13373,7 +13285,7 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "91ff416ad1ff0c42e5a926ed5d5fab74c0f098749aa0ad8b2a34b982ce0e867b" dependencies = [ - "parity-wasm 0.45.0", + "parity-wasm", ] [[package]] @@ -13385,7 +13297,7 @@ dependencies = [ "downcast-rs", "libm 0.2.6", "memory_units", - "num-rational 0.4.1", + "num-rational", "num-traits", ] @@ -13406,7 +13318,7 @@ checksum = "4ad5af6ba38311282f2a21670d96e78266e8c8e2f38cbcd52c254df6ccbc7731" dependencies = [ "anyhow", "bincode", - "cfg-if 1.0.0", + "cfg-if", "indexmap", "libc", "log", @@ -13432,7 +13344,7 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "45de63ddfc8b9223d1adc8f7b2ee5f35d1f6d112833934ad7ea66e4f4339e597" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] @@ -13504,7 +13416,7 @@ dependencies = [ "addr2line 0.17.0", "anyhow", "bincode", - "cfg-if 1.0.0", + "cfg-if", "cpp_demangle", "gimli 0.26.2", "log", @@ -13539,7 +13451,7 @@ checksum = "ee8f92ad4b61736339c29361da85769ebc200f184361959d1792832e592a1afd" dependencies = [ "anyhow", "cc", - "cfg-if 1.0.0", + "cfg-if", "indexmap", "libc", "log", @@ -13608,8 +13520,8 @@ dependencies = [ [[package]] name = "westend-runtime" -version = "0.9.30" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +version = "0.9.33" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" dependencies = [ "beefy-primitives", "bitvec", @@ -13698,14 +13610,16 @@ dependencies = [ [[package]] name = "westend-runtime-constants" -version = "0.9.30" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +version = "0.9.33" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" dependencies = [ "frame-support", "polkadot-primitives", "polkadot-runtime-common", "smallvec", + "sp-core", "sp-runtime", + "sp-weights", ] [[package]] @@ -13930,8 +13844,8 @@ dependencies = [ [[package]] name = "xcm" -version = "0.9.30" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +version = "0.9.33" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" dependencies = [ "derivative", "impl-trait-for-tuples", @@ -13944,8 +13858,8 @@ dependencies = [ [[package]] name = "xcm-builder" -version = "0.9.30" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +version = "0.9.33" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" dependencies = [ "frame-support", "frame-system", @@ -13964,8 +13878,8 @@ dependencies = [ [[package]] name = "xcm-executor" -version = "0.9.30" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +version = "0.9.33" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" dependencies = [ "frame-benchmarking", "frame-support", @@ -13983,10 +13897,10 @@ dependencies = [ [[package]] name = "xcm-primitives" version = "0.1.0" -source = "git+https://github.com/darwinia-network/moonbeam?branch=polkadot-v0.9.30#9d31c6120bb0f317053da9cac7fe7cd2a44f844c" +source = "git+https://github.com/darwinia-network/moonbeam?branch=polkadot-v0.9.33#4ea11a7b2b71e0f4f6d100f5fa04e0f3ea285895" dependencies = [ "ethereum", - "ethereum-types", + "ethereum-types 0.14.1", "frame-support", "frame-system", "hex", @@ -13995,7 +13909,7 @@ dependencies = [ "parity-scale-codec", "scale-info", "serde", - "sha3 0.8.2", + "sha3 0.10.6", "sp-io", "sp-runtime", "sp-std", @@ -14006,8 +13920,8 @@ dependencies = [ [[package]] name = "xcm-procedural" -version = "0.9.30" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.30#064536093f5ff70d867f4bbce8d4c41a406d317a" +version = "0.9.33" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" dependencies = [ "Inflector", "proc-macro2", diff --git a/core/inflation/Cargo.toml b/core/inflation/Cargo.toml index d0eccec37..e9144376a 100644 --- a/core/inflation/Cargo.toml +++ b/core/inflation/Cargo.toml @@ -20,7 +20,7 @@ dc-types = { path = "../types" } substrate-fixed = { default-features = false, git = "https://github.com/encointer/substrate-fixed" } [dev-dependencies] -sp-arithmetic = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-arithmetic = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } [features] default = ["std"] diff --git a/core/primitives/Cargo.toml b/core/primitives/Cargo.toml index 2218521a5..cb9fd0668 100644 --- a/core/primitives/Cargo.toml +++ b/core/primitives/Cargo.toml @@ -14,12 +14,11 @@ version = "6.0.0" dc-types = { path = "../types" } # moonbeam -account = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.30" } +account = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.33" } # substrate -sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } - +sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } [features] default = ["std"] diff --git a/node/Cargo.toml b/node/Cargo.toml index cf57504f6..b901c3291 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -10,13 +10,13 @@ repository = "https://github.com/darwinia-network/darwinia" version = "6.0.0" [build-dependencies] -substrate-build-script-utils = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +substrate-build-script-utils = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } [dependencies] # crates.io array-bytes = { version = "6.0" } async-trait = { version = "0.1" } -clap = { version = "3.2", features = ["derive"] } +clap = { version = "4.0", features = ["derive"] } codec = { package = "parity-scale-codec", version = "3.2" } futures = { version = "0.3" } jsonrpsee = { version = "0.15", features = ["server"] } @@ -24,17 +24,18 @@ log = { version = "0.4" } serde = { version = "1.0", features = ["derive"] } # cumulus -cumulus-client-cli = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.30" } -cumulus-client-collator = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.30" } -cumulus-client-consensus-aura = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.30" } -cumulus-client-consensus-common = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.30" } -cumulus-client-network = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.30" } -cumulus-client-service = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.30" } -cumulus-primitives-core = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.30" } -cumulus-primitives-parachain-inherent = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.30" } -cumulus-relay-chain-inprocess-interface = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.30" } -cumulus-relay-chain-interface = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.30" } -cumulus-relay-chain-rpc-interface = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.30" } +cumulus-client-cli = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.33" } +cumulus-client-collator = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.33" } +cumulus-client-consensus-aura = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.33" } +cumulus-client-consensus-common = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.33" } +cumulus-client-network = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.33" } +cumulus-client-service = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.33" } +cumulus-primitives-core = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.33" } +cumulus-primitives-parachain-inherent = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.33" } +cumulus-relay-chain-inprocess-interface = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.33" } +cumulus-relay-chain-interface = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.33" } +cumulus-relay-chain-rpc-interface = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.33" } +cumulus-relay-chain-minimal-node = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.33" } # darwinia crab-runtime = { path = "../runtime/crab" } @@ -43,63 +44,63 @@ dc-primitives = { path = "../core/primitives" } pangolin-runtime = { path = "../runtime/pangolin" } # frontier -fc-cli = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } -fc-consensus = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } -fc-db = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } -fc-mapping-sync = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } -fc-rpc = { features = ["rpc_binary_search_estimate"], git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } -fc-rpc-core = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } -fp-evm = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } -fp-rpc = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } -fp-storage = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +fc-cli = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } +fc-consensus = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } +fc-db = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } +fc-mapping-sync = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } +fc-rpc = { features = ["rpc_binary_search_estimate"], git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } +fc-rpc-core = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } +fp-evm = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } +fp-rpc = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } +fp-storage = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } # polkadot -polkadot-cli = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" } -polkadot-parachain = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" } -polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" } -polkadot-service = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" } -xcm = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" } +polkadot-cli = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.33" } +polkadot-parachain = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.33" } +polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.33" } +polkadot-service = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.33" } +xcm = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.33" } # substrate -frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -frame-benchmarking-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-transaction-payment-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sc-basic-authorship = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sc-chain-spec = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sc-cli = { features = ["wasmtime"], git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sc-consensus-aura = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sc-executor = { features = ["wasmtime"], git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sc-keystore = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sc-network = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sc-network-common = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sc-offchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sc-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sc-rpc-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sc-service = { features = ["wasmtime"], git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sc-sysinfo = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sc-telemetry = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sc-tracing = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sc-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sc-transaction-pool-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-block-builder = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-consensus = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-consensus-aura = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-inherents = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-offchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-session = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -substrate-frame-rpc-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -substrate-prometheus-endpoint = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -try-runtime-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +frame-benchmarking-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-transaction-payment-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sc-basic-authorship = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sc-chain-spec = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sc-cli = { features = ["wasmtime"], git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sc-consensus-aura = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sc-executor = { features = ["wasmtime"], git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sc-keystore = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sc-network = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sc-network-common = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sc-offchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sc-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sc-rpc-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sc-service = { features = ["wasmtime"], git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sc-sysinfo = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sc-telemetry = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sc-tracing = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sc-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sc-transaction-pool-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-block-builder = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-consensus = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-consensus-aura = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-inherents = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-offchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-session = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +substrate-frame-rpc-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +substrate-prometheus-endpoint = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +try-runtime-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33", optional = true} [features] default = [] @@ -117,6 +118,9 @@ runtime-benchmarks = [ try-runtime = [ # darwinia "darwinia-runtime/try-runtime", + + # substrate + "try-runtime-cli/try-runtime", ] all-native = [ diff --git a/node/src/chain_spec/crab.rs b/node/src/chain_spec/crab.rs index 071eb1d77..bcf14134c 100644 --- a/node/src/chain_spec/crab.rs +++ b/node/src/chain_spec/crab.rs @@ -216,7 +216,6 @@ pub fn genesis_config() -> ChainSpec { ) }, }, - base_fee: Default::default(), // S2S stuff. bridge_polkadot_grandpa: Default::default(), @@ -340,7 +339,6 @@ fn testnet_genesis( ) }, }, - base_fee: Default::default(), // S2S stuff. bridge_polkadot_grandpa: Default::default(), diff --git a/node/src/chain_spec/darwinia.rs b/node/src/chain_spec/darwinia.rs index bb2607779..2d3a843f2 100644 --- a/node/src/chain_spec/darwinia.rs +++ b/node/src/chain_spec/darwinia.rs @@ -216,7 +216,6 @@ pub fn genesis_config() -> ChainSpec { ) }, }, - base_fee: Default::default(), // S2S stuff. bridge_kusama_grandpa: Default::default(), @@ -340,7 +339,6 @@ fn testnet_genesis( ) }, }, - base_fee: Default::default(), // S2S stuff. bridge_kusama_grandpa: Default::default(), diff --git a/node/src/chain_spec/pangolin.rs b/node/src/chain_spec/pangolin.rs index d178d9008..3cf7f4ad0 100644 --- a/node/src/chain_spec/pangolin.rs +++ b/node/src/chain_spec/pangolin.rs @@ -216,7 +216,6 @@ pub fn genesis_config() -> ChainSpec { ) }, }, - base_fee: Default::default(), } }, Vec::new(), @@ -334,6 +333,5 @@ fn testnet_genesis( ) }, }, - base_fee: Default::default(), } } diff --git a/node/src/cli.rs b/node/src/cli.rs index 085a2a70a..809159bec 100644 --- a/node/src/cli.rs +++ b/node/src/cli.rs @@ -54,24 +54,29 @@ pub enum Subcommand { /// Sub-commands concerned with benchmarking. /// The pallet benchmarking moved to the `pallet` sub-command. - #[clap(subcommand)] + #[command(subcommand)] Benchmark(frame_benchmarking_cli::BenchmarkCmd), /// Try some testing command against a specified runtime state. + #[cfg(feature = "try-runtime")] TryRuntime(try_runtime_cli::TryRuntimeCmd), + + /// Errors since the binary was not build with `--features try-runtime`. + #[cfg(not(feature = "try-runtime"))] + TryRuntime, } #[derive(Debug, clap::Parser)] -#[clap( +#[command( propagate_version = true, args_conflicts_with_subcommands = true, subcommand_negates_reqs = true )] pub struct Cli { - #[clap(subcommand)] + #[command(subcommand)] pub subcommand: Option, - #[clap(flatten)] + #[command(flatten)] pub run: cumulus_client_cli::RunCmd, /// Disable automatic hardware benchmarks. @@ -81,14 +86,14 @@ pub struct Cli { /// /// The results are then printed out in the logs, and also sent as part of /// telemetry, if telemetry is enabled. - #[clap(long)] + #[arg(long)] pub no_hardware_benchmarks: bool, /// Relay chain arguments - #[clap(raw = true)] + #[arg(raw = true)] pub relay_chain_args: Vec, - #[clap(flatten)] + #[command(flatten)] pub eth_args: EthArgs, } @@ -119,19 +124,19 @@ impl RelayChainCli { #[derive(Debug, clap::Parser)] pub struct EthArgs { /// Size in bytes of the LRU cache for block data. - #[clap(long, default_value = "300000000")] + #[arg(long, default_value = "300000000")] pub eth_log_block_cache: usize, /// Size of the LRU cache for block data and their transaction statuses. - #[clap(long, default_value = "300000000")] + #[arg(long, default_value = "300000000")] pub eth_statuses_cache: usize, /// Maximum number of logs in a query. - #[clap(long, default_value = "10000")] + #[arg(long, default_value = "10000")] pub max_past_logs: u32, /// Maximum fee history cache size. - #[clap(long, default_value = "2048")] + #[arg(long, default_value = "2048")] pub fee_history_limit: u64, } impl EthArgs { diff --git a/node/src/command.rs b/node/src/command.rs index c3488be36..acd4be45f 100644 --- a/node/src/command.rs +++ b/node/src/command.rs @@ -40,7 +40,7 @@ use sc_cli::{ }; use sc_service::{ config::{BasePath, PrometheusConfig}, - DatabaseSource, PartialComponents, TaskManager, + DatabaseSource, PartialComponents, }; use sp_core::{crypto::Ss58AddressFormatRegistry, hexdisplay::HexDisplay}; use sp_runtime::traits::{AccountIdConversion, Block as BlockT}; @@ -496,35 +496,35 @@ pub fn run() -> Result<()> { _ => Err("Benchmarking sub-command unsupported".into()), } }, + #[cfg(feature = "try-runtime")] Some(Subcommand::TryRuntime(cmd)) => { - if cfg!(feature = "try-runtime") { - let runner = cli.create_runner(cmd)?; - let chain_spec = &runner.config().chain_spec; + let runner = cli.create_runner(cmd)?; + let chain_spec = &runner.config().chain_spec; - set_default_ss58_version(chain_spec); - // grab the task manager. - let registry = &runner.config().prometheus_config.as_ref().map(|cfg| &cfg.registry); - let task_manager = - TaskManager::new(runner.config().tokio_handle.clone(), *registry) - .map_err(|e| format!("Error: {:?}", e))?; + set_default_ss58_version(chain_spec); + // grab the task manager. + let registry = &runner.config().prometheus_config.as_ref().map(|cfg| &cfg.registry); + let task_manager = TaskManager::new(runner.config().tokio_handle.clone(), *registry) + .map_err(|e| format!("Error: {:?}", e))?; - if chain_spec.is_crab() { - runner.async_run(|config| { - Ok((cmd.run::(config), task_manager)) - }) - } else if chain_spec.is_pangolin() { - runner.async_run(|config| { - Ok((cmd.run::(config), task_manager)) - }) - } else { - runner.async_run(|config| { - Ok((cmd.run::(config), task_manager)) - }) - } + if chain_spec.is_crab() { + runner.async_run(|config| { + Ok((cmd.run::(config), task_manager)) + }) + } else if chain_spec.is_pangolin() { + runner.async_run(|config| { + Ok((cmd.run::(config), task_manager)) + }) } else { - Err("Try-runtime must be enabled by `--features try-runtime`.".into()) + runner.async_run(|config| { + Ok((cmd.run::(config), task_manager)) + }) } }, + #[cfg(not(feature = "try-runtime"))] + Some(Subcommand::TryRuntime) => Err("Try-runtime was not enabled when building the node. \ + You can enable it with `--features try-runtime`." + .into()), None => { let runner = cli.create_runner(&cli.run.normalize())?; let collator_options = cli.run.collator_options(); @@ -568,6 +568,10 @@ pub fn run() -> Result<()> { if config.role.is_authority() { "yes" } else { "no" } ); + if collator_options.relay_chain_rpc_url.is_some() && cli.relay_chain_args.len() > 0 { + log::warn!("Detected relay chain node arguments together with --relay-chain-rpc-url. This command starts a minimal Polkadot node that only uses a network-related subset of all relay chain CLI options."); + } + if chain_spec.is_dev() { return if chain_spec.is_crab() { service::start_dev_node::( diff --git a/node/src/service/mod.rs b/node/src/service/mod.rs index b9c2bf7a7..fe11eafb4 100644 --- a/node/src/service/mod.rs +++ b/node/src/service/mod.rs @@ -45,6 +45,8 @@ use sp_runtime::app_crypto::AppKey; type FullBackend = sc_service::TFullBackend; type FullClient = sc_service::TFullClient>; +type ParachainBlockImport = + cumulus_client_consensus_common::ParachainBlockImport>>; /// Can be called for a `Configuration` to check if it is a configuration for the `Crab` network. pub trait IdentifyVariant { @@ -123,6 +125,7 @@ pub fn new_partial( Option, fc_rpc_core::types::FeeHistoryCache, fc_rpc_core::types::FeeHistoryCacheLimit, + ParachainBlockImport, Option, Option, ), @@ -172,8 +175,12 @@ where task_manager.spawn_essential_handle(), client.clone(), ); + + let block_import = ParachainBlockImport::new(client.clone()); + let import_queue = parachain_build_import_queue( client.clone(), + block_import.clone(), config, telemetry.as_ref().map(|telemetry| telemetry.handle()), &task_manager, @@ -201,6 +208,7 @@ where filter_pool, fee_history_cache, fee_history_cache_limit, + block_import, telemetry, telemetry_worker_handle, ), @@ -219,18 +227,13 @@ async fn build_relay_chain_interface( Option, )> { match collator_options.relay_chain_rpc_url { - Some(relay_chain_url) => { - let client = cumulus_relay_chain_rpc_interface::create_client_and_start_worker( - relay_chain_url, + Some(relay_chain_url) => + cumulus_relay_chain_minimal_node::build_minimal_relay_chain_node( + polkadot_config, task_manager, + relay_chain_url, ) - .await?; - Ok(( - Arc::new(cumulus_relay_chain_rpc_interface::RelayChainRpcInterface::new(client)) - as Arc<_>, - None, - )) - }, + .await, None => cumulus_relay_chain_inprocess_interface::build_inprocess_relay_chain( polkadot_config, parachain_config, @@ -250,7 +253,7 @@ async fn start_node_impl( parachain_config: sc_service::Configuration, polkadot_config: sc_service::Configuration, collator_options: cumulus_client_cli::CollatorOptions, - id: cumulus_primitives_core::ParaId, + para_id: cumulus_primitives_core::ParaId, _rpc_ext_builder: RB, build_consensus: BIC, hwbench: Option, @@ -264,13 +267,12 @@ where RuntimeApi::RuntimeApi: RuntimeApiCollection, sc_client_api::StateBackendFor: sp_api::StateBackend, Executor: 'static + sc_executor::NativeExecutionDispatch, - RB: 'static - + Send - + Fn( - Arc>, - ) -> Result, sc_service::Error>, + RB: Fn( + Arc>, + ) -> Result, sc_service::Error>, BIC: FnOnce( Arc>, + ParachainBlockImport, Option<&substrate_prometheus_endpoint::Registry>, Option, &sc_service::TaskManager, @@ -299,6 +301,7 @@ where filter_pool, fee_history_cache, fee_history_cache_limit, + block_import, mut telemetry, telemetry_worker_handle, ), @@ -321,7 +324,7 @@ where })?; let block_announce_validator = - cumulus_client_network::BlockAnnounceValidator::new(relay_chain_interface.clone(), id); + cumulus_client_network::BlockAnnounceValidator::new(relay_chain_interface.clone(), para_id); let force_authoring = parachain_config.force_authoring; let validator = parachain_config.role.is_authority(); @@ -428,6 +431,7 @@ where if validator { let parachain_consensus = build_consensus( client.clone(), + block_import, prometheus_registry.as_ref(), telemetry.as_ref().map(|t| t.handle()), &task_manager, @@ -439,9 +443,8 @@ where )?; let spawner = task_manager.spawn_handle(); - let params = cumulus_client_service::StartCollatorParams { - para_id: id, + para_id, block_status: client.clone(), announce_block, client: client.clone(), @@ -460,11 +463,10 @@ where client: client.clone(), announce_block, task_manager: &mut task_manager, - para_id: id, + para_id, relay_chain_interface, relay_chain_slot_duration, import_queue, - collator_options, }; cumulus_client_service::start_full_node(params)?; @@ -478,6 +480,7 @@ where /// Build the import queue for the parachain runtime. pub fn parachain_build_import_queue( client: Arc>, + block_import: ParachainBlockImport, config: &sc_service::Configuration, telemetry: Option, task_manager: &sc_service::TaskManager, @@ -503,7 +506,7 @@ where _, _, >(cumulus_client_consensus_aura::ImportQueueParams { - block_import: client.clone(), + block_import, client, create_inherent_data_providers: move |_, _| async move { let timestamp = sp_timestamp::InherentDataProvider::from_system_time(); @@ -528,7 +531,7 @@ pub async fn start_parachain_node( parachain_config: sc_service::Configuration, polkadot_config: sc_service::Configuration, collator_options: cumulus_client_cli::CollatorOptions, - id: cumulus_primitives_core::ParaId, + para_id: cumulus_primitives_core::ParaId, hwbench: Option, eth_rpc_config: &crate::cli::EthRpcConfig, ) -> sc_service::error::Result<( @@ -549,9 +552,10 @@ where parachain_config, polkadot_config, collator_options, - id, + para_id, |_| Ok(jsonrpsee::RpcModule::new(())), |client, + block_import, prometheus_registry, telemetry, task_manager, @@ -588,7 +592,7 @@ where relay_parent, &relay_chain_interface, &validation_data, - id, + para_id, ).await; let timestamp = sp_timestamp::InherentDataProvider::from_system_time(); @@ -606,7 +610,7 @@ where Ok((slot, timestamp, parachain_inherent)) } }, - block_import: client.clone(), + block_import, para_client: client, backoff_authoring_blocks: Option::<()>::None, sync_oracle, @@ -663,6 +667,7 @@ where filter_pool, fee_history_cache, fee_history_cache_limit, + _block_import, _telemetry, _telemetry_worker_handle, ), @@ -779,6 +784,7 @@ where cumulus_client_consensus_aura::SlotProportion::new(1f32 / 16f32), ), telemetry: None, + compatibility_mode: Default::default(), })?; // the AURA authoring task is considered essential, i.e. if it diff --git a/pallet/account-migration/Cargo.toml b/pallet/account-migration/Cargo.toml index 3ad71d51a..3434e6be6 100644 --- a/pallet/account-migration/Cargo.toml +++ b/pallet/account-migration/Cargo.toml @@ -20,17 +20,17 @@ darwinia-staking = { default-features = false, path = "../staking" } dc-primitives = { default-features = false, path = "../../core/primitives" } # substrate -frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-assets = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-balances = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-vesting = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-assets = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-balances = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-vesting = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } [dev-dependencies] -sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } [features] default = ["std"] diff --git a/pallet/deposit/Cargo.toml b/pallet/deposit/Cargo.toml index 05bfb25e7..326be9968 100644 --- a/pallet/deposit/Cargo.toml +++ b/pallet/deposit/Cargo.toml @@ -20,18 +20,18 @@ dc-inflation = { default-features = false, path = "../../core/inflation" } dc-types = { path = "../../core/types" } # subtrate -frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } [dev-dependencies] # substrate -pallet-assets = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-assets = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } [features] default = ["std"] diff --git a/pallet/deposit/tests/mock.rs b/pallet/deposit/tests/mock.rs index 971e29270..48fdb0e94 100644 --- a/pallet/deposit/tests/mock.rs +++ b/pallet/deposit/tests/mock.rs @@ -74,6 +74,9 @@ impl pallet_assets::Config for Runtime { type AssetDeposit = (); type AssetId = AssetId; type Balance = Balance; + type CreateOrigin = frame_support::traits::AsEnsureOriginWithArg< + frame_system::EnsureSignedBy, u32>, + >; type Currency = Balances; type Extra = (); type ForceOrigin = frame_system::EnsureRoot; diff --git a/pallet/ecdsa-authority/Cargo.toml b/pallet/ecdsa-authority/Cargo.toml index 59d7b8111..2f57c77d9 100644 --- a/pallet/ecdsa-authority/Cargo.toml +++ b/pallet/ecdsa-authority/Cargo.toml @@ -19,17 +19,17 @@ scale-info = { version = "2.3", default-features = false } dc-primitives = { default-features = false, path = "../../core/primitives" } # substrate -frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-io = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-io = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } [dev-dependencies] array-bytes = { version = "6.0" } libsecp256k1 = { version = "0.7" } -sp-version = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-version = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } [features] default = ["std"] diff --git a/pallet/message-gadget/Cargo.toml b/pallet/message-gadget/Cargo.toml index dae9a92d4..f2e2deeb1 100644 --- a/pallet/message-gadget/Cargo.toml +++ b/pallet/message-gadget/Cargo.toml @@ -15,23 +15,23 @@ codec = { package = "parity-scale-codec", version = "3.2", default-features scale-info = { version = "2.3", default-features = false, features = ["derive"] } # frontier -pallet-evm = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +pallet-evm = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } # paritytech -frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-io = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-io = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } [dev-dependencies] # crates.io array-bytes = { version = "6.0" } # substrate -pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } [features] default = ["std"] diff --git a/pallet/message-transact/Cargo.toml b/pallet/message-transact/Cargo.toml index df35eefde..b2552c3f2 100644 --- a/pallet/message-transact/Cargo.toml +++ b/pallet/message-transact/Cargo.toml @@ -11,21 +11,21 @@ version = "6.0.0" [dependencies] # crates.io -codec = { package = "parity-scale-codec", version = "3.2", default-features = false, features = ["derive"] } -ethereum = { version = "0.12", default-features = false, features = ["with-codec"] } -scale-info = { version = "2.3", default-features = false, features = ["derive"] } +codec = { default-features = false, package = "parity-scale-codec", version = "3.2", features = ["derive"] } +ethereum = { default-features = false, version = "0.14.0", features = ["with-codec"] } +scale-info = { default-features = false, version = "2.3.0", features = ["derive"] } # frontier -fp-ethereum = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } -fp-evm = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } -pallet-evm = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +fp-ethereum = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } +fp-evm = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } +pallet-evm = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } # paritytech -frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } [dev-dependencies] array-bytes = { version = "4.1" } @@ -34,21 +34,21 @@ rlp = { version = "0.5" } sha3 = { version = "0.9" } # darwinia -bp-message-dispatch = { git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } -bp-runtime = { git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } -pallet-bridge-dispatch = { git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } +bp-message-dispatch = { git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.33" } +bp-runtime = { git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.33" } +pallet-bridge-dispatch = { git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.33" } # frontier -fp-self-contained = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } -pallet-ethereum = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +fp-self-contained = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } # moonbeam -precompile-utils = { git = "https://github.com/darwinia-network/moonbeam.git", branch = "polkadot-v0.9.30", features = ["testing"] } +precompile-utils = { git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.33", features = ["testing"] } # substrate -pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-ethereum = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } +pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } [features] default = ["std"] diff --git a/pallet/message-transact/src/tests/eip1559.rs b/pallet/message-transact/src/tests/eip1559.rs index 8247ce601..6ea902e3a 100644 --- a/pallet/message-transact/src/tests/eip1559.rs +++ b/pallet/message-transact/src/tests/eip1559.rs @@ -111,11 +111,12 @@ fn test_dispatch_eip1559_transaction_weight_mismatch() { ); assert!(!result.dispatch_result); + System::assert_has_event(RuntimeEvent::Dispatch( pallet_bridge_dispatch::Event::MessageWeightMismatch( SOURCE_CHAIN_ID, mock_message_id, - Weight::from_ref_time(1249913722000), + Weight::from_ref_time(1249901046000), Weight::from_ref_time(1000000000000), ), )); diff --git a/pallet/message-transact/src/tests/eip2930.rs b/pallet/message-transact/src/tests/eip2930.rs index 1bbf012ad..fefef528b 100644 --- a/pallet/message-transact/src/tests/eip2930.rs +++ b/pallet/message-transact/src/tests/eip2930.rs @@ -114,7 +114,7 @@ fn test_dispatch_eip2930_transaction_weight_mismatch() { pallet_bridge_dispatch::Event::MessageWeightMismatch( SOURCE_CHAIN_ID, mock_message_id, - Weight::from_ref_time(1249913722000), + Weight::from_ref_time(1249901046000), Weight::from_ref_time(1000000000000), ), )); diff --git a/pallet/message-transact/src/tests/legacy.rs b/pallet/message-transact/src/tests/legacy.rs index 23fd87595..3e730759a 100644 --- a/pallet/message-transact/src/tests/legacy.rs +++ b/pallet/message-transact/src/tests/legacy.rs @@ -111,7 +111,7 @@ fn test_dispatch_legacy_transaction_weight_mismatch() { pallet_bridge_dispatch::Event::MessageWeightMismatch( SOURCE_CHAIN_ID, mock_message_id, - Weight::from_ref_time(1249913722000), + Weight::from_ref_time(1249901046000), Weight::from_ref_time(1000000000000), ), )); diff --git a/pallet/staking/Cargo.toml b/pallet/staking/Cargo.toml index 244939b9f..959b18d95 100644 --- a/pallet/staking/Cargo.toml +++ b/pallet/staking/Cargo.toml @@ -19,13 +19,13 @@ dc-inflation = { default-features = false, path = "../../core/inflation" } dc-types = { path = "../../core/types" } # subtrate -frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-authorship = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-session = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-authorship = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-session = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } [dev-dependencies] # crates.io @@ -35,11 +35,11 @@ pretty_env_logger = { version = "0.4" } darwinia-deposit = { path = "../deposit" } # substrate -pallet-assets = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-session = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-assets = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-session = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } [features] default = ["std"] diff --git a/pallet/staking/tests/mock.rs b/pallet/staking/tests/mock.rs index 5fc0f8cd0..980cd862c 100644 --- a/pallet/staking/tests/mock.rs +++ b/pallet/staking/tests/mock.rs @@ -76,6 +76,9 @@ impl pallet_assets::Config for Runtime { type AssetDeposit = (); type AssetId = AssetId; type Balance = Balance; + type CreateOrigin = frame_support::traits::AsEnsureOriginWithArg< + frame_system::EnsureSignedBy, u32>, + >; type Currency = Balances; type Extra = (); type ForceOrigin = frame_system::EnsureRoot; diff --git a/precompile/assets/Cargo.toml b/precompile/assets/Cargo.toml index ef1cbb5e1..6ee038a46 100644 --- a/precompile/assets/Cargo.toml +++ b/precompile/assets/Cargo.toml @@ -11,19 +11,19 @@ version = "6.0.0" [dependencies] # frontier -fp-evm = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } -pallet-evm = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +fp-evm = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } +pallet-evm = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } # moonbeam -precompile-utils = { default-features = false, git = "https://github.com/darwinia-network/moonbeam.git", branch = "polkadot-v0.9.30" } +precompile-utils = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.33" } # paritytech -frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-assets = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-assets = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } [dev-dependencies] # crates.io codec = { package = "parity-scale-codec", version = "3.2" } @@ -31,14 +31,14 @@ scale-info = { version = "2.3", features = ["derive"] } sha3 = { version = "0.8" } # moonbeam -precompile-utils = { git = "https://github.com/darwinia-network/moonbeam.git", branch = "polkadot-v0.9.30", features = ["testing"] } +precompile-utils = { git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.33", features = ["testing"] } # paritytech -pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } [features] default = ["std"] diff --git a/precompile/assets/src/mock.rs b/precompile/assets/src/mock.rs index b594a280c..b03d21f68 100644 --- a/precompile/assets/src/mock.rs +++ b/precompile/assets/src/mock.rs @@ -177,6 +177,9 @@ impl pallet_assets::Config for TestRuntime { type AssetDeposit = (); type AssetId = AssetId; type Balance = Balance; + type CreateOrigin = frame_support::traits::AsEnsureOriginWithArg< + frame_system::EnsureSignedBy, AccountId>, + >; type Currency = Balances; type Extra = (); type ForceOrigin = frame_system::EnsureRoot; diff --git a/precompile/bls12-381/Cargo.toml b/precompile/bls12-381/Cargo.toml index c02145ee7..1aa0f2e18 100644 --- a/precompile/bls12-381/Cargo.toml +++ b/precompile/bls12-381/Cargo.toml @@ -14,15 +14,15 @@ version = "6.0.0" milagro_bls = { default-features = false, git = "https://github.com/darwinia-network/milagro_bls" } # frontier -fp-evm = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } -pallet-evm = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +fp-evm = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } +pallet-evm = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } # moonbeam -precompile-utils = { default-features = false, git = "https://github.com/darwinia-network/moonbeam.git", branch = "polkadot-v0.9.30" } +precompile-utils = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.33" } # substrate -frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } [dev-dependencies] # crates.io @@ -30,15 +30,15 @@ codec = { package = "parity-scale-codec", version = "3.2" } scale-info = { version = "2.3", features = ["derive"] } # moonbeam -precompile-utils = { git = "https://github.com/darwinia-network/moonbeam.git", branch = "polkadot-v0.9.30", features = ["testing"] } +precompile-utils = { git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.33", features = ["testing"] } # substrate -frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } [features] default = ["std"] diff --git a/precompile/deposit/Cargo.toml b/precompile/deposit/Cargo.toml index a60c174c3..49152047c 100644 --- a/precompile/deposit/Cargo.toml +++ b/precompile/deposit/Cargo.toml @@ -11,20 +11,20 @@ version = "6.0.0" [dependencies] # frontier -fp-evm = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } -pallet-evm = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +fp-evm = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } +pallet-evm = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } # darwinia darwinia-deposit = { default-features = false, path = "../../pallet/deposit"} # moonbeam -precompile-utils = { default-features = false, git = "https://github.com/darwinia-network/moonbeam.git", branch = "polkadot-v0.9.30" } +precompile-utils = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.33" } # substrate -frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } [dev-dependencies] # crates.io @@ -32,13 +32,13 @@ codec = { package = "parity-scale-codec", version = "3.2" } scale-info = { version = "2.3", features = ["derive"] } # moonbeam -precompile-utils = { git = "https://github.com/darwinia-network/moonbeam.git", branch = "polkadot-v0.9.30", features = ["testing"] } +precompile-utils = { git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.33", features = ["testing"] } # substrate -pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } [features] default = ["std"] diff --git a/precompile/dispatch/Cargo.toml b/precompile/dispatch/Cargo.toml deleted file mode 100644 index 1b9d9e0a3..000000000 --- a/precompile/dispatch/Cargo.toml +++ /dev/null @@ -1,37 +0,0 @@ -[package] -authors = ["Darwinia Network "] -description = "Call dispatch precompile for EVM pallet." -edition = "2021" -homepage = "https://darwinia.network" -license = "GPL-3.0" -name = "darwinia-precompile-dispatch" -readme = "README.md" -repository = "https://github.com/darwinia-network/darwinia" -version = "6.0.0" - -[dependencies] -# frontier -fp-evm = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } -pallet-evm = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } - -# moonbeam -precompile-utils = { default-features = false, git = "https://github.com/darwinia-network/moonbeam.git", branch = "polkadot-v0.9.30" } - -# substrate -frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } - -[features] -default = ["std"] -std = [ - # frontier - "fp-evm/std", - "pallet-evm/std", - - # moonbeam - "precompile-utils/std", - - # substrate - "frame-support/std", - "sp-std/std", -] diff --git a/precompile/dispatch/src/lib.rs b/precompile/dispatch/src/lib.rs deleted file mode 100644 index 695f7fcdb..000000000 --- a/precompile/dispatch/src/lib.rs +++ /dev/null @@ -1,93 +0,0 @@ -// This file is part of Darwinia. -// -// Copyright (C) 2018-2023 Darwinia Network -// SPDX-License-Identifier: GPL-3.0 -// -// Darwinia is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// Darwinia 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 Darwinia. If not, see . - -#![cfg_attr(not(feature = "std"), no_std)] - -extern crate alloc; - -// std -use alloc::format; -use core::marker::PhantomData; -// frontier -use fp_evm::{ExitError, PrecompileFailure}; -// moonbeam -use frame_support::{ - codec::{Decode, DecodeLimit as _}, - dispatch::{DispatchClass, Dispatchable, GetDispatchInfo, Pays, PostDispatchInfo}, - traits::{ConstU32, Get}, -}; -use pallet_evm::{AddressMapping, GasWeightMapping}; -use precompile_utils::prelude::*; - -// `DecodeLimit` specifies the max depth a call can use when decoding, as unbounded depth -// can be used to overflow the stack. -// Default value is 8, which is the same as in XCM call decoding. -pub struct Dispatch> { - _marker: PhantomData<(T, DecodeLimit)>, -} - -#[precompile_utils::precompile] -impl Dispatch -where - T: pallet_evm::Config, - T::RuntimeCall: Dispatchable + GetDispatchInfo + Decode, - ::RuntimeOrigin: From>, - DecodeLimit: Get, -{ - #[precompile::public("execute(bytes)")] - fn execute( - handle: &mut impl PrecompileHandle, - encoded_call: UnboundedBytes, - ) -> EvmResult { - let target_gas = handle.gas_limit(); - let context = handle.context(); - - let call = T::RuntimeCall::decode_with_depth_limit( - DecodeLimit::get(), - &mut encoded_call.as_bytes(), - ) - .map_err(|_| revert("decode failed"))?; - let info = call.get_dispatch_info(); - - let valid_call = info.pays_fee == Pays::Yes && info.class == DispatchClass::Normal; - if !valid_call { - return Err(revert("invalid call")); - } - - if let Some(gas) = target_gas { - let valid_weight = - info.weight.ref_time() <= T::GasWeightMapping::gas_to_weight(gas, false).ref_time(); - if !valid_weight { - return Err(PrecompileFailure::Error { exit_status: ExitError::OutOfGas }); - } - } - - let origin = T::AddressMapping::into_account_id(context.caller); - match call.dispatch(Some(origin).into()) { - Ok(post_info) => { - let cost = T::GasWeightMapping::weight_to_gas( - post_info.actual_weight.unwrap_or(info.weight), - ); - - handle.record_cost(cost)?; - Ok(true) - }, - Err(e) => Err(revert(format!("dispatch failed: {}", <&'static str>::from(e)))), - } - } -} diff --git a/precompile/staking/Cargo.toml b/precompile/staking/Cargo.toml index a20f3d0db..c7b74f720 100644 --- a/precompile/staking/Cargo.toml +++ b/precompile/staking/Cargo.toml @@ -11,21 +11,21 @@ version = "6.0.0" [dependencies] # frontier -fp-evm = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } -pallet-evm = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +fp-evm = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } +pallet-evm = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } # darwinia darwinia-staking = { default-features = false, path = "../../pallet/staking" } # moonbeam -precompile-utils = { default-features = false, git = "https://github.com/darwinia-network/moonbeam.git", branch = "polkadot-v0.9.30" } +precompile-utils = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.33" } # substrate -frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } [dev-dependencies] # crates.io @@ -36,13 +36,13 @@ scale-info = { version = "2.3", features = ["derive"] } darwinia-deposit = { path = "../../pallet/deposit" } # moonbeam -precompile-utils = { git = "https://github.com/darwinia-network/moonbeam.git", branch = "polkadot-v0.9.30", features = ["testing"] } +precompile-utils = { git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.33", features = ["testing"] } # substrate -frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } [features] diff --git a/precompile/state-storage/Cargo.toml b/precompile/state-storage/Cargo.toml index 5c9d35e54..ad5e5584f 100644 --- a/precompile/state-storage/Cargo.toml +++ b/precompile/state-storage/Cargo.toml @@ -11,15 +11,15 @@ version = "6.0.0" [dependencies] # frontier -fp-evm = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } -pallet-evm = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +fp-evm = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } +pallet-evm = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } # moonbeam -precompile-utils = { default-features = false, git = "https://github.com/darwinia-network/moonbeam.git", branch = "polkadot-v0.9.30" } +precompile-utils = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.33" } # substrate -frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } [dev-dependencies] # crates.io @@ -27,15 +27,15 @@ codec = { package = "parity-scale-codec", version = "3.2" } scale-info = { version = "2.3", features = ["derive"] } # moonbeam -precompile-utils = { git = "https://github.com/darwinia-network/moonbeam.git", branch = "polkadot-v0.9.30", features = ["testing"] } +precompile-utils = { git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.33", features = ["testing"] } # substrate -frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } [features] default = ["std"] diff --git a/runtime/common/Cargo.toml b/runtime/common/Cargo.toml index 6783afc30..2902e7f2c 100644 --- a/runtime/common/Cargo.toml +++ b/runtime/common/Cargo.toml @@ -18,23 +18,23 @@ smallvec = { version = "1.10" } dc-primitives = { default-features = false, path = "../../core/primitives" } # darwinia-messages-substrate -bp-darwinia-core = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } +bp-darwinia-core = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.33" } # moonbeam -account = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.30" } +account = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.33" } # polkadot -xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" } -xcm-builder = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" } -xcm-executor = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" } +xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.33" } +xcm-builder = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.33" } +xcm-executor = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.33" } # substrate -frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-collective = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-io = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-collective = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-io = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } [features] default = ["std"] @@ -45,6 +45,9 @@ std = [ # darwinia "dc-primitives/std", + # darwinia-messages-substrate + "bp-darwinia-core/std", + # moonbeam "account/std", diff --git a/runtime/crab/Cargo.toml b/runtime/crab/Cargo.toml index 5fdef26a1..3da1d1834 100644 --- a/runtime/crab/Cargo.toml +++ b/runtime/crab/Cargo.toml @@ -10,7 +10,7 @@ repository = "https://github.com/darwinia-network/darwinia" version = "6.0.0" [build-dependencies] -substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } [dependencies] # crates.io @@ -21,17 +21,17 @@ static_assertions = { version = "1.1" } array-bytes = { version = "6.0", optional = true } # cumulus -cumulus-pallet-aura-ext = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } -cumulus-pallet-dmp-queue = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } -cumulus-pallet-parachain-system = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } -cumulus-pallet-xcm = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } -cumulus-pallet-xcmp-queue = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } -cumulus-primitives-core = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } -cumulus-primitives-timestamp = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } -cumulus-primitives-utility = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } -parachain-info = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } +cumulus-pallet-aura-ext = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.33" } +cumulus-pallet-dmp-queue = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.33" } +cumulus-pallet-parachain-system = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.33" } +cumulus-pallet-xcm = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.33" } +cumulus-pallet-xcmp-queue = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.33" } +cumulus-primitives-core = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.33" } +cumulus-primitives-timestamp = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.33" } +cumulus-primitives-utility = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.33" } +parachain-info = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.33" } # cumulus optional -cumulus-pallet-session-benchmarking = { optional = true, default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } +cumulus-pallet-session-benchmarking = { optional = true, default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.33" } # darwinia darwinia-account-migration = { default-features = false, path = "../../pallet/account-migration" } @@ -43,96 +43,95 @@ darwinia-message-transact = { default-features = false, path = "../../pa darwinia-precompile-assets = { default-features = false, path = "../../precompile/assets" } darwinia-precompile-bls12-381 = { default-features = false, path = "../../precompile/bls12-381" } darwinia-precompile-deposit = { default-features = false, path = "../../precompile/deposit" } -darwinia-precompile-dispatch = { default-features = false, path = "../../precompile/dispatch" } darwinia-precompile-staking = { default-features = false, path = "../../precompile/staking" } darwinia-precompile-state-storage = { default-features = false, path = "../../precompile/state-storage" } darwinia-staking = { default-features = false, path = "../../pallet/staking" } dc-primitives = { default-features = false, path = "../../core/primitives" } # darwinia-messages-substrate -bp-message-dispatch = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } -bp-messages = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } -bp-polkadot-core = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } -bp-runtime = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } -bridge-runtime-common = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } -pallet-bridge-dispatch = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } -pallet-bridge-grandpa = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } -pallet-bridge-messages = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } -pallet-bridge-parachains = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } -pallet-fee-market = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } +bp-message-dispatch = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.33" } +bp-messages = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.33" } +bp-polkadot-core = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.33" } +bp-runtime = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.33" } +bridge-runtime-common = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.33" } +pallet-bridge-dispatch = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.33" } +pallet-bridge-grandpa = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.33" } +pallet-bridge-messages = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.33" } +pallet-bridge-parachains = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.33" } +pallet-fee-market = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.33" } # frontier -fp-rpc = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } -fp-self-contained = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } -pallet-base-fee = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } -pallet-ethereum = { default-features = false, features = ["forbid-evm-reentrancy"], git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } -pallet-evm = { default-features = false, features = ["forbid-evm-reentrancy"], git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } -pallet-evm-precompile-blake2 = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } -pallet-evm-precompile-bn128 = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } -pallet-evm-precompile-modexp = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } -pallet-evm-precompile-simple = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +fp-rpc = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } +fp-self-contained = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } +pallet-ethereum = { default-features = false, features = ["forbid-evm-reentrancy"], git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } +pallet-evm = { default-features = false, features = ["forbid-evm-reentrancy"], git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } +pallet-evm-precompile-blake2 = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } +pallet-evm-precompile-bn128 = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } +pallet-evm-precompile-dispatch = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } +pallet-evm-precompile-modexp = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } +pallet-evm-precompile-simple = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } # moonbeam -precompile-utils = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.30" } -xcm-primitives = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.30" } +precompile-utils = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.33" } +xcm-primitives = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.33" } # polkadot -pallet-xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" } -polkadot-parachain = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" } -polkadot-runtime-common = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" } -xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" } -xcm-builder = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" } -xcm-executor = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" } +pallet-xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.33" } +polkadot-parachain = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.33" } +polkadot-runtime-common = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.33" } +xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.33" } +xcm-builder = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.33" } +xcm-executor = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.33" } # substrate -frame-executive = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -frame-system-rpc-runtime-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-assets = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-aura = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-authorship = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-balances = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-collective = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-democracy = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-elections-phragmen = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-identity = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-membership = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-multisig = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-preimage = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-proxy = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-scheduler = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-session = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-sudo = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-timestamp = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-tips = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-transaction-payment = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-transaction-payment-rpc-runtime-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-treasury = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-utility = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-vesting = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-block-builder = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-consensus-aura = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-inherents = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-io = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-offchain = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-session = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-transaction-pool = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-version = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +frame-executive = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +frame-system-rpc-runtime-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-assets = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-aura = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-authorship = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-balances = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-collective = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-democracy = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-elections-phragmen = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-identity = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-membership = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-multisig = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-preimage = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-proxy = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-scheduler = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-session = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-sudo = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-timestamp = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-tips = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-transaction-payment = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-transaction-payment-rpc-runtime-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-treasury = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-utility = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-vesting = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-block-builder = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-consensus-aura = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-inherents = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-io = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-offchain = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-session = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-transaction-pool = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-version = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } # substrate optional -frame-benchmarking = { optional = true, default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -frame-system-benchmarking = { optional = true, default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -frame-try-runtime = { optional = true, default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +frame-benchmarking = { optional = true, default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +frame-system-benchmarking = { optional = true, default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +frame-try-runtime = { optional = true, default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } [dev-dependencies] # darwinia darwinia-common-runtime = { features = ["test"], path = "../common" } # substrate -sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } [features] default = ["std"] @@ -165,7 +164,6 @@ std = [ "darwinia-precompile-bls12-381/std", "darwinia-precompile-staking/std", "darwinia-precompile-deposit/std", - "darwinia-precompile-dispatch/std", "darwinia-precompile-state-storage/std", "darwinia-staking/std", "dc-primitives/std", @@ -185,11 +183,11 @@ std = [ # frontier "fp-rpc/std", "fp-self-contained/std", - "pallet-base-fee/std", "pallet-ethereum/std", "pallet-evm/std", "pallet-evm-precompile-blake2/std", "pallet-evm-precompile-bn128/std", + "pallet-evm-precompile-dispatch/std", "pallet-evm-precompile-modexp/std", "pallet-evm-precompile-simple/std", @@ -319,7 +317,6 @@ try-runtime = [ "parachain-info/try-runtime", # frontier - "pallet-base-fee/try-runtime", "pallet-ethereum/try-runtime", "pallet-evm/try-runtime", @@ -353,5 +350,5 @@ try-runtime = [ "pallet-utility/try-runtime", "pallet-vesting/try-runtime", # substrate optional - "frame-try-runtime", + "frame-try-runtime/try-runtime", ] diff --git a/runtime/crab/src/lib.rs b/runtime/crab/src/lib.rs index 64fb84e1e..411618b56 100644 --- a/runtime/crab/src/lib.rs +++ b/runtime/crab/src/lib.rs @@ -43,10 +43,10 @@ use xcm_executor::XcmExecutor; // substrate use frame_support::{ dispatch::DispatchClass, - traits::{Imbalance, OnUnbalanced}, + traits::{AsEnsureOriginWithArg, Imbalance, IsInVec, OnUnbalanced, WithdrawReasons}, weights::{ConstantMultiplier, Weight}, }; -use frame_system::EnsureRoot; +use frame_system::{EnsureRoot, EnsureSignedBy}; use sp_core::{crypto::KeyTypeId, OpaqueMetadata, H160, H256, U256}; use sp_runtime::{ generic, @@ -271,7 +271,6 @@ frame_support::construct_runtime! { // EVM stuff. Ethereum: pallet_ethereum = 31, Evm: pallet_evm = 32, - BaseFee: pallet_base_fee = 33, MessageTransact: darwinia_message_transact = 39, // S2S stuff. @@ -577,8 +576,10 @@ sp_api::impl_runtime_apis! { } fn elasticity() -> Option { - Some(BaseFee::elasticity()) + None } + + fn gas_limit_multiplier_support() {} } impl fp_rpc::ConvertTransactionRuntimeApi for Runtime { diff --git a/runtime/crab/src/pallets/assets.rs b/runtime/crab/src/pallets/assets.rs index cd21cc493..19ff27cb8 100644 --- a/runtime/crab/src/pallets/assets.rs +++ b/runtime/crab/src/pallets/assets.rs @@ -24,16 +24,19 @@ pub enum AssetIds { CKton = 1026, } +frame_support::parameter_types! { + pub Creators: Vec = vec![ROOT]; +} + impl pallet_assets::Config for Runtime { type ApprovalDeposit = ConstU128<0>; type AssetAccountDeposit = ConstU128<0>; type AssetDeposit = ConstU128<0>; type AssetId = AssetId; type Balance = Balance; + type CreateOrigin = AsEnsureOriginWithArg, AccountId>>; type Currency = Balances; type Extra = (); - // TODO: Restrict the create asset origin. https://github.com/paritytech/substrate/pull/12586 - // type CreateOrigin = EnsureRoot; type ForceOrigin = EnsureRoot; type Freezer = (); type MetadataDepositBase = ConstU128<0>; diff --git a/runtime/crab/src/pallets/base_fee.rs b/runtime/crab/src/pallets/base_fee.rs deleted file mode 100644 index d1da68d2c..000000000 --- a/runtime/crab/src/pallets/base_fee.rs +++ /dev/null @@ -1,47 +0,0 @@ -// This file is part of Darwinia. -// -// Copyright (C) 2018-2023 Darwinia Network -// SPDX-License-Identifier: GPL-3.0 -// -// Darwinia is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// Darwinia 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 Darwinia. If not, see . - -// darwinia -use crate::*; - -frame_support::parameter_types! { - pub DefaultBaseFeePerGas: U256 = U256::from(1_000_000_000); - pub DefaultElasticity: Permill = Permill::from_parts(125_000); -} - -pub struct BaseFeeThreshold; -impl pallet_base_fee::BaseFeeThreshold for BaseFeeThreshold { - fn lower() -> Permill { - Permill::zero() - } - - fn ideal() -> Permill { - Permill::from_parts(500_000) - } - - fn upper() -> Permill { - Permill::from_parts(1_000_000) - } -} - -impl pallet_base_fee::Config for Runtime { - type DefaultBaseFeePerGas = DefaultBaseFeePerGas; - type DefaultElasticity = DefaultElasticity; - type RuntimeEvent = RuntimeEvent; - type Threshold = BaseFeeThreshold; -} diff --git a/runtime/crab/src/pallets/democracy.rs b/runtime/crab/src/pallets/democracy.rs index b996f322f..e28b4f392 100644 --- a/runtime/crab/src/pallets/democracy.rs +++ b/runtime/crab/src/pallets/democracy.rs @@ -45,13 +45,13 @@ impl pallet_democracy::Config for Runtime { type InstantAllowed = ConstBool; type InstantOrigin = RootOrAll; type LaunchPeriod = ConstU32<{ 28 * DAYS }>; + type MaxBlacklisted = ConstU32<100>; + type MaxDeposits = ConstU32<100>; type MaxProposals = ConstU32<100>; type MaxVotes = ConstU32<100>; type MinimumDeposit = ConstU128; - type OperationalPreimageOrigin = pallet_collective::EnsureMember; type PalletsOrigin = OriginCaller; - type PreimageByteDeposit = ConstU128<{ darwinia_deposit(0, 1) }>; - type Proposal = RuntimeCall; + type Preimages = Preimage; type RuntimeEvent = RuntimeEvent; type Scheduler = Scheduler; type Slash = Treasury; diff --git a/runtime/crab/src/pallets/evm.rs b/runtime/crab/src/pallets/evm.rs index d9eb03a20..9f07703cb 100644 --- a/runtime/crab/src/pallets/evm.rs +++ b/runtime/crab/src/pallets/evm.rs @@ -146,7 +146,7 @@ where darwinia_precompile_state_storage::EthereumStorageFilter, >>::execute(handle)), a if a == addr(1025) => - Some(>::execute(handle)), + Some(>::execute(handle)), // [1026, 1536) reserved for assets precompiles. a if (1026..1536).contains(&AssetIdConverter::account_to_asset_id(a.into())) => Some(>::execute( diff --git a/runtime/crab/src/pallets/mod.rs b/runtime/crab/src/pallets/mod.rs index ebfd94629..a82061ac6 100644 --- a/runtime/crab/src/pallets/mod.rs +++ b/runtime/crab/src/pallets/mod.rs @@ -107,8 +107,6 @@ mod ethereum; mod evm; pub use evm::*; -mod base_fee; - mod message_transact; // S2S stuff. diff --git a/runtime/crab/src/pallets/multisig.rs b/runtime/crab/src/pallets/multisig.rs index 9f4ad225e..c47262b26 100644 --- a/runtime/crab/src/pallets/multisig.rs +++ b/runtime/crab/src/pallets/multisig.rs @@ -25,7 +25,7 @@ impl pallet_multisig::Config for Runtime { type DepositBase = ConstU128<{ darwinia_deposit(1, 88) }>; // Additional storage item size of 32 bytes. type DepositFactor = ConstU128<{ darwinia_deposit(0, 32) }>; - type MaxSignatories = ConstU16<100>; + type MaxSignatories = ConstU32<100>; type RuntimeCall = RuntimeCall; type RuntimeEvent = RuntimeEvent; type WeightInfo = (); diff --git a/runtime/crab/src/pallets/preimage.rs b/runtime/crab/src/pallets/preimage.rs index 4fa3a5843..fc31bb737 100644 --- a/runtime/crab/src/pallets/preimage.rs +++ b/runtime/crab/src/pallets/preimage.rs @@ -23,8 +23,7 @@ impl pallet_preimage::Config for Runtime { type BaseDeposit = ConstU128<{ 500 * UNIT }>; type ByteDeposit = ConstU128<{ darwinia_deposit(0, 1) }>; type Currency = Balances; - type ManagerOrigin = Root; - type MaxSize = ConstU32<{ 4096 * 1024 }>; + type ManagerOrigin = EnsureRoot; type RuntimeEvent = RuntimeEvent; type WeightInfo = (); } diff --git a/runtime/crab/src/pallets/scheduler.rs b/runtime/crab/src/pallets/scheduler.rs index ea698235d..2f0197405 100644 --- a/runtime/crab/src/pallets/scheduler.rs +++ b/runtime/crab/src/pallets/scheduler.rs @@ -52,10 +52,9 @@ frame_support::parameter_types! { impl pallet_scheduler::Config for Runtime { type MaxScheduledPerBlock = ConstU32<50>; type MaximumWeight = MaximumSchedulerWeight; - type NoPreimagePostponement = NoPreimagePostponement; type OriginPrivilegeCmp = OriginPrivilegeCmp; type PalletsOrigin = OriginCaller; - type PreimageProvider = Preimage; + type Preimages = Preimage; type RuntimeCall = RuntimeCall; type RuntimeEvent = RuntimeEvent; type RuntimeOrigin = RuntimeOrigin; diff --git a/runtime/crab/src/pallets/system.rs b/runtime/crab/src/pallets/system.rs index 990a59ce1..ac01d5c80 100644 --- a/runtime/crab/src/pallets/system.rs +++ b/runtime/crab/src/pallets/system.rs @@ -28,8 +28,9 @@ const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(5); pub const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75); /// We allow for 0.5 of a second of compute with a 12 second average block time. -pub const MAXIMUM_BLOCK_WEIGHT: Weight = - frame_support::weights::constants::WEIGHT_PER_SECOND.saturating_div(2); +pub const MAXIMUM_BLOCK_WEIGHT: Weight = frame_support::weights::constants::WEIGHT_PER_SECOND + .saturating_div(2) + .set_proof_size(cumulus_primitives_core::relay_chain::v2::MAX_POV_SIZE as u64); frame_support::parameter_types! { pub const Version: sp_version::RuntimeVersion = VERSION; diff --git a/runtime/crab/src/pallets/vesting.rs b/runtime/crab/src/pallets/vesting.rs index 0ab19e7ff..ca01513ea 100644 --- a/runtime/crab/src/pallets/vesting.rs +++ b/runtime/crab/src/pallets/vesting.rs @@ -19,11 +19,17 @@ // darwinia use crate::*; +frame_support::parameter_types! { + pub UnvestedFundsAllowedWithdrawReasons: WithdrawReasons = + WithdrawReasons::except(WithdrawReasons::TRANSFER | WithdrawReasons::RESERVE); +} + impl pallet_vesting::Config for Runtime { type BlockNumberToBalance = sp_runtime::traits::ConvertInto; type Currency = Balances; type MinVestedTransfer = ConstU128; type RuntimeEvent = RuntimeEvent; + type UnvestedFundsAllowedWithdrawReasons = UnvestedFundsAllowedWithdrawReasons; type WeightInfo = (); // `VestingInfo` encode length is 36bytes. 28 schedules gets encoded as 1009 bytes, which is the diff --git a/runtime/darwinia/Cargo.toml b/runtime/darwinia/Cargo.toml index 9b687de83..64a45636a 100644 --- a/runtime/darwinia/Cargo.toml +++ b/runtime/darwinia/Cargo.toml @@ -10,7 +10,7 @@ repository = "https://github.com/darwinia-network/darwinia" version = "6.0.0" [build-dependencies] -substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } [dependencies] # crates.io @@ -21,17 +21,17 @@ static_assertions = { version = "1.1" } array-bytes = { version = "6.0", optional = true } # cumulus -cumulus-pallet-aura-ext = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } -cumulus-pallet-dmp-queue = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } -cumulus-pallet-parachain-system = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } -cumulus-pallet-xcm = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } -cumulus-pallet-xcmp-queue = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } -cumulus-primitives-core = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } -cumulus-primitives-timestamp = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } -cumulus-primitives-utility = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } -parachain-info = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } +cumulus-pallet-aura-ext = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.33" } +cumulus-pallet-dmp-queue = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.33" } +cumulus-pallet-parachain-system = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.33" } +cumulus-pallet-xcm = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.33" } +cumulus-pallet-xcmp-queue = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.33" } +cumulus-primitives-core = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.33" } +cumulus-primitives-timestamp = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.33" } +cumulus-primitives-utility = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.33" } +parachain-info = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.33" } # cumulus optional -cumulus-pallet-session-benchmarking = { optional = true, default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } +cumulus-pallet-session-benchmarking = { optional = true, default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.33" } # darwinia darwinia-account-migration = { default-features = false, path = "../../pallet/account-migration" } @@ -43,96 +43,95 @@ darwinia-message-transact = { default-features = false, path = "../../pa darwinia-precompile-assets = { default-features = false, path = "../../precompile/assets" } darwinia-precompile-bls12-381 = { default-features = false, path = "../../precompile/bls12-381" } darwinia-precompile-deposit = { default-features = false, path = "../../precompile/deposit" } -darwinia-precompile-dispatch = { default-features = false, path = "../../precompile/dispatch" } darwinia-precompile-staking = { default-features = false, path = "../../precompile/staking" } darwinia-precompile-state-storage = { default-features = false, path = "../../precompile/state-storage" } darwinia-staking = { default-features = false, path = "../../pallet/staking" } dc-primitives = { default-features = false, path = "../../core/primitives" } # darwinia-messages-substrate -bp-message-dispatch = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } -bp-messages = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } -bp-polkadot-core = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } -bp-runtime = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } -bridge-runtime-common = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } -pallet-bridge-dispatch = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } -pallet-bridge-grandpa = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } -pallet-bridge-messages = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } -pallet-bridge-parachains = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } -pallet-fee-market = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } +bp-message-dispatch = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.33" } +bp-messages = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.33" } +bp-polkadot-core = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.33" } +bp-runtime = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.33" } +bridge-runtime-common = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.33" } +pallet-bridge-dispatch = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.33" } +pallet-bridge-grandpa = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.33" } +pallet-bridge-messages = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.33" } +pallet-bridge-parachains = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.33" } +pallet-fee-market = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.33" } # frontier -fp-rpc = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } -fp-self-contained = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } -pallet-base-fee = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } -pallet-ethereum = { default-features = false, features = ["forbid-evm-reentrancy"], git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } -pallet-evm = { default-features = false, features = ["forbid-evm-reentrancy"], git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } -pallet-evm-precompile-blake2 = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } -pallet-evm-precompile-bn128 = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } -pallet-evm-precompile-modexp = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } -pallet-evm-precompile-simple = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +fp-rpc = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } +fp-self-contained = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } +pallet-ethereum = { default-features = false, features = ["forbid-evm-reentrancy"], git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } +pallet-evm = { default-features = false, features = ["forbid-evm-reentrancy"], git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } +pallet-evm-precompile-blake2 = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } +pallet-evm-precompile-bn128 = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } +pallet-evm-precompile-dispatch = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } +pallet-evm-precompile-modexp = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } +pallet-evm-precompile-simple = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } # moonbeam -precompile-utils = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.30" } -xcm-primitives = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.30" } +precompile-utils = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.33" } +xcm-primitives = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.33" } # polkadot -pallet-xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" } -polkadot-parachain = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" } -polkadot-runtime-common = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" } -xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" } -xcm-builder = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" } -xcm-executor = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" } +pallet-xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.33" } +polkadot-parachain = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.33" } +polkadot-runtime-common = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.33" } +xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.33" } +xcm-builder = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.33" } +xcm-executor = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.33" } # substrate -frame-executive = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -frame-system-rpc-runtime-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-assets = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-aura = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-authorship = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-balances = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-collective = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-democracy = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-elections-phragmen = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-identity = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-membership = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-multisig = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-preimage = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-proxy = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-scheduler = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-session = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-sudo = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-timestamp = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-tips = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-transaction-payment = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-transaction-payment-rpc-runtime-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-treasury = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-utility = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-vesting = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-block-builder = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-consensus-aura = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-inherents = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-io = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-offchain = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-session = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-transaction-pool = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-version = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +frame-executive = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +frame-system-rpc-runtime-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-assets = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-aura = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-authorship = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-balances = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-collective = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-democracy = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-elections-phragmen = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-identity = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-membership = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-multisig = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-preimage = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-proxy = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-scheduler = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-session = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-sudo = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-timestamp = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-tips = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-transaction-payment = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-transaction-payment-rpc-runtime-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-treasury = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-utility = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-vesting = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-block-builder = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-consensus-aura = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-inherents = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-io = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-offchain = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-session = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-transaction-pool = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-version = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } # substrate optional -frame-benchmarking = { optional = true, default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -frame-system-benchmarking = { optional = true, default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -frame-try-runtime = { optional = true, default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +frame-benchmarking = { optional = true, default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +frame-system-benchmarking = { optional = true, default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +frame-try-runtime = { optional = true, default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } [dev-dependencies] # darwinia darwinia-common-runtime = { features = ["test"], path = "../common" } # substrate -sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } [features] default = ["std"] @@ -165,7 +164,6 @@ std = [ "darwinia-precompile-bls12-381/std", "darwinia-precompile-staking/std", "darwinia-precompile-deposit/std", - "darwinia-precompile-dispatch/std", "darwinia-precompile-state-storage/std", "darwinia-staking/std", "dc-primitives/std", @@ -185,11 +183,11 @@ std = [ # frontier "fp-rpc/std", "fp-self-contained/std", - "pallet-base-fee/std", "pallet-ethereum/std", "pallet-evm/std", "pallet-evm-precompile-blake2/std", "pallet-evm-precompile-bn128/std", + "pallet-evm-precompile-dispatch/std", "pallet-evm-precompile-modexp/std", "pallet-evm-precompile-simple/std", @@ -319,7 +317,6 @@ try-runtime = [ "parachain-info/try-runtime", # frontier - "pallet-base-fee/try-runtime", "pallet-ethereum/try-runtime", "pallet-evm/try-runtime", @@ -353,5 +350,5 @@ try-runtime = [ "pallet-utility/try-runtime", "pallet-vesting/try-runtime", # substrate optional - "frame-try-runtime", + "frame-try-runtime/try-runtime", ] diff --git a/runtime/darwinia/src/lib.rs b/runtime/darwinia/src/lib.rs index 2f8a5d9cb..744347be8 100644 --- a/runtime/darwinia/src/lib.rs +++ b/runtime/darwinia/src/lib.rs @@ -43,10 +43,10 @@ use xcm_executor::XcmExecutor; // substrate use frame_support::{ dispatch::DispatchClass, - traits::{Imbalance, OnUnbalanced}, + traits::{AsEnsureOriginWithArg, Imbalance, IsInVec, OnUnbalanced, WithdrawReasons}, weights::{ConstantMultiplier, Weight}, }; -use frame_system::EnsureRoot; +use frame_system::{EnsureRoot, EnsureSignedBy}; use sp_core::{crypto::KeyTypeId, OpaqueMetadata, H160, H256, U256}; use sp_runtime::{ generic, @@ -271,7 +271,6 @@ frame_support::construct_runtime! { // EVM stuff. Ethereum: pallet_ethereum = 31, Evm: pallet_evm = 32, - BaseFee: pallet_base_fee = 33, MessageTransact: darwinia_message_transact = 39, // S2S stuff. @@ -577,7 +576,10 @@ sp_api::impl_runtime_apis! { } fn elasticity() -> Option { - Some(BaseFee::elasticity()) + None + } + + fn gas_limit_multiplier_support() { } } diff --git a/runtime/darwinia/src/pallets/assets.rs b/runtime/darwinia/src/pallets/assets.rs index 5fe0af1ca..2367bca4e 100644 --- a/runtime/darwinia/src/pallets/assets.rs +++ b/runtime/darwinia/src/pallets/assets.rs @@ -24,16 +24,19 @@ pub enum AssetIds { Kton = 1026, } +frame_support::parameter_types! { + pub Creators: Vec = vec![ROOT]; +} + impl pallet_assets::Config for Runtime { type ApprovalDeposit = ConstU128<0>; type AssetAccountDeposit = ConstU128<0>; type AssetDeposit = ConstU128<0>; type AssetId = AssetId; type Balance = Balance; + type CreateOrigin = AsEnsureOriginWithArg, AccountId>>; type Currency = Balances; type Extra = (); - // TODO: Restrict the create asset origin. https://github.com/paritytech/substrate/pull/12586 - // type CreateOrigin = EnsureRoot; type ForceOrigin = EnsureRoot; type Freezer = (); type MetadataDepositBase = ConstU128<0>; diff --git a/runtime/darwinia/src/pallets/base_fee.rs b/runtime/darwinia/src/pallets/base_fee.rs deleted file mode 100644 index d1da68d2c..000000000 --- a/runtime/darwinia/src/pallets/base_fee.rs +++ /dev/null @@ -1,47 +0,0 @@ -// This file is part of Darwinia. -// -// Copyright (C) 2018-2023 Darwinia Network -// SPDX-License-Identifier: GPL-3.0 -// -// Darwinia is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// Darwinia 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 Darwinia. If not, see . - -// darwinia -use crate::*; - -frame_support::parameter_types! { - pub DefaultBaseFeePerGas: U256 = U256::from(1_000_000_000); - pub DefaultElasticity: Permill = Permill::from_parts(125_000); -} - -pub struct BaseFeeThreshold; -impl pallet_base_fee::BaseFeeThreshold for BaseFeeThreshold { - fn lower() -> Permill { - Permill::zero() - } - - fn ideal() -> Permill { - Permill::from_parts(500_000) - } - - fn upper() -> Permill { - Permill::from_parts(1_000_000) - } -} - -impl pallet_base_fee::Config for Runtime { - type DefaultBaseFeePerGas = DefaultBaseFeePerGas; - type DefaultElasticity = DefaultElasticity; - type RuntimeEvent = RuntimeEvent; - type Threshold = BaseFeeThreshold; -} diff --git a/runtime/darwinia/src/pallets/democracy.rs b/runtime/darwinia/src/pallets/democracy.rs index b996f322f..e28b4f392 100644 --- a/runtime/darwinia/src/pallets/democracy.rs +++ b/runtime/darwinia/src/pallets/democracy.rs @@ -45,13 +45,13 @@ impl pallet_democracy::Config for Runtime { type InstantAllowed = ConstBool; type InstantOrigin = RootOrAll; type LaunchPeriod = ConstU32<{ 28 * DAYS }>; + type MaxBlacklisted = ConstU32<100>; + type MaxDeposits = ConstU32<100>; type MaxProposals = ConstU32<100>; type MaxVotes = ConstU32<100>; type MinimumDeposit = ConstU128; - type OperationalPreimageOrigin = pallet_collective::EnsureMember; type PalletsOrigin = OriginCaller; - type PreimageByteDeposit = ConstU128<{ darwinia_deposit(0, 1) }>; - type Proposal = RuntimeCall; + type Preimages = Preimage; type RuntimeEvent = RuntimeEvent; type Scheduler = Scheduler; type Slash = Treasury; diff --git a/runtime/darwinia/src/pallets/evm.rs b/runtime/darwinia/src/pallets/evm.rs index 8132d2706..8578cc1b7 100644 --- a/runtime/darwinia/src/pallets/evm.rs +++ b/runtime/darwinia/src/pallets/evm.rs @@ -146,7 +146,7 @@ where darwinia_precompile_state_storage::EthereumStorageFilter, >>::execute(handle)), a if a == addr(1025) => - Some(>::execute(handle)), + Some(>::execute(handle)), // [1026, 1536) reserved for assets precompiles. a if (1026..1536).contains(&AssetIdConverter::account_to_asset_id(a.into())) => Some(>::execute( diff --git a/runtime/darwinia/src/pallets/mod.rs b/runtime/darwinia/src/pallets/mod.rs index ebfd94629..a82061ac6 100644 --- a/runtime/darwinia/src/pallets/mod.rs +++ b/runtime/darwinia/src/pallets/mod.rs @@ -107,8 +107,6 @@ mod ethereum; mod evm; pub use evm::*; -mod base_fee; - mod message_transact; // S2S stuff. diff --git a/runtime/darwinia/src/pallets/multisig.rs b/runtime/darwinia/src/pallets/multisig.rs index 9f4ad225e..c47262b26 100644 --- a/runtime/darwinia/src/pallets/multisig.rs +++ b/runtime/darwinia/src/pallets/multisig.rs @@ -25,7 +25,7 @@ impl pallet_multisig::Config for Runtime { type DepositBase = ConstU128<{ darwinia_deposit(1, 88) }>; // Additional storage item size of 32 bytes. type DepositFactor = ConstU128<{ darwinia_deposit(0, 32) }>; - type MaxSignatories = ConstU16<100>; + type MaxSignatories = ConstU32<100>; type RuntimeCall = RuntimeCall; type RuntimeEvent = RuntimeEvent; type WeightInfo = (); diff --git a/runtime/darwinia/src/pallets/preimage.rs b/runtime/darwinia/src/pallets/preimage.rs index 4fa3a5843..fc31bb737 100644 --- a/runtime/darwinia/src/pallets/preimage.rs +++ b/runtime/darwinia/src/pallets/preimage.rs @@ -23,8 +23,7 @@ impl pallet_preimage::Config for Runtime { type BaseDeposit = ConstU128<{ 500 * UNIT }>; type ByteDeposit = ConstU128<{ darwinia_deposit(0, 1) }>; type Currency = Balances; - type ManagerOrigin = Root; - type MaxSize = ConstU32<{ 4096 * 1024 }>; + type ManagerOrigin = EnsureRoot; type RuntimeEvent = RuntimeEvent; type WeightInfo = (); } diff --git a/runtime/darwinia/src/pallets/scheduler.rs b/runtime/darwinia/src/pallets/scheduler.rs index ea698235d..2f0197405 100644 --- a/runtime/darwinia/src/pallets/scheduler.rs +++ b/runtime/darwinia/src/pallets/scheduler.rs @@ -52,10 +52,9 @@ frame_support::parameter_types! { impl pallet_scheduler::Config for Runtime { type MaxScheduledPerBlock = ConstU32<50>; type MaximumWeight = MaximumSchedulerWeight; - type NoPreimagePostponement = NoPreimagePostponement; type OriginPrivilegeCmp = OriginPrivilegeCmp; type PalletsOrigin = OriginCaller; - type PreimageProvider = Preimage; + type Preimages = Preimage; type RuntimeCall = RuntimeCall; type RuntimeEvent = RuntimeEvent; type RuntimeOrigin = RuntimeOrigin; diff --git a/runtime/darwinia/src/pallets/system.rs b/runtime/darwinia/src/pallets/system.rs index 990a59ce1..ac01d5c80 100644 --- a/runtime/darwinia/src/pallets/system.rs +++ b/runtime/darwinia/src/pallets/system.rs @@ -28,8 +28,9 @@ const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(5); pub const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75); /// We allow for 0.5 of a second of compute with a 12 second average block time. -pub const MAXIMUM_BLOCK_WEIGHT: Weight = - frame_support::weights::constants::WEIGHT_PER_SECOND.saturating_div(2); +pub const MAXIMUM_BLOCK_WEIGHT: Weight = frame_support::weights::constants::WEIGHT_PER_SECOND + .saturating_div(2) + .set_proof_size(cumulus_primitives_core::relay_chain::v2::MAX_POV_SIZE as u64); frame_support::parameter_types! { pub const Version: sp_version::RuntimeVersion = VERSION; diff --git a/runtime/darwinia/src/pallets/vesting.rs b/runtime/darwinia/src/pallets/vesting.rs index 0ab19e7ff..ca01513ea 100644 --- a/runtime/darwinia/src/pallets/vesting.rs +++ b/runtime/darwinia/src/pallets/vesting.rs @@ -19,11 +19,17 @@ // darwinia use crate::*; +frame_support::parameter_types! { + pub UnvestedFundsAllowedWithdrawReasons: WithdrawReasons = + WithdrawReasons::except(WithdrawReasons::TRANSFER | WithdrawReasons::RESERVE); +} + impl pallet_vesting::Config for Runtime { type BlockNumberToBalance = sp_runtime::traits::ConvertInto; type Currency = Balances; type MinVestedTransfer = ConstU128; type RuntimeEvent = RuntimeEvent; + type UnvestedFundsAllowedWithdrawReasons = UnvestedFundsAllowedWithdrawReasons; type WeightInfo = (); // `VestingInfo` encode length is 36bytes. 28 schedules gets encoded as 1009 bytes, which is the diff --git a/runtime/pangolin/Cargo.toml b/runtime/pangolin/Cargo.toml index aa619b242..c45b67bb9 100644 --- a/runtime/pangolin/Cargo.toml +++ b/runtime/pangolin/Cargo.toml @@ -10,7 +10,7 @@ repository = "https://github.com/darwinia-network/darwinia" version = "6.0.0" [build-dependencies] -substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } [dependencies] # crates.io @@ -21,17 +21,17 @@ static_assertions = { version = "1.1" } array-bytes = { version = "6.0", optional = true } # cumulus -cumulus-pallet-aura-ext = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } -cumulus-pallet-dmp-queue = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } -cumulus-pallet-parachain-system = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } -cumulus-pallet-xcm = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } -cumulus-pallet-xcmp-queue = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } -cumulus-primitives-core = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } -cumulus-primitives-timestamp = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } -cumulus-primitives-utility = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } -parachain-info = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } +cumulus-pallet-aura-ext = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.33" } +cumulus-pallet-dmp-queue = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.33" } +cumulus-pallet-parachain-system = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.33" } +cumulus-pallet-xcm = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.33" } +cumulus-pallet-xcmp-queue = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.33" } +cumulus-primitives-core = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.33" } +cumulus-primitives-timestamp = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.33" } +cumulus-primitives-utility = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.33" } +parachain-info = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.33" } # cumulus optional -cumulus-pallet-session-benchmarking = { optional = true, default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" } +cumulus-pallet-session-benchmarking = { optional = true, default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.33" } # darwinia darwinia-account-migration = { default-features = false, path = "../../pallet/account-migration" } @@ -43,95 +43,94 @@ darwinia-message-transact = { default-features = false, path = "../../pa darwinia-precompile-assets = { default-features = false, path = "../../precompile/assets" } darwinia-precompile-bls12-381 = { default-features = false, path = "../../precompile/bls12-381" } darwinia-precompile-deposit = { default-features = false, path = "../../precompile/deposit" } -darwinia-precompile-dispatch = { default-features = false, path = "../../precompile/dispatch" } darwinia-precompile-staking = { default-features = false, path = "../../precompile/staking" } darwinia-precompile-state-storage = { default-features = false, path = "../../precompile/state-storage" } darwinia-staking = { default-features = false, path = "../../pallet/staking" } dc-primitives = { default-features = false, path = "../../core/primitives" } # darwinia-messages-substrate -bp-message-dispatch = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } -bp-messages = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } -bp-polkadot-core = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } -bp-runtime = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } -bridge-runtime-common = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } -pallet-bridge-dispatch = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } -pallet-bridge-grandpa = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } -pallet-bridge-messages = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } -pallet-fee-market = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.30" } +bp-message-dispatch = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.33" } +bp-messages = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.33" } +bp-polkadot-core = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.33" } +bp-runtime = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.33" } +bridge-runtime-common = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.33" } +pallet-bridge-dispatch = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.33" } +pallet-bridge-grandpa = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.33" } +pallet-bridge-messages = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.33" } +pallet-fee-market = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.33" } # frontier -fp-rpc = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } -fp-self-contained = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } -pallet-base-fee = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } -pallet-ethereum = { default-features = false, features = ["forbid-evm-reentrancy"], git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } -pallet-evm = { default-features = false, features = ["forbid-evm-reentrancy"], git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } -pallet-evm-precompile-blake2 = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } -pallet-evm-precompile-bn128 = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } -pallet-evm-precompile-modexp = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } -pallet-evm-precompile-simple = { default-features = false, git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.30" } +fp-rpc = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } +fp-self-contained = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } +pallet-ethereum = { default-features = false, features = ["forbid-evm-reentrancy"], git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } +pallet-evm = { default-features = false, features = ["forbid-evm-reentrancy"], git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } +pallet-evm-precompile-blake2 = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } +pallet-evm-precompile-bn128 = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } +pallet-evm-precompile-dispatch = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } +pallet-evm-precompile-modexp = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } +pallet-evm-precompile-simple = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } # moonbeam -precompile-utils = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.30" } -xcm-primitives = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.30" } +precompile-utils = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.33" } +xcm-primitives = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.33" } # polkadot -pallet-xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" } -polkadot-parachain = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" } -polkadot-runtime-common = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" } -xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" } -xcm-builder = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" } -xcm-executor = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" } +pallet-xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.33" } +polkadot-parachain = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.33" } +polkadot-runtime-common = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.33" } +xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.33" } +xcm-builder = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.33" } +xcm-executor = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.33" } # substrate -frame-executive = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -frame-system-rpc-runtime-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-assets = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-aura = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-authorship = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-balances = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-collective = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-democracy = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-elections-phragmen = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-identity = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-membership = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-multisig = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-preimage = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-proxy = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-scheduler = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-session = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-sudo = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-timestamp = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-tips = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-transaction-payment = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-transaction-payment-rpc-runtime-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-treasury = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-utility = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-vesting = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-block-builder = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-consensus-aura = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-inherents = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-io = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-offchain = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-session = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-transaction-pool = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-version = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +frame-executive = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +frame-system-rpc-runtime-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-assets = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-aura = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-authorship = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-balances = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-collective = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-democracy = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-elections-phragmen = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-identity = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-membership = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-multisig = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-preimage = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-proxy = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-scheduler = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-session = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-sudo = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-timestamp = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-tips = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-transaction-payment = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-transaction-payment-rpc-runtime-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-treasury = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-utility = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-vesting = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-block-builder = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-consensus-aura = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-inherents = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-io = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-offchain = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-session = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-transaction-pool = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-version = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } # substrate optional -frame-benchmarking = { optional = true, default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -frame-system-benchmarking = { optional = true, default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -frame-try-runtime = { optional = true, default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +frame-benchmarking = { optional = true, default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +frame-system-benchmarking = { optional = true, default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +frame-try-runtime = { optional = true, default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } [dev-dependencies] # darwinia darwinia-common-runtime = { features = ["test"], path = "../common" } # substrate -sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } [features] default = ["std"] @@ -163,7 +162,6 @@ std = [ "darwinia-precompile-assets/std", "darwinia-precompile-bls12-381/std", "darwinia-precompile-deposit/std", - "darwinia-precompile-dispatch/std", "darwinia-precompile-staking/std", "darwinia-precompile-state-storage/std", "darwinia-staking/std", @@ -183,11 +181,11 @@ std = [ # frontier "fp-rpc/std", "fp-self-contained/std", - "pallet-base-fee/std", "pallet-ethereum/std", "pallet-evm/std", "pallet-evm-precompile-blake2/std", "pallet-evm-precompile-bn128/std", + "pallet-evm-precompile-dispatch/std", "pallet-evm-precompile-modexp/std", "pallet-evm-precompile-simple/std", @@ -316,7 +314,6 @@ try-runtime = [ "parachain-info/try-runtime", # frontier - "pallet-base-fee/try-runtime", "pallet-ethereum/try-runtime", "pallet-evm/try-runtime", @@ -350,5 +347,5 @@ try-runtime = [ "pallet-utility/try-runtime", "pallet-vesting/try-runtime", # substrate optional - "frame-try-runtime", + "frame-try-runtime/try-runtime", ] diff --git a/runtime/pangolin/src/lib.rs b/runtime/pangolin/src/lib.rs index 0ffadeb46..fce6f7df8 100644 --- a/runtime/pangolin/src/lib.rs +++ b/runtime/pangolin/src/lib.rs @@ -40,10 +40,10 @@ use xcm_executor::XcmExecutor; // substrate use frame_support::{ dispatch::DispatchClass, - traits::{Imbalance, OnUnbalanced}, + traits::{AsEnsureOriginWithArg, Imbalance, IsInVec, OnUnbalanced, WithdrawReasons}, weights::{ConstantMultiplier, Weight}, }; -use frame_system::EnsureRoot; +use frame_system::{EnsureRoot, EnsureSignedBy}; use sp_core::{crypto::KeyTypeId, OpaqueMetadata, H160, H256, U256}; use sp_runtime::{ generic, @@ -268,7 +268,6 @@ frame_support::construct_runtime! { // EVM stuff. Ethereum: pallet_ethereum = 31, Evm: pallet_evm = 32, - BaseFee: pallet_base_fee = 33, MessageTransact: darwinia_message_transact = 39, } } @@ -567,7 +566,10 @@ sp_api::impl_runtime_apis! { } fn elasticity() -> Option { - Some(BaseFee::elasticity()) + None + } + + fn gas_limit_multiplier_support() { } } diff --git a/runtime/pangolin/src/pallets/assets.rs b/runtime/pangolin/src/pallets/assets.rs index 1102b75dd..d1a5335fe 100644 --- a/runtime/pangolin/src/pallets/assets.rs +++ b/runtime/pangolin/src/pallets/assets.rs @@ -24,16 +24,19 @@ pub enum AssetIds { PKton = 1026, } +frame_support::parameter_types! { + pub Creators: Vec = vec![ROOT]; +} + impl pallet_assets::Config for Runtime { type ApprovalDeposit = ConstU128<0>; type AssetAccountDeposit = ConstU128<0>; type AssetDeposit = ConstU128<0>; type AssetId = AssetId; type Balance = Balance; + type CreateOrigin = AsEnsureOriginWithArg, AccountId>>; type Currency = Balances; type Extra = (); - // TODO: Restrict the create asset origin. https://github.com/paritytech/substrate/pull/12586 - // type CreateOrigin = EnsureRoot; type ForceOrigin = EnsureRoot; type Freezer = (); type MetadataDepositBase = ConstU128<0>; diff --git a/runtime/pangolin/src/pallets/base_fee.rs b/runtime/pangolin/src/pallets/base_fee.rs deleted file mode 100644 index d1da68d2c..000000000 --- a/runtime/pangolin/src/pallets/base_fee.rs +++ /dev/null @@ -1,47 +0,0 @@ -// This file is part of Darwinia. -// -// Copyright (C) 2018-2023 Darwinia Network -// SPDX-License-Identifier: GPL-3.0 -// -// Darwinia is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// Darwinia 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 Darwinia. If not, see . - -// darwinia -use crate::*; - -frame_support::parameter_types! { - pub DefaultBaseFeePerGas: U256 = U256::from(1_000_000_000); - pub DefaultElasticity: Permill = Permill::from_parts(125_000); -} - -pub struct BaseFeeThreshold; -impl pallet_base_fee::BaseFeeThreshold for BaseFeeThreshold { - fn lower() -> Permill { - Permill::zero() - } - - fn ideal() -> Permill { - Permill::from_parts(500_000) - } - - fn upper() -> Permill { - Permill::from_parts(1_000_000) - } -} - -impl pallet_base_fee::Config for Runtime { - type DefaultBaseFeePerGas = DefaultBaseFeePerGas; - type DefaultElasticity = DefaultElasticity; - type RuntimeEvent = RuntimeEvent; - type Threshold = BaseFeeThreshold; -} diff --git a/runtime/pangolin/src/pallets/democracy.rs b/runtime/pangolin/src/pallets/democracy.rs index b996f322f..e28b4f392 100644 --- a/runtime/pangolin/src/pallets/democracy.rs +++ b/runtime/pangolin/src/pallets/democracy.rs @@ -45,13 +45,13 @@ impl pallet_democracy::Config for Runtime { type InstantAllowed = ConstBool; type InstantOrigin = RootOrAll; type LaunchPeriod = ConstU32<{ 28 * DAYS }>; + type MaxBlacklisted = ConstU32<100>; + type MaxDeposits = ConstU32<100>; type MaxProposals = ConstU32<100>; type MaxVotes = ConstU32<100>; type MinimumDeposit = ConstU128; - type OperationalPreimageOrigin = pallet_collective::EnsureMember; type PalletsOrigin = OriginCaller; - type PreimageByteDeposit = ConstU128<{ darwinia_deposit(0, 1) }>; - type Proposal = RuntimeCall; + type Preimages = Preimage; type RuntimeEvent = RuntimeEvent; type Scheduler = Scheduler; type Slash = Treasury; diff --git a/runtime/pangolin/src/pallets/evm.rs b/runtime/pangolin/src/pallets/evm.rs index 597d6bb6b..0174f96c2 100644 --- a/runtime/pangolin/src/pallets/evm.rs +++ b/runtime/pangolin/src/pallets/evm.rs @@ -146,7 +146,7 @@ where darwinia_precompile_state_storage::EthereumStorageFilter, >>::execute(handle)), a if a == addr(1025) => - Some(>::execute(handle)), + Some(>::execute(handle)), // [1026, 1536) reserved for assets precompiles. a if (1026..1536).contains(&AssetIdConverter::account_to_asset_id(a.into())) => Some(>::execute( diff --git a/runtime/pangolin/src/pallets/mod.rs b/runtime/pangolin/src/pallets/mod.rs index ce3faff96..c07ec8c74 100644 --- a/runtime/pangolin/src/pallets/mod.rs +++ b/runtime/pangolin/src/pallets/mod.rs @@ -108,6 +108,4 @@ mod ethereum; mod evm; pub use evm::*; -mod base_fee; - mod message_transact; diff --git a/runtime/pangolin/src/pallets/multisig.rs b/runtime/pangolin/src/pallets/multisig.rs index 9f4ad225e..c47262b26 100644 --- a/runtime/pangolin/src/pallets/multisig.rs +++ b/runtime/pangolin/src/pallets/multisig.rs @@ -25,7 +25,7 @@ impl pallet_multisig::Config for Runtime { type DepositBase = ConstU128<{ darwinia_deposit(1, 88) }>; // Additional storage item size of 32 bytes. type DepositFactor = ConstU128<{ darwinia_deposit(0, 32) }>; - type MaxSignatories = ConstU16<100>; + type MaxSignatories = ConstU32<100>; type RuntimeCall = RuntimeCall; type RuntimeEvent = RuntimeEvent; type WeightInfo = (); diff --git a/runtime/pangolin/src/pallets/preimage.rs b/runtime/pangolin/src/pallets/preimage.rs index 4fa3a5843..fc31bb737 100644 --- a/runtime/pangolin/src/pallets/preimage.rs +++ b/runtime/pangolin/src/pallets/preimage.rs @@ -23,8 +23,7 @@ impl pallet_preimage::Config for Runtime { type BaseDeposit = ConstU128<{ 500 * UNIT }>; type ByteDeposit = ConstU128<{ darwinia_deposit(0, 1) }>; type Currency = Balances; - type ManagerOrigin = Root; - type MaxSize = ConstU32<{ 4096 * 1024 }>; + type ManagerOrigin = EnsureRoot; type RuntimeEvent = RuntimeEvent; type WeightInfo = (); } diff --git a/runtime/pangolin/src/pallets/scheduler.rs b/runtime/pangolin/src/pallets/scheduler.rs index ea698235d..2f0197405 100644 --- a/runtime/pangolin/src/pallets/scheduler.rs +++ b/runtime/pangolin/src/pallets/scheduler.rs @@ -52,10 +52,9 @@ frame_support::parameter_types! { impl pallet_scheduler::Config for Runtime { type MaxScheduledPerBlock = ConstU32<50>; type MaximumWeight = MaximumSchedulerWeight; - type NoPreimagePostponement = NoPreimagePostponement; type OriginPrivilegeCmp = OriginPrivilegeCmp; type PalletsOrigin = OriginCaller; - type PreimageProvider = Preimage; + type Preimages = Preimage; type RuntimeCall = RuntimeCall; type RuntimeEvent = RuntimeEvent; type RuntimeOrigin = RuntimeOrigin; diff --git a/runtime/pangolin/src/pallets/system.rs b/runtime/pangolin/src/pallets/system.rs index 990a59ce1..ac01d5c80 100644 --- a/runtime/pangolin/src/pallets/system.rs +++ b/runtime/pangolin/src/pallets/system.rs @@ -28,8 +28,9 @@ const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(5); pub const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75); /// We allow for 0.5 of a second of compute with a 12 second average block time. -pub const MAXIMUM_BLOCK_WEIGHT: Weight = - frame_support::weights::constants::WEIGHT_PER_SECOND.saturating_div(2); +pub const MAXIMUM_BLOCK_WEIGHT: Weight = frame_support::weights::constants::WEIGHT_PER_SECOND + .saturating_div(2) + .set_proof_size(cumulus_primitives_core::relay_chain::v2::MAX_POV_SIZE as u64); frame_support::parameter_types! { pub const Version: sp_version::RuntimeVersion = VERSION; diff --git a/runtime/pangolin/src/pallets/vesting.rs b/runtime/pangolin/src/pallets/vesting.rs index 0ab19e7ff..ca01513ea 100644 --- a/runtime/pangolin/src/pallets/vesting.rs +++ b/runtime/pangolin/src/pallets/vesting.rs @@ -19,11 +19,17 @@ // darwinia use crate::*; +frame_support::parameter_types! { + pub UnvestedFundsAllowedWithdrawReasons: WithdrawReasons = + WithdrawReasons::except(WithdrawReasons::TRANSFER | WithdrawReasons::RESERVE); +} + impl pallet_vesting::Config for Runtime { type BlockNumberToBalance = sp_runtime::traits::ConvertInto; type Currency = Balances; type MinVestedTransfer = ConstU128; type RuntimeEvent = RuntimeEvent; + type UnvestedFundsAllowedWithdrawReasons = UnvestedFundsAllowedWithdrawReasons; type WeightInfo = (); // `VestingInfo` encode length is 36bytes. 28 schedules gets encoded as 1009 bytes, which is the From ed7da51d0133a662d2a0188e14dc6c4e467fcf85 Mon Sep 17 00:00:00 2001 From: bear Date: Mon, 16 Jan 2023 12:29:41 +0800 Subject: [PATCH 102/189] pallet-identity state process (#124) * Add types folder * Read storage out * Decimal update * Add remove subsOf and superOf * Remove useless file * Add README * Process in runtime side * Format * Add SUDO back * Fix doc link * Identity migrate * Fix runtime * Add tests * Add tests * Code clean * Remove sp-runtime * Code format * Delete useless reserve * Reset the judgements * Self review * Fix * Add identities runtime tests * Fix tests * Just format * Tiny updates * Update doc Co-authored-by: Xavier Lau --- Cargo.lock | 1 + pallet/account-migration/Cargo.toml | 2 + pallet/account-migration/src/lib.rs | 48 +++++- runtime/common/src/test.rs | 63 ++++++++ tool/state-processor/Cargo.lock | 27 +++- tool/state-processor/Cargo.toml | 3 +- tool/state-processor/src/adjust.rs | 14 ++ tool/state-processor/src/identity/README.md | 6 + tool/state-processor/src/identity/mod.rs | 49 ++++++ tool/state-processor/src/main.rs | 1 + tool/state-processor/src/processor.rs | 1 + tool/state-processor/src/tests.rs | 124 ++++++++++++++- tool/state-processor/src/type_registry.rs | 162 +++++++++++++++++++- tool/state-processor/src/util.rs | 5 + 14 files changed, 492 insertions(+), 14 deletions(-) create mode 100644 tool/state-processor/src/identity/README.md create mode 100644 tool/state-processor/src/identity/mod.rs diff --git a/Cargo.lock b/Cargo.lock index 174ba26f3..1c0162090 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2289,6 +2289,7 @@ dependencies = [ "frame-system", "pallet-assets", "pallet-balances", + "pallet-identity", "pallet-vesting", "parity-scale-codec", "scale-info", diff --git a/pallet/account-migration/Cargo.toml b/pallet/account-migration/Cargo.toml index 3434e6be6..5afad954b 100644 --- a/pallet/account-migration/Cargo.toml +++ b/pallet/account-migration/Cargo.toml @@ -24,6 +24,7 @@ frame-support = { default-features = false, git = "https://github.com/parityte frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } pallet-assets = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } pallet-balances = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-identity = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } pallet-vesting = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } @@ -49,6 +50,7 @@ std = [ "frame-system/std", "pallet-assets/std", "pallet-balances/std", + "pallet-identity/std", "pallet-vesting/std", "sp-core/std", "sp-runtime/std", diff --git a/pallet/account-migration/src/lib.rs b/pallet/account-migration/src/lib.rs index 95bf67bb1..dd1318227 100644 --- a/pallet/account-migration/src/lib.rs +++ b/pallet/account-migration/src/lib.rs @@ -53,12 +53,14 @@ use dc_primitives::{AccountId as AccountId20, AssetId, Balance, BlockNumber, Ind // substrate use frame_support::{ log, migration, + migration::put_storage_value, pallet_prelude::*, traits::{Currency, ExistenceRequirement::KeepAlive, LockableCurrency, WithdrawReasons}, StorageHasher, }; use frame_system::{pallet_prelude::*, AccountInfo, RawOrigin}; use pallet_balances::AccountData; +use pallet_identity::{RegistrarInfo, Registration}; use pallet_vesting::VestingInfo; use sp_core::sr25519::{Public, Signature}; use sp_runtime::{ @@ -87,6 +89,7 @@ pub mod pallet { > + pallet_assets::Config + pallet_balances::Config + pallet_vesting::Config> + + pallet_identity::Config> + darwinia_deposit::Config + darwinia_staking::Config { @@ -146,7 +149,26 @@ pub mod pallet { #[pallet::getter(fn ledger_of)] pub type Ledgers = StorageMap<_, Blake2_128Concat, AccountId32, Ledger>; - // TODO: identity storages + /// [`pallet_identity::IdentityOf`] data. + /// + /// + #[pallet::storage] + #[pallet::getter(fn identity_of)] + pub type IdentityOf = StorageMap< + _, + Twox64Concat, + AccountId32, + Registration, ConstU32<100>>, + >; + + /// [`pallet_identity::Registrars`] data. + /// + /// + #[pallet::storage] + #[pallet::unbounded] + #[pallet::getter(fn registrars)] + pub type Registrars = + StorageValue<_, Vec>>, ValueQuery>; #[pallet::call] impl Pallet { @@ -228,6 +250,30 @@ pub mod pallet { >::insert(to, l); } + if let Some(identity) = IdentityOf::::take(from.clone()) { + put_storage_value( + b"Identity", + b"IdentityOf", + &Twox64Concat::hash(&to.encode()), + identity, + ); + } + let mut chain_rs = >::registrars().into_inner(); + for (i, rs) in Self::registrars().iter().enumerate() { + if let Some(rs) = rs { + if rs.account == from { + chain_rs.push(Some(RegistrarInfo { + account: to, + fee: rs.fee, + fields: rs.fields, + })); + + Registrars::::mutate(|rs| rs.remove(i)); + } + } + } + put_storage_value(b"Identity", b"Registrars", &[], chain_rs); + Self::deposit_event(Event::Migrated { from, to }); Ok(()) diff --git a/runtime/common/src/test.rs b/runtime/common/src/test.rs index 4c16c241a..f28e8a9c4 100644 --- a/runtime/common/src/test.rs +++ b/runtime/common/src/test.rs @@ -13,6 +13,9 @@ macro_rules! impl_account_migration_tests { use frame_system::AccountInfo; use pallet_assets::ExistenceReason; use pallet_balances::AccountData; + use pallet_identity::{ + Data, IdentityFields, IdentityInfo, RegistrarInfo, Registration, + }; use sp_core::{sr25519::Pair, Encode, Pair as PairT, H160}; use sp_keyring::sr25519::Keyring; use sp_runtime::{ @@ -302,6 +305,66 @@ macro_rules! impl_account_migration_tests { assert_eq!(Staking::ledger_of(to).unwrap().staked_kton, 20); }); } + + #[test] + fn identities_should_work() { + let (from, from_pk) = alice(); + let to = H160::from_low_u64_be(255).into(); + + ExtBuilder::default().build().execute_with(|| { + preset_state_of(&from); + + let info = IdentityInfo { + additional: Default::default(), + display: Data::Sha256([1u8; 32]), + legal: Data::None, + web: Data::None, + riot: Data::None, + email: Data::None, + pgp_fingerprint: None, + image: Data::None, + twitter: Data::None, + }; + >::insert( + from_pk, + Registration { + judgements: Default::default(), + deposit: RING_AMOUNT, + info: info.clone(), + }, + ); + + assert_ok!(migrate(from, to,)); + assert_eq!(Identity::identity(to).unwrap().info, info); + assert_eq!(Identity::identity(to).unwrap().deposit, RING_AMOUNT); + assert_eq!(Identity::identity(to).unwrap().judgements.len(), 0); + }); + } + + #[test] + fn registrars_should_work() { + let (from, from_pk) = alice(); + let to = H160::from_low_u64_be(255).into(); + + ExtBuilder::default().build().execute_with(|| { + preset_state_of(&from); + + let info = RegistrarInfo { + account: from_pk, + fee: RING_AMOUNT, + fields: IdentityFields::default(), + }; + >::put(vec![ + Some(info.clone()), + None, + ]); + + assert_ok!(migrate(from, to,)); + assert!(!AccountMigration::registrars().contains(&Some(info.clone()))); + assert_eq!(Identity::registrars()[0].clone().unwrap().account, to); + assert_eq!(Identity::registrars()[0].clone().unwrap().fee, info.fee); + }); + } } }; } diff --git a/tool/state-processor/Cargo.lock b/tool/state-processor/Cargo.lock index 3b052ae95..18d7578f1 100644 --- a/tool/state-processor/Cargo.lock +++ b/tool/state-processor/Cargo.lock @@ -181,6 +181,26 @@ dependencies = [ "crypto-common", ] +[[package]] +name = "enumflags2" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e75d4cd21b95383444831539909fbb14b9dc3fdceb2a6f5d36577329a1f55ccb" +dependencies = [ + "enumflags2_derive", +] + +[[package]] +name = "enumflags2_derive" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f58dc3c5e468259f19f2d46304a6b28f1c3d034442e14b322d2b850e36f6d5ae" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "env_logger" version = "0.7.1" @@ -652,6 +672,7 @@ version = "0.0.0" dependencies = [ "anyhow", "array-bytes", + "enumflags2", "fxhash", "log", "once_cell", @@ -677,7 +698,7 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] name = "subhasher" version = "0.9.0-rc20" -source = "git+https://github.com/hack-ink/subalfred#f1a80ef1a41111d2cd85dc08db1726d1f6c98bab" +source = "git+https://github.com/hack-ink/subalfred#10f4207c4154eef9c489d97bdfc1cb960150bc87" dependencies = [ "blake2-rfc", "byteorder", @@ -689,7 +710,7 @@ dependencies = [ [[package]] name = "subspector" version = "0.9.0-rc20" -source = "git+https://github.com/hack-ink/subalfred#f1a80ef1a41111d2cd85dc08db1726d1f6c98bab" +source = "git+https://github.com/hack-ink/subalfred#10f4207c4154eef9c489d97bdfc1cb960150bc87" dependencies = [ "fxhash", "serde", @@ -699,7 +720,7 @@ dependencies = [ [[package]] name = "substorager" version = "0.9.0-rc20" -source = "git+https://github.com/hack-ink/subalfred#f1a80ef1a41111d2cd85dc08db1726d1f6c98bab" +source = "git+https://github.com/hack-ink/subalfred#10f4207c4154eef9c489d97bdfc1cb960150bc87" dependencies = [ "array-bytes", "subhasher", diff --git a/tool/state-processor/Cargo.toml b/tool/state-processor/Cargo.toml index 09c0b5b9c..ed1e7f264 100644 --- a/tool/state-processor/Cargo.toml +++ b/tool/state-processor/Cargo.toml @@ -8,12 +8,13 @@ version = "0.0.0" # crates.io anyhow = { version = "1.0" } array-bytes = { version = "6.0" } +enumflags2 = { version = "0.7" } fxhash = { version = "0.2" } log = { version = "0.4" } once_cell = { version = "1.16" } parity-scale-codec = { version = "3.2", features = ["derive"] } pretty_env_logger = { version = "0.4" } -primitive-types = { version = "0.12.1", features = ["codec"] } +primitive-types = { version = "0.12", features = ["codec"] } serde = { version = "1.0" } serde_json = { version = "1.0" } tar = { version = "0.4" } diff --git a/tool/state-processor/src/adjust.rs b/tool/state-processor/src/adjust.rs index 5b3c8d724..99d00b844 100644 --- a/tool/state-processor/src/adjust.rs +++ b/tool/state-processor/src/adjust.rs @@ -69,3 +69,17 @@ impl Adjust for Unbonding { self.until.adjust(); } } + +impl Adjust for Registration { + fn adjust(&mut self) { + // Reset the judgements + self.judgements.clear(); + self.deposit.adjust(); + } +} + +impl Adjust for RegistrarInfo { + fn adjust(&mut self) { + self.fee.adjust(); + } +} diff --git a/tool/state-processor/src/identity/README.md b/tool/state-processor/src/identity/README.md new file mode 100644 index 000000000..b4c261656 --- /dev/null +++ b/tool/state-processor/src/identity/README.md @@ -0,0 +1,6 @@ +### Process steps +1. take `Identity::IdentityOf`, `Identity::Registrars`, `Identity::SuperOf` and `Identity::SuperOf`. +2. update identities's deposit decimal and reset judgements. +3. update registrars fee decimal. +4. update super_id's reserved balance. +5. set `AccountMigration::IdentityOf` and`AccountMigration::Registrars`. diff --git a/tool/state-processor/src/identity/mod.rs b/tool/state-processor/src/identity/mod.rs new file mode 100644 index 000000000..fe39087e3 --- /dev/null +++ b/tool/state-processor/src/identity/mod.rs @@ -0,0 +1,49 @@ +// darwinia +use crate::*; + +impl Processor { + /// Only care about the solo chain, since parachains don't have identity now. + pub fn process_identity(&mut self) -> &mut Self { + let mut identities = >::default(); + let mut registrars = Vec::>::default(); + let mut subs_of = Map::<(u128, Vec<[u8; 32]>)>::default(); + + log::info!("take `Identity::IdentityOf`, `Identity::Registrars`, `Identity::SuperOf` and `Identity::SuperOf`"); + self.solo_state + .take_map(b"Identity", b"IdentityOf", &mut identities, get_hashed_key) + .take_value(b"Identity", b"Registrars", "", &mut registrars) + .take_map(b"Identity", b"SubsOf", &mut subs_of, get_last_64_key); + + log::info!("update identities's deposit and judgement decimal"); + identities.iter_mut().for_each(|(_k, v)| { + v.adjust(); + }); + + log::info!("update registrars fee decimal"); + registrars.iter_mut().for_each(|o| { + if let Some(r) = o { + r.adjust() + } + }); + + log::info!("update super_id's reserved balance"); + subs_of.into_iter().for_each(|(super_id, (mut subs_deposit, _))| { + subs_deposit.adjust(); + + self.shell_state + .unreserve(array_bytes::hex2array_unchecked::<_, 32>(super_id), subs_deposit); + }); + + log::info!("set `AccountMigration::IdentityOf`"); + { + let ik = item_key(b"AccountMigration", b"IdentityOf"); + + self.shell_state.insert_map(identities, |h| format!("{ik}{h}")); + } + + log::info!("set `AccountMigration::Registrars`"); + self.shell_state.insert_value(b"AccountMigration", b"Registrars", "", registrars); + + self + } +} diff --git a/tool/state-processor/src/main.rs b/tool/state-processor/src/main.rs index 79a52845e..f8bff8f9e 100644 --- a/tool/state-processor/src/main.rs +++ b/tool/state-processor/src/main.rs @@ -15,6 +15,7 @@ use type_registry::*; // Runtime pallets. mod balances; mod evm; +mod identity; mod indices; mod proxy; mod staking; diff --git a/tool/state-processor/src/processor.rs b/tool/state-processor/src/processor.rs index 9a2bc782d..587e3225f 100644 --- a/tool/state-processor/src/processor.rs +++ b/tool/state-processor/src/processor.rs @@ -72,6 +72,7 @@ where self.process_system() .process_indices() + .process_identity() .process_vesting() .process_proxy() .process_staking() diff --git a/tool/state-processor/src/tests.rs b/tool/state-processor/src/tests.rs index 92bd01f76..2471ee61b 100644 --- a/tool/state-processor/src/tests.rs +++ b/tool/state-processor/src/tests.rs @@ -24,8 +24,11 @@ struct Tester { shell_state: State<()>, } -fn get_last_64(key: &str, _: &str) -> String { - format!("0x{}", &key[key.len() - 64..]) +pub fn two_x64_concat_to_string(data: D) -> String +where + D: AsRef<[u8]>, +{ + array_bytes::bytes2hex("", subhasher::twox64_concat(data)) } fn get_last_40(key: &str, _: &str) -> String { @@ -46,14 +49,24 @@ impl Tester { let mut solo_remaining_kton = >::default(); let mut solo_evm_codes = >>::default(); solo_state - .take_map(b"System", b"Account", &mut solo_accounts, get_last_64) - .take_map(b"Ethereum", b"RemainingRingBalance", &mut solo_remaining_ring, get_last_64) - .take_map(b"Ethereum", b"RemainingKtonBalance", &mut solo_remaining_kton, get_last_64) + .take_map(b"System", b"Account", &mut solo_accounts, get_last_64_key) + .take_map( + b"Ethereum", + b"RemainingRingBalance", + &mut solo_remaining_ring, + get_last_64_key, + ) + .take_map( + b"Ethereum", + b"RemainingKtonBalance", + &mut solo_remaining_kton, + get_last_64_key, + ) .take_map(b"EVM", b"AccountCodes", &mut solo_evm_codes, get_last_40); // para chain let mut para_accounts = >::default(); - para_state.take_map(b"System", b"Account", &mut para_accounts, get_last_64); + para_state.take_map(b"System", b"Account", &mut para_accounts, get_last_64_key); // processed let mut shell_system_accounts = >::default(); @@ -66,9 +79,9 @@ impl Tester { b"AccountMigration", b"KtonAccounts", &mut migration_kton_accounts, - get_last_64, + get_last_64_key, ) - .take_map(b"AccountMigration", b"Accounts", &mut migration_accounts, get_last_64) + .take_map(b"AccountMigration", b"Accounts", &mut migration_accounts, get_last_64_key) .take_map(b"Evm", b"AccountCodes", &mut shell_evm_codes, get_last_40); Self { @@ -683,3 +696,98 @@ fn proxy_reserved_adjust() { assert_eq!(migrated_account.data.reserved, 0); }); } + +// --- Identity --- + +#[test] +fn identities_adjust() { + run_test(|tester| { + // https://crab.subscan.io/account/5CcRAW3d6vi4Vq2BX9EeynS1rj7bqoZ5EPwPiLiJ422FsEbC + let test_addr: [u8; 32] = hex_n_into_unchecked::<_, _, 32>( + "0x182fa92d7f04c79c541d5f117223fcb9f83f2e830c3c187f2622176ed68c3c1a", + ); + + let mut registration = Registration::default(); + tester.solo_state.get_value( + b"Identity", + b"IdentityOf", + &two_x64_concat_to_string(test_addr.encode()), + &mut registration, + ); + assert_ne!(registration.deposit, 0); + assert_eq!(registration.info.display, Data::Raw(b"COLD STORAGE CAPITAL".to_vec())); + assert_eq!(registration.info.email, Data::Raw(b"rbarraza@coldstoragecapital.com".to_vec())); + assert_eq!(registration.info.twitter, Data::Raw(b"@coldstoragecap".to_vec())); + + // after migrated + let mut migrated_registration = Registration::default(); + tester.shell_state.get_value( + b"AccountMigration", + b"IdentityOf", + &two_x64_concat_to_string(test_addr.encode()), + &mut migrated_registration, + ); + assert_eq!(migrated_registration.deposit, registration.deposit * GWEI); + assert_eq!(migrated_registration.judgements.len(), 0); + assert_eq!(migrated_registration.info.display, registration.info.display); + assert_eq!(migrated_registration.info.email, registration.info.email); + assert_eq!(migrated_registration.info.twitter, registration.info.twitter); + }); +} + +#[test] +fn registrars_adust() { + run_test(|tester| { + let mut registrars: Vec> = Vec::new(); + tester.solo_state.get_value(b"Identity", b"Registrars", "", &mut registrars); + assert!(registrars.len() > 0); + + // after migrated + let mut migrated_registrars: Vec> = Vec::new(); + tester.solo_state.get_value( + b"AccountMigration", + b"Registrars", + "", + &mut migrated_registrars, + ); + + registrars.iter().zip(migrated_registrars.iter()).for_each(|(a, b)| match (a, b) { + (Some(a), Some(b)) => { + assert_eq!(a.account, b.account); + assert_eq!(a.fee * GWEI, b.fee); + assert_eq!(a.fields, b.fields); + }, + (None, None) => {}, + _ => panic!("this should never happen!"), + }); + }); +} + +#[test] +fn super_of_adjust() { + run_test(|tester| { + // https://crab.subscan.io/account/5HizvHpWBowXaH3VmVsVXF7V1YkdbX7LWpbb9ToevnvxdHpg + let addr = "0xfa61ee117cf487dc39620fac6c3e855111f68435827a1c6468a45b8ab73b7a93"; + let account_id: [u8; 32] = hex_n_into_unchecked::<_, _, 32>(addr); + + let mut subs_of = (0u128, Vec::<[u8; 32]>::default()); + tester.solo_state.get_value( + b"Identity", + b"SubsOf", + &two_x64_concat_to_string(account_id.encode()), + &mut subs_of, + ); + assert_ne!(subs_of.0, 0); + assert_ne!(subs_of.1.len(), 0); + + let solo_account = tester.solo_accounts.get(addr).unwrap(); + assert_ne!(solo_account.data.reserved, 0); + + // after migrated + let migrated_account = tester.migration_accounts.get(addr).unwrap(); + assert_eq!( + solo_account.data.reserved * GWEI - migrated_account.data.reserved, + subs_of.0 * GWEI + ); + }); +} diff --git a/tool/state-processor/src/type_registry.rs b/tool/state-processor/src/type_registry.rs index d2c2d459b..e18cdf411 100644 --- a/tool/state-processor/src/type_registry.rs +++ b/tool/state-processor/src/type_registry.rs @@ -1,5 +1,8 @@ +// std +use std::iter::once; // crates.io -use parity_scale_codec::{Decode, Encode}; +use enumflags2::{bitflags, BitFlags}; +use parity_scale_codec::{Decode, Encode, EncodeLike, Error, Input}; #[derive(Default, Debug, PartialEq, Eq, Encode, Decode)] pub struct AccountInfo { @@ -156,3 +159,160 @@ pub struct Ledger { pub unstaking_kton: Vec<(u128, u32)>, pub unstaking_deposits: Vec<(u16, u32)>, } + +#[derive(Default, Debug, Encode)] +pub struct Registration { + pub judgements: Vec<(u32, Judgement)>, + pub deposit: u128, + pub info: IdentityInfo, +} +impl Decode for Registration { + fn decode(input: &mut I) -> Result { + let (judgements, deposit, info) = Decode::decode(&mut AppendZerosInput::new(input))?; + Ok(Self { judgements, deposit, info }) + } +} +#[derive(Debug, Encode, Decode)] +pub enum Judgement { + Unknown, + FeePaid(u128), + Reasonable, + KnownGood, + OutOfDate, + LowQuality, + Erroneous, +} +#[derive(Default, Debug, Encode, Decode)] +pub struct IdentityInfo { + pub additional: Vec<(Data, Data)>, + pub display: Data, + pub legal: Data, + pub web: Data, + pub riot: Data, + pub email: Data, + pub pgp_fingerprint: Option<[u8; 20]>, + pub image: Data, + pub twitter: Data, +} +#[derive(Debug, PartialEq, Eq)] +pub enum Data { + None, + Raw(Vec), + BlakeTwo256([u8; 32]), + Sha256([u8; 32]), + Keccak256([u8; 32]), + ShaThree256([u8; 32]), +} +impl Default for Data { + fn default() -> Self { + Data::None + } +} +impl Encode for Data { + fn encode(&self) -> Vec { + match self { + Data::None => vec![0u8; 1], + Data::Raw(ref x) => { + let l = x.len().min(32); + let mut r = vec![l as u8 + 1; l + 1]; + r[1..].copy_from_slice(&x[..l as usize]); + r + }, + Data::BlakeTwo256(ref h) => once(34u8).chain(h.iter().cloned()).collect(), + Data::Sha256(ref h) => once(35u8).chain(h.iter().cloned()).collect(), + Data::Keccak256(ref h) => once(36u8).chain(h.iter().cloned()).collect(), + Data::ShaThree256(ref h) => once(37u8).chain(h.iter().cloned()).collect(), + } + } +} +impl Decode for Data { + fn decode(input: &mut I) -> Result { + let b = input.read_byte()?; + Ok(match b { + 0 => Data::None, + n @ 1..=33 => { + let mut r = vec![0u8; n as usize - 1]; + input.read(&mut r[..])?; + Data::Raw(r) + }, + 34 => Data::BlakeTwo256(<[u8; 32]>::decode(input)?), + 35 => Data::Sha256(<[u8; 32]>::decode(input)?), + 36 => Data::Keccak256(<[u8; 32]>::decode(input)?), + 37 => Data::ShaThree256(<[u8; 32]>::decode(input)?), + _ => return Err(Error::from("invalid leading byte")), + }) + } +} +impl EncodeLike for Data {} +// Copied from substrate repo +pub struct AppendZerosInput<'a, T>(&'a mut T); +impl<'a, T> AppendZerosInput<'a, T> { + pub fn new(input: &'a mut T) -> Self { + Self(input) + } +} +impl<'a, T: Input> Input for AppendZerosInput<'a, T> { + fn remaining_len(&mut self) -> Result, Error> { + Ok(None) + } + + fn read(&mut self, into: &mut [u8]) -> Result<(), Error> { + let remaining = self.0.remaining_len()?; + let completed = if let Some(n) = remaining { + let readable = into.len().min(n); + // this should never fail if `remaining_len` API is implemented correctly. + self.0.read(&mut into[..readable])?; + readable + } else { + // Fill it byte-by-byte. + let mut i = 0; + while i < into.len() { + if let Ok(b) = self.0.read_byte() { + into[i] = b; + i += 1; + } else { + break; + } + } + i + }; + // Fill the rest with zeros. + for i in &mut into[completed..] { + *i = 0; + } + Ok(()) + } +} + +#[derive(Debug, Encode, Decode, PartialEq, Eq)] +pub struct RegistrarInfo { + pub account: [u8; 32], + pub fee: u128, + pub fields: IdentityFields, +} +#[derive(Debug, PartialEq, Eq)] +pub struct IdentityFields(pub BitFlags); +impl Encode for IdentityFields { + fn using_encoded R>(&self, f: F) -> R { + self.0.bits().using_encoded(f) + } +} +impl Decode for IdentityFields { + fn decode(input: &mut I) -> Result { + let field = u64::decode(input)?; + Ok(Self(>::from_bits(field as u64).map_err(|_| "invalid value")?)) + } +} +#[bitflags] +#[repr(u64)] +#[derive(Clone, Copy, PartialEq, Eq, Debug)] +pub enum IdentityField { + Display = 0b0000000000000000000000000000000000000000000000000000000000000001, + Legal = 0b0000000000000000000000000000000000000000000000000000000000000010, + Web = 0b0000000000000000000000000000000000000000000000000000000000000100, + Riot = 0b0000000000000000000000000000000000000000000000000000000000001000, + Email = 0b0000000000000000000000000000000000000000000000000000000000010000, + PgpFingerprint = 0b0000000000000000000000000000000000000000000000000000000000100000, + Image = 0b0000000000000000000000000000000000000000000000000000000001000000, + Twitter = 0b0000000000000000000000000000000000000000000000000000000010000000, +} diff --git a/tool/state-processor/src/util.rs b/tool/state-processor/src/util.rs index 7bed91667..960375d8d 100644 --- a/tool/state-processor/src/util.rs +++ b/tool/state-processor/src/util.rs @@ -47,6 +47,11 @@ pub fn get_hashed_key(full_key: &str, item_key: &str) -> String { full_key.trim_start_matches(item_key).into() } +// twox128(pallet) + twox128(item) + *(item_key) -> account_id_32 +pub fn get_last_64_key(key: &str, _: &str) -> String { + get_last_64(key) +} + // twox128(pallet) + twox128(item) + *_concat(account_id_32) -> account_id_32 pub fn get_last_64(key: &str) -> String { format!("0x{}", &key[key.len() - 64..]) From cadfb76573a007dad29cd05dd35dea27322ddf0d Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Tue, 17 Jan 2023 11:31:39 +0800 Subject: [PATCH 103/189] Keep identity judgments (#210) * Keep identity judgments * Doc --- pallet/account-migration/src/lib.rs | 65 +++++++++------------ runtime/common/src/test.rs | 29 +++++---- tool/state-processor/src/adjust.rs | 4 +- tool/state-processor/src/configuration.rs | 11 ---- tool/state-processor/src/identity/README.md | 11 ++-- tool/state-processor/src/identity/mod.rs | 41 ++++++++----- tool/state-processor/src/tests.rs | 31 +++++----- tool/state-processor/src/type_registry.rs | 4 +- 8 files changed, 91 insertions(+), 105 deletions(-) diff --git a/pallet/account-migration/src/lib.rs b/pallet/account-migration/src/lib.rs index dd1318227..2c2914485 100644 --- a/pallet/account-migration/src/lib.rs +++ b/pallet/account-migration/src/lib.rs @@ -53,14 +53,13 @@ use dc_primitives::{AccountId as AccountId20, AssetId, Balance, BlockNumber, Ind // substrate use frame_support::{ log, migration, - migration::put_storage_value, pallet_prelude::*, traits::{Currency, ExistenceRequirement::KeepAlive, LockableCurrency, WithdrawReasons}, StorageHasher, }; use frame_system::{pallet_prelude::*, AccountInfo, RawOrigin}; use pallet_balances::AccountData; -use pallet_identity::{RegistrarInfo, Registration}; +use pallet_identity::Registration; use pallet_vesting::VestingInfo; use sp_core::sr25519::{Public, Signature}; use sp_runtime::{ @@ -144,31 +143,22 @@ pub mod pallet { #[pallet::getter(fn deposit_of)] pub type Deposits = StorageMap<_, Blake2_128Concat, AccountId32, Vec>; - /// [`darwinia_staking::Ledgers`] data. - #[pallet::storage] - #[pallet::getter(fn ledger_of)] - pub type Ledgers = StorageMap<_, Blake2_128Concat, AccountId32, Ledger>; - /// [`pallet_identity::IdentityOf`] data. /// /// #[pallet::storage] #[pallet::getter(fn identity_of)] - pub type IdentityOf = StorageMap< + pub type Identities = StorageMap< _, Twox64Concat, AccountId32, Registration, ConstU32<100>>, >; - /// [`pallet_identity::Registrars`] data. - /// - /// + /// [`darwinia_staking::Ledgers`] data. #[pallet::storage] - #[pallet::unbounded] - #[pallet::getter(fn registrars)] - pub type Registrars = - StorageValue<_, Vec>>, ValueQuery>; + #[pallet::getter(fn ledger_of)] + pub type Ledgers = StorageMap<_, Blake2_128Concat, AccountId32, Ledger>; #[pallet::call] impl Pallet { @@ -213,6 +203,27 @@ pub mod pallet { // https://github.dev/paritytech/substrate/blob/19162e43be45817b44c7d48e50d03f074f60fbf4/frame/vesting/src/lib.rs#L86 >::set_lock(*b"vesting ", &to, locked, reasons); } + if let Some(i) = >::take(&from) { + migration::put_storage_value( + b"Identity", + b"IdentityOf", + &Twox64Concat::hash(&to.encode()), + i, + ); + } + { + let mut rs = >::registrars(); + + for r in rs.iter_mut().flatten() { + if r.account.0 == >::as_ref(&from)[..20] { + r.account = to; + + break; + } + } + + migration::put_storage_value(b"Identity", b"Registrars", &[], rs); + } if let Some(l) = >::take(&from) { if let Some(ds) = >::take(&from) { as Currency<_>>::transfer( @@ -250,30 +261,6 @@ pub mod pallet { >::insert(to, l); } - if let Some(identity) = IdentityOf::::take(from.clone()) { - put_storage_value( - b"Identity", - b"IdentityOf", - &Twox64Concat::hash(&to.encode()), - identity, - ); - } - let mut chain_rs = >::registrars().into_inner(); - for (i, rs) in Self::registrars().iter().enumerate() { - if let Some(rs) = rs { - if rs.account == from { - chain_rs.push(Some(RegistrarInfo { - account: to, - fee: rs.fee, - fields: rs.fields, - })); - - Registrars::::mutate(|rs| rs.remove(i)); - } - } - } - put_storage_value(b"Identity", b"Registrars", &[], chain_rs); - Self::deposit_event(Event::Migrated { from, to }); Ok(()) diff --git a/runtime/common/src/test.rs b/runtime/common/src/test.rs index f28e8a9c4..9ff2e948a 100644 --- a/runtime/common/src/test.rs +++ b/runtime/common/src/test.rs @@ -325,7 +325,7 @@ macro_rules! impl_account_migration_tests { image: Data::None, twitter: Data::None, }; - >::insert( + >::insert( from_pk, Registration { judgements: Default::default(), @@ -344,25 +344,32 @@ macro_rules! impl_account_migration_tests { #[test] fn registrars_should_work() { let (from, from_pk) = alice(); + let mut truncated_from = [0_u8; 20]; + + truncated_from.copy_from_slice(&>::as_ref(&from_pk)[..20]); + let to = H160::from_low_u64_be(255).into(); ExtBuilder::default().build().execute_with(|| { preset_state_of(&from); - let info = RegistrarInfo { - account: from_pk, + let info = RegistrarInfo:: { + account: truncated_from.into(), fee: RING_AMOUNT, fields: IdentityFields::default(), }; - >::put(vec![ - Some(info.clone()), - None, - ]); - assert_ok!(migrate(from, to,)); - assert!(!AccountMigration::registrars().contains(&Some(info.clone()))); - assert_eq!(Identity::registrars()[0].clone().unwrap().account, to); - assert_eq!(Identity::registrars()[0].clone().unwrap().fee, info.fee); + migration::put_storage_value( + b"Identity", + b"Registrars", + &[], + vec![Some(info.clone()), None], + ); + + assert_ok!(migrate(from, to)); + assert_eq!(Identity::registrars()[0].as_ref().unwrap().account, to); + assert_eq!(Identity::registrars()[0].as_ref().unwrap().fee, info.fee); + assert!(Identity::registrars()[1].is_none()); }); } } diff --git a/tool/state-processor/src/adjust.rs b/tool/state-processor/src/adjust.rs index 99d00b844..6943edff2 100644 --- a/tool/state-processor/src/adjust.rs +++ b/tool/state-processor/src/adjust.rs @@ -72,13 +72,11 @@ impl Adjust for Unbonding { impl Adjust for Registration { fn adjust(&mut self) { - // Reset the judgements - self.judgements.clear(); self.deposit.adjust(); } } -impl Adjust for RegistrarInfo { +impl Adjust for RegistrarInfo<[u8; 32]> { fn adjust(&mut self) { self.fee.adjust(); } diff --git a/tool/state-processor/src/configuration.rs b/tool/state-processor/src/configuration.rs index f02e49d52..d8438691e 100644 --- a/tool/state-processor/src/configuration.rs +++ b/tool/state-processor/src/configuration.rs @@ -5,33 +5,22 @@ pub const ROOT: [u8; 20] = [0x72, 0x6f, 0x6f, 0x74, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 pub trait Configurable { const NAME: &'static str; - - const KTON_NAME: &'static [u8]; - const KTON_SYMBOL: &'static [u8]; } impl Configurable for () { - const KTON_NAME: &'static [u8] = b""; - const KTON_SYMBOL: &'static [u8] = b""; const NAME: &'static str = ""; } pub struct Darwinia; impl Configurable for Darwinia { - const KTON_NAME: &'static [u8] = b"Darwinia Commitment Token"; - const KTON_SYMBOL: &'static [u8] = b"KTON"; const NAME: &'static str = "darwinia"; } pub struct Crab; impl Configurable for Crab { - const KTON_NAME: &'static [u8] = b"Crab Commitment Token"; - const KTON_SYMBOL: &'static [u8] = b"CKTON"; const NAME: &'static str = "crab"; } pub struct Pangolin; impl Configurable for Pangolin { - const KTON_NAME: &'static [u8] = b"Pangolin Commitment Token"; - const KTON_SYMBOL: &'static [u8] = b"PKTON"; const NAME: &'static str = "pangolin"; } diff --git a/tool/state-processor/src/identity/README.md b/tool/state-processor/src/identity/README.md index b4c261656..3d3428f7c 100644 --- a/tool/state-processor/src/identity/README.md +++ b/tool/state-processor/src/identity/README.md @@ -1,6 +1,7 @@ ### Process steps -1. take `Identity::IdentityOf`, `Identity::Registrars`, `Identity::SuperOf` and `Identity::SuperOf`. -2. update identities's deposit decimal and reset judgements. -3. update registrars fee decimal. -4. update super_id's reserved balance. -5. set `AccountMigration::IdentityOf` and`AccountMigration::Registrars`. +1. take `Identity::IdentityOf`, `Identity::Registrars`, `Identity::SuperOf` and `Identity::SuperOf` +2. free super_id's reservation +3. adjust identities' deposit and judgement decimal +4. set `AccountMigration::IdentityOf` +5. truncate registrar account id and adjust registrars fee decimal +6. set `Identity::Registrars diff --git a/tool/state-processor/src/identity/mod.rs b/tool/state-processor/src/identity/mod.rs index fe39087e3..eb773e382 100644 --- a/tool/state-processor/src/identity/mod.rs +++ b/tool/state-processor/src/identity/mod.rs @@ -5,7 +5,7 @@ impl Processor { /// Only care about the solo chain, since parachains don't have identity now. pub fn process_identity(&mut self) -> &mut Self { let mut identities = >::default(); - let mut registrars = Vec::>::default(); + let mut registrars = Vec::>>::default(); let mut subs_of = Map::<(u128, Vec<[u8; 32]>)>::default(); log::info!("take `Identity::IdentityOf`, `Identity::Registrars`, `Identity::SuperOf` and `Identity::SuperOf`"); @@ -14,19 +14,7 @@ impl Processor { .take_value(b"Identity", b"Registrars", "", &mut registrars) .take_map(b"Identity", b"SubsOf", &mut subs_of, get_last_64_key); - log::info!("update identities's deposit and judgement decimal"); - identities.iter_mut().for_each(|(_k, v)| { - v.adjust(); - }); - - log::info!("update registrars fee decimal"); - registrars.iter_mut().for_each(|o| { - if let Some(r) = o { - r.adjust() - } - }); - - log::info!("update super_id's reserved balance"); + log::info!("free super_id's reservation"); subs_of.into_iter().for_each(|(super_id, (mut subs_deposit, _))| { subs_deposit.adjust(); @@ -34,6 +22,9 @@ impl Processor { .unreserve(array_bytes::hex2array_unchecked::<_, 32>(super_id), subs_deposit); }); + log::info!("adjust identities' deposit and judgement decimal"); + identities.iter_mut().for_each(|(_, v)| v.adjust()); + log::info!("set `AccountMigration::IdentityOf`"); { let ik = item_key(b"AccountMigration", b"IdentityOf"); @@ -41,8 +32,26 @@ impl Processor { self.shell_state.insert_map(identities, |h| format!("{ik}{h}")); } - log::info!("set `AccountMigration::Registrars`"); - self.shell_state.insert_value(b"AccountMigration", b"Registrars", "", registrars); + log::info!("truncate registrar account id and adjust registrars fee decimal"); + let registrars = registrars + .into_iter() + .map(|o| { + if let Some(mut r) = o { + r.adjust(); + + let mut account = [0_u8; 20]; + + account.copy_from_slice(&r.account[..20]); + + Some(RegistrarInfo { account, fee: r.fee, fields: r.fields }) + } else { + None + } + }) + .collect::>(); + + log::info!("set `Identity::Registrars`"); + self.shell_state.insert_value(b"Identity", b"Registrars", "", registrars); self } diff --git a/tool/state-processor/src/tests.rs b/tool/state-processor/src/tests.rs index 2471ee61b..238d0184d 100644 --- a/tool/state-processor/src/tests.rs +++ b/tool/state-processor/src/tests.rs @@ -736,28 +736,23 @@ fn identities_adjust() { } #[test] -fn registrars_adust() { +fn registrars_adjust() { run_test(|tester| { - let mut registrars: Vec> = Vec::new(); - tester.solo_state.get_value(b"Identity", b"Registrars", "", &mut registrars); - assert!(registrars.len() > 0); + let mut rs: Vec>> = Vec::new(); + tester.solo_state.get_value(b"Identity", b"Registrars", "", &mut rs); + assert!(!rs.is_empty()); // after migrated - let mut migrated_registrars: Vec> = Vec::new(); - tester.solo_state.get_value( - b"AccountMigration", - b"Registrars", - "", - &mut migrated_registrars, - ); - - registrars.iter().zip(migrated_registrars.iter()).for_each(|(a, b)| match (a, b) { - (Some(a), Some(b)) => { - assert_eq!(a.account, b.account); - assert_eq!(a.fee * GWEI, b.fee); - assert_eq!(a.fields, b.fields); + let mut migrated_rs: Vec>> = Vec::new(); + tester.shell_state.get_value(b"Identity", b"Registrars", "", &mut migrated_rs); + + rs.iter().zip(migrated_rs.iter()).for_each(|(r, m_r)| match (r, m_r) { + (Some(r), Some(m_r)) => { + assert_eq!(r.account, m_r.account[..20]); + assert_eq!(r.fee * GWEI, m_r.fee); + assert_eq!(r.fields, m_r.fields); }, - (None, None) => {}, + (None, None) => (), _ => panic!("this should never happen!"), }); }); diff --git a/tool/state-processor/src/type_registry.rs b/tool/state-processor/src/type_registry.rs index e18cdf411..c5b793013 100644 --- a/tool/state-processor/src/type_registry.rs +++ b/tool/state-processor/src/type_registry.rs @@ -285,8 +285,8 @@ impl<'a, T: Input> Input for AppendZerosInput<'a, T> { } #[derive(Debug, Encode, Decode, PartialEq, Eq)] -pub struct RegistrarInfo { - pub account: [u8; 32], +pub struct RegistrarInfo { + pub account: A, pub fee: u128, pub fields: IdentityFields, } From 5aaffee983b28ba6dc81a75cb9e93cce4b9ed72a Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Tue, 17 Jan 2023 14:55:47 +0800 Subject: [PATCH 104/189] Bump toolchain to `nightly-2022-11-15` (#212) --- rust-toolchain.toml | 2 +- tool/state-processor/rust-toolchain.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/rust-toolchain.toml b/rust-toolchain.toml index f0a04ee40..4115a9530 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,5 +1,5 @@ [toolchain] -channel = "nightly-2022-09-19" +channel = "nightly-2022-11-15" components = ["cargo", "clippy", "rustc", "rustfmt", "rust-src"] profile = "minimal" targets = ["wasm32-unknown-unknown"] diff --git a/tool/state-processor/rust-toolchain.toml b/tool/state-processor/rust-toolchain.toml index f0a04ee40..4115a9530 100644 --- a/tool/state-processor/rust-toolchain.toml +++ b/tool/state-processor/rust-toolchain.toml @@ -1,5 +1,5 @@ [toolchain] -channel = "nightly-2022-09-19" +channel = "nightly-2022-11-15" components = ["cargo", "clippy", "rustc", "rustfmt", "rust-src"] profile = "minimal" targets = ["wasm32-unknown-unknown"] From 2301211881fda747b05ff0398c2bc747941e0800 Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Wed, 18 Jan 2023 10:27:19 +0800 Subject: [PATCH 105/189] Add metadata for front end (#219) --- pallet/account-migration/src/lib.rs | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/pallet/account-migration/src/lib.rs b/pallet/account-migration/src/lib.rs index 2c2914485..74770c3e8 100644 --- a/pallet/account-migration/src/lib.rs +++ b/pallet/account-migration/src/lib.rs @@ -64,7 +64,7 @@ use pallet_vesting::VestingInfo; use sp_core::sr25519::{Public, Signature}; use sp_runtime::{ traits::{IdentityLookup, Verify}, - AccountId32, + AccountId32, RuntimeDebug, }; use sp_std::prelude::*; @@ -126,7 +126,7 @@ pub mod pallet { // The size of encoded `pallet_asset::AssetAccount` is 18 bytes. #[pallet::storage] #[pallet::getter(fn kton_account_of)] - pub type KtonAccounts = StorageMap<_, Blake2_128Concat, AccountId32, [u8; 18]>; + pub type KtonAccounts = StorageMap<_, Blake2_128Concat, AccountId32, AssetAccount>; /// [`pallet_vesting::Vesting`] data. /// @@ -308,6 +308,29 @@ pub mod pallet { } pub use pallet::*; +// Copy from . +// Due to its visibility. +#[allow(missing_docs)] +#[derive(PartialEq, Eq, Encode, Decode, MaxEncodedLen, TypeInfo, RuntimeDebug)] +pub struct AssetAccount { + balance: Balance, + is_frozen: bool, + reason: ExistenceReason, + extra: (), +} +#[allow(missing_docs)] +#[derive(PartialEq, Eq, Encode, Decode, MaxEncodedLen, TypeInfo, RuntimeDebug)] +pub enum ExistenceReason { + #[codec(index = 0)] + Consumer, + #[codec(index = 1)] + Sufficient, + #[codec(index = 2)] + DepositHeld(Balance), + #[codec(index = 3)] + DepositRefunded, +} + /// Build a Darwinia account migration message. pub fn sr25519_signable_message(spec_name: &[u8], account_id_20: &AccountId20) -> Vec { [ From 8f08de1753ecaee95dcdf3744ad2bd9a4f4ea414 Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Wed, 18 Jan 2023 10:28:01 +0800 Subject: [PATCH 106/189] Burn parachain backing RING (#218) --- tool/state-processor/src/configuration.rs | 10 ++++++++++ tool/state-processor/src/system/README.md | 8 ++++---- tool/state-processor/src/system/mod.rs | 9 +++++++++ 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/tool/state-processor/src/configuration.rs b/tool/state-processor/src/configuration.rs index d8438691e..4e4589a0a 100644 --- a/tool/state-processor/src/configuration.rs +++ b/tool/state-processor/src/configuration.rs @@ -5,22 +5,32 @@ pub const ROOT: [u8; 20] = [0x72, 0x6f, 0x6f, 0x74, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 pub trait Configurable { const NAME: &'static str; + // This account's balance will be burned. + // Please make sure no one transfer balance to this account. + const PARACHAIN_BACKING: &'static str; } impl Configurable for () { const NAME: &'static str = ""; + const PARACHAIN_BACKING: &'static str = ""; } pub struct Darwinia; impl Configurable for Darwinia { const NAME: &'static str = "darwinia"; + const PARACHAIN_BACKING: &'static str = + "0x1000000000000000000000000000000000000000000000000000000000000000"; } pub struct Crab; impl Configurable for Crab { const NAME: &'static str = "crab"; + const PARACHAIN_BACKING: &'static str = + "0x64766d3a0000000000000035a314e53e2fddfeca7b743042aacfb1abaf0adea3"; } pub struct Pangolin; impl Configurable for Pangolin { const NAME: &'static str = "pangolin"; + const PARACHAIN_BACKING: &'static str = + "0x64766d3a000000000000008c585f9791ee5b4b23fe82888ce576dbb69607ebe9"; } diff --git a/tool/state-processor/src/system/README.md b/tool/state-processor/src/system/README.md index 8eb034bde..868188c05 100644 --- a/tool/state-processor/src/system/README.md +++ b/tool/state-processor/src/system/README.md @@ -14,11 +14,12 @@ - use all previous data to build the new accounts and calculate total issuances - merge solo and para account infos - how to deal with the account references? - TODO + - burn parachain backing ring - set `Balances::TotalIssuance` - compare the calculated one with the storage one - - remove para backing account - TODO - - check remaining sum - TODO - - XCM relate - TODO + - remove para backing account + - check remaining sum + - XCM related things - create KTON asset details - set accounts - if is EVM address @@ -30,7 +31,6 @@ - insert to `AccountMigration::Accounts` - set KTON total issuances - compare the calculated one with the storage one - - check remaining sum - TODO - some remaining accounts, bridge endpoint accounts - TODO - special accounts - TODO diff --git a/tool/state-processor/src/system/mod.rs b/tool/state-processor/src/system/mod.rs index 2b2fa4296..8d20f1d99 100644 --- a/tool/state-processor/src/system/mod.rs +++ b/tool/state-processor/src/system/mod.rs @@ -86,6 +86,14 @@ where ring_total_issuance += v.data.reserved; }); + log::info!("burn parachain backing ring"); + if let Some(a) = accounts.get_mut(&blake2_128_concat_to_string( + array_bytes::hex2array_unchecked::<_, 32>(S::PARACHAIN_BACKING), + )) { + ring_total_issuance -= a.ring; + a.ring = 0; + } + log::info!("`ring_total_issuance({ring_total_issuance})`"); log::info!("`ring_total_issuance_storage({ring_total_issuance_storage})`"); @@ -226,6 +234,7 @@ where ); } }); + log::info!("total_remaining_ring({total_remaining_ring})"); log::info!("total_remaining_kton({total_remaining_kton})"); From ca2dd6619b8d0012a9a152f11284738de4420068 Mon Sep 17 00:00:00 2001 From: bear Date: Wed, 18 Jan 2023 15:53:26 +0800 Subject: [PATCH 107/189] Fix state judgement (#222) * Fix judgement * Use adjust() * Format --- tool/state-processor/src/adjust.rs | 5 +++++ tool/state-processor/src/identity/README.md | 2 +- tool/state-processor/src/identity/mod.rs | 4 ++-- tool/state-processor/src/tests.rs | 21 +++++++++++++-------- tool/state-processor/src/type_registry.rs | 2 +- 5 files changed, 22 insertions(+), 12 deletions(-) diff --git a/tool/state-processor/src/adjust.rs b/tool/state-processor/src/adjust.rs index 6943edff2..8e126735d 100644 --- a/tool/state-processor/src/adjust.rs +++ b/tool/state-processor/src/adjust.rs @@ -72,6 +72,11 @@ impl Adjust for Unbonding { impl Adjust for Registration { fn adjust(&mut self) { + self.judgements.iter_mut().for_each(|(_, judgement)| { + if let Judgement::FeePaid(ref mut amount) = judgement { + amount.adjust(); + } + }); self.deposit.adjust(); } } diff --git a/tool/state-processor/src/identity/README.md b/tool/state-processor/src/identity/README.md index 3d3428f7c..5be6a9eb5 100644 --- a/tool/state-processor/src/identity/README.md +++ b/tool/state-processor/src/identity/README.md @@ -2,6 +2,6 @@ 1. take `Identity::IdentityOf`, `Identity::Registrars`, `Identity::SuperOf` and `Identity::SuperOf` 2. free super_id's reservation 3. adjust identities' deposit and judgement decimal -4. set `AccountMigration::IdentityOf` +4. set `AccountMigration::Identities` 5. truncate registrar account id and adjust registrars fee decimal 6. set `Identity::Registrars diff --git a/tool/state-processor/src/identity/mod.rs b/tool/state-processor/src/identity/mod.rs index eb773e382..f0e991290 100644 --- a/tool/state-processor/src/identity/mod.rs +++ b/tool/state-processor/src/identity/mod.rs @@ -25,9 +25,9 @@ impl Processor { log::info!("adjust identities' deposit and judgement decimal"); identities.iter_mut().for_each(|(_, v)| v.adjust()); - log::info!("set `AccountMigration::IdentityOf`"); + log::info!("set `AccountMigration::Identities`"); { - let ik = item_key(b"AccountMigration", b"IdentityOf"); + let ik = item_key(b"AccountMigration", b"Identities"); self.shell_state.insert_map(identities, |h| format!("{ik}{h}")); } diff --git a/tool/state-processor/src/tests.rs b/tool/state-processor/src/tests.rs index 238d0184d..206d52a4a 100644 --- a/tool/state-processor/src/tests.rs +++ b/tool/state-processor/src/tests.rs @@ -702,9 +702,9 @@ fn proxy_reserved_adjust() { #[test] fn identities_adjust() { run_test(|tester| { - // https://crab.subscan.io/account/5CcRAW3d6vi4Vq2BX9EeynS1rj7bqoZ5EPwPiLiJ422FsEbC + // https://crab.subscan.io/account/5Ct3V8cbYgJiUoQQhYMyyWChL5YwJnZ4yak7MKegNkpPptAP let test_addr: [u8; 32] = hex_n_into_unchecked::<_, _, 32>( - "0x182fa92d7f04c79c541d5f117223fcb9f83f2e830c3c187f2622176ed68c3c1a", + "0x241a9c2aa8a83e1c5f02fc2b7112bd1873249a8e55a4f919c7d42cf1164be35c", ); let mut registration = Registration::default(); @@ -715,20 +715,25 @@ fn identities_adjust() { &mut registration, ); assert_ne!(registration.deposit, 0); - assert_eq!(registration.info.display, Data::Raw(b"COLD STORAGE CAPITAL".to_vec())); - assert_eq!(registration.info.email, Data::Raw(b"rbarraza@coldstoragecapital.com".to_vec())); - assert_eq!(registration.info.twitter, Data::Raw(b"@coldstoragecap".to_vec())); + assert_eq!(registration.info.display, Data::Raw(b"iskulbukolPH".to_vec())); + assert_eq!(registration.info.email, Data::Raw(b"pjdamondamon@gmail.com".to_vec())); + assert_eq!(registration.info.twitter, Data::Raw(b"@DPedroJuan".to_vec())); // after migrated let mut migrated_registration = Registration::default(); tester.shell_state.get_value( b"AccountMigration", - b"IdentityOf", + b"Identities", &two_x64_concat_to_string(test_addr.encode()), &mut migrated_registration, ); assert_eq!(migrated_registration.deposit, registration.deposit * GWEI); - assert_eq!(migrated_registration.judgements.len(), 0); + registration.judgements.iter().zip(migrated_registration.judgements.iter()).for_each( + |((_, r), (_, m_r))| match (r, m_r) { + (Judgement::FeePaid(a), Judgement::FeePaid(m_a)) => assert_eq!(a * GWEI, *m_a), + _ => assert_eq!(*r, *m_r), + }, + ); assert_eq!(migrated_registration.info.display, registration.info.display); assert_eq!(migrated_registration.info.email, registration.info.email); assert_eq!(migrated_registration.info.twitter, registration.info.twitter); @@ -748,7 +753,7 @@ fn registrars_adjust() { rs.iter().zip(migrated_rs.iter()).for_each(|(r, m_r)| match (r, m_r) { (Some(r), Some(m_r)) => { - assert_eq!(r.account, m_r.account[..20]); + assert_eq!(r.account[..20], m_r.account); assert_eq!(r.fee * GWEI, m_r.fee); assert_eq!(r.fields, m_r.fields); }, diff --git a/tool/state-processor/src/type_registry.rs b/tool/state-processor/src/type_registry.rs index c5b793013..47fc36df6 100644 --- a/tool/state-processor/src/type_registry.rs +++ b/tool/state-processor/src/type_registry.rs @@ -172,7 +172,7 @@ impl Decode for Registration { Ok(Self { judgements, deposit, info }) } } -#[derive(Debug, Encode, Decode)] +#[derive(Debug, PartialEq, Eq, Encode, Decode)] pub enum Judgement { Unknown, FeePaid(u128), From a7bfc4a4808304121ff7d1788448f9aa2033d85f Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Wed, 18 Jan 2023 20:21:11 +0800 Subject: [PATCH 108/189] Readable address (#224) --- Cargo.lock | 3 ++- pallet/account-migration/Cargo.toml | 5 +++-- pallet/account-migration/src/lib.rs | 2 +- pallet/account-migration/src/tests.rs | 2 +- pallet/message-transact/Cargo.toml | 15 +++++++-------- pallet/message-transact/src/tests/eip1559.rs | 4 +--- pallet/message-transact/src/tests/eip2930.rs | 4 +--- pallet/message-transact/src/tests/legacy.rs | 4 +--- 8 files changed, 17 insertions(+), 22 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1c0162090..1f3a97d3b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2282,6 +2282,7 @@ dependencies = [ name = "darwinia-account-migration" version = "6.0.0" dependencies = [ + "array-bytes 6.0.0", "darwinia-deposit", "darwinia-staking", "dc-primitives", @@ -2380,7 +2381,7 @@ dependencies = [ name = "darwinia-message-transact" version = "6.0.0" dependencies = [ - "array-bytes 4.2.0", + "array-bytes 6.0.0", "bp-message-dispatch", "bp-runtime", "ethereum", diff --git a/pallet/account-migration/Cargo.toml b/pallet/account-migration/Cargo.toml index 5afad954b..2cc84449b 100644 --- a/pallet/account-migration/Cargo.toml +++ b/pallet/account-migration/Cargo.toml @@ -11,8 +11,9 @@ version = "6.0.0" [dependencies] # crates.io -codec = { package = "parity-scale-codec", version = "3.2", default-features = false, features = ["derive"] } -scale-info = { version = "2.3", default-features = false, features = ["derive"] } +array-bytes = { version = "6.0" } +codec = { package = "parity-scale-codec", version = "3.2", default-features = false, features = ["derive"] } +scale-info = { version = "2.3", default-features = false, features = ["derive"] } # darwinia darwinia-deposit = { default-features = false, path = "../deposit" } diff --git a/pallet/account-migration/src/lib.rs b/pallet/account-migration/src/lib.rs index 74770c3e8..fa3f2bee3 100644 --- a/pallet/account-migration/src/lib.rs +++ b/pallet/account-migration/src/lib.rs @@ -335,7 +335,7 @@ pub enum ExistenceReason { pub fn sr25519_signable_message(spec_name: &[u8], account_id_20: &AccountId20) -> Vec { [ b"I authorize the migration to ", - account_id_20.0.as_slice(), + array_bytes::bytes2hex("0x", account_id_20.0).as_bytes(), b", an unused address on ", spec_name, b". Sign this message to authorize using the Substrate key associated with the account on ", diff --git a/pallet/account-migration/src/tests.rs b/pallet/account-migration/src/tests.rs index 849820ca8..d8eb1842a 100644 --- a/pallet/account-migration/src/tests.rs +++ b/pallet/account-migration/src/tests.rs @@ -28,7 +28,7 @@ fn sr25519_signable_message_should_work() { sr25519_signable_message(s.as_bytes(), &Default::default()), format!( "I authorize the migration to {}, an unused address on {}. Sign this message to authorize using the Substrate key associated with the account on {} that you wish to migrate.", - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", + "0x0000000000000000000000000000000000000000", s, &s[..s.len() - 1], ).as_bytes() diff --git a/pallet/message-transact/Cargo.toml b/pallet/message-transact/Cargo.toml index b2552c3f2..57d5ceadb 100644 --- a/pallet/message-transact/Cargo.toml +++ b/pallet/message-transact/Cargo.toml @@ -11,16 +11,16 @@ version = "6.0.0" [dependencies] # crates.io -codec = { default-features = false, package = "parity-scale-codec", version = "3.2", features = ["derive"] } -ethereum = { default-features = false, version = "0.14.0", features = ["with-codec"] } -scale-info = { default-features = false, version = "2.3.0", features = ["derive"] } +codec = { package = "parity-scale-codec", version = "3.2", default-features = false, features = ["derive"] } +ethereum = { version = "0.14", default-features = false, features = ["with-codec"] } +scale-info = { version = "2.3", default-features = false, features = ["derive"] } # frontier fp-ethereum = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } fp-evm = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } pallet-evm = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } -# paritytech +# substrate frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } @@ -28,7 +28,7 @@ sp-runtime = { default-features = false, git = "https://github.com/paritytech sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } [dev-dependencies] -array-bytes = { version = "4.1" } +array-bytes = { version = "6.0" } libsecp256k1 = { version = "0.5", features = ["static-context", "hmac"] } rlp = { version = "0.5" } sha3 = { version = "0.9" } @@ -40,13 +40,13 @@ pallet-bridge-dispatch = { git = "https://github.com/darwinia-network/darwinia-m # frontier fp-self-contained = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } +pallet-ethereum = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } # moonbeam precompile-utils = { git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.33", features = ["testing"] } # substrate pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-ethereum = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } @@ -62,9 +62,8 @@ std = [ "fp-evm/std", "fp-ethereum/std", "pallet-evm/std", - "pallet-ethereum/std", - # paritytech + # substrate "frame-support/std", "frame-system/std", "sp-core/std", diff --git a/pallet/message-transact/src/tests/eip1559.rs b/pallet/message-transact/src/tests/eip1559.rs index 6ea902e3a..ce3de2d0e 100644 --- a/pallet/message-transact/src/tests/eip1559.rs +++ b/pallet/message-transact/src/tests/eip1559.rs @@ -16,8 +16,6 @@ // You should have received a copy of the GNU General Public License // along with Darwinia. If not, see . -// crates -use array_bytes::hex2bytes; // darwinia use crate::{mock::*, tests::*}; // frontier @@ -35,7 +33,7 @@ pub fn eip1559_erc20_creation_unsigned_transaction() -> EIP1559UnsignedTransacti gas_limit: U256::from(1_000_000), action: ethereum::TransactionAction::Create, value: U256::zero(), - input: hex2bytes(ERC20_CONTRACT_BYTECODE).unwrap(), + input: array_bytes::hex2bytes_unchecked(ERC20_CONTRACT_BYTECODE), } } diff --git a/pallet/message-transact/src/tests/eip2930.rs b/pallet/message-transact/src/tests/eip2930.rs index fefef528b..a599a615f 100644 --- a/pallet/message-transact/src/tests/eip2930.rs +++ b/pallet/message-transact/src/tests/eip2930.rs @@ -16,8 +16,6 @@ // You should have received a copy of the GNU General Public License // along with Darwinia. If not, see . -// crates.io -use array_bytes::hex2bytes; // darwinia use crate::{mock::*, tests::*}; // frontier @@ -34,7 +32,7 @@ fn eip2930_erc20_creation_unsigned_transaction() -> EIP2930UnsignedTransaction { gas_limit: U256::from(1_000_000), action: ethereum::TransactionAction::Create, value: U256::zero(), - input: hex2bytes(ERC20_CONTRACT_BYTECODE).unwrap(), + input: array_bytes::hex2bytes_unchecked(ERC20_CONTRACT_BYTECODE), } } diff --git a/pallet/message-transact/src/tests/legacy.rs b/pallet/message-transact/src/tests/legacy.rs index 3e730759a..c3488b380 100644 --- a/pallet/message-transact/src/tests/legacy.rs +++ b/pallet/message-transact/src/tests/legacy.rs @@ -16,8 +16,6 @@ // You should have received a copy of the GNU General Public License // along with Darwinia. If not, see . -// crates.io -use array_bytes::hex2bytes; // darwinia use crate::{mock::*, tests::*}; // frontier @@ -34,7 +32,7 @@ pub fn legacy_erc20_creation_unsigned_transaction() -> LegacyUnsignedTransaction gas_limit: U256::from(1_000_000), action: ethereum::TransactionAction::Create, value: U256::zero(), - input: hex2bytes(ERC20_CONTRACT_BYTECODE).unwrap(), + input: array_bytes::hex2bytes_unchecked(ERC20_CONTRACT_BYTECODE), } } From 3ad6cc846868bfadc41ac518e96ac13144261345 Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Thu, 19 Jan 2023 11:05:44 +0800 Subject: [PATCH 109/189] Add missing field (#226) --- tool/state-processor/src/staking/mod.rs | 1 + tool/state-processor/src/type_registry.rs | 1 + 2 files changed, 2 insertions(+) diff --git a/tool/state-processor/src/staking/mod.rs b/tool/state-processor/src/staking/mod.rs index 908ae41d6..eebfa9478 100644 --- a/tool/state-processor/src/staking/mod.rs +++ b/tool/state-processor/src/staking/mod.rs @@ -49,6 +49,7 @@ impl Processor { Deposit { id, value: d.value, + start_time: d.start_time as _, expired_time: d.expire_time as _, in_use: true, } diff --git a/tool/state-processor/src/type_registry.rs b/tool/state-processor/src/type_registry.rs index 47fc36df6..0c4cdeda4 100644 --- a/tool/state-processor/src/type_registry.rs +++ b/tool/state-processor/src/type_registry.rs @@ -112,6 +112,7 @@ pub struct VestingInfo { pub struct Deposit { pub id: u16, pub value: u128, + pub start_time: u128, pub expired_time: u128, pub in_use: bool, } From 668fde35d040a39a971796bc9cb719b7e48edc59 Mon Sep 17 00:00:00 2001 From: bear Date: Thu, 19 Jan 2023 14:12:08 +0800 Subject: [PATCH 110/189] Fix `try-runtime` (#223) * Try fix * Try fix * Adjust toml file * Fix compile * Foramat --- Cargo.lock | 28 ++++++++++++++-------------- node/Cargo.toml | 2 ++ node/src/command.rs | 2 ++ pallet/account-migration/Cargo.toml | 2 ++ pallet/deposit/Cargo.toml | 3 ++- pallet/ecdsa-authority/Cargo.toml | 2 ++ pallet/message-gadget/Cargo.toml | 2 ++ pallet/message-transact/Cargo.toml | 2 ++ pallet/staking/Cargo.toml | 3 ++- runtime/common/src/test.rs | 3 ++- runtime/crab/Cargo.toml | 15 +++++++++++++++ runtime/darwinia/Cargo.toml | 15 +++++++++++++++ runtime/pangolin/Cargo.toml | 14 ++++++++++++++ 13 files changed, 76 insertions(+), 17 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1f3a97d3b..377b2abd4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -753,7 +753,7 @@ dependencies = [ [[package]] name = "bp-darwinia-core" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.33#f98feb62bcf0a0e5b4b971e9ba22640e4bce625f" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.33#3c4598428c048b78749ad334a1e134f435984daf" dependencies = [ "account", "bp-messages", @@ -770,7 +770,7 @@ dependencies = [ [[package]] name = "bp-header-chain" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.33#f98feb62bcf0a0e5b4b971e9ba22640e4bce625f" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.33#3c4598428c048b78749ad334a1e134f435984daf" dependencies = [ "bp-runtime", "finality-grandpa", @@ -787,7 +787,7 @@ dependencies = [ [[package]] name = "bp-message-dispatch" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.33#f98feb62bcf0a0e5b4b971e9ba22640e4bce625f" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.33#3c4598428c048b78749ad334a1e134f435984daf" dependencies = [ "bp-runtime", "frame-support", @@ -800,7 +800,7 @@ dependencies = [ [[package]] name = "bp-messages" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.33#f98feb62bcf0a0e5b4b971e9ba22640e4bce625f" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.33#3c4598428c048b78749ad334a1e134f435984daf" dependencies = [ "bitvec", "bp-runtime", @@ -817,7 +817,7 @@ dependencies = [ [[package]] name = "bp-parachains" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.33#f98feb62bcf0a0e5b4b971e9ba22640e4bce625f" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.33#3c4598428c048b78749ad334a1e134f435984daf" dependencies = [ "bp-polkadot-core", "bp-runtime", @@ -830,7 +830,7 @@ dependencies = [ [[package]] name = "bp-polkadot-core" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.33#f98feb62bcf0a0e5b4b971e9ba22640e4bce625f" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.33#3c4598428c048b78749ad334a1e134f435984daf" dependencies = [ "bp-messages", "bp-runtime", @@ -850,7 +850,7 @@ dependencies = [ [[package]] name = "bp-runtime" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.33#f98feb62bcf0a0e5b4b971e9ba22640e4bce625f" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.33#3c4598428c048b78749ad334a1e134f435984daf" dependencies = [ "frame-support", "frame-system", @@ -871,7 +871,7 @@ dependencies = [ [[package]] name = "bp-test-utils" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.33#f98feb62bcf0a0e5b4b971e9ba22640e4bce625f" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.33#3c4598428c048b78749ad334a1e134f435984daf" dependencies = [ "bp-header-chain", "ed25519-dalek", @@ -886,7 +886,7 @@ dependencies = [ [[package]] name = "bridge-runtime-common" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.33#f98feb62bcf0a0e5b4b971e9ba22640e4bce625f" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.33#3c4598428c048b78749ad334a1e134f435984daf" dependencies = [ "bp-header-chain", "bp-message-dispatch", @@ -6390,7 +6390,7 @@ dependencies = [ [[package]] name = "pallet-bridge-dispatch" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.33#f98feb62bcf0a0e5b4b971e9ba22640e4bce625f" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.33#3c4598428c048b78749ad334a1e134f435984daf" dependencies = [ "bp-message-dispatch", "bp-runtime", @@ -6406,7 +6406,7 @@ dependencies = [ [[package]] name = "pallet-bridge-grandpa" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.33#f98feb62bcf0a0e5b4b971e9ba22640e4bce625f" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.33#3c4598428c048b78749ad334a1e134f435984daf" dependencies = [ "bp-header-chain", "bp-runtime", @@ -6428,7 +6428,7 @@ dependencies = [ [[package]] name = "pallet-bridge-messages" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.33#f98feb62bcf0a0e5b4b971e9ba22640e4bce625f" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.33#3c4598428c048b78749ad334a1e134f435984daf" dependencies = [ "bitvec", "bp-message-dispatch", @@ -6449,7 +6449,7 @@ dependencies = [ [[package]] name = "pallet-bridge-parachains" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.33#f98feb62bcf0a0e5b4b971e9ba22640e4bce625f" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.33#3c4598428c048b78749ad334a1e134f435984daf" dependencies = [ "bp-parachains", "bp-polkadot-core", @@ -6713,7 +6713,7 @@ dependencies = [ [[package]] name = "pallet-fee-market" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.33#f98feb62bcf0a0e5b4b971e9ba22640e4bce625f" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.33#3c4598428c048b78749ad334a1e134f435984daf" dependencies = [ "bp-messages", "bp-runtime", diff --git a/node/Cargo.toml b/node/Cargo.toml index b901c3291..0aa5daf44 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -117,7 +117,9 @@ runtime-benchmarks = [ try-runtime = [ # darwinia + "crab-runtime/try-runtime", "darwinia-runtime/try-runtime", + "pangolin-runtime/try-runtime", # substrate "try-runtime-cli/try-runtime", diff --git a/node/src/command.rs b/node/src/command.rs index acd4be45f..bd9d6ce90 100644 --- a/node/src/command.rs +++ b/node/src/command.rs @@ -498,6 +498,8 @@ pub fn run() -> Result<()> { }, #[cfg(feature = "try-runtime")] Some(Subcommand::TryRuntime(cmd)) => { + use sc_service::TaskManager; + let runner = cli.create_runner(cmd)?; let chain_spec = &runner.config().chain_spec; diff --git a/pallet/account-migration/Cargo.toml b/pallet/account-migration/Cargo.toml index 2cc84449b..218be4810 100644 --- a/pallet/account-migration/Cargo.toml +++ b/pallet/account-migration/Cargo.toml @@ -57,3 +57,5 @@ std = [ "sp-runtime/std", "sp-std/std", ] + +try-runtime = ["frame-support/try-runtime"] diff --git a/pallet/deposit/Cargo.toml b/pallet/deposit/Cargo.toml index 326be9968..0368d8aac 100644 --- a/pallet/deposit/Cargo.toml +++ b/pallet/deposit/Cargo.toml @@ -52,4 +52,5 @@ std = [ "sp-std/std", ] -# TODO: runtime-benchmarks, try-runtime +# TODO: runtime-benchmarks +try-runtime = ["frame-support/try-runtime"] diff --git a/pallet/ecdsa-authority/Cargo.toml b/pallet/ecdsa-authority/Cargo.toml index 2f57c77d9..f739e0aa8 100644 --- a/pallet/ecdsa-authority/Cargo.toml +++ b/pallet/ecdsa-authority/Cargo.toml @@ -51,3 +51,5 @@ std = [ "sp-std/std", "sp-io/std", ] + +try-runtime = ["frame-support/try-runtime"] diff --git a/pallet/message-gadget/Cargo.toml b/pallet/message-gadget/Cargo.toml index f2e2deeb1..5c358f671 100644 --- a/pallet/message-gadget/Cargo.toml +++ b/pallet/message-gadget/Cargo.toml @@ -50,3 +50,5 @@ std = [ "sp-core/std", "sp-io/std", ] + +try-runtime = ["frame-support/try-runtime"] diff --git a/pallet/message-transact/Cargo.toml b/pallet/message-transact/Cargo.toml index 57d5ceadb..15eec2774 100644 --- a/pallet/message-transact/Cargo.toml +++ b/pallet/message-transact/Cargo.toml @@ -70,3 +70,5 @@ std = [ "sp-runtime/std", "sp-std/std", ] + +try-runtime = ["frame-support/try-runtime"] diff --git a/pallet/staking/Cargo.toml b/pallet/staking/Cargo.toml index 959b18d95..363868751 100644 --- a/pallet/staking/Cargo.toml +++ b/pallet/staking/Cargo.toml @@ -62,4 +62,5 @@ std = [ "sp-std/std", ] -# TODO: runtime-benchmarks, try-runtime +# TODO: runtime-benchmarks +try-runtime = ["frame-support/try-runtime"] diff --git a/runtime/common/src/test.rs b/runtime/common/src/test.rs index 9ff2e948a..30983d4e1 100644 --- a/runtime/common/src/test.rs +++ b/runtime/common/src/test.rs @@ -346,7 +346,8 @@ macro_rules! impl_account_migration_tests { let (from, from_pk) = alice(); let mut truncated_from = [0_u8; 20]; - truncated_from.copy_from_slice(&>::as_ref(&from_pk)[..20]); + truncated_from + .copy_from_slice(&>::as_ref(&from_pk)[..20]); let to = H160::from_low_u64_be(255).into(); diff --git a/runtime/crab/Cargo.toml b/runtime/crab/Cargo.toml index 3da1d1834..e528d9b1d 100644 --- a/runtime/crab/Cargo.toml +++ b/runtime/crab/Cargo.toml @@ -316,6 +316,21 @@ try-runtime = [ "cumulus-pallet-xcmp-queue/try-runtime", "parachain-info/try-runtime", + # darwinia + "darwinia-account-migration/try-runtime", + "darwinia-deposit/try-runtime", + "darwinia-ecdsa-authority/try-runtime", + "darwinia-message-gadget/try-runtime", + "darwinia-message-transact/try-runtime", + "darwinia-staking/try-runtime", + + # darwinia-messages-substrate + "pallet-bridge-dispatch/try-runtime", + "pallet-bridge-grandpa/try-runtime", + "pallet-bridge-messages/try-runtime", + "pallet-bridge-parachains/try-runtime", + "pallet-fee-market/try-runtime", + # frontier "pallet-ethereum/try-runtime", "pallet-evm/try-runtime", diff --git a/runtime/darwinia/Cargo.toml b/runtime/darwinia/Cargo.toml index 64a45636a..04c21b309 100644 --- a/runtime/darwinia/Cargo.toml +++ b/runtime/darwinia/Cargo.toml @@ -316,6 +316,21 @@ try-runtime = [ "cumulus-pallet-xcmp-queue/try-runtime", "parachain-info/try-runtime", + # darwinia + "darwinia-account-migration/try-runtime", + "darwinia-deposit/try-runtime", + "darwinia-ecdsa-authority/try-runtime", + "darwinia-message-gadget/try-runtime", + "darwinia-message-transact/try-runtime", + "darwinia-staking/try-runtime", + + # darwinia-messages-substrate + "pallet-bridge-dispatch/try-runtime", + "pallet-bridge-grandpa/try-runtime", + "pallet-bridge-messages/try-runtime", + "pallet-bridge-parachains/try-runtime", + "pallet-fee-market/try-runtime", + # frontier "pallet-ethereum/try-runtime", "pallet-evm/try-runtime", diff --git a/runtime/pangolin/Cargo.toml b/runtime/pangolin/Cargo.toml index c45b67bb9..81831e951 100644 --- a/runtime/pangolin/Cargo.toml +++ b/runtime/pangolin/Cargo.toml @@ -313,6 +313,20 @@ try-runtime = [ "cumulus-pallet-xcmp-queue/try-runtime", "parachain-info/try-runtime", + # darwinia + "darwinia-account-migration/try-runtime", + "darwinia-deposit/try-runtime", + "darwinia-ecdsa-authority/try-runtime", + "darwinia-message-gadget/try-runtime", + "darwinia-message-transact/try-runtime", + "darwinia-staking/try-runtime", + + # darwinia-messages-substrate + "pallet-bridge-dispatch/try-runtime", + "pallet-bridge-grandpa/try-runtime", + "pallet-bridge-messages/try-runtime", + "pallet-fee-market/try-runtime", + # frontier "pallet-ethereum/try-runtime", "pallet-evm/try-runtime", From cf9038f053447d4130d0582368c13d1d70fd2c01 Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Thu, 19 Jan 2023 14:13:17 +0800 Subject: [PATCH 111/189] Adjust session consumer part.1 (#229) --- tool/state-processor/src/main.rs | 4 +- tool/state-processor/src/processor.rs | 188 ++++++++++++---------- tool/state-processor/src/session/mod.rs | 23 +++ tool/state-processor/src/system/README.md | 1 + tool/state-processor/src/system/mod.rs | 22 ++- tool/state-processor/src/util.rs | 6 +- 6 files changed, 155 insertions(+), 89 deletions(-) create mode 100644 tool/state-processor/src/session/mod.rs diff --git a/tool/state-processor/src/main.rs b/tool/state-processor/src/main.rs index f8bff8f9e..dfd87f57f 100644 --- a/tool/state-processor/src/main.rs +++ b/tool/state-processor/src/main.rs @@ -18,6 +18,7 @@ mod evm; mod identity; mod indices; mod proxy; +mod session; mod staking; mod system; mod vesting; @@ -32,9 +33,10 @@ fn main() -> Result<()> { std::env::set_var("RUST_LOG", "state_processor"); pretty_env_logger::init(); + // >::new()?.process()?; + >::new()?.test().process()?; // >::new()?.process()?; // >::new()?.process()?; - >::new()?.test().process()?; Ok(()) } diff --git a/tool/state-processor/src/processor.rs b/tool/state-processor/src/processor.rs index 587e3225f..b5bc8f01d 100644 --- a/tool/state-processor/src/processor.rs +++ b/tool/state-processor/src/processor.rs @@ -11,7 +11,7 @@ use std::{ use crate::*; // crates.io use anyhow::Result; -use fxhash::FxHashMap; +use fxhash::{FxHashMap, FxHashSet}; use once_cell::sync::Lazy; use parity_scale_codec::{Decode, Encode}; use serde::de::DeserializeOwned; @@ -19,6 +19,7 @@ use serde_json::Value; // hack-ink use subspector::ChainSpec; +pub type Set = FxHashSet; pub type Map = FxHashMap; pub static NOW: Lazy> = Lazy::new(|| RwLock::new(0)); @@ -112,6 +113,32 @@ impl State { }) } + pub fn get_value(&self, pallet: &[u8], item: &[u8], hash: &str, value: &mut D) -> &Self + where + D: Decode, + { + let key = full_key(pallet, item, hash); + + if let Some(v) = self.map.get(&key) { + match decode(v) { + Ok(v) => *value = v, + Err(e) => log::error!( + "failed to decode `{}::{}::{hash}({v})`, due to `{e}`", + String::from_utf8_lossy(pallet), + String::from_utf8_lossy(item), + ), + } + } else { + log::error!( + "key not found `{}::{}::{hash}`", + String::from_utf8_lossy(pallet), + String::from_utf8_lossy(item), + ); + } + + self + } + pub fn insert_raw_key_raw_value(&mut self, key: String, value: String) -> &mut Self { self.map.insert(key, value); @@ -127,6 +154,64 @@ impl State { self } + pub fn insert_raw_key_map(&mut self, pairs: Map) -> &mut Self { + pairs.into_iter().for_each(|(k, v)| { + if self.map.contains_key(&k) { + log::error!("key({k}) has already existed, overriding"); + } + + self.map.insert(k, v); + }); + + self + } + + pub fn insert_value(&mut self, pallet: &[u8], item: &[u8], hash: &str, value: E) -> &mut Self + where + E: Encode, + { + self.map.insert(full_key(pallet, item, hash), encode_value(value)); + + self + } + + pub fn insert_map(&mut self, pairs: Map, process_key: F) -> &mut Self + where + E: Encode, + F: Fn(&str) -> String, + { + pairs.into_iter().for_each(|(k, v)| { + self.map.insert(process_key(&k), encode_value(v)); + }); + + self + } + + pub fn contains_key(&self, key: &str) -> bool { + self.map.contains_key(key) + } + + pub fn exists(&self, pallet: &[u8], item: &[u8]) -> bool { + self.map.keys().into_iter().any(|k| k.starts_with(&item_key(pallet, item))) + } + + pub fn unreserve(&mut self, account_id_32: A, amount: u128) + where + A: AsRef<[u8]>, + { + let account_id_32 = account_id_32.as_ref(); + let (p, i, h) = if is_evm_address(account_id_32) { + (&b"System"[..], &b"Account"[..], &account_id_32[11..31]) + } else { + (&b"AccountMigration"[..], &b"Accounts"[..], account_id_32) + }; + + self.mutate_value(p, i, &blake2_128_concat_to_string(h), |a: &mut AccountInfo| { + a.data.free += amount; + a.data.reserved -= amount; + }); + } + pub fn take_raw_map( &mut self, prefix: &str, @@ -149,40 +234,19 @@ impl State { self } - pub fn insert_raw_key_map(&mut self, pairs: Map) -> &mut Self { - pairs.into_iter().for_each(|(k, v)| { - if self.map.contains_key(&k) { - log::error!("key({k}) has already existed, overriding"); - } - - self.map.insert(k, v); - }); - - self - } - - pub fn get_value(&self, pallet: &[u8], item: &[u8], hash: &str, value: &mut D) -> &Self + pub fn take_keys(&mut self, prefix: &str, keys: &mut Set, process_key: F) -> &mut Self where - D: Decode, + F: Fn(&str, &str) -> String, { - let key = full_key(pallet, item, hash); + self.map.retain(|k, _| { + if k.starts_with(prefix) { + keys.insert(process_key(k, prefix)); - if let Some(v) = self.map.get(&key) { - match decode(v) { - Ok(v) => *value = v, - Err(e) => log::error!( - "failed to decode `{}::{}::{hash}({v})`, due to `{e}`", - String::from_utf8_lossy(pallet), - String::from_utf8_lossy(item), - ), + false + } else { + true } - } else { - log::error!( - "key not found `{}::{}::{hash}`", - String::from_utf8_lossy(pallet), - String::from_utf8_lossy(item), - ); - } + }); self } @@ -219,31 +283,6 @@ impl State { self } - pub fn insert_value(&mut self, pallet: &[u8], item: &[u8], hash: &str, value: E) -> &mut Self - where - E: Encode, - { - self.map.insert(full_key(pallet, item, hash), encode_value(value)); - - self - } - - pub fn mutate_value(&mut self, pallet: &[u8], item: &[u8], hash: &str, f: F) -> &mut Self - where - D: Default + Encode + Decode, - F: FnOnce(&mut D), - { - let mut v = D::default(); - - self.get_value(pallet, item, hash, &mut v); - - f(&mut v); - - self.insert_value(pallet, item, hash, v); - - self - } - pub fn take_map( &mut self, pallet: &[u8], @@ -284,41 +323,20 @@ impl State { self } - pub fn insert_map(&mut self, pairs: Map, process_key: F) -> &mut Self + pub fn mutate_value(&mut self, pallet: &[u8], item: &[u8], hash: &str, f: F) -> &mut Self where - E: Encode, - F: Fn(&str) -> String, + D: Default + Encode + Decode, + F: FnOnce(&mut D), { - pairs.into_iter().for_each(|(k, v)| { - self.map.insert(process_key(&k), encode_value(v)); - }); - - self - } + let mut v = D::default(); - pub fn contains_key(&self, key: &str) -> bool { - self.map.contains_key(key) - } + self.get_value(pallet, item, hash, &mut v); - pub fn exists(&self, pallet: &[u8], item: &[u8]) -> bool { - self.map.keys().into_iter().any(|k| k.starts_with(&item_key(pallet, item))) - } + f(&mut v); - pub fn unreserve(&mut self, account_id_32: A, amount: u128) - where - A: AsRef<[u8]>, - { - let account_id_32 = account_id_32.as_ref(); - let (p, i, h) = if is_evm_address(account_id_32) { - (&b"System"[..], &b"Account"[..], &account_id_32[11..31]) - } else { - (&b"AccountMigration"[..], &b"Accounts"[..], account_id_32) - }; + self.insert_value(pallet, item, hash, v); - self.mutate_value(p, i, &blake2_128_concat_to_string(h), |a: &mut AccountInfo| { - a.data.free += amount; - a.data.reserved -= amount; - }); + self } } diff --git a/tool/state-processor/src/session/mod.rs b/tool/state-processor/src/session/mod.rs new file mode 100644 index 000000000..c7d3c4d55 --- /dev/null +++ b/tool/state-processor/src/session/mod.rs @@ -0,0 +1,23 @@ +// darwinia +use crate::*; + +impl Processor { + pub fn process_session(&mut self) -> (Set, Set) { + // Session storage items. + // https://github.dev/darwinia-network/substrate/blob/darwinia-v0.12.5/frame/session/src/lib.rs#L532 + + let prefix = item_key(b"Session", b"NextKeys"); + + let mut s_keys = Set::default(); + let mut p_keys = Set::default(); + + self.solo_state.take_keys(&prefix, &mut s_keys, |k, _| { + blake2_128_concat_to_string(key_to_account32(k)) + }); + self.para_state.take_keys(&prefix, &mut p_keys, |k, _| { + blake2_128_concat_to_string(key_to_account32(k)) + }); + + (s_keys, p_keys) + } +} diff --git a/tool/state-processor/src/system/README.md b/tool/state-processor/src/system/README.md index 868188c05..9467e4973 100644 --- a/tool/state-processor/src/system/README.md +++ b/tool/state-processor/src/system/README.md @@ -11,6 +11,7 @@ - take para `Balances::TotalIssuance` and `Balances::Locks` - there should not be any locks on parachain - check if there are any other locks +- decrease pallet-session account references - use all previous data to build the new accounts and calculate total issuances - merge solo and para account infos - how to deal with the account references? - TODO diff --git a/tool/state-processor/src/system/mod.rs b/tool/state-processor/src/system/mod.rs index 8d20f1d99..cd7c1470a 100644 --- a/tool/state-processor/src/system/mod.rs +++ b/tool/state-processor/src/system/mod.rs @@ -24,13 +24,31 @@ where pub fn process_system(&mut self) -> &mut Self { // System storage items. // https://github.dev/darwinia-network/substrate/blob/darwinia-v0.12.5/frame/system/src/lib.rs#L545 - let solo_account_infos = self.process_solo_account_infos(); - let para_account_infos = self.process_para_account_infos(); + let mut solo_account_infos = self.process_solo_account_infos(); + let mut para_account_infos = self.process_para_account_infos(); let (ring_total_issuance_storage, kton_total_issuance_storage) = self.process_balances(); + let (solo_validators, para_collators) = self.process_session(); let mut accounts = Map::default(); let mut ring_total_issuance = u128::default(); let mut kton_total_issuance = u128::default(); + // Skip for testnets, due to https://github.com/paritytech/substrate/issues/13172. + // log::info!("decrease solo pallet-session account references"); + // solo_validators.into_iter().for_each(|k| { + // if let Some(a) = solo_account_infos.get_mut(&k) { + // a.consumers -= 1; + // } + // }); + + // Skip, due to https://github.com/paritytech/substrate/issues/13172. + // log::info!("decrease para pallet-session account references"); + // para_collators.into_iter().for_each(|k| { + // if let Some(a) = para_account_infos.get_mut(&k) { + // dbg!(get_last_64(&k)); + // a.consumers -= 1; + // } + // }); + log::info!("build accounts"); log::info!("calculate total issuance"); solo_account_infos.into_iter().for_each(|(k, v)| { diff --git a/tool/state-processor/src/util.rs b/tool/state-processor/src/util.rs index 960375d8d..24fc9a613 100644 --- a/tool/state-processor/src/util.rs +++ b/tool/state-processor/src/util.rs @@ -47,7 +47,7 @@ pub fn get_hashed_key(full_key: &str, item_key: &str) -> String { full_key.trim_start_matches(item_key).into() } -// twox128(pallet) + twox128(item) + *(item_key) -> account_id_32 +// twox128(pallet) + twox128(item) + *_concat(account_id_32) -> account_id_32 pub fn get_last_64_key(key: &str, _: &str) -> String { get_last_64(key) } @@ -73,6 +73,10 @@ pub fn is_evm_address(address: &[u8]) -> bool { && address[1..31].iter().fold(address[0], |checksum, &b| checksum ^ b) == address[31] } +pub fn key_to_account32(key: &str) -> [u8; 32] { + array_bytes::hex2array_unchecked(get_last_64(key)) +} + pub fn build_spec(chain: &str) -> Result<()> { log::info!("build {chain} spec"); From 77f399d410e161b37b4ca8d119ff38832a94c7a7 Mon Sep 17 00:00:00 2001 From: Guantong Date: Thu, 19 Jan 2023 14:21:47 +0800 Subject: [PATCH 112/189] Clean unused deps (#228) * Clean unused deps * Update messages-substrate deps * Try fix CI --- Cargo.lock | 29 +---------------------------- node/Cargo.toml | 8 -------- precompile/bls12-381/Cargo.toml | 2 -- runtime/pangolin/Cargo.toml | 4 ++++ 4 files changed, 5 insertions(+), 38 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 377b2abd4..6e9a7a434 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2203,7 +2203,6 @@ dependencies = [ "clap", "crab-runtime", "cumulus-client-cli", - "cumulus-client-collator", "cumulus-client-consensus-aura", "cumulus-client-consensus-common", "cumulus-client-network", @@ -2213,11 +2212,9 @@ dependencies = [ "cumulus-relay-chain-inprocess-interface", "cumulus-relay-chain-interface", "cumulus-relay-chain-minimal-node", - "cumulus-relay-chain-rpc-interface", "darwinia-runtime", "dc-primitives", "fc-cli", - "fc-consensus", "fc-db", "fc-mapping-sync", "fc-rpc", @@ -2234,7 +2231,6 @@ dependencies = [ "pangolin-runtime", "parity-scale-codec", "polkadot-cli", - "polkadot-parachain", "polkadot-primitives", "polkadot-service", "sc-basic-authorship", @@ -2244,12 +2240,10 @@ dependencies = [ "sc-consensus", "sc-consensus-aura", "sc-executor", - "sc-keystore", "sc-network", "sc-network-common", "sc-offchain", "sc-rpc", - "sc-rpc-api", "sc-service", "sc-sysinfo", "sc-telemetry", @@ -2263,8 +2257,6 @@ dependencies = [ "sp-consensus", "sp-consensus-aura", "sp-core", - "sp-inherents", - "sp-io", "sp-keystore", "sp-offchain", "sp-runtime", @@ -2433,7 +2425,6 @@ name = "darwinia-precompile-bls12-381" version = "6.0.0" dependencies = [ "fp-evm", - "frame-support", "frame-system", "milagro_bls", "pallet-balances", @@ -3273,25 +3264,6 @@ dependencies = [ "sp-runtime", ] -[[package]] -name = "fc-consensus" -version = "2.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.33#05ee2dbf537bf5bbcbc5b4785be62088034bdd58" -dependencies = [ - "async-trait", - "fc-db", - "fp-consensus", - "fp-rpc", - "sc-client-api", - "sc-consensus", - "sp-api", - "sp-block-builder", - "sp-blockchain", - "sp-consensus", - "sp-runtime", - "thiserror", -] - [[package]] name = "fc-db" version = "2.0.0-dev" @@ -7425,6 +7397,7 @@ dependencies = [ "pallet-bridge-dispatch", "pallet-bridge-grandpa", "pallet-bridge-messages", + "pallet-bridge-parachains", "pallet-collective", "pallet-democracy", "pallet-elections-phragmen", diff --git a/node/Cargo.toml b/node/Cargo.toml index 0aa5daf44..5aae74c63 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -25,7 +25,6 @@ serde = { version = "1.0", features = ["derive"] } # cumulus cumulus-client-cli = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.33" } -cumulus-client-collator = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.33" } cumulus-client-consensus-aura = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.33" } cumulus-client-consensus-common = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.33" } cumulus-client-network = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.33" } @@ -34,7 +33,6 @@ cumulus-primitives-core = { git = "https://github.com/paritytech cumulus-primitives-parachain-inherent = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.33" } cumulus-relay-chain-inprocess-interface = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.33" } cumulus-relay-chain-interface = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.33" } -cumulus-relay-chain-rpc-interface = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.33" } cumulus-relay-chain-minimal-node = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.33" } # darwinia @@ -45,7 +43,6 @@ pangolin-runtime = { path = "../runtime/pangolin" } # frontier fc-cli = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } -fc-consensus = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } fc-db = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } fc-mapping-sync = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } fc-rpc = { features = ["rpc_binary_search_estimate"], git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } @@ -56,7 +53,6 @@ fp-storage = { git = "https://github.com/darwinia-network/frontier", branch # polkadot polkadot-cli = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.33" } -polkadot-parachain = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.33" } polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.33" } polkadot-service = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.33" } xcm = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.33" } @@ -72,12 +68,10 @@ sc-client-api = { git = "https://github.com/paritytech/substrat sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } sc-consensus-aura = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } sc-executor = { features = ["wasmtime"], git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sc-keystore = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } sc-network = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } sc-network-common = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } sc-offchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } sc-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sc-rpc-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } sc-service = { features = ["wasmtime"], git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } sc-sysinfo = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } sc-telemetry = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } @@ -90,8 +84,6 @@ sp-blockchain = { git = "https://github.com/paritytech/substrat sp-consensus = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } sp-consensus-aura = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-inherents = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } sp-offchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } diff --git a/precompile/bls12-381/Cargo.toml b/precompile/bls12-381/Cargo.toml index 1aa0f2e18..a866b20b8 100644 --- a/precompile/bls12-381/Cargo.toml +++ b/precompile/bls12-381/Cargo.toml @@ -21,7 +21,6 @@ pallet-evm = { default-features = false, git = "https://github.com/darwinia-netw precompile-utils = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.33" } # substrate -frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } [dev-dependencies] @@ -51,6 +50,5 @@ std = [ "precompile-utils/std", # substrate - "frame-support/std", "sp-std/std", ] diff --git a/runtime/pangolin/Cargo.toml b/runtime/pangolin/Cargo.toml index 81831e951..bcb371fea 100644 --- a/runtime/pangolin/Cargo.toml +++ b/runtime/pangolin/Cargo.toml @@ -57,6 +57,7 @@ bridge-runtime-common = { default-features = false, git = "https://github.com/d pallet-bridge-dispatch = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.33" } pallet-bridge-grandpa = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.33" } pallet-bridge-messages = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.33" } +pallet-bridge-parachains = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.33" } pallet-fee-market = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.33" } # frontier @@ -176,6 +177,7 @@ std = [ "pallet-bridge-dispatch/std", "pallet-bridge-grandpa/std", "pallet-bridge-messages/std", + "pallet-bridge-parachains/std", "pallet-fee-market/std", # frontier @@ -261,6 +263,7 @@ runtime-benchmarks = [ "bridge-runtime-common/runtime-benchmarks", "pallet-bridge-grandpa/runtime-benchmarks", "pallet-bridge-messages/runtime-benchmarks", + "pallet-bridge-parachains/runtime-benchmarks", "pallet-fee-market/runtime-benchmarks", # frontier @@ -325,6 +328,7 @@ try-runtime = [ "pallet-bridge-dispatch/try-runtime", "pallet-bridge-grandpa/try-runtime", "pallet-bridge-messages/try-runtime", + "pallet-bridge-parachains/try-runtime", "pallet-fee-market/try-runtime", # frontier From a266d90dd0120d99d15c5aeadeb6423628323f3e Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Fri, 20 Jan 2023 00:52:54 +0800 Subject: [PATCH 113/189] Adapt PolkadotJS (#231) --- pallet/account-migration/src/lib.rs | 4 ++-- pallet/account-migration/src/tests.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pallet/account-migration/src/lib.rs b/pallet/account-migration/src/lib.rs index fa3f2bee3..964b8e6ea 100644 --- a/pallet/account-migration/src/lib.rs +++ b/pallet/account-migration/src/lib.rs @@ -334,13 +334,13 @@ pub enum ExistenceReason { /// Build a Darwinia account migration message. pub fn sr25519_signable_message(spec_name: &[u8], account_id_20: &AccountId20) -> Vec { [ - b"I authorize the migration to ", + b"I authorize the migration to ", array_bytes::bytes2hex("0x", account_id_20.0).as_bytes(), b", an unused address on ", spec_name, b". Sign this message to authorize using the Substrate key associated with the account on ", &spec_name[..spec_name.len() - 1], - b" that you wish to migrate.", + b" that you wish to migrate.", ] .concat() } diff --git a/pallet/account-migration/src/tests.rs b/pallet/account-migration/src/tests.rs index d8eb1842a..f4f033726 100644 --- a/pallet/account-migration/src/tests.rs +++ b/pallet/account-migration/src/tests.rs @@ -27,7 +27,7 @@ fn sr25519_signable_message_should_work() { assert_eq!( sr25519_signable_message(s.as_bytes(), &Default::default()), format!( - "I authorize the migration to {}, an unused address on {}. Sign this message to authorize using the Substrate key associated with the account on {} that you wish to migrate.", + "I authorize the migration to {}, an unused address on {}. Sign this message to authorize using the Substrate key associated with the account on {} that you wish to migrate.", "0x0000000000000000000000000000000000000000", s, &s[..s.len() - 1], From 8ba1ff7894588a540763c1c24fc74c3848b835fa Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Fri, 20 Jan 2023 01:22:26 +0800 Subject: [PATCH 114/189] Release Pangolin2 (#225) * Reorder * Adjust genesis * Typo --- node/src/chain_spec/mod.rs | 9 +++- node/src/chain_spec/pangolin.rs | 47 ++++++++++++++++----- node/src/command.rs | 2 +- runtime/crab/src/lib.rs | 74 ++++++++++++++++----------------- runtime/darwinia/src/lib.rs | 74 ++++++++++++++++----------------- runtime/pangolin/src/lib.rs | 64 ++++++++++++++-------------- 6 files changed, 151 insertions(+), 119 deletions(-) diff --git a/node/src/chain_spec/mod.rs b/node/src/chain_spec/mod.rs index bac865f6b..5f3478017 100644 --- a/node/src/chain_spec/mod.rs +++ b/node/src/chain_spec/mod.rs @@ -39,13 +39,20 @@ use sp_core::{Pair, Public}; // contracts. (PUSH1 0x00 PUSH1 0x00 REVERT) const REVERT_BYTECODE: [u8; 5] = [0x60, 0x00, 0x60, 0x00, 0xFD]; -// These are are testnet-only keys. +// These are devnet-only keys. const ALITH: &str = "0xf24FF3a9CF04c71Dbc94D0b566f7A27B94566cac"; const BALTATHAR: &str = "0x3Cd0A705a2DC65e5b1E1205896BaA2be8A07c6e0"; const CHARLETH: &str = "0x798d4Ba9baf0064Ec19eB4F0a1a45785ae9D6DFc"; const DOROTHY: &str = "0x773539d4Ac0e786233D90A233654ccEE26a613D9"; const ETHAN: &str = "0xFf64d3F6efE2317EE2807d223a0Bdc4c0c49dfDB"; const FAITH: &str = "0xC0F0f4ab324C46e55D02D0033343B4Be8A55532d"; +// These are testnet-only keys. +const C1: &str = "0x0eef9fabb6eb6fed2ab24a842931f8950426070a"; +const C1_AURA: &str = "0xeed007f04d568b2d3bf329945a48c21a8ed030c81ca1dce61ad41c916599f405"; +const C2: &str = "0xa858cde8f6cf178786578a3b0becf5c27d18300c"; +const C2_AURA: &str = "0x28273ae24cc6048c515e6bcaefe98cbfaa50c69290d70cf8eca1de3329015c2f"; +const C3: &str = "0x986b41d07776aa48f6d7a80caad49485f9a71714"; +const C3_AURA: &str = "0xe25d860707bd1b88b9851cf40df3af3368cd57e5e82824cabac9c75fe537600f"; const SUDO: &str = "0x2748def2f9c3cfbbb963002935bc6d2e1c36ce2e"; // The default XCM version to set in genesis config. diff --git a/node/src/chain_spec/pangolin.rs b/node/src/chain_spec/pangolin.rs index 3cf7f4ad0..c66c10cb0 100644 --- a/node/src/chain_spec/pangolin.rs +++ b/node/src/chain_spec/pangolin.rs @@ -34,7 +34,7 @@ use fp_evm::GenesisAccount; // substrate use sc_chain_spec::Properties; use sc_service::ChainType; -use sp_core::H160; +use sp_core::{crypto::UncheckedInto, H160}; /// Specialized `ChainSpec` for the normal parachain runtime. pub type ChainSpec = sc_service::GenericChainSpec; @@ -135,7 +135,6 @@ pub fn local_config() -> ChainSpec { } pub fn genesis_config() -> ChainSpec { - // TODO: update this before the final release ChainSpec::from_genesis( "Pangolin2", "pangolin2", @@ -149,7 +148,11 @@ pub fn genesis_config() -> ChainSpec { // Monetary stuff. balances: BalancesConfig { - balances: vec![(array_bytes::hex_n_into_unchecked(ALITH), 100_000_000 * UNIT)], + balances: vec![ + (array_bytes::hex_n_into_unchecked(C1), 10_000 * UNIT), + (array_bytes::hex_n_into_unchecked(C2), 10_000 * UNIT), + (array_bytes::hex_n_into_unchecked(C3), 10_000 * UNIT), + ], }, transaction_payment: Default::default(), assets: AssetsConfig { @@ -167,16 +170,38 @@ pub fn genesis_config() -> ChainSpec { // Consensus stuff. staking: StakingConfig { now: SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_millis(), - elapsed_time: 0, + elapsed_time: 11_516_352_020, collator_count: 3, - collators: vec![(array_bytes::hex_n_into_unchecked(ALITH), UNIT)], + collators: vec![ + (array_bytes::hex_n_into_unchecked(C1), UNIT), + (array_bytes::hex_n_into_unchecked(C2), UNIT), + (array_bytes::hex_n_into_unchecked(C3), UNIT), + ], }, session: SessionConfig { - keys: vec![( - array_bytes::hex_n_into_unchecked(ALITH), - array_bytes::hex_n_into_unchecked(ALITH), - session_keys(get_collator_keys_from_seed("Alice")), - )], + keys: vec![ + ( + array_bytes::hex_n_into_unchecked(C1), + array_bytes::hex_n_into_unchecked(C1), + session_keys( + array_bytes::hex2array_unchecked(C1_AURA).unchecked_into(), + ), + ), + ( + array_bytes::hex_n_into_unchecked(C2), + array_bytes::hex_n_into_unchecked(C2), + session_keys( + array_bytes::hex2array_unchecked(C2_AURA).unchecked_into(), + ), + ), + ( + array_bytes::hex_n_into_unchecked(C3), + array_bytes::hex_n_into_unchecked(C3), + session_keys( + array_bytes::hex2array_unchecked(C3_AURA).unchecked_into(), + ), + ), + ], }, aura: Default::default(), aura_ext: Default::default(), @@ -192,7 +217,7 @@ pub fn genesis_config() -> ChainSpec { treasury: Default::default(), // Utility stuff. - sudo: SudoConfig { key: Some(array_bytes::hex_n_into_unchecked(ALITH)) }, + sudo: SudoConfig { key: Some(array_bytes::hex_n_into_unchecked(SUDO)) }, // XCM stuff. polkadot_xcm: PolkadotXcmConfig { safe_xcm_version: Some(SAFE_XCM_VERSION) }, diff --git a/node/src/command.rs b/node/src/command.rs index bd9d6ce90..3692eb7a6 100644 --- a/node/src/command.rs +++ b/node/src/command.rs @@ -570,7 +570,7 @@ pub fn run() -> Result<()> { if config.role.is_authority() { "yes" } else { "no" } ); - if collator_options.relay_chain_rpc_url.is_some() && cli.relay_chain_args.len() > 0 { + if collator_options.relay_chain_rpc_url.is_some() && !cli.relay_chain_args.is_empty() { log::warn!("Detected relay chain node arguments together with --relay-chain-rpc-url. This command starts a minimal Polkadot node that only uses a network-related subset of all relay chain CLI options."); } diff --git a/runtime/crab/src/lib.rs b/runtime/crab/src/lib.rs index 411618b56..b71616cad 100644 --- a/runtime/crab/src/lib.rs +++ b/runtime/crab/src/lib.rs @@ -230,55 +230,55 @@ frame_support::construct_runtime! { // To keep balances consistent with the existing XCM configurations. Balances: pallet_balances = 5, TransactionPayment: pallet_transaction_payment = 6, - Assets: pallet_assets = 34, - Vesting: pallet_vesting = 20, - Deposit: darwinia_deposit = 40, - AccountMigration: darwinia_account_migration = 41, + Assets: pallet_assets = 7, + Vesting: pallet_vesting = 8, + Deposit: darwinia_deposit = 9, + AccountMigration: darwinia_account_migration = 10, // Consensus stuff. - Authorship: pallet_authorship = 7, - Staking: darwinia_staking = 8, - Session: pallet_session = 9, - Aura: pallet_aura = 10, - AuraExt: cumulus_pallet_aura_ext = 11, - MessageGadget: darwinia_message_gadget = 43, - EcdsaAuthority: darwinia_ecdsa_authority = 44, + Authorship: pallet_authorship = 11, + Staking: darwinia_staking = 12, + Session: pallet_session = 13, + Aura: pallet_aura = 14, + AuraExt: cumulus_pallet_aura_ext = 15, + MessageGadget: darwinia_message_gadget = 16, + EcdsaAuthority: darwinia_ecdsa_authority = 17, // Governance stuff. - Democracy: pallet_democracy = 12, - Council: pallet_collective:: = 13, - TechnicalCommittee: pallet_collective:: = 14, - PhragmenElection: pallet_elections_phragmen = 15, - TechnicalMembership: pallet_membership:: = 16, - Treasury: pallet_treasury = 17, - Tips: pallet_tips = 18, + Democracy: pallet_democracy = 18, + Council: pallet_collective:: = 19, + TechnicalCommittee: pallet_collective:: = 20, + PhragmenElection: pallet_elections_phragmen = 21, + TechnicalMembership: pallet_membership:: = 22, + Treasury: pallet_treasury = 23, + Tips: pallet_tips = 24, // Utility stuff. - Sudo: pallet_sudo = 19, - Utility: pallet_utility = 21, - Identity: pallet_identity = 22, - Scheduler: pallet_scheduler = 23, - Preimage: pallet_preimage = 24, - Proxy: pallet_proxy = 25, - Multisig: pallet_multisig = 26, + Sudo: pallet_sudo = 25, + Utility: pallet_utility = 26, + Identity: pallet_identity = 27, + Scheduler: pallet_scheduler = 28, + Preimage: pallet_preimage = 29, + Proxy: pallet_proxy = 30, + Multisig: pallet_multisig = 31, // XCM stuff. - XcmpQueue: cumulus_pallet_xcmp_queue = 27, - PolkadotXcm: pallet_xcm = 28, - CumulusXcm: cumulus_pallet_xcm = 29, - DmpQueue: cumulus_pallet_dmp_queue = 30, + XcmpQueue: cumulus_pallet_xcmp_queue = 32, + PolkadotXcm: pallet_xcm = 33, + CumulusXcm: cumulus_pallet_xcm = 34, + DmpQueue: cumulus_pallet_dmp_queue = 35, // EVM stuff. - Ethereum: pallet_ethereum = 31, - Evm: pallet_evm = 32, - MessageTransact: darwinia_message_transact = 39, + Ethereum: pallet_ethereum = 36, + Evm: pallet_evm = 37, + MessageTransact: darwinia_message_transact = 38, // S2S stuff. - BridgePolkadotGrandpa: pallet_bridge_grandpa:: = 35, - BridgePolkadotParachain: pallet_bridge_parachains:: = 42, - BridgeDarwiniaMessages: pallet_bridge_messages:: = 36, - BridgeDarwiniaDispatch: pallet_bridge_dispatch:: = 37, - DarwiniaFeeMarket: pallet_fee_market:: = 38 + BridgePolkadotGrandpa: pallet_bridge_grandpa:: = 39, + BridgePolkadotParachain: pallet_bridge_parachains:: = 40, + BridgeDarwiniaMessages: pallet_bridge_messages:: = 41, + BridgeDarwiniaDispatch: pallet_bridge_dispatch:: = 42, + DarwiniaFeeMarket: pallet_fee_market:: = 43 } } diff --git a/runtime/darwinia/src/lib.rs b/runtime/darwinia/src/lib.rs index 744347be8..d7106e742 100644 --- a/runtime/darwinia/src/lib.rs +++ b/runtime/darwinia/src/lib.rs @@ -230,55 +230,55 @@ frame_support::construct_runtime! { // To keep balances consistent with the existing XCM configurations. Balances: pallet_balances = 5, TransactionPayment: pallet_transaction_payment = 6, - Assets: pallet_assets = 34, - Vesting: pallet_vesting = 20, - Deposit: darwinia_deposit = 40, - AccountMigration: darwinia_account_migration = 41, + Assets: pallet_assets = 7, + Vesting: pallet_vesting = 8, + Deposit: darwinia_deposit = 9, + AccountMigration: darwinia_account_migration = 10, // Consensus stuff. - Authorship: pallet_authorship = 7, - Staking: darwinia_staking = 8, - Session: pallet_session = 9, - Aura: pallet_aura = 10, - AuraExt: cumulus_pallet_aura_ext = 11, - MessageGadget: darwinia_message_gadget = 43, - EcdsaAuthority: darwinia_ecdsa_authority = 44, + Authorship: pallet_authorship = 11, + Staking: darwinia_staking = 12, + Session: pallet_session = 13, + Aura: pallet_aura = 14, + AuraExt: cumulus_pallet_aura_ext = 15, + MessageGadget: darwinia_message_gadget = 16, + EcdsaAuthority: darwinia_ecdsa_authority = 17, // Governance stuff. - Democracy: pallet_democracy = 12, - Council: pallet_collective:: = 13, - TechnicalCommittee: pallet_collective:: = 14, - PhragmenElection: pallet_elections_phragmen = 15, - TechnicalMembership: pallet_membership:: = 16, - Treasury: pallet_treasury = 17, - Tips: pallet_tips = 18, + Democracy: pallet_democracy = 18, + Council: pallet_collective:: = 19, + TechnicalCommittee: pallet_collective:: = 20, + PhragmenElection: pallet_elections_phragmen = 21, + TechnicalMembership: pallet_membership:: = 22, + Treasury: pallet_treasury = 23, + Tips: pallet_tips = 24, // Utility stuff. - Sudo: pallet_sudo = 19, - Utility: pallet_utility = 21, - Identity: pallet_identity = 22, - Scheduler: pallet_scheduler = 23, - Preimage: pallet_preimage = 24, - Proxy: pallet_proxy = 25, - Multisig: pallet_multisig = 26, + Sudo: pallet_sudo = 25, + Utility: pallet_utility = 26, + Identity: pallet_identity = 27, + Scheduler: pallet_scheduler = 28, + Preimage: pallet_preimage = 29, + Proxy: pallet_proxy = 30, + Multisig: pallet_multisig = 31, // XCM stuff. - XcmpQueue: cumulus_pallet_xcmp_queue = 27, - PolkadotXcm: pallet_xcm = 28, - CumulusXcm: cumulus_pallet_xcm = 29, - DmpQueue: cumulus_pallet_dmp_queue = 30, + XcmpQueue: cumulus_pallet_xcmp_queue = 32, + PolkadotXcm: pallet_xcm = 33, + CumulusXcm: cumulus_pallet_xcm = 34, + DmpQueue: cumulus_pallet_dmp_queue = 35, // EVM stuff. - Ethereum: pallet_ethereum = 31, - Evm: pallet_evm = 32, - MessageTransact: darwinia_message_transact = 39, + Ethereum: pallet_ethereum = 36, + Evm: pallet_evm = 37, + MessageTransact: darwinia_message_transact = 38, // S2S stuff. - BridgeKusamaGrandpa: pallet_bridge_grandpa:: = 35, - BridgeKusamaParachain: pallet_bridge_parachains:: = 42, - BridgeCrabMessages: pallet_bridge_messages:: = 36, - BridgeCrabDispatch: pallet_bridge_dispatch:: = 37, - CrabFeeMarket: pallet_fee_market:: = 38 + BridgeKusamaGrandpa: pallet_bridge_grandpa:: = 39, + BridgeKusamaParachain: pallet_bridge_parachains:: = 40, + BridgeCrabMessages: pallet_bridge_messages:: = 41, + BridgeCrabDispatch: pallet_bridge_dispatch:: = 42, + CrabFeeMarket: pallet_fee_market:: = 43 } } diff --git a/runtime/pangolin/src/lib.rs b/runtime/pangolin/src/lib.rs index fce6f7df8..f1bf3edd2 100644 --- a/runtime/pangolin/src/lib.rs +++ b/runtime/pangolin/src/lib.rs @@ -227,48 +227,48 @@ frame_support::construct_runtime! { // To keep balances consistent with the existing XCM configurations. Balances: pallet_balances = 5, TransactionPayment: pallet_transaction_payment = 6, - Assets: pallet_assets = 34, - Vesting: pallet_vesting = 20, - Deposit: darwinia_deposit = 40, - AccountMigration: darwinia_account_migration = 41, + Assets: pallet_assets = 7, + Vesting: pallet_vesting = 8, + Deposit: darwinia_deposit = 9, + AccountMigration: darwinia_account_migration = 10, // Consensus stuff. - Authorship: pallet_authorship = 7, - Staking: darwinia_staking = 8, - Session: pallet_session = 9, - Aura: pallet_aura = 10, - AuraExt: cumulus_pallet_aura_ext = 11, - MessageGadget: darwinia_message_gadget = 42, - EcdsaAuthority: darwinia_ecdsa_authority = 43, + Authorship: pallet_authorship = 11, + Staking: darwinia_staking = 12, + Session: pallet_session = 13, + Aura: pallet_aura = 14, + AuraExt: cumulus_pallet_aura_ext = 15, + MessageGadget: darwinia_message_gadget = 16, + EcdsaAuthority: darwinia_ecdsa_authority = 17, // Governance stuff. - Democracy: pallet_democracy = 12, - Council: pallet_collective:: = 13, - TechnicalCommittee: pallet_collective:: = 14, - PhragmenElection: pallet_elections_phragmen = 15, - TechnicalMembership: pallet_membership:: = 16, - Treasury: pallet_treasury = 17, - Tips: pallet_tips = 18, + Democracy: pallet_democracy = 18, + Council: pallet_collective:: = 19, + TechnicalCommittee: pallet_collective:: = 20, + PhragmenElection: pallet_elections_phragmen = 21, + TechnicalMembership: pallet_membership:: = 22, + Treasury: pallet_treasury = 23, + Tips: pallet_tips = 24, // Utility stuff. - Sudo: pallet_sudo = 19, - Utility: pallet_utility = 21, - Identity: pallet_identity = 22, - Scheduler: pallet_scheduler = 23, - Preimage: pallet_preimage = 24, - Proxy: pallet_proxy = 25, - Multisig: pallet_multisig = 26, + Sudo: pallet_sudo = 25, + Utility: pallet_utility = 26, + Identity: pallet_identity = 27, + Scheduler: pallet_scheduler = 28, + Preimage: pallet_preimage = 29, + Proxy: pallet_proxy = 30, + Multisig: pallet_multisig = 31, // XCM stuff. - XcmpQueue: cumulus_pallet_xcmp_queue = 27, - PolkadotXcm: pallet_xcm = 28, - CumulusXcm: cumulus_pallet_xcm = 29, - DmpQueue: cumulus_pallet_dmp_queue = 30, + XcmpQueue: cumulus_pallet_xcmp_queue = 32, + PolkadotXcm: pallet_xcm = 33, + CumulusXcm: cumulus_pallet_xcm = 34, + DmpQueue: cumulus_pallet_dmp_queue = 35, // EVM stuff. - Ethereum: pallet_ethereum = 31, - Evm: pallet_evm = 32, - MessageTransact: darwinia_message_transact = 39, + Ethereum: pallet_ethereum = 36, + Evm: pallet_evm = 37, + MessageTransact: darwinia_message_transact = 38, } } From ff23cac1869f59c235b15ca7cfc8f1250fd16a66 Mon Sep 17 00:00:00 2001 From: bear Date: Sat, 28 Jan 2023 10:32:16 +0800 Subject: [PATCH 115/189] State types check (#230) * Check * Use type * Update processor files * Find others * Format * Default pangolin * Fix review --- tool/state-processor/src/balances/mod.rs | 8 +- tool/state-processor/src/identity/mod.rs | 4 +- tool/state-processor/src/indices/mod.rs | 2 +- tool/state-processor/src/main.rs | 2 +- tool/state-processor/src/proxy/mod.rs | 2 +- tool/state-processor/src/staking/mod.rs | 12 +-- tool/state-processor/src/system/mod.rs | 22 +++--- tool/state-processor/src/tests.rs | 5 +- tool/state-processor/src/type_registry.rs | 96 ++++++++++++----------- 9 files changed, 81 insertions(+), 72 deletions(-) diff --git a/tool/state-processor/src/balances/mod.rs b/tool/state-processor/src/balances/mod.rs index 996a85aef..13b23a0d6 100644 --- a/tool/state-processor/src/balances/mod.rs +++ b/tool/state-processor/src/balances/mod.rs @@ -4,15 +4,15 @@ use crate::*; type Locks = Vec; impl Processor { - pub fn process_balances(&mut self) -> (u128, u128) { + pub fn process_balances(&mut self) -> (Balance, Balance) { // Balances storage items. // https://github.dev/darwinia-network/substrate/blob/darwinia-v0.12.5/frame/balances/src/lib.rs#L486 - let mut solo_ring_total_issuance = u128::default(); - let mut solo_kton_total_issuance = u128::default(); + let mut solo_ring_total_issuance = Balance::default(); + let mut solo_kton_total_issuance = Balance::default(); let mut solo_ring_locks = >::default(); let mut solo_kton_locks = >::default(); - let mut para_ring_total_issuance = u128::default(); + let mut para_ring_total_issuance = Balance::default(); log::info!("take solo `Balances::TotalIssuance`, `Kton::TotalIssuance`, `Balances::Locks` and `Kton::Locks`"); self.solo_state diff --git a/tool/state-processor/src/identity/mod.rs b/tool/state-processor/src/identity/mod.rs index f0e991290..846214122 100644 --- a/tool/state-processor/src/identity/mod.rs +++ b/tool/state-processor/src/identity/mod.rs @@ -5,8 +5,8 @@ impl Processor { /// Only care about the solo chain, since parachains don't have identity now. pub fn process_identity(&mut self) -> &mut Self { let mut identities = >::default(); - let mut registrars = Vec::>>::default(); - let mut subs_of = Map::<(u128, Vec<[u8; 32]>)>::default(); + let mut registrars = Vec::>>::default(); + let mut subs_of = Map::<(Balance, Vec)>::default(); log::info!("take `Identity::IdentityOf`, `Identity::Registrars`, `Identity::SuperOf` and `Identity::SuperOf`"); self.solo_state diff --git a/tool/state-processor/src/indices/mod.rs b/tool/state-processor/src/indices/mod.rs index c9222fed1..c94a497db 100644 --- a/tool/state-processor/src/indices/mod.rs +++ b/tool/state-processor/src/indices/mod.rs @@ -5,7 +5,7 @@ impl Processor { pub fn process_indices(&mut self) -> &mut Self { // Storage items. // https://github.dev/darwinia-network/substrate/blob/darwinia-v0.12.5/frame/indices/src/lib.rs#L291 - let mut accounts = >::default(); + let mut accounts = >::default(); log::info!("take solo `Indices::Accounts`"); self.solo_state.take_map(b"Indices", b"Accounts", &mut accounts, get_identity_key); diff --git a/tool/state-processor/src/main.rs b/tool/state-processor/src/main.rs index dfd87f57f..f202d211d 100644 --- a/tool/state-processor/src/main.rs +++ b/tool/state-processor/src/main.rs @@ -33,7 +33,7 @@ fn main() -> Result<()> { std::env::set_var("RUST_LOG", "state_processor"); pretty_env_logger::init(); - // >::new()?.process()?; + // >::new()?.process()?; >::new()?.test().process()?; // >::new()?.process()?; // >::new()?.process()?; diff --git a/tool/state-processor/src/proxy/mod.rs b/tool/state-processor/src/proxy/mod.rs index 080e6ed75..5ca073470 100644 --- a/tool/state-processor/src/proxy/mod.rs +++ b/tool/state-processor/src/proxy/mod.rs @@ -13,7 +13,7 @@ impl Processor { } // The size of encoded `pallet_proxy::ProxyDefinition` is 37 bytes. - let mut proxies = , u128)>>::default(); + let mut proxies = , Balance)>>::default(); log::info!("take solo `Proxy::Proxies`"); self.solo_state.take_map(b"Proxy", b"Proxies", &mut proxies, get_identity_key); diff --git a/tool/state-processor/src/staking/mod.rs b/tool/state-processor/src/staking/mod.rs index eebfa9478..1cdd19539 100644 --- a/tool/state-processor/src/staking/mod.rs +++ b/tool/state-processor/src/staking/mod.rs @@ -6,10 +6,10 @@ impl Processor { // Storage items. // https://github.dev/darwinia-network/darwinia-common/blob/darwinia-v0.12.5/frame/staking/src/lib.rs#L560 let mut ledgers = >::default(); - let mut ring_pool_storage = u128::default(); - let mut kton_pool_storage = u128::default(); - let mut ring_pool = u128::default(); - let mut kton_pool = u128::default(); + let mut ring_pool_storage = Balance::default(); + let mut kton_pool_storage = Balance::default(); + let mut ring_pool = Balance::default(); + let mut kton_pool = Balance::default(); let mut elapsed_time = u64::default(); log::info!("take solo `Staking::Ledger`, `Staking::RingPool`, `Staking::KtonPool` and `Staking::LivingTime`"); @@ -33,7 +33,7 @@ impl Processor { let mut staked_deposits = Vec::default(); if !v.deposit_items.is_empty() { - let mut deposit_ring = u128::default(); + let mut deposit_ring = Balance::default(); self.shell_state.insert_raw_key_value( deposit_k, @@ -102,7 +102,7 @@ impl Processor { ); log::info!("set `Staking::ElapsedTime`"); - self.shell_state.insert_value(b"Staking", b"ElapsedTime", "", elapsed_time as u128); + self.shell_state.insert_value(b"Staking", b"ElapsedTime", "", elapsed_time as Moment); self } diff --git a/tool/state-processor/src/system/mod.rs b/tool/state-processor/src/system/mod.rs index cd7c1470a..463c1c171 100644 --- a/tool/state-processor/src/system/mod.rs +++ b/tool/state-processor/src/system/mod.rs @@ -6,14 +6,14 @@ use crate::*; #[derive(Debug)] pub struct AccountAll { pub nonce: u32, - pub consumers: u32, - pub providers: u32, - pub sufficients: u32, - pub ring: u128, - pub ring_reserved: u128, + pub consumers: RefCount, + pub providers: RefCount, + pub sufficients: RefCount, + pub ring: Balance, + pub ring_reserved: Balance, pub ring_locks: Vec, - pub kton: u128, - pub kton_reserved: u128, + pub kton: Balance, + pub kton_reserved: Balance, pub kton_locks: Vec, } @@ -29,8 +29,8 @@ where let (ring_total_issuance_storage, kton_total_issuance_storage) = self.process_balances(); let (solo_validators, para_collators) = self.process_session(); let mut accounts = Map::default(); - let mut ring_total_issuance = u128::default(); - let mut kton_total_issuance = u128::default(); + let mut ring_total_issuance = Balance::default(); + let mut kton_total_issuance = Balance::default(); // Skip for testnets, due to https://github.com/paritytech/substrate/issues/13172. // log::info!("decrease solo pallet-session account references"); @@ -269,7 +269,7 @@ where } } -fn try_get_evm_address(key: &str) -> Option<[u8; 20]> { +fn try_get_evm_address(key: &str) -> Option { let k = array_bytes::hex2bytes_unchecked(key); if is_evm_address(&k) { @@ -282,7 +282,7 @@ fn try_get_evm_address(key: &str) -> Option<[u8; 20]> { fn new_kton_account( account_info: &mut AccountInfo, asset_details: &mut AssetDetails, - balance: u128, + balance: Balance, ) -> AssetAccount { account_info.sufficients += 1; asset_details.accounts += 1; diff --git a/tool/state-processor/src/tests.rs b/tool/state-processor/src/tests.rs index 206d52a4a..c69b8326f 100644 --- a/tool/state-processor/src/tests.rs +++ b/tool/state-processor/src/tests.rs @@ -8,8 +8,8 @@ use crate::*; struct Tester { // solo chain solo_accounts: Map, - solo_remaining_ring: Map, - solo_remaining_kton: Map, + solo_remaining_ring: Map, + solo_remaining_kton: Map, solo_evm_codes: Map>, // para chain para_accounts: Map, @@ -467,6 +467,7 @@ fn deposit_items_migrate() { assert_eq!(migrated_deposits.len(), ledger.deposit_items.len()); ledger.deposit_items.iter().zip(migrated_deposits.iter()).for_each(|(old, new)| { assert_eq!(new.value, old.value * GWEI); + assert_eq!(new.start_time, old.start_time as u128); assert_eq!(new.expired_time, old.expire_time as u128); assert!(new.in_use); }); diff --git a/tool/state-processor/src/type_registry.rs b/tool/state-processor/src/type_registry.rs index 0c4cdeda4..7060071eb 100644 --- a/tool/state-processor/src/type_registry.rs +++ b/tool/state-processor/src/type_registry.rs @@ -4,26 +4,34 @@ use std::iter::once; use enumflags2::{bitflags, BitFlags}; use parity_scale_codec::{Decode, Encode, EncodeLike, Error, Input}; +pub type Balance = u128; +pub type AccountId20 = [u8; 20]; +pub type AccountId32 = [u8; 32]; +pub type BlockNumber = u32; +pub type RefCount = u32; +pub type Moment = u128; +pub type DepositId = u16; + #[derive(Default, Debug, PartialEq, Eq, Encode, Decode)] pub struct AccountInfo { pub nonce: u32, - pub consumers: u32, - pub providers: u32, - pub sufficients: u32, + pub consumers: RefCount, + pub providers: RefCount, + pub sufficients: RefCount, pub data: AccountData, } #[derive(Default, Debug, PartialEq, Eq, Encode, Decode)] pub struct AccountData { - pub free: u128, - pub reserved: u128, - pub free_kton_or_misc_frozen: u128, - pub reserved_kton_or_fee_frozen: u128, + pub free: Balance, + pub reserved: Balance, + pub free_kton_or_misc_frozen: Balance, + pub reserved_kton_or_fee_frozen: Balance, } #[derive(Default, Debug, Encode, Decode)] pub struct BalanceLock { pub id: [u8; 8], - pub amount: u128, + pub amount: Balance, pub reasons: Reasons, } @@ -43,13 +51,13 @@ impl Default for Reasons { // https://github.dev/paritytech/substrate/blob/polkadot-v0.9.30/frame/assets/src/types.rs#L33 #[derive(Default, Debug, Encode, Decode)] pub struct AssetDetails { - pub owner: [u8; 20], - pub issuer: [u8; 20], - pub admin: [u8; 20], - pub freezer: [u8; 20], - pub supply: u128, - pub deposit: u128, - pub min_balance: u128, + pub owner: AccountId20, + pub issuer: AccountId20, + pub admin: AccountId20, + pub freezer: AccountId20, + pub supply: Balance, + pub deposit: Balance, + pub min_balance: Balance, pub is_sufficient: bool, pub accounts: u32, pub sufficients: u32, @@ -60,7 +68,7 @@ pub struct AssetDetails { // https://github.dev/paritytech/substrate/blob/polkadot-v0.9.30/frame/assets/src/types.rs#L115 #[derive(Default, Debug, Encode, Decode)] pub struct AssetAccount { - pub balance: u128, + pub balance: Balance, pub is_frozen: bool, pub reason: ExistenceReason, pub extra: (), @@ -74,7 +82,7 @@ pub enum ExistenceReason { #[codec(index = 1)] Sufficient, #[codec(index = 2)] - DepositHeld(u128), + DepositHeld(Balance), #[codec(index = 3)] DepositRefunded, } @@ -87,14 +95,14 @@ impl Default for ExistenceReason { // https://github.dev/paritytech/substrate/blob/polkadot-v0.9.30/frame/assets/src/types.rs#L73 #[derive(Debug, Encode, Decode)] pub struct Approval { - pub amount: u128, - pub deposit: u128, + pub amount: Balance, + pub deposit: Balance, } // https://github.dev/paritytech/substrate/blob/polkadot-v0.9.30/frame/assets/src/types.rs#L127 #[derive(Clone, Default, Encode, Decode)] pub struct AssetMetadata { - pub deposit: u128, + pub deposit: Balance, pub name: Vec, pub symbol: Vec, pub decimals: u8, @@ -103,29 +111,29 @@ pub struct AssetMetadata { #[derive(Default, Debug, Encode, Decode)] pub struct VestingInfo { - pub locked: u128, - pub per_block: u128, - pub starting_block: u32, + pub locked: Balance, + pub per_block: Balance, + pub starting_block: BlockNumber, } #[derive(Default, Debug, Encode, Decode)] pub struct Deposit { - pub id: u16, - pub value: u128, - pub start_time: u128, - pub expired_time: u128, + pub id: DepositId, + pub value: Balance, + pub start_time: Moment, + pub expired_time: Moment, pub in_use: bool, } #[derive(Default, Debug, Encode, Decode)] pub struct StakingLedger { - pub stash: [u8; 32], + pub stash: AccountId32, #[codec(compact)] - pub active: u128, + pub active: Balance, #[codec(compact)] - pub active_deposit_ring: u128, + pub active_deposit_ring: Balance, #[codec(compact)] - pub active_kton: u128, + pub active_kton: Balance, pub deposit_items: Vec, pub ring_staking_lock: StakingLock, pub kton_staking_lock: StakingLock, @@ -134,7 +142,7 @@ pub struct StakingLedger { #[derive(Default, Debug, Encode, Decode)] pub struct TimeDepositItem { #[codec(compact)] - pub value: u128, + pub value: Balance, #[codec(compact)] pub start_time: u64, #[codec(compact)] @@ -142,29 +150,29 @@ pub struct TimeDepositItem { } #[derive(Default, Debug, Encode, Decode)] pub struct StakingLock { - pub staking_amount: u128, + pub staking_amount: Balance, pub unbondings: Vec, } #[derive(Default, Debug, Encode, Decode)] pub struct Unbonding { - pub amount: u128, - pub until: u32, + pub amount: Balance, + pub until: BlockNumber, } #[derive(Default, Debug, Encode, Decode)] pub struct Ledger { - pub staked_ring: u128, - pub staked_kton: u128, - pub staked_deposits: Vec, - pub unstaking_ring: Vec<(u128, u32)>, - pub unstaking_kton: Vec<(u128, u32)>, - pub unstaking_deposits: Vec<(u16, u32)>, + pub staked_ring: Balance, + pub staked_kton: Balance, + pub staked_deposits: Vec, + pub unstaking_ring: Vec<(Balance, BlockNumber)>, + pub unstaking_kton: Vec<(Balance, BlockNumber)>, + pub unstaking_deposits: Vec<(DepositId, BlockNumber)>, } #[derive(Default, Debug, Encode)] pub struct Registration { pub judgements: Vec<(u32, Judgement)>, - pub deposit: u128, + pub deposit: Balance, pub info: IdentityInfo, } impl Decode for Registration { @@ -176,7 +184,7 @@ impl Decode for Registration { #[derive(Debug, PartialEq, Eq, Encode, Decode)] pub enum Judgement { Unknown, - FeePaid(u128), + FeePaid(Balance), Reasonable, KnownGood, OutOfDate, @@ -288,7 +296,7 @@ impl<'a, T: Input> Input for AppendZerosInput<'a, T> { #[derive(Debug, Encode, Decode, PartialEq, Eq)] pub struct RegistrarInfo { pub account: A, - pub fee: u128, + pub fee: Balance, pub fields: IdentityFields, } #[derive(Debug, PartialEq, Eq)] From 14f9bebef2c8359aea46187040da2d3d32bea175 Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Sun, 29 Jan 2023 12:41:13 +0800 Subject: [PATCH 116/189] Account migration signer tool (#235) * Doc * Bump version for devnet * Account migration signer tool * Doc --- pallet/account-migration/src/lib.rs | 4 + runtime/pangolin/src/lib.rs | 2 +- tool/am-signer/.editorconfig | 21 + tool/am-signer/.gitignore | 15 + tool/am-signer/.rustfmt.toml | 29 + tool/am-signer/Cargo.lock | 2553 +++++++++++++++++++++++++++ tool/am-signer/Cargo.toml | 16 + tool/am-signer/README.md | 11 + tool/am-signer/rust-toolchain.toml | 5 + tool/am-signer/src/main.rs | 52 + 10 files changed, 2707 insertions(+), 1 deletion(-) create mode 100644 tool/am-signer/.editorconfig create mode 100644 tool/am-signer/.gitignore create mode 100644 tool/am-signer/.rustfmt.toml create mode 100644 tool/am-signer/Cargo.lock create mode 100644 tool/am-signer/Cargo.toml create mode 100644 tool/am-signer/README.md create mode 100644 tool/am-signer/rust-toolchain.toml create mode 100644 tool/am-signer/src/main.rs diff --git a/pallet/account-migration/src/lib.rs b/pallet/account-migration/src/lib.rs index 964b8e6ea..04e496b56 100644 --- a/pallet/account-migration/src/lib.rs +++ b/pallet/account-migration/src/lib.rs @@ -334,7 +334,11 @@ pub enum ExistenceReason { /// Build a Darwinia account migration message. pub fn sr25519_signable_message(spec_name: &[u8], account_id_20: &AccountId20) -> Vec { [ + // https://github.com/polkadot-js/common/issues/1710 b"I authorize the migration to ", + // Ignore the EIP-55 here. + // + // Must call the `to_lowercase` on front end. array_bytes::bytes2hex("0x", account_id_20.0).as_bytes(), b", an unused address on ", spec_name, diff --git a/runtime/pangolin/src/lib.rs b/runtime/pangolin/src/lib.rs index f1bf3edd2..85befb0c5 100644 --- a/runtime/pangolin/src/lib.rs +++ b/runtime/pangolin/src/lib.rs @@ -100,7 +100,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: sp_runtime::create_runtime_str!("Pangolin2"), impl_name: sp_runtime::create_runtime_str!("DarwiniaOfficialRust"), authoring_version: 0, - spec_version: 6_0_0_1, + spec_version: 6_0_0_2, impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 0, diff --git a/tool/am-signer/.editorconfig b/tool/am-signer/.editorconfig new file mode 100644 index 000000000..7a124a295 --- /dev/null +++ b/tool/am-signer/.editorconfig @@ -0,0 +1,21 @@ +root = true + +[*] +charset=utf-8 +end_of_line=lf +indent_size=tab +indent_style=tab +insert_final_newline=true +max_line_length=100 +tab_width=4 +trim_trailing_whitespace=true + +[*.py] +charset=utf-8 +indent_size=4 +indent_style=space + +[*.{sh,yml,yaml}] +indent_size=2 +indent_style=space +tab_width=8 diff --git a/tool/am-signer/.gitignore b/tool/am-signer/.gitignore new file mode 100644 index 000000000..a9a20e83c --- /dev/null +++ b/tool/am-signer/.gitignore @@ -0,0 +1,15 @@ +# System +.DS_Store + +# Integrated Development Environment +.idea +.vscode + +# Package Manager +## cargo +target +## npm +node_modules + +# Test data +test-data diff --git a/tool/am-signer/.rustfmt.toml b/tool/am-signer/.rustfmt.toml new file mode 100644 index 000000000..8f17dfe50 --- /dev/null +++ b/tool/am-signer/.rustfmt.toml @@ -0,0 +1,29 @@ +# Basic +edition = "2021" +hard_tabs = true +max_width = 100 +tab_spaces = 4 + +# Imports +imports_granularity = "Crate" +reorder_imports = true + +# Format comments +comment_width = 100 +wrap_comments = true + +# Misc +match_arm_blocks = false +match_block_trailing_comma = true +newline_style = "Unix" +reorder_impl_items = true +reorder_modules = true +use_field_init_shorthand = true +use_small_heuristics = "Max" + +# Wait for stablization +# format_code_in_doc_comments = true + +# Could give it a try +# group_imports = "StdExternalCrate" +# inline_attribute_width = 100 diff --git a/tool/am-signer/Cargo.lock b/tool/am-signer/Cargo.lock new file mode 100644 index 000000000..1c4f14d10 --- /dev/null +++ b/tool/am-signer/Cargo.lock @@ -0,0 +1,2553 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "Inflector" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" +dependencies = [ + "lazy_static", + "regex", +] + +[[package]] +name = "addr2line" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9ecd88a8c8378ca913a680cd98f0f13ac67383d35993f86c90a70e3f137816b" +dependencies = [ + "gimli", +] + +[[package]] +name = "ahash" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" +dependencies = [ + "getrandom 0.2.8", + "once_cell", + "version_check", +] + +[[package]] +name = "aho-corasick" +version = "0.7.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac" +dependencies = [ + "memchr", +] + +[[package]] +name = "am-signer" +version = "0.0.0" +dependencies = [ + "array-bytes 6.0.0", + "clap", + "sp-core", +] + +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + +[[package]] +name = "ansi_term" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" +dependencies = [ + "winapi", +] + +[[package]] +name = "anyhow" +version = "1.0.68" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2cb2f989d18dd141ab8ae82f64d1a8cdd37e0840f73a406896cf5e99502fab61" + +[[package]] +name = "array-bytes" +version = "4.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f52f63c5c1316a16a4b35eaac8b76a98248961a533f061684cb2a7cb0eafb6c6" + +[[package]] +name = "array-bytes" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22f72e9d6fac4bc80778ea470b20197b88d28c292bb7d60c3fb099280003cd19" + +[[package]] +name = "arrayref" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" + +[[package]] +name = "arrayvec" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" + +[[package]] +name = "arrayvec" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" + +[[package]] +name = "autocfg" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + +[[package]] +name = "base58" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6107fe1be6682a68940da878d9e9f5e90ca5745b3dec9fd1bb393c8777d4f581" + +[[package]] +name = "base64" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" + +[[package]] +name = "bincode" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" +dependencies = [ + "serde", +] + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitvec" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c" +dependencies = [ + "funty", + "radium", + "tap", + "wyz", +] + +[[package]] +name = "blake2" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" +dependencies = [ + "digest 0.10.6", +] + +[[package]] +name = "block-buffer" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" +dependencies = [ + "block-padding", + "byte-tools", + "byteorder", + "generic-array 0.12.4", +] + +[[package]] +name = "block-buffer" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" +dependencies = [ + "generic-array 0.14.6", +] + +[[package]] +name = "block-buffer" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cce20737498f97b993470a6e536b8523f0af7892a4f928cceb1ac5e52ebe7e" +dependencies = [ + "generic-array 0.14.6", +] + +[[package]] +name = "block-padding" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5" +dependencies = [ + "byte-tools", +] + +[[package]] +name = "bumpalo" +version = "3.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d261e256854913907f67ed06efbc3338dfe6179796deefc1ff763fc1aee5535" + +[[package]] +name = "byte-slice-cast" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c" + +[[package]] +name = "byte-tools" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" + +[[package]] +name = "byteorder" +version = "1.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" + +[[package]] +name = "bytes" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfb24e866b15a1af2a1b663f10c6b6b8f397a84aadb828f12e5b289ec23a3a3c" + +[[package]] +name = "cc" +version = "1.0.79" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "chrono" +version = "0.4.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16b0a3d9ed01224b22057780a37bb8c5dbfe1be8ba48678e7bf57ec4b385411f" +dependencies = [ + "iana-time-zone", + "num-integer", + "num-traits", + "winapi", +] + +[[package]] +name = "clap" +version = "4.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f13b9c79b5d1dd500d20ef541215a6423c75829ef43117e1b4d17fd8af0b5d76" +dependencies = [ + "bitflags", + "clap_derive", + "clap_lex", + "is-terminal", + "once_cell", + "strsim", + "termcolor", +] + +[[package]] +name = "clap_derive" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "684a277d672e91966334af371f1a7b5833f9aa00b07c84e92fbce95e00208ce8" +dependencies = [ + "heck", + "proc-macro-error", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "clap_lex" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "783fe232adfca04f90f56201b26d79682d4cd2625e0bc7290b95123afe558ade" +dependencies = [ + "os_str_bytes", +] + +[[package]] +name = "codespan-reporting" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e" +dependencies = [ + "termcolor", + "unicode-width", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" + +[[package]] +name = "cpp_demangle" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eeaa953eaad386a53111e47172c2fedba671e5684c8dd601a5f474f4f118710f" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "cpufeatures" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28d997bd5e24a5928dd43e46dc529867e207907fe0b239c3477d924f7f2ca320" +dependencies = [ + "libc", +] + +[[package]] +name = "cranelift-entity" +version = "0.88.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87a0f1b2fdc18776956370cf8d9b009ded3f855350c480c1c52142510961f352" +dependencies = [ + "serde", +] + +[[package]] +name = "crc32fast" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "crunchy" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array 0.14.6", + "typenum", +] + +[[package]] +name = "crypto-mac" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1d1a86f49236c215f271d40892d5fc950490551400b02ef360692c29815c714" +dependencies = [ + "generic-array 0.14.6", + "subtle", +] + +[[package]] +name = "curve25519-dalek" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a9b85542f99a2dfa2a1b8e192662741c9859a846b296bef1c92ef9b58b5a216" +dependencies = [ + "byteorder", + "digest 0.8.1", + "rand_core 0.5.1", + "subtle", + "zeroize", +] + +[[package]] +name = "curve25519-dalek" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b9fdf9972b2bd6af2d913799d9ebc165ea4d2e65878e329d9c6b372c4491b61" +dependencies = [ + "byteorder", + "digest 0.9.0", + "rand_core 0.5.1", + "subtle", + "zeroize", +] + +[[package]] +name = "cxx" +version = "1.0.88" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "322296e2f2e5af4270b54df9e85a02ff037e271af20ba3e7fe1575515dc840b8" +dependencies = [ + "cc", + "cxxbridge-flags", + "cxxbridge-macro", + "link-cplusplus", +] + +[[package]] +name = "cxx-build" +version = "1.0.88" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "017a1385b05d631e7875b1f151c9f012d37b53491e2a87f65bff5c262b2111d8" +dependencies = [ + "cc", + "codespan-reporting", + "once_cell", + "proc-macro2", + "quote", + "scratch", + "syn", +] + +[[package]] +name = "cxxbridge-flags" +version = "1.0.88" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c26bbb078acf09bc1ecda02d4223f03bdd28bd4874edcb0379138efc499ce971" + +[[package]] +name = "cxxbridge-macro" +version = "1.0.88" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "357f40d1f06a24b60ae1fe122542c1fb05d28d32acb2aed064e84bc2ad1e252e" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "derive_more" +version = "0.99.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "digest" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" +dependencies = [ + "generic-array 0.12.4", +] + +[[package]] +name = "digest" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" +dependencies = [ + "generic-array 0.14.6", +] + +[[package]] +name = "digest" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f" +dependencies = [ + "block-buffer 0.10.3", + "crypto-common", + "subtle", +] + +[[package]] +name = "downcast-rs" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" + +[[package]] +name = "dyn-clonable" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e9232f0e607a262ceb9bd5141a3dfb3e4db6994b31989bbfd845878cba59fd4" +dependencies = [ + "dyn-clonable-impl", + "dyn-clone", +] + +[[package]] +name = "dyn-clonable-impl" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "558e40ea573c374cf53507fd240b7ee2f5477df7cfebdb97323ec61c719399c5" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "dyn-clone" +version = "1.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9b0705efd4599c15a38151f4721f7bc388306f61084d3bfd50bd07fbca5cb60" + +[[package]] +name = "ed25519-zebra" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c24f403d068ad0b359e577a77f92392118be3f3c927538f2bb544a5ecd828c6" +dependencies = [ + "curve25519-dalek 3.2.0", + "hashbrown", + "hex", + "rand_core 0.6.4", + "sha2 0.9.9", + "zeroize", +] + +[[package]] +name = "environmental" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e48c92028aaa870e83d51c64e5d4e0b6981b360c522198c23959f219a4e1b15b" + +[[package]] +name = "errno" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1" +dependencies = [ + "errno-dragonfly", + "libc", + "winapi", +] + +[[package]] +name = "errno-dragonfly" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" +dependencies = [ + "cc", + "libc", +] + +[[package]] +name = "fake-simd" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" + +[[package]] +name = "fallible-iterator" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" + +[[package]] +name = "fixed-hash" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "835c052cb0c08c1acf6ffd71c022172e18723949c8282f2b9f27efbc51e64534" +dependencies = [ + "byteorder", + "rand 0.8.5", + "rustc-hex", + "static_assertions", +] + +[[package]] +name = "funty" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" + +[[package]] +name = "futures" +version = "0.3.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38390104763dc37a5145a53c29c63c1290b5d316d6086ec32c293f6736051bb0" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52ba265a92256105f45b719605a571ffe2d1f0fea3807304b522c1d778f79eed" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04909a7a7e4633ae6c4a9ab280aeb86da1236243a77b694a49eacd659a4bd3ac" + +[[package]] +name = "futures-executor" +version = "0.3.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7acc85df6714c176ab5edf386123fafe217be88c0840ec11f199441134a074e2" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", + "num_cpus", +] + +[[package]] +name = "futures-io" +version = "0.3.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00f5fb52a06bdcadeb54e8d3671f8888a39697dcb0b81b23b55174030427f4eb" + +[[package]] +name = "futures-macro" +version = "0.3.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bdfb8ce053d86b91919aad980c220b1fb8401a9394410e1c289ed7e66b61835d" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "futures-sink" +version = "0.3.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39c15cf1a4aa79df40f1bb462fb39676d0ad9e366c2a33b590d7c66f4f81fcf9" + +[[package]] +name = "futures-task" +version = "0.3.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ffb393ac5d9a6eaa9d3fdf37ae2776656b706e200c8e16b1bdb227f5198e6ea" + +[[package]] +name = "futures-util" +version = "0.3.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "197676987abd2f9cadff84926f410af1c183608d36641465df73ae8211dc65d6" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "slab", +] + +[[package]] +name = "generic-array" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffdf9f34f1447443d37393cc6c2b8313aebddcd96906caf34e54c68d8e57d7bd" +dependencies = [ + "typenum", +] + +[[package]] +name = "generic-array" +version = "0.14.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bff49e947297f3312447abdca79f45f4738097cc82b06e72054d2223f601f1b9" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" +dependencies = [ + "cfg-if", + "libc", + "wasi 0.9.0+wasi-snapshot-preview1", +] + +[[package]] +name = "getrandom" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" +dependencies = [ + "cfg-if", + "libc", + "wasi 0.11.0+wasi-snapshot-preview1", +] + +[[package]] +name = "gimli" +version = "0.26.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22030e2c5a68ec659fde1e949a745124b48e6fa8b045b7ed5bd1fe4ccc5c4e5d" +dependencies = [ + "fallible-iterator", + "stable_deref_trait", +] + +[[package]] +name = "hash-db" +version = "0.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d23bd4e7b5eda0d0f3a307e8b381fdc8ba9000f26fbe912250c0a4cc3956364a" + +[[package]] +name = "hash256-std-hasher" +version = "0.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92c171d55b98633f4ed3860808f004099b36c1cc29c42cfc53aa8591b21efcf2" +dependencies = [ + "crunchy", +] + +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +dependencies = [ + "ahash", +] + +[[package]] +name = "heck" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9" + +[[package]] +name = "hermit-abi" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" +dependencies = [ + "libc", +] + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "hmac" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a2a2320eb7ec0ebe8da8f744d7812d9fc4cb4d09344ac01898dbcb6a20ae69b" +dependencies = [ + "crypto-mac", + "digest 0.9.0", +] + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest 0.10.6", +] + +[[package]] +name = "iana-time-zone" +version = "0.1.53" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64c122667b287044802d6ce17ee2ddf13207ed924c712de9a66a5814d5b64765" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "wasm-bindgen", + "winapi", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0703ae284fc167426161c2e3f1da3ea71d94b21bedbcc9494e92b28e334e3dca" +dependencies = [ + "cxx", + "cxx-build", +] + +[[package]] +name = "impl-codec" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba6a270039626615617f3f36d15fc827041df3b78c439da2cadfa47455a77f2f" +dependencies = [ + "parity-scale-codec", +] + +[[package]] +name = "impl-serde" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc88fc67028ae3db0c853baa36269d398d5f45b6982f95549ff5def78c935cd" +dependencies = [ + "serde", +] + +[[package]] +name = "impl-trait-for-tuples" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11d7a9f6330b71fea57921c9b61c47ee6e84f72d394754eff6163ae67e7395eb" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "indexmap" +version = "1.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399" +dependencies = [ + "autocfg", + "hashbrown", + "serde", +] + +[[package]] +name = "io-lifetimes" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ce5ef949d49ee85593fc4d3f3f95ad61657076395cbbce23e2121fc5542074" + +[[package]] +name = "io-lifetimes" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7d6c6f8c91b4b9ed43484ad1a938e393caf35960fce7f82a040497207bd8e9e" +dependencies = [ + "libc", + "windows-sys 0.42.0", +] + +[[package]] +name = "is-terminal" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28dfb6c8100ccc63462345b67d1bbc3679177c75ee4bf59bf29c8b1d110b8189" +dependencies = [ + "hermit-abi", + "io-lifetimes 1.0.4", + "rustix 0.36.7", + "windows-sys 0.42.0", +] + +[[package]] +name = "itoa" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fad582f4b9e86b6caa621cabeb0963332d92eea04729ab12892c2533951e6440" + +[[package]] +name = "js-sys" +version = "0.3.60" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49409df3e3bf0856b916e2ceaca09ee28e6871cf7d9ce97a692cacfdb2a25a47" +dependencies = [ + "wasm-bindgen", +] + +[[package]] +name = "keccak" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3afef3b6eff9ce9d8ff9b3601125eec7f0c8cbac7abd14f355d053fa56c98768" +dependencies = [ + "cpufeatures", +] + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "libc" +version = "0.2.139" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79" + +[[package]] +name = "libm" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "348108ab3fba42ec82ff6e9564fc4ca0247bdccdc68dd8af9764bbc79c3c8ffb" + +[[package]] +name = "libsecp256k1" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95b09eff1b35ed3b33b877ced3a691fc7a481919c7e29c53c906226fcf55e2a1" +dependencies = [ + "arrayref", + "base64", + "digest 0.9.0", + "libsecp256k1-core", + "libsecp256k1-gen-ecmult", + "libsecp256k1-gen-genmult", + "rand 0.8.5", + "serde", + "sha2 0.9.9", +] + +[[package]] +name = "libsecp256k1-core" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5be9b9bb642d8522a44d533eab56c16c738301965504753b03ad1de3425d5451" +dependencies = [ + "crunchy", + "digest 0.9.0", + "subtle", +] + +[[package]] +name = "libsecp256k1-gen-ecmult" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3038c808c55c87e8a172643a7d87187fc6c4174468159cb3090659d55bcb4809" +dependencies = [ + "libsecp256k1-core", +] + +[[package]] +name = "libsecp256k1-gen-genmult" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3db8d6ba2cec9eacc40e6e8ccc98931840301f1006e95647ceb2dd5c3aa06f7c" +dependencies = [ + "libsecp256k1-core", +] + +[[package]] +name = "link-cplusplus" +version = "1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecd207c9c713c34f95a097a5b029ac2ce6010530c7b49d7fea24d977dede04f5" +dependencies = [ + "cc", +] + +[[package]] +name = "linux-raw-sys" +version = "0.0.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4d2456c373231a208ad294c33dc5bff30051eafd954cd4caae83a712b12854d" + +[[package]] +name = "linux-raw-sys" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4" + +[[package]] +name = "lock_api" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df" +dependencies = [ + "autocfg", + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "mach" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b823e83b2affd8f40a9ee8c29dbc56404c1e34cd2710921f2801e2cf29527afa" +dependencies = [ + "libc", +] + +[[package]] +name = "matchers" +version = "0.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f099785f7595cc4b4553a174ce30dd7589ef93391ff414dbb67f62392b9e0ce1" +dependencies = [ + "regex-automata", +] + +[[package]] +name = "memchr" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" + +[[package]] +name = "memoffset" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" +dependencies = [ + "autocfg", +] + +[[package]] +name = "memory_units" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" + +[[package]] +name = "merlin" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e261cf0f8b3c42ded9f7d2bb59dea03aa52bc8a1cbc7482f9fc3fd1229d3b42" +dependencies = [ + "byteorder", + "keccak", + "rand_core 0.5.1", + "zeroize", +] + +[[package]] +name = "nom8" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae01545c9c7fc4486ab7debaf2aad7003ac19431791868fb2e8066df97fad2f8" +dependencies = [ + "memchr", +] + +[[package]] +name = "num-bigint" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f93ab6289c7b344a8a9f60f88d80aa20032336fe78da341afc91c8a2341fc75f" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-format" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a652d9771a63711fd3c3deb670acfbe5c30a4072e664d7a3bf5a9e1056ac72c3" +dependencies = [ + "arrayvec 0.7.2", + "itoa", +] + +[[package]] +name = "num-integer" +version = "0.1.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" +dependencies = [ + "autocfg", + "num-traits", +] + +[[package]] +name = "num-rational" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" +dependencies = [ + "autocfg", + "num-bigint", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" +dependencies = [ + "autocfg", +] + +[[package]] +name = "num_cpus" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b" +dependencies = [ + "hermit-abi", + "libc", +] + +[[package]] +name = "object" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21158b2c33aa6d4561f1c0a6ea283ca92bc54802a93b263e910746d679a7eb53" +dependencies = [ + "crc32fast", + "hashbrown", + "indexmap", + "memchr", +] + +[[package]] +name = "once_cell" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66" + +[[package]] +name = "opaque-debug" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" + +[[package]] +name = "opaque-debug" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" + +[[package]] +name = "os_str_bytes" +version = "6.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b7820b9daea5457c9f21c69448905d723fbd21136ccf521748f23fd49e723ee" + +[[package]] +name = "parity-scale-codec" +version = "3.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3840933452adf7b3b9145e27086a5a3376c619dca1a21b1e5a5af0d54979bed" +dependencies = [ + "arrayvec 0.7.2", + "bitvec", + "byte-slice-cast", + "bytes", + "impl-trait-for-tuples", + "parity-scale-codec-derive", + "serde", +] + +[[package]] +name = "parity-scale-codec-derive" +version = "3.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86b26a931f824dd4eca30b3e43bb4f31cd5f0d3a403c5f5ff27106b805bfde7b" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "parity-wasm" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1ad0aff30c1da14b1254fcb2af73e1fa9a28670e584a626f53a369d0e157304" + +[[package]] +name = "parking_lot" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba1ef8814b5c993410bb3adfad7a5ed269563e4a2f90c41f5d85be7fb47133bf" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-sys 0.42.0", +] + +[[package]] +name = "paste" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d01a5bd0424d00070b0098dd17ebca6f961a959dead1dbcbbbc1d1cd8d3deeba" + +[[package]] +name = "pbkdf2" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d95f5254224e617595d2cc3cc73ff0a5eaf2637519e25f03388154e9378b6ffa" +dependencies = [ + "crypto-mac", +] + +[[package]] +name = "pbkdf2" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917" +dependencies = [ + "digest 0.10.6", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "ppv-lite86" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" + +[[package]] +name = "primitive-types" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f3486ccba82358b11a77516035647c34ba167dfa53312630de83b12bd4f3d66" +dependencies = [ + "fixed-hash", + "impl-codec", + "impl-serde", + "scale-info", + "uint", +] + +[[package]] +name = "proc-macro-crate" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "66618389e4ec1c7afe67d51a9bf34ff9236480f8d51e7489b7d5ab0303c13f34" +dependencies = [ + "once_cell", + "toml_edit", +] + +[[package]] +name = "proc-macro-error" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +dependencies = [ + "proc-macro-error-attr", + "proc-macro2", + "quote", + "syn", + "version_check", +] + +[[package]] +name = "proc-macro-error-attr" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +dependencies = [ + "proc-macro2", + "quote", + "version_check", +] + +[[package]] +name = "proc-macro2" +version = "1.0.50" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ef7d57beacfaf2d8aee5937dab7b7f28de3cb8b1828479bb5de2a7106f2bae2" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "psm" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5787f7cda34e3033a72192c018bc5883100330f362ef279a8cbccfce8bb4e874" +dependencies = [ + "cc", +] + +[[package]] +name = "quote" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "radium" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" + +[[package]] +name = "rand" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" +dependencies = [ + "getrandom 0.1.16", + "libc", + "rand_chacha 0.2.2", + "rand_core 0.5.1", + "rand_hc", +] + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha 0.3.1", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_chacha" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" +dependencies = [ + "ppv-lite86", + "rand_core 0.5.1", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_core" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" +dependencies = [ + "getrandom 0.1.16", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.8", +] + +[[package]] +name = "rand_hc" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" +dependencies = [ + "rand_core 0.5.1", +] + +[[package]] +name = "redox_syscall" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" +dependencies = [ + "bitflags", +] + +[[package]] +name = "ref-cast" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c78fb8c9293bcd48ef6fce7b4ca950ceaf21210de6e105a883ee280c0f7b9ed" +dependencies = [ + "ref-cast-impl", +] + +[[package]] +name = "ref-cast-impl" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f9c0c92af03644e4806106281fe2e068ac5bc0ae74a707266d06ea27bccee5f" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "regex" +version = "1.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48aaa5748ba571fb95cd2c85c09f629215d3a6ece942baa100950af03a34f733" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" +dependencies = [ + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.6.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" + +[[package]] +name = "rustc-demangle" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342" + +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + +[[package]] +name = "rustc-hex" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" + +[[package]] +name = "rustix" +version = "0.35.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "727a1a6d65f786ec22df8a81ca3121107f235970dc1705ed681d3e6e8b9cd5f9" +dependencies = [ + "bitflags", + "errno", + "io-lifetimes 0.7.5", + "libc", + "linux-raw-sys 0.0.46", + "windows-sys 0.42.0", +] + +[[package]] +name = "rustix" +version = "0.36.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4fdebc4b395b7fbb9ab11e462e20ed9051e7b16e42d24042c776eca0ac81b03" +dependencies = [ + "bitflags", + "errno", + "io-lifetimes 1.0.4", + "libc", + "linux-raw-sys 0.1.4", + "windows-sys 0.42.0", +] + +[[package]] +name = "ryu" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde" + +[[package]] +name = "scale-info" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "001cf62ece89779fd16105b5f515ad0e5cedcd5440d3dd806bb067978e7c3608" +dependencies = [ + "bitvec", + "cfg-if", + "derive_more", + "parity-scale-codec", + "scale-info-derive", +] + +[[package]] +name = "scale-info-derive" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "303959cf613a6f6efd19ed4b4ad5bf79966a13352716299ad532cfb115f4205c" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "schnorrkel" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "021b403afe70d81eea68f6ea12f6b3c9588e5d536a94c3bf80f15e7faa267862" +dependencies = [ + "arrayref", + "arrayvec 0.5.2", + "curve25519-dalek 2.1.3", + "getrandom 0.1.16", + "merlin", + "rand 0.7.3", + "rand_core 0.5.1", + "sha2 0.8.2", + "subtle", + "zeroize", +] + +[[package]] +name = "scopeguard" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" + +[[package]] +name = "scratch" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddccb15bcce173023b3fedd9436f882a0739b8dfb45e4f6b6002bee5929f61b2" + +[[package]] +name = "secp256k1" +version = "0.24.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b1629c9c557ef9b293568b338dddfc8208c98a18c59d722a9d53f859d9c9b62" +dependencies = [ + "secp256k1-sys", +] + +[[package]] +name = "secp256k1-sys" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83080e2c2fc1006e625be82e5d1eb6a43b7fd9578b617fcc55814daf286bba4b" +dependencies = [ + "cc", +] + +[[package]] +name = "secrecy" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bd1c54ea06cfd2f6b63219704de0b9b4f72dcc2b8fdef820be6cd799780e91e" +dependencies = [ + "zeroize", +] + +[[package]] +name = "serde" +version = "1.0.152" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.152" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.91" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877c235533714907a8c2464236f5c4b2a17262ef1bd71f38f35ea592c8da6883" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "sha2" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a256f46ea78a0c0d9ff00077504903ac881a1dafdc20da66545699e7776b3e69" +dependencies = [ + "block-buffer 0.7.3", + "digest 0.8.1", + "fake-simd", + "opaque-debug 0.2.3", +] + +[[package]] +name = "sha2" +version = "0.9.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" +dependencies = [ + "block-buffer 0.9.0", + "cfg-if", + "cpufeatures", + "digest 0.9.0", + "opaque-debug 0.3.0", +] + +[[package]] +name = "sha2" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest 0.10.6", +] + +[[package]] +name = "sha3" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bdf0c33fae925bdc080598b84bc15c55e7b9a4a43b3c704da051f977469691c9" +dependencies = [ + "digest 0.10.6", + "keccak", +] + +[[package]] +name = "sharded-slab" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "900fba806f70c630b0a382d0d825e17a0f19fcd059a2ade1ff237bcddf446b31" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "slab" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4614a76b2a8be0058caa9dbbaf66d988527d86d003c11a94fbd335d7661edcef" +dependencies = [ + "autocfg", +] + +[[package]] +name = "smallvec" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" + +[[package]] +name = "sp-core" +version = "7.0.0" +source = "git+https://github.com/paritytech/substrate#6c1119016ff6b35e8ea79594edf20c03a39e3740" +dependencies = [ + "array-bytes 4.2.0", + "base58", + "bitflags", + "blake2", + "dyn-clonable", + "ed25519-zebra", + "futures", + "hash-db", + "hash256-std-hasher", + "impl-serde", + "lazy_static", + "libsecp256k1", + "log", + "merlin", + "parity-scale-codec", + "parking_lot", + "primitive-types", + "rand 0.8.5", + "regex", + "scale-info", + "schnorrkel", + "secp256k1", + "secrecy", + "serde", + "sp-core-hashing", + "sp-debug-derive", + "sp-externalities", + "sp-runtime-interface", + "sp-std", + "sp-storage", + "ss58-registry", + "substrate-bip39", + "thiserror", + "tiny-bip39", + "zeroize", +] + +[[package]] +name = "sp-core-hashing" +version = "5.0.0" +source = "git+https://github.com/paritytech/substrate#6c1119016ff6b35e8ea79594edf20c03a39e3740" +dependencies = [ + "blake2", + "byteorder", + "digest 0.10.6", + "sha2 0.10.6", + "sha3", + "sp-std", + "twox-hash", +] + +[[package]] +name = "sp-debug-derive" +version = "5.0.0" +source = "git+https://github.com/paritytech/substrate#6c1119016ff6b35e8ea79594edf20c03a39e3740" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "sp-externalities" +version = "0.13.0" +source = "git+https://github.com/paritytech/substrate#6c1119016ff6b35e8ea79594edf20c03a39e3740" +dependencies = [ + "environmental", + "parity-scale-codec", + "sp-std", + "sp-storage", +] + +[[package]] +name = "sp-runtime-interface" +version = "7.0.0" +source = "git+https://github.com/paritytech/substrate#6c1119016ff6b35e8ea79594edf20c03a39e3740" +dependencies = [ + "bytes", + "impl-trait-for-tuples", + "parity-scale-codec", + "primitive-types", + "sp-externalities", + "sp-runtime-interface-proc-macro", + "sp-std", + "sp-storage", + "sp-tracing", + "sp-wasm-interface", + "static_assertions", +] + +[[package]] +name = "sp-runtime-interface-proc-macro" +version = "6.0.0" +source = "git+https://github.com/paritytech/substrate#6c1119016ff6b35e8ea79594edf20c03a39e3740" +dependencies = [ + "Inflector", + "proc-macro-crate", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "sp-std" +version = "5.0.0" +source = "git+https://github.com/paritytech/substrate#6c1119016ff6b35e8ea79594edf20c03a39e3740" + +[[package]] +name = "sp-storage" +version = "7.0.0" +source = "git+https://github.com/paritytech/substrate#6c1119016ff6b35e8ea79594edf20c03a39e3740" +dependencies = [ + "impl-serde", + "parity-scale-codec", + "ref-cast", + "serde", + "sp-debug-derive", + "sp-std", +] + +[[package]] +name = "sp-tracing" +version = "6.0.0" +source = "git+https://github.com/paritytech/substrate#6c1119016ff6b35e8ea79594edf20c03a39e3740" +dependencies = [ + "parity-scale-codec", + "sp-std", + "tracing", + "tracing-core", + "tracing-subscriber", +] + +[[package]] +name = "sp-wasm-interface" +version = "7.0.0" +source = "git+https://github.com/paritytech/substrate#6c1119016ff6b35e8ea79594edf20c03a39e3740" +dependencies = [ + "impl-trait-for-tuples", + "log", + "parity-scale-codec", + "sp-std", + "wasmi", + "wasmtime", +] + +[[package]] +name = "ss58-registry" +version = "1.38.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e40c020d72bc0a9c5660bb71e4a6fdef081493583062c474740a7d59f55f0e7b" +dependencies = [ + "Inflector", + "num-format", + "proc-macro2", + "quote", + "serde", + "serde_json", + "unicode-xid", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[package]] +name = "strsim" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" + +[[package]] +name = "substrate-bip39" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49eee6965196b32f882dd2ee85a92b1dbead41b04e53907f269de3b0dc04733c" +dependencies = [ + "hmac 0.11.0", + "pbkdf2 0.8.0", + "schnorrkel", + "sha2 0.9.9", + "zeroize", +] + +[[package]] +name = "subtle" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" + +[[package]] +name = "syn" +version = "1.0.107" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "synstructure" +version = "0.12.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "unicode-xid", +] + +[[package]] +name = "tap" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" + +[[package]] +name = "target-lexicon" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9410d0f6853b1d94f0e519fb95df60f29d2c1eff2d921ffdf01a4c8a3b54f12d" + +[[package]] +name = "termcolor" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "thiserror" +version = "1.0.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a9cd18aa97d5c45c6603caea1da6628790b37f7a34b6ca89522331c5180fed0" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "thread_local" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5516c27b78311c50bf42c071425c560ac799b11c30b31f87e3081965fe5e0180" +dependencies = [ + "once_cell", +] + +[[package]] +name = "tiny-bip39" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62cc94d358b5a1e84a5cb9109f559aa3c4d634d2b1b4de3d0fa4adc7c78e2861" +dependencies = [ + "anyhow", + "hmac 0.12.1", + "once_cell", + "pbkdf2 0.11.0", + "rand 0.8.5", + "rustc-hash", + "sha2 0.10.6", + "thiserror", + "unicode-normalization", + "wasm-bindgen", + "zeroize", +] + +[[package]] +name = "tinyvec" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +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 = "toml_datetime" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4553f467ac8e3d374bc9a177a26801e5d0f9b211aa1673fb137a403afd1c9cf5" + +[[package]] +name = "toml_edit" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56c59d8dd7d0dcbc6428bf7aa2f0e823e26e43b3c9aca15bbc9475d23e5fa12b" +dependencies = [ + "indexmap", + "nom8", + "toml_datetime", +] + +[[package]] +name = "tracing" +version = "0.1.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" +dependencies = [ + "cfg-if", + "pin-project-lite", + "tracing-core", +] + +[[package]] +name = "tracing-core" +version = "0.1.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24eb03ba0eab1fd845050058ce5e616558e8f8d8fca633e6b163fe25c797213a" +dependencies = [ + "once_cell", + "valuable", +] + +[[package]] +name = "tracing-log" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ddad33d2d10b1ed7eb9d1f518a5674713876e97e5bb9b7345a7984fbb4f922" +dependencies = [ + "lazy_static", + "log", + "tracing-core", +] + +[[package]] +name = "tracing-serde" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc6b213177105856957181934e4920de57730fc69bf42c37ee5bb664d406d9e1" +dependencies = [ + "serde", + "tracing-core", +] + +[[package]] +name = "tracing-subscriber" +version = "0.2.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e0d2eaa99c3c2e41547cfa109e910a68ea03823cccad4a0525dcbc9b01e8c71" +dependencies = [ + "ansi_term", + "chrono", + "lazy_static", + "matchers", + "regex", + "serde", + "serde_json", + "sharded-slab", + "smallvec", + "thread_local", + "tracing", + "tracing-core", + "tracing-log", + "tracing-serde", +] + +[[package]] +name = "twox-hash" +version = "1.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" +dependencies = [ + "cfg-if", + "digest 0.10.6", + "rand 0.8.5", + "static_assertions", +] + +[[package]] +name = "typenum" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" + +[[package]] +name = "uint" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76f64bba2c53b04fcab63c01a7d7427eadc821e3bc48c34dc9ba29c501164b52" +dependencies = [ + "byteorder", + "crunchy", + "hex", + "static_assertions", +] + +[[package]] +name = "unicode-ident" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc" + +[[package]] +name = "unicode-normalization" +version = "0.1.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "unicode-width" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" + +[[package]] +name = "unicode-xid" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" + +[[package]] +name = "valuable" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" + +[[package]] +name = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" + +[[package]] +name = "wasi" +version = "0.9.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "wasm-bindgen" +version = "0.2.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eaf9f5aceeec8be17c128b2e93e031fb8a4d469bb9c4ae2d7dc1888b26887268" +dependencies = [ + "cfg-if", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c8ffb332579b0557b52d268b91feab8df3615f265d5270fec2a8c95b17c1142" +dependencies = [ + "bumpalo", + "log", + "once_cell", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "052be0f94026e6cbc75cdefc9bae13fd6052cdcaf532fa6c45e7ae33a1e6c810" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07bc0c051dc5f23e307b13285f9d75df86bfdf816c5721e573dec1f9b8aa193c" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f" + +[[package]] +name = "wasmi" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06c326c93fbf86419608361a2c925a31754cf109da1b8b55737070b4d6669422" +dependencies = [ + "parity-wasm", + "wasmi-validation", + "wasmi_core", +] + +[[package]] +name = "wasmi-validation" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91ff416ad1ff0c42e5a926ed5d5fab74c0f098749aa0ad8b2a34b982ce0e867b" +dependencies = [ + "parity-wasm", +] + +[[package]] +name = "wasmi_core" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57d20cb3c59b788653d99541c646c561c9dd26506f25c0cebfe810659c54c6d7" +dependencies = [ + "downcast-rs", + "libm", + "memory_units", + "num-rational", + "num-traits", +] + +[[package]] +name = "wasmparser" +version = "0.89.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab5d3e08b13876f96dd55608d03cd4883a0545884932d5adf11925876c96daef" +dependencies = [ + "indexmap", +] + +[[package]] +name = "wasmtime" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ad5af6ba38311282f2a21670d96e78266e8c8e2f38cbcd52c254df6ccbc7731" +dependencies = [ + "anyhow", + "bincode", + "cfg-if", + "indexmap", + "libc", + "log", + "object", + "once_cell", + "paste", + "psm", + "serde", + "target-lexicon", + "wasmparser", + "wasmtime-environ", + "wasmtime-jit", + "wasmtime-runtime", + "windows-sys 0.36.1", +] + +[[package]] +name = "wasmtime-asm-macros" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45de63ddfc8b9223d1adc8f7b2ee5f35d1f6d112833934ad7ea66e4f4339e597" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "wasmtime-environ" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebb881c61f4f627b5d45c54e629724974f8a8890d455bcbe634330cc27309644" +dependencies = [ + "anyhow", + "cranelift-entity", + "gimli", + "indexmap", + "log", + "object", + "serde", + "target-lexicon", + "thiserror", + "wasmparser", + "wasmtime-types", +] + +[[package]] +name = "wasmtime-jit" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1985c628011fe26adf5e23a5301bdc79b245e0e338f14bb58b39e4e25e4d8681" +dependencies = [ + "addr2line", + "anyhow", + "bincode", + "cfg-if", + "cpp_demangle", + "gimli", + "log", + "object", + "rustc-demangle", + "rustix 0.35.13", + "serde", + "target-lexicon", + "thiserror", + "wasmtime-environ", + "wasmtime-runtime", + "windows-sys 0.36.1", +] + +[[package]] +name = "wasmtime-jit-debug" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f671b588486f5ccec8c5a3dba6b4c07eac2e66ab8c60e6f4e53717c77f709731" +dependencies = [ + "once_cell", +] + +[[package]] +name = "wasmtime-runtime" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee8f92ad4b61736339c29361da85769ebc200f184361959d1792832e592a1afd" +dependencies = [ + "anyhow", + "cc", + "cfg-if", + "indexmap", + "libc", + "log", + "mach", + "memoffset", + "paste", + "rand 0.8.5", + "rustix 0.35.13", + "thiserror", + "wasmtime-asm-macros", + "wasmtime-environ", + "wasmtime-jit-debug", + "windows-sys 0.36.1", +] + +[[package]] +name = "wasmtime-types" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d23d61cb4c46e837b431196dd06abb11731541021916d03476a178b54dc07aeb" +dependencies = [ + "cranelift-entity", + "serde", + "thiserror", + "wasmparser", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-util" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +dependencies = [ + "winapi", +] + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows-sys" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2" +dependencies = [ + "windows_aarch64_msvc 0.36.1", + "windows_i686_gnu 0.36.1", + "windows_i686_msvc 0.36.1", + "windows_x86_64_gnu 0.36.1", + "windows_x86_64_msvc 0.36.1", +] + +[[package]] +name = "windows-sys" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc 0.42.1", + "windows_i686_gnu 0.42.1", + "windows_i686_msvc 0.42.1", + "windows_x86_64_gnu 0.42.1", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc 0.42.1", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7" + +[[package]] +name = "windows_i686_gnu" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" + +[[package]] +name = "windows_i686_gnu" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640" + +[[package]] +name = "windows_i686_msvc" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" + +[[package]] +name = "windows_i686_msvc" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd" + +[[package]] +name = "wyz" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" +dependencies = [ + "tap", +] + +[[package]] +name = "zeroize" +version = "1.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c394b5bd0c6f669e7275d9c20aa90ae064cb22e75a1cad54e1b34088034b149f" +dependencies = [ + "zeroize_derive", +] + +[[package]] +name = "zeroize_derive" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44bf07cb3e50ea2003396695d58bf46bc9887a1f362260446fad6bc4e79bd36c" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] diff --git a/tool/am-signer/Cargo.toml b/tool/am-signer/Cargo.toml new file mode 100644 index 000000000..058f48023 --- /dev/null +++ b/tool/am-signer/Cargo.toml @@ -0,0 +1,16 @@ +[package] +authors = ["Xavier Lau "] +edition = "2021" +name = "am-signer" +version = "0.0.0" + +[dependencies] +# crates.io +array-bytes = { version = "6.0" } +clap = { version = "4.1", features = ["derive"] } + +# substrate +sp-core = { git = "https://github.com/paritytech/substrate" } + +[workspace] +exclude = [] diff --git a/tool/am-signer/README.md b/tool/am-signer/README.md new file mode 100644 index 000000000..ecacc7a42 --- /dev/null +++ b/tool/am-signer/README.md @@ -0,0 +1,11 @@ +### Usage + +```shb +# Build +cargo build +# Get more detail +target/debug/am-signer --help + +# Generate migration proof +target/debug/am-signer -n +``` diff --git a/tool/am-signer/rust-toolchain.toml b/tool/am-signer/rust-toolchain.toml new file mode 100644 index 000000000..4115a9530 --- /dev/null +++ b/tool/am-signer/rust-toolchain.toml @@ -0,0 +1,5 @@ +[toolchain] +channel = "nightly-2022-11-15" +components = ["cargo", "clippy", "rustc", "rustfmt", "rust-src"] +profile = "minimal" +targets = ["wasm32-unknown-unknown"] diff --git a/tool/am-signer/src/main.rs b/tool/am-signer/src/main.rs new file mode 100644 index 000000000..018a63707 --- /dev/null +++ b/tool/am-signer/src/main.rs @@ -0,0 +1,52 @@ +// crates.io +use clap::{Parser, ValueEnum}; +// substrate +use sp_core::{sr25519::Pair, Pair as _}; + +#[derive(Parser)] +#[command(rename_all = "kebab")] +struct Cli { + #[arg(value_name = "PRIVATE_KEY")] + from: String, + #[arg(value_name = "ADDRESS")] + to: String, + #[arg(required = true, value_enum, long, short, value_name = "NETWORK")] + network: Network, +} +#[derive(Clone, ValueEnum)] +enum Network { + Darwinia, + Crab, + Pangoro, + Pangolin, +} +impl Network { + fn as_bytes(&self) -> &'static [u8] { + match self { + Self::Darwinia => b"Darwinia2", + Self::Crab => b"Crab2", + Self::Pangoro => b"Pangoro2", + Self::Pangolin => b"Pangolin2", + } + } +} + +fn main() { + let Cli { from, to, network } = Cli::parse(); + let from = array_bytes::hex2array(from).expect("invalid private key"); + let from = Pair::from_seed(&from); + let network = network.as_bytes(); + let msg = [ + b"I authorize the migration to ", + to.as_bytes(), + b", an unused address on ", + network, + b". Sign this message to authorize using the Substrate key associated with the account on ", + &network[..network.len() - 1], + b" that you wish to migrate.", + ] + .concat(); + let sig = from.sign(&msg); + + println!("{}", array_bytes::bytes2hex("0x", sig)); +} From 4a9ea62bba268c83f564bbca77d24b97369656b0 Mon Sep 17 00:00:00 2001 From: bear Date: Sun, 29 Jan 2023 15:58:24 +0800 Subject: [PATCH 117/189] Update docs (#237) Co-authored-by: Xavier Lau --- tool/state-processor/src/identity/README.md | 2 +- tool/state-processor/src/identity/mod.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tool/state-processor/src/identity/README.md b/tool/state-processor/src/identity/README.md index 5be6a9eb5..9081b6357 100644 --- a/tool/state-processor/src/identity/README.md +++ b/tool/state-processor/src/identity/README.md @@ -1,5 +1,5 @@ ### Process steps -1. take `Identity::IdentityOf`, `Identity::Registrars`, `Identity::SuperOf` and `Identity::SuperOf` +1. take `Identity::IdentityOf`, `Identity::Registrars`, `Identity::SubsOf` 2. free super_id's reservation 3. adjust identities' deposit and judgement decimal 4. set `AccountMigration::Identities` diff --git a/tool/state-processor/src/identity/mod.rs b/tool/state-processor/src/identity/mod.rs index 846214122..6e7969cd6 100644 --- a/tool/state-processor/src/identity/mod.rs +++ b/tool/state-processor/src/identity/mod.rs @@ -8,7 +8,7 @@ impl Processor { let mut registrars = Vec::>>::default(); let mut subs_of = Map::<(Balance, Vec)>::default(); - log::info!("take `Identity::IdentityOf`, `Identity::Registrars`, `Identity::SuperOf` and `Identity::SuperOf`"); + log::info!("take `Identity::IdentityOf`, `Identity::Registrars`, `Identity::SubsOf`"); self.solo_state .take_map(b"Identity", b"IdentityOf", &mut identities, get_hashed_key) .take_value(b"Identity", b"Registrars", "", &mut registrars) From be849d0c65d62aa963eaaf42fd1d28fbab33bcdb Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Mon, 30 Jan 2023 14:22:06 +0800 Subject: [PATCH 118/189] Fix call indexes (#238) --- pallet/account-migration/src/lib.rs | 1 + pallet/deposit/src/lib.rs | 3 +++ pallet/ecdsa-authority/src/lib.rs | 10 +++++----- pallet/message-transact/src/lib.rs | 1 + pallet/staking/src/lib.rs | 7 +++++++ 5 files changed, 17 insertions(+), 5 deletions(-) diff --git a/pallet/account-migration/src/lib.rs b/pallet/account-migration/src/lib.rs index 04e496b56..8dcb69745 100644 --- a/pallet/account-migration/src/lib.rs +++ b/pallet/account-migration/src/lib.rs @@ -163,6 +163,7 @@ pub mod pallet { #[pallet::call] impl Pallet { /// Migrate all the account data under the `from` to `to`. + #[pallet::call_index(0)] #[pallet::weight(0)] pub fn migrate( origin: OriginFor, diff --git a/pallet/deposit/src/lib.rs b/pallet/deposit/src/lib.rs index 4e004a8e6..ec980f841 100644 --- a/pallet/deposit/src/lib.rs +++ b/pallet/deposit/src/lib.rs @@ -177,6 +177,7 @@ pub mod pallet { #[pallet::call] impl Pallet { /// Lock the RING for some KTON profit/interest. + #[pallet::call_index(0)] #[pallet::weight(0)] pub fn lock(origin: OriginFor, amount: Balance, months: u8) -> DispatchResult { let who = ensure_signed(origin)?; @@ -246,6 +247,7 @@ pub mod pallet { } /// Claim the expired-locked RING. + #[pallet::call_index(1)] #[pallet::weight(0)] pub fn claim(origin: OriginFor) -> DispatchResult { let who = ensure_signed(origin)?; @@ -284,6 +286,7 @@ pub mod pallet { } /// Claim the unexpired-locked RING by paying the KTON penalty. + #[pallet::call_index(2)] #[pallet::weight(0)] pub fn claim_with_penalty(origin: OriginFor, id: DepositId) -> DispatchResult { let who = ensure_signed(origin)?; diff --git a/pallet/ecdsa-authority/src/lib.rs b/pallet/ecdsa-authority/src/lib.rs index 9a6c04227..d7e171887 100644 --- a/pallet/ecdsa-authority/src/lib.rs +++ b/pallet/ecdsa-authority/src/lib.rs @@ -225,8 +225,8 @@ pub mod pallet { /// /// Not allow to call while authorities is changing. /// This will insert new authority into the index 0 of authorities. + #[pallet::call_index(0)] #[pallet::weight(10_000_000)] - #[frame_support::transactional] pub fn add_authority(origin: OriginFor, new: T::AccountId) -> DispatchResult { ensure_root(origin)?; @@ -250,8 +250,8 @@ pub mod pallet { /// Remove a authority and trigger `on_authorities_change`. /// /// Not allow to call while authorities is changing. + #[pallet::call_index(1)] #[pallet::weight(10_000_000)] - #[frame_support::transactional] pub fn remove_authority(origin: OriginFor, old: T::AccountId) -> DispatchResult { ensure_root(origin)?; @@ -281,8 +281,8 @@ pub mod pallet { /// Swap the old authority with the new authority and trigger `on_authorities_change`. /// /// Not allow to call while authorities is changing. + #[pallet::call_index(2)] #[pallet::weight(10_000_000)] - #[frame_support::transactional] pub fn swap_authority( origin: OriginFor, old: T::AccountId, @@ -315,8 +315,8 @@ pub mod pallet { /// Submit the authorities change signature. /// /// Free to submit the first-correct signature. + #[pallet::call_index(3)] #[pallet::weight(10_000_000)] - #[frame_support::transactional] pub fn submit_authorities_change_signature( origin: OriginFor, signature: Signature, @@ -364,8 +364,8 @@ pub mod pallet { /// Submit the new message root signature. /// /// Free to submit the first-correct signature. + #[pallet::call_index(4)] #[pallet::weight(10_000_000)] - #[frame_support::transactional] pub fn submit_new_message_root_signature( origin: OriginFor, signature: Signature, diff --git a/pallet/message-transact/src/lib.rs b/pallet/message-transact/src/lib.rs index bfefcacfe..b5098809a 100644 --- a/pallet/message-transact/src/lib.rs +++ b/pallet/message-transact/src/lib.rs @@ -107,6 +107,7 @@ pub mod pallet { { /// This call can only be called by the lcmp message layer and is not available to normal /// users. + #[pallet::call_index(0)] #[pallet::weight({ let without_base_extrinsic_weight = true; ::GasWeightMapping::gas_to_weight({ diff --git a/pallet/staking/src/lib.rs b/pallet/staking/src/lib.rs index ff4a29832..d38d9d861 100644 --- a/pallet/staking/src/lib.rs +++ b/pallet/staking/src/lib.rs @@ -350,6 +350,7 @@ pub mod pallet { /// Add stakes to the staking pool. /// /// This will transfer the stakes to a pallet/contact account. + #[pallet::call_index(0)] #[pallet::weight(0)] pub fn stake( origin: OriginFor, @@ -409,6 +410,7 @@ pub mod pallet { } /// Withdraw stakes from the staking pool. + #[pallet::call_index(1)] #[pallet::weight(0)] pub fn unstake( origin: OriginFor, @@ -455,6 +457,7 @@ pub mod pallet { /// Cancel the `unstake` operation. /// /// Re-stake the unstaking assets immediately. + #[pallet::call_index(2)] #[pallet::weight(0)] pub fn restake( origin: OriginFor, @@ -499,6 +502,7 @@ pub mod pallet { } /// Claim the stakes from the pallet/contract account. + #[pallet::call_index(3)] #[pallet::weight(0)] pub fn claim(origin: OriginFor) -> DispatchResult { let who = ensure_signed(origin)?; @@ -515,6 +519,7 @@ pub mod pallet { /// Declare the desire to collect. /// /// Effects will be felt at the beginning of the next session. + #[pallet::call_index(4)] #[pallet::weight(0)] pub fn collect(origin: OriginFor, commission: Perbill) -> DispatchResult { let who = ensure_signed(origin)?; @@ -529,6 +534,7 @@ pub mod pallet { /// Declare the desire to nominate a collator. /// /// Effects will be felt at the beginning of the next session. + #[pallet::call_index(5)] #[pallet::weight(0)] pub fn nominate(origin: OriginFor, target: T::AccountId) -> DispatchResult { let who = ensure_signed(origin)?; @@ -552,6 +558,7 @@ pub mod pallet { /// Effects will be felt at the beginning of the next era. /// /// If the target is a collator, its nominators need to re-nominate. + #[pallet::call_index(6)] #[pallet::weight(0)] pub fn chill(origin: OriginFor) -> DispatchResult { let who = ensure_signed(origin)?; From d1a3b8cda6f7dda407522132513c5835d3b308b5 Mon Sep 17 00:00:00 2001 From: bear Date: Mon, 30 Jan 2023 15:05:54 +0800 Subject: [PATCH 119/189] Fix signer cli (#239) --- tool/am-signer/src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tool/am-signer/src/main.rs b/tool/am-signer/src/main.rs index 018a63707..68ed8f05a 100644 --- a/tool/am-signer/src/main.rs +++ b/tool/am-signer/src/main.rs @@ -38,7 +38,7 @@ fn main() { let network = network.as_bytes(); let msg = [ b"I authorize the migration to ", - to.as_bytes(), + to.to_lowercase().as_bytes(), b", an unused address on ", network, b". Sign this message to authorize using the Substrate key associated with the account on ", From 0626861ab836e650c0dc67a40e2d18e6ef75d48a Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Tue, 31 Jan 2023 18:55:27 +0800 Subject: [PATCH 120/189] Improve testing (#241) * Improve testing * Fix formula * Opt * State processor CI * Unset * Try Signed-off-by: Xavier Lau * Opt * Opt * Try Signed-off-by: Xavier Lau * Opt * Opt * Final test * Fix * Bump * Fix * Fix --------- Signed-off-by: Xavier Lau --- .github/workflows/checks.yml | 35 +- Cargo.lock | 456 ++++++++++++---------- node/Cargo.toml | 2 +- pallet/account-migration/Cargo.toml | 2 +- pallet/deposit/Cargo.toml | 2 +- pallet/ecdsa-authority/Cargo.toml | 2 +- pallet/message-gadget/Cargo.toml | 2 +- pallet/message-transact/Cargo.toml | 2 +- pallet/staking/Cargo.toml | 2 +- precompile/assets/Cargo.toml | 2 +- precompile/bls12-381/Cargo.toml | 2 +- precompile/deposit/Cargo.toml | 2 +- precompile/staking/Cargo.toml | 2 +- precompile/state-storage/Cargo.toml | 2 +- runtime/common/Cargo.toml | 2 +- runtime/crab/Cargo.toml | 2 +- runtime/darwinia/Cargo.toml | 2 +- runtime/pangolin/Cargo.toml | 2 +- tool/am-signer/Cargo.lock | 56 +-- tool/state-processor/Cargo.lock | 169 ++++---- tool/state-processor/Cargo.toml | 4 +- tool/state-processor/src/main.rs | 12 +- tool/state-processor/src/processor.rs | 23 +- tool/state-processor/src/tests.rs | 61 +-- tool/state-processor/src/type_registry.rs | 2 +- 25 files changed, 478 insertions(+), 372 deletions(-) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 0e2529179..d6bd702e5 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -65,10 +65,7 @@ jobs: key: sccache-${{ matrix.action }}-${{ env.GITHUB_CACHE_VERSION }}-${{ hashFiles('**/Cargo.lock') }} restore-keys: sccache-${{ matrix.action }}-${{ env.GITHUB_CACHE_VERSION }}- - name: Action ${{ matrix.action }} - uses: actions-rs/cargo@v1 - with: - command: ${{ matrix.action }} - args: --release --locked --features all-native + run: cargo ${{ matrix.action }} --release --locked --features all-native - name: Change path if: matrix.action != 'test' run: mv target/release/darwinia . @@ -115,10 +112,38 @@ jobs: chain: ${{ matrix.target.chain }} compare-with: ${{ matrix.target.compare-with }} + state-checks: + name: Task check state + if: github.event_name == 'push' || !github.event.pull_request.draft + needs: [basic-checks] + runs-on: ubuntu-latest + steps: + - name: Fetch latest code + uses: actions/checkout@v3 + - name: Download darwinia + uses: actions/download-artifact@v2 + with: + name: darwinia + - name: Setup test environment + run: | + mkdir -p target/release + chmod u+x darwinia + mv darwinia target/release/darwinia + cd tool/state-processor + mkdir -p data + cd data + curl -L https://github.com/darwinia-network/darwinia-2.0/releases/download/crab2/crab-state.tar.zst | tar x -I pzstd + cd .. + - name: Check state + run: | + cd tool/state-processor + unset RUSTC_WRAPPER + cargo test --release --locked + checks-cleaning: name: Task checks cleaning if: always() - needs: [features-checks, runtime-checks] + needs: [features-checks, runtime-checks, state-checks] steps: - name: Clean artifacts uses: geekyeggo/delete-artifact@v1 diff --git a/Cargo.lock b/Cargo.lock index 6e9a7a434..746ef56a4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -48,7 +48,7 @@ version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a76fd60b23679b7d19bd066031410fb7e458ccc5e958eb5c325888ce4baedc97" dependencies = [ - "gimli 0.27.0", + "gimli 0.27.1", ] [[package]] @@ -365,9 +365,9 @@ checksum = "7a40729d2133846d9ed0ea60a8b9541bccddab49cd30f0715a1da672fe9a2524" [[package]] name = "async-trait" -version = "0.1.60" +version = "0.1.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "677d1d8ab452a3936018a687b20e6f7cf5363d713b732b8884001317b0e48aa3" +checksum = "1cd7fce9ba8c3c042128ce72d8b2ddbf3a05747efb67ea0313c635e10bda47a2" dependencies = [ "proc-macro2", "quote", @@ -389,9 +389,9 @@ dependencies = [ [[package]] name = "atomic-waker" -version = "1.0.0" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "065374052e7df7ee4047b1160cca5e1467a12351a40b3da123c870ba0b8eda2a" +checksum = "debc29dde2e69f9e47506b525f639ed42300fc014a3e007832592448fa8e4599" [[package]] name = "atty" @@ -447,7 +447,7 @@ dependencies = [ "cfg-if", "libc", "miniz_oxide", - "object 0.30.0", + "object 0.30.3", "rustc-demangle", ] @@ -481,6 +481,12 @@ version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" +[[package]] +name = "base64" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4a4ddaa51a5bc52a6948f74c06d20aaaddb71924eab79b8c97a8c556e942d6a" + [[package]] name = "base64ct" version = "1.5.3" @@ -934,6 +940,16 @@ dependencies = [ "regex-automata", ] +[[package]] +name = "bstr" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b45ea9b00a7b3f2988e9a65ad3917e62123c38dba709b666506207be96d1790b" +dependencies = [ + "memchr", + "serde", +] + [[package]] name = "build-helper" version = "0.1.1" @@ -945,9 +961,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.11.1" +version = "3.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "572f695136211188308f16ad2ca5c851a712c464060ae6974944458eb83880ba" +checksum = "0d261e256854913907f67ed06efbc3338dfe6179796deefc1ff763fc1aee5535" [[package]] name = "byte-slice-cast" @@ -986,9 +1002,9 @@ dependencies = [ [[package]] name = "camino" -version = "1.1.1" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88ad0e1e3e88dd237a156ab9f571021b8a158caa0ae44b1968a241efb5144c1e" +checksum = "c77df041dc383319cc661b428b6961a005db4d6808d5e12536931b1ca9556055" dependencies = [ "serde", ] @@ -1023,9 +1039,9 @@ checksum = "fd6c0e7b807d60291f42f33f58480c0bfafe28ed08286446f45e463728cf9c1c" [[package]] name = "cc" -version = "1.0.78" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a20104e2335ce8a659d6dd92a51a767a0c062599c73b343fd152cb401e828c3d" +checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" dependencies = [ "jobserver", ] @@ -1144,9 +1160,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.0.32" +version = "4.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7db700bc935f9e43e88d00b0850dae18a63773cfbec6d8e070fccf7fef89a39" +checksum = "f13b9c79b5d1dd500d20ef541215a6423c75829ef43117e1b4d17fd8af0b5d76" dependencies = [ "bitflags", "clap_derive", @@ -1159,9 +1175,9 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.0.21" +version = "4.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0177313f9f02afc995627906bbd8967e2be069f5261954222dac78290c2b9014" +checksum = "684a277d672e91966334af371f1a7b5833f9aa00b07c84e92fbce95e00208ce8" dependencies = [ "heck", "proc-macro-error", @@ -1172,9 +1188,9 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d4198f73e42b4936b35b5bb248d81d2b595ecb170da0bac7655c54eedfa8da8" +checksum = "783fe232adfca04f90f56201b26d79682d4cd2625e0bc7290b95123afe558ade" dependencies = [ "os_str_bytes", ] @@ -1203,9 +1219,9 @@ dependencies = [ [[package]] name = "comfy-table" -version = "6.1.3" +version = "6.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e621e7e86c46fd8a14c32c6ae3cb95656621b4743a27d0cffedb831d46e7ad21" +checksum = "6e7b787b0dc42e8111badfdbe4c3059158ccb2db8780352fa1b01e8ccf45cc4d" dependencies = [ "strum", "strum_macros", @@ -1214,24 +1230,23 @@ dependencies = [ [[package]] name = "concurrent-queue" -version = "2.0.0" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd7bef69dc86e3c610e4e7aed41035e2a7ed12e72dd7530f61327a6579a4390b" +checksum = "c278839b831783b70278b14df4d45e1beb1aad306c07bb796637de9a0e323e8e" dependencies = [ "crossbeam-utils", ] [[package]] name = "console" -version = "0.15.2" +version = "0.15.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c050367d967ced717c04b65d8c619d863ef9292ce0c5760028655a2fb298718c" +checksum = "c3d79fbe8970a77e3e34151cc13d3b3e248aa0faaecb9f6091fa07ebefe5ad60" dependencies = [ "encode_unicode", "lazy_static", "libc", - "terminal_size", - "winapi", + "windows-sys 0.42.0", ] [[package]] @@ -2152,9 +2167,9 @@ dependencies = [ [[package]] name = "cxx" -version = "1.0.85" +version = "1.0.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5add3fc1717409d029b20c5b6903fc0c0b02fa6741d820054f4a2efa5e5816fd" +checksum = "322296e2f2e5af4270b54df9e85a02ff037e271af20ba3e7fe1575515dc840b8" dependencies = [ "cc", "cxxbridge-flags", @@ -2164,9 +2179,9 @@ dependencies = [ [[package]] name = "cxx-build" -version = "1.0.85" +version = "1.0.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4c87959ba14bc6fbc61df77c3fcfe180fc32b93538c4f1031dd802ccb5f2ff0" +checksum = "017a1385b05d631e7875b1f151c9f012d37b53491e2a87f65bff5c262b2111d8" dependencies = [ "cc", "codespan-reporting", @@ -2179,15 +2194,15 @@ dependencies = [ [[package]] name = "cxxbridge-flags" -version = "1.0.85" +version = "1.0.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69a3e162fde4e594ed2b07d0f83c6c67b745e7f28ce58c6df5e6b6bef99dfb59" +checksum = "c26bbb078acf09bc1ecda02d4223f03bdd28bd4874edcb0379138efc499ce971" [[package]] name = "cxxbridge-macro" -version = "1.0.85" +version = "1.0.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e7e2adeb6a0d4a282e581096b06e1791532b7d576dcde5ccd9382acf55db8e6" +checksum = "357f40d1f06a24b60ae1fe122542c1fb05d28d32acb2aed064e84bc2ad1e252e" dependencies = [ "proc-macro2", "quote", @@ -2854,9 +2869,9 @@ dependencies = [ [[package]] name = "ed25519" -version = "1.5.2" +version = "1.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e9c280362032ea4203659fc489832d0204ef09f247a0506f170dafcac08c369" +checksum = "91cff35c70bba8a626e3185d8cd48cc11b5437e1a5bcd15b9b5fa3c64b6dfee7" dependencies = [ "signature", ] @@ -2891,9 +2906,9 @@ dependencies = [ [[package]] name = "either" -version = "1.8.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797" +checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" [[package]] name = "elliptic-curve" @@ -2989,6 +3004,19 @@ dependencies = [ "termcolor", ] +[[package]] +name = "env_logger" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85cdab6a89accf66733ad5a1693a4dcced6aeff64602b634530dd73c1f3ee9f0" +dependencies = [ + "humantime 2.1.0", + "is-terminal", + "log", + "regex", + "termcolor", +] + [[package]] name = "environmental" version = "1.1.4" @@ -3384,11 +3412,11 @@ checksum = "a214f5bb88731d436478f3ae1f8a277b62124089ba9fb67f4f93fb100ef73c90" [[package]] name = "file-per-thread-logger" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21e16290574b39ee41c71aeb90ae960c504ebaf1e2a1c87bd52aa56ed6e1a02f" +checksum = "84f2e425d9790201ba4af4630191feac6dcc98765b118d4d18e91d23c2353866" dependencies = [ - "env_logger 0.9.3", + "env_logger 0.10.0", "log", ] @@ -3406,9 +3434,9 @@ dependencies = [ [[package]] name = "finality-grandpa" -version = "0.16.0" +version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b22349c6a11563a202d95772a68e0fcf56119e74ea8a2a19cf2301460fcd0df5" +checksum = "e24e6c429951433ccb7c87fd528c60084834dcd14763182c1f83291bcde24c34" dependencies = [ "either", "futures", @@ -3862,9 +3890,9 @@ checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" [[package]] name = "futures" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38390104763dc37a5145a53c29c63c1290b5d316d6086ec32c293f6736051bb0" +checksum = "13e2792b0ff0340399d58445b88fd9770e3489eff258a4cbc1523418f12abf84" dependencies = [ "futures-channel", "futures-core", @@ -3877,9 +3905,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52ba265a92256105f45b719605a571ffe2d1f0fea3807304b522c1d778f79eed" +checksum = "2e5317663a9089767a1ec00a487df42e0ca174b61b4483213ac24448e4664df5" dependencies = [ "futures-core", "futures-sink", @@ -3887,15 +3915,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04909a7a7e4633ae6c4a9ab280aeb86da1236243a77b694a49eacd659a4bd3ac" +checksum = "ec90ff4d0fe1f57d600049061dc6bb68ed03c7d2fbd697274c41805dcb3f8608" [[package]] name = "futures-executor" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7acc85df6714c176ab5edf386123fafe217be88c0840ec11f199441134a074e2" +checksum = "e8de0a35a6ab97ec8869e32a2473f4b1324459e14c29275d14b10cb1fd19b50e" dependencies = [ "futures-core", "futures-task", @@ -3905,9 +3933,9 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00f5fb52a06bdcadeb54e8d3671f8888a39697dcb0b81b23b55174030427f4eb" +checksum = "bfb8371b6fb2aeb2d280374607aeabfc99d95c72edfe51692e42d3d7f0d08531" [[package]] name = "futures-lite" @@ -3926,9 +3954,9 @@ dependencies = [ [[package]] name = "futures-macro" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdfb8ce053d86b91919aad980c220b1fb8401a9394410e1c289ed7e66b61835d" +checksum = "95a73af87da33b5acf53acfebdc339fe592ecf5357ac7c0a7734ab9d8c876a70" dependencies = [ "proc-macro2", "quote", @@ -3948,15 +3976,15 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39c15cf1a4aa79df40f1bb462fb39676d0ad9e366c2a33b590d7c66f4f81fcf9" +checksum = "f310820bb3e8cfd46c80db4d7fb8353e15dfff853a127158425f31e0be6c8364" [[package]] name = "futures-task" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ffb393ac5d9a6eaa9d3fdf37ae2776656b706e200c8e16b1bdb227f5198e6ea" +checksum = "dcf79a1bf610b10f42aea489289c5a2c478a786509693b80cd39c44ccd936366" [[package]] name = "futures-timer" @@ -3966,9 +3994,9 @@ checksum = "e64b03909df88034c26dc1547e8970b91f98bdb65165d6a4e9110d94263dbb2c" [[package]] name = "futures-util" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "197676987abd2f9cadff84926f410af1c183608d36641465df73ae8211dc65d6" +checksum = "9c1d6de3acfef38d2be4b1f543f553131788603495be83da675e180c8d6b7bd1" dependencies = [ "futures-channel", "futures-core", @@ -4067,24 +4095,24 @@ dependencies = [ [[package]] name = "gimli" -version = "0.27.0" +version = "0.27.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dec7af912d60cdbd3677c1af9352ebae6fb8394d165568a2234df0fa00f87793" +checksum = "221996f774192f0f718773def8201c4ae31f02616a54ccfc2d358bb0e5cefdec" [[package]] name = "glob" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" +checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" [[package]] name = "globset" -version = "0.4.9" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a1e17342619edbc21a964c2afbeb6c820c6a2560032872f397bb97ea127bd0a" +checksum = "029d74589adefde59de1a0c4f4732695c32805624aec7b68d91503d4dba79afc" dependencies = [ "aho-corasick", - "bstr", + "bstr 1.1.0", "fnv", "log", "regex", @@ -4092,9 +4120,9 @@ dependencies = [ [[package]] name = "gloo-timers" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98c4a8d6391675c6b2ee1a6c8d06e8e2d03605c44cec1270675985a4c2a5500b" +checksum = "9b995a66bb87bebce9a0f4a95aed01daca4872c050bfcb21653361c03bc35e5c" dependencies = [ "futures-channel", "futures-core", @@ -4508,9 +4536,9 @@ checksum = "59ce5ef949d49ee85593fc4d3f3f95ad61657076395cbbce23e2121fc5542074" [[package]] name = "io-lifetimes" -version = "1.0.3" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46112a93252b123d31a119a8d1a1ac19deac4fac6e0e8b0df58f0d4e5870e63c" +checksum = "e7d6c6f8c91b4b9ed43484ad1a938e393caf35960fce7f82a040497207bd8e9e" dependencies = [ "libc", "windows-sys 0.42.0", @@ -4536,9 +4564,9 @@ dependencies = [ [[package]] name = "ipnet" -version = "2.7.0" +version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11b0d96e660696543b251e58030cf9787df56da39dab19ad60eae7353040917e" +checksum = "30e22bd8629359895450b59ea7a776c850561b96a3b1d31321c1949d9e6c9146" [[package]] name = "is-terminal" @@ -4547,8 +4575,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "28dfb6c8100ccc63462345b67d1bbc3679177c75ee4bf59bf29c8b1d110b8189" dependencies = [ "hermit-abi 0.2.6", - "io-lifetimes 1.0.3", - "rustix 0.36.5", + "io-lifetimes 1.0.4", + "rustix 0.36.7", "windows-sys 0.42.0", ] @@ -5535,9 +5563,9 @@ dependencies = [ [[package]] name = "matches" -version = "0.1.9" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" +checksum = "2532096657941c2fea9c289d370a250971c689d4f143798ff67113ec042024a5" [[package]] name = "matrixmultiply" @@ -5560,7 +5588,7 @@ version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b20a59d985586e4a5aef64564ac77299f8586d8be6cf9106a5a40207e8908efb" dependencies = [ - "rustix 0.36.5", + "rustix 0.36.7", ] [[package]] @@ -5855,9 +5883,9 @@ dependencies = [ [[package]] name = "netlink-packet-utils" -version = "0.5.1" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25af9cf0dc55498b7bd94a1508af7a78706aa0ab715a73c5169273e03c84845e" +checksum = "0ede8a08c71ad5a95cdd0e4e52facd37190977039a4704eb82a283f713747d34" dependencies = [ "anyhow", "byteorder", @@ -5882,9 +5910,9 @@ dependencies = [ [[package]] name = "netlink-sys" -version = "0.8.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92b654097027250401127914afb37cb1f311df6610a9891ff07a757e94199027" +checksum = "260e21fbb6f3d253a14df90eb0000a6066780a15dd901a7519ce02d77a94985b" dependencies = [ "async-io", "bytes", @@ -5918,14 +5946,23 @@ checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451" [[package]] name = "nom" -version = "7.1.1" +version = "7.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8903e5a29a317527874d0402f867152a3d21c908bb0b933e416c65e301d4c36" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" dependencies = [ "memchr", "minimal-lexical", ] +[[package]] +name = "nom8" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae01545c9c7fc4486ab7debaf2aad7003ac19431791868fb2e8066df97fad2f8" +dependencies = [ + "memchr", +] + [[package]] name = "normalize-line-endings" version = "0.3.0" @@ -5959,9 +5996,9 @@ dependencies = [ [[package]] name = "num-complex" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ae39348c8bc5fbd7f40c727a9925f03517afd2ab27d46702108b6a7e5414c19" +checksum = "02e0d21255c828d6f128a1e41534206671e8c3ea0c62f32291e808dc82cff17d" dependencies = [ "num-traits", ] @@ -6031,18 +6068,18 @@ dependencies = [ [[package]] name = "num_enum" -version = "0.5.7" +version = "0.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf5395665662ef45796a4ff5486c5d41d29e0c09640af4c5f17fd94ee2c119c9" +checksum = "8d829733185c1ca374f17e52b762f24f535ec625d2cc1f070e34c8a9068f341b" dependencies = [ "num_enum_derive", ] [[package]] name = "num_enum_derive" -version = "0.5.7" +version = "0.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b0498641e53dd6ac1a4f22547548caa6864cc4933784319cd1775271c5a46ce" +checksum = "2be1598bf1c313dcdd12092e3f1920f463462525a21b7b4e11b4168353d0123e" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -6064,18 +6101,18 @@ dependencies = [ [[package]] name = "object" -version = "0.30.0" +version = "0.30.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "239da7f290cfa979f43f85a8efeee9a8a76d0827c356d37f9d3d7254d6b537fb" +checksum = "ea86265d3d3dcb6a27fc51bd29a4bf387fae9d2986b823079d4986af253eb439" dependencies = [ "memchr", ] [[package]] name = "once_cell" -version = "1.16.0" +version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860" +checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66" [[package]] name = "opaque-debug" @@ -7466,9 +7503,9 @@ dependencies = [ [[package]] name = "parity-db" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a7511a0bec4a336b5929999d02b560d2439c993cccf98c26481484e811adc43" +checksum = "dd684a725651d9588ef21f140a328b6b4f64e646b2e931f3e6f14f75eedf9980" dependencies = [ "blake2", "crc32fast", @@ -7485,9 +7522,9 @@ dependencies = [ [[package]] name = "parity-scale-codec" -version = "3.2.1" +version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "366e44391a8af4cfd6002ef6ba072bae071a96aafca98d7d448a34c5dca38b6a" +checksum = "c3840933452adf7b3b9145e27086a5a3376c619dca1a21b1e5a5af0d54979bed" dependencies = [ "arrayvec 0.7.2", "bitvec", @@ -7500,9 +7537,9 @@ dependencies = [ [[package]] name = "parity-scale-codec-derive" -version = "3.1.3" +version = "3.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9299338969a3d2f491d65f140b00ddec470858402f888af98e8642fb5e8965cd" +checksum = "86b26a931f824dd4eca30b3e43bb4f31cd5f0d3a403c5f5ff27106b805bfde7b" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -7575,7 +7612,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" dependencies = [ "lock_api", - "parking_lot_core 0.9.5", + "parking_lot_core 0.9.6", ] [[package]] @@ -7594,9 +7631,9 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.5" +version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ff9f3fef3968a3ec5945535ed654cb38ff72d7495a25619e2247fb15a2ed9ba" +checksum = "ba1ef8814b5c993410bb3adfad7a5ed269563e4a2f90c41f5d85be7fb47133bf" dependencies = [ "cfg-if", "libc", @@ -7643,9 +7680,9 @@ checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" [[package]] name = "pest" -version = "2.5.2" +version = "2.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f6e86fb9e7026527a0d46bc308b841d73170ef8f443e1807f6ef88526a816d4" +checksum = "4ab62d2fa33726dbe6321cc97ef96d8cde531e3eeaf858a058de53a8a6d40d8f" dependencies = [ "thiserror", "ucd-trie", @@ -7653,9 +7690,9 @@ dependencies = [ [[package]] name = "pest_derive" -version = "2.5.2" +version = "2.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96504449aa860c8dcde14f9fba5c58dc6658688ca1fe363589d6327b8662c603" +checksum = "8bf026e2d0581559db66d837fe5242320f525d85c76283c61f4d51a1238d65ea" dependencies = [ "pest", "pest_generator", @@ -7663,9 +7700,9 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.5.2" +version = "2.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "798e0220d1111ae63d66cb66a5dcb3fc2d986d520b98e49e1852bfdb11d7c5e7" +checksum = "2b27bd18aa01d91c8ed2b61ea23406a676b42d82609c6e2581fba42f0c15f17f" dependencies = [ "pest", "pest_meta", @@ -7676,13 +7713,13 @@ dependencies = [ [[package]] name = "pest_meta" -version = "2.5.2" +version = "2.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "984298b75898e30a843e278a9f2452c31e349a073a0ce6fd950a12a74464e065" +checksum = "9f02b677c1859756359fc9983c2e56a0237f18624a3789528804406b7e915e5d" dependencies = [ "once_cell", "pest", - "sha1", + "sha2 0.10.6", ] [[package]] @@ -9024,9 +9061,9 @@ dependencies = [ [[package]] name = "prettyplease" -version = "0.1.22" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c8992a85d8e93a28bdf76137db888d3874e3b230dee5ed8bebac4c9f7617773" +checksum = "e97e3215779627f01ee256d2fad52f3d95e8e1c11e9fc6fd08f7cd455d5d5c78" dependencies = [ "proc-macro2", "syn", @@ -9075,13 +9112,12 @@ dependencies = [ [[package]] name = "proc-macro-crate" -version = "1.2.1" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eda0fc3b0fb7c975631757e14d9049da17374063edb6ebbcbc54d880d4fe94e9" +checksum = "66618389e4ec1c7afe67d51a9bf34ff9236480f8d51e7489b7d5ab0303c13f34" dependencies = [ "once_cell", - "thiserror", - "toml", + "toml_edit", ] [[package]] @@ -9110,9 +9146,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.49" +version = "1.0.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57a8eca9f9c4ffde41714334dee777596264c7825420f521abc92b5b5deb63a5" +checksum = "6ef7d57beacfaf2d8aee5937dab7b7f28de3cb8b1828479bb5de2a7106f2bae2" dependencies = [ "unicode-ident", ] @@ -9156,9 +9192,9 @@ dependencies = [ [[package]] name = "prost" -version = "0.11.5" +version = "0.11.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c01db6702aa05baa3f57dec92b8eeeeb4cb19e894e73996b32a4093289e54592" +checksum = "21dc42e00223fc37204bd4aa177e69420c604ca4a183209a8f9de30c6d934698" dependencies = [ "bytes", "prost-derive", @@ -9166,9 +9202,9 @@ dependencies = [ [[package]] name = "prost-build" -version = "0.11.5" +version = "0.11.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb5320c680de74ba083512704acb90fe00f28f79207286a848e730c45dd73ed6" +checksum = "a3f8ad728fb08fe212df3c05169e940fbb6d9d16a877ddde14644a983ba2012e" dependencies = [ "bytes", "heck", @@ -9201,9 +9237,9 @@ dependencies = [ [[package]] name = "prost-derive" -version = "0.11.5" +version = "0.11.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8842bad1a5419bca14eac663ba798f6bc19c413c2fdceb5f3ba3b0932d96720" +checksum = "8bda8c0881ea9f722eb9629376db3d0b903b462477c1aafcb0566610ac28ac5d" dependencies = [ "anyhow", "itertools", @@ -9214,9 +9250,9 @@ dependencies = [ [[package]] name = "prost-types" -version = "0.11.5" +version = "0.11.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "017f79637768cde62820bc2d4fe0e45daaa027755c323ad077767c6c5f173091" +checksum = "a5e0526209433e96d83d750dd81a99118edbc55739e7e61a46764fd2ad537788" dependencies = [ "bytes", "prost", @@ -9381,9 +9417,9 @@ dependencies = [ [[package]] name = "rayon-core" -version = "1.10.1" +version = "1.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cac410af5d00ab6884528b4ab69d1e8e146e8d471201800fa1b4524126de6ad3" +checksum = "356a0625f1954f730c0201cdab48611198dc6ce21f4acff55089b5a78e6e835b" dependencies = [ "crossbeam-channel", "crossbeam-deque", @@ -9458,9 +9494,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.7.0" +version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e076559ef8e241f2ae3479e36f97bd5741c0330689e217ad51ce2c76808b868a" +checksum = "48aaa5748ba571fb95cd2c85c09f629215d3a6ece942baa100950af03a34f733" dependencies = [ "aho-corasick", "memchr", @@ -9763,13 +9799,13 @@ dependencies = [ [[package]] name = "rustix" -version = "0.36.5" +version = "0.36.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3807b5d10909833d3e9acd1eb5fb988f79376ff10fce42937de71a449c4c588" +checksum = "d4fdebc4b395b7fbb9ab11e462e20ed9051e7b16e42d24042c776eca0ac81b03" dependencies = [ "bitflags", "errno", - "io-lifetimes 1.0.3", + "io-lifetimes 1.0.4", "libc", "linux-raw-sys 0.1.4", "windows-sys 0.42.0", @@ -9777,9 +9813,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.20.7" +version = "0.20.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "539a2bfe908f471bfa933876bd1eb6a19cf2176d375f82ef7f99530a40e48c2c" +checksum = "fff78fc74d175294f4e83b28343315ffcfb114b156f0185e9741cb5570f50e2f" dependencies = [ "log", "ring", @@ -9801,11 +9837,11 @@ dependencies = [ [[package]] name = "rustls-pemfile" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0864aeff53f8c05aa08d86e5ef839d3dfcf07aeba2db32f12db0ef716e87bd55" +checksum = "d194b56d58803a43635bdc398cd17e383d6f71f9182b9a192c127ca42494a59b" dependencies = [ - "base64 0.13.1", + "base64 0.21.0", ] [[package]] @@ -10945,12 +10981,11 @@ dependencies = [ [[package]] name = "schannel" -version = "0.1.20" +version = "0.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88d6731146462ea25d9244b2ed5fd1d716d25c52e4d54aa4fb0f3c4e9854dbe2" +checksum = "713cfb06c7059f3588fb8044c0fad1d09e3c01d225e25b9220dbfdcf16dbb1b3" dependencies = [ - "lazy_static", - "windows-sys 0.36.1", + "windows-sys 0.42.0", ] [[package]] @@ -11009,9 +11044,9 @@ dependencies = [ [[package]] name = "secp256k1" -version = "0.24.2" +version = "0.24.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9512ffd81e3a3503ed401f79c33168b9148c75038956039166cd750eaa037c3" +checksum = "6b1629c9c557ef9b293568b338dddfc8208c98a18c59d722a9d53f859d9c9b62" dependencies = [ "secp256k1-sys", ] @@ -11036,9 +11071,9 @@ dependencies = [ [[package]] name = "security-framework" -version = "2.7.0" +version = "2.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bc1bb97804af6631813c55739f771071e0f2ed33ee20b68c86ec505d906356c" +checksum = "a332be01508d814fed64bf28f798a146d73792121129962fdf335bb3c49a4254" dependencies = [ "bitflags", "core-foundation", @@ -11049,9 +11084,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.6.1" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0160a13a177a45bfb43ce71c01580998474f556ad854dcbca936dd2841a5c556" +checksum = "31c9bb296072e961fcbd8853511dd39c2d8be2deb1e17c6860b1d30732b323b4" dependencies = [ "core-foundation-sys", "libc", @@ -11083,18 +11118,18 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.151" +version = "1.0.152" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97fed41fc1a24994d044e6db6935e69511a1153b52c15eb42493b26fa87feba0" +checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.151" +version = "1.0.152" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "255abe9a125a985c05190d687b320c12f9b1f0b99445e608c21ba0782c719ad8" +checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e" dependencies = [ "proc-macro2", "quote", @@ -11134,17 +11169,6 @@ dependencies = [ "opaque-debug 0.3.0", ] -[[package]] -name = "sha1" -version = "0.10.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3" -dependencies = [ - "cfg-if", - "cpufeatures", - "digest 0.10.6", -] - [[package]] name = "sha2" version = "0.8.2" @@ -11278,7 +11302,7 @@ version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "420acb44afdae038210c99e69aae24109f32f15500aa708e81d46c9f29d55fcf" dependencies = [ - "bstr", + "bstr 0.2.17", "unicode-segmentation", ] @@ -12122,9 +12146,9 @@ dependencies = [ [[package]] name = "ss58-registry" -version = "1.36.0" +version = "1.38.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23d92659e7d18d82b803824a9ba5a6022cff101c3491d027c1c1d8d30e749284" +checksum = "e40c020d72bc0a9c5660bb71e4a6fdef081493583062c474740a7d59f55f0e7b" dependencies = [ "Inflector", "num-format", @@ -12449,23 +12473,13 @@ dependencies = [ [[package]] name = "termcolor" -version = "1.1.3" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" +checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" dependencies = [ "winapi-util", ] -[[package]] -name = "terminal_size" -version = "0.1.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "633c1a546cee861a1a6d0dc69ebeca693bf4296661ba7852b9d21d159e0506df" -dependencies = [ - "libc", - "winapi", -] - [[package]] name = "termtree" version = "0.4.0" @@ -12596,9 +12610,9 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" [[package]] name = "tokio" -version = "1.23.0" +version = "1.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eab6d665857cc6ca78d6e80303a02cea7a7851e85dfbd77cbdc09bd129f1ef46" +checksum = "c8e00990ebabbe4c14c08aca901caed183ecd5c09562a12c824bb53d3c3fd3af" dependencies = [ "autocfg", "bytes", @@ -12664,13 +12678,30 @@ dependencies = [ [[package]] name = "toml" -version = "0.5.10" +version = "0.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1333c76748e868a4d9d1017b5ab53171dfd095f70c712fdb4653a406547f598f" +checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" dependencies = [ "serde", ] +[[package]] +name = "toml_datetime" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4553f467ac8e3d374bc9a177a26801e5d0f9b211aa1673fb137a403afd1c9cf5" + +[[package]] +name = "toml_edit" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56c59d8dd7d0dcbc6428bf7aa2f0e823e26e43b3c9aca15bbc9475d23e5fa12b" +dependencies = [ + "indexmap", + "nom8", + "toml_datetime", +] + [[package]] name = "tower-service" version = "0.3.2" @@ -12864,9 +12895,9 @@ dependencies = [ [[package]] name = "try-lock" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" +checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" [[package]] name = "try-runtime-cli" @@ -12957,9 +12988,9 @@ dependencies = [ [[package]] name = "unicode-bidi" -version = "0.3.8" +version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992" +checksum = "d54675592c1dbefd78cbd98db9bacd89886e1ca50692a0692baefffdeb92dd58" [[package]] name = "unicode-ident" @@ -13599,9 +13630,9 @@ dependencies = [ [[package]] name = "which" -version = "4.3.0" +version = "4.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c831fbbee9e129a8cf93e7747a82da9d95ba8e16621cae60ec2cdc849bacb7b" +checksum = "2441c784c52b289a054b7201fc93253e288f094e2f4be9058343127c4226a269" dependencies = [ "either", "libc", @@ -13678,19 +13709,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" dependencies = [ "windows_aarch64_gnullvm", - "windows_aarch64_msvc 0.42.0", - "windows_i686_gnu 0.42.0", - "windows_i686_msvc 0.42.0", - "windows_x86_64_gnu 0.42.0", + "windows_aarch64_msvc 0.42.1", + "windows_i686_gnu 0.42.1", + "windows_i686_msvc 0.42.1", + "windows_x86_64_gnu 0.42.1", "windows_x86_64_gnullvm", - "windows_x86_64_msvc 0.42.0", + "windows_x86_64_msvc 0.42.1", ] [[package]] name = "windows_aarch64_gnullvm" -version = "0.42.0" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41d2aa71f6f0cbe00ae5167d90ef3cfe66527d6f613ca78ac8024c3ccab9a19e" +checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608" [[package]] name = "windows_aarch64_msvc" @@ -13706,9 +13737,9 @@ checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" [[package]] name = "windows_aarch64_msvc" -version = "0.42.0" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4" +checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7" [[package]] name = "windows_i686_gnu" @@ -13724,9 +13755,9 @@ checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" [[package]] name = "windows_i686_gnu" -version = "0.42.0" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbeae19f6716841636c28d695375df17562ca208b2b7d0dc47635a50ae6c5de7" +checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640" [[package]] name = "windows_i686_msvc" @@ -13742,9 +13773,9 @@ checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" [[package]] name = "windows_i686_msvc" -version = "0.42.0" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84c12f65daa39dd2babe6e442988fc329d6243fdce47d7d2d155b8d874862246" +checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605" [[package]] name = "windows_x86_64_gnu" @@ -13760,15 +13791,15 @@ checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" [[package]] name = "windows_x86_64_gnu" -version = "0.42.0" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf7b1b21b5362cbc318f686150e5bcea75ecedc74dd157d874d754a2ca44b0ed" +checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45" [[package]] name = "windows_x86_64_gnullvm" -version = "0.42.0" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09d525d2ba30eeb3297665bd434a54297e4170c7f1a44cad4ef58095b4cd2028" +checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463" [[package]] name = "windows_x86_64_msvc" @@ -13784,9 +13815,9 @@ checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" [[package]] name = "windows_x86_64_msvc" -version = "0.42.0" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5" +checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd" [[package]] name = "winreg" @@ -13960,10 +13991,11 @@ dependencies = [ [[package]] name = "zstd-sys" -version = "2.0.4+zstd.1.5.2" +version = "2.0.5+zstd.1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fa202f2ef00074143e219d15b62ffc317d17cc33909feac471c044087cad7b0" +checksum = "edc50ffce891ad571e9f9afe5039c4837bede781ac4bb13052ed7ae695518596" dependencies = [ "cc", "libc", + "pkg-config", ] diff --git a/node/Cargo.toml b/node/Cargo.toml index 5aae74c63..f9d496488 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -17,7 +17,7 @@ substrate-build-script-utils = { git = "https://github.com/paritytech/substrate" array-bytes = { version = "6.0" } async-trait = { version = "0.1" } clap = { version = "4.0", features = ["derive"] } -codec = { package = "parity-scale-codec", version = "3.2" } +codec = { package = "parity-scale-codec", version = "3.3" } futures = { version = "0.3" } jsonrpsee = { version = "0.15", features = ["server"] } log = { version = "0.4" } diff --git a/pallet/account-migration/Cargo.toml b/pallet/account-migration/Cargo.toml index 218be4810..203adcc30 100644 --- a/pallet/account-migration/Cargo.toml +++ b/pallet/account-migration/Cargo.toml @@ -12,7 +12,7 @@ version = "6.0.0" [dependencies] # crates.io array-bytes = { version = "6.0" } -codec = { package = "parity-scale-codec", version = "3.2", default-features = false, features = ["derive"] } +codec = { package = "parity-scale-codec", version = "3.3", default-features = false, features = ["derive"] } scale-info = { version = "2.3", default-features = false, features = ["derive"] } # darwinia diff --git a/pallet/deposit/Cargo.toml b/pallet/deposit/Cargo.toml index 0368d8aac..55ee4d13b 100644 --- a/pallet/deposit/Cargo.toml +++ b/pallet/deposit/Cargo.toml @@ -11,7 +11,7 @@ version = "6.0.0" [dependencies] # crates.io -codec = { package = "parity-scale-codec", version = "3.2", default-features = false, features = ["derive"] } +codec = { package = "parity-scale-codec", version = "3.3", default-features = false, features = ["derive"] } scale-info = { version = "2.3", default-features = false } # darwinia diff --git a/pallet/ecdsa-authority/Cargo.toml b/pallet/ecdsa-authority/Cargo.toml index f739e0aa8..6a10ceaeb 100644 --- a/pallet/ecdsa-authority/Cargo.toml +++ b/pallet/ecdsa-authority/Cargo.toml @@ -11,7 +11,7 @@ version = "2.10.1" [dependencies] # crates.io -codec = { package = "parity-scale-codec", version = "3.2", default-features = false, features = ["derive"] } +codec = { package = "parity-scale-codec", version = "3.3", default-features = false, features = ["derive"] } ethabi = { version = "17.0", default-features = false } scale-info = { version = "2.3", default-features = false } diff --git a/pallet/message-gadget/Cargo.toml b/pallet/message-gadget/Cargo.toml index 5c358f671..2e18d1860 100644 --- a/pallet/message-gadget/Cargo.toml +++ b/pallet/message-gadget/Cargo.toml @@ -11,7 +11,7 @@ version = "6.0.0" [dependencies] # crates.io -codec = { package = "parity-scale-codec", version = "3.2", default-features = false } +codec = { package = "parity-scale-codec", version = "3.3", default-features = false } scale-info = { version = "2.3", default-features = false, features = ["derive"] } # frontier diff --git a/pallet/message-transact/Cargo.toml b/pallet/message-transact/Cargo.toml index 15eec2774..fcd39611d 100644 --- a/pallet/message-transact/Cargo.toml +++ b/pallet/message-transact/Cargo.toml @@ -11,7 +11,7 @@ version = "6.0.0" [dependencies] # crates.io -codec = { package = "parity-scale-codec", version = "3.2", default-features = false, features = ["derive"] } +codec = { package = "parity-scale-codec", version = "3.3", default-features = false, features = ["derive"] } ethereum = { version = "0.14", default-features = false, features = ["with-codec"] } scale-info = { version = "2.3", default-features = false, features = ["derive"] } diff --git a/pallet/staking/Cargo.toml b/pallet/staking/Cargo.toml index 363868751..dcdbea2b9 100644 --- a/pallet/staking/Cargo.toml +++ b/pallet/staking/Cargo.toml @@ -11,7 +11,7 @@ version = "6.0.0" [dependencies] # crates.io -codec = { package = "parity-scale-codec", version = "3.2", default-features = false, features = ["derive"] } +codec = { package = "parity-scale-codec", version = "3.3", default-features = false, features = ["derive"] } scale-info = { version = "2.3", default-features = false } # darwinia diff --git a/precompile/assets/Cargo.toml b/precompile/assets/Cargo.toml index 6ee038a46..2200c55bd 100644 --- a/precompile/assets/Cargo.toml +++ b/precompile/assets/Cargo.toml @@ -26,7 +26,7 @@ sp-std = { default-features = false, git = "https://github.com/paritytech sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } [dev-dependencies] # crates.io -codec = { package = "parity-scale-codec", version = "3.2" } +codec = { package = "parity-scale-codec", version = "3.3" } scale-info = { version = "2.3", features = ["derive"] } sha3 = { version = "0.8" } diff --git a/precompile/bls12-381/Cargo.toml b/precompile/bls12-381/Cargo.toml index a866b20b8..9f8bd4455 100644 --- a/precompile/bls12-381/Cargo.toml +++ b/precompile/bls12-381/Cargo.toml @@ -25,7 +25,7 @@ sp-std = { default-features = false, git = "https://github.com/paritytech [dev-dependencies] # crates.io -codec = { package = "parity-scale-codec", version = "3.2" } +codec = { package = "parity-scale-codec", version = "3.3" } scale-info = { version = "2.3", features = ["derive"] } # moonbeam diff --git a/precompile/deposit/Cargo.toml b/precompile/deposit/Cargo.toml index 49152047c..38b5ba967 100644 --- a/precompile/deposit/Cargo.toml +++ b/precompile/deposit/Cargo.toml @@ -28,7 +28,7 @@ sp-std = { default-features = false, git = "https://github.com/paritytech [dev-dependencies] # crates.io -codec = { package = "parity-scale-codec", version = "3.2" } +codec = { package = "parity-scale-codec", version = "3.3" } scale-info = { version = "2.3", features = ["derive"] } # moonbeam diff --git a/precompile/staking/Cargo.toml b/precompile/staking/Cargo.toml index c7b74f720..373e0103c 100644 --- a/precompile/staking/Cargo.toml +++ b/precompile/staking/Cargo.toml @@ -29,7 +29,7 @@ sp-std = { default-features = false, git = "https://github.com/paritytech [dev-dependencies] # crates.io -codec = { package = "parity-scale-codec", version = "3.2" } +codec = { package = "parity-scale-codec", version = "3.3" } scale-info = { version = "2.3", features = ["derive"] } # darwinia diff --git a/precompile/state-storage/Cargo.toml b/precompile/state-storage/Cargo.toml index ad5e5584f..c07c5163c 100644 --- a/precompile/state-storage/Cargo.toml +++ b/precompile/state-storage/Cargo.toml @@ -23,7 +23,7 @@ sp-std = { default-features = false, git = "https://github.com/paritytech [dev-dependencies] # crates.io -codec = { package = "parity-scale-codec", version = "3.2" } +codec = { package = "parity-scale-codec", version = "3.3" } scale-info = { version = "2.3", features = ["derive"] } # moonbeam diff --git a/runtime/common/Cargo.toml b/runtime/common/Cargo.toml index 2902e7f2c..263024b22 100644 --- a/runtime/common/Cargo.toml +++ b/runtime/common/Cargo.toml @@ -11,7 +11,7 @@ version = "6.0.0" [dependencies] # crates.io -codec = { package = "parity-scale-codec", version = "3.2", default-features = false } +codec = { package = "parity-scale-codec", version = "3.3", default-features = false } smallvec = { version = "1.10" } # darwinia diff --git a/runtime/crab/Cargo.toml b/runtime/crab/Cargo.toml index e528d9b1d..c295578a3 100644 --- a/runtime/crab/Cargo.toml +++ b/runtime/crab/Cargo.toml @@ -14,7 +14,7 @@ substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", bran [dependencies] # crates.io -codec = { package = "parity-scale-codec", version = "3.2", default-features = false, features = ["derive"] } +codec = { package = "parity-scale-codec", version = "3.3", default-features = false, features = ["derive"] } scale-info = { version = "2.3", default-features = false, features = ["derive"] } static_assertions = { version = "1.1" } # crates.io optional diff --git a/runtime/darwinia/Cargo.toml b/runtime/darwinia/Cargo.toml index 04c21b309..693ca9a30 100644 --- a/runtime/darwinia/Cargo.toml +++ b/runtime/darwinia/Cargo.toml @@ -14,7 +14,7 @@ substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", bran [dependencies] # crates.io -codec = { package = "parity-scale-codec", version = "3.2", default-features = false, features = ["derive"] } +codec = { package = "parity-scale-codec", version = "3.3", default-features = false, features = ["derive"] } scale-info = { version = "2.3", default-features = false, features = ["derive"] } static_assertions = { version = "1.1" } # crates.io optional diff --git a/runtime/pangolin/Cargo.toml b/runtime/pangolin/Cargo.toml index bcb371fea..f3da526f8 100644 --- a/runtime/pangolin/Cargo.toml +++ b/runtime/pangolin/Cargo.toml @@ -14,7 +14,7 @@ substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", bran [dependencies] # crates.io -codec = { package = "parity-scale-codec", version = "3.2", default-features = false, features = ["derive"] } +codec = { package = "parity-scale-codec", version = "3.3", default-features = false, features = ["derive"] } scale-info = { version = "2.3", default-features = false, features = ["derive"] } static_assertions = { version = "1.1" } # crates.io optional diff --git a/tool/am-signer/Cargo.lock b/tool/am-signer/Cargo.lock index 1c4f14d10..dc0766e52 100644 --- a/tool/am-signer/Cargo.lock +++ b/tool/am-signer/Cargo.lock @@ -582,9 +582,9 @@ checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" [[package]] name = "futures" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38390104763dc37a5145a53c29c63c1290b5d316d6086ec32c293f6736051bb0" +checksum = "13e2792b0ff0340399d58445b88fd9770e3489eff258a4cbc1523418f12abf84" dependencies = [ "futures-channel", "futures-core", @@ -597,9 +597,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52ba265a92256105f45b719605a571ffe2d1f0fea3807304b522c1d778f79eed" +checksum = "2e5317663a9089767a1ec00a487df42e0ca174b61b4483213ac24448e4664df5" dependencies = [ "futures-core", "futures-sink", @@ -607,15 +607,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04909a7a7e4633ae6c4a9ab280aeb86da1236243a77b694a49eacd659a4bd3ac" +checksum = "ec90ff4d0fe1f57d600049061dc6bb68ed03c7d2fbd697274c41805dcb3f8608" [[package]] name = "futures-executor" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7acc85df6714c176ab5edf386123fafe217be88c0840ec11f199441134a074e2" +checksum = "e8de0a35a6ab97ec8869e32a2473f4b1324459e14c29275d14b10cb1fd19b50e" dependencies = [ "futures-core", "futures-task", @@ -625,15 +625,15 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00f5fb52a06bdcadeb54e8d3671f8888a39697dcb0b81b23b55174030427f4eb" +checksum = "bfb8371b6fb2aeb2d280374607aeabfc99d95c72edfe51692e42d3d7f0d08531" [[package]] name = "futures-macro" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdfb8ce053d86b91919aad980c220b1fb8401a9394410e1c289ed7e66b61835d" +checksum = "95a73af87da33b5acf53acfebdc339fe592ecf5357ac7c0a7734ab9d8c876a70" dependencies = [ "proc-macro2", "quote", @@ -642,21 +642,21 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39c15cf1a4aa79df40f1bb462fb39676d0ad9e366c2a33b590d7c66f4f81fcf9" +checksum = "f310820bb3e8cfd46c80db4d7fb8353e15dfff853a127158425f31e0be6c8364" [[package]] name = "futures-task" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ffb393ac5d9a6eaa9d3fdf37ae2776656b706e200c8e16b1bdb227f5198e6ea" +checksum = "dcf79a1bf610b10f42aea489289c5a2c478a786509693b80cd39c44ccd936366" [[package]] name = "futures-util" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "197676987abd2f9cadff84926f410af1c183608d36641465df73ae8211dc65d6" +checksum = "9c1d6de3acfef38d2be4b1f543f553131788603495be83da675e180c8d6b7bd1" dependencies = [ "futures-channel", "futures-core", @@ -1705,7 +1705,7 @@ checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" [[package]] name = "sp-core" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate#6c1119016ff6b35e8ea79594edf20c03a39e3740" +source = "git+https://github.com/paritytech/substrate#129fee774a6d185d117a57fd1e81b3d0d05ad747" dependencies = [ "array-bytes 4.2.0", "base58", @@ -1747,7 +1747,7 @@ dependencies = [ [[package]] name = "sp-core-hashing" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate#6c1119016ff6b35e8ea79594edf20c03a39e3740" +source = "git+https://github.com/paritytech/substrate#129fee774a6d185d117a57fd1e81b3d0d05ad747" dependencies = [ "blake2", "byteorder", @@ -1761,7 +1761,7 @@ dependencies = [ [[package]] name = "sp-debug-derive" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate#6c1119016ff6b35e8ea79594edf20c03a39e3740" +source = "git+https://github.com/paritytech/substrate#129fee774a6d185d117a57fd1e81b3d0d05ad747" dependencies = [ "proc-macro2", "quote", @@ -1771,7 +1771,7 @@ dependencies = [ [[package]] name = "sp-externalities" version = "0.13.0" -source = "git+https://github.com/paritytech/substrate#6c1119016ff6b35e8ea79594edf20c03a39e3740" +source = "git+https://github.com/paritytech/substrate#129fee774a6d185d117a57fd1e81b3d0d05ad747" dependencies = [ "environmental", "parity-scale-codec", @@ -1782,7 +1782,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate#6c1119016ff6b35e8ea79594edf20c03a39e3740" +source = "git+https://github.com/paritytech/substrate#129fee774a6d185d117a57fd1e81b3d0d05ad747" dependencies = [ "bytes", "impl-trait-for-tuples", @@ -1800,7 +1800,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate#6c1119016ff6b35e8ea79594edf20c03a39e3740" +source = "git+https://github.com/paritytech/substrate#129fee774a6d185d117a57fd1e81b3d0d05ad747" dependencies = [ "Inflector", "proc-macro-crate", @@ -1812,12 +1812,12 @@ dependencies = [ [[package]] name = "sp-std" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate#6c1119016ff6b35e8ea79594edf20c03a39e3740" +source = "git+https://github.com/paritytech/substrate#129fee774a6d185d117a57fd1e81b3d0d05ad747" [[package]] name = "sp-storage" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate#6c1119016ff6b35e8ea79594edf20c03a39e3740" +source = "git+https://github.com/paritytech/substrate#129fee774a6d185d117a57fd1e81b3d0d05ad747" dependencies = [ "impl-serde", "parity-scale-codec", @@ -1830,7 +1830,7 @@ dependencies = [ [[package]] name = "sp-tracing" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate#6c1119016ff6b35e8ea79594edf20c03a39e3740" +source = "git+https://github.com/paritytech/substrate#129fee774a6d185d117a57fd1e81b3d0d05ad747" dependencies = [ "parity-scale-codec", "sp-std", @@ -1842,7 +1842,7 @@ dependencies = [ [[package]] name = "sp-wasm-interface" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate#6c1119016ff6b35e8ea79594edf20c03a39e3740" +source = "git+https://github.com/paritytech/substrate#129fee774a6d185d117a57fd1e81b3d0d05ad747" dependencies = [ "impl-trait-for-tuples", "log", diff --git a/tool/state-processor/Cargo.lock b/tool/state-processor/Cargo.lock index 18d7578f1..512f3f75e 100644 --- a/tool/state-processor/Cargo.lock +++ b/tool/state-processor/Cargo.lock @@ -55,6 +55,12 @@ dependencies = [ "winapi", ] +[[package]] +name = "autocfg" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + [[package]] name = "base64" version = "0.13.1" @@ -100,9 +106,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.11.1" +version = "3.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "572f695136211188308f16ad2ca5c851a712c464060ae6974944458eb83880ba" +checksum = "0d261e256854913907f67ed06efbc3338dfe6179796deefc1ff763fc1aee5535" [[package]] name = "byte-slice-cast" @@ -118,9 +124,9 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "cc" -version = "1.0.78" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a20104e2335ce8a659d6dd92a51a767a0c062599c73b343fd152cb401e828c3d" +checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" dependencies = [ "jobserver", ] @@ -293,6 +299,12 @@ dependencies = [ "wasi", ] +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" + [[package]] name = "hermit-abi" version = "0.1.19" @@ -347,6 +359,16 @@ dependencies = [ "syn", ] +[[package]] +name = "indexmap" +version = "1.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399" +dependencies = [ + "autocfg", + "hashbrown", +] + [[package]] name = "itoa" version = "1.0.5" @@ -407,6 +429,15 @@ version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" +[[package]] +name = "nom8" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae01545c9c7fc4486ab7debaf2aad7003ac19431791868fb2e8066df97fad2f8" +dependencies = [ + "memchr", +] + [[package]] name = "once_cell" version = "1.17.0" @@ -415,9 +446,9 @@ checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66" [[package]] name = "parity-scale-codec" -version = "3.2.1" +version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "366e44391a8af4cfd6002ef6ba072bae071a96aafca98d7d448a34c5dca38b6a" +checksum = "c3840933452adf7b3b9145e27086a5a3376c619dca1a21b1e5a5af0d54979bed" dependencies = [ "arrayvec 0.7.2", "bitvec", @@ -429,9 +460,9 @@ dependencies = [ [[package]] name = "parity-scale-codec-derive" -version = "3.1.3" +version = "3.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9299338969a3d2f491d65f140b00ddec470858402f888af98e8642fb5e8965cd" +checksum = "86b26a931f824dd4eca30b3e43bb4f31cd5f0d3a403c5f5ff27106b805bfde7b" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -445,6 +476,12 @@ version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" +[[package]] +name = "pkg-config" +version = "0.3.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160" + [[package]] name = "ppv-lite86" version = "0.2.17" @@ -474,20 +511,19 @@ dependencies = [ [[package]] name = "proc-macro-crate" -version = "1.2.1" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eda0fc3b0fb7c975631757e14d9049da17374063edb6ebbcbc54d880d4fe94e9" +checksum = "66618389e4ec1c7afe67d51a9bf34ff9236480f8d51e7489b7d5ab0303c13f34" dependencies = [ "once_cell", - "thiserror", - "toml", + "toml_edit", ] [[package]] name = "proc-macro2" -version = "1.0.49" +version = "1.0.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57a8eca9f9c4ffde41714334dee777596264c7825420f521abc92b5b5deb63a5" +checksum = "6ef7d57beacfaf2d8aee5937dab7b7f28de3cb8b1828479bb5de2a7106f2bae2" dependencies = [ "unicode-ident", ] @@ -554,9 +590,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.7.0" +version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e076559ef8e241f2ae3479e36f97bd5741c0330689e217ad51ce2c76808b868a" +checksum = "48aaa5748ba571fb95cd2c85c09f629215d3a6ece942baa100950af03a34f733" dependencies = [ "aho-corasick", "memchr", @@ -592,9 +628,9 @@ checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" [[package]] name = "rustls" -version = "0.20.7" +version = "0.20.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "539a2bfe908f471bfa933876bd1eb6a19cf2176d375f82ef7f99530a40e48c2c" +checksum = "fff78fc74d175294f4e83b28343315ffcfb114b156f0185e9741cb5570f50e2f" dependencies = [ "log", "ring", @@ -697,8 +733,8 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] name = "subhasher" -version = "0.9.0-rc20" -source = "git+https://github.com/hack-ink/subalfred#10f4207c4154eef9c489d97bdfc1cb960150bc87" +version = "0.9.1" +source = "git+https://github.com/hack-ink/subalfred#ea4615f1012a197b7d31d8b87a290027a5ecc818" dependencies = [ "blake2-rfc", "byteorder", @@ -709,8 +745,8 @@ dependencies = [ [[package]] name = "subspector" -version = "0.9.0-rc20" -source = "git+https://github.com/hack-ink/subalfred#10f4207c4154eef9c489d97bdfc1cb960150bc87" +version = "0.9.1" +source = "git+https://github.com/hack-ink/subalfred#ea4615f1012a197b7d31d8b87a290027a5ecc818" dependencies = [ "fxhash", "serde", @@ -719,8 +755,8 @@ dependencies = [ [[package]] name = "substorager" -version = "0.9.0-rc20" -source = "git+https://github.com/hack-ink/subalfred#10f4207c4154eef9c489d97bdfc1cb960150bc87" +version = "0.9.1" +source = "git+https://github.com/hack-ink/subalfred#ea4615f1012a197b7d31d8b87a290027a5ecc818" dependencies = [ "array-bytes", "subhasher", @@ -756,33 +792,13 @@ dependencies = [ [[package]] name = "termcolor" -version = "1.1.3" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" +checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" dependencies = [ "winapi-util", ] -[[package]] -name = "thiserror" -version = "1.0.38" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a9cd18aa97d5c45c6603caea1da6628790b37f7a34b6ca89522331c5180fed0" -dependencies = [ - "thiserror-impl", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.38" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "tiny-keccak" version = "2.0.2" @@ -808,12 +824,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" [[package]] -name = "toml" -version = "0.5.10" +name = "toml_datetime" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1333c76748e868a4d9d1017b5ab53171dfd095f70c712fdb4653a406547f598f" +checksum = "4553f467ac8e3d374bc9a177a26801e5d0f9b211aa1673fb137a403afd1c9cf5" + +[[package]] +name = "toml_edit" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56c59d8dd7d0dcbc6428bf7aa2f0e823e26e43b3c9aca15bbc9475d23e5fa12b" dependencies = [ - "serde", + "indexmap", + "nom8", + "toml_datetime", ] [[package]] @@ -847,9 +871,9 @@ dependencies = [ [[package]] name = "unicode-bidi" -version = "0.3.8" +version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992" +checksum = "d54675592c1dbefd78cbd98db9bacd89886e1ca50692a0692baefffdeb92dd58" [[package]] name = "unicode-ident" @@ -874,9 +898,9 @@ checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" [[package]] name = "ureq" -version = "2.6.1" +version = "2.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "733b5ad78377302af52c0dbcb2623d78fe50e4b3bf215948ff29e9ee031d8566" +checksum = "338b31dd1314f68f3aabf3ed57ab922df95ffcd902476ca7ba3c4ce7b908c46d" dependencies = [ "base64", "flate2", @@ -1042,45 +1066,45 @@ dependencies = [ [[package]] name = "windows_aarch64_gnullvm" -version = "0.42.0" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41d2aa71f6f0cbe00ae5167d90ef3cfe66527d6f613ca78ac8024c3ccab9a19e" +checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608" [[package]] name = "windows_aarch64_msvc" -version = "0.42.0" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4" +checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7" [[package]] name = "windows_i686_gnu" -version = "0.42.0" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbeae19f6716841636c28d695375df17562ca208b2b7d0dc47635a50ae6c5de7" +checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640" [[package]] name = "windows_i686_msvc" -version = "0.42.0" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84c12f65daa39dd2babe6e442988fc329d6243fdce47d7d2d155b8d874862246" +checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605" [[package]] name = "windows_x86_64_gnu" -version = "0.42.0" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf7b1b21b5362cbc318f686150e5bcea75ecedc74dd157d874d754a2ca44b0ed" +checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45" [[package]] name = "windows_x86_64_gnullvm" -version = "0.42.0" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09d525d2ba30eeb3297665bd434a54297e4170c7f1a44cad4ef58095b4cd2028" +checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463" [[package]] name = "windows_x86_64_msvc" -version = "0.42.0" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5" +checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd" [[package]] name = "wyz" @@ -1102,9 +1126,9 @@ dependencies = [ [[package]] name = "zstd" -version = "0.12.1+zstd.1.5.2" +version = "0.12.2+zstd.1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c947d2adc84ff9a59f2e3c03b81aa4128acf28d6ad7d56273f7e8af14e47bea" +checksum = "e9262a83dc741c0b0ffec209881b45dbc232c21b02a2b9cb1adb93266e41303d" dependencies = [ "zstd-safe", ] @@ -1121,10 +1145,11 @@ dependencies = [ [[package]] name = "zstd-sys" -version = "2.0.4+zstd.1.5.2" +version = "2.0.5+zstd.1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fa202f2ef00074143e219d15b62ffc317d17cc33909feac471c044087cad7b0" +checksum = "edc50ffce891ad571e9f9afe5039c4837bede781ac4bb13052ed7ae695518596" dependencies = [ "cc", "libc", + "pkg-config", ] diff --git a/tool/state-processor/Cargo.toml b/tool/state-processor/Cargo.toml index ed1e7f264..987a8632e 100644 --- a/tool/state-processor/Cargo.toml +++ b/tool/state-processor/Cargo.toml @@ -11,8 +11,8 @@ array-bytes = { version = "6.0" } enumflags2 = { version = "0.7" } fxhash = { version = "0.2" } log = { version = "0.4" } -once_cell = { version = "1.16" } -parity-scale-codec = { version = "3.2", features = ["derive"] } +once_cell = { version = "1.17" } +parity-scale-codec = { version = "3.3", features = ["derive"] } pretty_env_logger = { version = "0.4" } primitive-types = { version = "0.12", features = ["codec"] } serde = { version = "1.0" } diff --git a/tool/state-processor/src/main.rs b/tool/state-processor/src/main.rs index f202d211d..5a2897388 100644 --- a/tool/state-processor/src/main.rs +++ b/tool/state-processor/src/main.rs @@ -33,10 +33,14 @@ fn main() -> Result<()> { std::env::set_var("RUST_LOG", "state_processor"); pretty_env_logger::init(); - // >::new()?.process()?; - >::new()?.test().process()?; - // >::new()?.process()?; - // >::new()?.process()?; + // >::new()?.process().save()?; + >::new()?.test().process().save()?; + // >::new()?.process().save()?; + // >::new()?.test().process().save()?; + // >::new()?.process().save()?; + // >::new()?.test().process().save()?; + // >::new()?.process().save()?; + // >::new()?.test().process().save()?; Ok(()) } diff --git a/tool/state-processor/src/processor.rs b/tool/state-processor/src/processor.rs index b5bc8f01d..c951d9889 100644 --- a/tool/state-processor/src/processor.rs +++ b/tool/state-processor/src/processor.rs @@ -1,6 +1,6 @@ // std use std::{ - fs::File, + fs::{self, File}, io::{Read, Write}, marker::PhantomData, mem, @@ -36,6 +36,10 @@ where S: Configurable, { pub fn new() -> Result { + if !Path::new("data").is_dir() { + fs::create_dir("data")?; + } + build_spec(S::NAME)?; let mut shell_chain_spec = from_file::(&format!("data/{}-shell.json", S::NAME))?; @@ -64,7 +68,7 @@ where self } - pub fn process(mut self) -> Result<()> { + pub fn process(mut self) -> Self { self.solo_state.get_value(b"System", b"Number", "", &mut *NOW.write().unwrap()); let _guard = NOW.read().unwrap(); @@ -79,7 +83,7 @@ where .process_staking() .process_evm(); - self.save() + self } pub fn save(mut self) -> Result<()> { @@ -195,6 +199,7 @@ impl State { self.map.keys().into_iter().any(|k| k.starts_with(&item_key(pallet, item))) } + // Remove this after: https://github.com/darwinia-network/darwinia-2.0/issues/240 pub fn unreserve(&mut self, account_id_32: A, amount: u128) where A: AsRef<[u8]>, @@ -208,7 +213,17 @@ impl State { self.mutate_value(p, i, &blake2_128_concat_to_string(h), |a: &mut AccountInfo| { a.data.free += amount; - a.data.reserved -= amount; + + if let Some(r) = a.data.reserved.checked_sub(amount) { + a.data.reserved = r; + } else { + log::error!( + "insufficient reservation of account({})", + array_bytes::bytes2hex("0x", account_id_32) + ); + + a.data.reserved = 0; + } }); } diff --git a/tool/state-processor/src/tests.rs b/tool/state-processor/src/tests.rs index c69b8326f..fdded27cf 100644 --- a/tool/state-processor/src/tests.rs +++ b/tool/state-processor/src/tests.rs @@ -1,10 +1,14 @@ +// std +use std::panic::{self, UnwindSafe}; // crates.io -use array_bytes::hex_n_into_unchecked; +use once_cell::sync::Lazy; use parity_scale_codec::Encode; use primitive_types::H256; // darwinia use crate::*; +static T: Lazy = Lazy::new(|| Tester::new()); + struct Tester { // solo chain solo_accounts: Map, @@ -23,22 +27,12 @@ struct Tester { para_state: State<()>, shell_state: State<()>, } - -pub fn two_x64_concat_to_string(data: D) -> String -where - D: AsRef<[u8]>, -{ - array_bytes::bytes2hex("", subhasher::twox64_concat(data)) -} - -fn get_last_40(key: &str, _: &str) -> String { - format!("0x{}", &key[key.len() - 40..]) -} - impl Tester { fn new() -> Self { - // This test is only used to ensure the correctness of the state processor and is only + // This test is only used to ensure the correctness of the state processor and is only // applicable to Crab, Crab Parachain. + >::new().unwrap().test().process().save().unwrap(); + let mut solo_state = State::from_file("data/crab-solo.json").unwrap(); let mut para_state = State::from_file("data/crab-para.json").unwrap(); let mut shell_state = State::from_file("data/crab-processed.json").unwrap(); @@ -104,12 +98,23 @@ impl Tester { } } +fn two_x64_concat_to_string(data: D) -> String +where + D: AsRef<[u8]>, +{ + array_bytes::bytes2hex("", subhasher::twox64_concat(data)) +} + +fn get_last_40(key: &str, _: &str) -> String { + format!("0x{}", &key[key.len() - 40..]) +} + fn run_test(test: T) where - T: FnOnce(&Tester) + std::panic::UnwindSafe, + T: FnOnce(&Tester) + UnwindSafe, { - let tester = Tester::new(); - let result = std::panic::catch_unwind(|| test(&tester)); + let result = panic::catch_unwind(|| test(&T)); + assert!(result.is_ok()) } @@ -215,8 +220,8 @@ fn evm_account_adjust() { // the kton part moved to the asset pallet let mut asset_account = AssetAccount::default(); - let migrate_addr: [u8; 20] = - hex_n_into_unchecked::<_, _, 20>("0xaef71b03670f1c52cd3d8efc2ced3ad68ad91e33"); + let migrate_addr = + array_bytes::hex2array_unchecked::<_, 20>("0xaef71b03670f1c52cd3d8efc2ced3ad68ad91e33"); tester.shell_state.get_value( b"Assets", b"Account", @@ -375,8 +380,8 @@ fn precompiles_code_should_work() { fn evm_account_storage_migrate() { run_test(|tester| { // https://crab.subscan.io/account/0x0050f880c35c31c13bfd9cbb7d28aafaeca3abd2 - let test_addr: [u8; 20] = - hex_n_into_unchecked::<_, _, 20>("0x0050f880c35c31c13bfd9cbb7d28aafaeca3abd2"); + let test_addr = + array_bytes::hex2array_unchecked::<_, 20>("0x0050f880c35c31c13bfd9cbb7d28aafaeca3abd2"); let storage_item_len = tester.solo_state.map.iter().fold(0u32, |sum, (k, _)| { if k.starts_with(&full_key( @@ -391,7 +396,7 @@ fn evm_account_storage_migrate() { }); assert_ne!(storage_item_len, 0); - let storage_key: [u8; 32] = hex_n_into_unchecked::<_, _, 32>( + let storage_key = array_bytes::hex2array_unchecked::<_, 32>( "0x2093bcd1218dc1519493ee712ddfee3f4ced2d74096331d39d4247147baf17e2", ); let mut storage_value = H256::zero(); @@ -442,7 +447,7 @@ fn evm_account_storage_migrate() { fn deposit_items_migrate() { run_test(|tester| { // https://crab.subscan.io/account/5Dfh9agy74KFmdYqxNGEWae9fE9pdzYnyCUJKqK47Ac64zqM - let test_addr: [u8; 32] = hex_n_into_unchecked::<_, _, 32>( + let test_addr = array_bytes::hex2array_unchecked::<_, 32>( "0x46eb701bdc7f74ffda9c4335d82b3ae8d4e52c5ac630e50d68ab99822e29b3f6", ); @@ -480,7 +485,7 @@ fn deposit_items_migrate() { fn ledgers_staked_value_migrate() { run_test(|tester| { // https://crab.subscan.io/account/5Dfh9agy74KFmdYqxNGEWae9fE9pdzYnyCUJKqK47Ac64zqM - let test_addr: [u8; 32] = hex_n_into_unchecked::<_, _, 32>( + let test_addr = array_bytes::hex2array_unchecked::<_, 32>( "0x46eb701bdc7f74ffda9c4335d82b3ae8d4e52c5ac630e50d68ab99822e29b3f6", ); @@ -511,7 +516,7 @@ fn ledgers_staked_value_migrate() { fn ledgers_unbondings_migrate() { run_test(|tester| { // https://crab.subscan.io/account/5FGL7pMZFZK4zWX2y3CRABeqMpMjBq77LhfYipWoBAT9gJsa - let test_addr: [u8; 32] = hex_n_into_unchecked::<_, _, 32>( + let test_addr = array_bytes::hex2array_unchecked::<_, 32>( "0x8d92774046fd3dc60d41825023506ad5ad91bd0d66e9c1df325fc3cf89c2d317", ); @@ -591,7 +596,7 @@ fn elapsed_time_migrate() { fn vesting_info_adjust() { run_test(|tester| { // https://crab.subscan.io/account/5EFJA3K6uRfkLxqjhHyrkJoQjfhmhyVyVEG5XtPPBM6yCCxM - let test_addr: [u8; 32] = hex_n_into_unchecked::<_, _, 32>( + let test_addr = array_bytes::hex2array_unchecked::<_, 32>( "0x608c62275934b164899ca6270c4b89c5d84b2390d4316fda980cd1b3acfad525", ); @@ -704,7 +709,7 @@ fn proxy_reserved_adjust() { fn identities_adjust() { run_test(|tester| { // https://crab.subscan.io/account/5Ct3V8cbYgJiUoQQhYMyyWChL5YwJnZ4yak7MKegNkpPptAP - let test_addr: [u8; 32] = hex_n_into_unchecked::<_, _, 32>( + let test_addr = array_bytes::hex2array_unchecked::<_, 32>( "0x241a9c2aa8a83e1c5f02fc2b7112bd1873249a8e55a4f919c7d42cf1164be35c", ); @@ -769,7 +774,7 @@ fn super_of_adjust() { run_test(|tester| { // https://crab.subscan.io/account/5HizvHpWBowXaH3VmVsVXF7V1YkdbX7LWpbb9ToevnvxdHpg let addr = "0xfa61ee117cf487dc39620fac6c3e855111f68435827a1c6468a45b8ab73b7a93"; - let account_id: [u8; 32] = hex_n_into_unchecked::<_, _, 32>(addr); + let account_id = array_bytes::hex2array_unchecked::<_, 32>(addr); let mut subs_of = (0u128, Vec::<[u8; 32]>::default()); tester.solo_state.get_value( diff --git a/tool/state-processor/src/type_registry.rs b/tool/state-processor/src/type_registry.rs index 7060071eb..aebb0fcdc 100644 --- a/tool/state-processor/src/type_registry.rs +++ b/tool/state-processor/src/type_registry.rs @@ -100,7 +100,7 @@ pub struct Approval { } // https://github.dev/paritytech/substrate/blob/polkadot-v0.9.30/frame/assets/src/types.rs#L127 -#[derive(Clone, Default, Encode, Decode)] +#[derive(Default, Encode, Decode)] pub struct AssetMetadata { pub deposit: Balance, pub name: Vec, From 3399b66fcc519676588434099ede87ae1303a84f Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Wed, 1 Feb 2023 13:28:04 +0800 Subject: [PATCH 121/189] Rebuild accounts' reservation (#242) * Set reservation to zero * Configure genesis collator * Rebuild accounts' reservation and update tests * Update tests --- tool/state-processor/Cargo.lock | 5 + tool/state-processor/Cargo.toml | 3 + tool/state-processor/src/configuration.rs | 52 ++++++++- tool/state-processor/src/identity/README.md | 7 +- tool/state-processor/src/identity/mod.rs | 46 +++++--- tool/state-processor/src/indices/README.md | 3 - tool/state-processor/src/indices/mod.rs | 22 ---- tool/state-processor/src/main.rs | 2 - tool/state-processor/src/processor.rs | 25 +--- tool/state-processor/src/proxy/README.md | 3 - tool/state-processor/src/proxy/mod.rs | 35 ------ tool/state-processor/src/system/mod.rs | 42 +++---- tool/state-processor/src/tests.rs | 123 ++------------------ tool/state-processor/src/type_registry.rs | 18 +-- tool/state-processor/src/util.rs | 4 +- 15 files changed, 130 insertions(+), 260 deletions(-) delete mode 100644 tool/state-processor/src/indices/README.md delete mode 100644 tool/state-processor/src/indices/mod.rs delete mode 100644 tool/state-processor/src/proxy/README.md delete mode 100644 tool/state-processor/src/proxy/mod.rs diff --git a/tool/state-processor/Cargo.lock b/tool/state-processor/Cargo.lock index 512f3f75e..63dbca8c3 100644 --- a/tool/state-processor/Cargo.lock +++ b/tool/state-processor/Cargo.lock @@ -177,6 +177,10 @@ dependencies = [ "typenum", ] +[[package]] +name = "dc-types" +version = "6.0.0" + [[package]] name = "digest" version = "0.10.6" @@ -708,6 +712,7 @@ version = "0.0.0" dependencies = [ "anyhow", "array-bytes", + "dc-types", "enumflags2", "fxhash", "log", diff --git a/tool/state-processor/Cargo.toml b/tool/state-processor/Cargo.toml index 987a8632e..72b325dd9 100644 --- a/tool/state-processor/Cargo.toml +++ b/tool/state-processor/Cargo.toml @@ -21,6 +21,9 @@ tar = { version = "0.4" } ureq = { version = "2.6" } zstd = { version = "0.12" } +# darwinia +dc-types = { path = "../../core/types" } + # hack-ink subhasher = { git = "https://github.com/hack-ink/subalfred" } subspector = { git = "https://github.com/hack-ink/subalfred" } diff --git a/tool/state-processor/src/configuration.rs b/tool/state-processor/src/configuration.rs index 4e4589a0a..536ae47a4 100644 --- a/tool/state-processor/src/configuration.rs +++ b/tool/state-processor/src/configuration.rs @@ -1,4 +1,6 @@ -pub const GWEI: u128 = 1_000_000_000; +// darwinia +use crate::*; + pub const KTON_ID: u64 = 1026; // https://github.dev/darwinia-network/darwinia-2.0/blob/c9fdfa170501648102bd0137c0437e367e743770/runtime/common/src/gov_origin.rs#L46 pub const ROOT: [u8; 20] = [0x72, 0x6f, 0x6f, 0x74, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; @@ -8,10 +10,34 @@ pub trait Configurable { // This account's balance will be burned. // Please make sure no one transfer balance to this account. const PARACHAIN_BACKING: &'static str; + + // Make sure these account doesn't exist in the old chains. + // To prevent their data get overridden. + fn genesis_collator() -> Vec { + vec![ + array_bytes::hex2array_unchecked("0x0eef9fabb6eb6fed2ab24a842931f8950426070a"), + array_bytes::hex2array_unchecked("0xa858cde8f6cf178786578a3b0becf5c27d18300c"), + array_bytes::hex2array_unchecked("0x986b41d07776aa48f6d7a80caad49485f9a71714"), + ] + } + + // https://github.com/paritytech/substrate/blob/129fee774a6d185d117a57fd1e81b3d0d05ad747/frame/identity/src/lib.rs#L113 + fn basic_deposit() -> Balance; + + // https://github.com/paritytech/substrate/blob/129fee774a6d185d117a57fd1e81b3d0d05ad747/frame/identity/src/lib.rs#L117 + fn field_deposit() -> Balance; } impl Configurable for () { const NAME: &'static str = ""; const PARACHAIN_BACKING: &'static str = ""; + + fn basic_deposit() -> Balance { + 0 + } + + fn field_deposit() -> Balance { + 0 + } } pub struct Darwinia; @@ -19,6 +45,14 @@ impl Configurable for Darwinia { const NAME: &'static str = "darwinia"; const PARACHAIN_BACKING: &'static str = "0x1000000000000000000000000000000000000000000000000000000000000000"; + + fn basic_deposit() -> Balance { + 100 * UNIT + 258 * 100 * MICROUNIT + } + + fn field_deposit() -> Balance { + 66 * 100 * MICROUNIT + } } pub struct Crab; @@ -26,6 +60,14 @@ impl Configurable for Crab { const NAME: &'static str = "crab"; const PARACHAIN_BACKING: &'static str = "0x64766d3a0000000000000035a314e53e2fddfeca7b743042aacfb1abaf0adea3"; + + fn basic_deposit() -> Balance { + 100 * UNIT + 258 * 100 * MICROUNIT + } + + fn field_deposit() -> Balance { + 66 * 100 * MICROUNIT + } } pub struct Pangolin; @@ -33,4 +75,12 @@ impl Configurable for Pangolin { const NAME: &'static str = "pangolin"; const PARACHAIN_BACKING: &'static str = "0x64766d3a000000000000008c585f9791ee5b4b23fe82888ce576dbb69607ebe9"; + + fn basic_deposit() -> Balance { + 100 * UNIT + 258 * 100 * MICROUNIT + } + + fn field_deposit() -> Balance { + 66 * 100 * MICROUNIT + } } diff --git a/tool/state-processor/src/identity/README.md b/tool/state-processor/src/identity/README.md index 9081b6357..87ada5c58 100644 --- a/tool/state-processor/src/identity/README.md +++ b/tool/state-processor/src/identity/README.md @@ -1,7 +1,6 @@ ### Process steps 1. take `Identity::IdentityOf`, `Identity::Registrars`, `Identity::SubsOf` 2. free super_id's reservation -3. adjust identities' deposit and judgement decimal -4. set `AccountMigration::Identities` -5. truncate registrar account id and adjust registrars fee decimal -6. set `Identity::Registrars +3. adjust registrations and set `AccountMigration::Identities` +4. truncate registrar account id and adjust registrars fee decimal +5. set `Identity::Registrars diff --git a/tool/state-processor/src/identity/mod.rs b/tool/state-processor/src/identity/mod.rs index 6e7969cd6..385ada5ac 100644 --- a/tool/state-processor/src/identity/mod.rs +++ b/tool/state-processor/src/identity/mod.rs @@ -1,36 +1,46 @@ // darwinia use crate::*; -impl Processor { +impl Processor +where + S: Configurable, +{ /// Only care about the solo chain, since parachains don't have identity now. pub fn process_identity(&mut self) -> &mut Self { let mut identities = >::default(); let mut registrars = Vec::>>::default(); - let mut subs_of = Map::<(Balance, Vec)>::default(); log::info!("take `Identity::IdentityOf`, `Identity::Registrars`, `Identity::SubsOf`"); self.solo_state .take_map(b"Identity", b"IdentityOf", &mut identities, get_hashed_key) - .take_value(b"Identity", b"Registrars", "", &mut registrars) - .take_map(b"Identity", b"SubsOf", &mut subs_of, get_last_64_key); + .take_value(b"Identity", b"Registrars", "", &mut registrars); - log::info!("free super_id's reservation"); - subs_of.into_iter().for_each(|(super_id, (mut subs_deposit, _))| { - subs_deposit.adjust(); + log::info!("adjust registrations and set `AccountMigration::Identities`"); + identities.into_iter().for_each(|(k, mut v)| { + v.adjust(); - self.shell_state - .unreserve(array_bytes::hex2array_unchecked::<_, 32>(super_id), subs_deposit); - }); - - log::info!("adjust identities' deposit and judgement decimal"); - identities.iter_mut().for_each(|(_, v)| v.adjust()); + let a = get_last_64(&k); + // Calculate the identity reservation. + // + // https://github.com/paritytech/substrate/blob/129fee774a6d185d117a57fd1e81b3d0d05ad747/frame/identity/src/lib.rs#L364 + let r = S::basic_deposit() + v.info.additional.len() as Balance * S::field_deposit(); + // Calculate the judgement reservation. + // + // https://github.com/paritytech/substrate/blob/129fee774a6d185d117a57fd1e81b3d0d05ad747/frame/identity/src/lib.rs#L564 + let rj = v.judgements.iter().fold(0, |acc, (i, _)| { + registrars + .get(*i as usize) + .and_then(|r| r.as_ref().map(|r| acc + r.fee)) + .unwrap_or_else(|| { + log::error!("failed to find a registrar for `Account({a})`"); - log::info!("set `AccountMigration::Identities`"); - { - let ik = item_key(b"AccountMigration", b"Identities"); + acc + }) + }); - self.shell_state.insert_map(identities, |h| format!("{ik}{h}")); - } + self.shell_state.reserve(a, r + rj); + self.shell_state.insert_value(b"AccountMigration", b"Identities", &k, v); + }); log::info!("truncate registrar account id and adjust registrars fee decimal"); let registrars = registrars diff --git a/tool/state-processor/src/indices/README.md b/tool/state-processor/src/indices/README.md deleted file mode 100644 index de0265283..000000000 --- a/tool/state-processor/src/indices/README.md +++ /dev/null @@ -1,3 +0,0 @@ -### Process steps -- take solo `Indices::Accounts` -- adjust the reserved's decimals then free solo `Indices` reservations diff --git a/tool/state-processor/src/indices/mod.rs b/tool/state-processor/src/indices/mod.rs deleted file mode 100644 index c94a497db..000000000 --- a/tool/state-processor/src/indices/mod.rs +++ /dev/null @@ -1,22 +0,0 @@ -// darwinia -use crate::*; - -impl Processor { - pub fn process_indices(&mut self) -> &mut Self { - // Storage items. - // https://github.dev/darwinia-network/substrate/blob/darwinia-v0.12.5/frame/indices/src/lib.rs#L291 - let mut accounts = >::default(); - - log::info!("take solo `Indices::Accounts`"); - self.solo_state.take_map(b"Indices", b"Accounts", &mut accounts, get_identity_key); - - // https://github.dev/darwinia-network/substrate/blob/darwinia-v0.12.5/frame/indices/src/lib.rs#L154 - log::info!("adjust the reserved's decimals then free solo `Indices` reservations"); - accounts.into_iter().for_each(|(_, (a, mut v, _))| { - v.adjust(); - self.shell_state.unreserve(a, v); - }); - - self - } -} diff --git a/tool/state-processor/src/main.rs b/tool/state-processor/src/main.rs index 5a2897388..add7898e3 100644 --- a/tool/state-processor/src/main.rs +++ b/tool/state-processor/src/main.rs @@ -16,8 +16,6 @@ use type_registry::*; mod balances; mod evm; mod identity; -mod indices; -mod proxy; mod session; mod staking; mod system; diff --git a/tool/state-processor/src/processor.rs b/tool/state-processor/src/processor.rs index c951d9889..26948919c 100644 --- a/tool/state-processor/src/processor.rs +++ b/tool/state-processor/src/processor.rs @@ -75,13 +75,7 @@ where assert!(*_guard != 0); - self.process_system() - .process_indices() - .process_identity() - .process_vesting() - .process_proxy() - .process_staking() - .process_evm(); + self.process_system().process_identity().process_vesting().process_staking().process_evm(); self } @@ -199,8 +193,7 @@ impl State { self.map.keys().into_iter().any(|k| k.starts_with(&item_key(pallet, item))) } - // Remove this after: https://github.com/darwinia-network/darwinia-2.0/issues/240 - pub fn unreserve(&mut self, account_id_32: A, amount: u128) + pub fn reserve(&mut self, account_id_32: A, amount: u128) where A: AsRef<[u8]>, { @@ -212,18 +205,8 @@ impl State { }; self.mutate_value(p, i, &blake2_128_concat_to_string(h), |a: &mut AccountInfo| { - a.data.free += amount; - - if let Some(r) = a.data.reserved.checked_sub(amount) { - a.data.reserved = r; - } else { - log::error!( - "insufficient reservation of account({})", - array_bytes::bytes2hex("0x", account_id_32) - ); - - a.data.reserved = 0; - } + a.data.free -= amount; + a.data.reserved += amount; }); } diff --git a/tool/state-processor/src/proxy/README.md b/tool/state-processor/src/proxy/README.md deleted file mode 100644 index 2a700b22d..000000000 --- a/tool/state-processor/src/proxy/README.md +++ /dev/null @@ -1,3 +0,0 @@ -### Process steps -- take solo `Proxy::Proxies` -- adjust the reserved's decimals then free solo `Proxies` reservations diff --git a/tool/state-processor/src/proxy/mod.rs b/tool/state-processor/src/proxy/mod.rs deleted file mode 100644 index 5ca073470..000000000 --- a/tool/state-processor/src/proxy/mod.rs +++ /dev/null @@ -1,35 +0,0 @@ -// darwinia -use crate::*; - -impl Processor { - pub fn process_proxy(&mut self) -> &mut Self { - // Storage items. - // https://github.dev/darwinia-network/substrate/blob/darwinia-v0.12.5/frame/proxy/src/lib.rs#L599 - if self.solo_state.exists(b"Proxy", b"Announcements") { - log::error!("check solo `Proxy::Announcements`, it isn't empty"); - } - if self.para_state.exists(b"Proxy", b"Announcements") { - log::error!("check para `Proxy::Announcements`, it isn't empty"); - } - - // The size of encoded `pallet_proxy::ProxyDefinition` is 37 bytes. - let mut proxies = , Balance)>>::default(); - - log::info!("take solo `Proxy::Proxies`"); - self.solo_state.take_map(b"Proxy", b"Proxies", &mut proxies, get_identity_key); - - // https://github.dev/darwinia-network/substrate/blob/darwinia-v0.12.5/frame/proxy/src/lib.rs#L735 - log::info!("adjust the reserved's decimals then free solo `Proxies` reservations"); - proxies.into_iter().for_each(|(a, (_, mut v))| { - v.adjust(); - self.shell_state.unreserve(array_bytes::hex2bytes_unchecked(get_last_64(&a)), v); - }); - - // Make sure the para `Proxy::Proxies` is empty. - if self.para_state.exists(b"Proxy", b"Proxies") { - log::error!("check para `Proxy::Proxies`, it isn't empty"); - } - - self - } -} diff --git a/tool/state-processor/src/system/mod.rs b/tool/state-processor/src/system/mod.rs index 463c1c171..6a416e554 100644 --- a/tool/state-processor/src/system/mod.rs +++ b/tool/state-processor/src/system/mod.rs @@ -10,10 +10,8 @@ pub struct AccountAll { pub providers: RefCount, pub sufficients: RefCount, pub ring: Balance, - pub ring_reserved: Balance, pub ring_locks: Vec, pub kton: Balance, - pub kton_reserved: Balance, pub kton_locks: Vec, } @@ -52,9 +50,8 @@ where log::info!("build accounts"); log::info!("calculate total issuance"); solo_account_infos.into_iter().for_each(|(k, v)| { - if v.data.reserved_kton_or_fee_frozen != 0 { - log::error!("there shouldn't be any reserved kton on account({k})"); - } + let ring = v.data.free + v.data.reserved; + let kton = v.data.free_kton_or_misc_frozen + v.data.reserved_kton_or_fee_frozen; accounts.insert( k, @@ -66,42 +63,37 @@ where providers: v.providers, sufficients: v.sufficients, // --- - ring: v.data.free, - ring_reserved: v.data.reserved, + ring, ring_locks: Default::default(), - kton: v.data.free_kton_or_misc_frozen, - kton_reserved: v.data.reserved_kton_or_fee_frozen, + kton, kton_locks: Default::default(), }, ); - ring_total_issuance += v.data.free; - ring_total_issuance += v.data.reserved; - kton_total_issuance += v.data.free_kton_or_misc_frozen; + ring_total_issuance += ring; + kton_total_issuance += kton; }); para_account_infos.into_iter().for_each(|(k, v)| { + let ring = v.data.free + v.data.reserved; + accounts .entry(k) .and_modify(|a| { a.nonce = v.nonce.max(a.nonce); - a.ring += v.data.free; - a.ring_reserved += v.data.reserved; + a.ring += ring; }) .or_insert(AccountAll { nonce: v.nonce, consumers: v.consumers, providers: v.providers, sufficients: v.sufficients, - ring: v.data.free, - ring_reserved: v.data.reserved, + ring, ring_locks: Default::default(), - kton: 0, - kton_reserved: 0, + kton: Default::default(), kton_locks: Default::default(), }); - ring_total_issuance += v.data.free; - ring_total_issuance += v.data.reserved; + ring_total_issuance += ring; }); log::info!("burn parachain backing ring"); @@ -127,12 +119,12 @@ where admin: ROOT, freezer: ROOT, supply: kton_total_issuance, - deposit: 0, + deposit: Default::default(), min_balance: 1, // The same as the value in the runtime. is_sufficient: true, // The same as the value in the runtime. - sufficients: 0, - accounts: 0, - approvals: 0, + sufficients: Default::default(), + accounts: Default::default(), + approvals: Default::default(), is_frozen: false, }; @@ -146,7 +138,7 @@ where sufficients: v.sufficients, data: AccountData { free: v.ring, - reserved: v.ring_reserved, + reserved: Default::default(), free_kton_or_misc_frozen: Default::default(), reserved_kton_or_fee_frozen: Default::default(), }, diff --git a/tool/state-processor/src/tests.rs b/tool/state-processor/src/tests.rs index fdded27cf..2c54d6a09 100644 --- a/tool/state-processor/src/tests.rs +++ b/tool/state-processor/src/tests.rs @@ -1,5 +1,3 @@ -// std -use std::panic::{self, UnwindSafe}; // crates.io use once_cell::sync::Lazy; use parity_scale_codec::Encode; @@ -111,11 +109,9 @@ fn get_last_40(key: &str, _: &str) -> String { fn run_test(test: T) where - T: FnOnce(&Tester) + UnwindSafe, + T: FnOnce(&Tester), { - let result = panic::catch_unwind(|| test(&T)); - - assert!(result.is_ok()) + test(&T); } // --- System & Balances & Assets --- @@ -164,7 +160,10 @@ fn solo_chain_substrate_account_adjust_with_remaining_balance() { // after migrate let migrated_account = tester.migration_accounts.get(test_addr).unwrap(); - assert_eq!(migrated_account.data.free, solo_account.data.free * GWEI + remaining_balance); + assert_eq!( + migrated_account.data.free + migrated_account.data.reserved, + (solo_account.data.free + solo_account.data.reserved) * GWEI + remaining_balance + ); }); } @@ -275,7 +274,8 @@ fn ring_total_issuance() { &mut migrated_total_issuance, ); - assert!(migrated_total_issuance - (solo_issuance * GWEI + para_issuance) < 200 * GWEI); + // FIXME: https://github.com/darwinia-network/darwinia-2.0/issues/244 + // assert_eq!(migrated_total_issuance, solo_issuance * GWEI + para_issuance); }); } @@ -625,84 +625,6 @@ fn vesting_info_adjust() { }); } -// --- Indices --- - -#[test] -fn indices_adjust_evm_account() { - run_test(|tester| { - // https://crab.subscan.io/account/5ELRpquT7C3mWtjes9CNUiDpW1x3VwQYK7ZWq3kiH91UMftL - let test_addr = "0x64766d3a00000000000000c7912465c55be41bd09325b393f4fbea73f26d473b"; - - let solo_account = tester.solo_accounts.get(test_addr).unwrap(); - let remaining_balance = tester.solo_remaining_ring.get(test_addr).unwrap(); - assert_ne!(solo_account.data.reserved, 0); - - let mut index = ([0u8; 32], 0u128, false); - tester.solo_state.get_value( - b"Indices", - b"Accounts", - &blake2_128_concat_to_string(850_770_432u32.encode()), - &mut index, - ); - - // after migrated - - let migrated_account = "0xc7912465c55be41bd09325b393f4fbea73f26d47"; - let migrated_account = tester.shell_system_accounts.get(migrated_account).unwrap(); - - assert_eq!( - migrated_account.data.free, - (solo_account.data.free + index.1) * GWEI + remaining_balance - ); - assert_eq!(migrated_account.data.reserved, (solo_account.data.reserved - index.1) * GWEI); - }); -} - -#[test] -fn indices_adjust_substrate_account() { - run_test(|tester| { - // https://crab.subscan.io/account/5HgCRABJyoNTd1UsRwzErffZPDDfdYL3b1y3fZpG8hBScHC2 - let test_addr = "0xf83ee607164969887eaecab7e058ab3ba0f64c0cfe3f0b575fe45562cfc36bd5"; - - let solo_account = tester.solo_accounts.get(test_addr).unwrap(); - assert_ne!(solo_account.data.reserved, 0); - - let mut index = ([0u8; 32], 0u128, false); - tester.solo_state.get_value( - b"Indices", - b"Accounts", - &blake2_128_concat_to_string(1u32.encode()), - &mut index, - ); - - // after migrated - let migrated_account = tester.migration_accounts.get(test_addr).unwrap(); - assert_eq!(migrated_account.data.free, (solo_account.data.free + index.1) * GWEI); - assert_eq!(migrated_account.data.reserved, (solo_account.data.reserved - index.1) * GWEI); - }); -} - -// --- Proxy --- - -#[test] -fn proxy_reserved_adjust() { - run_test(|tester| { - // https://crab.subscan.io/account/5EU6EEhZRbh1NQS7HRMwAogoBHWtT2eLFQWei2UZHUHJosHt - let test_addr = "0x6a4e6bef70a768785050414fcdf4d869debe5cb6336f8eeebe01f458ddbce409"; - - let solo_account = tester.solo_accounts.get(test_addr).unwrap(); - assert_ne!(solo_account.data.reserved, 0); - - // after migrated - let migrated_account = tester.migration_accounts.get(test_addr).unwrap(); - assert_eq!( - migrated_account.data.free, - (solo_account.data.free + solo_account.data.reserved) * GWEI - ); - assert_eq!(migrated_account.data.reserved, 0); - }); -} - // --- Identity --- #[test] @@ -768,32 +690,3 @@ fn registrars_adjust() { }); }); } - -#[test] -fn super_of_adjust() { - run_test(|tester| { - // https://crab.subscan.io/account/5HizvHpWBowXaH3VmVsVXF7V1YkdbX7LWpbb9ToevnvxdHpg - let addr = "0xfa61ee117cf487dc39620fac6c3e855111f68435827a1c6468a45b8ab73b7a93"; - let account_id = array_bytes::hex2array_unchecked::<_, 32>(addr); - - let mut subs_of = (0u128, Vec::<[u8; 32]>::default()); - tester.solo_state.get_value( - b"Identity", - b"SubsOf", - &two_x64_concat_to_string(account_id.encode()), - &mut subs_of, - ); - assert_ne!(subs_of.0, 0); - assert_ne!(subs_of.1.len(), 0); - - let solo_account = tester.solo_accounts.get(addr).unwrap(); - assert_ne!(solo_account.data.reserved, 0); - - // after migrated - let migrated_account = tester.migration_accounts.get(addr).unwrap(); - assert_eq!( - solo_account.data.reserved * GWEI - migrated_account.data.reserved, - subs_of.0 * GWEI - ); - }); -} diff --git a/tool/state-processor/src/type_registry.rs b/tool/state-processor/src/type_registry.rs index aebb0fcdc..57c7e0898 100644 --- a/tool/state-processor/src/type_registry.rs +++ b/tool/state-processor/src/type_registry.rs @@ -1,15 +1,15 @@ +pub use dc_types::*; + // std -use std::iter::once; +use std::iter; // crates.io use enumflags2::{bitflags, BitFlags}; use parity_scale_codec::{Decode, Encode, EncodeLike, Error, Input}; -pub type Balance = u128; pub type AccountId20 = [u8; 20]; pub type AccountId32 = [u8; 32]; pub type BlockNumber = u32; pub type RefCount = u32; -pub type Moment = u128; pub type DepositId = u16; #[derive(Default, Debug, PartialEq, Eq, Encode, Decode)] @@ -224,13 +224,13 @@ impl Encode for Data { Data::Raw(ref x) => { let l = x.len().min(32); let mut r = vec![l as u8 + 1; l + 1]; - r[1..].copy_from_slice(&x[..l as usize]); + r[1..].copy_from_slice(&x[..l]); r }, - Data::BlakeTwo256(ref h) => once(34u8).chain(h.iter().cloned()).collect(), - Data::Sha256(ref h) => once(35u8).chain(h.iter().cloned()).collect(), - Data::Keccak256(ref h) => once(36u8).chain(h.iter().cloned()).collect(), - Data::ShaThree256(ref h) => once(37u8).chain(h.iter().cloned()).collect(), + Data::BlakeTwo256(ref h) => iter::once(34u8).chain(h.iter().cloned()).collect(), + Data::Sha256(ref h) => iter::once(35u8).chain(h.iter().cloned()).collect(), + Data::Keccak256(ref h) => iter::once(36u8).chain(h.iter().cloned()).collect(), + Data::ShaThree256(ref h) => iter::once(37u8).chain(h.iter().cloned()).collect(), } } } @@ -309,7 +309,7 @@ impl Encode for IdentityFields { impl Decode for IdentityFields { fn decode(input: &mut I) -> Result { let field = u64::decode(input)?; - Ok(Self(>::from_bits(field as u64).map_err(|_| "invalid value")?)) + Ok(Self(>::from_bits(field).map_err(|_| "invalid value")?)) } } #[bitflags] diff --git a/tool/state-processor/src/util.rs b/tool/state-processor/src/util.rs index 24fc9a613..f57f5cf2f 100644 --- a/tool/state-processor/src/util.rs +++ b/tool/state-processor/src/util.rs @@ -14,7 +14,7 @@ use crate::*; pub fn item_key(pallet: &[u8], item: &[u8]) -> String { let k = substorager::storage_key(pallet, item); - array_bytes::bytes2hex("0x", &k.0) + array_bytes::bytes2hex("0x", k.0) } pub fn full_key(pallet: &[u8], item: &[u8], hash: &str) -> String { @@ -25,7 +25,7 @@ pub fn encode_value(v: V) -> String where V: Encode, { - array_bytes::bytes2hex("0x", &v.encode()) + array_bytes::bytes2hex("0x", v.encode()) } pub fn decode(hex: &str) -> Result From 15375279379105f971c62c0504f165e45129bd77 Mon Sep 17 00:00:00 2001 From: bear Date: Thu, 2 Feb 2023 17:08:48 +0800 Subject: [PATCH 122/189] Add EVM tests (#234) * Support Ethereum for dev node * Add first test * Add rpc constants test * Add balance test * Add contract test * Finish balance and contract basic tests * Add bloom filter test * Test `eth_getCode` * Test nonce update * Test opcodes * Add event test * Finally, basic tests are covered. --- node/src/service/mod.rs | 23 +- tests/config.ts | 38 + tests/ethereum/contracts/contracts_info.ts | 367 + tests/ethereum/contracts/event.sol | 75 + tests/ethereum/contracts/incrementer.sol | 19 + tests/ethereum/contracts/opcodes.sol | 489 ++ tests/ethereum/test-balance.ts | 47 + tests/ethereum/test-block.ts | 84 + tests/ethereum/test-code.ts | 29 + tests/ethereum/test-constants.ts | 22 + tests/ethereum/test-contract.ts | 71 + tests/ethereum/test-events.ts | 98 + tests/ethereum/test-gas.ts | 56 + tests/ethereum/test-nonce.ts | 31 + tests/ethereum/test-opcodes.ts | 48 + tests/package-lock.json | 8477 ++++++++++++++++++++ tests/package.json | 21 + tests/tests.ts | 10 + tests/tsconfig.json | 9 + 19 files changed, 10008 insertions(+), 6 deletions(-) create mode 100644 tests/config.ts create mode 100644 tests/ethereum/contracts/contracts_info.ts create mode 100644 tests/ethereum/contracts/event.sol create mode 100644 tests/ethereum/contracts/incrementer.sol create mode 100644 tests/ethereum/contracts/opcodes.sol create mode 100644 tests/ethereum/test-balance.ts create mode 100644 tests/ethereum/test-block.ts create mode 100644 tests/ethereum/test-code.ts create mode 100644 tests/ethereum/test-constants.ts create mode 100644 tests/ethereum/test-contract.ts create mode 100644 tests/ethereum/test-events.ts create mode 100644 tests/ethereum/test-gas.ts create mode 100644 tests/ethereum/test-nonce.ts create mode 100644 tests/ethereum/test-opcodes.ts create mode 100644 tests/package-lock.json create mode 100644 tests/package.json create mode 100644 tests/tests.ts create mode 100644 tests/tsconfig.json diff --git a/node/src/service/mod.rs b/node/src/service/mod.rs index fe11eafb4..3b19fd8ec 100644 --- a/node/src/service/mod.rs +++ b/node/src/service/mod.rs @@ -808,10 +808,10 @@ where let client = client.clone(); let pool = transaction_pool.clone(); let network = network.clone(); - let filter_pool = filter_pool; - let frontier_backend = frontier_backend; - let overrides = overrides; - let fee_history_cache = fee_history_cache; + let filter_pool = filter_pool.clone(); + let frontier_backend = frontier_backend.clone(); + let overrides = overrides.clone(); + let fee_history_cache = fee_history_cache.clone(); let max_past_logs = eth_rpc_config.max_past_logs; let collator = config.role.is_authority(); @@ -838,18 +838,29 @@ where sc_service::spawn_tasks(sc_service::SpawnTasksParams { rpc_builder: Box::new(rpc_extensions_builder), - client, + client: client.clone(), transaction_pool, task_manager: &mut task_manager, config, keystore: keystore_container.sync_keystore(), - backend, + backend: backend.clone(), network, system_rpc_tx, tx_handler_controller, telemetry: None, })?; + frontier_service::spawn_frontier_tasks( + &task_manager, + client, + backend, + frontier_backend, + filter_pool, + overrides, + fee_history_cache, + fee_history_cache_limit, + ); + start_network.start_network(); Ok(task_manager) diff --git a/tests/config.ts b/tests/config.ts new file mode 100644 index 000000000..0028b31fb --- /dev/null +++ b/tests/config.ts @@ -0,0 +1,38 @@ +import Web3 from "web3"; +import { JsonRpcResponse } from "web3-core-helpers"; + +export const CHAIN_ID = 43; +export const HOST_HTTP_URL = "http://127.0.0.1:9933"; +export const HOST_WS_URL = "ws://127.0.0.1:9944"; +// TODO: https://github.com/darwinia-network/darwinia-2.0/issues/248 +export const BLOCK_GAS_LIMIT = 9375000; +export const DEFAULT_GAS = 4000000; +// EXTRINSIC_GAS_LIMIT = [BLOCK_GAS_LIMIT - BLOCK_GAS_LIMIT * (NORMAL_DISPATCH_RATIO - AVERAGE_ON_INITIALIZE_RATIO) - EXTRINSIC_BASE_Weight] / WEIGHT_PER_GAS = (1_000_000_000_000 * 2 * (0.75-0.025) - 125_000_000) / 40_000 +export const EXTRINSIC_GAS_LIMIT = 9059375; + +// Accounts builtin +export const FAITH = "0xC0F0f4ab324C46e55D02D0033343B4Be8A55532d"; +export const FAITH_P = "0xb9d2ea9a615f3165812e8d44de0d24da9bbd164b65c4f0573e1ce2c8dbd9c8df"; + +export async function customRequest(web3: Web3, method: string, params: any[]) { + return new Promise((resolve, reject) => { + (web3.currentProvider as any).send( + { + jsonrpc: "2.0", + id: 1, + method, + params, + }, + (error: Error | null, result?: JsonRpcResponse) => { + if (error) { + reject( + `Failed to send custom request (${method} (${params.join(",")})): ${ + error.message || error.toString() + }` + ); + } + resolve(result); + } + ); + }); +} diff --git a/tests/ethereum/contracts/contracts_info.ts b/tests/ethereum/contracts/contracts_info.ts new file mode 100644 index 000000000..3dcfa9fbf --- /dev/null +++ b/tests/ethereum/contracts/contracts_info.ts @@ -0,0 +1,367 @@ +export const incrementerInfo = { + bytecode: + "608060405234801561001057600080fd5b5060405161018c38038061018c8339818101604052602081101561003357600080fd5b810190808051906020019092919050505080600081905550506101318061005b6000396000f3fe6080604052348015600f57600080fd5b5060043610603c5760003560e01c80637cf5dab01460415780638381f58a14606c578063d826f88f146088575b600080fd5b606a60048036036020811015605557600080fd5b81019080803590602001909291905050506090565b005b607260ec565b6040518082815260200191505060405180910390f35b608e60f2565b005b80600054016000819055503373ffffffffffffffffffffffffffffffffffffffff167fb182275171042022ff972a26edbd0171bccc74463bd22e56dbbeba4e93b7a668826040518082815260200191505060405180910390a250565b60005481565b6000808190555056fea2646970667358221220e20e87bcf3085e9302330bfcfc42af9eeff3a82cf3d5bb636c607ae9363c595a64736f6c634300060c0033", + opcodes: + "PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 MLOAD PUSH2 0x18C CODESIZE SUB DUP1 PUSH2 0x18C DUP4 CODECOPY DUP2 DUP2 ADD PUSH1 0x40 MSTORE PUSH1 0x20 DUP2 LT ISZERO PUSH2 0x33 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 ADD SWAP1 DUP1 DUP1 MLOAD SWAP1 PUSH1 0x20 ADD SWAP1 SWAP3 SWAP2 SWAP1 POP POP POP DUP1 PUSH1 0x0 DUP2 SWAP1 SSTORE POP POP PUSH2 0x131 DUP1 PUSH2 0x5B PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN INVALID PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH1 0xF JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x4 CALLDATASIZE LT PUSH1 0x3C JUMPI PUSH1 0x0 CALLDATALOAD PUSH1 0xE0 SHR DUP1 PUSH4 0x7CF5DAB0 EQ PUSH1 0x41 JUMPI DUP1 PUSH4 0x8381F58A EQ PUSH1 0x6C JUMPI DUP1 PUSH4 0xD826F88F EQ PUSH1 0x88 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x6A PUSH1 0x4 DUP1 CALLDATASIZE SUB PUSH1 0x20 DUP2 LT ISZERO PUSH1 0x55 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 ADD SWAP1 DUP1 DUP1 CALLDATALOAD SWAP1 PUSH1 0x20 ADD SWAP1 SWAP3 SWAP2 SWAP1 POP POP POP PUSH1 0x90 JUMP JUMPDEST STOP JUMPDEST PUSH1 0x72 PUSH1 0xEC JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 DUP3 DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH1 0x8E PUSH1 0xF2 JUMP JUMPDEST STOP JUMPDEST DUP1 PUSH1 0x0 SLOAD ADD PUSH1 0x0 DUP2 SWAP1 SSTORE POP CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH32 0xB182275171042022FF972A26EDBD0171BCCC74463BD22E56DBBEBA4E93B7A668 DUP3 PUSH1 0x40 MLOAD DUP1 DUP3 DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG2 POP JUMP JUMPDEST PUSH1 0x0 SLOAD DUP2 JUMP JUMPDEST PUSH1 0x0 DUP1 DUP2 SWAP1 SSTORE POP JUMP INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 0xE2 0xE DUP8 0xBC RETURN ADDMOD 0x5E SWAP4 MUL CALLER SIGNEXTEND 0xFC 0xFC TIMESTAMP 0xAF SWAP15 0xEF RETURN 0xA8 0x2C RETURN 0xD5 0xBB PUSH4 0x6C607AE9 CALLDATASIZE EXTCODECOPY MSIZE GAS PUSH5 0x736F6C6343 STOP MOD 0xC STOP CALLER ", + abi: [ + { + inputs: [ + { + internalType: "uint256", + name: "_initialNumber", + type: "uint256", + }, + ], + stateMutability: "nonpayable", + type: "constructor", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "sender", + type: "address", + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256", + }, + ], + name: "Increment", + type: "event", + }, + { + inputs: [ + { + internalType: "uint256", + name: "_value", + type: "uint256", + }, + ], + name: "increment", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "number", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "reset", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + ], +}; + +export const opcodesInfo = { + bytecode: + "608060405234801561001057600080fd5b5060405161001d9061007e565b604051809103906000f080158015610039573d6000803e3d6000fd5b506000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061008b565b6101438061052283390190565b6104888061009a6000396000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c806355313dea146100515780636d3d14161461005b578063b9d1e5aa14610065578063f8a8fd6d1461006f575b600080fd5b610059610079565b005b61006361007b565b005b61006d610080565b005b610077610082565b005b005b600080fd5bfe5b600160021a6002f35b600581101561009f5760018101905061008b565b5060065b60058111156100b7576001810190506100a3565b5060015b60058112156100cf576001810190506100bb565b5060065b60058113156100e7576001810190506100d3565b506002156100f457600051505b60405160208101602060048337505060405160208101602060048339505060405160208101602060048360003c50503660005b8181101561013e5760028152600181019050610127565b505060008020506000602060403e6010608060106040610123612710fa506020610123600af05060008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600060405180807f697353616d654164647265737328616464726573732c61646472657373290000815250601e01905060405180910390209050600033905060405182815281600482015281602482015260648101604052602081604483600088611388f1505060405182815281600482015281602482015260648101604052602081604483600088611388f250506040518281528160048201528160248201526064810160405260208160448387611388f4505060006242004290507f50cb9fe53daa9737b786ab3646f04d0150dc50ef4e75f59509d83667ad5adb2060001b6040518082815260200191505060405180910390a07f50cb9fe53daa9737b786ab3646f04d0150dc50ef4e75f59509d83667ad5adb2060001b7f50cb9fe53daa9737b786ab3646f04d0150dc50ef4e75f59509d83667ad5adb2060001b6040518082815260200191505060405180910390a13373ffffffffffffffffffffffffffffffffffffffff1660001b7f50cb9fe53daa9737b786ab3646f04d0150dc50ef4e75f59509d83667ad5adb2060001b7f50cb9fe53daa9737b786ab3646f04d0150dc50ef4e75f59509d83667ad5adb2060001b6040518082815260200191505060405180910390a28060001b3373ffffffffffffffffffffffffffffffffffffffff1660001b7f50cb9fe53daa9737b786ab3646f04d0150dc50ef4e75f59509d83667ad5adb2060001b7f50cb9fe53daa9737b786ab3646f04d0150dc50ef4e75f59509d83667ad5adb2060001b6040518082815260200191505060405180910390a38060001b8160001b3373ffffffffffffffffffffffffffffffffffffffff1660001b7f50cb9fe53daa9737b786ab3646f04d0150dc50ef4e75f59509d83667ad5adb2060001b7f50cb9fe53daa9737b786ab3646f04d0150dc50ef4e75f59509d83667ad5adb2060001b6040518082815260200191505060405180910390a46002fffea265627a7a72315820da4feb2af5051e773c61e531dc7c451208bd898210e40f606667d91689c23c7c64736f6c63430005110032608060405234801561001057600080fd5b50610123806100206000396000f3fe6080604052348015600f57600080fd5b506004361060285760003560e01c8063161e715014602d575b600080fd5b608c60048036036040811015604157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505060a6565b604051808215151515815260200191505060405180910390f35b60008173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141560e3576001905060e8565b600090505b9291505056fea265627a7a7231582082d761506d74e3b44f3c332693f36afc64d261352ea6bd6c457883eea792919064736f6c63430005110032", + opcodes: + "PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 MLOAD PUSH2 0x1D SWAP1 PUSH2 0x7E JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 PUSH1 0x0 CREATE DUP1 ISZERO DUP1 ISZERO PUSH2 0x39 JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP PUSH1 0x0 DUP1 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF MUL NOT AND SWAP1 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND MUL OR SWAP1 SSTORE POP PUSH2 0x8B JUMP JUMPDEST PUSH2 0x143 DUP1 PUSH2 0x522 DUP4 CODECOPY ADD SWAP1 JUMP JUMPDEST PUSH2 0x488 DUP1 PUSH2 0x9A PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN INVALID PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x4 CALLDATASIZE LT PUSH2 0x4C JUMPI PUSH1 0x0 CALLDATALOAD PUSH1 0xE0 SHR DUP1 PUSH4 0x55313DEA EQ PUSH2 0x51 JUMPI DUP1 PUSH4 0x6D3D1416 EQ PUSH2 0x5B JUMPI DUP1 PUSH4 0xB9D1E5AA EQ PUSH2 0x65 JUMPI DUP1 PUSH4 0xF8A8FD6D EQ PUSH2 0x6F JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x59 PUSH2 0x79 JUMP JUMPDEST STOP JUMPDEST PUSH2 0x63 PUSH2 0x7B JUMP JUMPDEST STOP JUMPDEST PUSH2 0x6D PUSH2 0x80 JUMP JUMPDEST STOP JUMPDEST PUSH2 0x77 PUSH2 0x82 JUMP JUMPDEST STOP JUMPDEST STOP JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST INVALID JUMPDEST PUSH1 0x1 PUSH1 0x2 BYTE PUSH1 0x2 RETURN JUMPDEST PUSH1 0x5 DUP2 LT ISZERO PUSH2 0x9F JUMPI PUSH1 0x1 DUP2 ADD SWAP1 POP PUSH2 0x8B JUMP JUMPDEST POP PUSH1 0x6 JUMPDEST PUSH1 0x5 DUP2 GT ISZERO PUSH2 0xB7 JUMPI PUSH1 0x1 DUP2 ADD SWAP1 POP PUSH2 0xA3 JUMP JUMPDEST POP PUSH1 0x1 JUMPDEST PUSH1 0x5 DUP2 SLT ISZERO PUSH2 0xCF JUMPI PUSH1 0x1 DUP2 ADD SWAP1 POP PUSH2 0xBB JUMP JUMPDEST POP PUSH1 0x6 JUMPDEST PUSH1 0x5 DUP2 SGT ISZERO PUSH2 0xE7 JUMPI PUSH1 0x1 DUP2 ADD SWAP1 POP PUSH2 0xD3 JUMP JUMPDEST POP PUSH1 0x2 ISZERO PUSH2 0xF4 JUMPI PUSH1 0x0 MLOAD POP JUMPDEST PUSH1 0x40 MLOAD PUSH1 0x20 DUP2 ADD PUSH1 0x20 PUSH1 0x4 DUP4 CALLDATACOPY POP POP PUSH1 0x40 MLOAD PUSH1 0x20 DUP2 ADD PUSH1 0x20 PUSH1 0x4 DUP4 CODECOPY POP POP PUSH1 0x40 MLOAD PUSH1 0x20 DUP2 ADD PUSH1 0x20 PUSH1 0x4 DUP4 PUSH1 0x0 EXTCODECOPY POP POP CALLDATASIZE PUSH1 0x0 JUMPDEST DUP2 DUP2 LT ISZERO PUSH2 0x13E JUMPI PUSH1 0x2 DUP2 MSTORE PUSH1 0x1 DUP2 ADD SWAP1 POP PUSH2 0x127 JUMP JUMPDEST POP POP PUSH1 0x0 DUP1 KECCAK256 POP PUSH1 0x0 PUSH1 0x20 PUSH1 0x40 RETURNDATACOPY PUSH1 0x10 PUSH1 0x80 PUSH1 0x10 PUSH1 0x40 PUSH2 0x123 PUSH2 0x2710 STATICCALL POP PUSH1 0x20 PUSH2 0x123 PUSH1 0xA CREATE POP PUSH1 0x0 DUP1 PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 POP PUSH1 0x0 PUSH1 0x40 MLOAD DUP1 DUP1 PUSH32 0x697353616D654164647265737328616464726573732C61646472657373290000 DUP2 MSTORE POP PUSH1 0x1E ADD SWAP1 POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 KECCAK256 SWAP1 POP PUSH1 0x0 CALLER SWAP1 POP PUSH1 0x40 MLOAD DUP3 DUP2 MSTORE DUP2 PUSH1 0x4 DUP3 ADD MSTORE DUP2 PUSH1 0x24 DUP3 ADD MSTORE PUSH1 0x64 DUP2 ADD PUSH1 0x40 MSTORE PUSH1 0x20 DUP2 PUSH1 0x44 DUP4 PUSH1 0x0 DUP9 PUSH2 0x1388 CALL POP POP PUSH1 0x40 MLOAD DUP3 DUP2 MSTORE DUP2 PUSH1 0x4 DUP3 ADD MSTORE DUP2 PUSH1 0x24 DUP3 ADD MSTORE PUSH1 0x64 DUP2 ADD PUSH1 0x40 MSTORE PUSH1 0x20 DUP2 PUSH1 0x44 DUP4 PUSH1 0x0 DUP9 PUSH2 0x1388 CALLCODE POP POP PUSH1 0x40 MLOAD DUP3 DUP2 MSTORE DUP2 PUSH1 0x4 DUP3 ADD MSTORE DUP2 PUSH1 0x24 DUP3 ADD MSTORE PUSH1 0x64 DUP2 ADD PUSH1 0x40 MSTORE PUSH1 0x20 DUP2 PUSH1 0x44 DUP4 DUP8 PUSH2 0x1388 DELEGATECALL POP POP PUSH1 0x0 PUSH3 0x420042 SWAP1 POP PUSH32 0x50CB9FE53DAA9737B786AB3646F04D0150DC50EF4E75F59509D83667AD5ADB20 PUSH1 0x0 SHL PUSH1 0x40 MLOAD DUP1 DUP3 DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG0 PUSH32 0x50CB9FE53DAA9737B786AB3646F04D0150DC50EF4E75F59509D83667AD5ADB20 PUSH1 0x0 SHL PUSH32 0x50CB9FE53DAA9737B786AB3646F04D0150DC50EF4E75F59509D83667AD5ADB20 PUSH1 0x0 SHL PUSH1 0x40 MLOAD DUP1 DUP3 DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG1 CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x0 SHL PUSH32 0x50CB9FE53DAA9737B786AB3646F04D0150DC50EF4E75F59509D83667AD5ADB20 PUSH1 0x0 SHL PUSH32 0x50CB9FE53DAA9737B786AB3646F04D0150DC50EF4E75F59509D83667AD5ADB20 PUSH1 0x0 SHL PUSH1 0x40 MLOAD DUP1 DUP3 DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG2 DUP1 PUSH1 0x0 SHL CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x0 SHL PUSH32 0x50CB9FE53DAA9737B786AB3646F04D0150DC50EF4E75F59509D83667AD5ADB20 PUSH1 0x0 SHL PUSH32 0x50CB9FE53DAA9737B786AB3646F04D0150DC50EF4E75F59509D83667AD5ADB20 PUSH1 0x0 SHL PUSH1 0x40 MLOAD DUP1 DUP3 DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG3 DUP1 PUSH1 0x0 SHL DUP2 PUSH1 0x0 SHL CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x0 SHL PUSH32 0x50CB9FE53DAA9737B786AB3646F04D0150DC50EF4E75F59509D83667AD5ADB20 PUSH1 0x0 SHL PUSH32 0x50CB9FE53DAA9737B786AB3646F04D0150DC50EF4E75F59509D83667AD5ADB20 PUSH1 0x0 SHL PUSH1 0x40 MLOAD DUP1 DUP3 DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG4 PUSH1 0x2 SELFDESTRUCT INVALID LOG2 PUSH6 0x627A7A723158 KECCAK256 0xDA 0x4F 0xEB 0x2A CREATE2 SDIV 0x1E PUSH24 0x3C61E531DC7C451208BD898210E40F606667D91689C23C7C PUSH5 0x736F6C6343 STOP SDIV GT STOP ORIGIN PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x123 DUP1 PUSH2 0x20 PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN INVALID PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH1 0xF JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x4 CALLDATASIZE LT PUSH1 0x28 JUMPI PUSH1 0x0 CALLDATALOAD PUSH1 0xE0 SHR DUP1 PUSH4 0x161E7150 EQ PUSH1 0x2D JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x8C PUSH1 0x4 DUP1 CALLDATASIZE SUB PUSH1 0x40 DUP2 LT ISZERO PUSH1 0x41 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 ADD SWAP1 DUP1 DUP1 CALLDATALOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 PUSH1 0x20 ADD SWAP1 SWAP3 SWAP2 SWAP1 DUP1 CALLDATALOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 PUSH1 0x20 ADD SWAP1 SWAP3 SWAP2 SWAP1 POP POP POP PUSH1 0xA6 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 DUP3 ISZERO ISZERO ISZERO ISZERO DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH1 0x0 DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ ISZERO PUSH1 0xE3 JUMPI PUSH1 0x1 SWAP1 POP PUSH1 0xE8 JUMP JUMPDEST PUSH1 0x0 SWAP1 POP JUMPDEST SWAP3 SWAP2 POP POP JUMP INVALID LOG2 PUSH6 0x627A7A723158 KECCAK256 DUP3 0xD7 PUSH2 0x506D PUSH21 0xE3B44F3C332693F36AFC64D261352EA6BD6C457883 0xEE 0xA7 SWAP3 SWAP2 SWAP1 PUSH5 0x736F6C6343 STOP SDIV GT STOP ORIGIN ", + abi: [ + { + inputs: [], + payable: false, + stateMutability: "nonpayable", + type: "constructor", + }, + { + constant: false, + inputs: [], + name: "test", + outputs: [], + payable: false, + stateMutability: "nonpayable", + type: "function", + }, + { + constant: true, + inputs: [], + name: "test_invalid", + outputs: [], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: true, + inputs: [], + name: "test_revert", + outputs: [], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: true, + inputs: [], + name: "test_stop", + outputs: [], + payable: false, + stateMutability: "view", + type: "function", + }, + ], +}; + +export const eventInfo = { + bytecode: + "608060405234801561001057600080fd5b5061031b806100206000396000f3fe608060405234801561001057600080fd5b50600436106100885760003560e01c8063a67808571161005b578063a6780857146100b5578063b61c0503146100bf578063e8beef5b146100c9578063f38b0600146100d357610088565b8063102accc11461008d5780634e7ad3671461009757806365538c73146100a157806376bc21d9146100ab575b600080fd5b6100956100dd565b005b61009f610132565b005b6100a961014f565b005b6100b3610189565b005b6100bd6101bd565b005b6100c76101d6565b005b6100d1610214565b005b6100db61026c565b005b3373ffffffffffffffffffffffffffffffffffffffff16600115157f0e216b62efbb97e751a2ce09f607048751720397ecfb9eef1e48a6644948985b602a6040518082815260200191505060405180910390a3565b60011515602a6040518082815260200191505060405180910390a1565b7f65c9ac8011e286e89d02a269890f41d67ca2cc597b2c76c7c69321ff492be580602a6040518082815260200191505060405180910390a1565b3373ffffffffffffffffffffffffffffffffffffffff1660011515602a6040518082815260200191505060405180910390a2565b602a6040518082815260200191505060405180910390a0565b600115157f81933b308056e7e85668661dcd102b1f22795b4431f9cf4625794f381c271c6b602a6040518082815260200191505060405180910390a2565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60001b3373ffffffffffffffffffffffffffffffffffffffff1660011515602a6040518082815260200191505060405180910390a3565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60001b3373ffffffffffffffffffffffffffffffffffffffff16600115157f317b31292193c2a4f561cc40a95ea0d97a2733f14af6d6d59522473e1f3ae65f602a6040518082815260200191505060405180910390a456fea2646970667358221220153d53b462c5c7cf5d26f62987030b4c78e85c6c87a3b3e742769581438308c864736f6c634300060c0033", + opcode: "PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x31B DUP1 PUSH2 0x20 PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN INVALID PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x4 CALLDATASIZE LT PUSH2 0x88 JUMPI PUSH1 0x0 CALLDATALOAD PUSH1 0xE0 SHR DUP1 PUSH4 0xA6780857 GT PUSH2 0x5B JUMPI DUP1 PUSH4 0xA6780857 EQ PUSH2 0xB5 JUMPI DUP1 PUSH4 0xB61C0503 EQ PUSH2 0xBF JUMPI DUP1 PUSH4 0xE8BEEF5B EQ PUSH2 0xC9 JUMPI DUP1 PUSH4 0xF38B0600 EQ PUSH2 0xD3 JUMPI PUSH2 0x88 JUMP JUMPDEST DUP1 PUSH4 0x102ACCC1 EQ PUSH2 0x8D JUMPI DUP1 PUSH4 0x4E7AD367 EQ PUSH2 0x97 JUMPI DUP1 PUSH4 0x65538C73 EQ PUSH2 0xA1 JUMPI DUP1 PUSH4 0x76BC21D9 EQ PUSH2 0xAB JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x95 PUSH2 0xDD JUMP JUMPDEST STOP JUMPDEST PUSH2 0x9F PUSH2 0x132 JUMP JUMPDEST STOP JUMPDEST PUSH2 0xA9 PUSH2 0x14F JUMP JUMPDEST STOP JUMPDEST PUSH2 0xB3 PUSH2 0x189 JUMP JUMPDEST STOP JUMPDEST PUSH2 0xBD PUSH2 0x1BD JUMP JUMPDEST STOP JUMPDEST PUSH2 0xC7 PUSH2 0x1D6 JUMP JUMPDEST STOP JUMPDEST PUSH2 0xD1 PUSH2 0x214 JUMP JUMPDEST STOP JUMPDEST PUSH2 0xDB PUSH2 0x26C JUMP JUMPDEST STOP JUMPDEST CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x1 ISZERO ISZERO PUSH32 0xE216B62EFBB97E751A2CE09F607048751720397ECFB9EEF1E48A6644948985B PUSH1 0x2A PUSH1 0x40 MLOAD DUP1 DUP3 DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG3 JUMP JUMPDEST PUSH1 0x1 ISZERO ISZERO PUSH1 0x2A PUSH1 0x40 MLOAD DUP1 DUP3 DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG1 JUMP JUMPDEST PUSH32 0x65C9AC8011E286E89D02A269890F41D67CA2CC597B2C76C7C69321FF492BE580 PUSH1 0x2A PUSH1 0x40 MLOAD DUP1 DUP3 DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG1 JUMP JUMPDEST CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x1 ISZERO ISZERO PUSH1 0x2A PUSH1 0x40 MLOAD DUP1 DUP3 DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG2 JUMP JUMPDEST PUSH1 0x2A PUSH1 0x40 MLOAD DUP1 DUP3 DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG0 JUMP JUMPDEST PUSH1 0x1 ISZERO ISZERO PUSH32 0x81933B308056E7E85668661DCD102B1F22795B4431F9CF4625794F381C271C6B PUSH1 0x2A PUSH1 0x40 MLOAD DUP1 DUP3 DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG2 JUMP JUMPDEST PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x0 SHL CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x1 ISZERO ISZERO PUSH1 0x2A PUSH1 0x40 MLOAD DUP1 DUP3 DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG3 JUMP JUMPDEST PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x0 SHL CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x1 ISZERO ISZERO PUSH32 0x317B31292193C2A4F561CC40A95EA0D97A2733F14AF6D6D59522473E1F3AE65F PUSH1 0x2A PUSH1 0x40 MLOAD DUP1 DUP3 DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG4 JUMP INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 ISZERO RETURNDATASIZE MSTORE8 0xB4 PUSH3 0xC5C7CF 0x5D 0x26 0xF6 0x29 DUP8 SUB SIGNEXTEND 0x4C PUSH25 0xE85C6C87A3B3E742769581438308C864736F6C634300060C00 CALLER ", + abi: [ + { + inputs: [], + stateMutability: "nonpayable", + type: "constructor", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256", + }, + ], + name: "Log0", + type: "event", + }, + { + anonymous: true, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256", + }, + ], + name: "Log0Anonym", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bool", + name: "aBool", + type: "bool", + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256", + }, + ], + name: "Log1", + type: "event", + }, + { + anonymous: true, + inputs: [ + { + indexed: true, + internalType: "bool", + name: "aBool", + type: "bool", + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256", + }, + ], + name: "Log1Anonym", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bool", + name: "aBool", + type: "bool", + }, + { + indexed: true, + internalType: "address", + name: "aAddress", + type: "address", + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256", + }, + ], + name: "Log2", + type: "event", + }, + { + anonymous: true, + inputs: [ + { + indexed: true, + internalType: "bool", + name: "aBool", + type: "bool", + }, + { + indexed: true, + internalType: "address", + name: "aAddress", + type: "address", + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256", + }, + ], + name: "Log2Anonym", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bool", + name: "aBool", + type: "bool", + }, + { + indexed: true, + internalType: "address", + name: "aAddress", + type: "address", + }, + { + indexed: true, + internalType: "bytes32", + name: "aBytes32", + type: "bytes32", + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256", + }, + ], + name: "Log3", + type: "event", + }, + { + anonymous: true, + inputs: [ + { + indexed: true, + internalType: "bool", + name: "aBool", + type: "bool", + }, + { + indexed: true, + internalType: "address", + name: "aAddress", + type: "address", + }, + { + indexed: true, + internalType: "bytes32", + name: "aBytes32", + type: "bytes32", + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256", + }, + ], + name: "Log3Anonym", + type: "event", + }, + { + inputs: [], + name: "fireEventLog0", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "fireEventLog0Anonym", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "fireEventLog1", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "fireEventLog1Anonym", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "fireEventLog2", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "fireEventLog2Anonym", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "fireEventLog3", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "fireEventLog3Anonym", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + ], +}; diff --git a/tests/ethereum/contracts/event.sol b/tests/ethereum/contracts/event.sol new file mode 100644 index 000000000..4a350029a --- /dev/null +++ b/tests/ethereum/contracts/event.sol @@ -0,0 +1,75 @@ +// SPDX-License-Identifier: GPL-3.0 + +pragma solidity ^0.6.0; + +contract JSON_Test { + event Log0(uint256 value); + event Log0Anonym(uint256 value) anonymous; + + event Log1(bool indexed aBool, uint256 value); + event Log1Anonym(bool indexed aBool, uint256 value) anonymous; + + event Log2(bool indexed aBool, address indexed aAddress, uint256 value); + event Log2Anonym( + bool indexed aBool, + address indexed aAddress, + uint256 value + ) anonymous; + + event Log3( + bool indexed aBool, + address indexed aAddress, + bytes32 indexed aBytes32, + uint256 value + ); + event Log3Anonym( + bool indexed aBool, + address indexed aAddress, + bytes32 indexed aBytes32, + uint256 value + ) anonymous; + + constructor() public {} + + function fireEventLog0() public { + emit Log0(42); + } + + function fireEventLog0Anonym() public { + emit Log0Anonym(42); + } + + function fireEventLog1() public { + emit Log1(true, 42); + } + + function fireEventLog1Anonym() public { + emit Log1Anonym(true, 42); + } + + function fireEventLog2() public { + emit Log2(true, msg.sender, 42); + } + + function fireEventLog2Anonym() public { + emit Log2Anonym(true, msg.sender, 42); + } + + function fireEventLog3() public { + emit Log3( + true, + msg.sender, + 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff, + 42 + ); + } + + function fireEventLog3Anonym() public { + emit Log3Anonym( + true, + msg.sender, + 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff, + 42 + ); + } +} diff --git a/tests/ethereum/contracts/incrementer.sol b/tests/ethereum/contracts/incrementer.sol new file mode 100644 index 000000000..98dc6ea36 --- /dev/null +++ b/tests/ethereum/contracts/incrementer.sol @@ -0,0 +1,19 @@ +// SPDX-License-Identifier: GPL-3.0 + +pragma solidity ^0.6.0; + +contract Incrementer { + uint256 public number; + + constructor(uint256 _initialNumber) public { + number = _initialNumber; + } + + function increment(uint256 _value) public { + number = number + _value; + } + + function reset() public { + number = 0; + } +} diff --git a/tests/ethereum/contracts/opcodes.sol b/tests/ethereum/contracts/opcodes.sol new file mode 100644 index 000000000..d5ac9b5de --- /dev/null +++ b/tests/ethereum/contracts/opcodes.sol @@ -0,0 +1,489 @@ +// SPDX-License-Identifier: GPL-3.0 + +pragma solidity >=0.4.21 <0.6.0; + +contract Test1 { + //Simply add the two arguments and return + function isSameAddress(address a, address b) public pure returns (bool) { + if (a == b) return true; + return false; + } +} + +contract OpCodes { + Test1 test1; + + //Constructor function + constructor() public { + test1 = new Test1(); + } + + modifier onlyOwner(address _owner) { + require(msg.sender == _owner); + _; + } + + // Add a todo to the list + function test() public { + //simple_instructions + /*assembly { pop(sub(dup1, mul(dup1, dup1))) }*/ + + //keywords + assembly { + pop(address) + return(2, byte(2, 1)) + } + + //label_complex + /*assembly { 7 abc: 8 eq jump(abc) jumpi(eq(7, 8), abc) pop } + assembly { pop(jumpi(eq(7, 8), abc)) jump(abc) }*/ + + //functional + /*assembly { let x := 2 add(7, mul(6, x)) mul(7, 8) add =: x }*/ + + //for_statement + assembly { + for { + let i := 1 + } lt(i, 5) { + i := add(i, 1) + } { + + } + } + assembly { + for { + let i := 6 + } gt(i, 5) { + i := add(i, 1) + } { + + } + } + assembly { + for { + let i := 1 + } slt(i, 5) { + i := add(i, 1) + } { + + } + } + assembly { + for { + let i := 6 + } sgt(i, 5) { + i := add(i, 1) + } { + + } + } + + //no_opcodes_in_strict + assembly { + pop(callvalue()) + } + + //no_dup_swap_in_strict + /*assembly { swap1() }*/ + + //print_functional + assembly { + let x := mul(sload(0x12), 7) + } + + //print_if + assembly { + if 2 { + pop(mload(0)) + } + } + + //function_definitions_multiple_args + assembly { + function f(a, d) { + mstore(a, d) + } + function g(a, d) -> x, y { + + } + } + + //sstore + assembly { + function f(a, d) { + sstore(a, d) + } + function g(a, d) -> x, y { + + } + } + + //mstore8 + assembly { + function f(a, d) { + mstore8(a, d) + } + function g(a, d) -> x, y { + + } + } + + //calldatacopy + assembly { + let a := mload(0x40) + let b := add(a, 32) + calldatacopy(a, 4, 32) + /*calldatacopy(b, add(4, 32), 32)*/ + /*result := add(mload(a), mload(b))*/ + } + + //codecopy + assembly { + let a := mload(0x40) + let b := add(a, 32) + codecopy(a, 4, 32) + } + + //codecopy + assembly { + let a := mload(0x40) + let b := add(a, 32) + extcodecopy(0, a, 4, 32) + } + + //for_statement + assembly { + let x := calldatasize() + for { + let i := 0 + } lt(i, x) { + i := add(i, 1) + } { + mstore(i, 2) + } + } + + //keccak256 + assembly { + pop(keccak256(0, 0)) + } + + //returndatasize + assembly { + let r := returndatasize + } + + //returndatacopy + assembly { + returndatacopy(64, 32, 0) + } + + //byzantium vs const Constantinople + //staticcall + assembly { + pop(staticcall(10000, 0x123, 64, 0x10, 128, 0x10)) + } + + /*//create2 Constantinople + assembly { pop(create2(10, 0x123, 32, 64)) }*/ + + //create Constantinople + assembly { + pop(create(10, 0x123, 32)) + } + + //shift Constantinople + /*assembly { pop(shl(10, 32)) } + assembly { pop(shr(10, 32)) } + assembly { pop(sar(10, 32)) }*/ + + //not + assembly { + pop(not(0x1f)) + } + + //exp + assembly { + pop(exp(2, 226)) + } + + //mod + assembly { + pop(mod(3, 9)) + } + + //smod + assembly { + pop(smod(3, 9)) + } + + //div + assembly { + pop(div(4, 2)) + } + + //sdiv + assembly { + pop(sdiv(4, 2)) + } + + //iszero + assembly { + pop(iszero(1)) + } + + //and + assembly { + pop(and(2, 3)) + } + + //or + assembly { + pop(or(3, 3)) + } + + //xor + assembly { + pop(xor(3, 3)) + } + + //addmod + assembly { + pop(addmod(3, 3, 6)) + } + + //mulmod + assembly { + pop(mulmod(3, 3, 3)) + } + + //signextend + assembly { + pop(signextend(1, 10)) + } + + //sha3 + assembly { + pop(calldataload(0)) + } + + //blockhash + assembly { + pop(blockhash(sub(number(), 1))) + } + + //balance + assembly { + pop(balance(0x0)) + } + + //caller + assembly { + pop(caller()) + } + + //codesize + assembly { + pop(codesize()) + } + + //extcodesize + assembly { + pop(extcodesize(0x1)) + } + + //origin + assembly { + pop(origin()) + } + + //gas + assembly { + pop(gas()) + } + + //msize + assembly { + pop(msize()) + } + + //pc + assembly { + pop(pc()) + } + + //gasprice + assembly { + pop(gasprice()) + } + + //coinbase + assembly { + pop(coinbase()) + } + + //timestamp + assembly { + pop(timestamp()) + } + + //number + assembly { + pop(number()) + } + + //difficulty + assembly { + pop(difficulty()) + } + + //gaslimit + assembly { + pop(gaslimit()) + } + + //call + address contractAddr = address(test1); + bytes4 sig = bytes4(keccak256("isSameAddress(address,address)")); //Function signature + address a = msg.sender; + + assembly { + let x := mload(0x40) //Find empty storage location using "free memory pointer" + mstore(x, sig) //Place signature at begining of empty storage + mstore(add(x, 0x04), a) // first address parameter. just after signature + mstore(add(x, 0x24), a) // 2nd address parameter - first padded. add 32 bytes (not 20 bytes) + mstore(0x40, add(x, 0x64)) // this is missing in other examples. Set free pointer before function call. so it is used by called function. + // new free pointer position after the output values of the called function. + + let success := call( + 5000, //5k gas + contractAddr, //To addr + 0, //No wei passed + x, // Inputs are at location x + 0x44, //Inputs size two padded, so 68 bytes + x, //Store output over input + 0x20 + ) //Output is 32 bytes long + } + + //callcode + assembly { + let x := mload(0x40) //Find empty storage location using "free memory pointer" + mstore(x, sig) //Place signature at begining of empty storage + mstore(add(x, 0x04), a) // first address parameter. just after signature + mstore(add(x, 0x24), a) // 2nd address parameter - first padded. add 32 bytes (not 20 bytes) + mstore(0x40, add(x, 0x64)) // this is missing in other examples. Set free pointer before function call. so it is used by called function. + // new free pointer position after the output values of the called function. + + let success := callcode( + 5000, //5k gas + contractAddr, //To addr + 0, //No wei passed + x, // Inputs are at location x + 0x44, //Inputs size two padded, so 68 bytes + x, //Store output over input + 0x20 + ) //Output is 32 bytes long + } + + //delegatecall + assembly { + let x := mload(0x40) //Find empty storage location using "free memory pointer" + mstore(x, sig) //Place signature at begining of empty storage + mstore(add(x, 0x04), a) // first address parameter. just after signature + mstore(add(x, 0x24), a) // 2nd address parameter - first padded. add 32 bytes (not 20 bytes) + mstore(0x40, add(x, 0x64)) // this is missing in other examples. Set free pointer before function call. so it is used by called function. + // new free pointer position after the output values of the called function. + + let success := delegatecall( + 5000, //5k gas + contractAddr, //To addr + x, // Inputs are at location x + 0x44, //Inputs size two padded, so 68 bytes + x, //Store output over input + 0x20 + ) //Output is 32 bytes long + } + + uint256 _id = 0x420042; + //log0 + log0( + bytes32( + 0x50cb9fe53daa9737b786ab3646f04d0150dc50ef4e75f59509d83667ad5adb20 + ) + ); + + //log1 + log1( + bytes32( + 0x50cb9fe53daa9737b786ab3646f04d0150dc50ef4e75f59509d83667ad5adb20 + ), + bytes32( + 0x50cb9fe53daa9737b786ab3646f04d0150dc50ef4e75f59509d83667ad5adb20 + ) + ); + + //log2 + log2( + bytes32( + 0x50cb9fe53daa9737b786ab3646f04d0150dc50ef4e75f59509d83667ad5adb20 + ), + bytes32( + 0x50cb9fe53daa9737b786ab3646f04d0150dc50ef4e75f59509d83667ad5adb20 + ), + bytes32(uint256(msg.sender)) + ); + + //log3 + log3( + bytes32( + 0x50cb9fe53daa9737b786ab3646f04d0150dc50ef4e75f59509d83667ad5adb20 + ), + bytes32( + 0x50cb9fe53daa9737b786ab3646f04d0150dc50ef4e75f59509d83667ad5adb20 + ), + bytes32(uint256(msg.sender)), + bytes32(_id) + ); + + //log4 + log4( + bytes32( + 0x50cb9fe53daa9737b786ab3646f04d0150dc50ef4e75f59509d83667ad5adb20 + ), + bytes32( + 0x50cb9fe53daa9737b786ab3646f04d0150dc50ef4e75f59509d83667ad5adb20 + ), + bytes32(uint256(msg.sender)), + bytes32(_id), + bytes32(_id) + ); + + //selfdestruct + assembly { + selfdestruct(0x02) + } + } + + function test_revert() public pure { + //revert + assembly { + revert(0, 0) + } + } + + function test_invalid() public pure { + //revert + assembly { + invalid() + } + } + + function test_stop() public pure { + //revert + assembly { + stop() + } + } +} diff --git a/tests/ethereum/test-balance.ts b/tests/ethereum/test-balance.ts new file mode 100644 index 000000000..89ccb387d --- /dev/null +++ b/tests/ethereum/test-balance.ts @@ -0,0 +1,47 @@ +import Web3 from "web3"; +import { describe } from "mocha"; +import { step } from "mocha-steps"; +import { expect } from "chai"; +import { HOST_HTTP_URL, FAITH, FAITH_P } from "../config"; + +const web3 = new Web3(HOST_HTTP_URL); +describe("Test balances", () => { + const VALUE = "0x200"; + const TO = "0x1111111111111111111111111111111111111111"; + const GAS_PRICE = "0x3B9ACA00"; // 1000000000 + + let init_from; + let init_to; + it("Account has correct balance", async function () { + init_from = await web3.eth.getBalance(FAITH); + init_to = await web3.eth.getBalance(TO); + + expect(Number(init_from)).to.be.greaterThan(Number(VALUE)); + }); + + step("Balance should be updated after transfer", async function () { + let tx = await web3.eth.accounts.signTransaction( + { + from: FAITH, + to: TO, + value: VALUE, + gasPrice: GAS_PRICE, + gas: "0x100000", + }, + FAITH_P + ); + await web3.eth.sendSignedTransaction(tx.rawTransaction); + }).timeout(60000); + + step("Balance should be updated after transfer", async function () { + const expectedFromBalance = ( + BigInt(init_from) - + BigInt(21000) * BigInt(GAS_PRICE) - + BigInt(VALUE) + ).toString(); + const expectedToBalance = (BigInt(init_to) + BigInt(VALUE)).toString(); + + expect(await web3.eth.getBalance(FAITH)).to.equal(expectedFromBalance); + expect(await web3.eth.getBalance(TO)).to.equal(expectedToBalance); + }); +}); diff --git a/tests/ethereum/test-block.ts b/tests/ethereum/test-block.ts new file mode 100644 index 000000000..95caccf74 --- /dev/null +++ b/tests/ethereum/test-block.ts @@ -0,0 +1,84 @@ +import Web3 from "web3"; +import { describe } from "mocha"; +import { expect } from "chai"; +import { HOST_HTTP_URL, BLOCK_GAS_LIMIT } from "../config"; + +const web3 = new Web3(HOST_HTTP_URL); +describe("Test Block RPC", () => { + it("The block number should not be zero", async () => { + expect(await web3.eth.getBlockNumber()).to.not.equal(0); + }); + + it("Get block by hash", async () => { + let latest_block = await web3.eth.getBlock("latest"); + let block = await web3.eth.getBlock(latest_block.hash); + expect(block.hash).to.be.equal(latest_block.hash); + }); + + it("Get block by number", async () => { + let block = await web3.eth.getBlock(1); + expect(block.number).not.null; + }); + + it("Get block by number", async () => { + let block = await web3.eth.getBlock(1); + expect(block.number).not.null; + }); + + it("Should return the genesis block", async () => { + let block = await web3.eth.getBlock(0); + expect(block).to.include({ + author: "0x0000000000000000000000000000000000000000", + difficulty: "0", + extraData: "0x", + gasLimit: BLOCK_GAS_LIMIT, + gasUsed: 0, + logsBloom: + "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + miner: "0x0000000000000000000000000000000000000000", + number: 0, + receiptsRoot: "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + size: 504, + timestamp: 0, + totalDifficulty: "0", + transactionsRoot: "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + }); + + expect(block.nonce).to.eql("0x0000000000000000"); + expect(block.timestamp).to.be.a("number"); + expect(block.transactions).to.be.a("array").empty; + expect(block.uncles).to.be.a("array").empty; + expect(block.sha3Uncles).to.equal( + "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + ); + expect(block.hash).to.be.a("string").lengthOf(66); + expect(block.parentHash).to.be.a("string").lengthOf(66); + expect(block.timestamp).to.be.a("number"); + }); + + it("Should include previous block hash as parent", async () => { + let block = await web3.eth.getBlock("latest"); + // previous block + let previous_block = await web3.eth.getBlock(block.number - 1); + + expect(block.hash).to.not.equal(previous_block.hash); + expect(block.parentHash).to.equal(previous_block.hash); + }); + + it("Should the taged block valid", async () => { + expect((await web3.eth.getBlock("earliest")).number).to.equal(0); + expect((await web3.eth.getBlock("latest")).number).gt(0); + }); + + it("Should return null if the block doesnt exist", async () => { + expect( + await web3.eth.getBlockTransactionCount( + "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" + ) + ).to.null; + }); + + it("Should return null when no uncle was found", async () => { + expect(await web3.eth.getUncle(0, 0)).to.be.null; + }); +}); diff --git a/tests/ethereum/test-code.ts b/tests/ethereum/test-code.ts new file mode 100644 index 000000000..3ff174438 --- /dev/null +++ b/tests/ethereum/test-code.ts @@ -0,0 +1,29 @@ +import Web3 from "web3"; +import { describe } from "mocha"; +import { expect } from "chai"; +import { HOST_HTTP_URL } from "../config"; + +const web3 = new Web3(HOST_HTTP_URL); +describe("Test contracts code", () => { + it("The precompiles bytes code shouldn't be empty", async () => { + [ + "0x0000000000000000000000000000000000000001", + "0x0000000000000000000000000000000000000002", + "0x0000000000000000000000000000000000000003", + "0x0000000000000000000000000000000000000004", + "0x0000000000000000000000000000000000000005", + "0x0000000000000000000000000000000000000006", + "0x0000000000000000000000000000000000000007", + "0x0000000000000000000000000000000000000008", + "0x0000000000000000000000000000000000000400", + "0x0000000000000000000000000000000000000401", + "0x0000000000000000000000000000000000000402", + "0x0000000000000000000000000000000000000600", + "0x0000000000000000000000000000000000000601", + "0x0000000000000000000000000000000000000800", + ].forEach(async (x) => { + const code = await web3.eth.getCode(x); + expect(code).to.equal("0x60006000fd"); + }); + }); +}); diff --git a/tests/ethereum/test-constants.ts b/tests/ethereum/test-constants.ts new file mode 100644 index 000000000..20dd9e522 --- /dev/null +++ b/tests/ethereum/test-constants.ts @@ -0,0 +1,22 @@ +import Web3 from "web3"; +import { describe } from "mocha"; +import { expect } from "chai"; +import { HOST_HTTP_URL, CHAIN_ID } from "../config"; + +const web3 = new Web3(HOST_HTTP_URL); +describe("Test constants RPC", () => { + it("Should have 0 hashrate", async () => { + expect(await web3.eth.getHashrate()).to.equal(0); + }); + + it("Should have chainId", async () => { + expect(await web3.eth.getChainId()).to.equal(CHAIN_ID); + }); + + // TODO: FIX ME + it.skip("block author should be 0x0000000000000000000000000000000000000000", async () => { + // This address `0x1234567890` is hardcoded into the runtime find_author + // as we are running manual sealing consensus. + expect(await web3.eth.getCoinbase()).to.equal("0x0000000000000000000000000000000000000000"); + }); +}); diff --git a/tests/ethereum/test-contract.ts b/tests/ethereum/test-contract.ts new file mode 100644 index 000000000..d44d9dd01 --- /dev/null +++ b/tests/ethereum/test-contract.ts @@ -0,0 +1,71 @@ +import Web3 from "web3"; +import { describe } from "mocha"; +import { step } from "mocha-steps"; +import { expect } from "chai"; +import { HOST_HTTP_URL, FAITH, FAITH_P, DEFAULT_GAS } from "../config"; +import { incrementerInfo } from "./contracts/contracts_info"; +import { AbiItem } from "web3-utils"; + +const web3 = new Web3(HOST_HTTP_URL); +describe("Test contract", () => { + web3.eth.accounts.wallet.add(FAITH_P); + const inc = new web3.eth.Contract(incrementerInfo.abi as AbiItem[]); + inc.options.from = FAITH; + inc.options.gas = DEFAULT_GAS; + + let transact_hash; + step("Deploy contract", async () => { + let data = inc.deploy({ data: incrementerInfo.bytecode, arguments: [5] }); + let tx = await web3.eth.accounts.signTransaction( + { + from: FAITH, + data: data.encodeABI(), + gas: DEFAULT_GAS, + }, + FAITH_P + ); + let receipt = await web3.eth.sendSignedTransaction(tx.rawTransaction); + + expect(receipt.transactionHash).to.not.be.null; + inc.options.address = receipt.contractAddress; + }).timeout(60000); + + step("Get contract code", async function () { + expect(await web3.eth.getCode(inc.options.address), incrementerInfo.bytecode); + }); + + step("Get default number", async function () { + expect(await inc.methods.number().call()).to.be.equal("5"); + }); + + step("Increase number", async function () { + let receipt = await inc.methods.increment(3).send(); + transact_hash = receipt.transactionHash; + + expect(receipt.transactionHash).to.not.be.null; + expect(await inc.methods.number().call()).to.be.equal("8"); + }).timeout(60000); + + step("Transaction bloom and Block bloom", async function () { + // transaction bloom + let receipt = await web3.eth.getTransactionReceipt(transact_hash); + expect(web3.utils.isInBloom(receipt.logsBloom, receipt.logs[0].address)).to.be.true; + for (let topic of receipt.logs[0].topics) { + expect(web3.utils.isInBloom(receipt.logsBloom, topic)).to.be.true; + } + + // block bloom + let block = await web3.eth.getBlock(receipt.blockHash); + expect(web3.utils.isInBloom(block.logsBloom, receipt.logs[0].address)).to.be.true; + for (let topic of receipt.logs[0].topics) { + expect(web3.utils.isInBloom(block.logsBloom, topic)).to.be.true; + } + }); + + step("Reset number", async function () { + let receipt = await inc.methods.reset().send(); + + expect(receipt.transactionHash).to.not.be.null; + expect(await inc.methods.number().call()).to.be.equal("0"); + }).timeout(60000); +}); diff --git a/tests/ethereum/test-events.ts b/tests/ethereum/test-events.ts new file mode 100644 index 000000000..453a6bb53 --- /dev/null +++ b/tests/ethereum/test-events.ts @@ -0,0 +1,98 @@ +import Web3 from "web3"; +import { describe } from "mocha"; +import { step } from "mocha-steps"; +import { expect } from "chai"; +import { HOST_WS_URL, FAITH, FAITH_P, DEFAULT_GAS } from "../config"; +import { eventInfo } from "./contracts/contracts_info"; +import { AbiItem } from "web3-utils"; + +const web3 = new Web3(HOST_WS_URL); +describe("Test event", () => { + web3.eth.accounts.wallet.add(FAITH_P); + const event = new web3.eth.Contract(eventInfo.abi as AbiItem[]); + event.options.from = FAITH; + event.options.gas = DEFAULT_GAS; + + step("Deploy event contract", async function () { + let tx = await web3.eth.accounts.signTransaction( + { + from: FAITH, + data: eventInfo.bytecode, + gas: DEFAULT_GAS, + }, + FAITH_P + ); + let receipt = await web3.eth.sendSignedTransaction(tx.rawTransaction); + + expect(receipt.transactionHash).to.not.be.null; + event.options.address = receipt.contractAddress; + }).timeout(60000); + + step("Fire event log0", async function () { + await event.methods.fireEventLog0().send(); + + event.once("Log0", function (error, event) { + expect(event.raw.data).to.be.equal( + "0x000000000000000000000000000000000000000000000000000000000000002a" + ); + expect(event.signature).to.be.equal( + "0x65c9ac8011e286e89d02a269890f41d67ca2cc597b2c76c7c69321ff492be580" + ); + }); + }).timeout(60000); + + step("Fire event log0 anonym", async function () { + await event.methods.fireEventLog0Anonym().send(); + + event.once("Log0", function (error, event) { + expect(event.raw.data).to.be.equal( + "0x000000000000000000000000000000000000000000000000000000000000002a" + ); + expect(event.signature).to.be.null; + }); + }).timeout(60000); + + step("Fire event log3", async function () { + await event.methods.fireEventLog3().send(); + + event.once("Log0", function (error, event) { + expect(event.raw.data).to.be.equal( + "0x000000000000000000000000000000000000000000000000000000000000002a" + ); + expect(event.raw.topics.length).to.be.equal(4); + expect(event.raw.topics[1]).to.be.equal( + "0x0000000000000000000000000000000000000000000000000000000000000001" + ); + expect(event.raw.topics[2]).to.be.equal( + "0x0000000000000000000000006be02d1d3665660d22ff9624b7be0551ee1ac91b" + ); + expect(event.raw.topics[3]).to.be.equal( + "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" + ); + expect(event.signature).to.be.equal( + "0x317b31292193c2a4f561cc40a95ea0d97a2733f14af6d6d59522473e1f3ae65f" + ); + }); + }).timeout(60000); + + step("Fire event log3 anonym", async function () { + await event.methods.fireEventLog3Anonym().send(); + + event.once("Log0", function (error, event) { + expect(event.raw.data).to.be.equal( + "0x000000000000000000000000000000000000000000000000000000000000002a" + ); + expect(event.raw.topics.length).to.be.equal(3); + expect(event.raw.topics[0]).to.be.equal( + "0x0000000000000000000000000000000000000000000000000000000000000001" + ); + expect(event.raw.topics[1]).to.be.equal( + "0x0000000000000000000000006be02d1d3665660d22ff9624b7be0551ee1ac91b" + ); + expect(event.raw.topics[2]).to.be.equal( + "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" + ); + expect(event.signature).to.be.null; + }); + }).timeout(60000); +}); diff --git a/tests/ethereum/test-gas.ts b/tests/ethereum/test-gas.ts new file mode 100644 index 000000000..df00fab41 --- /dev/null +++ b/tests/ethereum/test-gas.ts @@ -0,0 +1,56 @@ +import Web3 from "web3"; +import { describe } from "mocha"; +import { step } from "mocha-steps"; +import { expect } from "chai"; +import { HOST_HTTP_URL, FAITH, FAITH_P, EXTRINSIC_GAS_LIMIT, customRequest } from "../config"; +import { incrementerInfo } from "./contracts/contracts_info"; +import { AbiItem } from "web3-utils"; + +const web3 = new Web3(HOST_HTTP_URL); +describe("Test transaction gas limit", () => { + web3.eth.accounts.wallet.add(FAITH_P); + const inc = new web3.eth.Contract(incrementerInfo.abi as AbiItem[]); + const data = inc.deploy({ data: incrementerInfo.bytecode, arguments: [5] }); + + it("Test transaction gas limit < `EXTRINSIC_GAS_LIMIT`", async () => { + let tx = await web3.eth.accounts.signTransaction( + { + from: FAITH, + data: data.encodeABI(), + gas: EXTRINSIC_GAS_LIMIT - 1, + }, + FAITH_P + ); + const receipt = await customRequest(web3, "eth_sendRawTransaction", [tx.rawTransaction]); + + expect((receipt as any).transactionHash).to.be.not.null; + }).timeout(60000); + + it("Test transaction gas limit = `EXTRINSIC_GAS_LIMIT`", async () => { + let tx = await web3.eth.accounts.signTransaction( + { + from: FAITH, + data: data.encodeABI(), + gas: EXTRINSIC_GAS_LIMIT, + }, + FAITH_P + ); + const receipt = await customRequest(web3, "eth_sendRawTransaction", [tx.rawTransaction]); + + expect((receipt as any).transactionHash).to.be.not.null; + }).timeout(60000); + + it("Test transaction gas limit > `EXTRINSIC_GAS_LIMIT`", async () => { + let tx = await web3.eth.accounts.signTransaction( + { + from: FAITH, + data: data.encodeABI(), + gas: EXTRINSIC_GAS_LIMIT + 1, + }, + FAITH_P + ); + const receipt = await customRequest(web3, "eth_sendRawTransaction", [tx.rawTransaction]); + + expect((receipt as any).error.message).to.equal("exceeds block gas limit"); + }).timeout(60000); +}); diff --git a/tests/ethereum/test-nonce.ts b/tests/ethereum/test-nonce.ts new file mode 100644 index 000000000..c51496990 --- /dev/null +++ b/tests/ethereum/test-nonce.ts @@ -0,0 +1,31 @@ +import Web3 from "web3"; +import { describe } from "mocha"; +import { step } from "mocha-steps"; +import { expect } from "chai"; +import { HOST_HTTP_URL, FAITH, FAITH_P } from "../config"; + +const web3 = new Web3(HOST_HTTP_URL); +describe("Test balances", () => { + let init_nonce; + step("Get the init nonce", async function () { + init_nonce = await web3.eth.getTransactionCount(FAITH); + }); + + step("Make a transaction", async function () { + let tx = await web3.eth.accounts.signTransaction( + { + from: FAITH, + to: "0x1111111111111111111111111111111111111111", + value: 0x200, + gasPrice: "0x3B9ACA00", // 1000000000, + gas: "0x100000", + }, + FAITH_P + ); + await web3.eth.sendSignedTransaction(tx.rawTransaction); + }).timeout(60000); + + step("Nonce should be updated after transaction", async function () { + expect(await web3.eth.getTransactionCount(FAITH)).to.be.equal(init_nonce + 1); + }); +}); diff --git a/tests/ethereum/test-opcodes.ts b/tests/ethereum/test-opcodes.ts new file mode 100644 index 000000000..82d411a1f --- /dev/null +++ b/tests/ethereum/test-opcodes.ts @@ -0,0 +1,48 @@ +import Web3 from "web3"; +import { describe } from "mocha"; +import { step } from "mocha-steps"; +import { expect } from "chai"; +import { HOST_HTTP_URL, FAITH, FAITH_P, DEFAULT_GAS } from "../config"; +import { opcodesInfo } from "./contracts/contracts_info"; +import { AbiItem } from "web3-utils"; + +const web3 = new Web3(HOST_HTTP_URL); +describe("Test solidity opcodes", () => { + web3.eth.accounts.wallet.add(FAITH_P); + const opcodes = new web3.eth.Contract(opcodesInfo.abi as AbiItem[]); + opcodes.options.from = FAITH; + opcodes.options.gas = DEFAULT_GAS; + + step("Opcodes should works", async function () { + let tx = await web3.eth.accounts.signTransaction( + { + from: FAITH, + data: opcodesInfo.bytecode, + gas: DEFAULT_GAS, + }, + FAITH_P + ); + let receipt = await web3.eth.sendSignedTransaction(tx.rawTransaction); + opcodes.options.address = receipt.contractAddress; + expect(receipt.transactionHash).to.not.be.null; + + await opcodes.methods.test().call(); + await opcodes.methods.test_stop().call(); + }).timeout(60000); + + step("Call invalid opcode", async function () { + try { + await opcodes.methods.test_invalid().send(); + } catch (receipt) { + expect(receipt.receipt.status).to.be.false; + } + }).timeout(60000); + + step("Call revert opcode", async function () { + try { + await opcodes.methods.test_revert().send(); + } catch (receipt) { + expect(receipt.receipt.status).to.be.false; + } + }).timeout(60000); +}); diff --git a/tests/package-lock.json b/tests/package-lock.json new file mode 100644 index 000000000..549fdba64 --- /dev/null +++ b/tests/package-lock.json @@ -0,0 +1,8477 @@ +{ + "name": "ethereum-tests", + "version": "1.0.0", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "name": "ethereum-tests", + "version": "1.0.0", + "license": "ISC", + "dependencies": { + "@types/chai": "^4.3.4", + "@types/mocha": "^9.0.0", + "chai": "^4.3.4", + "mocha": "^8.2.0", + "mocha-steps": "^1.3.0", + "ts-node": "^10.9.1", + "typescript": "^4.2.4", + "web3": "^1.8.0" + } + }, + "node_modules/@cspotcode/source-map-support": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", + "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", + "dependencies": { + "@jridgewell/trace-mapping": "0.3.9" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@ethereumjs/common": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/@ethereumjs/common/-/common-2.5.0.tgz", + "integrity": "sha512-DEHjW6e38o+JmB/NO3GZBpW4lpaiBpkFgXF6jLcJ6gETBYpEyaA5nTimsWBUJR3Vmtm/didUEbNjajskugZORg==", + "dependencies": { + "crc-32": "^1.2.0", + "ethereumjs-util": "^7.1.1" + } + }, + "node_modules/@ethereumjs/tx": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/@ethereumjs/tx/-/tx-3.3.2.tgz", + "integrity": "sha512-6AaJhwg4ucmwTvw/1qLaZUX5miWrwZ4nLOUsKyb/HtzS3BMw/CasKhdi1ims9mBKeK9sOJCH4qGKOBGyJCeeog==", + "dependencies": { + "@ethereumjs/common": "^2.5.0", + "ethereumjs-util": "^7.1.2" + } + }, + "node_modules/@ethersproject/abi": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/abi/-/abi-5.7.0.tgz", + "integrity": "sha512-351ktp42TiRcYB3H1OP8yajPeAQstMW/yCFokj/AthP9bLHzQFPlOrxOcwYEDkUAICmOHljvN4K39OMTMUa9RA==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/address": "^5.7.0", + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/constants": "^5.7.0", + "@ethersproject/hash": "^5.7.0", + "@ethersproject/keccak256": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/strings": "^5.7.0" + } + }, + "node_modules/@ethersproject/abstract-provider": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/abstract-provider/-/abstract-provider-5.7.0.tgz", + "integrity": "sha512-R41c9UkchKCpAqStMYUpdunjo3pkEvZC3FAwZn5S5MGbXoMQOHIdHItezTETxAO5bevtMApSyEhn9+CHcDsWBw==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/networks": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/transactions": "^5.7.0", + "@ethersproject/web": "^5.7.0" + } + }, + "node_modules/@ethersproject/abstract-signer": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/abstract-signer/-/abstract-signer-5.7.0.tgz", + "integrity": "sha512-a16V8bq1/Cz+TGCkE2OPMTOUDLS3grCpdjoJCYNnVBbdYEMSgKrU0+B90s8b6H+ByYTBZN7a3g76jdIJi7UfKQ==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/abstract-provider": "^5.7.0", + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0" + } + }, + "node_modules/@ethersproject/address": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/address/-/address-5.7.0.tgz", + "integrity": "sha512-9wYhYt7aghVGo758POM5nqcOMaE168Q6aRLJZwUmiqSrAungkG74gSSeKEIR7ukixesdRZGPgVqme6vmxs1fkA==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/keccak256": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/rlp": "^5.7.0" + } + }, + "node_modules/@ethersproject/base64": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/base64/-/base64-5.7.0.tgz", + "integrity": "sha512-Dr8tcHt2mEbsZr/mwTPIQAf3Ai0Bks/7gTw9dSqk1mQvhW3XvRlmDJr/4n+wg1JmCl16NZue17CDh8xb/vZ0sQ==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/bytes": "^5.7.0" + } + }, + "node_modules/@ethersproject/bignumber": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/bignumber/-/bignumber-5.7.0.tgz", + "integrity": "sha512-n1CAdIHRWjSucQO3MC1zPSVgV/6dy/fjL9pMrPP9peL+QxEg9wOsVqwD4+818B6LUEtaXzVHQiuivzRoxPxUGw==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "bn.js": "^5.2.1" + } + }, + "node_modules/@ethersproject/bignumber/node_modules/bn.js": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", + "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==" + }, + "node_modules/@ethersproject/bytes": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/bytes/-/bytes-5.7.0.tgz", + "integrity": "sha512-nsbxwgFXWh9NyYWo+U8atvmMsSdKJprTcICAkvbBffT75qDocbuggBU0SJiVK2MuTrp0q+xvLkTnGMPK1+uA9A==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/logger": "^5.7.0" + } + }, + "node_modules/@ethersproject/constants": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/constants/-/constants-5.7.0.tgz", + "integrity": "sha512-DHI+y5dBNvkpYUMiRQyxRBYBefZkJfo70VUkUAsRjcPs47muV9evftfZ0PJVCXYbAiCgght0DtcF9srFQmIgWA==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/bignumber": "^5.7.0" + } + }, + "node_modules/@ethersproject/hash": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/hash/-/hash-5.7.0.tgz", + "integrity": "sha512-qX5WrQfnah1EFnO5zJv1v46a8HW0+E5xuBBDTwMFZLuVTx0tbU2kkx15NqdjxecrLGatQN9FGQKpb1FKdHCt+g==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/abstract-signer": "^5.7.0", + "@ethersproject/address": "^5.7.0", + "@ethersproject/base64": "^5.7.0", + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/keccak256": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/strings": "^5.7.0" + } + }, + "node_modules/@ethersproject/keccak256": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/keccak256/-/keccak256-5.7.0.tgz", + "integrity": "sha512-2UcPboeL/iW+pSg6vZ6ydF8tCnv3Iu/8tUmLLzWWGzxWKFFqOBQFLo6uLUv6BDrLgCDfN28RJ/wtByx+jZ4KBg==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/bytes": "^5.7.0", + "js-sha3": "0.8.0" + } + }, + "node_modules/@ethersproject/logger": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/logger/-/logger-5.7.0.tgz", + "integrity": "sha512-0odtFdXu/XHtjQXJYA3u9G0G8btm0ND5Cu8M7i5vhEcE8/HmF4Lbdqanwyv4uQTr2tx6b7fQRmgLrsnpQlmnig==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ] + }, + "node_modules/@ethersproject/networks": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/@ethersproject/networks/-/networks-5.7.1.tgz", + "integrity": "sha512-n/MufjFYv3yFcUyfhnXotyDlNdFb7onmkSy8aQERi2PjNcnWQ66xXxa3XlS8nCcA8aJKJjIIMNJTC7tu80GwpQ==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/logger": "^5.7.0" + } + }, + "node_modules/@ethersproject/properties": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/properties/-/properties-5.7.0.tgz", + "integrity": "sha512-J87jy8suntrAkIZtecpxEPxY//szqr1mlBaYlQ0r4RCaiD2hjheqF9s1LVE8vVuJCXisjIP+JgtK/Do54ej4Sw==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/logger": "^5.7.0" + } + }, + "node_modules/@ethersproject/rlp": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/rlp/-/rlp-5.7.0.tgz", + "integrity": "sha512-rBxzX2vK8mVF7b0Tol44t5Tb8gomOHkj5guL+HhzQ1yBh/ydjGnpw6at+X6Iw0Kp3OzzzkcKp8N9r0W4kYSs9w==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0" + } + }, + "node_modules/@ethersproject/signing-key": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/signing-key/-/signing-key-5.7.0.tgz", + "integrity": "sha512-MZdy2nL3wO0u7gkB4nA/pEf8lu1TlFswPNmy8AiYkfKTdO6eXBJyUdmHO/ehm/htHw9K/qF8ujnTyUAD+Ry54Q==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "bn.js": "^5.2.1", + "elliptic": "6.5.4", + "hash.js": "1.1.7" + } + }, + "node_modules/@ethersproject/signing-key/node_modules/bn.js": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", + "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==" + }, + "node_modules/@ethersproject/strings": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/strings/-/strings-5.7.0.tgz", + "integrity": "sha512-/9nu+lj0YswRNSH0NXYqrh8775XNyEdUQAuf3f+SmOrnVewcJ5SBNAjF7lpgehKi4abvNNXyf+HX86czCdJ8Mg==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/constants": "^5.7.0", + "@ethersproject/logger": "^5.7.0" + } + }, + "node_modules/@ethersproject/transactions": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/transactions/-/transactions-5.7.0.tgz", + "integrity": "sha512-kmcNicCp1lp8qanMTC3RIikGgoJ80ztTyvtsFvCYpSCfkjhD0jZ2LOrnbcuxuToLIUYYf+4XwD1rP+B/erDIhQ==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/address": "^5.7.0", + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/constants": "^5.7.0", + "@ethersproject/keccak256": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/rlp": "^5.7.0", + "@ethersproject/signing-key": "^5.7.0" + } + }, + "node_modules/@ethersproject/web": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/@ethersproject/web/-/web-5.7.1.tgz", + "integrity": "sha512-Gueu8lSvyjBWL4cYsWsjh6MtMwM0+H4HvqFPZfB6dV8ctbP9zFAO73VG1cMWae0FLPCtz0peKPpZY8/ugJJX2w==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/base64": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/strings": "^5.7.0" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz", + "integrity": "sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.4.14", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz", + "integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==" + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", + "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", + "dependencies": { + "@jridgewell/resolve-uri": "^3.0.3", + "@jridgewell/sourcemap-codec": "^1.4.10" + } + }, + "node_modules/@sindresorhus/is": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.6.0.tgz", + "integrity": "sha512-t09vSN3MdfsyCHoFcTRCH/iUtG7OJ0CsjzB8cjAmKc/va/kIgeDI/TxsigdncE/4be734m0cvIYwNaV4i2XqAw==", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sindresorhus/is?sponsor=1" + } + }, + "node_modules/@szmarczak/http-timer": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-5.0.1.tgz", + "integrity": "sha512-+PmQX0PiAYPMeVYe237LJAYvOMYW1j2rH5YROyS3b4CTVJum34HfRvKvAzozHAQG0TnHNdUfY9nCeUyRAs//cw==", + "dependencies": { + "defer-to-connect": "^2.0.1" + }, + "engines": { + "node": ">=14.16" + } + }, + "node_modules/@tsconfig/node10": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz", + "integrity": "sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==" + }, + "node_modules/@tsconfig/node12": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", + "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==" + }, + "node_modules/@tsconfig/node14": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", + "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==" + }, + "node_modules/@tsconfig/node16": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.3.tgz", + "integrity": "sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ==" + }, + "node_modules/@types/bn.js": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/@types/bn.js/-/bn.js-5.1.1.tgz", + "integrity": "sha512-qNrYbZqMx0uJAfKnKclPh+dTwK33KfLHYqtyODwd5HnXOjnkhc4qgn3BrK6RWyGZm5+sIFE7Q7Vz6QQtJB7w7g==", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/cacheable-request": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/@types/cacheable-request/-/cacheable-request-6.0.3.tgz", + "integrity": "sha512-IQ3EbTzGxIigb1I3qPZc1rWJnH0BmSKv5QYTalEwweFvyBDLSAe24zP0le/hyi7ecGfZVlIVAg4BZqb8WBwKqw==", + "dependencies": { + "@types/http-cache-semantics": "*", + "@types/keyv": "^3.1.4", + "@types/node": "*", + "@types/responselike": "^1.0.0" + } + }, + "node_modules/@types/chai": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.3.4.tgz", + "integrity": "sha512-KnRanxnpfpjUTqTCXslZSEdLfXExwgNxYPdiO2WGUj8+HDjFi8R3k5RVKPeSCzLjCcshCAtVO2QBbVuAV4kTnw==" + }, + "node_modules/@types/http-cache-semantics": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@types/http-cache-semantics/-/http-cache-semantics-4.0.1.tgz", + "integrity": "sha512-SZs7ekbP8CN0txVG2xVRH6EgKmEm31BOxA07vkFaETzZz1xh+cbt8BcI0slpymvwhx5dlFnQG2rTlPVQn+iRPQ==" + }, + "node_modules/@types/keyv": { + "version": "3.1.4", + "resolved": "https://registry.npmjs.org/@types/keyv/-/keyv-3.1.4.tgz", + "integrity": "sha512-BQ5aZNSCpj7D6K2ksrRCTmKRLEpnPvWDiLPfoGyhZ++8YtiK9d/3DBKPJgry359X/P1PfruyYwvnvwFjuEiEIg==", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/mocha": { + "version": "9.1.1", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-9.1.1.tgz", + "integrity": "sha512-Z61JK7DKDtdKTWwLeElSEBcWGRLY8g95ic5FoQqI9CMx0ns/Ghep3B4DfcEimiKMvtamNVULVNKEsiwV3aQmXw==" + }, + "node_modules/@types/node": { + "version": "12.20.55", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.55.tgz", + "integrity": "sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==" + }, + "node_modules/@types/pbkdf2": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@types/pbkdf2/-/pbkdf2-3.1.0.tgz", + "integrity": "sha512-Cf63Rv7jCQ0LaL8tNXmEyqTHuIJxRdlS5vMh1mj5voN4+QFhVZnlZruezqpWYDiJ8UTzhP0VmeLXCmBk66YrMQ==", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/responselike": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@types/responselike/-/responselike-1.0.0.tgz", + "integrity": "sha512-85Y2BjiufFzaMIlvJDvTTB8Fxl2xfLo4HgmHzVBz08w4wDePCTjYw66PdrolO0kzli3yam/YCgRufyo1DdQVTA==", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/secp256k1": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/@types/secp256k1/-/secp256k1-4.0.3.tgz", + "integrity": "sha512-Da66lEIFeIz9ltsdMZcpQvmrmmoqrfju8pm1BH8WbYjZSwUgCwXLb9C+9XYogwBITnbsSaMdVPb2ekf7TV+03w==", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@ungap/promise-all-settled": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz", + "integrity": "sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q==" + }, + "node_modules/abortcontroller-polyfill": { + "version": "1.7.5", + "resolved": "https://registry.npmjs.org/abortcontroller-polyfill/-/abortcontroller-polyfill-1.7.5.tgz", + "integrity": "sha512-JMJ5soJWP18htbbxJjG7bG6yuI6pRhgJ0scHHTfkUjf6wjP912xZWvM+A4sJK3gqd9E8fcPbDnOefbA9Th/FIQ==" + }, + "node_modules/accepts": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", + "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==", + "dependencies": { + "mime-types": "~2.1.34", + "negotiator": "0.6.3" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/acorn": { + "version": "8.8.2", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz", + "integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==", + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-walk": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", + "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ansi-colors": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", + "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==", + "engines": { + "node": ">=6" + } + }, + "node_modules/ansi-regex": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.1.tgz", + "integrity": "sha512-+O9Jct8wf++lXxxFc4hc8LsjaSq0HFzzL7cVsw8pRDIPdjKD2mT4ytDZlLuSBZ4cLKZFXIrMGO7DbQCtMJJMKw==", + "engines": { + "node": ">=4" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/arg": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==" + }, + "node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" + }, + "node_modules/array-flatten": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", + "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==" + }, + "node_modules/asn1": { + "version": "0.2.6", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.6.tgz", + "integrity": "sha512-ix/FxPn0MDjeyJ7i/yoHGFt/EX6LyNbxSEhPPXODPL+KB0VPk86UYfL0lMdy+KCnv+fmvIzySwaK5COwqVbWTQ==", + "dependencies": { + "safer-buffer": "~2.1.0" + } + }, + "node_modules/asn1.js": { + "version": "5.4.1", + "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-5.4.1.tgz", + "integrity": "sha512-+I//4cYPccV8LdmBLiX8CYvf9Sp3vQsrqu2QNXRcrbiWvcx/UdlFiqUJJzxRQxgsZmvhXhn4cSKeSmoFjVdupA==", + "dependencies": { + "bn.js": "^4.0.0", + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0", + "safer-buffer": "^2.1.0" + } + }, + "node_modules/assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha512-NfJ4UzBCcQGLDlQq7nHxH+tv3kyZ0hHQqF5BO6J7tNJeP5do1llPr8dZ8zHonfhAu0PHAdMkSo+8o0wxg9lZWw==", + "engines": { + "node": ">=0.8" + } + }, + "node_modules/assertion-error": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", + "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", + "engines": { + "node": "*" + } + }, + "node_modules/async-limiter": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.1.tgz", + "integrity": "sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ==" + }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" + }, + "node_modules/available-typed-arrays": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz", + "integrity": "sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/aws-sign2": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", + "integrity": "sha512-08kcGqnYf/YmjoRhfxyu+CLxBjUtHLXLXX/vUfx9l2LYzG3c1m61nrpyFUZI6zeS+Li/wWMMidD9KgrqtGq3mA==", + "engines": { + "node": "*" + } + }, + "node_modules/aws4": { + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.12.0.tgz", + "integrity": "sha512-NmWvPnx0F1SfrQbYwOi7OeaNGokp9XhzNioJ/CSBs8Qa4vxug81mhJEAVZwxXuBmYB5KDRfMq/F3RR0BIU7sWg==" + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" + }, + "node_modules/base-x": { + "version": "3.0.9", + "resolved": "https://registry.npmjs.org/base-x/-/base-x-3.0.9.tgz", + "integrity": "sha512-H7JU6iBHTal1gp56aKoaa//YUxEaAOUiydvrV/pILqIHXTtqxSkATOnDA2u+jZ/61sD+L/412+7kzXRtWukhpQ==", + "dependencies": { + "safe-buffer": "^5.0.1" + } + }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/bcrypt-pbkdf": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", + "integrity": "sha512-qeFIXtP4MSoi6NLqO12WfqARWWuCKi2Rn/9hJLEmtB5yTNr9DqFWkJRCf2qShWzPeAMRnOgCrq0sg/KLv5ES9w==", + "dependencies": { + "tweetnacl": "^0.14.3" + } + }, + "node_modules/bignumber.js": { + "version": "9.1.1", + "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.1.1.tgz", + "integrity": "sha512-pHm4LsMJ6lzgNGVfZHjMoO8sdoRhOzOH4MLmY65Jg70bpxCKu5iOHNJyfF6OyvYw7t8Fpf35RuzUyqnQsj8Vig==", + "engines": { + "node": "*" + } + }, + "node_modules/binary-extensions": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", + "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", + "engines": { + "node": ">=8" + } + }, + "node_modules/blakejs": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/blakejs/-/blakejs-1.2.1.tgz", + "integrity": "sha512-QXUSXI3QVc/gJME0dBpXrag1kbzOqCjCX8/b54ntNyW6sjtoqxqRk3LTmXzaJoh71zMsDCjM+47jS7XiwN/+fQ==" + }, + "node_modules/bluebird": { + "version": "3.7.2", + "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", + "integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==" + }, + "node_modules/bn.js": { + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", + "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" + }, + "node_modules/body-parser": { + "version": "1.20.1", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.1.tgz", + "integrity": "sha512-jWi7abTbYwajOytWCQc37VulmWiRae5RyTpaCyDcS5/lMdtwSz5lOpDE67srw/HYe35f1z3fDQw+3txg7gNtWw==", + "dependencies": { + "bytes": "3.1.2", + "content-type": "~1.0.4", + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "on-finished": "2.4.1", + "qs": "6.11.0", + "raw-body": "2.5.1", + "type-is": "~1.6.18", + "unpipe": "1.0.0" + }, + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" + } + }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dependencies": { + "fill-range": "^7.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/brorand": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", + "integrity": "sha512-cKV8tMCEpQs4hK/ik71d6LrPOnpkpGBR0wzxqr68g2m/LB2GxVYQroAjMJZRVM1Y4BCjCKc3vAamxSzOY2RP+w==" + }, + "node_modules/browser-stdout": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", + "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==" + }, + "node_modules/browserify-aes": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz", + "integrity": "sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA==", + "dependencies": { + "buffer-xor": "^1.0.3", + "cipher-base": "^1.0.0", + "create-hash": "^1.1.0", + "evp_bytestokey": "^1.0.3", + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "node_modules/browserify-cipher": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/browserify-cipher/-/browserify-cipher-1.0.1.tgz", + "integrity": "sha512-sPhkz0ARKbf4rRQt2hTpAHqn47X3llLkUGn+xEJzLjwY8LRs2p0v7ljvI5EyoRO/mexrNunNECisZs+gw2zz1w==", + "dependencies": { + "browserify-aes": "^1.0.4", + "browserify-des": "^1.0.0", + "evp_bytestokey": "^1.0.0" + } + }, + "node_modules/browserify-des": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/browserify-des/-/browserify-des-1.0.2.tgz", + "integrity": "sha512-BioO1xf3hFwz4kc6iBhI3ieDFompMhrMlnDFC4/0/vd5MokpuAc3R+LYbwTA9A5Yc9pq9UYPqffKpW2ObuwX5A==", + "dependencies": { + "cipher-base": "^1.0.1", + "des.js": "^1.0.0", + "inherits": "^2.0.1", + "safe-buffer": "^5.1.2" + } + }, + "node_modules/browserify-rsa": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/browserify-rsa/-/browserify-rsa-4.1.0.tgz", + "integrity": "sha512-AdEER0Hkspgno2aR97SAf6vi0y0k8NuOpGnVH3O99rcA5Q6sh8QxcngtHuJ6uXwnfAXNM4Gn1Gb7/MV1+Ymbog==", + "dependencies": { + "bn.js": "^5.0.0", + "randombytes": "^2.0.1" + } + }, + "node_modules/browserify-rsa/node_modules/bn.js": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", + "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==" + }, + "node_modules/browserify-sign": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/browserify-sign/-/browserify-sign-4.2.1.tgz", + "integrity": "sha512-/vrA5fguVAKKAVTNJjgSm1tRQDHUU6DbwO9IROu/0WAzC8PKhucDSh18J0RMvVeHAn5puMd+QHC2erPRNf8lmg==", + "dependencies": { + "bn.js": "^5.1.1", + "browserify-rsa": "^4.0.1", + "create-hash": "^1.2.0", + "create-hmac": "^1.1.7", + "elliptic": "^6.5.3", + "inherits": "^2.0.4", + "parse-asn1": "^5.1.5", + "readable-stream": "^3.6.0", + "safe-buffer": "^5.2.0" + } + }, + "node_modules/browserify-sign/node_modules/bn.js": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", + "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==" + }, + "node_modules/bs58": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/bs58/-/bs58-4.0.1.tgz", + "integrity": "sha512-Ok3Wdf5vOIlBrgCvTq96gBkJw+JUEzdBgyaza5HLtPm7yTHkjRy8+JzNyHF7BHa0bNWOQIp3m5YF0nnFcOIKLw==", + "dependencies": { + "base-x": "^3.0.2" + } + }, + "node_modules/bs58check": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/bs58check/-/bs58check-2.1.2.tgz", + "integrity": "sha512-0TS1jicxdU09dwJMNZtVAfzPi6Q6QeN0pM1Fkzrjn+XYHvzMKPU3pHVpva+769iNVSfIYWf7LJ6WR+BuuMf8cA==", + "dependencies": { + "bs58": "^4.0.0", + "create-hash": "^1.1.0", + "safe-buffer": "^5.1.2" + } + }, + "node_modules/buffer": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", + "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" + } + }, + "node_modules/buffer-to-arraybuffer": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/buffer-to-arraybuffer/-/buffer-to-arraybuffer-0.0.5.tgz", + "integrity": "sha512-3dthu5CYiVB1DEJp61FtApNnNndTckcqe4pFcLdvHtrpG+kcyekCJKg4MRiDcFW7A6AODnXB9U4dwQiCW5kzJQ==" + }, + "node_modules/buffer-xor": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/buffer-xor/-/buffer-xor-1.0.3.tgz", + "integrity": "sha512-571s0T7nZWK6vB67HI5dyUF7wXiNcfaPPPTl6zYCNApANjIvYJTg7hlud/+cJpdAhS7dVzqMLmfhfHR3rAcOjQ==" + }, + "node_modules/bufferutil": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-4.0.7.tgz", + "integrity": "sha512-kukuqc39WOHtdxtw4UScxF/WVnMFVSQVKhtx3AjZJzhd0RGZZldcrfSEbVsWWe6KNH253574cq5F+wpv0G9pJw==", + "hasInstallScript": true, + "dependencies": { + "node-gyp-build": "^4.3.0" + }, + "engines": { + "node": ">=6.14.2" + } + }, + "node_modules/bytes": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", + "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/cacheable-lookup": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/cacheable-lookup/-/cacheable-lookup-6.1.0.tgz", + "integrity": "sha512-KJ/Dmo1lDDhmW2XDPMo+9oiy/CeqosPguPCrgcVzKyZrL6pM1gU2GmPY/xo6OQPTUaA/c0kwHuywB4E6nmT9ww==", + "engines": { + "node": ">=10.6.0" + } + }, + "node_modules/cacheable-request": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-7.0.2.tgz", + "integrity": "sha512-pouW8/FmiPQbuGpkXQ9BAPv/Mo5xDGANgSNXzTzJ8DrKGuXOssM4wIQRjfanNRh3Yu5cfYPvcorqbhg2KIJtew==", + "dependencies": { + "clone-response": "^1.0.2", + "get-stream": "^5.1.0", + "http-cache-semantics": "^4.0.0", + "keyv": "^4.0.0", + "lowercase-keys": "^2.0.0", + "normalize-url": "^6.0.1", + "responselike": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/cacheable-request/node_modules/get-stream": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", + "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", + "dependencies": { + "pump": "^3.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/cacheable-request/node_modules/lowercase-keys": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz", + "integrity": "sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==", + "engines": { + "node": ">=8" + } + }, + "node_modules/call-bind": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", + "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "dependencies": { + "function-bind": "^1.1.1", + "get-intrinsic": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/camelcase": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", + "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/caseless": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw==" + }, + "node_modules/chai": { + "version": "4.3.7", + "resolved": "https://registry.npmjs.org/chai/-/chai-4.3.7.tgz", + "integrity": "sha512-HLnAzZ2iupm25PlN0xFreAlBA5zaBSv3og0DdeGA4Ar6h6rJ3A0rolRUKJhSF2V10GZKDgWF/VmAEsNWjCRB+A==", + "dependencies": { + "assertion-error": "^1.1.0", + "check-error": "^1.0.2", + "deep-eql": "^4.1.2", + "get-func-name": "^2.0.0", + "loupe": "^2.3.1", + "pathval": "^1.1.1", + "type-detect": "^4.0.5" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/chalk/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/check-error": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", + "integrity": "sha512-BrgHpW9NURQgzoNyjfq0Wu6VFO6D7IZEmJNdtgNqpzGG8RuNFHt2jQxWlAs4HMe119chBnv+34syEZtc6IhLtA==", + "engines": { + "node": "*" + } + }, + "node_modules/chokidar": { + "version": "3.5.1", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.1.tgz", + "integrity": "sha512-9+s+Od+W0VJJzawDma/gvBNQqkTiqYTWLuZoyAsivsI4AaWTCzHG06/TMjsf1cYe9Cb97UCEhjz7HvnPk2p/tw==", + "dependencies": { + "anymatch": "~3.1.1", + "braces": "~3.0.2", + "glob-parent": "~5.1.0", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.5.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.1" + } + }, + "node_modules/chownr": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz", + "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==" + }, + "node_modules/cids": { + "version": "0.7.5", + "resolved": "https://registry.npmjs.org/cids/-/cids-0.7.5.tgz", + "integrity": "sha512-zT7mPeghoWAu+ppn8+BS1tQ5qGmbMfB4AregnQjA/qHY3GC1m1ptI9GkWNlgeu38r7CuRdXB47uY2XgAYt6QVA==", + "deprecated": "This module has been superseded by the multiformats module", + "dependencies": { + "buffer": "^5.5.0", + "class-is": "^1.1.0", + "multibase": "~0.6.0", + "multicodec": "^1.0.0", + "multihashes": "~0.4.15" + }, + "engines": { + "node": ">=4.0.0", + "npm": ">=3.0.0" + } + }, + "node_modules/cids/node_modules/multicodec": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/multicodec/-/multicodec-1.0.4.tgz", + "integrity": "sha512-NDd7FeS3QamVtbgfvu5h7fd1IlbaC4EQ0/pgU4zqE2vdHCmBGsUa0TiM8/TdSeG6BMPC92OOCf8F1ocE/Wkrrg==", + "deprecated": "This module has been superseded by the multiformats module", + "dependencies": { + "buffer": "^5.6.0", + "varint": "^5.0.0" + } + }, + "node_modules/cipher-base": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz", + "integrity": "sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==", + "dependencies": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "node_modules/class-is": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/class-is/-/class-is-1.1.0.tgz", + "integrity": "sha512-rhjH9AG1fvabIDoGRVH587413LPjTZgmDF9fOFCbFJQV4yuocX1mHxxvXI4g3cGwbVY9wAYIoKlg1N79frJKQw==" + }, + "node_modules/cliui": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", + "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^7.0.0" + } + }, + "node_modules/cliui/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "engines": { + "node": ">=8" + } + }, + "node_modules/cliui/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "engines": { + "node": ">=8" + } + }, + "node_modules/cliui/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/cliui/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/clone-response": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/clone-response/-/clone-response-1.0.3.tgz", + "integrity": "sha512-ROoL94jJH2dUVML2Y/5PEDNaSHgeOdSDicUyS7izcF63G6sTc/FTjLub4b8Il9S8S0beOfYt0TaA5qvFK+w0wA==", + "dependencies": { + "mimic-response": "^1.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" + }, + "node_modules/content-disposition": { + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", + "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==", + "dependencies": { + "safe-buffer": "5.2.1" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/content-hash": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/content-hash/-/content-hash-2.5.2.tgz", + "integrity": "sha512-FvIQKy0S1JaWV10sMsA7TRx8bpU+pqPkhbsfvOJAdjRXvYxEckAwQWGwtRjiaJfh+E0DvcWUGqcdjwMGFjsSdw==", + "dependencies": { + "cids": "^0.7.1", + "multicodec": "^0.5.5", + "multihashes": "^0.4.15" + } + }, + "node_modules/content-type": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", + "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz", + "integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie-signature": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", + "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==" + }, + "node_modules/core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ==" + }, + "node_modules/cors": { + "version": "2.8.5", + "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz", + "integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==", + "dependencies": { + "object-assign": "^4", + "vary": "^1" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/crc-32": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/crc-32/-/crc-32-1.2.2.tgz", + "integrity": "sha512-ROmzCKrTnOwybPcJApAA6WBWij23HVfGVNKqqrZpuyZOHqK2CwHSvpGuyt/UNNvaIjEd8X5IFGp4Mh+Ie1IHJQ==", + "bin": { + "crc32": "bin/crc32.njs" + }, + "engines": { + "node": ">=0.8" + } + }, + "node_modules/create-ecdh": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/create-ecdh/-/create-ecdh-4.0.4.tgz", + "integrity": "sha512-mf+TCx8wWc9VpuxfP2ht0iSISLZnt0JgWlrOKZiNqyUZWnjIaCIVNQArMHnCZKfEYRg6IM7A+NeJoN8gf/Ws0A==", + "dependencies": { + "bn.js": "^4.1.0", + "elliptic": "^6.5.3" + } + }, + "node_modules/create-hash": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz", + "integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==", + "dependencies": { + "cipher-base": "^1.0.1", + "inherits": "^2.0.1", + "md5.js": "^1.3.4", + "ripemd160": "^2.0.1", + "sha.js": "^2.4.0" + } + }, + "node_modules/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==", + "dependencies": { + "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" + } + }, + "node_modules/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==" + }, + "node_modules/cross-fetch": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.1.5.tgz", + "integrity": "sha512-lvb1SBsI0Z7GDwmuid+mU3kWVBwTVUbe7S0H52yaaAdQOXq2YktTCZdlAcNKFzE6QtRz0snpw9bNiPeOIkkQvw==", + "dependencies": { + "node-fetch": "2.6.7" + } + }, + "node_modules/crypto-browserify": { + "version": "3.12.0", + "resolved": "https://registry.npmjs.org/crypto-browserify/-/crypto-browserify-3.12.0.tgz", + "integrity": "sha512-fz4spIh+znjO2VjL+IdhEpRJ3YN6sMzITSBijk6FK2UvTqruSQW+/cCZTSNsMiZNvUeq0CqurF+dAbyiGOY6Wg==", + "dependencies": { + "browserify-cipher": "^1.0.0", + "browserify-sign": "^4.0.0", + "create-ecdh": "^4.0.0", + "create-hash": "^1.1.0", + "create-hmac": "^1.1.0", + "diffie-hellman": "^5.0.0", + "inherits": "^2.0.1", + "pbkdf2": "^3.0.3", + "public-encrypt": "^4.0.0", + "randombytes": "^2.0.0", + "randomfill": "^1.0.3" + }, + "engines": { + "node": "*" + } + }, + "node_modules/d": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/d/-/d-1.0.1.tgz", + "integrity": "sha512-m62ShEObQ39CfralilEQRjH6oAMtNCV1xJyEx5LpRYUVN+EviphDgUc/F3hnYbADmkiNs67Y+3ylmlG7Lnu+FA==", + "dependencies": { + "es5-ext": "^0.10.50", + "type": "^1.0.1" + } + }, + "node_modules/dashdash": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", + "integrity": "sha512-jRFi8UDGo6j+odZiEpjazZaWqEal3w/basFjQHQEwVtZJGDpxbH1MeYluwCS8Xq5wmLJooDlMgvVarmWfGM44g==", + "dependencies": { + "assert-plus": "^1.0.0" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/decamelize": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz", + "integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/decode-uri-component": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.2.tgz", + "integrity": "sha512-FqUYQ+8o158GyGTrMFJms9qh3CqTKvAqgqsTnkLI8sKu0028orqBhxNMFkFen0zGyg6epACD32pjVk58ngIErQ==", + "engines": { + "node": ">=0.10" + } + }, + "node_modules/decompress-response": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz", + "integrity": "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==", + "dependencies": { + "mimic-response": "^3.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/decompress-response/node_modules/mimic-response": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz", + "integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/deep-eql": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-4.1.3.tgz", + "integrity": "sha512-WaEtAOpRA1MQ0eohqZjpGD8zdI0Ovsm8mmFhaDN8dvDZzyoUMcYDnf5Y6iu7HTXxf8JDS23qWa4a+hKCDyOPzw==", + "dependencies": { + "type-detect": "^4.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/defer-to-connect": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-2.0.1.tgz", + "integrity": "sha512-4tvttepXG1VaYGrRibk5EwJd1t4udunSOVMdLSAL6mId1ix438oPwPZMALY41FCijukO1L0twNcGsdzS7dHgDg==", + "engines": { + "node": ">=10" + } + }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/depd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/des.js": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/des.js/-/des.js-1.0.1.tgz", + "integrity": "sha512-Q0I4pfFrv2VPd34/vfLrFOoRmlYj3OV50i7fskps1jZWK1kApMWWT9G6RRUeYedLcBDIhnSDaUvJMb3AhUlaEA==", + "dependencies": { + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0" + } + }, + "node_modules/destroy": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", + "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==", + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" + } + }, + "node_modules/diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "engines": { + "node": ">=0.3.1" + } + }, + "node_modules/diffie-hellman": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz", + "integrity": "sha512-kqag/Nl+f3GwyK25fhUMYj81BUOrZ9IuJsjIcDE5icNM9FJHAVm3VcUDxdLPoQtTuUylWm6ZIknYJwwaPxsUzg==", + "dependencies": { + "bn.js": "^4.1.0", + "miller-rabin": "^4.0.0", + "randombytes": "^2.0.0" + } + }, + "node_modules/dom-walk": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/dom-walk/-/dom-walk-0.1.2.tgz", + "integrity": "sha512-6QvTW9mrGeIegrFXdtQi9pk7O/nSK6lSdXW2eqUspN5LWD7UTji2Fqw5V2YLjBpHEoU9Xl/eUWNpDeZvoyOv2w==" + }, + "node_modules/ecc-jsbn": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", + "integrity": "sha512-eh9O+hwRHNbG4BLTjEl3nw044CkGm5X6LoaCf7LPp7UU8Qrt47JYNi6nPX8xjW97TKGKm1ouctg0QSpZe9qrnw==", + "dependencies": { + "jsbn": "~0.1.0", + "safer-buffer": "^2.1.0" + } + }, + "node_modules/ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==" + }, + "node_modules/elliptic": { + "version": "6.5.4", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz", + "integrity": "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==", + "dependencies": { + "bn.js": "^4.11.9", + "brorand": "^1.1.0", + "hash.js": "^1.0.0", + "hmac-drbg": "^1.0.1", + "inherits": "^2.0.4", + "minimalistic-assert": "^1.0.1", + "minimalistic-crypto-utils": "^1.0.1" + } + }, + "node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" + }, + "node_modules/encodeurl": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", + "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/end-of-stream": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", + "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", + "dependencies": { + "once": "^1.4.0" + } + }, + "node_modules/es5-ext": { + "version": "0.10.62", + "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.62.tgz", + "integrity": "sha512-BHLqn0klhEpnOKSrzn/Xsz2UIW8j+cGmo9JLzr8BiUapV8hPL9+FliFqjwr9ngW7jWdnxv6eO+/LqyhJVqgrjA==", + "hasInstallScript": true, + "dependencies": { + "es6-iterator": "^2.0.3", + "es6-symbol": "^3.1.3", + "next-tick": "^1.1.0" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/es6-iterator": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/es6-iterator/-/es6-iterator-2.0.3.tgz", + "integrity": "sha512-zw4SRzoUkd+cl+ZoE15A9o1oQd920Bb0iOJMQkQhl3jNc03YqVjAhG7scf9C5KWRU/R13Orf588uCC6525o02g==", + "dependencies": { + "d": "1", + "es5-ext": "^0.10.35", + "es6-symbol": "^3.1.1" + } + }, + "node_modules/es6-promise": { + "version": "4.2.8", + "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", + "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==" + }, + "node_modules/es6-symbol": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.3.tgz", + "integrity": "sha512-NJ6Yn3FuDinBaBRWl/q5X/s4koRHBrgKAu+yGI6JCBeiu3qrcbJhwT2GeR/EXVfylRk8dpQVJoLEFhK+Mu31NA==", + "dependencies": { + "d": "^1.0.1", + "ext": "^1.1.2" + } + }, + "node_modules/escalade": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", + "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", + "engines": { + "node": ">=6" + } + }, + "node_modules/escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==" + }, + "node_modules/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==", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/eth-ens-namehash": { + "version": "2.0.8", + "resolved": "https://registry.npmjs.org/eth-ens-namehash/-/eth-ens-namehash-2.0.8.tgz", + "integrity": "sha512-VWEI1+KJfz4Km//dadyvBBoBeSQ0MHTXPvr8UIXiLW6IanxvAV+DmlZAijZwAyggqGUfwQBeHf7tc9wzc1piSw==", + "dependencies": { + "idna-uts46-hx": "^2.3.1", + "js-sha3": "^0.5.7" + } + }, + "node_modules/eth-ens-namehash/node_modules/js-sha3": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.5.7.tgz", + "integrity": "sha512-GII20kjaPX0zJ8wzkTbNDYMY7msuZcTWk8S5UOh6806Jq/wz1J8/bnr8uGU0DAUmYDjj2Mr4X1cW8v/GLYnR+g==" + }, + "node_modules/eth-lib": { + "version": "0.1.29", + "resolved": "https://registry.npmjs.org/eth-lib/-/eth-lib-0.1.29.tgz", + "integrity": "sha512-bfttrr3/7gG4E02HoWTDUcDDslN003OlOoBxk9virpAZQ1ja/jDgwkWB8QfJF7ojuEowrqy+lzp9VcJG7/k5bQ==", + "dependencies": { + "bn.js": "^4.11.6", + "elliptic": "^6.4.0", + "nano-json-stream-parser": "^0.1.2", + "servify": "^0.1.12", + "ws": "^3.0.0", + "xhr-request-promise": "^0.1.2" + } + }, + "node_modules/ethereum-bloom-filters": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/ethereum-bloom-filters/-/ethereum-bloom-filters-1.0.10.tgz", + "integrity": "sha512-rxJ5OFN3RwjQxDcFP2Z5+Q9ho4eIdEmSc2ht0fCu8Se9nbXjZ7/031uXoUYJ87KHCOdVeiUuwSnoS7hmYAGVHA==", + "dependencies": { + "js-sha3": "^0.8.0" + } + }, + "node_modules/ethereum-cryptography": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-0.1.3.tgz", + "integrity": "sha512-w8/4x1SGGzc+tO97TASLja6SLd3fRIK2tLVcV2Gx4IB21hE19atll5Cq9o3d0ZmAYC/8aw0ipieTSiekAea4SQ==", + "dependencies": { + "@types/pbkdf2": "^3.0.0", + "@types/secp256k1": "^4.0.1", + "blakejs": "^1.1.0", + "browserify-aes": "^1.2.0", + "bs58check": "^2.1.2", + "create-hash": "^1.2.0", + "create-hmac": "^1.1.7", + "hash.js": "^1.1.7", + "keccak": "^3.0.0", + "pbkdf2": "^3.0.17", + "randombytes": "^2.1.0", + "safe-buffer": "^5.1.2", + "scrypt-js": "^3.0.0", + "secp256k1": "^4.0.1", + "setimmediate": "^1.0.5" + } + }, + "node_modules/ethereumjs-util": { + "version": "7.1.5", + "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-7.1.5.tgz", + "integrity": "sha512-SDl5kKrQAudFBUe5OJM9Ac6WmMyYmXX/6sTmLZ3ffG2eY6ZIGBes3pEDxNN6V72WyOw4CPD5RomKdsa8DAAwLg==", + "dependencies": { + "@types/bn.js": "^5.1.0", + "bn.js": "^5.1.2", + "create-hash": "^1.1.2", + "ethereum-cryptography": "^0.1.3", + "rlp": "^2.2.4" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/ethereumjs-util/node_modules/bn.js": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", + "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==" + }, + "node_modules/ethjs-unit": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/ethjs-unit/-/ethjs-unit-0.1.6.tgz", + "integrity": "sha512-/Sn9Y0oKl0uqQuvgFk/zQgR7aw1g36qX/jzSQ5lSwlO0GigPymk4eGQfeNTD03w1dPOqfz8V77Cy43jH56pagw==", + "dependencies": { + "bn.js": "4.11.6", + "number-to-bn": "1.7.0" + }, + "engines": { + "node": ">=6.5.0", + "npm": ">=3" + } + }, + "node_modules/ethjs-unit/node_modules/bn.js": { + "version": "4.11.6", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.6.tgz", + "integrity": "sha512-XWwnNNFCuuSQ0m3r3C4LE3EiORltHd9M05pq6FOlVeiophzRbMo50Sbz1ehl8K3Z+jw9+vmgnXefY1hz8X+2wA==" + }, + "node_modules/eventemitter3": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.4.tgz", + "integrity": "sha512-rlaVLnVxtxvoyLsQQFBx53YmXHDxRIzzTLbdfxqi4yocpSjAxXwkU0cScM5JgSKMqEhrZpnvQ2D9gjylR0AimQ==" + }, + "node_modules/evp_bytestokey": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz", + "integrity": "sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA==", + "dependencies": { + "md5.js": "^1.3.4", + "safe-buffer": "^5.1.1" + } + }, + "node_modules/express": { + "version": "4.18.2", + "resolved": "https://registry.npmjs.org/express/-/express-4.18.2.tgz", + "integrity": "sha512-5/PsL6iGPdfQ/lKM1UuielYgv3BUoJfz1aUwU9vHZ+J7gyvwdQXFEBIEIaxeGf0GIcreATNyBExtalisDbuMqQ==", + "dependencies": { + "accepts": "~1.3.8", + "array-flatten": "1.1.1", + "body-parser": "1.20.1", + "content-disposition": "0.5.4", + "content-type": "~1.0.4", + "cookie": "0.5.0", + "cookie-signature": "1.0.6", + "debug": "2.6.9", + "depd": "2.0.0", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "finalhandler": "1.2.0", + "fresh": "0.5.2", + "http-errors": "2.0.0", + "merge-descriptors": "1.0.1", + "methods": "~1.1.2", + "on-finished": "2.4.1", + "parseurl": "~1.3.3", + "path-to-regexp": "0.1.7", + "proxy-addr": "~2.0.7", + "qs": "6.11.0", + "range-parser": "~1.2.1", + "safe-buffer": "5.2.1", + "send": "0.18.0", + "serve-static": "1.15.0", + "setprototypeof": "1.2.0", + "statuses": "2.0.1", + "type-is": "~1.6.18", + "utils-merge": "1.0.1", + "vary": "~1.1.2" + }, + "engines": { + "node": ">= 0.10.0" + } + }, + "node_modules/ext": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/ext/-/ext-1.7.0.tgz", + "integrity": "sha512-6hxeJYaL110a9b5TEJSj0gojyHQAmA2ch5Os+ySCiA1QGdS697XWY1pzsrSjqA9LDEEgdB/KypIlR59RcLuHYw==", + "dependencies": { + "type": "^2.7.2" + } + }, + "node_modules/ext/node_modules/type": { + "version": "2.7.2", + "resolved": "https://registry.npmjs.org/type/-/type-2.7.2.tgz", + "integrity": "sha512-dzlvlNlt6AXU7EBSfpAscydQ7gXB+pPGsPnfJnZpiNJBDj7IaJzQlBZYGdEi4R9HmPdBv2XmWJ6YUtoTa7lmCw==" + }, + "node_modules/extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" + }, + "node_modules/extsprintf": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", + "integrity": "sha512-11Ndz7Nv+mvAC1j0ktTa7fAb0vLyGGX+rMHNBYQviQDGU0Hw7lhctJANqbPhu9nV9/izT/IntTgZ7Im/9LJs9g==", + "engines": [ + "node >=0.6.0" + ] + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" + }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" + }, + "node_modules/fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/finalhandler": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz", + "integrity": "sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg==", + "dependencies": { + "debug": "2.6.9", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "on-finished": "2.4.1", + "parseurl": "~1.3.3", + "statuses": "2.0.1", + "unpipe": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dependencies": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/flat": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", + "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", + "bin": { + "flat": "cli.js" + } + }, + "node_modules/for-each": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", + "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", + "dependencies": { + "is-callable": "^1.1.3" + } + }, + "node_modules/forever-agent": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", + "integrity": "sha512-j0KLYPhm6zeac4lz3oJ3o65qvgQCcPubiyotZrXqEaG4hNagNYO8qdlUrX5vwqv9ohqeT/Z3j6+yW067yWWdUw==", + "engines": { + "node": "*" + } + }, + "node_modules/form-data": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", + "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.6", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 0.12" + } + }, + "node_modules/form-data-encoder": { + "version": "1.7.1", + "resolved": "https://registry.npmjs.org/form-data-encoder/-/form-data-encoder-1.7.1.tgz", + "integrity": "sha512-EFRDrsMm/kyqbTQocNvRXMLjc7Es2Vk+IQFx/YW7hkUH1eBl4J1fqiP34l74Yt0pFLCNpc06fkbVk00008mzjg==" + }, + "node_modules/forwarded": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", + "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/fresh": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", + "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/fs-extra": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-4.0.3.tgz", + "integrity": "sha512-q6rbdDd1o2mAnQreO7YADIxf/Whx4AHBiRf6d+/cVT8h44ss+lHgxf1FemcqDnQt9X3ct4McHr+JMGlYSsK7Cg==", + "dependencies": { + "graceful-fs": "^4.1.2", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + } + }, + "node_modules/fs-minipass": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-1.2.7.tgz", + "integrity": "sha512-GWSSJGFy4e9GUeCcbIkED+bgAoFyj7XF1mV8rma3QW4NIqX9Kyx79N/PF61H5udOV3aY1IaMLs6pGbH71nlCTA==", + "dependencies": { + "minipass": "^2.6.0" + } + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" + }, + "node_modules/fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" + }, + "node_modules/get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, + "node_modules/get-func-name": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", + "integrity": "sha512-Hm0ixYtaSZ/V7C8FJrtZIuBBI+iSgL+1Aq82zSu8VQNB4S3Gk8e7Qs3VwBDJAhmRZcFqkl3tQu36g/Foh5I5ig==", + "engines": { + "node": "*" + } + }, + "node_modules/get-intrinsic": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.0.tgz", + "integrity": "sha512-L049y6nFOuom5wGyRc3/gdTLO94dySVKRACj1RmJZBQXlbTMhtNIgkWkUHq+jYmZvKf14EW1EoJnnjbmoHij0Q==", + "dependencies": { + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-stream": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", + "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/getpass": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", + "integrity": "sha512-0fzj9JxOLfJ+XGLhR8ze3unN0KZCgZwiSSDz168VERjK8Wl8kVSdcu2kspd4s4wtAa1y/qrVRiAA0WclVsu0ng==", + "dependencies": { + "assert-plus": "^1.0.0" + } + }, + "node_modules/glob": { + "version": "7.1.6", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", + "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/global": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/global/-/global-4.4.0.tgz", + "integrity": "sha512-wv/LAoHdRE3BeTGz53FAamhGlPLhlssK45usmGFThIi4XqnBmjKQ16u+RNbP7WvigRZDxUsM0J3gcQ5yicaL0w==", + "dependencies": { + "min-document": "^2.19.0", + "process": "^0.11.10" + } + }, + "node_modules/gopd": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", + "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", + "dependencies": { + "get-intrinsic": "^1.1.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/got": { + "version": "12.1.0", + "resolved": "https://registry.npmjs.org/got/-/got-12.1.0.tgz", + "integrity": "sha512-hBv2ty9QN2RdbJJMK3hesmSkFTjVIHyIDDbssCKnSmq62edGgImJWD10Eb1k77TiV1bxloxqcFAVK8+9pkhOig==", + "dependencies": { + "@sindresorhus/is": "^4.6.0", + "@szmarczak/http-timer": "^5.0.1", + "@types/cacheable-request": "^6.0.2", + "@types/responselike": "^1.0.0", + "cacheable-lookup": "^6.0.4", + "cacheable-request": "^7.0.2", + "decompress-response": "^6.0.0", + "form-data-encoder": "1.7.1", + "get-stream": "^6.0.1", + "http2-wrapper": "^2.1.10", + "lowercase-keys": "^3.0.0", + "p-cancelable": "^3.0.0", + "responselike": "^2.0.0" + }, + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sindresorhus/got?sponsor=1" + } + }, + "node_modules/graceful-fs": { + "version": "4.2.10", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", + "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==" + }, + "node_modules/growl": { + "version": "1.10.5", + "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", + "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==", + "engines": { + "node": ">=4.x" + } + }, + "node_modules/har-schema": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", + "integrity": "sha512-Oqluz6zhGX8cyRaTQlFMPw80bSJVG2x/cFb8ZPhUILGgHka9SsokCCOQgpveePerqidZOrT14ipqfJb7ILcW5Q==", + "engines": { + "node": ">=4" + } + }, + "node_modules/har-validator": { + "version": "5.1.5", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.5.tgz", + "integrity": "sha512-nmT2T0lljbxdQZfspsno9hgrG3Uir6Ks5afism62poxqBM6sDnMEuPmzTq8XN0OEwqKLLdh1jQI3qyE66Nzb3w==", + "deprecated": "this library is no longer supported", + "dependencies": { + "ajv": "^6.12.3", + "har-schema": "^2.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dependencies": { + "function-bind": "^1.1.1" + }, + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "engines": { + "node": ">=8" + } + }, + "node_modules/has-symbols": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", + "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-tostringtag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.0.tgz", + "integrity": "sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==", + "dependencies": { + "has-symbols": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hash-base": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.1.0.tgz", + "integrity": "sha512-1nmYp/rhMDiE7AYkDw+lLwlAzz0AntGIe51F3RfFfEqyQ3feY2eI/NcwC6umIQVOASPMsWJLJScWKSSvzL9IVA==", + "dependencies": { + "inherits": "^2.0.4", + "readable-stream": "^3.6.0", + "safe-buffer": "^5.2.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/hash.js": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", + "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==", + "dependencies": { + "inherits": "^2.0.3", + "minimalistic-assert": "^1.0.1" + } + }, + "node_modules/he": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", + "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", + "bin": { + "he": "bin/he" + } + }, + "node_modules/hmac-drbg": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", + "integrity": "sha512-Tti3gMqLdZfhOQY1Mzf/AanLiqh1WTiJgEj26ZuYQ9fbkLomzGchCws4FyrSd4VkpBfiNhaE1On+lOz894jvXg==", + "dependencies": { + "hash.js": "^1.0.3", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.1" + } + }, + "node_modules/http-cache-semantics": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.1.tgz", + "integrity": "sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ==" + }, + "node_modules/http-errors": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", + "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==", + "dependencies": { + "depd": "2.0.0", + "inherits": "2.0.4", + "setprototypeof": "1.2.0", + "statuses": "2.0.1", + "toidentifier": "1.0.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/http-https": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/http-https/-/http-https-1.0.0.tgz", + "integrity": "sha512-o0PWwVCSp3O0wS6FvNr6xfBCHgt0m1tvPLFOCc2iFDKTRAXhB7m8klDf7ErowFH8POa6dVdGatKU5I1YYwzUyg==" + }, + "node_modules/http-signature": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", + "integrity": "sha512-CAbnr6Rz4CYQkLYUtSNXxQPUH2gK8f3iWexVlsnMeD+GjlsQ0Xsy1cOX+mN3dtxYomRy21CiOzU8Uhw6OwncEQ==", + "dependencies": { + "assert-plus": "^1.0.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" + }, + "engines": { + "node": ">=0.8", + "npm": ">=1.3.7" + } + }, + "node_modules/http2-wrapper": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/http2-wrapper/-/http2-wrapper-2.2.0.tgz", + "integrity": "sha512-kZB0wxMo0sh1PehyjJUWRFEd99KC5TLjZ2cULC4f9iqJBAmKQQXEICjxl5iPJRwP40dpeHFqqhm7tYCvODpqpQ==", + "dependencies": { + "quick-lru": "^5.1.1", + "resolve-alpn": "^1.2.0" + }, + "engines": { + "node": ">=10.19.0" + } + }, + "node_modules/iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/idna-uts46-hx": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/idna-uts46-hx/-/idna-uts46-hx-2.3.1.tgz", + "integrity": "sha512-PWoF9Keq6laYdIRwwCdhTPl60xRqAloYNMQLiyUnG42VjT53oW07BXIRM+NK7eQjzXjAk2gUvX9caRxlnF9TAA==", + "dependencies": { + "punycode": "2.1.0" + }, + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/idna-uts46-hx/node_modules/punycode": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.0.tgz", + "integrity": "sha512-Yxz2kRwT90aPiWEMHVYnEf4+rhwF1tBmmZ4KepCP+Wkium9JxtWnUm1nqGwpiAHr/tnTSeHqr3wb++jgSkXjhA==", + "engines": { + "node": ">=6" + } + }, + "node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "node_modules/ipaddr.js": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", + "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/is-arguments": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.1.tgz", + "integrity": "sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA==", + "dependencies": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-callable": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", + "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha512-VHskAKYM8RfSFXwee5t5cbN5PZeq1Wrh6qd5bkyiXIf6UQcN6w/A0eXM9r6t8d+GYOh+o6ZhiEnb88LN/Y8m2w==", + "engines": { + "node": ">=4" + } + }, + "node_modules/is-function": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-function/-/is-function-1.0.2.tgz", + "integrity": "sha512-lw7DUp0aWXYg+CBCN+JKkcE0Q2RayZnSvnZBlwgxHBQhqt5pZNVy4Ri7H9GmmXkdu7LUthszM+Tor1u/2iBcpQ==" + }, + "node_modules/is-generator-function": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.0.10.tgz", + "integrity": "sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A==", + "dependencies": { + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-hex-prefixed": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-hex-prefixed/-/is-hex-prefixed-1.0.0.tgz", + "integrity": "sha512-WvtOiug1VFrE9v1Cydwm+FnXd3+w9GaeVUss5W4v/SLy3UW00vP+6iNF2SdnfiBoLy4bTqVdkftNGTUeOFVsbA==", + "engines": { + "node": ">=6.5.0", + "npm": ">=3" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/is-plain-obj": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz", + "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==", + "engines": { + "node": ">=8" + } + }, + "node_modules/is-typed-array": { + "version": "1.1.10", + "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.10.tgz", + "integrity": "sha512-PJqgEHiWZvMpaFZ3uTc8kHPM4+4ADTlDniuQL7cU/UDA0Ql7F70yGfHph3cLNe+c9toaigv+DFzTJKhc2CtO6A==", + "dependencies": { + "available-typed-arrays": "^1.0.5", + "call-bind": "^1.0.2", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA==" + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==" + }, + "node_modules/isstream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha512-Yljz7ffyPbrLpLngrMtZ7NduUgVvi6wG9RJ9IUcyCd59YQ911PBJphODUcbOVbqYfxe1wuYf/LJ8PauMRwsM/g==" + }, + "node_modules/js-sha3": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.8.0.tgz", + "integrity": "sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q==" + }, + "node_modules/js-yaml": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.0.0.tgz", + "integrity": "sha512-pqon0s+4ScYUvX30wxQi3PogGFAlUyH0awepWvwkj4jD4v+ova3RiYw8bmA6x2rDrEaj8i/oWKoRxpVNW+Re8Q==", + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", + "integrity": "sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg==" + }, + "node_modules/json-buffer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", + "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==" + }, + "node_modules/json-schema": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.4.0.tgz", + "integrity": "sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA==" + }, + "node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" + }, + "node_modules/json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==" + }, + "node_modules/jsonfile": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", + "integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==", + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "node_modules/jsprim": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.2.tgz", + "integrity": "sha512-P2bSOMAc/ciLz6DzgjVlGJP9+BrJWu5UDGK70C2iweC5QBIeFf0ZXRvGjEj2uYgrY2MkAAhsSWHDWlFtEroZWw==", + "dependencies": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.4.0", + "verror": "1.10.0" + }, + "engines": { + "node": ">=0.6.0" + } + }, + "node_modules/keccak": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/keccak/-/keccak-3.0.3.tgz", + "integrity": "sha512-JZrLIAJWuZxKbCilMpNz5Vj7Vtb4scDG3dMXLOsbzBmQGyjwE61BbW7bJkfKKCShXiQZt3T6sBgALRtmd+nZaQ==", + "hasInstallScript": true, + "dependencies": { + "node-addon-api": "^2.0.0", + "node-gyp-build": "^4.2.0", + "readable-stream": "^3.6.0" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/keyv": { + "version": "4.5.2", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.2.tgz", + "integrity": "sha512-5MHbFaKn8cNSmVW7BYnijeAVlE4cYA/SVkifVgrh7yotnfhKmjuXpDKjrABLnT0SfHWV21P8ow07OGfRrNDg8g==", + "dependencies": { + "json-buffer": "3.0.1" + } + }, + "node_modules/locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dependencies": { + "p-locate": "^5.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/log-symbols": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.0.0.tgz", + "integrity": "sha512-FN8JBzLx6CzeMrB0tg6pqlGU1wCrXW+ZXGH481kfsBqer0hToTIiHdjH4Mq8xJUbvATujKCvaREGWpGUionraA==", + "dependencies": { + "chalk": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/loupe": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/loupe/-/loupe-2.3.6.tgz", + "integrity": "sha512-RaPMZKiMy8/JruncMU5Bt6na1eftNoo++R4Y+N2FrxkDVTrGvcyzFTsaGif4QTeKESheMGegbhw6iUAq+5A8zA==", + "dependencies": { + "get-func-name": "^2.0.0" + } + }, + "node_modules/lowercase-keys": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-3.0.0.tgz", + "integrity": "sha512-ozCC6gdQ+glXOQsveKD0YsDy8DSQFjDTz4zyzEHNV5+JP5D62LmfDZ6o1cycFx9ouG940M5dE8C8CTewdj2YWQ==", + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/make-error": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==" + }, + "node_modules/md5.js": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz", + "integrity": "sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg==", + "dependencies": { + "hash-base": "^3.0.0", + "inherits": "^2.0.1", + "safe-buffer": "^5.1.2" + } + }, + "node_modules/media-typer": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/merge-descriptors": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", + "integrity": "sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w==" + }, + "node_modules/methods": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", + "integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/miller-rabin": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/miller-rabin/-/miller-rabin-4.0.1.tgz", + "integrity": "sha512-115fLhvZVqWwHPbClyntxEVfVDfl9DLLTuJvq3g2O/Oxi8AiNouAHvDSzHS0viUJc+V5vm3eq91Xwqn9dp4jRA==", + "dependencies": { + "bn.js": "^4.0.0", + "brorand": "^1.0.1" + }, + "bin": { + "miller-rabin": "bin/miller-rabin" + } + }, + "node_modules/mime": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", + "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", + "bin": { + "mime": "cli.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mimic-response": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", + "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==", + "engines": { + "node": ">=4" + } + }, + "node_modules/min-document": { + "version": "2.19.0", + "resolved": "https://registry.npmjs.org/min-document/-/min-document-2.19.0.tgz", + "integrity": "sha512-9Wy1B3m3f66bPPmU5hdA4DR4PB2OfDU/+GS3yAB7IQozE3tqXaVv2zOjgla7MEGSRv95+ILmOuvhLkOK6wJtCQ==", + "dependencies": { + "dom-walk": "^0.1.0" + } + }, + "node_modules/minimalistic-assert": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", + "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==" + }, + "node_modules/minimalistic-crypto-utils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", + "integrity": "sha512-JIYlbt6g8i5jKfJ3xz7rF0LXmv2TkDxBLUkiBeZ7bAx4GnnNMr8xFpGnOxn6GhTEHx3SjRrZEoU+j04prX1ktg==" + }, + "node_modules/minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/minimist": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.7.tgz", + "integrity": "sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/minipass": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-2.9.0.tgz", + "integrity": "sha512-wxfUjg9WebH+CUDX/CdbRlh5SmfZiy/hpkxaRI16Y9W56Pa75sWgd/rvFilSgrauD9NyFymP/+JFV3KwzIsJeg==", + "dependencies": { + "safe-buffer": "^5.1.2", + "yallist": "^3.0.0" + } + }, + "node_modules/minizlib": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-1.3.3.tgz", + "integrity": "sha512-6ZYMOEnmVsdCeTJVE0W9ZD+pVnE8h9Hma/iOwwRDsdQoePpoX56/8B6z3P9VNwppJuBKNRuFDRNRqRWexT9G9Q==", + "dependencies": { + "minipass": "^2.9.0" + } + }, + "node_modules/mkdirp": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-2.1.3.tgz", + "integrity": "sha512-sjAkg21peAG9HS+Dkx7hlG9Ztx7HLeKnvB3NQRcu/mltCVmvkF0pisbiTSfDVYTT86XEfZrTUosLdZLStquZUw==", + "bin": { + "mkdirp": "dist/cjs/src/bin.js" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/mkdirp-promise": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/mkdirp-promise/-/mkdirp-promise-5.0.1.tgz", + "integrity": "sha512-Hepn5kb1lJPtVW84RFT40YG1OddBNTOVUZR2bzQUHc+Z03en8/3uX0+060JDhcEzyO08HmipsN9DcnFMxhIL9w==", + "deprecated": "This package is broken and no longer maintained. 'mkdirp' itself supports promises now, please switch to that.", + "dependencies": { + "mkdirp": "*" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/mocha": { + "version": "8.4.0", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-8.4.0.tgz", + "integrity": "sha512-hJaO0mwDXmZS4ghXsvPVriOhsxQ7ofcpQdm8dE+jISUOKopitvnXFQmpRR7jd2K6VBG6E26gU3IAbXXGIbu4sQ==", + "dependencies": { + "@ungap/promise-all-settled": "1.1.2", + "ansi-colors": "4.1.1", + "browser-stdout": "1.3.1", + "chokidar": "3.5.1", + "debug": "4.3.1", + "diff": "5.0.0", + "escape-string-regexp": "4.0.0", + "find-up": "5.0.0", + "glob": "7.1.6", + "growl": "1.10.5", + "he": "1.2.0", + "js-yaml": "4.0.0", + "log-symbols": "4.0.0", + "minimatch": "3.0.4", + "ms": "2.1.3", + "nanoid": "3.1.20", + "serialize-javascript": "5.0.1", + "strip-json-comments": "3.1.1", + "supports-color": "8.1.1", + "which": "2.0.2", + "wide-align": "1.1.3", + "workerpool": "6.1.0", + "yargs": "16.2.0", + "yargs-parser": "20.2.4", + "yargs-unparser": "2.0.0" + }, + "bin": { + "_mocha": "bin/_mocha", + "mocha": "bin/mocha" + }, + "engines": { + "node": ">= 10.12.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/mochajs" + } + }, + "node_modules/mocha-steps": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/mocha-steps/-/mocha-steps-1.3.0.tgz", + "integrity": "sha512-KZvpMJTqzLZw3mOb+EEuYi4YZS41C9iTnb7skVFRxHjUd1OYbl64tCMSmpdIRM9LnwIrSOaRfPtNpF5msgv6Eg==" + }, + "node_modules/mocha/node_modules/debug": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", + "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/mocha/node_modules/debug/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "node_modules/mocha/node_modules/diff": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz", + "integrity": "sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==", + "engines": { + "node": ">=0.3.1" + } + }, + "node_modules/mocha/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" + }, + "node_modules/mock-fs": { + "version": "4.14.0", + "resolved": "https://registry.npmjs.org/mock-fs/-/mock-fs-4.14.0.tgz", + "integrity": "sha512-qYvlv/exQ4+svI3UOvPUpLDF0OMX5euvUH0Ny4N5QyRyhNdgAgUrVH3iUINSzEPLvx0kbo/Bp28GJKIqvE7URw==" + }, + "node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" + }, + "node_modules/multibase": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/multibase/-/multibase-0.6.1.tgz", + "integrity": "sha512-pFfAwyTjbbQgNc3G7D48JkJxWtoJoBMaR4xQUOuB8RnCgRqaYmWNFeJTTvrJ2w51bjLq2zTby6Rqj9TQ9elSUw==", + "deprecated": "This module has been superseded by the multiformats module", + "dependencies": { + "base-x": "^3.0.8", + "buffer": "^5.5.0" + } + }, + "node_modules/multicodec": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/multicodec/-/multicodec-0.5.7.tgz", + "integrity": "sha512-PscoRxm3f+88fAtELwUnZxGDkduE2HD9Q6GHUOywQLjOGT/HAdhjLDYNZ1e7VR0s0TP0EwZ16LNUTFpoBGivOA==", + "deprecated": "This module has been superseded by the multiformats module", + "dependencies": { + "varint": "^5.0.0" + } + }, + "node_modules/multihashes": { + "version": "0.4.21", + "resolved": "https://registry.npmjs.org/multihashes/-/multihashes-0.4.21.tgz", + "integrity": "sha512-uVSvmeCWf36pU2nB4/1kzYZjsXD9vofZKpgudqkceYY5g2aZZXJ5r9lxuzoRLl1OAp28XljXsEJ/X/85ZsKmKw==", + "dependencies": { + "buffer": "^5.5.0", + "multibase": "^0.7.0", + "varint": "^5.0.0" + } + }, + "node_modules/multihashes/node_modules/multibase": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/multibase/-/multibase-0.7.0.tgz", + "integrity": "sha512-TW8q03O0f6PNFTQDvh3xxH03c8CjGaaYrjkl9UQPG6rz53TQzzxJVCIWVjzcbN/Q5Y53Zd0IBQBMVktVgNx4Fg==", + "deprecated": "This module has been superseded by the multiformats module", + "dependencies": { + "base-x": "^3.0.8", + "buffer": "^5.5.0" + } + }, + "node_modules/nano-json-stream-parser": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/nano-json-stream-parser/-/nano-json-stream-parser-0.1.2.tgz", + "integrity": "sha512-9MqxMH/BSJC7dnLsEMPyfN5Dvoo49IsPFYMcHw3Bcfc2kN0lpHRBSzlMSVx4HGyJ7s9B31CyBTVehWJoQ8Ctew==" + }, + "node_modules/nanoid": { + "version": "3.1.20", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.20.tgz", + "integrity": "sha512-a1cQNyczgKbLX9jwbS/+d7W8fX/RfgYR7lVWwWOGIPNgK2m0MWvrGF6/m4kk6U3QcFMnZf3RIhL0v2Jgh/0Uxw==", + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/negotiator": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", + "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/next-tick": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/next-tick/-/next-tick-1.1.0.tgz", + "integrity": "sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ==" + }, + "node_modules/node-addon-api": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-2.0.2.tgz", + "integrity": "sha512-Ntyt4AIXyaLIuMHF6IOoTakB3K+RWxwtsHNRxllEoA6vPwP9o4866g6YWDLUdnucilZhmkxiHwHr11gAENw+QA==" + }, + "node_modules/node-fetch": { + "version": "2.6.7", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", + "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + } + }, + "node_modules/node-gyp-build": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.6.0.tgz", + "integrity": "sha512-NTZVKn9IylLwUzaKjkas1e4u2DLNcV4rdYagA4PWdPwW87Bi7z+BznyKSRwS/761tV/lzCGXplWsiaMjLqP2zQ==", + "bin": { + "node-gyp-build": "bin.js", + "node-gyp-build-optional": "optional.js", + "node-gyp-build-test": "build-test.js" + } + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/normalize-url": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-6.1.0.tgz", + "integrity": "sha512-DlL+XwOy3NxAQ8xuC0okPgK46iuVNAK01YN7RueYBqqFeGsBjV9XmCAzAdgt+667bCl5kPh9EqKKDwnaPG1I7A==", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/number-to-bn": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/number-to-bn/-/number-to-bn-1.7.0.tgz", + "integrity": "sha512-wsJ9gfSz1/s4ZsJN01lyonwuxA1tml6X1yBDnfpMglypcBRFZZkus26EdPSlqS5GJfYddVZa22p3VNb3z5m5Ig==", + "dependencies": { + "bn.js": "4.11.6", + "strip-hex-prefix": "1.0.0" + }, + "engines": { + "node": ">=6.5.0", + "npm": ">=3" + } + }, + "node_modules/number-to-bn/node_modules/bn.js": { + "version": "4.11.6", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.6.tgz", + "integrity": "sha512-XWwnNNFCuuSQ0m3r3C4LE3EiORltHd9M05pq6FOlVeiophzRbMo50Sbz1ehl8K3Z+jw9+vmgnXefY1hz8X+2wA==" + }, + "node_modules/oauth-sign": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", + "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==", + "engines": { + "node": "*" + } + }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object-inspect": { + "version": "1.12.3", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz", + "integrity": "sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/oboe": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/oboe/-/oboe-2.1.5.tgz", + "integrity": "sha512-zRFWiF+FoicxEs3jNI/WYUrVEgA7DeET/InK0XQuudGHRg8iIob3cNPrJTKaz4004uaA9Pbe+Dwa8iluhjLZWA==", + "dependencies": { + "http-https": "^1.0.0" + } + }, + "node_modules/on-finished": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", + "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", + "dependencies": { + "ee-first": "1.1.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/p-cancelable": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-3.0.0.tgz", + "integrity": "sha512-mlVgR3PGuzlo0MmTdk4cXqXWlwQDLnONTAg6sm62XkMJEiRxN3GL3SffkYvqwonbkJBcrI7Uvv5Zh9yjvn2iUw==", + "engines": { + "node": ">=12.20" + } + }, + "node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dependencies": { + "p-limit": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/parse-asn1": { + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/parse-asn1/-/parse-asn1-5.1.6.tgz", + "integrity": "sha512-RnZRo1EPU6JBnra2vGHj0yhp6ebyjBZpmUCLHWiFhxlzvBCCpAuZ7elsBp1PVAbQN0/04VD/19rfzlBSwLstMw==", + "dependencies": { + "asn1.js": "^5.2.0", + "browserify-aes": "^1.0.0", + "evp_bytestokey": "^1.0.0", + "pbkdf2": "^3.0.3", + "safe-buffer": "^5.1.1" + } + }, + "node_modules/parse-headers": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/parse-headers/-/parse-headers-2.0.5.tgz", + "integrity": "sha512-ft3iAoLOB/MlwbNXgzy43SWGP6sQki2jQvAyBg/zDFAgr9bfNWZIUj42Kw2eJIl8kEi4PbgE6U1Zau/HwI75HA==" + }, + "node_modules/parseurl": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", + "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-to-regexp": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", + "integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==" + }, + "node_modules/pathval": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", + "integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==", + "engines": { + "node": "*" + } + }, + "node_modules/pbkdf2": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.1.2.tgz", + "integrity": "sha512-iuh7L6jA7JEGu2WxDwtQP1ddOpaJNC4KlDEFfdQajSGgGPNi4OyDc2R7QnbY2bR9QjBVGwgvTdNJZoE7RaxUMA==", + "dependencies": { + "create-hash": "^1.1.2", + "create-hmac": "^1.1.4", + "ripemd160": "^2.0.1", + "safe-buffer": "^5.0.1", + "sha.js": "^2.4.8" + }, + "engines": { + "node": ">=0.12" + } + }, + "node_modules/performance-now": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow==" + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/process": { + "version": "0.11.10", + "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", + "integrity": "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==", + "engines": { + "node": ">= 0.6.0" + } + }, + "node_modules/proxy-addr": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", + "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", + "dependencies": { + "forwarded": "0.2.0", + "ipaddr.js": "1.9.1" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/psl": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.9.0.tgz", + "integrity": "sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag==" + }, + "node_modules/public-encrypt": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/public-encrypt/-/public-encrypt-4.0.3.tgz", + "integrity": "sha512-zVpa8oKZSz5bTMTFClc1fQOnyyEzpl5ozpi1B5YcvBrdohMjH2rfsBtyXcuNuwjsDIXmBYlF2N5FlJYhR29t8Q==", + "dependencies": { + "bn.js": "^4.1.0", + "browserify-rsa": "^4.0.0", + "create-hash": "^1.1.0", + "parse-asn1": "^5.0.0", + "randombytes": "^2.0.1", + "safe-buffer": "^5.1.2" + } + }, + "node_modules/pump": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", + "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", + "dependencies": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "node_modules/punycode": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", + "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==", + "engines": { + "node": ">=6" + } + }, + "node_modules/qs": { + "version": "6.11.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz", + "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==", + "dependencies": { + "side-channel": "^1.0.4" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/query-string": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/query-string/-/query-string-5.1.1.tgz", + "integrity": "sha512-gjWOsm2SoGlgLEdAGt7a6slVOk9mGiXmPFMqrEhLQ68rhQuBnpfs3+EmlvqKyxnCo9/PPlF+9MtY02S1aFg+Jw==", + "dependencies": { + "decode-uri-component": "^0.2.0", + "object-assign": "^4.1.0", + "strict-uri-encode": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/quick-lru": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-5.1.1.tgz", + "integrity": "sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA==", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/randombytes": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "dependencies": { + "safe-buffer": "^5.1.0" + } + }, + "node_modules/randomfill": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/randomfill/-/randomfill-1.0.4.tgz", + "integrity": "sha512-87lcbR8+MhcWcUiQ+9e+Rwx8MyR2P7qnt15ynUlbm3TU/fjbgz4GsvfSUDTemtCCtVCqb4ZcEFlyPNTh9bBTLw==", + "dependencies": { + "randombytes": "^2.0.5", + "safe-buffer": "^5.1.0" + } + }, + "node_modules/range-parser": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", + "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/raw-body": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.1.tgz", + "integrity": "sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig==", + "dependencies": { + "bytes": "3.1.2", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "unpipe": "1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/readdirp": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.5.0.tgz", + "integrity": "sha512-cMhu7c/8rdhkHXWsY+osBhfSy0JikwpHK/5+imo+LpeasTF8ouErHrlYkwT0++njiyuDvc7OFY5T3ukvZ8qmFQ==", + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, + "node_modules/request": { + "version": "2.88.2", + "resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz", + "integrity": "sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==", + "deprecated": "request has been deprecated, see https://github.com/request/request/issues/3142", + "dependencies": { + "aws-sign2": "~0.7.0", + "aws4": "^1.8.0", + "caseless": "~0.12.0", + "combined-stream": "~1.0.6", + "extend": "~3.0.2", + "forever-agent": "~0.6.1", + "form-data": "~2.3.2", + "har-validator": "~5.1.3", + "http-signature": "~1.2.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.19", + "oauth-sign": "~0.9.0", + "performance-now": "^2.1.0", + "qs": "~6.5.2", + "safe-buffer": "^5.1.2", + "tough-cookie": "~2.5.0", + "tunnel-agent": "^0.6.0", + "uuid": "^3.3.2" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/request/node_modules/qs": { + "version": "6.5.3", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.3.tgz", + "integrity": "sha512-qxXIEh4pCGfHICj1mAJQ2/2XVZkjCDTcEgfoSQxc/fYivUZxTkk7L3bDBJSoNrEzXI17oUO5Dp07ktqE5KzczA==", + "engines": { + "node": ">=0.6" + } + }, + "node_modules/require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/resolve-alpn": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/resolve-alpn/-/resolve-alpn-1.2.1.tgz", + "integrity": "sha512-0a1F4l73/ZFZOakJnQ3FvkJ2+gSTQWz/r2KE5OdDY0TxPm5h4GkqkWWfM47T7HsbnOtcJVEF4epCVy6u7Q3K+g==" + }, + "node_modules/responselike": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/responselike/-/responselike-2.0.1.tgz", + "integrity": "sha512-4gl03wn3hj1HP3yzgdI7d3lCkF95F21Pz4BPGvKHinyQzALR5CapwC8yIi0Rh58DEMQ/SguC03wFj2k0M/mHhw==", + "dependencies": { + "lowercase-keys": "^2.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/responselike/node_modules/lowercase-keys": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz", + "integrity": "sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==", + "engines": { + "node": ">=8" + } + }, + "node_modules/ripemd160": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.2.tgz", + "integrity": "sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA==", + "dependencies": { + "hash-base": "^3.0.0", + "inherits": "^2.0.1" + } + }, + "node_modules/rlp": { + "version": "2.2.7", + "resolved": "https://registry.npmjs.org/rlp/-/rlp-2.2.7.tgz", + "integrity": "sha512-d5gdPmgQ0Z+AklL2NVXr/IoSjNZFfTVvQWzL/AM2AOcSzYP2xjlb0AC8YyCLc41MSNf6P6QVtjgPdmVtzb+4lQ==", + "dependencies": { + "bn.js": "^5.2.0" + }, + "bin": { + "rlp": "bin/rlp" + } + }, + "node_modules/rlp/node_modules/bn.js": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", + "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==" + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, + "node_modules/scrypt-js": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/scrypt-js/-/scrypt-js-3.0.1.tgz", + "integrity": "sha512-cdwTTnqPu0Hyvf5in5asVdZocVDTNRmR7XEcJuIzMjJeSHybHl7vpB66AzwTaIg6CLSbtjcxc8fqcySfnTkccA==" + }, + "node_modules/secp256k1": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/secp256k1/-/secp256k1-4.0.3.tgz", + "integrity": "sha512-NLZVf+ROMxwtEj3Xa562qgv2BK5e2WNmXPiOdVIPLgs6lyTzMvBq0aWTYMI5XCP9jZMVKOcqZLw/Wc4vDkuxhA==", + "hasInstallScript": true, + "dependencies": { + "elliptic": "^6.5.4", + "node-addon-api": "^2.0.0", + "node-gyp-build": "^4.2.0" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/send": { + "version": "0.18.0", + "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz", + "integrity": "sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==", + "dependencies": { + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "0.5.2", + "http-errors": "2.0.0", + "mime": "1.6.0", + "ms": "2.1.3", + "on-finished": "2.4.1", + "range-parser": "~1.2.1", + "statuses": "2.0.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/send/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" + }, + "node_modules/serialize-javascript": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-5.0.1.tgz", + "integrity": "sha512-SaaNal9imEO737H2c05Og0/8LUXG7EnsZyMa8MzkmuHoELfT6txuj0cMqRj6zfPKnmQ1yasR4PCJc8x+M4JSPA==", + "dependencies": { + "randombytes": "^2.1.0" + } + }, + "node_modules/serve-static": { + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.15.0.tgz", + "integrity": "sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g==", + "dependencies": { + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "parseurl": "~1.3.3", + "send": "0.18.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/servify": { + "version": "0.1.12", + "resolved": "https://registry.npmjs.org/servify/-/servify-0.1.12.tgz", + "integrity": "sha512-/xE6GvsKKqyo1BAY+KxOWXcLpPsUUyji7Qg3bVD7hh1eRze5bR1uYiuDA/k3Gof1s9BTzQZEJK8sNcNGFIzeWw==", + "dependencies": { + "body-parser": "^1.16.0", + "cors": "^2.8.1", + "express": "^4.14.0", + "request": "^2.79.0", + "xhr": "^2.3.3" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/setimmediate": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", + "integrity": "sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA==" + }, + "node_modules/setprototypeof": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==" + }, + "node_modules/sha.js": { + "version": "2.4.11", + "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", + "integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==", + "dependencies": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + }, + "bin": { + "sha.js": "bin.js" + } + }, + "node_modules/side-channel": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", + "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", + "dependencies": { + "call-bind": "^1.0.0", + "get-intrinsic": "^1.0.2", + "object-inspect": "^1.9.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/simple-concat": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.1.tgz", + "integrity": "sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/simple-get": { + "version": "2.8.2", + "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-2.8.2.tgz", + "integrity": "sha512-Ijd/rV5o+mSBBs4F/x9oDPtTx9Zb6X9brmnXvMW4J7IR15ngi9q5xxqWBKU744jTZiaXtxaPL7uHG6vtN8kUkw==", + "dependencies": { + "decompress-response": "^3.3.0", + "once": "^1.3.1", + "simple-concat": "^1.0.0" + } + }, + "node_modules/simple-get/node_modules/decompress-response": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", + "integrity": "sha512-BzRPQuY1ip+qDonAOz42gRm/pg9F768C+npV/4JOsxRC2sq+Rlk+Q4ZCAsOhnIaMrgarILY+RMUIvMmmX1qAEA==", + "dependencies": { + "mimic-response": "^1.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/sshpk": { + "version": "1.17.0", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.17.0.tgz", + "integrity": "sha512-/9HIEs1ZXGhSPE8X6Ccm7Nam1z8KcoCqPdI7ecm1N33EzAetWahvQWVqLZtaZQ+IDKX4IyA2o0gBzqIMkAagHQ==", + "dependencies": { + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "bcrypt-pbkdf": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jsbn": "~0.1.0", + "safer-buffer": "^2.0.2", + "tweetnacl": "~0.14.0" + }, + "bin": { + "sshpk-conv": "bin/sshpk-conv", + "sshpk-sign": "bin/sshpk-sign", + "sshpk-verify": "bin/sshpk-verify" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/statuses": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", + "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/strict-uri-encode": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz", + "integrity": "sha512-R3f198pcvnB+5IpnBlRkphuE9n46WyVl8I39W/ZUTZLz4nqSP/oLYUrcnJrw462Ds8he4YKMov2efsTIw1BDGQ==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "node_modules/string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "dependencies": { + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha512-4XaJ2zQdCzROZDivEVIDPkcQn8LMFSa8kj8Gxb/Lnwzv9A8VctNZ+lfivC/sV3ivW8ElJTERXZoPBRrZKkNKow==", + "dependencies": { + "ansi-regex": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/strip-hex-prefix": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/strip-hex-prefix/-/strip-hex-prefix-1.0.0.tgz", + "integrity": "sha512-q8d4ue7JGEiVcypji1bALTos+0pWtyGlivAWyPuTkHzuTCJqrK9sWxYQZUq6Nq3cuyv3bm734IhHvHtGGURU6A==", + "dependencies": { + "is-hex-prefixed": "1.0.0" + }, + "engines": { + "node": ">=6.5.0", + "npm": ">=3" + } + }, + "node_modules/strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" + } + }, + "node_modules/swarm-js": { + "version": "0.1.42", + "resolved": "https://registry.npmjs.org/swarm-js/-/swarm-js-0.1.42.tgz", + "integrity": "sha512-BV7c/dVlA3R6ya1lMlSSNPLYrntt0LUq4YMgy3iwpCIc6rZnS5W2wUoctarZ5pXlpKtxDDf9hNziEkcfrxdhqQ==", + "dependencies": { + "bluebird": "^3.5.0", + "buffer": "^5.0.5", + "eth-lib": "^0.1.26", + "fs-extra": "^4.0.2", + "got": "^11.8.5", + "mime-types": "^2.1.16", + "mkdirp-promise": "^5.0.1", + "mock-fs": "^4.1.0", + "setimmediate": "^1.0.5", + "tar": "^4.0.2", + "xhr-request": "^1.0.1" + } + }, + "node_modules/swarm-js/node_modules/@szmarczak/http-timer": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-4.0.6.tgz", + "integrity": "sha512-4BAffykYOgO+5nzBWYwE3W90sBgLJoUPRWWcL8wlyiM8IB8ipJz3UMJ9KXQd1RKQXpKp8Tutn80HZtWsu2u76w==", + "dependencies": { + "defer-to-connect": "^2.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/swarm-js/node_modules/cacheable-lookup": { + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/cacheable-lookup/-/cacheable-lookup-5.0.4.tgz", + "integrity": "sha512-2/kNscPhpcxrOigMZzbiWF7dz8ilhb/nIHU3EyZiXWXpeq/au8qJ8VhdftMkty3n7Gj6HIGalQG8oiBNB3AJgA==", + "engines": { + "node": ">=10.6.0" + } + }, + "node_modules/swarm-js/node_modules/got": { + "version": "11.8.6", + "resolved": "https://registry.npmjs.org/got/-/got-11.8.6.tgz", + "integrity": "sha512-6tfZ91bOr7bOXnK7PRDCGBLa1H4U080YHNaAQ2KsMGlLEzRbk44nsZF2E1IeRc3vtJHPVbKCYgdFbaGO2ljd8g==", + "dependencies": { + "@sindresorhus/is": "^4.0.0", + "@szmarczak/http-timer": "^4.0.5", + "@types/cacheable-request": "^6.0.1", + "@types/responselike": "^1.0.0", + "cacheable-lookup": "^5.0.3", + "cacheable-request": "^7.0.2", + "decompress-response": "^6.0.0", + "http2-wrapper": "^1.0.0-beta.5.2", + "lowercase-keys": "^2.0.0", + "p-cancelable": "^2.0.0", + "responselike": "^2.0.0" + }, + "engines": { + "node": ">=10.19.0" + }, + "funding": { + "url": "https://github.com/sindresorhus/got?sponsor=1" + } + }, + "node_modules/swarm-js/node_modules/http2-wrapper": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/http2-wrapper/-/http2-wrapper-1.0.3.tgz", + "integrity": "sha512-V+23sDMr12Wnz7iTcDeJr3O6AIxlnvT/bmaAAAP/Xda35C90p9599p0F1eHR/N1KILWSoWVAiOMFjBBXaXSMxg==", + "dependencies": { + "quick-lru": "^5.1.1", + "resolve-alpn": "^1.0.0" + }, + "engines": { + "node": ">=10.19.0" + } + }, + "node_modules/swarm-js/node_modules/lowercase-keys": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz", + "integrity": "sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==", + "engines": { + "node": ">=8" + } + }, + "node_modules/swarm-js/node_modules/p-cancelable": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-2.1.1.tgz", + "integrity": "sha512-BZOr3nRQHOntUjTrH8+Lh54smKHoHyur8We1V8DSMVrl5A2malOOwuJRnKRDjSnkoeBh4at6BwEnb5I7Jl31wg==", + "engines": { + "node": ">=8" + } + }, + "node_modules/tar": { + "version": "4.4.19", + "resolved": "https://registry.npmjs.org/tar/-/tar-4.4.19.tgz", + "integrity": "sha512-a20gEsvHnWe0ygBY8JbxoM4w3SJdhc7ZAuxkLqh+nvNQN2IOt0B5lLgM490X5Hl8FF0dl0tOf2ewFYAlIFgzVA==", + "dependencies": { + "chownr": "^1.1.4", + "fs-minipass": "^1.2.7", + "minipass": "^2.9.0", + "minizlib": "^1.3.3", + "mkdirp": "^0.5.5", + "safe-buffer": "^5.2.1", + "yallist": "^3.1.1" + }, + "engines": { + "node": ">=4.5" + } + }, + "node_modules/tar/node_modules/mkdirp": { + "version": "0.5.6", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz", + "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==", + "dependencies": { + "minimist": "^1.2.6" + }, + "bin": { + "mkdirp": "bin/cmd.js" + } + }, + "node_modules/timed-out": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/timed-out/-/timed-out-4.0.1.tgz", + "integrity": "sha512-G7r3AhovYtr5YKOWQkta8RKAPb+J9IsO4uVmzjl8AZwfhs8UcUwTiD6gcJYSgOtzyjvQKrKYn41syHbUWMkafA==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/toidentifier": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", + "engines": { + "node": ">=0.6" + } + }, + "node_modules/tough-cookie": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", + "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==", + "dependencies": { + "psl": "^1.1.28", + "punycode": "^2.1.1" + }, + "engines": { + "node": ">=0.8" + } + }, + "node_modules/tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" + }, + "node_modules/ts-node": { + "version": "10.9.1", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz", + "integrity": "sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==", + "dependencies": { + "@cspotcode/source-map-support": "^0.8.0", + "@tsconfig/node10": "^1.0.7", + "@tsconfig/node12": "^1.0.7", + "@tsconfig/node14": "^1.0.0", + "@tsconfig/node16": "^1.0.2", + "acorn": "^8.4.1", + "acorn-walk": "^8.1.1", + "arg": "^4.1.0", + "create-require": "^1.1.0", + "diff": "^4.0.1", + "make-error": "^1.1.1", + "v8-compile-cache-lib": "^3.0.1", + "yn": "3.1.1" + }, + "bin": { + "ts-node": "dist/bin.js", + "ts-node-cwd": "dist/bin-cwd.js", + "ts-node-esm": "dist/bin-esm.js", + "ts-node-script": "dist/bin-script.js", + "ts-node-transpile-only": "dist/bin-transpile.js", + "ts-script": "dist/bin-script-deprecated.js" + }, + "peerDependencies": { + "@swc/core": ">=1.2.50", + "@swc/wasm": ">=1.2.50", + "@types/node": "*", + "typescript": ">=2.7" + }, + "peerDependenciesMeta": { + "@swc/core": { + "optional": true + }, + "@swc/wasm": { + "optional": true + } + } + }, + "node_modules/tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==", + "dependencies": { + "safe-buffer": "^5.0.1" + }, + "engines": { + "node": "*" + } + }, + "node_modules/tweetnacl": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA==" + }, + "node_modules/type": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/type/-/type-1.2.0.tgz", + "integrity": "sha512-+5nt5AAniqsCnu2cEQQdpzCAh33kVx8n0VoFidKpB1dVVLAN/F+bgVOqOJqOnEnrhp222clB5p3vUlD+1QAnfg==" + }, + "node_modules/type-detect": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", + "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", + "engines": { + "node": ">=4" + } + }, + "node_modules/type-is": { + "version": "1.6.18", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", + "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", + "dependencies": { + "media-typer": "0.3.0", + "mime-types": "~2.1.24" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/typedarray-to-buffer": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", + "integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==", + "dependencies": { + "is-typedarray": "^1.0.0" + } + }, + "node_modules/typescript": { + "version": "4.9.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.4.tgz", + "integrity": "sha512-Uz+dTXYzxXXbsFpM86Wh3dKCxrQqUcVMxwU54orwlJjOpO3ao8L7j5lH+dWfTwgCwIuM9GQ2kvVotzYJMXTBZg==", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } + }, + "node_modules/ultron": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ultron/-/ultron-1.1.1.tgz", + "integrity": "sha512-UIEXBNeYmKptWH6z8ZnqTeS8fV74zG0/eRU9VGkpzz+LIJNs8W/zM/L+7ctCkRrgbNnnR0xxw4bKOr0cW0N0Og==" + }, + "node_modules/universalify": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", + "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", + "engines": { + "node": ">= 4.0.0" + } + }, + "node_modules/unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dependencies": { + "punycode": "^2.1.0" + } + }, + "node_modules/url-set-query": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/url-set-query/-/url-set-query-1.0.0.tgz", + "integrity": "sha512-3AChu4NiXquPfeckE5R5cGdiHCMWJx1dwCWOmWIL4KHAziJNOFIYJlpGFeKDvwLPHovZRCxK3cYlwzqI9Vp+Gg==" + }, + "node_modules/utf-8-validate": { + "version": "5.0.10", + "resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.10.tgz", + "integrity": "sha512-Z6czzLq4u8fPOyx7TU6X3dvUZVvoJmxSQ+IcrlmagKhilxlhZgxPK6C5Jqbkw1IDUmFTM+cz9QDnnLTwDz/2gQ==", + "hasInstallScript": true, + "dependencies": { + "node-gyp-build": "^4.3.0" + }, + "engines": { + "node": ">=6.14.2" + } + }, + "node_modules/utf8": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/utf8/-/utf8-3.0.0.tgz", + "integrity": "sha512-E8VjFIQ/TyQgp+TZfS6l8yp/xWppSAHzidGiRrqe4bK4XP9pTRyKFgGJpO3SN7zdX4DeomTrwaseCHovfpFcqQ==" + }, + "node_modules/util": { + "version": "0.12.5", + "resolved": "https://registry.npmjs.org/util/-/util-0.12.5.tgz", + "integrity": "sha512-kZf/K6hEIrWHI6XqOFUiiMa+79wE/D8Q+NCNAWclkyg3b4d2k7s0QGepNjiABc+aR3N1PAyHL7p6UcLY6LmrnA==", + "dependencies": { + "inherits": "^2.0.3", + "is-arguments": "^1.0.4", + "is-generator-function": "^1.0.7", + "is-typed-array": "^1.1.3", + "which-typed-array": "^1.1.2" + } + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" + }, + "node_modules/utils-merge": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", + "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==", + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/uuid": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", + "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", + "deprecated": "Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.", + "bin": { + "uuid": "bin/uuid" + } + }, + "node_modules/v8-compile-cache-lib": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", + "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==" + }, + "node_modules/varint": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/varint/-/varint-5.0.2.tgz", + "integrity": "sha512-lKxKYG6H03yCZUpAGOPOsMcGxd1RHCu1iKvEHYDPmTyq2HueGhD73ssNBqqQWfvYs04G9iUFRvmAVLW20Jw6ow==" + }, + "node_modules/vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/verror": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", + "integrity": "sha512-ZZKSmDAEFOijERBLkmYfJ+vmk3w+7hOLYDNkRCuRuMJGEmqYNCNLyBBFwWKVMhfwaEF3WOd0Zlw86U/WC/+nYw==", + "engines": [ + "node >=0.6.0" + ], + "dependencies": { + "assert-plus": "^1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "^1.2.0" + } + }, + "node_modules/web3": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/web3/-/web3-1.8.1.tgz", + "integrity": "sha512-tAqFsQhGv340C9OgRJIuoScN7f7wa1tUvsnnDUMt9YE6J4gcm7TV2Uwv+KERnzvV+xgdeuULYpsioRRNKrUvoQ==", + "hasInstallScript": true, + "dependencies": { + "web3-bzz": "1.8.1", + "web3-core": "1.8.1", + "web3-eth": "1.8.1", + "web3-eth-personal": "1.8.1", + "web3-net": "1.8.1", + "web3-shh": "1.8.1", + "web3-utils": "1.8.1" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/web3-bzz": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/web3-bzz/-/web3-bzz-1.8.1.tgz", + "integrity": "sha512-dJJHS84nvpoxv6ijTMkdUSlRr5beCXNtx4UZcrFLHBva8dT63QEtKdLyDt2AyMJJdVzTCk78uir/6XtVWrdS6w==", + "hasInstallScript": true, + "dependencies": { + "@types/node": "^12.12.6", + "got": "12.1.0", + "swarm-js": "^0.1.40" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/web3-core": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/web3-core/-/web3-core-1.8.1.tgz", + "integrity": "sha512-LbRZlJH2N6nS3n3Eo9Y++25IvzMY7WvYnp4NM/Ajhh97dAdglYs6rToQ2DbL2RLvTYmTew4O/y9WmOk4nq9COw==", + "dependencies": { + "@types/bn.js": "^5.1.0", + "@types/node": "^12.12.6", + "bignumber.js": "^9.0.0", + "web3-core-helpers": "1.8.1", + "web3-core-method": "1.8.1", + "web3-core-requestmanager": "1.8.1", + "web3-utils": "1.8.1" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/web3-core-helpers": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.8.1.tgz", + "integrity": "sha512-ClzNO6T1S1gifC+BThw0+GTfcsjLEY8T1qUp6Ly2+w4PntAdNtKahxWKApWJ0l9idqot/fFIDXwO3Euu7I0Xqw==", + "dependencies": { + "web3-eth-iban": "1.8.1", + "web3-utils": "1.8.1" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/web3-core-method": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/web3-core-method/-/web3-core-method-1.8.1.tgz", + "integrity": "sha512-oYGRodktfs86NrnFwaWTbv2S38JnpPslFwSSARwFv4W9cjbGUW3LDeA5MKD/dRY+ssZ5OaekeMsUCLoGhX68yA==", + "dependencies": { + "@ethersproject/transactions": "^5.6.2", + "web3-core-helpers": "1.8.1", + "web3-core-promievent": "1.8.1", + "web3-core-subscriptions": "1.8.1", + "web3-utils": "1.8.1" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/web3-core-promievent": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/web3-core-promievent/-/web3-core-promievent-1.8.1.tgz", + "integrity": "sha512-9mxqHlgB0MrZI4oUIRFkuoJMNj3E7btjrMv3sMer/Z9rYR1PfoSc1aAokw4rxKIcAh+ylVtd/acaB2HKB7aRPg==", + "dependencies": { + "eventemitter3": "4.0.4" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/web3-core-requestmanager": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/web3-core-requestmanager/-/web3-core-requestmanager-1.8.1.tgz", + "integrity": "sha512-x+VC2YPPwZ1khvqA6TA69LvfFCOZXsoUVOxmTx/vIN22PrY9KzKhxcE7pBSiGhmab1jtmRYXUbcQSVpAXqL8cw==", + "dependencies": { + "util": "^0.12.0", + "web3-core-helpers": "1.8.1", + "web3-providers-http": "1.8.1", + "web3-providers-ipc": "1.8.1", + "web3-providers-ws": "1.8.1" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/web3-core-subscriptions": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/web3-core-subscriptions/-/web3-core-subscriptions-1.8.1.tgz", + "integrity": "sha512-bmCMq5OeA3E2vZUh8Js1HcJbhwtsE+yeMqGC4oIZB3XsL5SLqyKLB/pU+qUYqQ9o4GdcrFTDPhPg1bgvf7p1Pw==", + "dependencies": { + "eventemitter3": "4.0.4", + "web3-core-helpers": "1.8.1" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/web3-eth": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/web3-eth/-/web3-eth-1.8.1.tgz", + "integrity": "sha512-LgyzbhFqiFRd8M8sBXoFN4ztzOnkeckl3H/9lH5ek7AdoRMhBg7tYpYRP3E5qkhd/q+yiZmcUgy1AF6NHrC1wg==", + "dependencies": { + "web3-core": "1.8.1", + "web3-core-helpers": "1.8.1", + "web3-core-method": "1.8.1", + "web3-core-subscriptions": "1.8.1", + "web3-eth-abi": "1.8.1", + "web3-eth-accounts": "1.8.1", + "web3-eth-contract": "1.8.1", + "web3-eth-ens": "1.8.1", + "web3-eth-iban": "1.8.1", + "web3-eth-personal": "1.8.1", + "web3-net": "1.8.1", + "web3-utils": "1.8.1" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/web3-eth-abi": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/web3-eth-abi/-/web3-eth-abi-1.8.1.tgz", + "integrity": "sha512-0mZvCRTIG0UhDhJwNQJgJxu4b4DyIpuMA0GTfqxqeuqzX4Q/ZvmoNurw0ExTfXaGPP82UUmmdkRi6FdZOx+C6w==", + "dependencies": { + "@ethersproject/abi": "^5.6.3", + "web3-utils": "1.8.1" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/web3-eth-accounts": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/web3-eth-accounts/-/web3-eth-accounts-1.8.1.tgz", + "integrity": "sha512-mgzxSYgN54/NsOFBO1Fq1KkXp1S5KlBvI/DlgvajU72rupoFMq6Cu6Yp9GUaZ/w2ij9PzEJuFJk174XwtfMCmg==", + "dependencies": { + "@ethereumjs/common": "2.5.0", + "@ethereumjs/tx": "3.3.2", + "crypto-browserify": "3.12.0", + "eth-lib": "0.2.8", + "ethereumjs-util": "^7.0.10", + "scrypt-js": "^3.0.1", + "uuid": "^9.0.0", + "web3-core": "1.8.1", + "web3-core-helpers": "1.8.1", + "web3-core-method": "1.8.1", + "web3-utils": "1.8.1" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/web3-eth-accounts/node_modules/eth-lib": { + "version": "0.2.8", + "resolved": "https://registry.npmjs.org/eth-lib/-/eth-lib-0.2.8.tgz", + "integrity": "sha512-ArJ7x1WcWOlSpzdoTBX8vkwlkSQ85CjjifSZtV4co64vWxSV8geWfPI9x4SVYu3DSxnX4yWFVTtGL+j9DUFLNw==", + "dependencies": { + "bn.js": "^4.11.6", + "elliptic": "^6.4.0", + "xhr-request-promise": "^0.1.2" + } + }, + "node_modules/web3-eth-accounts/node_modules/uuid": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.0.tgz", + "integrity": "sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==", + "bin": { + "uuid": "dist/bin/uuid" + } + }, + "node_modules/web3-eth-contract": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/web3-eth-contract/-/web3-eth-contract-1.8.1.tgz", + "integrity": "sha512-1wphnl+/xwCE2io44JKnN+ti3oa47BKRiVzvWd42icwRbcpFfRxH9QH+aQX3u8VZIISNH7dAkTWpGIIJgGFTmg==", + "dependencies": { + "@types/bn.js": "^5.1.0", + "web3-core": "1.8.1", + "web3-core-helpers": "1.8.1", + "web3-core-method": "1.8.1", + "web3-core-promievent": "1.8.1", + "web3-core-subscriptions": "1.8.1", + "web3-eth-abi": "1.8.1", + "web3-utils": "1.8.1" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/web3-eth-ens": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/web3-eth-ens/-/web3-eth-ens-1.8.1.tgz", + "integrity": "sha512-FT8xTI9uN8RxeBQa/W8pLa2aoFh4+EE34w7W2271LICKzla1dtLyb6XSdn48vsUcPmhWsTVk9mO9RTU0l4LGQQ==", + "dependencies": { + "content-hash": "^2.5.2", + "eth-ens-namehash": "2.0.8", + "web3-core": "1.8.1", + "web3-core-helpers": "1.8.1", + "web3-core-promievent": "1.8.1", + "web3-eth-abi": "1.8.1", + "web3-eth-contract": "1.8.1", + "web3-utils": "1.8.1" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/web3-eth-iban": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.8.1.tgz", + "integrity": "sha512-DomoQBfvIdtM08RyMGkMVBOH0vpOIxSSQ+jukWk/EkMLGMWJtXw/K2c2uHAeq3L/VPWNB7zXV2DUEGV/lNE2Dg==", + "dependencies": { + "bn.js": "^5.2.1", + "web3-utils": "1.8.1" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/web3-eth-iban/node_modules/bn.js": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", + "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==" + }, + "node_modules/web3-eth-personal": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/web3-eth-personal/-/web3-eth-personal-1.8.1.tgz", + "integrity": "sha512-myIYMvj7SDIoV9vE5BkVdon3pya1WinaXItugoii2VoTcQNPOtBxmYVH+XS5ErzCJlnxzphpQrkywyY64bbbCA==", + "dependencies": { + "@types/node": "^12.12.6", + "web3-core": "1.8.1", + "web3-core-helpers": "1.8.1", + "web3-core-method": "1.8.1", + "web3-net": "1.8.1", + "web3-utils": "1.8.1" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/web3-net": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/web3-net/-/web3-net-1.8.1.tgz", + "integrity": "sha512-LyEJAwogdFo0UAXZqoSJGFjopdt+kLw0P00FSZn2yszbgcoI7EwC+nXiOsEe12xz4LqpYLOtbR7+gxgiTVjjHQ==", + "dependencies": { + "web3-core": "1.8.1", + "web3-core-method": "1.8.1", + "web3-utils": "1.8.1" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/web3-providers-http": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/web3-providers-http/-/web3-providers-http-1.8.1.tgz", + "integrity": "sha512-1Zyts4O9W/UNEPkp+jyL19Jc3D15S4yp8xuLTjVhcUEAlHo24NDWEKxtZGUuHk4HrKL2gp8OlsDbJ7MM+ESDgg==", + "dependencies": { + "abortcontroller-polyfill": "^1.7.3", + "cross-fetch": "^3.1.4", + "es6-promise": "^4.2.8", + "web3-core-helpers": "1.8.1" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/web3-providers-ipc": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/web3-providers-ipc/-/web3-providers-ipc-1.8.1.tgz", + "integrity": "sha512-nw/W5nclvi+P2z2dYkLWReKLnocStflWqFl+qjtv0xn3MrUTyXMzSF0+61i77+16xFsTgzo4wS/NWIOVkR0EFA==", + "dependencies": { + "oboe": "2.1.5", + "web3-core-helpers": "1.8.1" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/web3-providers-ws": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/web3-providers-ws/-/web3-providers-ws-1.8.1.tgz", + "integrity": "sha512-TNefIDAMpdx57+YdWpYZ/xdofS0P+FfKaDYXhn24ie/tH9G+AB+UBSOKnjN0KSadcRSCMBwGPRiEmNHPavZdsA==", + "dependencies": { + "eventemitter3": "4.0.4", + "web3-core-helpers": "1.8.1", + "websocket": "^1.0.32" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/web3-shh": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/web3-shh/-/web3-shh-1.8.1.tgz", + "integrity": "sha512-sqHgarnfcY2Qt3PYS4R6YveHrDy7hmL09yeLLHHCI+RKirmjLVqV0rc5LJWUtlbYI+kDoa5gbgde489M9ZAC0g==", + "hasInstallScript": true, + "dependencies": { + "web3-core": "1.8.1", + "web3-core-method": "1.8.1", + "web3-core-subscriptions": "1.8.1", + "web3-net": "1.8.1" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/web3-utils": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.8.1.tgz", + "integrity": "sha512-LgnM9p6V7rHHUGfpMZod+NST8cRfGzJ1BTXAyNo7A9cJX9LczBfSRxJp+U/GInYe9mby40t3v22AJdlELibnsQ==", + "dependencies": { + "bn.js": "^5.2.1", + "ethereum-bloom-filters": "^1.0.6", + "ethereumjs-util": "^7.1.0", + "ethjs-unit": "0.1.6", + "number-to-bn": "1.7.0", + "randombytes": "^2.1.0", + "utf8": "3.0.0" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/web3-utils/node_modules/bn.js": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", + "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==" + }, + "node_modules/webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" + }, + "node_modules/websocket": { + "version": "1.0.34", + "resolved": "https://registry.npmjs.org/websocket/-/websocket-1.0.34.tgz", + "integrity": "sha512-PRDso2sGwF6kM75QykIesBijKSVceR6jL2G8NGYyq2XrItNC2P5/qL5XeR056GhA+Ly7JMFvJb9I312mJfmqnQ==", + "dependencies": { + "bufferutil": "^4.0.1", + "debug": "^2.2.0", + "es5-ext": "^0.10.50", + "typedarray-to-buffer": "^3.1.5", + "utf-8-validate": "^5.0.2", + "yaeti": "^0.0.6" + }, + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/which-typed-array": { + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.9.tgz", + "integrity": "sha512-w9c4xkx6mPidwp7180ckYWfMmvxpjlZuIudNtDf4N/tTAUB8VJbX25qZoAsrtGuYNnGw3pa0AXgbGKRB8/EceA==", + "dependencies": { + "available-typed-arrays": "^1.0.5", + "call-bind": "^1.0.2", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "has-tostringtag": "^1.0.0", + "is-typed-array": "^1.1.10" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/wide-align": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", + "integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==", + "dependencies": { + "string-width": "^1.0.2 || 2" + } + }, + "node_modules/workerpool": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.1.0.tgz", + "integrity": "sha512-toV7q9rWNYha963Pl/qyeZ6wG+3nnsyvolaNUS8+R5Wtw6qJPTxIlOP1ZSvcGhEJw+l3HMMmtiNo9Gl61G4GVg==" + }, + "node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrap-ansi/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" + }, + "node_modules/ws": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/ws/-/ws-3.3.3.tgz", + "integrity": "sha512-nnWLa/NwZSt4KQJu51MYlCcSQ5g7INpOrOMt4XV8j4dqTXdmlUmSHQ8/oLC069ckre0fRsgfvsKwbTdtKLCDkA==", + "dependencies": { + "async-limiter": "~1.0.0", + "safe-buffer": "~5.1.0", + "ultron": "~1.1.0" + } + }, + "node_modules/ws/node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "node_modules/xhr": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/xhr/-/xhr-2.6.0.tgz", + "integrity": "sha512-/eCGLb5rxjx5e3mF1A7s+pLlR6CGyqWN91fv1JgER5mVWg1MZmlhBvy9kjcsOdRk8RrIujotWyJamfyrp+WIcA==", + "dependencies": { + "global": "~4.4.0", + "is-function": "^1.0.1", + "parse-headers": "^2.0.0", + "xtend": "^4.0.0" + } + }, + "node_modules/xhr-request": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/xhr-request/-/xhr-request-1.1.0.tgz", + "integrity": "sha512-Y7qzEaR3FDtL3fP30k9wO/e+FBnBByZeybKOhASsGP30NIkRAAkKD/sCnLvgEfAIEC1rcmK7YG8f4oEnIrrWzA==", + "dependencies": { + "buffer-to-arraybuffer": "^0.0.5", + "object-assign": "^4.1.1", + "query-string": "^5.0.1", + "simple-get": "^2.7.0", + "timed-out": "^4.0.1", + "url-set-query": "^1.0.0", + "xhr": "^2.0.4" + } + }, + "node_modules/xhr-request-promise": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/xhr-request-promise/-/xhr-request-promise-0.1.3.tgz", + "integrity": "sha512-YUBytBsuwgitWtdRzXDDkWAXzhdGB8bYm0sSzMPZT7Z2MBjMSTHFsyCT1yCRATY+XC69DUrQraRAEgcoCRaIPg==", + "dependencies": { + "xhr-request": "^1.1.0" + } + }, + "node_modules/xtend": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", + "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", + "engines": { + "node": ">=0.4" + } + }, + "node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "engines": { + "node": ">=10" + } + }, + "node_modules/yaeti": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/yaeti/-/yaeti-0.0.6.tgz", + "integrity": "sha512-MvQa//+KcZCUkBTIC9blM+CU9J2GzuTytsOUwf2lidtvkx/6gnEp1QvJv34t9vdjhFmha/mUiNDbN0D0mJWdug==", + "engines": { + "node": ">=0.10.32" + } + }, + "node_modules/yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==" + }, + "node_modules/yargs": { + "version": "16.2.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", + "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", + "dependencies": { + "cliui": "^7.0.2", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.0", + "y18n": "^5.0.5", + "yargs-parser": "^20.2.2" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/yargs-parser": { + "version": "20.2.4", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.4.tgz", + "integrity": "sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==", + "engines": { + "node": ">=10" + } + }, + "node_modules/yargs-unparser": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-2.0.0.tgz", + "integrity": "sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==", + "dependencies": { + "camelcase": "^6.0.0", + "decamelize": "^4.0.0", + "flat": "^5.0.2", + "is-plain-obj": "^2.1.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/yargs/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "engines": { + "node": ">=8" + } + }, + "node_modules/yargs/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "engines": { + "node": ">=8" + } + }, + "node_modules/yargs/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/yargs/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/yn": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", + "engines": { + "node": ">=6" + } + }, + "node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + } + }, + "dependencies": { + "@cspotcode/source-map-support": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", + "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", + "requires": { + "@jridgewell/trace-mapping": "0.3.9" + } + }, + "@ethereumjs/common": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/@ethereumjs/common/-/common-2.5.0.tgz", + "integrity": "sha512-DEHjW6e38o+JmB/NO3GZBpW4lpaiBpkFgXF6jLcJ6gETBYpEyaA5nTimsWBUJR3Vmtm/didUEbNjajskugZORg==", + "requires": { + "crc-32": "^1.2.0", + "ethereumjs-util": "^7.1.1" + } + }, + "@ethereumjs/tx": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/@ethereumjs/tx/-/tx-3.3.2.tgz", + "integrity": "sha512-6AaJhwg4ucmwTvw/1qLaZUX5miWrwZ4nLOUsKyb/HtzS3BMw/CasKhdi1ims9mBKeK9sOJCH4qGKOBGyJCeeog==", + "requires": { + "@ethereumjs/common": "^2.5.0", + "ethereumjs-util": "^7.1.2" + } + }, + "@ethersproject/abi": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/abi/-/abi-5.7.0.tgz", + "integrity": "sha512-351ktp42TiRcYB3H1OP8yajPeAQstMW/yCFokj/AthP9bLHzQFPlOrxOcwYEDkUAICmOHljvN4K39OMTMUa9RA==", + "requires": { + "@ethersproject/address": "^5.7.0", + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/constants": "^5.7.0", + "@ethersproject/hash": "^5.7.0", + "@ethersproject/keccak256": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/strings": "^5.7.0" + } + }, + "@ethersproject/abstract-provider": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/abstract-provider/-/abstract-provider-5.7.0.tgz", + "integrity": "sha512-R41c9UkchKCpAqStMYUpdunjo3pkEvZC3FAwZn5S5MGbXoMQOHIdHItezTETxAO5bevtMApSyEhn9+CHcDsWBw==", + "requires": { + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/networks": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/transactions": "^5.7.0", + "@ethersproject/web": "^5.7.0" + } + }, + "@ethersproject/abstract-signer": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/abstract-signer/-/abstract-signer-5.7.0.tgz", + "integrity": "sha512-a16V8bq1/Cz+TGCkE2OPMTOUDLS3grCpdjoJCYNnVBbdYEMSgKrU0+B90s8b6H+ByYTBZN7a3g76jdIJi7UfKQ==", + "requires": { + "@ethersproject/abstract-provider": "^5.7.0", + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0" + } + }, + "@ethersproject/address": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/address/-/address-5.7.0.tgz", + "integrity": "sha512-9wYhYt7aghVGo758POM5nqcOMaE168Q6aRLJZwUmiqSrAungkG74gSSeKEIR7ukixesdRZGPgVqme6vmxs1fkA==", + "requires": { + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/keccak256": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/rlp": "^5.7.0" + } + }, + "@ethersproject/base64": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/base64/-/base64-5.7.0.tgz", + "integrity": "sha512-Dr8tcHt2mEbsZr/mwTPIQAf3Ai0Bks/7gTw9dSqk1mQvhW3XvRlmDJr/4n+wg1JmCl16NZue17CDh8xb/vZ0sQ==", + "requires": { + "@ethersproject/bytes": "^5.7.0" + } + }, + "@ethersproject/bignumber": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/bignumber/-/bignumber-5.7.0.tgz", + "integrity": "sha512-n1CAdIHRWjSucQO3MC1zPSVgV/6dy/fjL9pMrPP9peL+QxEg9wOsVqwD4+818B6LUEtaXzVHQiuivzRoxPxUGw==", + "requires": { + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "bn.js": "^5.2.1" + }, + "dependencies": { + "bn.js": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", + "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==" + } + } + }, + "@ethersproject/bytes": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/bytes/-/bytes-5.7.0.tgz", + "integrity": "sha512-nsbxwgFXWh9NyYWo+U8atvmMsSdKJprTcICAkvbBffT75qDocbuggBU0SJiVK2MuTrp0q+xvLkTnGMPK1+uA9A==", + "requires": { + "@ethersproject/logger": "^5.7.0" + } + }, + "@ethersproject/constants": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/constants/-/constants-5.7.0.tgz", + "integrity": "sha512-DHI+y5dBNvkpYUMiRQyxRBYBefZkJfo70VUkUAsRjcPs47muV9evftfZ0PJVCXYbAiCgght0DtcF9srFQmIgWA==", + "requires": { + "@ethersproject/bignumber": "^5.7.0" + } + }, + "@ethersproject/hash": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/hash/-/hash-5.7.0.tgz", + "integrity": "sha512-qX5WrQfnah1EFnO5zJv1v46a8HW0+E5xuBBDTwMFZLuVTx0tbU2kkx15NqdjxecrLGatQN9FGQKpb1FKdHCt+g==", + "requires": { + "@ethersproject/abstract-signer": "^5.7.0", + "@ethersproject/address": "^5.7.0", + "@ethersproject/base64": "^5.7.0", + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/keccak256": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/strings": "^5.7.0" + } + }, + "@ethersproject/keccak256": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/keccak256/-/keccak256-5.7.0.tgz", + "integrity": "sha512-2UcPboeL/iW+pSg6vZ6ydF8tCnv3Iu/8tUmLLzWWGzxWKFFqOBQFLo6uLUv6BDrLgCDfN28RJ/wtByx+jZ4KBg==", + "requires": { + "@ethersproject/bytes": "^5.7.0", + "js-sha3": "0.8.0" + } + }, + "@ethersproject/logger": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/logger/-/logger-5.7.0.tgz", + "integrity": "sha512-0odtFdXu/XHtjQXJYA3u9G0G8btm0ND5Cu8M7i5vhEcE8/HmF4Lbdqanwyv4uQTr2tx6b7fQRmgLrsnpQlmnig==" + }, + "@ethersproject/networks": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/@ethersproject/networks/-/networks-5.7.1.tgz", + "integrity": "sha512-n/MufjFYv3yFcUyfhnXotyDlNdFb7onmkSy8aQERi2PjNcnWQ66xXxa3XlS8nCcA8aJKJjIIMNJTC7tu80GwpQ==", + "requires": { + "@ethersproject/logger": "^5.7.0" + } + }, + "@ethersproject/properties": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/properties/-/properties-5.7.0.tgz", + "integrity": "sha512-J87jy8suntrAkIZtecpxEPxY//szqr1mlBaYlQ0r4RCaiD2hjheqF9s1LVE8vVuJCXisjIP+JgtK/Do54ej4Sw==", + "requires": { + "@ethersproject/logger": "^5.7.0" + } + }, + "@ethersproject/rlp": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/rlp/-/rlp-5.7.0.tgz", + "integrity": "sha512-rBxzX2vK8mVF7b0Tol44t5Tb8gomOHkj5guL+HhzQ1yBh/ydjGnpw6at+X6Iw0Kp3OzzzkcKp8N9r0W4kYSs9w==", + "requires": { + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0" + } + }, + "@ethersproject/signing-key": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/signing-key/-/signing-key-5.7.0.tgz", + "integrity": "sha512-MZdy2nL3wO0u7gkB4nA/pEf8lu1TlFswPNmy8AiYkfKTdO6eXBJyUdmHO/ehm/htHw9K/qF8ujnTyUAD+Ry54Q==", + "requires": { + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "bn.js": "^5.2.1", + "elliptic": "6.5.4", + "hash.js": "1.1.7" + }, + "dependencies": { + "bn.js": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", + "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==" + } + } + }, + "@ethersproject/strings": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/strings/-/strings-5.7.0.tgz", + "integrity": "sha512-/9nu+lj0YswRNSH0NXYqrh8775XNyEdUQAuf3f+SmOrnVewcJ5SBNAjF7lpgehKi4abvNNXyf+HX86czCdJ8Mg==", + "requires": { + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/constants": "^5.7.0", + "@ethersproject/logger": "^5.7.0" + } + }, + "@ethersproject/transactions": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/transactions/-/transactions-5.7.0.tgz", + "integrity": "sha512-kmcNicCp1lp8qanMTC3RIikGgoJ80ztTyvtsFvCYpSCfkjhD0jZ2LOrnbcuxuToLIUYYf+4XwD1rP+B/erDIhQ==", + "requires": { + "@ethersproject/address": "^5.7.0", + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/constants": "^5.7.0", + "@ethersproject/keccak256": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/rlp": "^5.7.0", + "@ethersproject/signing-key": "^5.7.0" + } + }, + "@ethersproject/web": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/@ethersproject/web/-/web-5.7.1.tgz", + "integrity": "sha512-Gueu8lSvyjBWL4cYsWsjh6MtMwM0+H4HvqFPZfB6dV8ctbP9zFAO73VG1cMWae0FLPCtz0peKPpZY8/ugJJX2w==", + "requires": { + "@ethersproject/base64": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/strings": "^5.7.0" + } + }, + "@jridgewell/resolve-uri": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz", + "integrity": "sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==" + }, + "@jridgewell/sourcemap-codec": { + "version": "1.4.14", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz", + "integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==" + }, + "@jridgewell/trace-mapping": { + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", + "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", + "requires": { + "@jridgewell/resolve-uri": "^3.0.3", + "@jridgewell/sourcemap-codec": "^1.4.10" + } + }, + "@sindresorhus/is": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.6.0.tgz", + "integrity": "sha512-t09vSN3MdfsyCHoFcTRCH/iUtG7OJ0CsjzB8cjAmKc/va/kIgeDI/TxsigdncE/4be734m0cvIYwNaV4i2XqAw==" + }, + "@szmarczak/http-timer": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-5.0.1.tgz", + "integrity": "sha512-+PmQX0PiAYPMeVYe237LJAYvOMYW1j2rH5YROyS3b4CTVJum34HfRvKvAzozHAQG0TnHNdUfY9nCeUyRAs//cw==", + "requires": { + "defer-to-connect": "^2.0.1" + } + }, + "@tsconfig/node10": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz", + "integrity": "sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==" + }, + "@tsconfig/node12": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", + "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==" + }, + "@tsconfig/node14": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", + "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==" + }, + "@tsconfig/node16": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.3.tgz", + "integrity": "sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ==" + }, + "@types/bn.js": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/@types/bn.js/-/bn.js-5.1.1.tgz", + "integrity": "sha512-qNrYbZqMx0uJAfKnKclPh+dTwK33KfLHYqtyODwd5HnXOjnkhc4qgn3BrK6RWyGZm5+sIFE7Q7Vz6QQtJB7w7g==", + "requires": { + "@types/node": "*" + } + }, + "@types/cacheable-request": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/@types/cacheable-request/-/cacheable-request-6.0.3.tgz", + "integrity": "sha512-IQ3EbTzGxIigb1I3qPZc1rWJnH0BmSKv5QYTalEwweFvyBDLSAe24zP0le/hyi7ecGfZVlIVAg4BZqb8WBwKqw==", + "requires": { + "@types/http-cache-semantics": "*", + "@types/keyv": "^3.1.4", + "@types/node": "*", + "@types/responselike": "^1.0.0" + } + }, + "@types/chai": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.3.4.tgz", + "integrity": "sha512-KnRanxnpfpjUTqTCXslZSEdLfXExwgNxYPdiO2WGUj8+HDjFi8R3k5RVKPeSCzLjCcshCAtVO2QBbVuAV4kTnw==" + }, + "@types/http-cache-semantics": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@types/http-cache-semantics/-/http-cache-semantics-4.0.1.tgz", + "integrity": "sha512-SZs7ekbP8CN0txVG2xVRH6EgKmEm31BOxA07vkFaETzZz1xh+cbt8BcI0slpymvwhx5dlFnQG2rTlPVQn+iRPQ==" + }, + "@types/keyv": { + "version": "3.1.4", + "resolved": "https://registry.npmjs.org/@types/keyv/-/keyv-3.1.4.tgz", + "integrity": "sha512-BQ5aZNSCpj7D6K2ksrRCTmKRLEpnPvWDiLPfoGyhZ++8YtiK9d/3DBKPJgry359X/P1PfruyYwvnvwFjuEiEIg==", + "requires": { + "@types/node": "*" + } + }, + "@types/mocha": { + "version": "9.1.1", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-9.1.1.tgz", + "integrity": "sha512-Z61JK7DKDtdKTWwLeElSEBcWGRLY8g95ic5FoQqI9CMx0ns/Ghep3B4DfcEimiKMvtamNVULVNKEsiwV3aQmXw==" + }, + "@types/node": { + "version": "12.20.55", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.55.tgz", + "integrity": "sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==" + }, + "@types/pbkdf2": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@types/pbkdf2/-/pbkdf2-3.1.0.tgz", + "integrity": "sha512-Cf63Rv7jCQ0LaL8tNXmEyqTHuIJxRdlS5vMh1mj5voN4+QFhVZnlZruezqpWYDiJ8UTzhP0VmeLXCmBk66YrMQ==", + "requires": { + "@types/node": "*" + } + }, + "@types/responselike": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@types/responselike/-/responselike-1.0.0.tgz", + "integrity": "sha512-85Y2BjiufFzaMIlvJDvTTB8Fxl2xfLo4HgmHzVBz08w4wDePCTjYw66PdrolO0kzli3yam/YCgRufyo1DdQVTA==", + "requires": { + "@types/node": "*" + } + }, + "@types/secp256k1": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/@types/secp256k1/-/secp256k1-4.0.3.tgz", + "integrity": "sha512-Da66lEIFeIz9ltsdMZcpQvmrmmoqrfju8pm1BH8WbYjZSwUgCwXLb9C+9XYogwBITnbsSaMdVPb2ekf7TV+03w==", + "requires": { + "@types/node": "*" + } + }, + "@ungap/promise-all-settled": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz", + "integrity": "sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q==" + }, + "abortcontroller-polyfill": { + "version": "1.7.5", + "resolved": "https://registry.npmjs.org/abortcontroller-polyfill/-/abortcontroller-polyfill-1.7.5.tgz", + "integrity": "sha512-JMJ5soJWP18htbbxJjG7bG6yuI6pRhgJ0scHHTfkUjf6wjP912xZWvM+A4sJK3gqd9E8fcPbDnOefbA9Th/FIQ==" + }, + "accepts": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", + "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==", + "requires": { + "mime-types": "~2.1.34", + "negotiator": "0.6.3" + } + }, + "acorn": { + "version": "8.8.2", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz", + "integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==" + }, + "acorn-walk": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", + "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==" + }, + "ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "requires": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + } + }, + "ansi-colors": { + "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-regex": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.1.tgz", + "integrity": "sha512-+O9Jct8wf++lXxxFc4hc8LsjaSq0HFzzL7cVsw8pRDIPdjKD2mT4ytDZlLuSBZ4cLKZFXIrMGO7DbQCtMJJMKw==" + }, + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "requires": { + "color-convert": "^2.0.1" + } + }, + "anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "requires": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + } + }, + "arg": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==" + }, + "argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" + }, + "array-flatten": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", + "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==" + }, + "asn1": { + "version": "0.2.6", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.6.tgz", + "integrity": "sha512-ix/FxPn0MDjeyJ7i/yoHGFt/EX6LyNbxSEhPPXODPL+KB0VPk86UYfL0lMdy+KCnv+fmvIzySwaK5COwqVbWTQ==", + "requires": { + "safer-buffer": "~2.1.0" + } + }, + "asn1.js": { + "version": "5.4.1", + "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-5.4.1.tgz", + "integrity": "sha512-+I//4cYPccV8LdmBLiX8CYvf9Sp3vQsrqu2QNXRcrbiWvcx/UdlFiqUJJzxRQxgsZmvhXhn4cSKeSmoFjVdupA==", + "requires": { + "bn.js": "^4.0.0", + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0", + "safer-buffer": "^2.1.0" + } + }, + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha512-NfJ4UzBCcQGLDlQq7nHxH+tv3kyZ0hHQqF5BO6J7tNJeP5do1llPr8dZ8zHonfhAu0PHAdMkSo+8o0wxg9lZWw==" + }, + "assertion-error": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", + "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==" + }, + "async-limiter": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.1.tgz", + "integrity": "sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ==" + }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" + }, + "available-typed-arrays": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz", + "integrity": "sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==" + }, + "aws-sign2": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", + "integrity": "sha512-08kcGqnYf/YmjoRhfxyu+CLxBjUtHLXLXX/vUfx9l2LYzG3c1m61nrpyFUZI6zeS+Li/wWMMidD9KgrqtGq3mA==" + }, + "aws4": { + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.12.0.tgz", + "integrity": "sha512-NmWvPnx0F1SfrQbYwOi7OeaNGokp9XhzNioJ/CSBs8Qa4vxug81mhJEAVZwxXuBmYB5KDRfMq/F3RR0BIU7sWg==" + }, + "balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" + }, + "base-x": { + "version": "3.0.9", + "resolved": "https://registry.npmjs.org/base-x/-/base-x-3.0.9.tgz", + "integrity": "sha512-H7JU6iBHTal1gp56aKoaa//YUxEaAOUiydvrV/pILqIHXTtqxSkATOnDA2u+jZ/61sD+L/412+7kzXRtWukhpQ==", + "requires": { + "safe-buffer": "^5.0.1" + } + }, + "base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==" + }, + "bcrypt-pbkdf": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", + "integrity": "sha512-qeFIXtP4MSoi6NLqO12WfqARWWuCKi2Rn/9hJLEmtB5yTNr9DqFWkJRCf2qShWzPeAMRnOgCrq0sg/KLv5ES9w==", + "requires": { + "tweetnacl": "^0.14.3" + } + }, + "bignumber.js": { + "version": "9.1.1", + "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.1.1.tgz", + "integrity": "sha512-pHm4LsMJ6lzgNGVfZHjMoO8sdoRhOzOH4MLmY65Jg70bpxCKu5iOHNJyfF6OyvYw7t8Fpf35RuzUyqnQsj8Vig==" + }, + "binary-extensions": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", + "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==" + }, + "blakejs": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/blakejs/-/blakejs-1.2.1.tgz", + "integrity": "sha512-QXUSXI3QVc/gJME0dBpXrag1kbzOqCjCX8/b54ntNyW6sjtoqxqRk3LTmXzaJoh71zMsDCjM+47jS7XiwN/+fQ==" + }, + "bluebird": { + "version": "3.7.2", + "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", + "integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==" + }, + "bn.js": { + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", + "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" + }, + "body-parser": { + "version": "1.20.1", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.1.tgz", + "integrity": "sha512-jWi7abTbYwajOytWCQc37VulmWiRae5RyTpaCyDcS5/lMdtwSz5lOpDE67srw/HYe35f1z3fDQw+3txg7gNtWw==", + "requires": { + "bytes": "3.1.2", + "content-type": "~1.0.4", + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "on-finished": "2.4.1", + "qs": "6.11.0", + "raw-body": "2.5.1", + "type-is": "~1.6.18", + "unpipe": "1.0.0" + } + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "requires": { + "fill-range": "^7.0.1" + } + }, + "brorand": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", + "integrity": "sha512-cKV8tMCEpQs4hK/ik71d6LrPOnpkpGBR0wzxqr68g2m/LB2GxVYQroAjMJZRVM1Y4BCjCKc3vAamxSzOY2RP+w==" + }, + "browser-stdout": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", + "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==" + }, + "browserify-aes": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz", + "integrity": "sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA==", + "requires": { + "buffer-xor": "^1.0.3", + "cipher-base": "^1.0.0", + "create-hash": "^1.1.0", + "evp_bytestokey": "^1.0.3", + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "browserify-cipher": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/browserify-cipher/-/browserify-cipher-1.0.1.tgz", + "integrity": "sha512-sPhkz0ARKbf4rRQt2hTpAHqn47X3llLkUGn+xEJzLjwY8LRs2p0v7ljvI5EyoRO/mexrNunNECisZs+gw2zz1w==", + "requires": { + "browserify-aes": "^1.0.4", + "browserify-des": "^1.0.0", + "evp_bytestokey": "^1.0.0" + } + }, + "browserify-des": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/browserify-des/-/browserify-des-1.0.2.tgz", + "integrity": "sha512-BioO1xf3hFwz4kc6iBhI3ieDFompMhrMlnDFC4/0/vd5MokpuAc3R+LYbwTA9A5Yc9pq9UYPqffKpW2ObuwX5A==", + "requires": { + "cipher-base": "^1.0.1", + "des.js": "^1.0.0", + "inherits": "^2.0.1", + "safe-buffer": "^5.1.2" + } + }, + "browserify-rsa": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/browserify-rsa/-/browserify-rsa-4.1.0.tgz", + "integrity": "sha512-AdEER0Hkspgno2aR97SAf6vi0y0k8NuOpGnVH3O99rcA5Q6sh8QxcngtHuJ6uXwnfAXNM4Gn1Gb7/MV1+Ymbog==", + "requires": { + "bn.js": "^5.0.0", + "randombytes": "^2.0.1" + }, + "dependencies": { + "bn.js": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", + "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==" + } + } + }, + "browserify-sign": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/browserify-sign/-/browserify-sign-4.2.1.tgz", + "integrity": "sha512-/vrA5fguVAKKAVTNJjgSm1tRQDHUU6DbwO9IROu/0WAzC8PKhucDSh18J0RMvVeHAn5puMd+QHC2erPRNf8lmg==", + "requires": { + "bn.js": "^5.1.1", + "browserify-rsa": "^4.0.1", + "create-hash": "^1.2.0", + "create-hmac": "^1.1.7", + "elliptic": "^6.5.3", + "inherits": "^2.0.4", + "parse-asn1": "^5.1.5", + "readable-stream": "^3.6.0", + "safe-buffer": "^5.2.0" + }, + "dependencies": { + "bn.js": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", + "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==" + } + } + }, + "bs58": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/bs58/-/bs58-4.0.1.tgz", + "integrity": "sha512-Ok3Wdf5vOIlBrgCvTq96gBkJw+JUEzdBgyaza5HLtPm7yTHkjRy8+JzNyHF7BHa0bNWOQIp3m5YF0nnFcOIKLw==", + "requires": { + "base-x": "^3.0.2" + } + }, + "bs58check": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/bs58check/-/bs58check-2.1.2.tgz", + "integrity": "sha512-0TS1jicxdU09dwJMNZtVAfzPi6Q6QeN0pM1Fkzrjn+XYHvzMKPU3pHVpva+769iNVSfIYWf7LJ6WR+BuuMf8cA==", + "requires": { + "bs58": "^4.0.0", + "create-hash": "^1.1.0", + "safe-buffer": "^5.1.2" + } + }, + "buffer": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", + "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "requires": { + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" + } + }, + "buffer-to-arraybuffer": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/buffer-to-arraybuffer/-/buffer-to-arraybuffer-0.0.5.tgz", + "integrity": "sha512-3dthu5CYiVB1DEJp61FtApNnNndTckcqe4pFcLdvHtrpG+kcyekCJKg4MRiDcFW7A6AODnXB9U4dwQiCW5kzJQ==" + }, + "buffer-xor": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/buffer-xor/-/buffer-xor-1.0.3.tgz", + "integrity": "sha512-571s0T7nZWK6vB67HI5dyUF7wXiNcfaPPPTl6zYCNApANjIvYJTg7hlud/+cJpdAhS7dVzqMLmfhfHR3rAcOjQ==" + }, + "bufferutil": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-4.0.7.tgz", + "integrity": "sha512-kukuqc39WOHtdxtw4UScxF/WVnMFVSQVKhtx3AjZJzhd0RGZZldcrfSEbVsWWe6KNH253574cq5F+wpv0G9pJw==", + "requires": { + "node-gyp-build": "^4.3.0" + } + }, + "bytes": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", + "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==" + }, + "cacheable-lookup": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/cacheable-lookup/-/cacheable-lookup-6.1.0.tgz", + "integrity": "sha512-KJ/Dmo1lDDhmW2XDPMo+9oiy/CeqosPguPCrgcVzKyZrL6pM1gU2GmPY/xo6OQPTUaA/c0kwHuywB4E6nmT9ww==" + }, + "cacheable-request": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-7.0.2.tgz", + "integrity": "sha512-pouW8/FmiPQbuGpkXQ9BAPv/Mo5xDGANgSNXzTzJ8DrKGuXOssM4wIQRjfanNRh3Yu5cfYPvcorqbhg2KIJtew==", + "requires": { + "clone-response": "^1.0.2", + "get-stream": "^5.1.0", + "http-cache-semantics": "^4.0.0", + "keyv": "^4.0.0", + "lowercase-keys": "^2.0.0", + "normalize-url": "^6.0.1", + "responselike": "^2.0.0" + }, + "dependencies": { + "get-stream": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", + "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", + "requires": { + "pump": "^3.0.0" + } + }, + "lowercase-keys": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz", + "integrity": "sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==" + } + } + }, + "call-bind": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", + "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "requires": { + "function-bind": "^1.1.1", + "get-intrinsic": "^1.0.2" + } + }, + "camelcase": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", + "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==" + }, + "caseless": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw==" + }, + "chai": { + "version": "4.3.7", + "resolved": "https://registry.npmjs.org/chai/-/chai-4.3.7.tgz", + "integrity": "sha512-HLnAzZ2iupm25PlN0xFreAlBA5zaBSv3og0DdeGA4Ar6h6rJ3A0rolRUKJhSF2V10GZKDgWF/VmAEsNWjCRB+A==", + "requires": { + "assertion-error": "^1.1.0", + "check-error": "^1.0.2", + "deep-eql": "^4.1.2", + "get-func-name": "^2.0.0", + "loupe": "^2.3.1", + "pathval": "^1.1.1", + "type-detect": "^4.0.5" + } + }, + "chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "dependencies": { + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, + "check-error": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", + "integrity": "sha512-BrgHpW9NURQgzoNyjfq0Wu6VFO6D7IZEmJNdtgNqpzGG8RuNFHt2jQxWlAs4HMe119chBnv+34syEZtc6IhLtA==" + }, + "chokidar": { + "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.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.5.0" + } + }, + "chownr": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz", + "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==" + }, + "cids": { + "version": "0.7.5", + "resolved": "https://registry.npmjs.org/cids/-/cids-0.7.5.tgz", + "integrity": "sha512-zT7mPeghoWAu+ppn8+BS1tQ5qGmbMfB4AregnQjA/qHY3GC1m1ptI9GkWNlgeu38r7CuRdXB47uY2XgAYt6QVA==", + "requires": { + "buffer": "^5.5.0", + "class-is": "^1.1.0", + "multibase": "~0.6.0", + "multicodec": "^1.0.0", + "multihashes": "~0.4.15" + }, + "dependencies": { + "multicodec": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/multicodec/-/multicodec-1.0.4.tgz", + "integrity": "sha512-NDd7FeS3QamVtbgfvu5h7fd1IlbaC4EQ0/pgU4zqE2vdHCmBGsUa0TiM8/TdSeG6BMPC92OOCf8F1ocE/Wkrrg==", + "requires": { + "buffer": "^5.6.0", + "varint": "^5.0.0" + } + } + } + }, + "cipher-base": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz", + "integrity": "sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==", + "requires": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "class-is": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/class-is/-/class-is-1.1.0.tgz", + "integrity": "sha512-rhjH9AG1fvabIDoGRVH587413LPjTZgmDF9fOFCbFJQV4yuocX1mHxxvXI4g3cGwbVY9wAYIoKlg1N79frJKQw==" + }, + "cliui": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", + "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", + "requires": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^7.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==" + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==" + }, + "string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + } + }, + "strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "requires": { + "ansi-regex": "^5.0.1" + } + } + } + }, + "clone-response": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/clone-response/-/clone-response-1.0.3.tgz", + "integrity": "sha512-ROoL94jJH2dUVML2Y/5PEDNaSHgeOdSDicUyS7izcF63G6sTc/FTjLub4b8Il9S8S0beOfYt0TaA5qvFK+w0wA==", + "requires": { + "mimic-response": "^1.0.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, + "combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "requires": { + "delayed-stream": "~1.0.0" + } + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" + }, + "content-disposition": { + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", + "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==", + "requires": { + "safe-buffer": "5.2.1" + } + }, + "content-hash": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/content-hash/-/content-hash-2.5.2.tgz", + "integrity": "sha512-FvIQKy0S1JaWV10sMsA7TRx8bpU+pqPkhbsfvOJAdjRXvYxEckAwQWGwtRjiaJfh+E0DvcWUGqcdjwMGFjsSdw==", + "requires": { + "cids": "^0.7.1", + "multicodec": "^0.5.5", + "multihashes": "^0.4.15" + } + }, + "content-type": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", + "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==" + }, + "cookie": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz", + "integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==" + }, + "cookie-signature": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", + "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==" + }, + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ==" + }, + "cors": { + "version": "2.8.5", + "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz", + "integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==", + "requires": { + "object-assign": "^4", + "vary": "^1" + } + }, + "crc-32": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/crc-32/-/crc-32-1.2.2.tgz", + "integrity": "sha512-ROmzCKrTnOwybPcJApAA6WBWij23HVfGVNKqqrZpuyZOHqK2CwHSvpGuyt/UNNvaIjEd8X5IFGp4Mh+Ie1IHJQ==" + }, + "create-ecdh": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/create-ecdh/-/create-ecdh-4.0.4.tgz", + "integrity": "sha512-mf+TCx8wWc9VpuxfP2ht0iSISLZnt0JgWlrOKZiNqyUZWnjIaCIVNQArMHnCZKfEYRg6IM7A+NeJoN8gf/Ws0A==", + "requires": { + "bn.js": "^4.1.0", + "elliptic": "^6.5.3" + } + }, + "create-hash": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz", + "integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==", + "requires": { + "cipher-base": "^1.0.1", + "inherits": "^2.0.1", + "md5.js": "^1.3.4", + "ripemd160": "^2.0.1", + "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==" + }, + "cross-fetch": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.1.5.tgz", + "integrity": "sha512-lvb1SBsI0Z7GDwmuid+mU3kWVBwTVUbe7S0H52yaaAdQOXq2YktTCZdlAcNKFzE6QtRz0snpw9bNiPeOIkkQvw==", + "requires": { + "node-fetch": "2.6.7" + } + }, + "crypto-browserify": { + "version": "3.12.0", + "resolved": "https://registry.npmjs.org/crypto-browserify/-/crypto-browserify-3.12.0.tgz", + "integrity": "sha512-fz4spIh+znjO2VjL+IdhEpRJ3YN6sMzITSBijk6FK2UvTqruSQW+/cCZTSNsMiZNvUeq0CqurF+dAbyiGOY6Wg==", + "requires": { + "browserify-cipher": "^1.0.0", + "browserify-sign": "^4.0.0", + "create-ecdh": "^4.0.0", + "create-hash": "^1.1.0", + "create-hmac": "^1.1.0", + "diffie-hellman": "^5.0.0", + "inherits": "^2.0.1", + "pbkdf2": "^3.0.3", + "public-encrypt": "^4.0.0", + "randombytes": "^2.0.0", + "randomfill": "^1.0.3" + } + }, + "d": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/d/-/d-1.0.1.tgz", + "integrity": "sha512-m62ShEObQ39CfralilEQRjH6oAMtNCV1xJyEx5LpRYUVN+EviphDgUc/F3hnYbADmkiNs67Y+3ylmlG7Lnu+FA==", + "requires": { + "es5-ext": "^0.10.50", + "type": "^1.0.1" + } + }, + "dashdash": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", + "integrity": "sha512-jRFi8UDGo6j+odZiEpjazZaWqEal3w/basFjQHQEwVtZJGDpxbH1MeYluwCS8Xq5wmLJooDlMgvVarmWfGM44g==", + "requires": { + "assert-plus": "^1.0.0" + } + }, + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "requires": { + "ms": "2.0.0" + } + }, + "decamelize": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz", + "integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==" + }, + "decode-uri-component": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.2.tgz", + "integrity": "sha512-FqUYQ+8o158GyGTrMFJms9qh3CqTKvAqgqsTnkLI8sKu0028orqBhxNMFkFen0zGyg6epACD32pjVk58ngIErQ==" + }, + "decompress-response": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz", + "integrity": "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==", + "requires": { + "mimic-response": "^3.1.0" + }, + "dependencies": { + "mimic-response": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz", + "integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==" + } + } + }, + "deep-eql": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-4.1.3.tgz", + "integrity": "sha512-WaEtAOpRA1MQ0eohqZjpGD8zdI0Ovsm8mmFhaDN8dvDZzyoUMcYDnf5Y6iu7HTXxf8JDS23qWa4a+hKCDyOPzw==", + "requires": { + "type-detect": "^4.0.0" + } + }, + "defer-to-connect": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-2.0.1.tgz", + "integrity": "sha512-4tvttepXG1VaYGrRibk5EwJd1t4udunSOVMdLSAL6mId1ix438oPwPZMALY41FCijukO1L0twNcGsdzS7dHgDg==" + }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==" + }, + "depd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==" + }, + "des.js": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/des.js/-/des.js-1.0.1.tgz", + "integrity": "sha512-Q0I4pfFrv2VPd34/vfLrFOoRmlYj3OV50i7fskps1jZWK1kApMWWT9G6RRUeYedLcBDIhnSDaUvJMb3AhUlaEA==", + "requires": { + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0" + } + }, + "destroy": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", + "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==" + }, + "diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==" + }, + "diffie-hellman": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz", + "integrity": "sha512-kqag/Nl+f3GwyK25fhUMYj81BUOrZ9IuJsjIcDE5icNM9FJHAVm3VcUDxdLPoQtTuUylWm6ZIknYJwwaPxsUzg==", + "requires": { + "bn.js": "^4.1.0", + "miller-rabin": "^4.0.0", + "randombytes": "^2.0.0" + } + }, + "dom-walk": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/dom-walk/-/dom-walk-0.1.2.tgz", + "integrity": "sha512-6QvTW9mrGeIegrFXdtQi9pk7O/nSK6lSdXW2eqUspN5LWD7UTji2Fqw5V2YLjBpHEoU9Xl/eUWNpDeZvoyOv2w==" + }, + "ecc-jsbn": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", + "integrity": "sha512-eh9O+hwRHNbG4BLTjEl3nw044CkGm5X6LoaCf7LPp7UU8Qrt47JYNi6nPX8xjW97TKGKm1ouctg0QSpZe9qrnw==", + "requires": { + "jsbn": "~0.1.0", + "safer-buffer": "^2.1.0" + } + }, + "ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==" + }, + "elliptic": { + "version": "6.5.4", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz", + "integrity": "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==", + "requires": { + "bn.js": "^4.11.9", + "brorand": "^1.1.0", + "hash.js": "^1.0.0", + "hmac-drbg": "^1.0.1", + "inherits": "^2.0.4", + "minimalistic-assert": "^1.0.1", + "minimalistic-crypto-utils": "^1.0.1" + } + }, + "emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" + }, + "encodeurl": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", + "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==" + }, + "end-of-stream": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", + "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", + "requires": { + "once": "^1.4.0" + } + }, + "es5-ext": { + "version": "0.10.62", + "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.62.tgz", + "integrity": "sha512-BHLqn0klhEpnOKSrzn/Xsz2UIW8j+cGmo9JLzr8BiUapV8hPL9+FliFqjwr9ngW7jWdnxv6eO+/LqyhJVqgrjA==", + "requires": { + "es6-iterator": "^2.0.3", + "es6-symbol": "^3.1.3", + "next-tick": "^1.1.0" + } + }, + "es6-iterator": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/es6-iterator/-/es6-iterator-2.0.3.tgz", + "integrity": "sha512-zw4SRzoUkd+cl+ZoE15A9o1oQd920Bb0iOJMQkQhl3jNc03YqVjAhG7scf9C5KWRU/R13Orf588uCC6525o02g==", + "requires": { + "d": "1", + "es5-ext": "^0.10.35", + "es6-symbol": "^3.1.1" + } + }, + "es6-promise": { + "version": "4.2.8", + "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", + "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==" + }, + "es6-symbol": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.3.tgz", + "integrity": "sha512-NJ6Yn3FuDinBaBRWl/q5X/s4koRHBrgKAu+yGI6JCBeiu3qrcbJhwT2GeR/EXVfylRk8dpQVJoLEFhK+Mu31NA==", + "requires": { + "d": "^1.0.1", + "ext": "^1.1.2" + } + }, + "escalade": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", + "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==" + }, + "escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==" + }, + "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==" + }, + "etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==" + }, + "eth-ens-namehash": { + "version": "2.0.8", + "resolved": "https://registry.npmjs.org/eth-ens-namehash/-/eth-ens-namehash-2.0.8.tgz", + "integrity": "sha512-VWEI1+KJfz4Km//dadyvBBoBeSQ0MHTXPvr8UIXiLW6IanxvAV+DmlZAijZwAyggqGUfwQBeHf7tc9wzc1piSw==", + "requires": { + "idna-uts46-hx": "^2.3.1", + "js-sha3": "^0.5.7" + }, + "dependencies": { + "js-sha3": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.5.7.tgz", + "integrity": "sha512-GII20kjaPX0zJ8wzkTbNDYMY7msuZcTWk8S5UOh6806Jq/wz1J8/bnr8uGU0DAUmYDjj2Mr4X1cW8v/GLYnR+g==" + } + } + }, + "eth-lib": { + "version": "0.1.29", + "resolved": "https://registry.npmjs.org/eth-lib/-/eth-lib-0.1.29.tgz", + "integrity": "sha512-bfttrr3/7gG4E02HoWTDUcDDslN003OlOoBxk9virpAZQ1ja/jDgwkWB8QfJF7ojuEowrqy+lzp9VcJG7/k5bQ==", + "requires": { + "bn.js": "^4.11.6", + "elliptic": "^6.4.0", + "nano-json-stream-parser": "^0.1.2", + "servify": "^0.1.12", + "ws": "^3.0.0", + "xhr-request-promise": "^0.1.2" + } + }, + "ethereum-bloom-filters": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/ethereum-bloom-filters/-/ethereum-bloom-filters-1.0.10.tgz", + "integrity": "sha512-rxJ5OFN3RwjQxDcFP2Z5+Q9ho4eIdEmSc2ht0fCu8Se9nbXjZ7/031uXoUYJ87KHCOdVeiUuwSnoS7hmYAGVHA==", + "requires": { + "js-sha3": "^0.8.0" + } + }, + "ethereum-cryptography": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-0.1.3.tgz", + "integrity": "sha512-w8/4x1SGGzc+tO97TASLja6SLd3fRIK2tLVcV2Gx4IB21hE19atll5Cq9o3d0ZmAYC/8aw0ipieTSiekAea4SQ==", + "requires": { + "@types/pbkdf2": "^3.0.0", + "@types/secp256k1": "^4.0.1", + "blakejs": "^1.1.0", + "browserify-aes": "^1.2.0", + "bs58check": "^2.1.2", + "create-hash": "^1.2.0", + "create-hmac": "^1.1.7", + "hash.js": "^1.1.7", + "keccak": "^3.0.0", + "pbkdf2": "^3.0.17", + "randombytes": "^2.1.0", + "safe-buffer": "^5.1.2", + "scrypt-js": "^3.0.0", + "secp256k1": "^4.0.1", + "setimmediate": "^1.0.5" + } + }, + "ethereumjs-util": { + "version": "7.1.5", + "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-7.1.5.tgz", + "integrity": "sha512-SDl5kKrQAudFBUe5OJM9Ac6WmMyYmXX/6sTmLZ3ffG2eY6ZIGBes3pEDxNN6V72WyOw4CPD5RomKdsa8DAAwLg==", + "requires": { + "@types/bn.js": "^5.1.0", + "bn.js": "^5.1.2", + "create-hash": "^1.1.2", + "ethereum-cryptography": "^0.1.3", + "rlp": "^2.2.4" + }, + "dependencies": { + "bn.js": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", + "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==" + } + } + }, + "ethjs-unit": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/ethjs-unit/-/ethjs-unit-0.1.6.tgz", + "integrity": "sha512-/Sn9Y0oKl0uqQuvgFk/zQgR7aw1g36qX/jzSQ5lSwlO0GigPymk4eGQfeNTD03w1dPOqfz8V77Cy43jH56pagw==", + "requires": { + "bn.js": "4.11.6", + "number-to-bn": "1.7.0" + }, + "dependencies": { + "bn.js": { + "version": "4.11.6", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.6.tgz", + "integrity": "sha512-XWwnNNFCuuSQ0m3r3C4LE3EiORltHd9M05pq6FOlVeiophzRbMo50Sbz1ehl8K3Z+jw9+vmgnXefY1hz8X+2wA==" + } + } + }, + "eventemitter3": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.4.tgz", + "integrity": "sha512-rlaVLnVxtxvoyLsQQFBx53YmXHDxRIzzTLbdfxqi4yocpSjAxXwkU0cScM5JgSKMqEhrZpnvQ2D9gjylR0AimQ==" + }, + "evp_bytestokey": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz", + "integrity": "sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA==", + "requires": { + "md5.js": "^1.3.4", + "safe-buffer": "^5.1.1" + } + }, + "express": { + "version": "4.18.2", + "resolved": "https://registry.npmjs.org/express/-/express-4.18.2.tgz", + "integrity": "sha512-5/PsL6iGPdfQ/lKM1UuielYgv3BUoJfz1aUwU9vHZ+J7gyvwdQXFEBIEIaxeGf0GIcreATNyBExtalisDbuMqQ==", + "requires": { + "accepts": "~1.3.8", + "array-flatten": "1.1.1", + "body-parser": "1.20.1", + "content-disposition": "0.5.4", + "content-type": "~1.0.4", + "cookie": "0.5.0", + "cookie-signature": "1.0.6", + "debug": "2.6.9", + "depd": "2.0.0", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "finalhandler": "1.2.0", + "fresh": "0.5.2", + "http-errors": "2.0.0", + "merge-descriptors": "1.0.1", + "methods": "~1.1.2", + "on-finished": "2.4.1", + "parseurl": "~1.3.3", + "path-to-regexp": "0.1.7", + "proxy-addr": "~2.0.7", + "qs": "6.11.0", + "range-parser": "~1.2.1", + "safe-buffer": "5.2.1", + "send": "0.18.0", + "serve-static": "1.15.0", + "setprototypeof": "1.2.0", + "statuses": "2.0.1", + "type-is": "~1.6.18", + "utils-merge": "1.0.1", + "vary": "~1.1.2" + } + }, + "ext": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/ext/-/ext-1.7.0.tgz", + "integrity": "sha512-6hxeJYaL110a9b5TEJSj0gojyHQAmA2ch5Os+ySCiA1QGdS697XWY1pzsrSjqA9LDEEgdB/KypIlR59RcLuHYw==", + "requires": { + "type": "^2.7.2" + }, + "dependencies": { + "type": { + "version": "2.7.2", + "resolved": "https://registry.npmjs.org/type/-/type-2.7.2.tgz", + "integrity": "sha512-dzlvlNlt6AXU7EBSfpAscydQ7gXB+pPGsPnfJnZpiNJBDj7IaJzQlBZYGdEi4R9HmPdBv2XmWJ6YUtoTa7lmCw==" + } + } + }, + "extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" + }, + "extsprintf": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", + "integrity": "sha512-11Ndz7Nv+mvAC1j0ktTa7fAb0vLyGGX+rMHNBYQviQDGU0Hw7lhctJANqbPhu9nV9/izT/IntTgZ7Im/9LJs9g==" + }, + "fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" + }, + "fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" + }, + "fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "requires": { + "to-regex-range": "^5.0.1" + } + }, + "finalhandler": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz", + "integrity": "sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg==", + "requires": { + "debug": "2.6.9", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "on-finished": "2.4.1", + "parseurl": "~1.3.3", + "statuses": "2.0.1", + "unpipe": "~1.0.0" + } + }, + "find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "requires": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + } + }, + "flat": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", + "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==" + }, + "for-each": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", + "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", + "requires": { + "is-callable": "^1.1.3" + } + }, + "forever-agent": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", + "integrity": "sha512-j0KLYPhm6zeac4lz3oJ3o65qvgQCcPubiyotZrXqEaG4hNagNYO8qdlUrX5vwqv9ohqeT/Z3j6+yW067yWWdUw==" + }, + "form-data": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", + "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.6", + "mime-types": "^2.1.12" + } + }, + "form-data-encoder": { + "version": "1.7.1", + "resolved": "https://registry.npmjs.org/form-data-encoder/-/form-data-encoder-1.7.1.tgz", + "integrity": "sha512-EFRDrsMm/kyqbTQocNvRXMLjc7Es2Vk+IQFx/YW7hkUH1eBl4J1fqiP34l74Yt0pFLCNpc06fkbVk00008mzjg==" + }, + "forwarded": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", + "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==" + }, + "fresh": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", + "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==" + }, + "fs-extra": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-4.0.3.tgz", + "integrity": "sha512-q6rbdDd1o2mAnQreO7YADIxf/Whx4AHBiRf6d+/cVT8h44ss+lHgxf1FemcqDnQt9X3ct4McHr+JMGlYSsK7Cg==", + "requires": { + "graceful-fs": "^4.1.2", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + } + }, + "fs-minipass": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-1.2.7.tgz", + "integrity": "sha512-GWSSJGFy4e9GUeCcbIkED+bgAoFyj7XF1mV8rma3QW4NIqX9Kyx79N/PF61H5udOV3aY1IaMLs6pGbH71nlCTA==", + "requires": { + "minipass": "^2.6.0" + } + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" + }, + "fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "optional": true + }, + "function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" + }, + "get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==" + }, + "get-func-name": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", + "integrity": "sha512-Hm0ixYtaSZ/V7C8FJrtZIuBBI+iSgL+1Aq82zSu8VQNB4S3Gk8e7Qs3VwBDJAhmRZcFqkl3tQu36g/Foh5I5ig==" + }, + "get-intrinsic": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.0.tgz", + "integrity": "sha512-L049y6nFOuom5wGyRc3/gdTLO94dySVKRACj1RmJZBQXlbTMhtNIgkWkUHq+jYmZvKf14EW1EoJnnjbmoHij0Q==", + "requires": { + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.3" + } + }, + "get-stream": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", + "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==" + }, + "getpass": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", + "integrity": "sha512-0fzj9JxOLfJ+XGLhR8ze3unN0KZCgZwiSSDz168VERjK8Wl8kVSdcu2kspd4s4wtAa1y/qrVRiAA0WclVsu0ng==", + "requires": { + "assert-plus": "^1.0.0" + } + }, + "glob": { + "version": "7.1.6", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", + "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "requires": { + "is-glob": "^4.0.1" + } + }, + "global": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/global/-/global-4.4.0.tgz", + "integrity": "sha512-wv/LAoHdRE3BeTGz53FAamhGlPLhlssK45usmGFThIi4XqnBmjKQ16u+RNbP7WvigRZDxUsM0J3gcQ5yicaL0w==", + "requires": { + "min-document": "^2.19.0", + "process": "^0.11.10" + } + }, + "gopd": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", + "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", + "requires": { + "get-intrinsic": "^1.1.3" + } + }, + "got": { + "version": "12.1.0", + "resolved": "https://registry.npmjs.org/got/-/got-12.1.0.tgz", + "integrity": "sha512-hBv2ty9QN2RdbJJMK3hesmSkFTjVIHyIDDbssCKnSmq62edGgImJWD10Eb1k77TiV1bxloxqcFAVK8+9pkhOig==", + "requires": { + "@sindresorhus/is": "^4.6.0", + "@szmarczak/http-timer": "^5.0.1", + "@types/cacheable-request": "^6.0.2", + "@types/responselike": "^1.0.0", + "cacheable-lookup": "^6.0.4", + "cacheable-request": "^7.0.2", + "decompress-response": "^6.0.0", + "form-data-encoder": "1.7.1", + "get-stream": "^6.0.1", + "http2-wrapper": "^2.1.10", + "lowercase-keys": "^3.0.0", + "p-cancelable": "^3.0.0", + "responselike": "^2.0.0" + } + }, + "graceful-fs": { + "version": "4.2.10", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", + "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==" + }, + "growl": { + "version": "1.10.5", + "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", + "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==" + }, + "har-schema": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", + "integrity": "sha512-Oqluz6zhGX8cyRaTQlFMPw80bSJVG2x/cFb8ZPhUILGgHka9SsokCCOQgpveePerqidZOrT14ipqfJb7ILcW5Q==" + }, + "har-validator": { + "version": "5.1.5", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.5.tgz", + "integrity": "sha512-nmT2T0lljbxdQZfspsno9hgrG3Uir6Ks5afism62poxqBM6sDnMEuPmzTq8XN0OEwqKLLdh1jQI3qyE66Nzb3w==", + "requires": { + "ajv": "^6.12.3", + "har-schema": "^2.0.0" + } + }, + "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", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==" + }, + "has-symbols": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", + "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==" + }, + "has-tostringtag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.0.tgz", + "integrity": "sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==", + "requires": { + "has-symbols": "^1.0.2" + } + }, + "hash-base": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.1.0.tgz", + "integrity": "sha512-1nmYp/rhMDiE7AYkDw+lLwlAzz0AntGIe51F3RfFfEqyQ3feY2eI/NcwC6umIQVOASPMsWJLJScWKSSvzL9IVA==", + "requires": { + "inherits": "^2.0.4", + "readable-stream": "^3.6.0", + "safe-buffer": "^5.2.0" + } + }, + "hash.js": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", + "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==", + "requires": { + "inherits": "^2.0.3", + "minimalistic-assert": "^1.0.1" + } + }, + "he": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", + "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==" + }, + "hmac-drbg": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", + "integrity": "sha512-Tti3gMqLdZfhOQY1Mzf/AanLiqh1WTiJgEj26ZuYQ9fbkLomzGchCws4FyrSd4VkpBfiNhaE1On+lOz894jvXg==", + "requires": { + "hash.js": "^1.0.3", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.1" + } + }, + "http-cache-semantics": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.1.tgz", + "integrity": "sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ==" + }, + "http-errors": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", + "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==", + "requires": { + "depd": "2.0.0", + "inherits": "2.0.4", + "setprototypeof": "1.2.0", + "statuses": "2.0.1", + "toidentifier": "1.0.1" + } + }, + "http-https": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/http-https/-/http-https-1.0.0.tgz", + "integrity": "sha512-o0PWwVCSp3O0wS6FvNr6xfBCHgt0m1tvPLFOCc2iFDKTRAXhB7m8klDf7ErowFH8POa6dVdGatKU5I1YYwzUyg==" + }, + "http-signature": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", + "integrity": "sha512-CAbnr6Rz4CYQkLYUtSNXxQPUH2gK8f3iWexVlsnMeD+GjlsQ0Xsy1cOX+mN3dtxYomRy21CiOzU8Uhw6OwncEQ==", + "requires": { + "assert-plus": "^1.0.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" + } + }, + "http2-wrapper": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/http2-wrapper/-/http2-wrapper-2.2.0.tgz", + "integrity": "sha512-kZB0wxMo0sh1PehyjJUWRFEd99KC5TLjZ2cULC4f9iqJBAmKQQXEICjxl5iPJRwP40dpeHFqqhm7tYCvODpqpQ==", + "requires": { + "quick-lru": "^5.1.1", + "resolve-alpn": "^1.2.0" + } + }, + "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" + } + }, + "idna-uts46-hx": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/idna-uts46-hx/-/idna-uts46-hx-2.3.1.tgz", + "integrity": "sha512-PWoF9Keq6laYdIRwwCdhTPl60xRqAloYNMQLiyUnG42VjT53oW07BXIRM+NK7eQjzXjAk2gUvX9caRxlnF9TAA==", + "requires": { + "punycode": "2.1.0" + }, + "dependencies": { + "punycode": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.0.tgz", + "integrity": "sha512-Yxz2kRwT90aPiWEMHVYnEf4+rhwF1tBmmZ4KepCP+Wkium9JxtWnUm1nqGwpiAHr/tnTSeHqr3wb++jgSkXjhA==" + } + } + }, + "ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==" + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "ipaddr.js": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", + "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==" + }, + "is-arguments": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.1.tgz", + "integrity": "sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA==", + "requires": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + } + }, + "is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "requires": { + "binary-extensions": "^2.0.0" + } + }, + "is-callable": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", + "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==" + }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==" + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha512-VHskAKYM8RfSFXwee5t5cbN5PZeq1Wrh6qd5bkyiXIf6UQcN6w/A0eXM9r6t8d+GYOh+o6ZhiEnb88LN/Y8m2w==" + }, + "is-function": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-function/-/is-function-1.0.2.tgz", + "integrity": "sha512-lw7DUp0aWXYg+CBCN+JKkcE0Q2RayZnSvnZBlwgxHBQhqt5pZNVy4Ri7H9GmmXkdu7LUthszM+Tor1u/2iBcpQ==" + }, + "is-generator-function": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.0.10.tgz", + "integrity": "sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A==", + "requires": { + "has-tostringtag": "^1.0.0" + } + }, + "is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "requires": { + "is-extglob": "^2.1.1" + } + }, + "is-hex-prefixed": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-hex-prefixed/-/is-hex-prefixed-1.0.0.tgz", + "integrity": "sha512-WvtOiug1VFrE9v1Cydwm+FnXd3+w9GaeVUss5W4v/SLy3UW00vP+6iNF2SdnfiBoLy4bTqVdkftNGTUeOFVsbA==" + }, + "is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==" + }, + "is-plain-obj": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz", + "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==" + }, + "is-typed-array": { + "version": "1.1.10", + "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.10.tgz", + "integrity": "sha512-PJqgEHiWZvMpaFZ3uTc8kHPM4+4ADTlDniuQL7cU/UDA0Ql7F70yGfHph3cLNe+c9toaigv+DFzTJKhc2CtO6A==", + "requires": { + "available-typed-arrays": "^1.0.5", + "call-bind": "^1.0.2", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "has-tostringtag": "^1.0.0" + } + }, + "is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA==" + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==" + }, + "isstream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha512-Yljz7ffyPbrLpLngrMtZ7NduUgVvi6wG9RJ9IUcyCd59YQ911PBJphODUcbOVbqYfxe1wuYf/LJ8PauMRwsM/g==" + }, + "js-sha3": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.8.0.tgz", + "integrity": "sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q==" + }, + "js-yaml": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.0.0.tgz", + "integrity": "sha512-pqon0s+4ScYUvX30wxQi3PogGFAlUyH0awepWvwkj4jD4v+ova3RiYw8bmA6x2rDrEaj8i/oWKoRxpVNW+Re8Q==", + "requires": { + "argparse": "^2.0.1" + } + }, + "jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", + "integrity": "sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg==" + }, + "json-buffer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", + "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==" + }, + "json-schema": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.4.0.tgz", + "integrity": "sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA==" + }, + "json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" + }, + "json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==" + }, + "jsonfile": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", + "integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==", + "requires": { + "graceful-fs": "^4.1.6" + } + }, + "jsprim": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.2.tgz", + "integrity": "sha512-P2bSOMAc/ciLz6DzgjVlGJP9+BrJWu5UDGK70C2iweC5QBIeFf0ZXRvGjEj2uYgrY2MkAAhsSWHDWlFtEroZWw==", + "requires": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.4.0", + "verror": "1.10.0" + } + }, + "keccak": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/keccak/-/keccak-3.0.3.tgz", + "integrity": "sha512-JZrLIAJWuZxKbCilMpNz5Vj7Vtb4scDG3dMXLOsbzBmQGyjwE61BbW7bJkfKKCShXiQZt3T6sBgALRtmd+nZaQ==", + "requires": { + "node-addon-api": "^2.0.0", + "node-gyp-build": "^4.2.0", + "readable-stream": "^3.6.0" + } + }, + "keyv": { + "version": "4.5.2", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.2.tgz", + "integrity": "sha512-5MHbFaKn8cNSmVW7BYnijeAVlE4cYA/SVkifVgrh7yotnfhKmjuXpDKjrABLnT0SfHWV21P8ow07OGfRrNDg8g==", + "requires": { + "json-buffer": "3.0.1" + } + }, + "locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "requires": { + "p-locate": "^5.0.0" + } + }, + "log-symbols": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.0.0.tgz", + "integrity": "sha512-FN8JBzLx6CzeMrB0tg6pqlGU1wCrXW+ZXGH481kfsBqer0hToTIiHdjH4Mq8xJUbvATujKCvaREGWpGUionraA==", + "requires": { + "chalk": "^4.0.0" + } + }, + "loupe": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/loupe/-/loupe-2.3.6.tgz", + "integrity": "sha512-RaPMZKiMy8/JruncMU5Bt6na1eftNoo++R4Y+N2FrxkDVTrGvcyzFTsaGif4QTeKESheMGegbhw6iUAq+5A8zA==", + "requires": { + "get-func-name": "^2.0.0" + } + }, + "lowercase-keys": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-3.0.0.tgz", + "integrity": "sha512-ozCC6gdQ+glXOQsveKD0YsDy8DSQFjDTz4zyzEHNV5+JP5D62LmfDZ6o1cycFx9ouG940M5dE8C8CTewdj2YWQ==" + }, + "make-error": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==" + }, + "md5.js": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz", + "integrity": "sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg==", + "requires": { + "hash-base": "^3.0.0", + "inherits": "^2.0.1", + "safe-buffer": "^5.1.2" + } + }, + "media-typer": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==" + }, + "merge-descriptors": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", + "integrity": "sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w==" + }, + "methods": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", + "integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==" + }, + "miller-rabin": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/miller-rabin/-/miller-rabin-4.0.1.tgz", + "integrity": "sha512-115fLhvZVqWwHPbClyntxEVfVDfl9DLLTuJvq3g2O/Oxi8AiNouAHvDSzHS0viUJc+V5vm3eq91Xwqn9dp4jRA==", + "requires": { + "bn.js": "^4.0.0", + "brorand": "^1.0.1" + } + }, + "mime": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", + "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==" + }, + "mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==" + }, + "mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "requires": { + "mime-db": "1.52.0" + } + }, + "mimic-response": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", + "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==" + }, + "min-document": { + "version": "2.19.0", + "resolved": "https://registry.npmjs.org/min-document/-/min-document-2.19.0.tgz", + "integrity": "sha512-9Wy1B3m3f66bPPmU5hdA4DR4PB2OfDU/+GS3yAB7IQozE3tqXaVv2zOjgla7MEGSRv95+ILmOuvhLkOK6wJtCQ==", + "requires": { + "dom-walk": "^0.1.0" + } + }, + "minimalistic-assert": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", + "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==" + }, + "minimalistic-crypto-utils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", + "integrity": "sha512-JIYlbt6g8i5jKfJ3xz7rF0LXmv2TkDxBLUkiBeZ7bAx4GnnNMr8xFpGnOxn6GhTEHx3SjRrZEoU+j04prX1ktg==" + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "minimist": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.7.tgz", + "integrity": "sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g==" + }, + "minipass": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-2.9.0.tgz", + "integrity": "sha512-wxfUjg9WebH+CUDX/CdbRlh5SmfZiy/hpkxaRI16Y9W56Pa75sWgd/rvFilSgrauD9NyFymP/+JFV3KwzIsJeg==", + "requires": { + "safe-buffer": "^5.1.2", + "yallist": "^3.0.0" + } + }, + "minizlib": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-1.3.3.tgz", + "integrity": "sha512-6ZYMOEnmVsdCeTJVE0W9ZD+pVnE8h9Hma/iOwwRDsdQoePpoX56/8B6z3P9VNwppJuBKNRuFDRNRqRWexT9G9Q==", + "requires": { + "minipass": "^2.9.0" + } + }, + "mkdirp": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-2.1.3.tgz", + "integrity": "sha512-sjAkg21peAG9HS+Dkx7hlG9Ztx7HLeKnvB3NQRcu/mltCVmvkF0pisbiTSfDVYTT86XEfZrTUosLdZLStquZUw==" + }, + "mkdirp-promise": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/mkdirp-promise/-/mkdirp-promise-5.0.1.tgz", + "integrity": "sha512-Hepn5kb1lJPtVW84RFT40YG1OddBNTOVUZR2bzQUHc+Z03en8/3uX0+060JDhcEzyO08HmipsN9DcnFMxhIL9w==", + "requires": { + "mkdirp": "*" + } + }, + "mocha": { + "version": "8.4.0", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-8.4.0.tgz", + "integrity": "sha512-hJaO0mwDXmZS4ghXsvPVriOhsxQ7ofcpQdm8dE+jISUOKopitvnXFQmpRR7jd2K6VBG6E26gU3IAbXXGIbu4sQ==", + "requires": { + "@ungap/promise-all-settled": "1.1.2", + "ansi-colors": "4.1.1", + "browser-stdout": "1.3.1", + "chokidar": "3.5.1", + "debug": "4.3.1", + "diff": "5.0.0", + "escape-string-regexp": "4.0.0", + "find-up": "5.0.0", + "glob": "7.1.6", + "growl": "1.10.5", + "he": "1.2.0", + "js-yaml": "4.0.0", + "log-symbols": "4.0.0", + "minimatch": "3.0.4", + "ms": "2.1.3", + "nanoid": "3.1.20", + "serialize-javascript": "5.0.1", + "strip-json-comments": "3.1.1", + "supports-color": "8.1.1", + "which": "2.0.2", + "wide-align": "1.1.3", + "workerpool": "6.1.0", + "yargs": "16.2.0", + "yargs-parser": "20.2.4", + "yargs-unparser": "2.0.0" + }, + "dependencies": { + "debug": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", + "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", + "requires": { + "ms": "2.1.2" + }, + "dependencies": { + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + } + } + }, + "diff": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz", + "integrity": "sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==" + }, + "ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" + } + } + }, + "mocha-steps": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/mocha-steps/-/mocha-steps-1.3.0.tgz", + "integrity": "sha512-KZvpMJTqzLZw3mOb+EEuYi4YZS41C9iTnb7skVFRxHjUd1OYbl64tCMSmpdIRM9LnwIrSOaRfPtNpF5msgv6Eg==" + }, + "mock-fs": { + "version": "4.14.0", + "resolved": "https://registry.npmjs.org/mock-fs/-/mock-fs-4.14.0.tgz", + "integrity": "sha512-qYvlv/exQ4+svI3UOvPUpLDF0OMX5euvUH0Ny4N5QyRyhNdgAgUrVH3iUINSzEPLvx0kbo/Bp28GJKIqvE7URw==" + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" + }, + "multibase": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/multibase/-/multibase-0.6.1.tgz", + "integrity": "sha512-pFfAwyTjbbQgNc3G7D48JkJxWtoJoBMaR4xQUOuB8RnCgRqaYmWNFeJTTvrJ2w51bjLq2zTby6Rqj9TQ9elSUw==", + "requires": { + "base-x": "^3.0.8", + "buffer": "^5.5.0" + } + }, + "multicodec": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/multicodec/-/multicodec-0.5.7.tgz", + "integrity": "sha512-PscoRxm3f+88fAtELwUnZxGDkduE2HD9Q6GHUOywQLjOGT/HAdhjLDYNZ1e7VR0s0TP0EwZ16LNUTFpoBGivOA==", + "requires": { + "varint": "^5.0.0" + } + }, + "multihashes": { + "version": "0.4.21", + "resolved": "https://registry.npmjs.org/multihashes/-/multihashes-0.4.21.tgz", + "integrity": "sha512-uVSvmeCWf36pU2nB4/1kzYZjsXD9vofZKpgudqkceYY5g2aZZXJ5r9lxuzoRLl1OAp28XljXsEJ/X/85ZsKmKw==", + "requires": { + "buffer": "^5.5.0", + "multibase": "^0.7.0", + "varint": "^5.0.0" + }, + "dependencies": { + "multibase": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/multibase/-/multibase-0.7.0.tgz", + "integrity": "sha512-TW8q03O0f6PNFTQDvh3xxH03c8CjGaaYrjkl9UQPG6rz53TQzzxJVCIWVjzcbN/Q5Y53Zd0IBQBMVktVgNx4Fg==", + "requires": { + "base-x": "^3.0.8", + "buffer": "^5.5.0" + } + } + } + }, + "nano-json-stream-parser": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/nano-json-stream-parser/-/nano-json-stream-parser-0.1.2.tgz", + "integrity": "sha512-9MqxMH/BSJC7dnLsEMPyfN5Dvoo49IsPFYMcHw3Bcfc2kN0lpHRBSzlMSVx4HGyJ7s9B31CyBTVehWJoQ8Ctew==" + }, + "nanoid": { + "version": "3.1.20", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.20.tgz", + "integrity": "sha512-a1cQNyczgKbLX9jwbS/+d7W8fX/RfgYR7lVWwWOGIPNgK2m0MWvrGF6/m4kk6U3QcFMnZf3RIhL0v2Jgh/0Uxw==" + }, + "negotiator": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", + "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==" + }, + "next-tick": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/next-tick/-/next-tick-1.1.0.tgz", + "integrity": "sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ==" + }, + "node-addon-api": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-2.0.2.tgz", + "integrity": "sha512-Ntyt4AIXyaLIuMHF6IOoTakB3K+RWxwtsHNRxllEoA6vPwP9o4866g6YWDLUdnucilZhmkxiHwHr11gAENw+QA==" + }, + "node-fetch": { + "version": "2.6.7", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", + "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", + "requires": { + "whatwg-url": "^5.0.0" + } + }, + "node-gyp-build": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.6.0.tgz", + "integrity": "sha512-NTZVKn9IylLwUzaKjkas1e4u2DLNcV4rdYagA4PWdPwW87Bi7z+BznyKSRwS/761tV/lzCGXplWsiaMjLqP2zQ==" + }, + "normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==" + }, + "normalize-url": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-6.1.0.tgz", + "integrity": "sha512-DlL+XwOy3NxAQ8xuC0okPgK46iuVNAK01YN7RueYBqqFeGsBjV9XmCAzAdgt+667bCl5kPh9EqKKDwnaPG1I7A==" + }, + "number-to-bn": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/number-to-bn/-/number-to-bn-1.7.0.tgz", + "integrity": "sha512-wsJ9gfSz1/s4ZsJN01lyonwuxA1tml6X1yBDnfpMglypcBRFZZkus26EdPSlqS5GJfYddVZa22p3VNb3z5m5Ig==", + "requires": { + "bn.js": "4.11.6", + "strip-hex-prefix": "1.0.0" + }, + "dependencies": { + "bn.js": { + "version": "4.11.6", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.6.tgz", + "integrity": "sha512-XWwnNNFCuuSQ0m3r3C4LE3EiORltHd9M05pq6FOlVeiophzRbMo50Sbz1ehl8K3Z+jw9+vmgnXefY1hz8X+2wA==" + } + } + }, + "oauth-sign": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", + "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==" + }, + "object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==" + }, + "object-inspect": { + "version": "1.12.3", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz", + "integrity": "sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==" + }, + "oboe": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/oboe/-/oboe-2.1.5.tgz", + "integrity": "sha512-zRFWiF+FoicxEs3jNI/WYUrVEgA7DeET/InK0XQuudGHRg8iIob3cNPrJTKaz4004uaA9Pbe+Dwa8iluhjLZWA==", + "requires": { + "http-https": "^1.0.0" + } + }, + "on-finished": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", + "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", + "requires": { + "ee-first": "1.1.1" + } + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "requires": { + "wrappy": "1" + } + }, + "p-cancelable": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-3.0.0.tgz", + "integrity": "sha512-mlVgR3PGuzlo0MmTdk4cXqXWlwQDLnONTAg6sm62XkMJEiRxN3GL3SffkYvqwonbkJBcrI7Uvv5Zh9yjvn2iUw==" + }, + "p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "requires": { + "yocto-queue": "^0.1.0" + } + }, + "p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "requires": { + "p-limit": "^3.0.2" + } + }, + "parse-asn1": { + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/parse-asn1/-/parse-asn1-5.1.6.tgz", + "integrity": "sha512-RnZRo1EPU6JBnra2vGHj0yhp6ebyjBZpmUCLHWiFhxlzvBCCpAuZ7elsBp1PVAbQN0/04VD/19rfzlBSwLstMw==", + "requires": { + "asn1.js": "^5.2.0", + "browserify-aes": "^1.0.0", + "evp_bytestokey": "^1.0.0", + "pbkdf2": "^3.0.3", + "safe-buffer": "^5.1.1" + } + }, + "parse-headers": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/parse-headers/-/parse-headers-2.0.5.tgz", + "integrity": "sha512-ft3iAoLOB/MlwbNXgzy43SWGP6sQki2jQvAyBg/zDFAgr9bfNWZIUj42Kw2eJIl8kEi4PbgE6U1Zau/HwI75HA==" + }, + "parseurl": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", + "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==" + }, + "path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==" + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==" + }, + "path-to-regexp": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", + "integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==" + }, + "pathval": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", + "integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==" + }, + "pbkdf2": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.1.2.tgz", + "integrity": "sha512-iuh7L6jA7JEGu2WxDwtQP1ddOpaJNC4KlDEFfdQajSGgGPNi4OyDc2R7QnbY2bR9QjBVGwgvTdNJZoE7RaxUMA==", + "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" + } + }, + "performance-now": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow==" + }, + "picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==" + }, + "process": { + "version": "0.11.10", + "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", + "integrity": "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==" + }, + "proxy-addr": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", + "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", + "requires": { + "forwarded": "0.2.0", + "ipaddr.js": "1.9.1" + } + }, + "psl": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.9.0.tgz", + "integrity": "sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag==" + }, + "public-encrypt": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/public-encrypt/-/public-encrypt-4.0.3.tgz", + "integrity": "sha512-zVpa8oKZSz5bTMTFClc1fQOnyyEzpl5ozpi1B5YcvBrdohMjH2rfsBtyXcuNuwjsDIXmBYlF2N5FlJYhR29t8Q==", + "requires": { + "bn.js": "^4.1.0", + "browserify-rsa": "^4.0.0", + "create-hash": "^1.1.0", + "parse-asn1": "^5.0.0", + "randombytes": "^2.0.1", + "safe-buffer": "^5.1.2" + } + }, + "pump": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", + "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", + "requires": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "punycode": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", + "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==" + }, + "qs": { + "version": "6.11.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz", + "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==", + "requires": { + "side-channel": "^1.0.4" + } + }, + "query-string": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/query-string/-/query-string-5.1.1.tgz", + "integrity": "sha512-gjWOsm2SoGlgLEdAGt7a6slVOk9mGiXmPFMqrEhLQ68rhQuBnpfs3+EmlvqKyxnCo9/PPlF+9MtY02S1aFg+Jw==", + "requires": { + "decode-uri-component": "^0.2.0", + "object-assign": "^4.1.0", + "strict-uri-encode": "^1.0.0" + } + }, + "quick-lru": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-5.1.1.tgz", + "integrity": "sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA==" + }, + "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" + } + }, + "randomfill": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/randomfill/-/randomfill-1.0.4.tgz", + "integrity": "sha512-87lcbR8+MhcWcUiQ+9e+Rwx8MyR2P7qnt15ynUlbm3TU/fjbgz4GsvfSUDTemtCCtVCqb4ZcEFlyPNTh9bBTLw==", + "requires": { + "randombytes": "^2.0.5", + "safe-buffer": "^5.1.0" + } + }, + "range-parser": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", + "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==" + }, + "raw-body": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.1.tgz", + "integrity": "sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig==", + "requires": { + "bytes": "3.1.2", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "unpipe": "1.0.0" + } + }, + "readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + }, + "readdirp": { + "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" + } + }, + "request": { + "version": "2.88.2", + "resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz", + "integrity": "sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==", + "requires": { + "aws-sign2": "~0.7.0", + "aws4": "^1.8.0", + "caseless": "~0.12.0", + "combined-stream": "~1.0.6", + "extend": "~3.0.2", + "forever-agent": "~0.6.1", + "form-data": "~2.3.2", + "har-validator": "~5.1.3", + "http-signature": "~1.2.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.19", + "oauth-sign": "~0.9.0", + "performance-now": "^2.1.0", + "qs": "~6.5.2", + "safe-buffer": "^5.1.2", + "tough-cookie": "~2.5.0", + "tunnel-agent": "^0.6.0", + "uuid": "^3.3.2" + }, + "dependencies": { + "qs": { + "version": "6.5.3", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.3.tgz", + "integrity": "sha512-qxXIEh4pCGfHICj1mAJQ2/2XVZkjCDTcEgfoSQxc/fYivUZxTkk7L3bDBJSoNrEzXI17oUO5Dp07ktqE5KzczA==" + } + } + }, + "require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==" + }, + "resolve-alpn": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/resolve-alpn/-/resolve-alpn-1.2.1.tgz", + "integrity": "sha512-0a1F4l73/ZFZOakJnQ3FvkJ2+gSTQWz/r2KE5OdDY0TxPm5h4GkqkWWfM47T7HsbnOtcJVEF4epCVy6u7Q3K+g==" + }, + "responselike": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/responselike/-/responselike-2.0.1.tgz", + "integrity": "sha512-4gl03wn3hj1HP3yzgdI7d3lCkF95F21Pz4BPGvKHinyQzALR5CapwC8yIi0Rh58DEMQ/SguC03wFj2k0M/mHhw==", + "requires": { + "lowercase-keys": "^2.0.0" + }, + "dependencies": { + "lowercase-keys": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz", + "integrity": "sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==" + } + } + }, + "ripemd160": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.2.tgz", + "integrity": "sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA==", + "requires": { + "hash-base": "^3.0.0", + "inherits": "^2.0.1" + } + }, + "rlp": { + "version": "2.2.7", + "resolved": "https://registry.npmjs.org/rlp/-/rlp-2.2.7.tgz", + "integrity": "sha512-d5gdPmgQ0Z+AklL2NVXr/IoSjNZFfTVvQWzL/AM2AOcSzYP2xjlb0AC8YyCLc41MSNf6P6QVtjgPdmVtzb+4lQ==", + "requires": { + "bn.js": "^5.2.0" + }, + "dependencies": { + "bn.js": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", + "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==" + } + } + }, + "safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" + }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, + "scrypt-js": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/scrypt-js/-/scrypt-js-3.0.1.tgz", + "integrity": "sha512-cdwTTnqPu0Hyvf5in5asVdZocVDTNRmR7XEcJuIzMjJeSHybHl7vpB66AzwTaIg6CLSbtjcxc8fqcySfnTkccA==" + }, + "secp256k1": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/secp256k1/-/secp256k1-4.0.3.tgz", + "integrity": "sha512-NLZVf+ROMxwtEj3Xa562qgv2BK5e2WNmXPiOdVIPLgs6lyTzMvBq0aWTYMI5XCP9jZMVKOcqZLw/Wc4vDkuxhA==", + "requires": { + "elliptic": "^6.5.4", + "node-addon-api": "^2.0.0", + "node-gyp-build": "^4.2.0" + } + }, + "send": { + "version": "0.18.0", + "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz", + "integrity": "sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==", + "requires": { + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "0.5.2", + "http-errors": "2.0.0", + "mime": "1.6.0", + "ms": "2.1.3", + "on-finished": "2.4.1", + "range-parser": "~1.2.1", + "statuses": "2.0.1" + }, + "dependencies": { + "ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" + } + } + }, + "serialize-javascript": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-5.0.1.tgz", + "integrity": "sha512-SaaNal9imEO737H2c05Og0/8LUXG7EnsZyMa8MzkmuHoELfT6txuj0cMqRj6zfPKnmQ1yasR4PCJc8x+M4JSPA==", + "requires": { + "randombytes": "^2.1.0" + } + }, + "serve-static": { + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.15.0.tgz", + "integrity": "sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g==", + "requires": { + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "parseurl": "~1.3.3", + "send": "0.18.0" + } + }, + "servify": { + "version": "0.1.12", + "resolved": "https://registry.npmjs.org/servify/-/servify-0.1.12.tgz", + "integrity": "sha512-/xE6GvsKKqyo1BAY+KxOWXcLpPsUUyji7Qg3bVD7hh1eRze5bR1uYiuDA/k3Gof1s9BTzQZEJK8sNcNGFIzeWw==", + "requires": { + "body-parser": "^1.16.0", + "cors": "^2.8.1", + "express": "^4.14.0", + "request": "^2.79.0", + "xhr": "^2.3.3" + } + }, + "setimmediate": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", + "integrity": "sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA==" + }, + "setprototypeof": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==" + }, + "sha.js": { + "version": "2.4.11", + "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", + "integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==", + "requires": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "side-channel": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", + "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", + "requires": { + "call-bind": "^1.0.0", + "get-intrinsic": "^1.0.2", + "object-inspect": "^1.9.0" + } + }, + "simple-concat": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.1.tgz", + "integrity": "sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==" + }, + "simple-get": { + "version": "2.8.2", + "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-2.8.2.tgz", + "integrity": "sha512-Ijd/rV5o+mSBBs4F/x9oDPtTx9Zb6X9brmnXvMW4J7IR15ngi9q5xxqWBKU744jTZiaXtxaPL7uHG6vtN8kUkw==", + "requires": { + "decompress-response": "^3.3.0", + "once": "^1.3.1", + "simple-concat": "^1.0.0" + }, + "dependencies": { + "decompress-response": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", + "integrity": "sha512-BzRPQuY1ip+qDonAOz42gRm/pg9F768C+npV/4JOsxRC2sq+Rlk+Q4ZCAsOhnIaMrgarILY+RMUIvMmmX1qAEA==", + "requires": { + "mimic-response": "^1.0.0" + } + } + } + }, + "sshpk": { + "version": "1.17.0", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.17.0.tgz", + "integrity": "sha512-/9HIEs1ZXGhSPE8X6Ccm7Nam1z8KcoCqPdI7ecm1N33EzAetWahvQWVqLZtaZQ+IDKX4IyA2o0gBzqIMkAagHQ==", + "requires": { + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "bcrypt-pbkdf": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jsbn": "~0.1.0", + "safer-buffer": "^2.0.2", + "tweetnacl": "~0.14.0" + } + }, + "statuses": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", + "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==" + }, + "strict-uri-encode": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz", + "integrity": "sha512-R3f198pcvnB+5IpnBlRkphuE9n46WyVl8I39W/ZUTZLz4nqSP/oLYUrcnJrw462Ds8he4YKMov2efsTIw1BDGQ==" + }, + "string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "requires": { + "safe-buffer": "~5.2.0" + } + }, + "string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "requires": { + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" + } + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha512-4XaJ2zQdCzROZDivEVIDPkcQn8LMFSa8kj8Gxb/Lnwzv9A8VctNZ+lfivC/sV3ivW8ElJTERXZoPBRrZKkNKow==", + "requires": { + "ansi-regex": "^3.0.0" + } + }, + "strip-hex-prefix": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/strip-hex-prefix/-/strip-hex-prefix-1.0.0.tgz", + "integrity": "sha512-q8d4ue7JGEiVcypji1bALTos+0pWtyGlivAWyPuTkHzuTCJqrK9sWxYQZUq6Nq3cuyv3bm734IhHvHtGGURU6A==", + "requires": { + "is-hex-prefixed": "1.0.0" + } + }, + "strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==" + }, + "supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "requires": { + "has-flag": "^4.0.0" + } + }, + "swarm-js": { + "version": "0.1.42", + "resolved": "https://registry.npmjs.org/swarm-js/-/swarm-js-0.1.42.tgz", + "integrity": "sha512-BV7c/dVlA3R6ya1lMlSSNPLYrntt0LUq4YMgy3iwpCIc6rZnS5W2wUoctarZ5pXlpKtxDDf9hNziEkcfrxdhqQ==", + "requires": { + "bluebird": "^3.5.0", + "buffer": "^5.0.5", + "eth-lib": "^0.1.26", + "fs-extra": "^4.0.2", + "got": "^11.8.5", + "mime-types": "^2.1.16", + "mkdirp-promise": "^5.0.1", + "mock-fs": "^4.1.0", + "setimmediate": "^1.0.5", + "tar": "^4.0.2", + "xhr-request": "^1.0.1" + }, + "dependencies": { + "@szmarczak/http-timer": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-4.0.6.tgz", + "integrity": "sha512-4BAffykYOgO+5nzBWYwE3W90sBgLJoUPRWWcL8wlyiM8IB8ipJz3UMJ9KXQd1RKQXpKp8Tutn80HZtWsu2u76w==", + "requires": { + "defer-to-connect": "^2.0.0" + } + }, + "cacheable-lookup": { + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/cacheable-lookup/-/cacheable-lookup-5.0.4.tgz", + "integrity": "sha512-2/kNscPhpcxrOigMZzbiWF7dz8ilhb/nIHU3EyZiXWXpeq/au8qJ8VhdftMkty3n7Gj6HIGalQG8oiBNB3AJgA==" + }, + "got": { + "version": "11.8.6", + "resolved": "https://registry.npmjs.org/got/-/got-11.8.6.tgz", + "integrity": "sha512-6tfZ91bOr7bOXnK7PRDCGBLa1H4U080YHNaAQ2KsMGlLEzRbk44nsZF2E1IeRc3vtJHPVbKCYgdFbaGO2ljd8g==", + "requires": { + "@sindresorhus/is": "^4.0.0", + "@szmarczak/http-timer": "^4.0.5", + "@types/cacheable-request": "^6.0.1", + "@types/responselike": "^1.0.0", + "cacheable-lookup": "^5.0.3", + "cacheable-request": "^7.0.2", + "decompress-response": "^6.0.0", + "http2-wrapper": "^1.0.0-beta.5.2", + "lowercase-keys": "^2.0.0", + "p-cancelable": "^2.0.0", + "responselike": "^2.0.0" + } + }, + "http2-wrapper": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/http2-wrapper/-/http2-wrapper-1.0.3.tgz", + "integrity": "sha512-V+23sDMr12Wnz7iTcDeJr3O6AIxlnvT/bmaAAAP/Xda35C90p9599p0F1eHR/N1KILWSoWVAiOMFjBBXaXSMxg==", + "requires": { + "quick-lru": "^5.1.1", + "resolve-alpn": "^1.0.0" + } + }, + "lowercase-keys": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz", + "integrity": "sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==" + }, + "p-cancelable": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-2.1.1.tgz", + "integrity": "sha512-BZOr3nRQHOntUjTrH8+Lh54smKHoHyur8We1V8DSMVrl5A2malOOwuJRnKRDjSnkoeBh4at6BwEnb5I7Jl31wg==" + } + } + }, + "tar": { + "version": "4.4.19", + "resolved": "https://registry.npmjs.org/tar/-/tar-4.4.19.tgz", + "integrity": "sha512-a20gEsvHnWe0ygBY8JbxoM4w3SJdhc7ZAuxkLqh+nvNQN2IOt0B5lLgM490X5Hl8FF0dl0tOf2ewFYAlIFgzVA==", + "requires": { + "chownr": "^1.1.4", + "fs-minipass": "^1.2.7", + "minipass": "^2.9.0", + "minizlib": "^1.3.3", + "mkdirp": "^0.5.5", + "safe-buffer": "^5.2.1", + "yallist": "^3.1.1" + }, + "dependencies": { + "mkdirp": { + "version": "0.5.6", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz", + "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==", + "requires": { + "minimist": "^1.2.6" + } + } + } + }, + "timed-out": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/timed-out/-/timed-out-4.0.1.tgz", + "integrity": "sha512-G7r3AhovYtr5YKOWQkta8RKAPb+J9IsO4uVmzjl8AZwfhs8UcUwTiD6gcJYSgOtzyjvQKrKYn41syHbUWMkafA==" + }, + "to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "requires": { + "is-number": "^7.0.0" + } + }, + "toidentifier": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==" + }, + "tough-cookie": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", + "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==", + "requires": { + "psl": "^1.1.28", + "punycode": "^2.1.1" + } + }, + "tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" + }, + "ts-node": { + "version": "10.9.1", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz", + "integrity": "sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==", + "requires": { + "@cspotcode/source-map-support": "^0.8.0", + "@tsconfig/node10": "^1.0.7", + "@tsconfig/node12": "^1.0.7", + "@tsconfig/node14": "^1.0.0", + "@tsconfig/node16": "^1.0.2", + "acorn": "^8.4.1", + "acorn-walk": "^8.1.1", + "arg": "^4.1.0", + "create-require": "^1.1.0", + "diff": "^4.0.1", + "make-error": "^1.1.1", + "v8-compile-cache-lib": "^3.0.1", + "yn": "3.1.1" + } + }, + "tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==", + "requires": { + "safe-buffer": "^5.0.1" + } + }, + "tweetnacl": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA==" + }, + "type": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/type/-/type-1.2.0.tgz", + "integrity": "sha512-+5nt5AAniqsCnu2cEQQdpzCAh33kVx8n0VoFidKpB1dVVLAN/F+bgVOqOJqOnEnrhp222clB5p3vUlD+1QAnfg==" + }, + "type-detect": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", + "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==" + }, + "type-is": { + "version": "1.6.18", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", + "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", + "requires": { + "media-typer": "0.3.0", + "mime-types": "~2.1.24" + } + }, + "typedarray-to-buffer": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", + "integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==", + "requires": { + "is-typedarray": "^1.0.0" + } + }, + "typescript": { + "version": "4.9.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.4.tgz", + "integrity": "sha512-Uz+dTXYzxXXbsFpM86Wh3dKCxrQqUcVMxwU54orwlJjOpO3ao8L7j5lH+dWfTwgCwIuM9GQ2kvVotzYJMXTBZg==" + }, + "ultron": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ultron/-/ultron-1.1.1.tgz", + "integrity": "sha512-UIEXBNeYmKptWH6z8ZnqTeS8fV74zG0/eRU9VGkpzz+LIJNs8W/zM/L+7ctCkRrgbNnnR0xxw4bKOr0cW0N0Og==" + }, + "universalify": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", + "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==" + }, + "unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==" + }, + "uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "requires": { + "punycode": "^2.1.0" + } + }, + "url-set-query": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/url-set-query/-/url-set-query-1.0.0.tgz", + "integrity": "sha512-3AChu4NiXquPfeckE5R5cGdiHCMWJx1dwCWOmWIL4KHAziJNOFIYJlpGFeKDvwLPHovZRCxK3cYlwzqI9Vp+Gg==" + }, + "utf-8-validate": { + "version": "5.0.10", + "resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.10.tgz", + "integrity": "sha512-Z6czzLq4u8fPOyx7TU6X3dvUZVvoJmxSQ+IcrlmagKhilxlhZgxPK6C5Jqbkw1IDUmFTM+cz9QDnnLTwDz/2gQ==", + "requires": { + "node-gyp-build": "^4.3.0" + } + }, + "utf8": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/utf8/-/utf8-3.0.0.tgz", + "integrity": "sha512-E8VjFIQ/TyQgp+TZfS6l8yp/xWppSAHzidGiRrqe4bK4XP9pTRyKFgGJpO3SN7zdX4DeomTrwaseCHovfpFcqQ==" + }, + "util": { + "version": "0.12.5", + "resolved": "https://registry.npmjs.org/util/-/util-0.12.5.tgz", + "integrity": "sha512-kZf/K6hEIrWHI6XqOFUiiMa+79wE/D8Q+NCNAWclkyg3b4d2k7s0QGepNjiABc+aR3N1PAyHL7p6UcLY6LmrnA==", + "requires": { + "inherits": "^2.0.3", + "is-arguments": "^1.0.4", + "is-generator-function": "^1.0.7", + "is-typed-array": "^1.1.3", + "which-typed-array": "^1.1.2" + } + }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" + }, + "utils-merge": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", + "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==" + }, + "uuid": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", + "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==" + }, + "v8-compile-cache-lib": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", + "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==" + }, + "varint": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/varint/-/varint-5.0.2.tgz", + "integrity": "sha512-lKxKYG6H03yCZUpAGOPOsMcGxd1RHCu1iKvEHYDPmTyq2HueGhD73ssNBqqQWfvYs04G9iUFRvmAVLW20Jw6ow==" + }, + "vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==" + }, + "verror": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", + "integrity": "sha512-ZZKSmDAEFOijERBLkmYfJ+vmk3w+7hOLYDNkRCuRuMJGEmqYNCNLyBBFwWKVMhfwaEF3WOd0Zlw86U/WC/+nYw==", + "requires": { + "assert-plus": "^1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "^1.2.0" + } + }, + "web3": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/web3/-/web3-1.8.1.tgz", + "integrity": "sha512-tAqFsQhGv340C9OgRJIuoScN7f7wa1tUvsnnDUMt9YE6J4gcm7TV2Uwv+KERnzvV+xgdeuULYpsioRRNKrUvoQ==", + "requires": { + "web3-bzz": "1.8.1", + "web3-core": "1.8.1", + "web3-eth": "1.8.1", + "web3-eth-personal": "1.8.1", + "web3-net": "1.8.1", + "web3-shh": "1.8.1", + "web3-utils": "1.8.1" + } + }, + "web3-bzz": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/web3-bzz/-/web3-bzz-1.8.1.tgz", + "integrity": "sha512-dJJHS84nvpoxv6ijTMkdUSlRr5beCXNtx4UZcrFLHBva8dT63QEtKdLyDt2AyMJJdVzTCk78uir/6XtVWrdS6w==", + "requires": { + "@types/node": "^12.12.6", + "got": "12.1.0", + "swarm-js": "^0.1.40" + } + }, + "web3-core": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/web3-core/-/web3-core-1.8.1.tgz", + "integrity": "sha512-LbRZlJH2N6nS3n3Eo9Y++25IvzMY7WvYnp4NM/Ajhh97dAdglYs6rToQ2DbL2RLvTYmTew4O/y9WmOk4nq9COw==", + "requires": { + "@types/bn.js": "^5.1.0", + "@types/node": "^12.12.6", + "bignumber.js": "^9.0.0", + "web3-core-helpers": "1.8.1", + "web3-core-method": "1.8.1", + "web3-core-requestmanager": "1.8.1", + "web3-utils": "1.8.1" + } + }, + "web3-core-helpers": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.8.1.tgz", + "integrity": "sha512-ClzNO6T1S1gifC+BThw0+GTfcsjLEY8T1qUp6Ly2+w4PntAdNtKahxWKApWJ0l9idqot/fFIDXwO3Euu7I0Xqw==", + "requires": { + "web3-eth-iban": "1.8.1", + "web3-utils": "1.8.1" + } + }, + "web3-core-method": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/web3-core-method/-/web3-core-method-1.8.1.tgz", + "integrity": "sha512-oYGRodktfs86NrnFwaWTbv2S38JnpPslFwSSARwFv4W9cjbGUW3LDeA5MKD/dRY+ssZ5OaekeMsUCLoGhX68yA==", + "requires": { + "@ethersproject/transactions": "^5.6.2", + "web3-core-helpers": "1.8.1", + "web3-core-promievent": "1.8.1", + "web3-core-subscriptions": "1.8.1", + "web3-utils": "1.8.1" + } + }, + "web3-core-promievent": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/web3-core-promievent/-/web3-core-promievent-1.8.1.tgz", + "integrity": "sha512-9mxqHlgB0MrZI4oUIRFkuoJMNj3E7btjrMv3sMer/Z9rYR1PfoSc1aAokw4rxKIcAh+ylVtd/acaB2HKB7aRPg==", + "requires": { + "eventemitter3": "4.0.4" + } + }, + "web3-core-requestmanager": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/web3-core-requestmanager/-/web3-core-requestmanager-1.8.1.tgz", + "integrity": "sha512-x+VC2YPPwZ1khvqA6TA69LvfFCOZXsoUVOxmTx/vIN22PrY9KzKhxcE7pBSiGhmab1jtmRYXUbcQSVpAXqL8cw==", + "requires": { + "util": "^0.12.0", + "web3-core-helpers": "1.8.1", + "web3-providers-http": "1.8.1", + "web3-providers-ipc": "1.8.1", + "web3-providers-ws": "1.8.1" + } + }, + "web3-core-subscriptions": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/web3-core-subscriptions/-/web3-core-subscriptions-1.8.1.tgz", + "integrity": "sha512-bmCMq5OeA3E2vZUh8Js1HcJbhwtsE+yeMqGC4oIZB3XsL5SLqyKLB/pU+qUYqQ9o4GdcrFTDPhPg1bgvf7p1Pw==", + "requires": { + "eventemitter3": "4.0.4", + "web3-core-helpers": "1.8.1" + } + }, + "web3-eth": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/web3-eth/-/web3-eth-1.8.1.tgz", + "integrity": "sha512-LgyzbhFqiFRd8M8sBXoFN4ztzOnkeckl3H/9lH5ek7AdoRMhBg7tYpYRP3E5qkhd/q+yiZmcUgy1AF6NHrC1wg==", + "requires": { + "web3-core": "1.8.1", + "web3-core-helpers": "1.8.1", + "web3-core-method": "1.8.1", + "web3-core-subscriptions": "1.8.1", + "web3-eth-abi": "1.8.1", + "web3-eth-accounts": "1.8.1", + "web3-eth-contract": "1.8.1", + "web3-eth-ens": "1.8.1", + "web3-eth-iban": "1.8.1", + "web3-eth-personal": "1.8.1", + "web3-net": "1.8.1", + "web3-utils": "1.8.1" + } + }, + "web3-eth-abi": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/web3-eth-abi/-/web3-eth-abi-1.8.1.tgz", + "integrity": "sha512-0mZvCRTIG0UhDhJwNQJgJxu4b4DyIpuMA0GTfqxqeuqzX4Q/ZvmoNurw0ExTfXaGPP82UUmmdkRi6FdZOx+C6w==", + "requires": { + "@ethersproject/abi": "^5.6.3", + "web3-utils": "1.8.1" + } + }, + "web3-eth-accounts": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/web3-eth-accounts/-/web3-eth-accounts-1.8.1.tgz", + "integrity": "sha512-mgzxSYgN54/NsOFBO1Fq1KkXp1S5KlBvI/DlgvajU72rupoFMq6Cu6Yp9GUaZ/w2ij9PzEJuFJk174XwtfMCmg==", + "requires": { + "@ethereumjs/common": "2.5.0", + "@ethereumjs/tx": "3.3.2", + "crypto-browserify": "3.12.0", + "eth-lib": "0.2.8", + "ethereumjs-util": "^7.0.10", + "scrypt-js": "^3.0.1", + "uuid": "^9.0.0", + "web3-core": "1.8.1", + "web3-core-helpers": "1.8.1", + "web3-core-method": "1.8.1", + "web3-utils": "1.8.1" + }, + "dependencies": { + "eth-lib": { + "version": "0.2.8", + "resolved": "https://registry.npmjs.org/eth-lib/-/eth-lib-0.2.8.tgz", + "integrity": "sha512-ArJ7x1WcWOlSpzdoTBX8vkwlkSQ85CjjifSZtV4co64vWxSV8geWfPI9x4SVYu3DSxnX4yWFVTtGL+j9DUFLNw==", + "requires": { + "bn.js": "^4.11.6", + "elliptic": "^6.4.0", + "xhr-request-promise": "^0.1.2" + } + }, + "uuid": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.0.tgz", + "integrity": "sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==" + } + } + }, + "web3-eth-contract": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/web3-eth-contract/-/web3-eth-contract-1.8.1.tgz", + "integrity": "sha512-1wphnl+/xwCE2io44JKnN+ti3oa47BKRiVzvWd42icwRbcpFfRxH9QH+aQX3u8VZIISNH7dAkTWpGIIJgGFTmg==", + "requires": { + "@types/bn.js": "^5.1.0", + "web3-core": "1.8.1", + "web3-core-helpers": "1.8.1", + "web3-core-method": "1.8.1", + "web3-core-promievent": "1.8.1", + "web3-core-subscriptions": "1.8.1", + "web3-eth-abi": "1.8.1", + "web3-utils": "1.8.1" + } + }, + "web3-eth-ens": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/web3-eth-ens/-/web3-eth-ens-1.8.1.tgz", + "integrity": "sha512-FT8xTI9uN8RxeBQa/W8pLa2aoFh4+EE34w7W2271LICKzla1dtLyb6XSdn48vsUcPmhWsTVk9mO9RTU0l4LGQQ==", + "requires": { + "content-hash": "^2.5.2", + "eth-ens-namehash": "2.0.8", + "web3-core": "1.8.1", + "web3-core-helpers": "1.8.1", + "web3-core-promievent": "1.8.1", + "web3-eth-abi": "1.8.1", + "web3-eth-contract": "1.8.1", + "web3-utils": "1.8.1" + } + }, + "web3-eth-iban": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.8.1.tgz", + "integrity": "sha512-DomoQBfvIdtM08RyMGkMVBOH0vpOIxSSQ+jukWk/EkMLGMWJtXw/K2c2uHAeq3L/VPWNB7zXV2DUEGV/lNE2Dg==", + "requires": { + "bn.js": "^5.2.1", + "web3-utils": "1.8.1" + }, + "dependencies": { + "bn.js": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", + "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==" + } + } + }, + "web3-eth-personal": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/web3-eth-personal/-/web3-eth-personal-1.8.1.tgz", + "integrity": "sha512-myIYMvj7SDIoV9vE5BkVdon3pya1WinaXItugoii2VoTcQNPOtBxmYVH+XS5ErzCJlnxzphpQrkywyY64bbbCA==", + "requires": { + "@types/node": "^12.12.6", + "web3-core": "1.8.1", + "web3-core-helpers": "1.8.1", + "web3-core-method": "1.8.1", + "web3-net": "1.8.1", + "web3-utils": "1.8.1" + } + }, + "web3-net": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/web3-net/-/web3-net-1.8.1.tgz", + "integrity": "sha512-LyEJAwogdFo0UAXZqoSJGFjopdt+kLw0P00FSZn2yszbgcoI7EwC+nXiOsEe12xz4LqpYLOtbR7+gxgiTVjjHQ==", + "requires": { + "web3-core": "1.8.1", + "web3-core-method": "1.8.1", + "web3-utils": "1.8.1" + } + }, + "web3-providers-http": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/web3-providers-http/-/web3-providers-http-1.8.1.tgz", + "integrity": "sha512-1Zyts4O9W/UNEPkp+jyL19Jc3D15S4yp8xuLTjVhcUEAlHo24NDWEKxtZGUuHk4HrKL2gp8OlsDbJ7MM+ESDgg==", + "requires": { + "abortcontroller-polyfill": "^1.7.3", + "cross-fetch": "^3.1.4", + "es6-promise": "^4.2.8", + "web3-core-helpers": "1.8.1" + } + }, + "web3-providers-ipc": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/web3-providers-ipc/-/web3-providers-ipc-1.8.1.tgz", + "integrity": "sha512-nw/W5nclvi+P2z2dYkLWReKLnocStflWqFl+qjtv0xn3MrUTyXMzSF0+61i77+16xFsTgzo4wS/NWIOVkR0EFA==", + "requires": { + "oboe": "2.1.5", + "web3-core-helpers": "1.8.1" + } + }, + "web3-providers-ws": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/web3-providers-ws/-/web3-providers-ws-1.8.1.tgz", + "integrity": "sha512-TNefIDAMpdx57+YdWpYZ/xdofS0P+FfKaDYXhn24ie/tH9G+AB+UBSOKnjN0KSadcRSCMBwGPRiEmNHPavZdsA==", + "requires": { + "eventemitter3": "4.0.4", + "web3-core-helpers": "1.8.1", + "websocket": "^1.0.32" + } + }, + "web3-shh": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/web3-shh/-/web3-shh-1.8.1.tgz", + "integrity": "sha512-sqHgarnfcY2Qt3PYS4R6YveHrDy7hmL09yeLLHHCI+RKirmjLVqV0rc5LJWUtlbYI+kDoa5gbgde489M9ZAC0g==", + "requires": { + "web3-core": "1.8.1", + "web3-core-method": "1.8.1", + "web3-core-subscriptions": "1.8.1", + "web3-net": "1.8.1" + } + }, + "web3-utils": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.8.1.tgz", + "integrity": "sha512-LgnM9p6V7rHHUGfpMZod+NST8cRfGzJ1BTXAyNo7A9cJX9LczBfSRxJp+U/GInYe9mby40t3v22AJdlELibnsQ==", + "requires": { + "bn.js": "^5.2.1", + "ethereum-bloom-filters": "^1.0.6", + "ethereumjs-util": "^7.1.0", + "ethjs-unit": "0.1.6", + "number-to-bn": "1.7.0", + "randombytes": "^2.1.0", + "utf8": "3.0.0" + }, + "dependencies": { + "bn.js": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", + "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==" + } + } + }, + "webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" + }, + "websocket": { + "version": "1.0.34", + "resolved": "https://registry.npmjs.org/websocket/-/websocket-1.0.34.tgz", + "integrity": "sha512-PRDso2sGwF6kM75QykIesBijKSVceR6jL2G8NGYyq2XrItNC2P5/qL5XeR056GhA+Ly7JMFvJb9I312mJfmqnQ==", + "requires": { + "bufferutil": "^4.0.1", + "debug": "^2.2.0", + "es5-ext": "^0.10.50", + "typedarray-to-buffer": "^3.1.5", + "utf-8-validate": "^5.0.2", + "yaeti": "^0.0.6" + } + }, + "whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "requires": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, + "which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "requires": { + "isexe": "^2.0.0" + } + }, + "which-typed-array": { + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.9.tgz", + "integrity": "sha512-w9c4xkx6mPidwp7180ckYWfMmvxpjlZuIudNtDf4N/tTAUB8VJbX25qZoAsrtGuYNnGw3pa0AXgbGKRB8/EceA==", + "requires": { + "available-typed-arrays": "^1.0.5", + "call-bind": "^1.0.2", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "has-tostringtag": "^1.0.0", + "is-typed-array": "^1.1.10" + } + }, + "wide-align": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", + "integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==", + "requires": { + "string-width": "^1.0.2 || 2" + } + }, + "workerpool": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.1.0.tgz", + "integrity": "sha512-toV7q9rWNYha963Pl/qyeZ6wG+3nnsyvolaNUS8+R5Wtw6qJPTxIlOP1ZSvcGhEJw+l3HMMmtiNo9Gl61G4GVg==" + }, + "wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "requires": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==" + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==" + }, + "string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + } + }, + "strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "requires": { + "ansi-regex": "^5.0.1" + } + } + } + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" + }, + "ws": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/ws/-/ws-3.3.3.tgz", + "integrity": "sha512-nnWLa/NwZSt4KQJu51MYlCcSQ5g7INpOrOMt4XV8j4dqTXdmlUmSHQ8/oLC069ckre0fRsgfvsKwbTdtKLCDkA==", + "requires": { + "async-limiter": "~1.0.0", + "safe-buffer": "~5.1.0", + "ultron": "~1.1.0" + }, + "dependencies": { + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + } + } + }, + "xhr": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/xhr/-/xhr-2.6.0.tgz", + "integrity": "sha512-/eCGLb5rxjx5e3mF1A7s+pLlR6CGyqWN91fv1JgER5mVWg1MZmlhBvy9kjcsOdRk8RrIujotWyJamfyrp+WIcA==", + "requires": { + "global": "~4.4.0", + "is-function": "^1.0.1", + "parse-headers": "^2.0.0", + "xtend": "^4.0.0" + } + }, + "xhr-request": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/xhr-request/-/xhr-request-1.1.0.tgz", + "integrity": "sha512-Y7qzEaR3FDtL3fP30k9wO/e+FBnBByZeybKOhASsGP30NIkRAAkKD/sCnLvgEfAIEC1rcmK7YG8f4oEnIrrWzA==", + "requires": { + "buffer-to-arraybuffer": "^0.0.5", + "object-assign": "^4.1.1", + "query-string": "^5.0.1", + "simple-get": "^2.7.0", + "timed-out": "^4.0.1", + "url-set-query": "^1.0.0", + "xhr": "^2.0.4" + } + }, + "xhr-request-promise": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/xhr-request-promise/-/xhr-request-promise-0.1.3.tgz", + "integrity": "sha512-YUBytBsuwgitWtdRzXDDkWAXzhdGB8bYm0sSzMPZT7Z2MBjMSTHFsyCT1yCRATY+XC69DUrQraRAEgcoCRaIPg==", + "requires": { + "xhr-request": "^1.1.0" + } + }, + "xtend": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", + "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==" + }, + "y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==" + }, + "yaeti": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/yaeti/-/yaeti-0.0.6.tgz", + "integrity": "sha512-MvQa//+KcZCUkBTIC9blM+CU9J2GzuTytsOUwf2lidtvkx/6gnEp1QvJv34t9vdjhFmha/mUiNDbN0D0mJWdug==" + }, + "yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==" + }, + "yargs": { + "version": "16.2.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", + "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", + "requires": { + "cliui": "^7.0.2", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.0", + "y18n": "^5.0.5", + "yargs-parser": "^20.2.2" + }, + "dependencies": { + "ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==" + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==" + }, + "string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + } + }, + "strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "requires": { + "ansi-regex": "^5.0.1" + } + } + } + }, + "yargs-parser": { + "version": "20.2.4", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.4.tgz", + "integrity": "sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==" + }, + "yargs-unparser": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-2.0.0.tgz", + "integrity": "sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==", + "requires": { + "camelcase": "^6.0.0", + "decamelize": "^4.0.0", + "flat": "^5.0.2", + "is-plain-obj": "^2.1.0" + } + }, + "yn": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==" + }, + "yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==" + } + } +} diff --git a/tests/package.json b/tests/package.json new file mode 100644 index 000000000..93eef065a --- /dev/null +++ b/tests/package.json @@ -0,0 +1,21 @@ +{ + "name": "ethereum-tests", + "version": "1.0.0", + "description": "", + "main": "index.js", + "dependencies": { + "@types/chai": "^4.3.4", + "@types/mocha": "^9.0.0", + "chai": "^4.3.4", + "mocha": "^8.2.0", + "mocha-steps": "^1.3.0", + "ts-node": "^10.9.1", + "web3": "^1.8.0", + "typescript": "^4.2.4" + }, + "scripts": { + "test": "mocha -r ts-node/register 'tests.ts' --exit" + }, + "author": "", + "license": "ISC" +} diff --git a/tests/tests.ts b/tests/tests.ts new file mode 100644 index 000000000..dc2fcf75d --- /dev/null +++ b/tests/tests.ts @@ -0,0 +1,10 @@ +// Make sure that the tests are performed in the correct order. +import "./ethereum/test-code"; +import "./ethereum/test-balance"; +import "./ethereum/test-nonce"; +import "./ethereum/test-contract"; +import "./ethereum/test-constants"; +import "./ethereum/test-block"; +import "./ethereum/test-opcodes"; +import "./ethereum/test-events"; +import "./ethereum/test-gas"; diff --git a/tests/tsconfig.json b/tests/tsconfig.json new file mode 100644 index 000000000..78401223f --- /dev/null +++ b/tests/tsconfig.json @@ -0,0 +1,9 @@ +{ + "compilerOptions": { + "target": "ES2020", + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "skipLibCheck": true, + "moduleResolution": "Node" + } +} From dae3f31e67dec5346eb933967469b4ae8dce0c8d Mon Sep 17 00:00:00 2001 From: bear Date: Thu, 2 Feb 2023 17:39:51 +0800 Subject: [PATCH 123/189] Use `impl_self_contained_call` (#250) --- runtime/common/src/lib.rs | 74 +++++++++++++++++++++++++++++++++++++ runtime/crab/src/lib.rs | 62 +------------------------------ runtime/darwinia/src/lib.rs | 64 +------------------------------- runtime/pangolin/src/lib.rs | 62 +------------------------------ 4 files changed, 78 insertions(+), 184 deletions(-) diff --git a/runtime/common/src/lib.rs b/runtime/common/src/lib.rs index 4a070a3ef..5bb1198cd 100644 --- a/runtime/common/src/lib.rs +++ b/runtime/common/src/lib.rs @@ -86,3 +86,77 @@ pub const fn darwinia_deposit(items: u32, bytes: u32) -> Balance { items as Balance * 100 * UNIT + (bytes as Balance) * 100 * MICROUNIT // items as Balance * 100 * UNIT + (bytes as Balance) * 100 * MILLIUNIT } + +#[macro_export] +macro_rules! impl_self_contained_call { + () => { + impl fp_self_contained::SelfContainedCall for RuntimeCall { + type SignedInfo = H160; + + fn is_self_contained(&self) -> bool { + match self { + RuntimeCall::Ethereum(call) => call.is_self_contained(), + _ => false, + } + } + + fn check_self_contained( + &self, + ) -> Option< + Result< + Self::SignedInfo, + sp_runtime::transaction_validity::TransactionValidityError, + >, + > { + match self { + RuntimeCall::Ethereum(call) => call.check_self_contained(), + _ => None, + } + } + + fn validate_self_contained( + &self, + info: &Self::SignedInfo, + dispatch_info: &sp_runtime::traits::DispatchInfoOf, + len: usize, + ) -> Option { + match self { + RuntimeCall::Ethereum(call) => + call.validate_self_contained(info, dispatch_info, len), + _ => None, + } + } + + fn pre_dispatch_self_contained( + &self, + info: &Self::SignedInfo, + dispatch_info: &sp_runtime::traits::DispatchInfoOf, + len: usize, + ) -> Option> { + match self { + RuntimeCall::Ethereum(call) => + call.pre_dispatch_self_contained(info, dispatch_info, len), + _ => None, + } + } + + fn apply_self_contained( + self, + info: Self::SignedInfo, + ) -> Option< + sp_runtime::DispatchResultWithInfo>, + > { + // substrate + use sp_runtime::traits::Dispatchable; + + match self { + call @ RuntimeCall::Ethereum(pallet_ethereum::Call::transact { .. }) => + Some(call.dispatch(RuntimeOrigin::from( + pallet_ethereum::RawOrigin::EthereumTransaction(info), + ))), + _ => None, + } + } + } + }; +} diff --git a/runtime/crab/src/lib.rs b/runtime/crab/src/lib.rs index b71616cad..5be6235e2 100644 --- a/runtime/crab/src/lib.rs +++ b/runtime/crab/src/lib.rs @@ -144,67 +144,7 @@ where } } -impl fp_self_contained::SelfContainedCall for RuntimeCall { - type SignedInfo = H160; - - fn is_self_contained(&self) -> bool { - match self { - RuntimeCall::Ethereum(call) => call.is_self_contained(), - _ => false, - } - } - - fn check_self_contained( - &self, - ) -> Option> - { - match self { - RuntimeCall::Ethereum(call) => call.check_self_contained(), - _ => None, - } - } - - fn validate_self_contained( - &self, - info: &Self::SignedInfo, - dispatch_info: &sp_runtime::traits::DispatchInfoOf, - len: usize, - ) -> Option { - match self { - RuntimeCall::Ethereum(call) => call.validate_self_contained(info, dispatch_info, len), - _ => None, - } - } - - fn pre_dispatch_self_contained( - &self, - info: &Self::SignedInfo, - dispatch_info: &sp_runtime::traits::DispatchInfoOf, - len: usize, - ) -> Option> { - match self { - RuntimeCall::Ethereum(call) => - call.pre_dispatch_self_contained(info, dispatch_info, len), - _ => None, - } - } - - fn apply_self_contained( - self, - info: Self::SignedInfo, - ) -> Option>> { - // substrate - use sp_runtime::traits::Dispatchable; - - match self { - call @ RuntimeCall::Ethereum(pallet_ethereum::Call::transact { .. }) => - Some(call.dispatch(RuntimeOrigin::from( - pallet_ethereum::RawOrigin::EthereumTransaction(info), - ))), - _ => None, - } - } -} +impl_self_contained_call!(); /// The version information used to identify this runtime when compiled natively. #[cfg(feature = "std")] diff --git a/runtime/darwinia/src/lib.rs b/runtime/darwinia/src/lib.rs index d7106e742..f0b213f0d 100644 --- a/runtime/darwinia/src/lib.rs +++ b/runtime/darwinia/src/lib.rs @@ -144,74 +144,14 @@ where } } -impl fp_self_contained::SelfContainedCall for RuntimeCall { - type SignedInfo = H160; - - fn is_self_contained(&self) -> bool { - match self { - RuntimeCall::Ethereum(call) => call.is_self_contained(), - _ => false, - } - } - - fn check_self_contained( - &self, - ) -> Option> - { - match self { - RuntimeCall::Ethereum(call) => call.check_self_contained(), - _ => None, - } - } - - fn validate_self_contained( - &self, - info: &Self::SignedInfo, - dispatch_info: &sp_runtime::traits::DispatchInfoOf, - len: usize, - ) -> Option { - match self { - RuntimeCall::Ethereum(call) => call.validate_self_contained(info, dispatch_info, len), - _ => None, - } - } - - fn pre_dispatch_self_contained( - &self, - info: &Self::SignedInfo, - dispatch_info: &sp_runtime::traits::DispatchInfoOf, - len: usize, - ) -> Option> { - match self { - RuntimeCall::Ethereum(call) => - call.pre_dispatch_self_contained(info, dispatch_info, len), - _ => None, - } - } - - fn apply_self_contained( - self, - info: Self::SignedInfo, - ) -> Option>> { - // substrate - use sp_runtime::traits::Dispatchable; - - match self { - call @ RuntimeCall::Ethereum(pallet_ethereum::Call::transact { .. }) => - Some(call.dispatch(RuntimeOrigin::from( - pallet_ethereum::RawOrigin::EthereumTransaction(info), - ))), - _ => None, - } - } -} - /// The version information used to identify this runtime when compiled natively. #[cfg(feature = "std")] pub fn native_version() -> NativeVersion { NativeVersion { runtime_version: VERSION, can_author_with: Default::default() } } +impl_self_contained_call!(); + // Create the runtime by composing the FRAME pallets that were previously configured. frame_support::construct_runtime! { pub enum Runtime where diff --git a/runtime/pangolin/src/lib.rs b/runtime/pangolin/src/lib.rs index 85befb0c5..c59b40a89 100644 --- a/runtime/pangolin/src/lib.rs +++ b/runtime/pangolin/src/lib.rs @@ -141,67 +141,7 @@ where } } -impl fp_self_contained::SelfContainedCall for RuntimeCall { - type SignedInfo = H160; - - fn is_self_contained(&self) -> bool { - match self { - RuntimeCall::Ethereum(call) => call.is_self_contained(), - _ => false, - } - } - - fn check_self_contained( - &self, - ) -> Option> - { - match self { - RuntimeCall::Ethereum(call) => call.check_self_contained(), - _ => None, - } - } - - fn validate_self_contained( - &self, - info: &Self::SignedInfo, - dispatch_info: &sp_runtime::traits::DispatchInfoOf, - len: usize, - ) -> Option { - match self { - RuntimeCall::Ethereum(call) => call.validate_self_contained(info, dispatch_info, len), - _ => None, - } - } - - fn pre_dispatch_self_contained( - &self, - info: &Self::SignedInfo, - dispatch_info: &sp_runtime::traits::DispatchInfoOf, - len: usize, - ) -> Option> { - match self { - RuntimeCall::Ethereum(call) => - call.pre_dispatch_self_contained(info, dispatch_info, len), - _ => None, - } - } - - fn apply_self_contained( - self, - info: Self::SignedInfo, - ) -> Option>> { - // substrate - use sp_runtime::traits::Dispatchable; - - match self { - call @ RuntimeCall::Ethereum(pallet_ethereum::Call::transact { .. }) => - Some(call.dispatch(RuntimeOrigin::from( - pallet_ethereum::RawOrigin::EthereumTransaction(info), - ))), - _ => None, - } - } -} +impl_self_contained_call!(); /// The version information used to identify this runtime when compiled natively. #[cfg(feature = "std")] From aa17f3e554dcc79d3dafca4bd86f47776409f528 Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Fri, 3 Feb 2023 00:15:23 +0800 Subject: [PATCH 124/189] Rebuild account reference counters (#249) * Rebuild account reference counters part.1 * part.2 * part.3 * TODO * Fix * Fixes Signed-off-by: Xavier Lau * Doc --------- Signed-off-by: Xavier Lau --- tool/state-processor/src/identity/mod.rs | 2 +- tool/state-processor/src/main.rs | 5 +- tool/state-processor/src/processor.rs | 71 +++++++++++------------ tool/state-processor/src/session/mod.rs | 23 -------- tool/state-processor/src/staking/mod.rs | 7 +++ tool/state-processor/src/system/README.md | 8 +-- tool/state-processor/src/system/mod.rs | 50 ++++------------ tool/state-processor/src/tests.rs | 3 +- tool/state-processor/src/util.rs | 4 -- 9 files changed, 61 insertions(+), 112 deletions(-) delete mode 100644 tool/state-processor/src/session/mod.rs diff --git a/tool/state-processor/src/identity/mod.rs b/tool/state-processor/src/identity/mod.rs index 385ada5ac..13225904b 100644 --- a/tool/state-processor/src/identity/mod.rs +++ b/tool/state-processor/src/identity/mod.rs @@ -38,7 +38,7 @@ where }) }); - self.shell_state.reserve(a, r + rj); + self.shell_state.reserve(&a, r + rj); self.shell_state.insert_value(b"AccountMigration", b"Identities", &k, v); }); diff --git a/tool/state-processor/src/main.rs b/tool/state-processor/src/main.rs index add7898e3..b64393358 100644 --- a/tool/state-processor/src/main.rs +++ b/tool/state-processor/src/main.rs @@ -16,7 +16,6 @@ use type_registry::*; mod balances; mod evm; mod identity; -mod session; mod staking; mod system; mod vesting; @@ -32,10 +31,10 @@ fn main() -> Result<()> { pretty_env_logger::init(); // >::new()?.process().save()?; - >::new()?.test().process().save()?; + // >::new()?.test().process().save()?; // >::new()?.process().save()?; // >::new()?.test().process().save()?; - // >::new()?.process().save()?; + >::new()?.process().save()?; // >::new()?.test().process().save()?; // >::new()?.process().save()?; // >::new()?.test().process().save()?; diff --git a/tool/state-processor/src/processor.rs b/tool/state-processor/src/processor.rs index 26948919c..0c3b86355 100644 --- a/tool/state-processor/src/processor.rs +++ b/tool/state-processor/src/processor.rs @@ -11,7 +11,7 @@ use std::{ use crate::*; // crates.io use anyhow::Result; -use fxhash::{FxHashMap, FxHashSet}; +use fxhash::FxHashMap; use once_cell::sync::Lazy; use parity_scale_codec::{Decode, Encode}; use serde::de::DeserializeOwned; @@ -19,7 +19,6 @@ use serde_json::Value; // hack-ink use subspector::ChainSpec; -pub type Set = FxHashSet; pub type Map = FxHashMap; pub static NOW: Lazy> = Lazy::new(|| RwLock::new(0)); @@ -193,23 +192,6 @@ impl State { self.map.keys().into_iter().any(|k| k.starts_with(&item_key(pallet, item))) } - pub fn reserve(&mut self, account_id_32: A, amount: u128) - where - A: AsRef<[u8]>, - { - let account_id_32 = account_id_32.as_ref(); - let (p, i, h) = if is_evm_address(account_id_32) { - (&b"System"[..], &b"Account"[..], &account_id_32[11..31]) - } else { - (&b"AccountMigration"[..], &b"Accounts"[..], account_id_32) - }; - - self.mutate_value(p, i, &blake2_128_concat_to_string(h), |a: &mut AccountInfo| { - a.data.free -= amount; - a.data.reserved += amount; - }); - } - pub fn take_raw_map( &mut self, prefix: &str, @@ -232,23 +214,6 @@ impl State { self } - pub fn take_keys(&mut self, prefix: &str, keys: &mut Set, process_key: F) -> &mut Self - where - F: Fn(&str, &str) -> String, - { - self.map.retain(|k, _| { - if k.starts_with(prefix) { - keys.insert(process_key(k, prefix)); - - false - } else { - true - } - }); - - self - } - pub fn take_value( &mut self, pallet: &[u8], @@ -336,6 +301,40 @@ impl State { self } + + fn mutate_account(&mut self, account_id_32: &str, f: F) + where + F: FnOnce(&mut AccountInfo), + { + let account_id_32 = array_bytes::hex2array_unchecked::<_, 32>(account_id_32); + let (p, i, h) = if is_evm_address(&account_id_32) { + (&b"System"[..], &b"Account"[..], &account_id_32[11..31]) + } else { + (&b"AccountMigration"[..], &b"Accounts"[..], &account_id_32[..]) + }; + + self.mutate_value(p, i, &blake2_128_concat_to_string(h), f); + } + + pub fn inc_consumers_by(&mut self, account_id_32: &str, x: RefCount) { + self.mutate_account(account_id_32, |a| a.consumers += x); + } + + pub fn reserve(&mut self, account_id_32: &str, amount: u128) { + self.mutate_account(account_id_32, |a| { + if a.data.free < amount { + log::warn!( + "`Account({account_id_32})` can't afford the latest runtime reservation amount" + ); + + a.data.reserved += a.data.free; + a.data.free = 0; + } else { + a.data.free -= amount; + a.data.reserved += amount; + } + }); + } } pub fn from_file(path: &str) -> Result diff --git a/tool/state-processor/src/session/mod.rs b/tool/state-processor/src/session/mod.rs deleted file mode 100644 index c7d3c4d55..000000000 --- a/tool/state-processor/src/session/mod.rs +++ /dev/null @@ -1,23 +0,0 @@ -// darwinia -use crate::*; - -impl Processor { - pub fn process_session(&mut self) -> (Set, Set) { - // Session storage items. - // https://github.dev/darwinia-network/substrate/blob/darwinia-v0.12.5/frame/session/src/lib.rs#L532 - - let prefix = item_key(b"Session", b"NextKeys"); - - let mut s_keys = Set::default(); - let mut p_keys = Set::default(); - - self.solo_state.take_keys(&prefix, &mut s_keys, |k, _| { - blake2_128_concat_to_string(key_to_account32(k)) - }); - self.para_state.take_keys(&prefix, &mut p_keys, |k, _| { - blake2_128_concat_to_string(key_to_account32(k)) - }); - - (s_keys, p_keys) - } -} diff --git a/tool/state-processor/src/staking/mod.rs b/tool/state-processor/src/staking/mod.rs index 1cdd19539..3cb20472f 100644 --- a/tool/state-processor/src/staking/mod.rs +++ b/tool/state-processor/src/staking/mod.rs @@ -30,9 +30,12 @@ impl Processor { let hash_k = blake2_128_concat_to_string(v.stash); let deposit_k = format!("{deposit_ik}{hash_k}"); let staking_k = format!("{staking_ik}{hash_k}"); + let mut consumers = 1; let mut staked_deposits = Vec::default(); if !v.deposit_items.is_empty() { + consumers += 1; + let mut deposit_ring = Balance::default(); self.shell_state.insert_raw_key_value( @@ -61,6 +64,10 @@ impl Processor { ring_pool += v.active; kton_pool += v.active_kton; + // Some accounts were killed. + // But their staking data didn't get deleted. + // TODO: https://github.com/darwinia-network/darwinia-2.0/issues/6 + self.shell_state.inc_consumers_by(&array_bytes::bytes2hex("", v.stash), consumers); self.shell_state.insert_raw_key_value( staking_k, Ledger { diff --git a/tool/state-processor/src/system/README.md b/tool/state-processor/src/system/README.md index 9467e4973..079a365f5 100644 --- a/tool/state-processor/src/system/README.md +++ b/tool/state-processor/src/system/README.md @@ -11,11 +11,11 @@ - take para `Balances::TotalIssuance` and `Balances::Locks` - there should not be any locks on parachain - check if there are any other locks -- decrease pallet-session account references -- use all previous data to build the new accounts and calculate total issuances +- burn parachain backing ring +- build the new accounts and calculate total issuances - merge solo and para account infos - - how to deal with the account references? - TODO - - burn parachain backing ring + - reset account reference counters + - increase `EVM::AccountCodes`'s `sufficients` - set `Balances::TotalIssuance` - compare the calculated one with the storage one - remove para backing account diff --git a/tool/state-processor/src/system/mod.rs b/tool/state-processor/src/system/mod.rs index 6a416e554..fa913f9e9 100644 --- a/tool/state-processor/src/system/mod.rs +++ b/tool/state-processor/src/system/mod.rs @@ -6,9 +6,6 @@ use crate::*; #[derive(Debug)] pub struct AccountAll { pub nonce: u32, - pub consumers: RefCount, - pub providers: RefCount, - pub sufficients: RefCount, pub ring: Balance, pub ring_locks: Vec, pub kton: Balance, @@ -22,31 +19,13 @@ where pub fn process_system(&mut self) -> &mut Self { // System storage items. // https://github.dev/darwinia-network/substrate/blob/darwinia-v0.12.5/frame/system/src/lib.rs#L545 - let mut solo_account_infos = self.process_solo_account_infos(); - let mut para_account_infos = self.process_para_account_infos(); + let solo_account_infos = self.process_solo_account_infos(); + let para_account_infos = self.process_para_account_infos(); let (ring_total_issuance_storage, kton_total_issuance_storage) = self.process_balances(); - let (solo_validators, para_collators) = self.process_session(); let mut accounts = Map::default(); let mut ring_total_issuance = Balance::default(); let mut kton_total_issuance = Balance::default(); - // Skip for testnets, due to https://github.com/paritytech/substrate/issues/13172. - // log::info!("decrease solo pallet-session account references"); - // solo_validators.into_iter().for_each(|k| { - // if let Some(a) = solo_account_infos.get_mut(&k) { - // a.consumers -= 1; - // } - // }); - - // Skip, due to https://github.com/paritytech/substrate/issues/13172. - // log::info!("decrease para pallet-session account references"); - // para_collators.into_iter().for_each(|k| { - // if let Some(a) = para_account_infos.get_mut(&k) { - // dbg!(get_last_64(&k)); - // a.consumers -= 1; - // } - // }); - log::info!("build accounts"); log::info!("calculate total issuance"); solo_account_infos.into_iter().for_each(|(k, v)| { @@ -57,12 +36,6 @@ where k, AccountAll { nonce: v.nonce, - // --- - // TODO: check if we could ignore para's. - consumers: v.consumers, - providers: v.providers, - sufficients: v.sufficients, - // --- ring, ring_locks: Default::default(), kton, @@ -84,9 +57,6 @@ where }) .or_insert(AccountAll { nonce: v.nonce, - consumers: v.consumers, - providers: v.providers, - sufficients: v.sufficients, ring, ring_locks: Default::default(), kton: Default::default(), @@ -128,14 +98,15 @@ where is_frozen: false, }; - log::info!("fix `EVM::AccountCodes`'s `sufficients` and set `Assets::Account`, `System::Account`, `AccountMigration::KtonAccounts` and `AccountMigration::Accounts`"); + log::info!("increase `EVM::AccountCodes`'s `sufficients` and set `Assets::Account`, `System::Account`, `AccountMigration::KtonAccounts` and `AccountMigration::Accounts`"); accounts.into_iter().for_each(|(k, v)| { let key = get_last_64(&k); let mut a = AccountInfo { nonce: v.nonce, - consumers: v.consumers, - providers: v.providers, - sufficients: v.sufficients, + consumers: Default::default(), + // https://github.com/paritytech/substrate/blob/3bc3742d5c0c5269353d7809d9f8f91104a93273/frame/system/src/lib.rs#L1708 + providers: 1, + sufficients: Default::default(), data: AccountData { free: v.ring, reserved: Default::default(), @@ -145,14 +116,12 @@ where }; if let Some(k) = try_get_evm_address(&key) { - // If the evm account is a contract contract with sufficients, then we should - // increase the sufficients by one. + // https://github.dev/paritytech/frontier/blob/ab0f4a47e42ad17e4d8551fb9b3c3a6b4c5df2db/frame/evm/src/lib.rs#L705 if self.solo_state.contains_key(&full_key( b"EVM", b"AccountCodes", &blake2_128_concat_to_string(k), - )) && a.sufficients == 0 - { + )) { a.sufficients += 1; } @@ -276,6 +245,7 @@ fn new_kton_account( asset_details: &mut AssetDetails, balance: Balance, ) -> AssetAccount { + // https://github.com/paritytech/substrate/blob/3bc3742d5c0c5269353d7809d9f8f91104a93273/frame/assets/src/functions.rs#L75 account_info.sufficients += 1; asset_details.accounts += 1; asset_details.sufficients += 1; diff --git a/tool/state-processor/src/tests.rs b/tool/state-processor/src/tests.rs index 2c54d6a09..40445043c 100644 --- a/tool/state-processor/src/tests.rs +++ b/tool/state-processor/src/tests.rs @@ -116,6 +116,7 @@ where // --- System & Balances & Assets --- +// TODO: more testcases about the account references and reservations #[test] fn solo_chain_substrate_account_adjust() { run_test(|tester| { @@ -132,7 +133,7 @@ fn solo_chain_substrate_account_adjust() { // after migrate let migrated_account = tester.migration_accounts.get(test_addr).unwrap(); - assert_eq!(solo_account.consumers, migrated_account.consumers); + assert_eq!(migrated_account.consumers, 2); assert_eq!(solo_account.providers, migrated_account.providers); assert_eq!(solo_account.sufficients + 1, migrated_account.sufficients); // nonce reset diff --git a/tool/state-processor/src/util.rs b/tool/state-processor/src/util.rs index f57f5cf2f..d469aeb6a 100644 --- a/tool/state-processor/src/util.rs +++ b/tool/state-processor/src/util.rs @@ -73,10 +73,6 @@ pub fn is_evm_address(address: &[u8]) -> bool { && address[1..31].iter().fold(address[0], |checksum, &b| checksum ^ b) == address[31] } -pub fn key_to_account32(key: &str) -> [u8; 32] { - array_bytes::hex2array_unchecked(get_last_64(key)) -} - pub fn build_spec(chain: &str) -> Result<()> { log::info!("build {chain} spec"); From 9fc1dad0cafbc0e582bdbe917513f6b18c4423d8 Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Fri, 3 Feb 2023 00:52:33 +0800 Subject: [PATCH 125/189] Add evm checks (#252) * Add evm checks Signed-off-by: Xavier Lau * Fix --------- Signed-off-by: Xavier Lau --- .github/workflows/checks.yml | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index d6bd702e5..b97dafdcd 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -45,8 +45,8 @@ jobs: run: | export SCCACHE_FILE=sccache-${{ env.SCCACHE_VERSION }}-x86_64-unknown-linux-musl curl -L ${{ env.SCCACHE_LINK }}/${{ env.SCCACHE_VERSION }}/$SCCACHE_FILE.tar.gz | tar xz + chmod u+x $SCCACHE_FILE/sccache sudo mv $SCCACHE_FILE/sccache /usr/bin - sudo chmod u+x /usr/bin/sccache - name: Fetch latest code uses: actions/checkout@v3 - name: Cache cargo @@ -112,6 +112,34 @@ jobs: chain: ${{ matrix.target.chain }} compare-with: ${{ matrix.target.compare-with }} + evm-checks: + name: Task check EVM + if: github.event_name == 'push' || !github.event.pull_request.draft + needs: [basic-checks] + runs-on: ubuntu-latest + steps: + - name: Download darwinia + uses: actions/download-artifact@v2 + with: + name: darwinia + - name: Install darwinia + run: | + chmod u+x darwinia + sudo mv darwinia /usr/bin + - name: Launch darwinia + run: darwinia --chain pangolin-dev --tmp --alice & + - name: Install Node 19 + uses: actions/setup-node@v2 + with: + node-version: 19 + - name: Fetch latest code + uses: actions/checkout@v3 + - name: Action test + run: | + cd tests + npm install + npm run test + state-checks: name: Task check state if: github.event_name == 'push' || !github.event.pull_request.draft From 40d7eaabb7371b6fe2eda615ee7837d0b266a2be Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Fri, 3 Feb 2023 10:02:05 +0800 Subject: [PATCH 126/189] Clean empty ledger (#253) Signed-off-by: Xavier Lau --- tool/state-processor/src/staking/README.md | 1 + tool/state-processor/src/staking/mod.rs | 16 +++++++++++----- tool/state-processor/src/type_registry.rs | 8 ++++++++ 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/tool/state-processor/src/staking/README.md b/tool/state-processor/src/staking/README.md index 4726c829d..946224a01 100644 --- a/tool/state-processor/src/staking/README.md +++ b/tool/state-processor/src/staking/README.md @@ -1,4 +1,5 @@ ### Process steps - take solo `Staking::Ledger`, `Staking::RingPool`, `Staking::KtonPool` and `Staking::LivingTime` +- clean empty ledger - adjust decimals and block number, convert ledger, adjust unstaking duration then set `AccountMigration::Ledgers` and `AccountMigration::Deposits` - set `Staking::RingPool` and `Staking::KtonPool` diff --git a/tool/state-processor/src/staking/mod.rs b/tool/state-processor/src/staking/mod.rs index 3cb20472f..7edde7175 100644 --- a/tool/state-processor/src/staking/mod.rs +++ b/tool/state-processor/src/staking/mod.rs @@ -24,7 +24,16 @@ impl Processor { let staking_ik = item_key(b"AccountMigration", b"Ledgers"); let deposit_ik = item_key(b"AccountMigration", b"Deposits"); - ledgers.into_iter().for_each(|(_, mut v)| { + for (_, mut v) in ledgers { + if v.is_empty() { + log::info!( + "clean empty ledger for Account({})", + array_bytes::bytes2hex("0x", v.stash) + ); + + continue; + } + v.adjust(); let hash_k = blake2_128_concat_to_string(v.stash); @@ -64,9 +73,6 @@ impl Processor { ring_pool += v.active; kton_pool += v.active_kton; - // Some accounts were killed. - // But their staking data didn't get deleted. - // TODO: https://github.com/darwinia-network/darwinia-2.0/issues/6 self.shell_state.inc_consumers_by(&array_bytes::bytes2hex("", v.stash), consumers); self.shell_state.insert_raw_key_value( staking_k, @@ -89,7 +95,7 @@ impl Processor { unstaking_deposits: Default::default(), }, ); - }); + } } ring_pool_storage.adjust(); diff --git a/tool/state-processor/src/type_registry.rs b/tool/state-processor/src/type_registry.rs index 57c7e0898..b0517ebb2 100644 --- a/tool/state-processor/src/type_registry.rs +++ b/tool/state-processor/src/type_registry.rs @@ -139,6 +139,14 @@ pub struct StakingLedger { pub kton_staking_lock: StakingLock, pub claimed_rewards: Vec, } +impl StakingLedger { + pub fn is_empty(&self) -> bool { + self.active == 0 + && self.active_deposit_ring == 0 + && self.active_kton == 0 + && self.deposit_items.is_empty() + } +} #[derive(Default, Debug, Encode, Decode)] pub struct TimeDepositItem { #[codec(compact)] From 4d1b188132d94a292467c6c1aaeb0d27fab69fd8 Mon Sep 17 00:00:00 2001 From: bear Date: Fri, 3 Feb 2023 14:42:29 +0800 Subject: [PATCH 127/189] Add bridge extension validation (#251) * Add bridger extension validatioin * Update comments * Revert changes * Fix review --- runtime/crab/src/lib.rs | 17 ++++++++++++++--- runtime/darwinia/src/lib.rs | 17 ++++++++++++++--- runtime/pangolin/src/lib.rs | 4 ++-- 3 files changed, 30 insertions(+), 8 deletions(-) diff --git a/runtime/crab/src/lib.rs b/runtime/crab/src/lib.rs index 5be6235e2..45196de9d 100644 --- a/runtime/crab/src/lib.rs +++ b/runtime/crab/src/lib.rs @@ -75,6 +75,7 @@ pub type SignedExtra = ( frame_system::CheckNonce, frame_system::CheckWeight, pallet_transaction_payment::ChargeTransactionPayment, + BridgeRejectObsoleteHeadersAndMessages, ); /// Unchecked extrinsic type as expected by this runtime. @@ -144,8 +145,6 @@ where } } -impl_self_contained_call!(); - /// The version information used to identify this runtime when compiled natively. #[cfg(feature = "std")] pub fn native_version() -> NativeVersion { @@ -213,7 +212,7 @@ frame_support::construct_runtime! { Evm: pallet_evm = 37, MessageTransact: darwinia_message_transact = 38, - // S2S stuff. + // Crab <> Darwinia BridgePolkadotGrandpa: pallet_bridge_grandpa:: = 39, BridgePolkadotParachain: pallet_bridge_parachains:: = 40, BridgeDarwiniaMessages: pallet_bridge_messages:: = 41, @@ -232,6 +231,18 @@ frame_benchmarking::define_benchmarks! { [cumulus_pallet_xcmp_queue, XcmpQueue] } +impl_self_contained_call!(); + +bridge_runtime_common::generate_bridge_reject_obsolete_headers_and_messages! { + RuntimeCall, AccountId, + // Grandpa + BridgePolkadotGrandpa, + // Messages + BridgeDarwiniaMessages, + // Parachain + BridgePolkadotParachain +} + sp_api::impl_runtime_apis! { impl sp_consensus_aura::AuraApi for Runtime { fn slot_duration() -> sp_consensus_aura::SlotDuration { diff --git a/runtime/darwinia/src/lib.rs b/runtime/darwinia/src/lib.rs index f0b213f0d..bddc318e9 100644 --- a/runtime/darwinia/src/lib.rs +++ b/runtime/darwinia/src/lib.rs @@ -75,6 +75,7 @@ pub type SignedExtra = ( frame_system::CheckNonce, frame_system::CheckWeight, pallet_transaction_payment::ChargeTransactionPayment, + BridgeRejectObsoleteHeadersAndMessages, ); /// Unchecked extrinsic type as expected by this runtime. @@ -150,8 +151,6 @@ pub fn native_version() -> NativeVersion { NativeVersion { runtime_version: VERSION, can_author_with: Default::default() } } -impl_self_contained_call!(); - // Create the runtime by composing the FRAME pallets that were previously configured. frame_support::construct_runtime! { pub enum Runtime where @@ -213,7 +212,7 @@ frame_support::construct_runtime! { Evm: pallet_evm = 37, MessageTransact: darwinia_message_transact = 38, - // S2S stuff. + // Darwinia <> Crab BridgeKusamaGrandpa: pallet_bridge_grandpa:: = 39, BridgeKusamaParachain: pallet_bridge_parachains:: = 40, BridgeCrabMessages: pallet_bridge_messages:: = 41, @@ -232,6 +231,18 @@ frame_benchmarking::define_benchmarks! { [cumulus_pallet_xcmp_queue, XcmpQueue] } +impl_self_contained_call!(); + +bridge_runtime_common::generate_bridge_reject_obsolete_headers_and_messages! { + RuntimeCall, AccountId, + // Grandpa + BridgeKusamaGrandpa, + // Messages + BridgeCrabMessages, + // Parachain + BridgeKusamaParachain +} + sp_api::impl_runtime_apis! { impl sp_consensus_aura::AuraApi for Runtime { fn slot_duration() -> sp_consensus_aura::SlotDuration { diff --git a/runtime/pangolin/src/lib.rs b/runtime/pangolin/src/lib.rs index c59b40a89..fb5b9cbc7 100644 --- a/runtime/pangolin/src/lib.rs +++ b/runtime/pangolin/src/lib.rs @@ -141,8 +141,6 @@ where } } -impl_self_contained_call!(); - /// The version information used to identify this runtime when compiled natively. #[cfg(feature = "std")] pub fn native_version() -> NativeVersion { @@ -222,6 +220,8 @@ frame_benchmarking::define_benchmarks! { [cumulus_pallet_xcmp_queue, XcmpQueue] } +impl_self_contained_call!(); + sp_api::impl_runtime_apis! { impl sp_consensus_aura::AuraApi for Runtime { fn slot_duration() -> sp_consensus_aura::SlotDuration { From 6aa85cdf00b3b4cfcddfd8ee3d20442de4a14858 Mon Sep 17 00:00:00 2001 From: bear Date: Tue, 7 Feb 2023 11:06:26 +0800 Subject: [PATCH 128/189] Add `reserve` and `references count` tests (#259) * Fix TODO * Add reserve test * Add another case * Add more samples * Code clean * Fix local test error --- tool/state-processor/src/tests.rs | 129 ++++++++++++++++++++++++------ 1 file changed, 105 insertions(+), 24 deletions(-) diff --git a/tool/state-processor/src/tests.rs b/tool/state-processor/src/tests.rs index 40445043c..075b4b3aa 100644 --- a/tool/state-processor/src/tests.rs +++ b/tool/state-processor/src/tests.rs @@ -116,36 +116,78 @@ where // --- System & Balances & Assets --- -// TODO: more testcases about the account references and reservations #[test] fn solo_chain_substrate_account_adjust() { run_test(|tester| { - let test_addr = "0xf4171e1b64c96cc17f601f28d002cb5fcd27eab8b6585e296f4652be5bf05550"; + // the purest account + { + let test_addr = "0xcefc2d75238c60c67b4b02867f061a7c36f9b37f625854d4e5daac2cbf58f42d"; + let solo_account = tester.solo_accounts.get(test_addr).unwrap(); + assert_eq!(solo_account.nonce, 0); + assert_eq!(solo_account.consumers, 0); + assert_eq!(solo_account.providers, 1); + assert_eq!(solo_account.sufficients, 0); + assert_ne!(solo_account.data.free, 0); + assert_eq!(solo_account.data.reserved, 0); - let solo_account = tester.solo_accounts.get(test_addr).unwrap(); - assert_ne!(solo_account.nonce, 0); - assert_ne!(solo_account.consumers, 0); - assert_ne!(solo_account.providers, 0); - assert_eq!(solo_account.sufficients, 0); - assert_ne!(solo_account.data.free, 0); - assert_ne!(solo_account.data.free_kton_or_misc_frozen, 0); + // after migrate - // after migrate + let migrated_account = tester.migration_accounts.get(test_addr).unwrap(); + assert_eq!(migrated_account.nonce, 0); + assert_eq!(migrated_account.consumers, 0); + assert_eq!(migrated_account.providers, 1); + assert_eq!(migrated_account.sufficients, 0); + assert_eq!(migrated_account.data.free, solo_account.data.free * GWEI); + assert_eq!(migrated_account.data.reserved, 0); + } - let migrated_account = tester.migration_accounts.get(test_addr).unwrap(); - assert_eq!(migrated_account.consumers, 2); - assert_eq!(solo_account.providers, migrated_account.providers); - assert_eq!(solo_account.sufficients + 1, migrated_account.sufficients); - // nonce reset - assert_eq!(migrated_account.nonce, 0); - // decimal adjust - assert_eq!(solo_account.data.free * GWEI, migrated_account.data.free); - // the kton part has been removed. - assert_eq!(migrated_account.data.free_kton_or_misc_frozen, 0); - // the kton part moved to the asset pallet - let asset_account = tester.migration_kton_accounts.get(test_addr).unwrap(); - assert_eq!(asset_account.balance, solo_account.data.free_kton_or_misc_frozen * GWEI); - assert!(!asset_account.is_frozen); + // account nonce reset + { + let test_addr = "0x82e54b190ef8dbe7864b7cdca3de6b3e8b5483e0a3e9419ba2a41a16531aaa0b"; + let solo_account = tester.solo_accounts.get(test_addr).unwrap(); + assert_ne!(solo_account.nonce, 0); + + // after migrate + + let migrated_account = tester.migration_accounts.get(test_addr).unwrap(); + assert_eq!(migrated_account.nonce, 0); + } + + // account staking without deposit items + { + let test_addr = "0x82e54b190ef8dbe7864b7cdca3de6b3e8b5483e0a3e9419ba2a41a16531aaa0b"; + let solo_account = tester.solo_accounts.get(test_addr).unwrap(); + assert_eq!(solo_account.consumers, 2); + + // after migrate + + let migrated_account = tester.migration_accounts.get(test_addr).unwrap(); + assert_eq!(migrated_account.consumers, 1); + } + + // account has kton with ledger and deposit items + { + let test_addr = "0xf4171e1b64c96cc17f601f28d002cb5fcd27eab8b6585e296f4652be5bf05550"; + let solo_account = tester.solo_accounts.get(test_addr).unwrap(); + assert_eq!(solo_account.consumers, 3); + assert_eq!(solo_account.providers, 1); + assert_eq!(solo_account.sufficients, 0); + assert_ne!(solo_account.data.free, 0); + assert_ne!(solo_account.data.free_kton_or_misc_frozen, 0); + + // after migrate + + let migrated_account = tester.migration_accounts.get(test_addr).unwrap(); + assert_eq!(migrated_account.consumers, 2); + assert_eq!(migrated_account.providers, 1); + assert_eq!(migrated_account.sufficients, 1); + assert_eq!(migrated_account.data.free, solo_account.data.free * GWEI); + assert_eq!(migrated_account.data.free_kton_or_misc_frozen, 0); + // the kton part moved to the asset pallet + let asset_account = tester.migration_kton_accounts.get(test_addr).unwrap(); + assert_eq!(asset_account.balance, solo_account.data.free_kton_or_misc_frozen * GWEI); + assert!(!asset_account.is_frozen); + } }); } @@ -340,6 +382,45 @@ fn asset_metadata() { }); } +#[test] +fn identities_reservation_adjust() { + run_test(|tester| { + { + // https://crab.subscan.io/account/5CXHjmXetspzSTWci8UKXnPjBeJGpibitrWX7fDDMqbggyap + let test_addr = "0x14466f29bc873ce014367d897940e3a4d4a22c1c70d83469bcd7647e921d1557"; + + let solo_account = tester.solo_accounts.get(test_addr).unwrap(); + let remaining = tester.solo_remaining_ring.get(test_addr).unwrap(); + assert_eq!(solo_account.data.reserved, 10000000000); + let total = (solo_account.data.free + solo_account.data.reserved) * GWEI + remaining; + + // after migrate + + let migrated_account = tester.migration_accounts.get(test_addr).unwrap(); + assert_eq!(migrated_account.data.reserved, 100025800000000000000); + assert_eq!(migrated_account.data.reserved + migrated_account.data.free, total); + } + + // can not afford the latest reservation amount + { + // https://crab.subscan.io/account/5HTysESF4MCRABBJ2Pmm8Sx3JrJToQgz1nwiBctGXGUKZLeP + let test_addr = "0xeeedb4805e781b16db87edc6fc2bb0982bf70a435e6a5acac37ede09131d8b8b"; + + let solo_account = tester.solo_accounts.get(test_addr).unwrap(); + assert_ne!(solo_account.data.free, 0); + assert_eq!(solo_account.data.reserved, 10000000000); + let total = (solo_account.data.free + solo_account.data.reserved) * GWEI; + + // after migrate + + let migrated_account = tester.migration_accounts.get(test_addr).unwrap(); + assert_eq!(migrated_account.data.free, 0); + assert_eq!(migrated_account.data.reserved, 10800000000000000000); + assert_eq!(migrated_account.data.reserved + migrated_account.data.free, total); + } + }); +} + // --- EVM & Ethereum --- #[test] From 7ecbe101f518897ebb69e48a2687961cf6732cef Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Tue, 7 Feb 2023 15:59:59 +0800 Subject: [PATCH 129/189] Handle special accounts (#265) * Handle special accounts * Refactor * More readable * Doc --- tool/state-processor/Cargo.lock | 1111 ++++++++++++++++++++- tool/state-processor/Cargo.toml | 7 +- tool/state-processor/src/configuration.rs | 2 +- tool/state-processor/src/system/README.md | 9 +- tool/state-processor/src/system/mod.rs | 69 +- 5 files changed, 1177 insertions(+), 21 deletions(-) diff --git a/tool/state-processor/Cargo.lock b/tool/state-processor/Cargo.lock index 63dbca8c3..c0df62a34 100644 --- a/tool/state-processor/Cargo.lock +++ b/tool/state-processor/Cargo.lock @@ -2,12 +2,27 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "Inflector" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" + [[package]] name = "adler" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +[[package]] +name = "affix" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50e7ea84d3fa2009f355f8429a0b418a96849135a4188fadf384f59127d5d4bc" +dependencies = [ + "convert_case 0.5.0", +] + [[package]] name = "aho-corasick" version = "0.7.20" @@ -23,6 +38,17 @@ version = "1.0.68" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2cb2f989d18dd141ab8ae82f64d1a8cdd37e0840f73a406896cf5e99502fab61" +[[package]] +name = "api-impl" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6666c6e6cf290a2ad45a37a4cdf4d7649cce3dcfc99f551d9dfc982987697ee6" +dependencies = [ + "convert_case 0.6.0", + "quote", + "syn", +] + [[package]] name = "array-bytes" version = "6.0.0" @@ -44,13 +70,24 @@ version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +[[package]] +name = "async-trait" +version = "0.1.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cd7fce9ba8c3c042128ce72d8b2ddbf3a05747efb67ea0313c635e10bda47a2" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "atty" version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" dependencies = [ - "hermit-abi", + "hermit-abi 0.1.19", "libc", "winapi", ] @@ -61,12 +98,24 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +[[package]] +name = "base58" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6107fe1be6682a68940da878d9e9f5e90ca5745b3dec9fd1bb393c8777d4f581" + [[package]] name = "base64" version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" +[[package]] +name = "base64" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4a4ddaa51a5bc52a6948f74c06d20aaaddb71924eab79b8c97a8c556e942d6a" + [[package]] name = "bitflags" version = "1.3.2" @@ -122,6 +171,54 @@ version = "1.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" +[[package]] +name = "bytes" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" + +[[package]] +name = "camino" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c77df041dc383319cc661b428b6961a005db4d6808d5e12536931b1ca9556055" +dependencies = [ + "serde", +] + +[[package]] +name = "cargo-platform" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cbdb825da8a5df079a43676dbe042702f1707b1109f713a01420fbb4cc71fa27" +dependencies = [ + "serde", +] + +[[package]] +name = "cargo_metadata" +version = "0.15.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08a1ec454bc3eead8719cb56e15dbbfecdbc14e4b3a3ae4936cc6e31f5fc0d07" +dependencies = [ + "camino", + "cargo-platform", + "semver", + "serde", + "serde_json", + "thiserror", +] + +[[package]] +name = "cargo_toml" +version = "0.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "189929343288eb08d1f418bfbc022a5bddc6889e4a8f8dfaf06035fd3adf6fed" +dependencies = [ + "serde", + "toml", +] + [[package]] name = "cc" version = "1.0.79" @@ -143,6 +240,37 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" +[[package]] +name = "convert_case" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb4a24b1aaf0fd0ce8b45161144d6f42cd91677fd5940fd431183eb023b3a2b8" + +[[package]] +name = "convert_case" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec182b0ca2f35d8fc196cf3404988fd8b8c739a4d270ff118a398feb0cbec1ca" +dependencies = [ + "unicode-segmentation", +] + +[[package]] +name = "core-foundation" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" + [[package]] name = "cpufeatures" version = "0.2.5" @@ -181,6 +309,17 @@ dependencies = [ name = "dc-types" version = "6.0.0" +[[package]] +name = "derive_more" +version = "0.99.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "digest" version = "0.10.6" @@ -191,6 +330,15 @@ dependencies = [ "crypto-common", ] +[[package]] +name = "encoding_rs" +version = "0.8.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071a31f4ee85403370b58aca746f01041ede6f0da2730960ad001edc2b71b394" +dependencies = [ + "cfg-if", +] + [[package]] name = "enumflags2" version = "0.7.5" @@ -224,6 +372,15 @@ dependencies = [ "termcolor", ] +[[package]] +name = "fastrand" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7a407cfaa3385c4ae6b23e84623d48c2798d06e3e6a1878f7f59f17b3f86499" +dependencies = [ + "instant", +] + [[package]] name = "filetime" version = "0.2.19" @@ -258,6 +415,27 @@ dependencies = [ "miniz_oxide", ] +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + [[package]] name = "form_urlencoded" version = "1.1.0" @@ -267,12 +445,113 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "frame-metadata" +version = "15.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df6bb8542ef006ef0de09a5c4420787d79823c0ed7924225822362fd2bf2ff2d" +dependencies = [ + "cfg-if", + "parity-scale-codec", + "scale-info", + "serde", +] + [[package]] name = "funty" version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" +[[package]] +name = "futures" +version = "0.3.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13e2792b0ff0340399d58445b88fd9770e3489eff258a4cbc1523418f12abf84" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e5317663a9089767a1ec00a487df42e0ca174b61b4483213ac24448e4664df5" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec90ff4d0fe1f57d600049061dc6bb68ed03c7d2fbd697274c41805dcb3f8608" + +[[package]] +name = "futures-executor" +version = "0.3.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8de0a35a6ab97ec8869e32a2473f4b1324459e14c29275d14b10cb1fd19b50e" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfb8371b6fb2aeb2d280374607aeabfc99d95c72edfe51692e42d3d7f0d08531" + +[[package]] +name = "futures-macro" +version = "0.3.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95a73af87da33b5acf53acfebdc339fe592ecf5357ac7c0a7734ab9d8c876a70" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "futures-sink" +version = "0.3.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f310820bb3e8cfd46c80db4d7fb8353e15dfff853a127158425f31e0be6c8364" + +[[package]] +name = "futures-task" +version = "0.3.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcf79a1bf610b10f42aea489289c5a2c478a786509693b80cd39c44ccd936366" + +[[package]] +name = "futures-util" +version = "0.3.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c1d6de3acfef38d2be4b1f543f553131788603495be83da675e180c8d6b7bd1" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "slab", +] + [[package]] name = "fxhash" version = "0.2.1" @@ -303,6 +582,34 @@ dependencies = [ "wasi", ] +[[package]] +name = "githuber" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b2e5ef09790481908cbfda99ef764f571e28e0a1466bba1419588dd3fd04fb2" +dependencies = [ + "api-impl", +] + +[[package]] +name = "h2" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f9f29bc9dda355256b2916cf526ab02ce0aeaaaf2bad60d65ef3f12f11dd0f4" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http", + "indexmap", + "slab", + "tokio", + "tokio-util", + "tracing", +] + [[package]] name = "hashbrown" version = "0.12.3" @@ -318,12 +625,55 @@ dependencies = [ "libc", ] +[[package]] +name = "hermit-abi" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" +dependencies = [ + "libc", +] + [[package]] name = "hex" version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +[[package]] +name = "http" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75f43d41e26995c17e71ee126451dd3941010b0514a81a9d11f3b341debc2399" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http-body" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" +dependencies = [ + "bytes", + "http", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" + +[[package]] +name = "httpdate" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" + [[package]] name = "humantime" version = "1.3.0" @@ -333,6 +683,43 @@ dependencies = [ "quick-error", ] +[[package]] +name = "hyper" +version = "0.14.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e011372fa0b68db8350aa7a248930ecc7839bf46d8485577d69f117a75f164c" +dependencies = [ + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", + "want", +] + +[[package]] +name = "hyper-tls" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" +dependencies = [ + "bytes", + "hyper", + "native-tls", + "tokio", + "tokio-native-tls", +] + [[package]] name = "idna" version = "0.3.0" @@ -373,6 +760,21 @@ dependencies = [ "hashbrown", ] +[[package]] +name = "instant" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "ipnet" +version = "2.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30e22bd8629359895450b59ea7a776c850561b96a3b1d31321c1949d9e6c9146" + [[package]] name = "itoa" version = "1.0.5" @@ -397,6 +799,12 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + [[package]] name = "libc" version = "0.2.139" @@ -418,6 +826,12 @@ version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" +[[package]] +name = "mime" +version = "0.3.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" + [[package]] name = "miniz_oxide" version = "0.6.2" @@ -427,6 +841,36 @@ dependencies = [ "adler", ] +[[package]] +name = "mio" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5d732bc30207a6423068df043e3d02e0735b155ad7ce1a6f76fe2baa5b158de" +dependencies = [ + "libc", + "log", + "wasi", + "windows-sys", +] + +[[package]] +name = "native-tls" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e" +dependencies = [ + "lazy_static", + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", +] + [[package]] name = "nodrop" version = "0.1.14" @@ -443,14 +887,79 @@ dependencies = [ ] [[package]] -name = "once_cell" -version = "1.17.0" +name = "num-format" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66" +checksum = "a652d9771a63711fd3c3deb670acfbe5c30a4072e664d7a3bf5a9e1056ac72c3" +dependencies = [ + "arrayvec 0.7.2", + "itoa", +] [[package]] -name = "parity-scale-codec" -version = "3.3.0" +name = "num_cpus" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b" +dependencies = [ + "hermit-abi 0.2.6", + "libc", +] + +[[package]] +name = "once_cell" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66" + +[[package]] +name = "openssl" +version = "0.10.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b102428fd03bc5edf97f62620f7298614c45cedf287c271e7ed450bbaf83f2e1" +dependencies = [ + "bitflags", + "cfg-if", + "foreign-types", + "libc", + "once_cell", + "openssl-macros", + "openssl-sys", +] + +[[package]] +name = "openssl-macros" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b501e44f11665960c7e7fcf062c7d96a14ade4aa98116c004b2e37b5be7d736c" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "openssl-probe" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" + +[[package]] +name = "openssl-sys" +version = "0.9.80" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23bbbf7854cd45b83958ebe919f0e8e516793727652e27fda10a8384cfc790b7" +dependencies = [ + "autocfg", + "cc", + "libc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "parity-scale-codec" +version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3840933452adf7b3b9145e27086a5a3376c619dca1a21b1e5a5af0d54979bed" dependencies = [ @@ -480,6 +989,18 @@ version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" +[[package]] +name = "pin-project-lite" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + [[package]] name = "pkg-config" version = "0.3.26" @@ -520,7 +1041,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "66618389e4ec1c7afe67d51a9bf34ff9236480f8d51e7489b7d5ab0303c13f34" dependencies = [ "once_cell", - "toml_edit", + "toml_edit 0.18.1", ] [[package]] @@ -609,6 +1130,52 @@ version = "0.6.28" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" +[[package]] +name = "remove_dir_all" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" +dependencies = [ + "winapi", +] + +[[package]] +name = "reqwest" +version = "0.11.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21eed90ec8570952d53b772ecf8f206aa1ec9a3d76b2521c56c42973f2d91ee9" +dependencies = [ + "base64 0.21.0", + "bytes", + "encoding_rs", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "hyper", + "hyper-tls", + "ipnet", + "js-sys", + "log", + "mime", + "native-tls", + "once_cell", + "percent-encoding", + "pin-project-lite", + "serde", + "serde_json", + "serde_urlencoded", + "tokio", + "tokio-native-tls", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "winreg", +] + [[package]] name = "ring" version = "0.16.20" @@ -642,12 +1209,68 @@ dependencies = [ "webpki", ] +[[package]] +name = "rustls-native-certs" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0167bac7a9f490495f3c33013e7722b53cb087ecbe082fb0c6387c96f634ea50" +dependencies = [ + "openssl-probe", + "rustls-pemfile", + "schannel", + "security-framework", +] + +[[package]] +name = "rustls-pemfile" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d194b56d58803a43635bdc398cd17e383d6f71f9182b9a192c127ca42494a59b" +dependencies = [ + "base64 0.21.0", +] + [[package]] name = "ryu" version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde" +[[package]] +name = "scale-info" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "001cf62ece89779fd16105b5f515ad0e5cedcd5440d3dd806bb067978e7c3608" +dependencies = [ + "bitvec", + "cfg-if", + "derive_more", + "parity-scale-codec", + "scale-info-derive", + "serde", +] + +[[package]] +name = "scale-info-derive" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "303959cf613a6f6efd19ed4b4ad5bf79966a13352716299ad532cfb115f4205c" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "schannel" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "713cfb06c7059f3588fb8044c0fad1d09e3c01d225e25b9220dbfdcf16dbb1b3" +dependencies = [ + "windows-sys", +] + [[package]] name = "sct" version = "0.7.0" @@ -658,6 +1281,38 @@ dependencies = [ "untrusted", ] +[[package]] +name = "security-framework" +version = "2.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a332be01508d814fed64bf28f798a146d73792121129962fdf335bb3c49a4254" +dependencies = [ + "bitflags", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31c9bb296072e961fcbd8853511dd39c2d8be2deb1e17c6860b1d30732b323b4" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "semver" +version = "1.0.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58bc9567378fc7690d6b2addae4e60ac2eeea07becb2c64b9f218b53865cba2a" +dependencies = [ + "serde", +] + [[package]] name = "serde" version = "1.0.152" @@ -689,6 +1344,38 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_spanned" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0efd8caf556a6cebd3b285caf480045fcc1ac04f6bd786b09a6f11af30c4fcf4" +dependencies = [ + "serde", +] + +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "sha1" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + [[package]] name = "sha2" version = "0.10.6" @@ -700,12 +1387,46 @@ dependencies = [ "digest", ] +[[package]] +name = "slab" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4614a76b2a8be0058caa9dbbaf66d988527d86d003c11a94fbd335d7661edcef" +dependencies = [ + "autocfg", +] + +[[package]] +name = "socket2" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02e2d2db9033d13a1567121ddd7a095ee144db4e1ca1b1bda3419bc0da294ebd" +dependencies = [ + "libc", + "winapi", +] + [[package]] name = "spin" version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" +[[package]] +name = "ss58-registry" +version = "1.38.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e40c020d72bc0a9c5660bb71e4a6fdef081493583062c474740a7d59f55f0e7b" +dependencies = [ + "Inflector", + "num-format", + "proc-macro2", + "quote", + "serde", + "serde_json", + "unicode-xid", +] + [[package]] name = "state-processor" version = "0.0.0" @@ -722,6 +1443,7 @@ dependencies = [ "primitive-types", "serde", "serde_json", + "subalfred-core", "subhasher", "subspector", "substorager", @@ -736,10 +1458,60 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" +[[package]] +name = "subalfred-core" +version = "0.9.1" +source = "git+https://github.com/hack-ink/subalfred#008d042dc7984f13ae3fa76483dafa12fafbc93d" +dependencies = [ + "array-bytes", + "async-trait", + "cargo_metadata", + "cargo_toml", + "futures", + "fxhash", + "githuber", + "once_cell", + "parity-scale-codec", + "regex", + "reqwest", + "serde", + "serde_json", + "subalfred-util", + "subcryptor", + "subhasher", + "submetadatan", + "subrpcer", + "subruntimer", + "subspector", + "substorager", + "subversioner", + "thiserror", + "tokio", + "tokio-stream", + "tokio-tungstenite", + "tracing", +] + +[[package]] +name = "subalfred-util" +version = "0.9.1" +source = "git+https://github.com/hack-ink/subalfred#008d042dc7984f13ae3fa76483dafa12fafbc93d" + +[[package]] +name = "subcryptor" +version = "0.9.1" +source = "git+https://github.com/hack-ink/subalfred#008d042dc7984f13ae3fa76483dafa12fafbc93d" +dependencies = [ + "base58", + "blake2-rfc", + "ss58-registry", + "thiserror", +] + [[package]] name = "subhasher" version = "0.9.1" -source = "git+https://github.com/hack-ink/subalfred#ea4615f1012a197b7d31d8b87a290027a5ecc818" +source = "git+https://github.com/hack-ink/subalfred#008d042dc7984f13ae3fa76483dafa12fafbc93d" dependencies = [ "blake2-rfc", "byteorder", @@ -748,10 +1520,38 @@ dependencies = [ "twox-hash", ] +[[package]] +name = "submetadatan" +version = "0.9.1" +source = "git+https://github.com/hack-ink/subalfred#008d042dc7984f13ae3fa76483dafa12fafbc93d" +dependencies = [ + "frame-metadata", + "scale-info", + "thiserror", +] + +[[package]] +name = "subrpcer" +version = "0.9.1" +source = "git+https://github.com/hack-ink/subalfred#008d042dc7984f13ae3fa76483dafa12fafbc93d" +dependencies = [ + "affix", + "serde", + "serde_json", +] + +[[package]] +name = "subruntimer" +version = "0.9.1" +source = "git+https://github.com/hack-ink/subalfred#008d042dc7984f13ae3fa76483dafa12fafbc93d" +dependencies = [ + "serde", +] + [[package]] name = "subspector" version = "0.9.1" -source = "git+https://github.com/hack-ink/subalfred#ea4615f1012a197b7d31d8b87a290027a5ecc818" +source = "git+https://github.com/hack-ink/subalfred#008d042dc7984f13ae3fa76483dafa12fafbc93d" dependencies = [ "fxhash", "serde", @@ -761,12 +1561,20 @@ dependencies = [ [[package]] name = "substorager" version = "0.9.1" -source = "git+https://github.com/hack-ink/subalfred#ea4615f1012a197b7d31d8b87a290027a5ecc818" +source = "git+https://github.com/hack-ink/subalfred#008d042dc7984f13ae3fa76483dafa12fafbc93d" dependencies = [ "array-bytes", "subhasher", ] +[[package]] +name = "subversioner" +version = "0.9.1" +source = "git+https://github.com/hack-ink/subalfred#008d042dc7984f13ae3fa76483dafa12fafbc93d" +dependencies = [ + "serde", +] + [[package]] name = "syn" version = "1.0.107" @@ -795,6 +1603,20 @@ dependencies = [ "xattr", ] +[[package]] +name = "tempfile" +version = "3.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4" +dependencies = [ + "cfg-if", + "fastrand", + "libc", + "redox_syscall", + "remove_dir_all", + "winapi", +] + [[package]] name = "termcolor" version = "1.2.0" @@ -804,6 +1626,26 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "thiserror" +version = "1.0.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a9cd18aa97d5c45c6603caea1da6628790b37f7a34b6ca89522331c5180fed0" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "tiny-keccak" version = "2.0.2" @@ -828,12 +1670,124 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" +[[package]] +name = "tokio" +version = "1.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8e00990ebabbe4c14c08aca901caed183ecd5c09562a12c824bb53d3c3fd3af" +dependencies = [ + "autocfg", + "bytes", + "libc", + "memchr", + "mio", + "num_cpus", + "pin-project-lite", + "socket2", + "tokio-macros", + "windows-sys", +] + +[[package]] +name = "tokio-macros" +version = "1.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d266c00fde287f55d3f1c3e96c500c362a2b8c695076ec180f27918820bc6df8" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tokio-native-tls" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7d995660bd2b7f8c1568414c1126076c13fbb725c40112dc0120b78eb9b717b" +dependencies = [ + "native-tls", + "tokio", +] + +[[package]] +name = "tokio-rustls" +version = "0.23.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c43ee83903113e03984cb9e5cebe6c04a5116269e900e3ddba8f068a62adda59" +dependencies = [ + "rustls", + "tokio", + "webpki", +] + +[[package]] +name = "tokio-stream" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d660770404473ccd7bc9f8b28494a811bc18542b915c0855c51e8f419d5223ce" +dependencies = [ + "futures-core", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "tokio-tungstenite" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54319c93411147bced34cb5609a80e0a8e44c5999c93903a81cd866630ec0bfd" +dependencies = [ + "futures-util", + "log", + "rustls", + "rustls-native-certs", + "tokio", + "tokio-rustls", + "tungstenite", + "webpki", +] + +[[package]] +name = "tokio-util" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bb2e075f03b3d66d8d8785356224ba688d2906a371015e225beeb65ca92c740" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", + "tracing", +] + +[[package]] +name = "toml" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "772c1426ab886e7362aedf4abc9c0d1348a979517efedfc25862944d10137af0" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime 0.6.1", + "toml_edit 0.19.2", +] + [[package]] name = "toml_datetime" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4553f467ac8e3d374bc9a177a26801e5d0f9b211aa1673fb137a403afd1c9cf5" +[[package]] +name = "toml_datetime" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ab8ed2edee10b50132aed5f331333428b011c99402b5a534154ed15746f9622" +dependencies = [ + "serde", +] + [[package]] name = "toml_edit" version = "0.18.1" @@ -842,7 +1796,85 @@ checksum = "56c59d8dd7d0dcbc6428bf7aa2f0e823e26e43b3c9aca15bbc9475d23e5fa12b" dependencies = [ "indexmap", "nom8", - "toml_datetime", + "toml_datetime 0.5.1", +] + +[[package]] +name = "toml_edit" +version = "0.19.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f35c303ea3e062b6131be4de16debe23860b9d3f2396658f13b7af1987fb473" +dependencies = [ + "indexmap", + "nom8", + "serde", + "serde_spanned", + "toml_datetime 0.6.1", +] + +[[package]] +name = "tower-service" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" + +[[package]] +name = "tracing" +version = "0.1.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" +dependencies = [ + "cfg-if", + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4017f8f45139870ca7e672686113917c71c7a6e02d4924eda67186083c03081a" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tracing-core" +version = "0.1.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24eb03ba0eab1fd845050058ce5e616558e8f8d8fca633e6b163fe25c797213a" +dependencies = [ + "once_cell", +] + +[[package]] +name = "try-lock" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" + +[[package]] +name = "tungstenite" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30ee6ab729cd4cf0fd55218530c4522ed30b7b6081752839b68fcec8d0960788" +dependencies = [ + "base64 0.13.1", + "byteorder", + "bytes", + "http", + "httparse", + "log", + "rand", + "rustls", + "sha1", + "thiserror", + "url", + "utf-8", + "webpki", ] [[package]] @@ -895,6 +1927,18 @@ dependencies = [ "tinyvec", ] +[[package]] +name = "unicode-segmentation" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" + +[[package]] +name = "unicode-xid" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" + [[package]] name = "untrusted" version = "0.7.1" @@ -907,7 +1951,7 @@ version = "2.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "338b31dd1314f68f3aabf3ed57ab922df95ffcd902476ca7ba3c4ce7b908c46d" dependencies = [ - "base64", + "base64 0.13.1", "flate2", "log", "once_cell", @@ -928,12 +1972,34 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "utf-8" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" + +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +[[package]] +name = "want" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" +dependencies = [ + "log", + "try-lock", +] + [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" @@ -965,6 +2031,18 @@ dependencies = [ "wasm-bindgen-shared", ] +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23639446165ca5a5de86ae1d8896b737ae80319560fbaa4c2887b7da6e7ebd7d" +dependencies = [ + "cfg-if", + "js-sys", + "wasm-bindgen", + "web-sys", +] + [[package]] name = "wasm-bindgen-macro" version = "0.2.83" @@ -1111,6 +2189,15 @@ version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd" +[[package]] +name = "winreg" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d" +dependencies = [ + "winapi", +] + [[package]] name = "wyz" version = "0.5.1" diff --git a/tool/state-processor/Cargo.toml b/tool/state-processor/Cargo.toml index 72b325dd9..3cc4f9602 100644 --- a/tool/state-processor/Cargo.toml +++ b/tool/state-processor/Cargo.toml @@ -25,9 +25,10 @@ zstd = { version = "0.12" } dc-types = { path = "../../core/types" } # hack-ink -subhasher = { git = "https://github.com/hack-ink/subalfred" } -subspector = { git = "https://github.com/hack-ink/subalfred" } -substorager = { git = "https://github.com/hack-ink/subalfred" } +subalfred-core = { git = "https://github.com/hack-ink/subalfred" } +subhasher = { git = "https://github.com/hack-ink/subalfred" } +subspector = { git = "https://github.com/hack-ink/subalfred" } +substorager = { git = "https://github.com/hack-ink/subalfred" } [workspace] exclude = [] diff --git a/tool/state-processor/src/configuration.rs b/tool/state-processor/src/configuration.rs index 536ae47a4..99e94eda6 100644 --- a/tool/state-processor/src/configuration.rs +++ b/tool/state-processor/src/configuration.rs @@ -13,7 +13,7 @@ pub trait Configurable { // Make sure these account doesn't exist in the old chains. // To prevent their data get overridden. - fn genesis_collator() -> Vec { + fn genesis_collators() -> Vec { vec![ array_bytes::hex2array_unchecked("0x0eef9fabb6eb6fed2ab24a842931f8950426070a"), array_bytes::hex2array_unchecked("0xa858cde8f6cf178786578a3b0becf5c27d18300c"), diff --git a/tool/state-processor/src/system/README.md b/tool/state-processor/src/system/README.md index 079a365f5..1053ca65d 100644 --- a/tool/state-processor/src/system/README.md +++ b/tool/state-processor/src/system/README.md @@ -34,7 +34,8 @@ - compare the calculated one with the storage one - some remaining accounts, bridge endpoint accounts - TODO -- special accounts - TODO - - parachain backing account 0x8c585F9791EE5b4B23fe82888cE576DBB69607eB - - bridge root account 0x726f6f7400000000000000000000000000000000 - - pallet accounts +- special accounts + - parachain backing account DONE + - bridge root account 0x726f6f7400000000000000000000000000000000 DONE + - pallet accounts DONE + - para accounts DONE diff --git a/tool/state-processor/src/system/mod.rs b/tool/state-processor/src/system/mod.rs index fa913f9e9..64fe8b154 100644 --- a/tool/state-processor/src/system/mod.rs +++ b/tool/state-processor/src/system/mod.rs @@ -1,5 +1,6 @@ // crates.io use parity_scale_codec::Encode; +use subalfred_core::key::{PalletId, ParaId, SiblId}; // darwinia use crate::*; @@ -114,8 +115,60 @@ where reserved_kton_or_fee_frozen: Default::default(), }, }; + let mut is_special_account = false; + + if key.ends_with("000000000000") { + if let Some(s) = try_get_sub_seed(&key) { + log::info!("migrate special Account(`{s}`)"); + + is_special_account = true; + } else if key + == "0x0000000000000000000000000000000000000000000000000000000000000000" + { + log::info!("migrate special Account(0x0000000000000000000000000000000000000000000000000000000000000000)"); + + is_special_account = true; + } else { + log::info!( + "found zeros-ending Account(`{key}`), it might be a special account" + ); + }; + } + + if is_special_account { + // Truncate the special accounts to 20 bytes length. + // + // Put the truncated account into `System` and `Assets` pallets directly. + + a.nonce = 0; + + // "0x".len() + 20 * 2 = 42 + let k = array_bytes::hex2array_unchecked::<_, 20>(&key[..42]); + + if v.kton != 0 { + self.shell_state.insert_value( + b"Assets", + b"Account", + &format!( + "{}{}", + blake2_128_concat_to_string(KTON_ID.encode()), + blake2_128_concat_to_string(k.encode()), + ), + new_kton_account(&mut a, &mut kton_details, v.kton), + ); + } + + self.shell_state.insert_value( + b"System", + b"Account", + &blake2_128_concat_to_string(k), + a, + ); + } else if let Some(k) = try_get_evm_address(&key) { + // Recover the EVM accounts from Substrate accounts. + // + // Put the recovered accounts into `System` and `Assets` pallets directly. - if let Some(k) = try_get_evm_address(&key) { // https://github.dev/paritytech/frontier/blob/ab0f4a47e42ad17e4d8551fb9b3c3a6b4c5df2db/frame/evm/src/lib.rs#L705 if self.solo_state.contains_key(&full_key( b"EVM", @@ -145,6 +198,8 @@ where a, ); } else { + // Put the normal Substrate accounts into `AccountMigration` pallet. + a.nonce = 0; if v.kton != 0 { @@ -240,6 +295,18 @@ fn try_get_evm_address(key: &str) -> Option { } } +// https://github.com/hack-ink/subalfred/blob/008d042dc7984f13ae3fa76483dafa12fafbc93d/bin/subalfred/src/command/key.rs#L100 +fn try_get_sub_seed(key: &str) -> Option { + let k = array_bytes::hex2bytes_unchecked(key); + let k = k.as_slice(); + + PalletId::try_from(k) + .map(|k| k.to_string()) + .or_else(|_| ParaId::try_from(k).map(|k| ToString::to_string(&k))) + .or_else(|_| SiblId::try_from(k).map(|k| ToString::to_string(&k))) + .ok() +} + fn new_kton_account( account_info: &mut AccountInfo, asset_details: &mut AssetDetails, From 60d19dab4e511ebcf05b196ecdeca91630f8e86c Mon Sep 17 00:00:00 2001 From: fewensa <37804932+fewensa@users.noreply.github.com> Date: Tue, 7 Feb 2023 18:58:27 +0800 Subject: [PATCH 130/189] Add staging workflow (#258) * Add staging workflow * Test CI * CI * Add deps * CI * CI * CI * Updte trigger --------- Co-authored-by: Xavier Lau --- .github/workflows/staging.yml | 91 +++++++++++++++++++++++++++++++++++ .maintain/docker/Dockerfile | 7 +++ 2 files changed, 98 insertions(+) create mode 100644 .github/workflows/staging.yml create mode 100644 .maintain/docker/Dockerfile diff --git a/.github/workflows/staging.yml b/.github/workflows/staging.yml new file mode 100644 index 000000000..3c255a531 --- /dev/null +++ b/.github/workflows/staging.yml @@ -0,0 +1,91 @@ +name: Staging + +on: + push: + branches: [ main ] + workflow_dispatch: + +env: + DOCKER_REGISTRY: ghcr.io + +jobs: + build-package: + name: Build package [linux] + runs-on: ubuntu-latest + container: + image: ubuntu:18.04 + steps: + - uses: actions/checkout@v3 + + - name: Install dependencies + run: | + apt update -y + apt install --no-install-recommends -y \ + ca-certificates curl git python3-pip \ + clang make gcc g++ protobuf-compiler + pip3 install --upgrade pip + pip3 install cmake --upgrade + + - name: Install Rust toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: nightly + + - name: Build + uses: actions-rs/cargo@v1 + with: + command: build + args: --release --locked + + - name: Collect shared + run: | + mkdir -p shared + tar cjSf \ + shared/darwinia2-x86_64-linux-gnu.tar.bz2 \ + -C \ + target/release \ + darwinia + - name: Upload shared + uses: actions/upload-artifact@v2 + with: + name: darwinia-artifact + path: shared + + + build-docker-image: + name: Build image + runs-on: ubuntu-latest + needs: [build-package] + steps: + - name: Fetch latest code + uses: actions/checkout@v3 + + - uses: benjlevesque/short-sha@v1.2 + + - name: Docker login + uses: docker/login-action@v1 + with: + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + registry: ${{ env.DOCKER_REGISTRY }} + + - name: Download shared + uses: actions/download-artifact@v2 + with: + name: darwinia-artifact + path: shared + + - name: Extract shared + run: | + mkdir -p dist + tar -xvf shared/darwinia2-x86_64-linux-gnu.tar.bz2 -C dist/ + + - name: Publish docker image + uses: docker/build-push-action@v3 + with: + push: true + context: . + file: .maintain/docker/Dockerfile + tags: ${{ env.DOCKER_REGISTRY }}/${{ github.repository }}:sha-${{ env.SHA }} + + diff --git a/.maintain/docker/Dockerfile b/.maintain/docker/Dockerfile new file mode 100644 index 000000000..92432b681 --- /dev/null +++ b/.maintain/docker/Dockerfile @@ -0,0 +1,7 @@ +FROM debian:stable-slim + +COPY dist/ /usr/local/bin + +EXPOSE 9933 9944 + +ENTRYPOINT [ "/usr/local/bin/darwinia" ] From ead344925506564c7a362c24d32f06220f20bde5 Mon Sep 17 00:00:00 2001 From: Guantong Date: Tue, 7 Feb 2023 22:54:19 +0800 Subject: [PATCH 131/189] To `polkadot-v0.9.36` (#213) * Anchor polkadot-v0.9.36 * Companion for paritytech/cumulus#1860 * Companion for paritytech/cumulus#1876 * Companion for paritytech/cumulus#1904 * Companion for paritytech/substrate#12310 * Companion for paritytech/substrate#12740 * Bump array-bytes to 6.0.0 * Companion for paritytech/substrate#12868 * Companion for paritytech/cumulus#1930 * Companion for paritytech/cumulus#1905 * Companion for paritytech/cumulus#1880 * Companion for paritytech/cumulus#1997 * Companion for paritytech/cumulus#1559 * Prepare messages-substrate * Companion for paritytech/substrate#12684 * Companion for paritytech/substrate#12740 * Fix compile paritytech/substrate#12740 * Compile done * Format * Add call index * Compile done * Fix CI * Bump moonbeam * Fix CI * Try fix tests * Use into instead of `Compact` * Patch substrate & Fix compile * Fix try-runtime * Remove parity-util-mem * Format * Format * Opt * Format * Use `codec::Compact` * Format --------- Co-authored-by: Xavier Lau --- Cargo.lock | 1311 +++++++++-------- Cargo.toml | 168 +++ core/inflation/Cargo.toml | 2 +- core/primitives/Cargo.toml | 6 +- node/Cargo.toml | 123 +- node/src/cli.rs | 2 +- node/src/command.rs | 25 +- node/src/service/mod.rs | 87 +- pallet/account-migration/Cargo.toml | 20 +- pallet/account-migration/src/lib.rs | 2 +- pallet/deposit/Cargo.toml | 18 +- pallet/deposit/tests/mock.rs | 6 +- pallet/ecdsa-authority/Cargo.toml | 14 +- pallet/message-gadget/Cargo.toml | 18 +- pallet/message-gadget/src/lib.rs | 1 + pallet/message-transact/Cargo.toml | 34 +- pallet/staking/Cargo.toml | 24 +- pallet/staking/tests/mock.rs | 20 +- precompile/assets/Cargo.toml | 28 +- precompile/assets/src/lib.rs | 20 +- precompile/assets/src/mock.rs | 2 + precompile/assets/src/tests.rs | 311 +++- precompile/bls12-381/Cargo.toml | 22 +- precompile/deposit/Cargo.toml | 24 +- precompile/staking/Cargo.toml | 26 +- precompile/state-storage/Cargo.toml | 24 +- runtime/common/Cargo.toml | 22 +- runtime/common/src/xcm_configs.rs | 2 +- runtime/crab/Cargo.toml | 162 +- runtime/crab/src/lib.rs | 26 +- runtime/crab/src/pallets/assets.rs | 4 + runtime/crab/src/pallets/deposit.rs | 9 +- runtime/crab/src/pallets/staking.rs | 4 +- runtime/crab/src/pallets/system.rs | 7 +- runtime/crab/src/pallets/timestamp.rs | 2 +- runtime/crab/src/weights/block_weights.rs | 6 +- runtime/crab/src/weights/extrinsic_weights.rs | 6 +- runtime/crab/src/weights/paritydb_weights.rs | 12 +- runtime/crab/src/weights/rocksdb_weights.rs | 12 +- runtime/darwinia/Cargo.toml | 162 +- runtime/darwinia/src/lib.rs | 26 +- runtime/darwinia/src/pallets/assets.rs | 4 + runtime/darwinia/src/pallets/deposit.rs | 9 +- runtime/darwinia/src/pallets/staking.rs | 4 +- runtime/darwinia/src/pallets/system.rs | 7 +- runtime/darwinia/src/pallets/timestamp.rs | 2 +- runtime/darwinia/src/weights/block_weights.rs | 6 +- .../darwinia/src/weights/extrinsic_weights.rs | 6 +- .../darwinia/src/weights/paritydb_weights.rs | 12 +- .../darwinia/src/weights/rocksdb_weights.rs | 12 +- runtime/pangolin/Cargo.toml | 162 +- runtime/pangolin/src/lib.rs | 26 +- runtime/pangolin/src/pallets/assets.rs | 4 + runtime/pangolin/src/pallets/deposit.rs | 9 +- runtime/pangolin/src/pallets/staking.rs | 4 +- runtime/pangolin/src/pallets/system.rs | 7 +- runtime/pangolin/src/pallets/timestamp.rs | 2 +- runtime/pangolin/src/weights/block_weights.rs | 6 +- .../pangolin/src/weights/extrinsic_weights.rs | 6 +- .../pangolin/src/weights/paritydb_weights.rs | 12 +- .../pangolin/src/weights/rocksdb_weights.rs | 12 +- 61 files changed, 1770 insertions(+), 1342 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 746ef56a4..84ef1b928 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -15,7 +15,7 @@ dependencies = [ [[package]] name = "account" version = "0.1.1" -source = "git+https://github.com/darwinia-network/moonbeam?branch=polkadot-v0.9.33#4ea11a7b2b71e0f4f6d100f5fa04e0f3ea285895" +source = "git+https://github.com/darwinia-network/moonbeam?branch=polkadot-v0.9.36#f5c98d5612bdb7b6311005f41fc873400d5e1481" dependencies = [ "blake2-rfc", "hex", @@ -325,7 +325,6 @@ dependencies = [ "async-global-executor", "async-io", "async-lock", - "async-process", "crossbeam-utils", "futures-channel", "futures-core", @@ -342,21 +341,6 @@ dependencies = [ "wasm-bindgen-futures", ] -[[package]] -name = "async-std-resolver" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ba50e24d9ee0a8950d3d03fc6d0dd10aa14b5de3b101949b4e160f7fee7c723" -dependencies = [ - "async-std", - "async-trait", - "futures-io", - "futures-util", - "pin-utils", - "socket2", - "trust-dns-resolver", -] - [[package]] name = "async-task" version = "4.3.0" @@ -422,20 +406,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" -[[package]] -name = "backoff" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b62ddb9cb1ec0a098ad4bbf9344d0713fa193ae1a80af55febcff2627b6a00c1" -dependencies = [ - "futures-core", - "getrandom 0.2.8", - "instant", - "pin-project-lite 0.2.9", - "rand 0.8.5", - "tokio", -] - [[package]] name = "backtrace" version = "0.3.67" @@ -505,11 +475,10 @@ dependencies = [ [[package]] name = "beefy-gadget" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "array-bytes 4.2.0", "async-trait", - "beefy-primitives", "fnv", "futures", "futures-timer", @@ -528,6 +497,7 @@ dependencies = [ "sp-api", "sp-application-crypto", "sp-arithmetic", + "sp-beefy", "sp-blockchain", "sp-consensus", "sp-core", @@ -542,10 +512,9 @@ dependencies = [ [[package]] name = "beefy-gadget-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "beefy-gadget", - "beefy-primitives", "futures", "jsonrpsee", "log", @@ -554,6 +523,7 @@ dependencies = [ "sc-rpc", "sc-utils", "serde", + "sp-beefy", "sp-core", "sp-runtime", "thiserror", @@ -562,28 +532,11 @@ dependencies = [ [[package]] name = "beefy-merkle-tree" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" -dependencies = [ - "beefy-primitives", - "sp-api", - "sp-runtime", -] - -[[package]] -name = "beefy-primitives" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ - "parity-scale-codec", - "scale-info", - "serde", "sp-api", - "sp-application-crypto", - "sp-core", - "sp-io", - "sp-mmr-primitives", + "sp-beefy", "sp-runtime", - "sp-std", ] [[package]] @@ -759,7 +712,7 @@ dependencies = [ [[package]] name = "bp-darwinia-core" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.33#3c4598428c048b78749ad334a1e134f435984daf" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.36#3cb281ddcd5a85b15da08bc2380f130d69ea2279" dependencies = [ "account", "bp-messages", @@ -776,7 +729,7 @@ dependencies = [ [[package]] name = "bp-header-chain" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.33#3c4598428c048b78749ad334a1e134f435984daf" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.36#3cb281ddcd5a85b15da08bc2380f130d69ea2279" dependencies = [ "bp-runtime", "finality-grandpa", @@ -793,7 +746,7 @@ dependencies = [ [[package]] name = "bp-message-dispatch" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.33#3c4598428c048b78749ad334a1e134f435984daf" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.36#3cb281ddcd5a85b15da08bc2380f130d69ea2279" dependencies = [ "bp-runtime", "frame-support", @@ -806,7 +759,7 @@ dependencies = [ [[package]] name = "bp-messages" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.33#3c4598428c048b78749ad334a1e134f435984daf" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.36#3cb281ddcd5a85b15da08bc2380f130d69ea2279" dependencies = [ "bitvec", "bp-runtime", @@ -823,7 +776,7 @@ dependencies = [ [[package]] name = "bp-parachains" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.33#3c4598428c048b78749ad334a1e134f435984daf" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.36#3cb281ddcd5a85b15da08bc2380f130d69ea2279" dependencies = [ "bp-polkadot-core", "bp-runtime", @@ -836,14 +789,13 @@ dependencies = [ [[package]] name = "bp-polkadot-core" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.33#3c4598428c048b78749ad334a1e134f435984daf" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.36#3cb281ddcd5a85b15da08bc2380f130d69ea2279" dependencies = [ "bp-messages", "bp-runtime", "frame-support", "frame-system", "parity-scale-codec", - "parity-util-mem", "scale-info", "serde", "sp-api", @@ -856,7 +808,7 @@ dependencies = [ [[package]] name = "bp-runtime" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.33#3c4598428c048b78749ad334a1e134f435984daf" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.36#3cb281ddcd5a85b15da08bc2380f130d69ea2279" dependencies = [ "frame-support", "frame-system", @@ -877,7 +829,7 @@ dependencies = [ [[package]] name = "bp-test-utils" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.33#3c4598428c048b78749ad334a1e134f435984daf" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.36#3cb281ddcd5a85b15da08bc2380f130d69ea2279" dependencies = [ "bp-header-chain", "ed25519-dalek", @@ -892,7 +844,7 @@ dependencies = [ [[package]] name = "bridge-runtime-common" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.33#3c4598428c048b78749ad334a1e134f435984daf" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.36#3cb281ddcd5a85b15da08bc2380f130d69ea2279" dependencies = [ "bp-header-chain", "bp-message-dispatch", @@ -1313,6 +1265,16 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "cpu-time" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9e393a7668fe1fad3075085b86c781883000b4ede868f43627b34a87c8b7ded" +dependencies = [ + "libc", + "winapi", +] + [[package]] name = "cpufeatures" version = "0.2.5" @@ -1655,7 +1617,7 @@ dependencies = [ [[package]] name = "cumulus-client-cli" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.33#27721d794ee63aae42317a7eeda21595dd3200d9" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.36#afe528af891f464b318293f183f6d3eefbc979b0" dependencies = [ "clap", "parity-scale-codec", @@ -1670,7 +1632,7 @@ dependencies = [ [[package]] name = "cumulus-client-collator" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.33#27721d794ee63aae42317a7eeda21595dd3200d9" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.36#afe528af891f464b318293f183f6d3eefbc979b0" dependencies = [ "cumulus-client-consensus-common", "cumulus-client-network", @@ -1693,7 +1655,7 @@ dependencies = [ [[package]] name = "cumulus-client-consensus-aura" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.33#27721d794ee63aae42317a7eeda21595dd3200d9" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.36#afe528af891f464b318293f183f6d3eefbc979b0" dependencies = [ "async-trait", "cumulus-client-consensus-common", @@ -1722,12 +1684,15 @@ dependencies = [ [[package]] name = "cumulus-client-consensus-common" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.33#27721d794ee63aae42317a7eeda21595dd3200d9" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.36#afe528af891f464b318293f183f6d3eefbc979b0" dependencies = [ "async-trait", + "cumulus-client-pov-recovery", + "cumulus-primitives-core", "cumulus-relay-chain-interface", "dyn-clone", "futures", + "log", "parity-scale-codec", "polkadot-primitives", "sc-client-api", @@ -1742,7 +1707,7 @@ dependencies = [ [[package]] name = "cumulus-client-network" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.33#27721d794ee63aae42317a7eeda21595dd3200d9" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.36#afe528af891f464b318293f183f6d3eefbc979b0" dependencies = [ "async-trait", "cumulus-relay-chain-interface", @@ -1765,7 +1730,7 @@ dependencies = [ [[package]] name = "cumulus-client-pov-recovery" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.33#27721d794ee63aae42317a7eeda21595dd3200d9" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.36#afe528af891f464b318293f183f6d3eefbc979b0" dependencies = [ "cumulus-primitives-core", "cumulus-relay-chain-interface", @@ -1788,19 +1753,24 @@ dependencies = [ [[package]] name = "cumulus-client-service" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.33#27721d794ee63aae42317a7eeda21595dd3200d9" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.36#afe528af891f464b318293f183f6d3eefbc979b0" dependencies = [ "cumulus-client-cli", "cumulus-client-collator", "cumulus-client-consensus-common", "cumulus-client-pov-recovery", "cumulus-primitives-core", + "cumulus-relay-chain-inprocess-interface", "cumulus-relay-chain-interface", + "cumulus-relay-chain-minimal-node", + "futures", "parking_lot 0.12.1", "polkadot-primitives", "sc-client-api", "sc-consensus", "sc-service", + "sc-sysinfo", + "sc-telemetry", "sp-api", "sp-blockchain", "sp-consensus", @@ -1811,7 +1781,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-aura-ext" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.33#27721d794ee63aae42317a7eeda21595dd3200d9" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.36#afe528af891f464b318293f183f6d3eefbc979b0" dependencies = [ "frame-support", "frame-system", @@ -1827,7 +1797,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-dmp-queue" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.33#27721d794ee63aae42317a7eeda21595dd3200d9" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.36#afe528af891f464b318293f183f6d3eefbc979b0" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -1844,7 +1814,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-parachain-system" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.33#27721d794ee63aae42317a7eeda21595dd3200d9" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.36#afe528af891f464b318293f183f6d3eefbc979b0" dependencies = [ "bytes", "cumulus-pallet-parachain-system-proc-macro", @@ -1872,7 +1842,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-parachain-system-proc-macro" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.33#27721d794ee63aae42317a7eeda21595dd3200d9" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.36#afe528af891f464b318293f183f6d3eefbc979b0" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -1883,7 +1853,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-session-benchmarking" version = "3.0.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.33#27721d794ee63aae42317a7eeda21595dd3200d9" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.36#afe528af891f464b318293f183f6d3eefbc979b0" dependencies = [ "frame-benchmarking", "frame-support", @@ -1897,7 +1867,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-xcm" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.33#27721d794ee63aae42317a7eeda21595dd3200d9" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.36#afe528af891f464b318293f183f6d3eefbc979b0" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -1913,7 +1883,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-xcmp-queue" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.33#27721d794ee63aae42317a7eeda21595dd3200d9" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.36#afe528af891f464b318293f183f6d3eefbc979b0" dependencies = [ "cumulus-primitives-core", "frame-benchmarking", @@ -1932,7 +1902,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-core" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.33#27721d794ee63aae42317a7eeda21595dd3200d9" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.36#afe528af891f464b318293f183f6d3eefbc979b0" dependencies = [ "parity-scale-codec", "polkadot-core-primitives", @@ -1947,7 +1917,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-parachain-inherent" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.33#27721d794ee63aae42317a7eeda21595dd3200d9" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.36#afe528af891f464b318293f183f6d3eefbc979b0" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -1970,7 +1940,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-timestamp" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.33#27721d794ee63aae42317a7eeda21595dd3200d9" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.36#afe528af891f464b318293f183f6d3eefbc979b0" dependencies = [ "cumulus-primitives-core", "futures", @@ -1983,7 +1953,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-utility" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.33#27721d794ee63aae42317a7eeda21595dd3200d9" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.36#afe528af891f464b318293f183f6d3eefbc979b0" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -1999,7 +1969,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-inprocess-interface" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.33#27721d794ee63aae42317a7eeda21595dd3200d9" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.36#afe528af891f464b318293f183f6d3eefbc979b0" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -2024,7 +1994,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-interface" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.33#27721d794ee63aae42317a7eeda21595dd3200d9" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.36#afe528af891f464b318293f183f6d3eefbc979b0" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -2038,24 +2008,23 @@ dependencies = [ "sp-blockchain", "sp-state-machine", "thiserror", + "tokio", ] [[package]] name = "cumulus-relay-chain-minimal-node" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.33#27721d794ee63aae42317a7eeda21595dd3200d9" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.36#afe528af891f464b318293f183f6d3eefbc979b0" dependencies = [ - "array-bytes 4.2.0", + "array-bytes 6.0.0", "async-trait", "cumulus-primitives-core", "cumulus-relay-chain-interface", "cumulus-relay-chain-rpc-interface", "futures", "lru", - "polkadot-availability-distribution", "polkadot-core-primitives", "polkadot-network-bridge", - "polkadot-node-core-av-store", "polkadot-node-network-protocol", "polkadot-node-subsystem-util", "polkadot-overseer", @@ -2067,8 +2036,6 @@ dependencies = [ "sc-keystore", "sc-network", "sc-network-common", - "sc-network-light", - "sc-network-sync", "sc-service", "sc-telemetry", "sc-tracing", @@ -2087,24 +2054,25 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-rpc-interface" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.33#27721d794ee63aae42317a7eeda21595dd3200d9" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.36#afe528af891f464b318293f183f6d3eefbc979b0" dependencies = [ "async-trait", - "backoff", "cumulus-primitives-core", "cumulus-relay-chain-interface", "futures", "futures-timer", "jsonrpsee", + "lru", "parity-scale-codec", "polkadot-service", "sc-client-api", "sc-rpc-api", + "serde", + "serde_json", "sp-api", "sp-authority-discovery", "sp-consensus-babe", "sp-core", - "sp-runtime", "sp-state-machine", "sp-storage", "tokio", @@ -2115,7 +2083,7 @@ dependencies = [ [[package]] name = "cumulus-test-relay-sproof-builder" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.33#27721d794ee63aae42317a7eeda21595dd3200d9" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.36#afe528af891f464b318293f183f6d3eefbc979b0" dependencies = [ "cumulus-primitives-core", "parity-scale-codec", @@ -2218,18 +2186,18 @@ dependencies = [ "clap", "crab-runtime", "cumulus-client-cli", + "cumulus-client-collator", "cumulus-client-consensus-aura", "cumulus-client-consensus-common", "cumulus-client-network", "cumulus-client-service", "cumulus-primitives-core", "cumulus-primitives-parachain-inherent", - "cumulus-relay-chain-inprocess-interface", "cumulus-relay-chain-interface", - "cumulus-relay-chain-minimal-node", "darwinia-runtime", "dc-primitives", "fc-cli", + "fc-consensus", "fc-db", "fc-mapping-sync", "fc-rpc", @@ -2246,6 +2214,7 @@ dependencies = [ "pangolin-runtime", "parity-scale-codec", "polkadot-cli", + "polkadot-parachain", "polkadot-primitives", "polkadot-service", "sc-basic-authorship", @@ -2255,10 +2224,12 @@ dependencies = [ "sc-consensus", "sc-consensus-aura", "sc-executor", + "sc-keystore", "sc-network", "sc-network-common", "sc-offchain", "sc-rpc", + "sc-rpc-api", "sc-service", "sc-sysinfo", "sc-telemetry", @@ -2272,6 +2243,8 @@ dependencies = [ "sp-consensus", "sp-consensus-aura", "sp-core", + "sp-inherents", + "sp-io", "sp-keystore", "sp-offchain", "sp-runtime", @@ -2711,6 +2684,17 @@ dependencies = [ "syn", ] +[[package]] +name = "derive-syn-parse" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e79116f119dd1dba1abf1f3405f03b9b0e79a27a3883864bfebded8a3dc768cd" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "derive_more" version = "0.99.17" @@ -3276,7 +3260,7 @@ dependencies = [ [[package]] name = "fc-cli" version = "1.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.33#05ee2dbf537bf5bbcbc5b4785be62088034bdd58" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.36#63309df8e9a4b19ab4ceb2fd1a37f7968c111de9" dependencies = [ "clap", "ethereum-types 0.14.1", @@ -3292,10 +3276,29 @@ dependencies = [ "sp-runtime", ] +[[package]] +name = "fc-consensus" +version = "2.0.0-dev" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.36#63309df8e9a4b19ab4ceb2fd1a37f7968c111de9" +dependencies = [ + "async-trait", + "fc-db", + "fp-consensus", + "fp-rpc", + "sc-client-api", + "sc-consensus", + "sp-api", + "sp-block-builder", + "sp-blockchain", + "sp-consensus", + "sp-runtime", + "thiserror", +] + [[package]] name = "fc-db" version = "2.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.33#05ee2dbf537bf5bbcbc5b4785be62088034bdd58" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.36#63309df8e9a4b19ab4ceb2fd1a37f7968c111de9" dependencies = [ "fp-storage", "kvdb-rocksdb", @@ -3314,7 +3317,7 @@ dependencies = [ [[package]] name = "fc-mapping-sync" version = "2.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.33#05ee2dbf537bf5bbcbc5b4785be62088034bdd58" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.36#63309df8e9a4b19ab4ceb2fd1a37f7968c111de9" dependencies = [ "fc-db", "fp-consensus", @@ -3331,7 +3334,7 @@ dependencies = [ [[package]] name = "fc-rpc" version = "2.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.33#05ee2dbf537bf5bbcbc5b4785be62088034bdd58" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.36#63309df8e9a4b19ab4ceb2fd1a37f7968c111de9" dependencies = [ "ethereum", "ethereum-types 0.14.1", @@ -3374,7 +3377,7 @@ dependencies = [ [[package]] name = "fc-rpc-core" version = "1.1.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.33#05ee2dbf537bf5bbcbc5b4785be62088034bdd58" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.36#63309df8e9a4b19ab4ceb2fd1a37f7968c111de9" dependencies = [ "ethereum", "ethereum-types 0.14.1", @@ -3507,7 +3510,7 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "fork-tree" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "parity-scale-codec", ] @@ -3524,7 +3527,7 @@ dependencies = [ [[package]] name = "fp-consensus" version = "2.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.33#05ee2dbf537bf5bbcbc5b4785be62088034bdd58" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.36#63309df8e9a4b19ab4ceb2fd1a37f7968c111de9" dependencies = [ "ethereum", "parity-scale-codec", @@ -3536,7 +3539,7 @@ dependencies = [ [[package]] name = "fp-ethereum" version = "1.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.33#05ee2dbf537bf5bbcbc5b4785be62088034bdd58" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.36#63309df8e9a4b19ab4ceb2fd1a37f7968c111de9" dependencies = [ "ethereum", "ethereum-types 0.14.1", @@ -3551,7 +3554,7 @@ dependencies = [ [[package]] name = "fp-evm" version = "3.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.33#05ee2dbf537bf5bbcbc5b4785be62088034bdd58" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.36#63309df8e9a4b19ab4ceb2fd1a37f7968c111de9" dependencies = [ "evm", "frame-support", @@ -3564,7 +3567,7 @@ dependencies = [ [[package]] name = "fp-rpc" version = "3.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.33#05ee2dbf537bf5bbcbc5b4785be62088034bdd58" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.36#63309df8e9a4b19ab4ceb2fd1a37f7968c111de9" dependencies = [ "ethereum", "ethereum-types 0.14.1", @@ -3581,12 +3584,11 @@ dependencies = [ [[package]] name = "fp-self-contained" version = "1.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.33#05ee2dbf537bf5bbcbc5b4785be62088034bdd58" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.36#63309df8e9a4b19ab4ceb2fd1a37f7968c111de9" dependencies = [ "ethereum", "frame-support", "parity-scale-codec", - "parity-util-mem", "scale-info", "serde", "sp-runtime", @@ -3595,7 +3597,7 @@ dependencies = [ [[package]] name = "fp-storage" version = "2.0.0" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.33#05ee2dbf537bf5bbcbc5b4785be62088034bdd58" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.36#63309df8e9a4b19ab4ceb2fd1a37f7968c111de9" dependencies = [ "parity-scale-codec", "serde", @@ -3610,7 +3612,7 @@ checksum = "6c2141d6d6c8512188a7891b4b01590a45f6dac67afb4f255c4124dbb86d4eaa" [[package]] name = "frame-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "frame-support", "frame-system", @@ -3633,7 +3635,7 @@ dependencies = [ [[package]] name = "frame-benchmarking-cli" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "Inflector", "array-bytes 4.2.0", @@ -3685,7 +3687,7 @@ dependencies = [ [[package]] name = "frame-election-provider-solution-type" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -3696,7 +3698,7 @@ dependencies = [ [[package]] name = "frame-election-provider-support" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "frame-election-provider-solution-type", "frame-support", @@ -3704,6 +3706,7 @@ dependencies = [ "parity-scale-codec", "scale-info", "sp-arithmetic", + "sp-core", "sp-npos-elections", "sp-runtime", "sp-std", @@ -3712,7 +3715,7 @@ dependencies = [ [[package]] name = "frame-executive" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "frame-support", "frame-system", @@ -3738,10 +3741,29 @@ dependencies = [ "serde", ] +[[package]] +name = "frame-remote-externalities" +version = "0.10.0-dev" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +dependencies = [ + "env_logger 0.9.3", + "futures", + "log", + "parity-scale-codec", + "serde", + "serde_json", + "sp-core", + "sp-io", + "sp-runtime", + "sp-version", + "substrate-rpc-client", + "tokio", +] + [[package]] name = "frame-support" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "bitflags", "frame-metadata", @@ -3767,16 +3789,18 @@ dependencies = [ "sp-std", "sp-tracing", "sp-weights", + "static_assertions", "tt-call", ] [[package]] name = "frame-support-procedural" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "Inflector", "cfg-expr", + "derive-syn-parse", "frame-support-procedural-tools", "itertools", "proc-macro2", @@ -3787,7 +3811,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "frame-support-procedural-tools-derive", "proc-macro-crate", @@ -3799,7 +3823,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools-derive" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "proc-macro2", "quote", @@ -3809,7 +3833,7 @@ dependencies = [ [[package]] name = "frame-system" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "frame-support", "log", @@ -3827,7 +3851,7 @@ dependencies = [ [[package]] name = "frame-system-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "frame-benchmarking", "frame-support", @@ -3842,7 +3866,7 @@ dependencies = [ [[package]] name = "frame-system-rpc-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "parity-scale-codec", "sp-api", @@ -3851,7 +3875,7 @@ dependencies = [ [[package]] name = "frame-try-runtime" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "frame-support", "parity-scale-codec", @@ -4307,6 +4331,12 @@ dependencies = [ "pin-project-lite 0.2.9", ] +[[package]] +name = "http-range-header" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bfe8eed0a9285ef776bb792479ea3834e8b94e13d615c2f66d03dd50a435a29" + [[package]] name = "httparse" version = "1.8.0" @@ -4615,24 +4645,23 @@ dependencies = [ [[package]] name = "jsonrpsee" -version = "0.15.1" +version = "0.16.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bd0d559d5e679b1ab2f869b486a11182923863b1b3ee8b421763cdd707b783a" +checksum = "7d291e3a5818a2384645fd9756362e6d89cf0541b0b916fa7702ea4a9833608e" dependencies = [ "jsonrpsee-core", - "jsonrpsee-http-server", "jsonrpsee-proc-macros", + "jsonrpsee-server", "jsonrpsee-types", "jsonrpsee-ws-client", - "jsonrpsee-ws-server", "tracing", ] [[package]] name = "jsonrpsee-client-transport" -version = "0.15.1" +version = "0.16.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8752740ecd374bcbf8b69f3e80b0327942df76f793f8d4e60d3355650c31fb74" +checksum = "965de52763f2004bc91ac5bcec504192440f0b568a5d621c59d9dbd6f886c3fb" dependencies = [ "futures-util", "http", @@ -4651,9 +4680,9 @@ dependencies = [ [[package]] name = "jsonrpsee-core" -version = "0.15.1" +version = "0.16.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3dc3e9cf2ba50b7b1d7d76a667619f82846caa39e8e8daa8a4962d74acaddca" +checksum = "a4e70b4439a751a5de7dd5ed55eacff78ebf4ffe0fc009cb1ebb11417f5b536b" dependencies = [ "anyhow", "arrayvec 0.7.2", @@ -4664,10 +4693,8 @@ dependencies = [ "futures-timer", "futures-util", "globset", - "http", "hyper", "jsonrpsee-types", - "lazy_static", "parking_lot 0.12.1", "rand 0.8.5", "rustc-hash", @@ -4677,45 +4704,48 @@ dependencies = [ "thiserror", "tokio", "tracing", - "tracing-futures", - "unicase", ] [[package]] -name = "jsonrpsee-http-server" -version = "0.15.1" +name = "jsonrpsee-proc-macros" +version = "0.16.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03802f0373a38c2420c70b5144742d800b509e2937edc4afb116434f07120117" +checksum = "baa6da1e4199c10d7b1d0a6e5e8bd8e55f351163b6f4b3cbb044672a69bd4c1c" +dependencies = [ + "heck", + "proc-macro-crate", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "jsonrpsee-server" +version = "0.16.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fb69dad85df79527c019659a992498d03f8495390496da2f07e6c24c2b356fc" dependencies = [ "futures-channel", "futures-util", + "http", "hyper", "jsonrpsee-core", "jsonrpsee-types", "serde", "serde_json", + "soketto", "tokio", + "tokio-stream", + "tokio-util", + "tower", "tracing", - "tracing-futures", -] - -[[package]] -name = "jsonrpsee-proc-macros" -version = "0.15.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd67957d4280217247588ac86614ead007b301ca2fa9f19c19f880a536f029e3" -dependencies = [ - "proc-macro-crate", - "proc-macro2", - "quote", - "syn", ] [[package]] name = "jsonrpsee-types" -version = "0.15.1" +version = "0.16.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e290bba767401b646812f608c099b922d8142603c9e73a50fb192d3ac86f4a0d" +checksum = "5bd522fe1ce3702fd94812965d7bb7a3364b1c9aba743944c5a00529aae80f8c" dependencies = [ "anyhow", "beef", @@ -4727,9 +4757,9 @@ dependencies = [ [[package]] name = "jsonrpsee-ws-client" -version = "0.15.1" +version = "0.16.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ee5feddd5188e62ac08fcf0e56478138e581509d4730f3f7be9b57dd402a4ff" +checksum = "0b83daeecfc6517cfe210df24e570fb06213533dfb990318fae781f4c7119dd9" dependencies = [ "http", "jsonrpsee-client-transport", @@ -4737,26 +4767,6 @@ dependencies = [ "jsonrpsee-types", ] -[[package]] -name = "jsonrpsee-ws-server" -version = "0.15.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d488ba74fb369e5ab68926feb75a483458b88e768d44319f37e4ecad283c7325" -dependencies = [ - "futures-channel", - "futures-util", - "http", - "jsonrpsee-core", - "jsonrpsee-types", - "serde_json", - "soketto", - "tokio", - "tokio-stream", - "tokio-util", - "tracing", - "tracing-futures", -] - [[package]] name = "k256" version = "0.11.6" @@ -4780,10 +4790,9 @@ dependencies = [ [[package]] name = "kusama-runtime" -version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" +version = "0.9.36" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" dependencies = [ - "beefy-primitives", "bitvec", "frame-benchmarking", "frame-election-provider-support", @@ -4810,13 +4819,13 @@ dependencies = [ "pallet-election-provider-support-benchmarking", "pallet-elections-phragmen", "pallet-fast-unstake", - "pallet-gilt", "pallet-grandpa", "pallet-identity", "pallet-im-online", "pallet-indices", "pallet-membership", "pallet-multisig", + "pallet-nis", "pallet-nomination-pools", "pallet-nomination-pools-benchmarking", "pallet-nomination-pools-runtime-api", @@ -4854,6 +4863,7 @@ dependencies = [ "sp-api", "sp-arithmetic", "sp-authority-discovery", + "sp-beefy", "sp-block-builder", "sp-consensus-babe", "sp-core", @@ -4877,8 +4887,8 @@ dependencies = [ [[package]] name = "kusama-runtime-constants" -version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" +version = "0.9.36" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" dependencies = [ "frame-support", "polkadot-primitives", @@ -4900,35 +4910,31 @@ dependencies = [ [[package]] name = "kvdb" -version = "0.12.0" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "585089ceadba0197ffe9af6740ab350b325e3c1f5fccfbc3522e0250c750409b" +checksum = "e7d770dcb02bf6835887c3a979b5107a04ff4bbde97a5f0928d27404a155add9" dependencies = [ - "parity-util-mem", "smallvec", ] [[package]] name = "kvdb-memorydb" -version = "0.12.0" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40d109c87bfb7759edd2a49b2649c1afe25af785d930ad6a38479b4dc70dd873" +checksum = "bf7a85fe66f9ff9cd74e169fdd2c94c6e1e74c412c99a73b4df3200b5d3760b2" dependencies = [ "kvdb", - "parity-util-mem", "parking_lot 0.12.1", ] [[package]] name = "kvdb-rocksdb" -version = "0.16.0" +version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c076cc2cdbac89b9910c853a36c957d3862a779f31c2661174222cefb49ee597" +checksum = "2182b8219fee6bd83aacaab7344e840179ae079d5216aa4e249b4d704646a844" dependencies = [ "kvdb", - "log", "num_cpus", - "parity-util-mem", "parking_lot 0.12.1", "regex", "rocksdb", @@ -5051,7 +5057,6 @@ version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2322c9fb40d99101def6a01612ee30500c89abbbecb6297b3cd252903a4c1720" dependencies = [ - "async-std-resolver", "futures", "libp2p-core", "log", @@ -5115,7 +5120,6 @@ version = "0.41.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "761704e727f7d68d58d7bc2231eafae5fc1b9814de24290f126df09d4bd37a15" dependencies = [ - "async-io", "data-encoding", "dns-parser", "futures", @@ -5126,6 +5130,7 @@ dependencies = [ "rand 0.8.5", "smallvec", "socket2", + "tokio", "void", ] @@ -5254,7 +5259,6 @@ version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9839d96761491c6d3e238e70554b856956fca0ab60feb9de2cd08eed4473fa92" dependencies = [ - "async-io", "futures", "futures-timer", "if-watch", @@ -5262,6 +5266,7 @@ dependencies = [ "libp2p-core", "log", "socket2", + "tokio", ] [[package]] @@ -5620,22 +5625,12 @@ dependencies = [ [[package]] name = "memory-db" -version = "0.30.0" +version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34ac11bb793c28fa095b7554466f53b3a60a2cd002afdac01bcf135cbd73a269" +checksum = "5e0c7cba9ce19ac7ffd2053ac9f49843bbd3f4318feedfd74e85c19d5fb0ba66" dependencies = [ "hash-db", "hashbrown", - "parity-util-mem", -] - -[[package]] -name = "memory-lru" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce95ae042940bad7e312857b929ee3d11b8f799a80cb7b9c7ec5125516906395" -dependencies = [ - "lru", ] [[package]] @@ -5704,6 +5699,42 @@ dependencies = [ "windows-sys 0.42.0", ] +[[package]] +name = "mmr-gadget" +version = "4.0.0-dev" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +dependencies = [ + "futures", + "log", + "parity-scale-codec", + "sc-client-api", + "sc-offchain", + "sp-api", + "sp-beefy", + "sp-blockchain", + "sp-consensus", + "sp-core", + "sp-io", + "sp-mmr-primitives", + "sp-runtime", +] + +[[package]] +name = "mmr-rpc" +version = "4.0.0-dev" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +dependencies = [ + "anyhow", + "jsonrpsee", + "parity-scale-codec", + "serde", + "sp-api", + "sp-blockchain", + "sp-core", + "sp-mmr-primitives", + "sp-runtime", +] + [[package]] name = "mockall" version = "0.11.3" @@ -6176,7 +6207,7 @@ dependencies = [ [[package]] name = "orml-traits" version = "0.4.1-dev" -source = "git+https://github.com/open-web3-stack/open-runtime-module-library?branch=polkadot-v0.9.33#dc39cfddefb10ef0de23655e2c3dcdab66a19404" +source = "git+https://github.com/open-web3-stack/open-runtime-module-library?branch=polkadot-v0.9.36#db0381f6363e0c8e781082b6f552c092b688fb1c" dependencies = [ "frame-support", "impl-trait-for-tuples", @@ -6193,7 +6224,7 @@ dependencies = [ [[package]] name = "orml-utilities" version = "0.4.1-dev" -source = "git+https://github.com/open-web3-stack/open-runtime-module-library?branch=polkadot-v0.9.33#dc39cfddefb10ef0de23655e2c3dcdab66a19404" +source = "git+https://github.com/open-web3-stack/open-runtime-module-library?branch=polkadot-v0.9.36#db0381f6363e0c8e781082b6f552c092b688fb1c" dependencies = [ "frame-support", "parity-scale-codec", @@ -6222,13 +6253,14 @@ dependencies = [ [[package]] name = "pallet-assets" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "frame-benchmarking", "frame-support", "frame-system", "parity-scale-codec", "scale-info", + "sp-core", "sp-runtime", "sp-std", ] @@ -6236,7 +6268,7 @@ dependencies = [ [[package]] name = "pallet-aura" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "frame-support", "frame-system", @@ -6252,7 +6284,7 @@ dependencies = [ [[package]] name = "pallet-authority-discovery" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "frame-support", "frame-system", @@ -6268,7 +6300,7 @@ dependencies = [ [[package]] name = "pallet-authorship" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "frame-support", "frame-system", @@ -6283,7 +6315,7 @@ dependencies = [ [[package]] name = "pallet-babe" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "frame-benchmarking", "frame-support", @@ -6307,7 +6339,7 @@ dependencies = [ [[package]] name = "pallet-bags-list" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -6327,7 +6359,7 @@ dependencies = [ [[package]] name = "pallet-balances" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "frame-benchmarking", "frame-support", @@ -6342,15 +6374,15 @@ dependencies = [ [[package]] name = "pallet-beefy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ - "beefy-primitives", "frame-support", "frame-system", "pallet-session", "parity-scale-codec", "scale-info", "serde", + "sp-beefy", "sp-runtime", "sp-std", ] @@ -6358,11 +6390,10 @@ dependencies = [ [[package]] name = "pallet-beefy-mmr" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "array-bytes 4.2.0", "beefy-merkle-tree", - "beefy-primitives", "frame-support", "frame-system", "log", @@ -6372,6 +6403,7 @@ dependencies = [ "parity-scale-codec", "scale-info", "serde", + "sp-beefy", "sp-core", "sp-io", "sp-runtime", @@ -6381,7 +6413,7 @@ dependencies = [ [[package]] name = "pallet-bounties" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "frame-benchmarking", "frame-support", @@ -6399,7 +6431,7 @@ dependencies = [ [[package]] name = "pallet-bridge-dispatch" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.33#3c4598428c048b78749ad334a1e134f435984daf" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.36#3cb281ddcd5a85b15da08bc2380f130d69ea2279" dependencies = [ "bp-message-dispatch", "bp-runtime", @@ -6415,7 +6447,7 @@ dependencies = [ [[package]] name = "pallet-bridge-grandpa" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.33#3c4598428c048b78749ad334a1e134f435984daf" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.36#3cb281ddcd5a85b15da08bc2380f130d69ea2279" dependencies = [ "bp-header-chain", "bp-runtime", @@ -6437,7 +6469,7 @@ dependencies = [ [[package]] name = "pallet-bridge-messages" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.33#3c4598428c048b78749ad334a1e134f435984daf" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.36#3cb281ddcd5a85b15da08bc2380f130d69ea2279" dependencies = [ "bitvec", "bp-message-dispatch", @@ -6458,7 +6490,7 @@ dependencies = [ [[package]] name = "pallet-bridge-parachains" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.33#3c4598428c048b78749ad334a1e134f435984daf" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.36#3cb281ddcd5a85b15da08bc2380f130d69ea2279" dependencies = [ "bp-parachains", "bp-polkadot-core", @@ -6479,7 +6511,7 @@ dependencies = [ [[package]] name = "pallet-child-bounties" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "frame-benchmarking", "frame-support", @@ -6498,7 +6530,7 @@ dependencies = [ [[package]] name = "pallet-collective" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "frame-benchmarking", "frame-support", @@ -6515,7 +6547,7 @@ dependencies = [ [[package]] name = "pallet-conviction-voting" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "assert_matches", "frame-benchmarking", @@ -6532,7 +6564,7 @@ dependencies = [ [[package]] name = "pallet-democracy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "frame-benchmarking", "frame-support", @@ -6550,7 +6582,7 @@ dependencies = [ [[package]] name = "pallet-election-provider-multi-phase" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -6574,7 +6606,7 @@ dependencies = [ [[package]] name = "pallet-election-provider-support-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -6587,7 +6619,7 @@ dependencies = [ [[package]] name = "pallet-elections-phragmen" version = "5.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "frame-benchmarking", "frame-support", @@ -6605,7 +6637,7 @@ dependencies = [ [[package]] name = "pallet-ethereum" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.33#05ee2dbf537bf5bbcbc5b4785be62088034bdd58" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.36#63309df8e9a4b19ab4ceb2fd1a37f7968c111de9" dependencies = [ "ethereum", "ethereum-types 0.14.1", @@ -6632,7 +6664,7 @@ dependencies = [ [[package]] name = "pallet-evm" version = "6.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.33#05ee2dbf537bf5bbcbc5b4785be62088034bdd58" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.36#63309df8e9a4b19ab4ceb2fd1a37f7968c111de9" dependencies = [ "environmental", "evm", @@ -6657,7 +6689,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-blake2" version = "2.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.33#05ee2dbf537bf5bbcbc5b4785be62088034bdd58" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.36#63309df8e9a4b19ab4ceb2fd1a37f7968c111de9" dependencies = [ "fp-evm", ] @@ -6665,7 +6697,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-bn128" version = "2.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.33#05ee2dbf537bf5bbcbc5b4785be62088034bdd58" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.36#63309df8e9a4b19ab4ceb2fd1a37f7968c111de9" dependencies = [ "fp-evm", "sp-core", @@ -6675,7 +6707,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-dispatch" version = "2.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.33#05ee2dbf537bf5bbcbc5b4785be62088034bdd58" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.36#63309df8e9a4b19ab4ceb2fd1a37f7968c111de9" dependencies = [ "fp-evm", "frame-support", @@ -6685,7 +6717,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-modexp" version = "2.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.33#05ee2dbf537bf5bbcbc5b4785be62088034bdd58" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.36#63309df8e9a4b19ab4ceb2fd1a37f7968c111de9" dependencies = [ "fp-evm", "num", @@ -6694,7 +6726,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-simple" version = "2.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.33#05ee2dbf537bf5bbcbc5b4785be62088034bdd58" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.36#63309df8e9a4b19ab4ceb2fd1a37f7968c111de9" dependencies = [ "fp-evm", "ripemd", @@ -6704,7 +6736,7 @@ dependencies = [ [[package]] name = "pallet-fast-unstake" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -6722,7 +6754,7 @@ dependencies = [ [[package]] name = "pallet-fee-market" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.33#3c4598428c048b78749ad334a1e134f435984daf" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.36#3cb281ddcd5a85b15da08bc2380f130d69ea2279" dependencies = [ "bp-messages", "bp-runtime", @@ -6738,25 +6770,10 @@ dependencies = [ "sp-std", ] -[[package]] -name = "pallet-gilt" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" -dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", - "parity-scale-codec", - "scale-info", - "sp-arithmetic", - "sp-runtime", - "sp-std", -] - [[package]] name = "pallet-grandpa" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "frame-benchmarking", "frame-support", @@ -6779,7 +6796,7 @@ dependencies = [ [[package]] name = "pallet-identity" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "enumflags2", "frame-benchmarking", @@ -6795,7 +6812,7 @@ dependencies = [ [[package]] name = "pallet-im-online" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "frame-benchmarking", "frame-support", @@ -6815,7 +6832,7 @@ dependencies = [ [[package]] name = "pallet-indices" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "frame-benchmarking", "frame-support", @@ -6832,7 +6849,7 @@ dependencies = [ [[package]] name = "pallet-membership" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "frame-benchmarking", "frame-support", @@ -6849,9 +6866,8 @@ dependencies = [ [[package]] name = "pallet-mmr" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ - "ckb-merkle-mountain-range", "frame-benchmarking", "frame-support", "frame-system", @@ -6865,33 +6881,33 @@ dependencies = [ ] [[package]] -name = "pallet-mmr-rpc" -version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +name = "pallet-multisig" +version = "4.0.0-dev" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ - "anyhow", - "jsonrpsee", + "frame-benchmarking", + "frame-support", + "frame-system", + "log", "parity-scale-codec", - "serde", - "sp-api", - "sp-blockchain", - "sp-core", - "sp-mmr-primitives", + "scale-info", + "sp-io", "sp-runtime", + "sp-std", ] [[package]] -name = "pallet-multisig" +name = "pallet-nis" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "frame-benchmarking", "frame-support", "frame-system", - "log", "parity-scale-codec", "scale-info", - "sp-io", + "sp-arithmetic", + "sp-core", "sp-runtime", "sp-std", ] @@ -6899,7 +6915,7 @@ dependencies = [ [[package]] name = "pallet-nomination-pools" version = "1.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "frame-support", "frame-system", @@ -6916,7 +6932,7 @@ dependencies = [ [[package]] name = "pallet-nomination-pools-benchmarking" version = "1.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -6936,7 +6952,7 @@ dependencies = [ [[package]] name = "pallet-nomination-pools-runtime-api" version = "1.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "parity-scale-codec", "sp-api", @@ -6946,7 +6962,7 @@ dependencies = [ [[package]] name = "pallet-offences" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "frame-support", "frame-system", @@ -6963,7 +6979,7 @@ dependencies = [ [[package]] name = "pallet-offences-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -6986,7 +7002,7 @@ dependencies = [ [[package]] name = "pallet-preimage" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "frame-benchmarking", "frame-support", @@ -7003,7 +7019,7 @@ dependencies = [ [[package]] name = "pallet-proxy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "frame-benchmarking", "frame-support", @@ -7018,7 +7034,7 @@ dependencies = [ [[package]] name = "pallet-ranked-collective" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "frame-benchmarking", "frame-support", @@ -7036,7 +7052,7 @@ dependencies = [ [[package]] name = "pallet-recovery" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "frame-benchmarking", "frame-support", @@ -7051,12 +7067,13 @@ dependencies = [ [[package]] name = "pallet-referenda" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "assert_matches", "frame-benchmarking", "frame-support", "frame-system", + "log", "parity-scale-codec", "scale-info", "serde", @@ -7069,7 +7086,7 @@ dependencies = [ [[package]] name = "pallet-scheduler" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "frame-benchmarking", "frame-support", @@ -7080,12 +7097,13 @@ dependencies = [ "sp-io", "sp-runtime", "sp-std", + "sp-weights", ] [[package]] name = "pallet-session" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "frame-support", "frame-system", @@ -7106,7 +7124,7 @@ dependencies = [ [[package]] name = "pallet-session-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "frame-benchmarking", "frame-support", @@ -7122,7 +7140,7 @@ dependencies = [ [[package]] name = "pallet-society" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "frame-support", "frame-system", @@ -7136,7 +7154,7 @@ dependencies = [ [[package]] name = "pallet-staking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -7159,7 +7177,7 @@ dependencies = [ [[package]] name = "pallet-staking-reward-curve" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -7170,7 +7188,7 @@ dependencies = [ [[package]] name = "pallet-staking-reward-fn" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "log", "sp-arithmetic", @@ -7179,7 +7197,7 @@ dependencies = [ [[package]] name = "pallet-state-trie-migration" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "frame-benchmarking", "frame-support", @@ -7196,7 +7214,7 @@ dependencies = [ [[package]] name = "pallet-sudo" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "frame-support", "frame-system", @@ -7210,7 +7228,7 @@ dependencies = [ [[package]] name = "pallet-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "frame-benchmarking", "frame-support", @@ -7228,7 +7246,7 @@ dependencies = [ [[package]] name = "pallet-tips" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "frame-benchmarking", "frame-support", @@ -7247,7 +7265,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "frame-support", "frame-system", @@ -7263,7 +7281,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "jsonrpsee", "pallet-transaction-payment-rpc-runtime-api", @@ -7279,7 +7297,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "pallet-transaction-payment", "parity-scale-codec", @@ -7291,7 +7309,7 @@ dependencies = [ [[package]] name = "pallet-treasury" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "frame-benchmarking", "frame-support", @@ -7308,7 +7326,7 @@ dependencies = [ [[package]] name = "pallet-utility" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "frame-benchmarking", "frame-support", @@ -7324,7 +7342,7 @@ dependencies = [ [[package]] name = "pallet-vesting" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "frame-benchmarking", "frame-support", @@ -7339,7 +7357,7 @@ dependencies = [ [[package]] name = "pallet-whitelist" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "frame-benchmarking", "frame-support", @@ -7353,8 +7371,8 @@ dependencies = [ [[package]] name = "pallet-xcm" -version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" +version = "0.9.36" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" dependencies = [ "frame-support", "frame-system", @@ -7371,8 +7389,8 @@ dependencies = [ [[package]] name = "pallet-xcm-benchmarks" -version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" +version = "0.9.36" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" dependencies = [ "frame-benchmarking", "frame-support", @@ -7492,7 +7510,7 @@ dependencies = [ [[package]] name = "parachain-info" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.33#27721d794ee63aae42317a7eeda21595dd3200d9" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.36#afe528af891f464b318293f183f6d3eefbc979b0" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -7553,35 +7571,6 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aa9777aa91b8ad9dd5aaa04a9b6bcb02c7f1deb952fca5a66034d5e63afc5c6f" -[[package]] -name = "parity-util-mem" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d32c34f4f5ca7f9196001c0aba5a1f9a5a12382c8944b8b0f90233282d1e8f8" -dependencies = [ - "cfg-if", - "ethereum-types 0.14.1", - "hashbrown", - "impl-trait-for-tuples", - "lru", - "parity-util-mem-derive", - "parking_lot 0.12.1", - "primitive-types 0.12.1", - "smallvec", - "winapi", -] - -[[package]] -name = "parity-util-mem-derive" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f557c32c6d268a07c921471619c0295f5efad3a0e76d4f97a05c091a51d110b2" -dependencies = [ - "proc-macro2", - "syn", - "synstructure", -] - [[package]] name = "parity-wasm" version = "0.45.0" @@ -7800,8 +7789,8 @@ checksum = "e3d7ddaed09e0eb771a79ab0fd64609ba0afb0a8366421957936ad14cbd13630" [[package]] name = "polkadot-approval-distribution" -version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" +version = "0.9.36" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" dependencies = [ "futures", "polkadot-node-network-protocol", @@ -7815,8 +7804,8 @@ dependencies = [ [[package]] name = "polkadot-availability-bitfield-distribution" -version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" +version = "0.9.36" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" dependencies = [ "futures", "polkadot-node-network-protocol", @@ -7829,8 +7818,8 @@ dependencies = [ [[package]] name = "polkadot-availability-distribution" -version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" +version = "0.9.36" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" dependencies = [ "derive_more", "fatality", @@ -7852,8 +7841,8 @@ dependencies = [ [[package]] name = "polkadot-availability-recovery" -version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" +version = "0.9.36" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" dependencies = [ "fatality", "futures", @@ -7873,8 +7862,8 @@ dependencies = [ [[package]] name = "polkadot-cli" -version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" +version = "0.9.36" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" dependencies = [ "clap", "frame-benchmarking-cli", @@ -7886,12 +7875,13 @@ dependencies = [ "polkadot-performance-test", "polkadot-service", "sc-cli", + "sc-executor", "sc-service", "sc-sysinfo", "sc-tracing", "sp-core", + "sp-io", "sp-keyring", - "sp-trie", "substrate-build-script-utils", "thiserror", "try-runtime-cli", @@ -7899,14 +7889,15 @@ dependencies = [ [[package]] name = "polkadot-client" -version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" +version = "0.9.36" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" dependencies = [ - "beefy-primitives", + "async-trait", "frame-benchmarking", "frame-benchmarking-cli", "frame-system", "frame-system-rpc-runtime-api", + "futures", "kusama-runtime", "pallet-transaction-payment", "pallet-transaction-payment-rpc-runtime-api", @@ -7922,6 +7913,7 @@ dependencies = [ "sc-service", "sp-api", "sp-authority-discovery", + "sp-beefy", "sp-block-builder", "sp-blockchain", "sp-consensus", @@ -7941,8 +7933,8 @@ dependencies = [ [[package]] name = "polkadot-collator-protocol" -version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" +version = "0.9.36" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" dependencies = [ "always-assert", "bitvec", @@ -7963,11 +7955,10 @@ dependencies = [ [[package]] name = "polkadot-core-primitives" -version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" +version = "0.9.36" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" dependencies = [ "parity-scale-codec", - "parity-util-mem", "scale-info", "sp-core", "sp-runtime", @@ -7976,8 +7967,8 @@ dependencies = [ [[package]] name = "polkadot-dispute-distribution" -version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" +version = "0.9.36" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" dependencies = [ "derive_more", "fatality", @@ -8001,8 +7992,8 @@ dependencies = [ [[package]] name = "polkadot-erasure-coding" -version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" +version = "0.9.36" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" dependencies = [ "parity-scale-codec", "polkadot-node-primitives", @@ -8015,8 +8006,8 @@ dependencies = [ [[package]] name = "polkadot-gossip-support" -version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" +version = "0.9.36" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" dependencies = [ "futures", "futures-timer", @@ -8035,8 +8026,8 @@ dependencies = [ [[package]] name = "polkadot-network-bridge" -version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" +version = "0.9.36" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" dependencies = [ "always-assert", "async-trait", @@ -8059,8 +8050,8 @@ dependencies = [ [[package]] name = "polkadot-node-collation-generation" -version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" +version = "0.9.36" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" dependencies = [ "futures", "parity-scale-codec", @@ -8077,8 +8068,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-approval-voting" -version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" +version = "0.9.36" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" dependencies = [ "bitvec", "derive_more", @@ -8106,8 +8097,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-av-store" -version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" +version = "0.9.36" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" dependencies = [ "bitvec", "futures", @@ -8126,8 +8117,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-backing" -version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" +version = "0.9.36" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" dependencies = [ "bitvec", "fatality", @@ -8145,8 +8136,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-bitfield-signing" -version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" +version = "0.9.36" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" dependencies = [ "futures", "polkadot-node-subsystem", @@ -8160,8 +8151,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-candidate-validation" -version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" +version = "0.9.36" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" dependencies = [ "async-trait", "futures", @@ -8179,8 +8170,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-chain-api" -version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" +version = "0.9.36" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" dependencies = [ "futures", "polkadot-node-subsystem", @@ -8194,8 +8185,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-chain-selection" -version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" +version = "0.9.36" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" dependencies = [ "futures", "futures-timer", @@ -8211,8 +8202,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-dispute-coordinator" -version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" +version = "0.9.36" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" dependencies = [ "fatality", "futures", @@ -8230,13 +8221,14 @@ dependencies = [ [[package]] name = "polkadot-node-core-parachains-inherent" -version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" +version = "0.9.36" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" dependencies = [ "async-trait", "futures", "futures-timer", "polkadot-node-subsystem", + "polkadot-overseer", "polkadot-primitives", "sp-blockchain", "sp-inherents", @@ -8247,8 +8239,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-provisioner" -version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" +version = "0.9.36" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" dependencies = [ "bitvec", "fatality", @@ -8265,13 +8257,14 @@ dependencies = [ [[package]] name = "polkadot-node-core-pvf" -version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" +version = "0.9.36" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" dependencies = [ "always-assert", "assert_matches", "async-process", "async-std", + "cpu-time", "futures", "futures-timer", "parity-scale-codec", @@ -8297,8 +8290,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-pvf-checker" -version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" +version = "0.9.36" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" dependencies = [ "futures", "polkadot-node-primitives", @@ -8313,12 +8306,11 @@ dependencies = [ [[package]] name = "polkadot-node-core-runtime-api" -version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" +version = "0.9.36" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" dependencies = [ "futures", - "memory-lru", - "parity-util-mem", + "lru", "polkadot-node-subsystem", "polkadot-node-subsystem-types", "polkadot-node-subsystem-util", @@ -8329,10 +8321,9 @@ dependencies = [ [[package]] name = "polkadot-node-jaeger" -version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" +version = "0.9.36" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" dependencies = [ - "async-std", "lazy_static", "log", "mick-jaeger", @@ -8343,12 +8334,13 @@ dependencies = [ "sc-network", "sp-core", "thiserror", + "tokio", ] [[package]] name = "polkadot-node-metrics" -version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" +version = "0.9.36" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" dependencies = [ "bs58", "futures", @@ -8366,8 +8358,8 @@ dependencies = [ [[package]] name = "polkadot-node-network-protocol" -version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" +version = "0.9.36" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" dependencies = [ "async-trait", "derive_more", @@ -8389,8 +8381,8 @@ dependencies = [ [[package]] name = "polkadot-node-primitives" -version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" +version = "0.9.36" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" dependencies = [ "bounded-vec", "futures", @@ -8411,8 +8403,8 @@ dependencies = [ [[package]] name = "polkadot-node-subsystem" -version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" +version = "0.9.36" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" dependencies = [ "polkadot-node-jaeger", "polkadot-node-subsystem-types", @@ -8421,8 +8413,8 @@ dependencies = [ [[package]] name = "polkadot-node-subsystem-types" -version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" +version = "0.9.36" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" dependencies = [ "async-trait", "derive_more", @@ -8444,8 +8436,8 @@ dependencies = [ [[package]] name = "polkadot-node-subsystem-util" -version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" +version = "0.9.36" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" dependencies = [ "async-trait", "derive_more", @@ -8456,7 +8448,6 @@ dependencies = [ "lru", "parity-db", "parity-scale-codec", - "parity-util-mem", "parking_lot 0.11.2", "pin-project", "polkadot-node-jaeger", @@ -8477,15 +8468,14 @@ dependencies = [ [[package]] name = "polkadot-overseer" -version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" +version = "0.9.36" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" dependencies = [ "async-trait", "futures", "futures-timer", "lru", "orchestra", - "parity-util-mem", "parking_lot 0.12.1", "polkadot-node-metrics", "polkadot-node-network-protocol", @@ -8495,18 +8485,18 @@ dependencies = [ "sc-client-api", "sp-api", "sp-core", + "tikv-jemalloc-ctl", "tracing-gum", ] [[package]] name = "polkadot-parachain" -version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" +version = "0.9.36" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" dependencies = [ "derive_more", "frame-support", "parity-scale-codec", - "parity-util-mem", "polkadot-core-primitives", "scale-info", "serde", @@ -8517,8 +8507,8 @@ dependencies = [ [[package]] name = "polkadot-performance-test" -version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" +version = "0.9.36" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" dependencies = [ "env_logger 0.9.3", "kusama-runtime", @@ -8532,13 +8522,12 @@ dependencies = [ [[package]] name = "polkadot-primitives" -version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" +version = "0.9.36" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" dependencies = [ "bitvec", "hex-literal", "parity-scale-codec", - "parity-util-mem", "polkadot-core-primitives", "polkadot-parachain", "scale-info", @@ -8559,13 +8548,13 @@ dependencies = [ [[package]] name = "polkadot-rpc" -version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" +version = "0.9.36" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" dependencies = [ "beefy-gadget", "beefy-gadget-rpc", "jsonrpsee", - "pallet-mmr-rpc", + "mmr-rpc", "pallet-transaction-payment-rpc", "polkadot-primitives", "sc-chain-spec", @@ -8591,10 +8580,9 @@ dependencies = [ [[package]] name = "polkadot-runtime" -version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" +version = "0.9.36" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" dependencies = [ - "beefy-primitives", "bitvec", "frame-benchmarking", "frame-election-provider-support", @@ -8657,6 +8645,7 @@ dependencies = [ "smallvec", "sp-api", "sp-authority-discovery", + "sp-beefy", "sp-block-builder", "sp-consensus-babe", "sp-core", @@ -8680,10 +8669,9 @@ dependencies = [ [[package]] name = "polkadot-runtime-common" -version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" +version = "0.9.36" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" dependencies = [ - "beefy-primitives", "bitvec", "frame-benchmarking", "frame-election-provider-support", @@ -8714,6 +8702,7 @@ dependencies = [ "serde_derive", "slot-range-helper", "sp-api", + "sp-beefy", "sp-core", "sp-inherents", "sp-io", @@ -8728,8 +8717,8 @@ dependencies = [ [[package]] name = "polkadot-runtime-constants" -version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" +version = "0.9.36" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" dependencies = [ "frame-support", "polkadot-primitives", @@ -8742,8 +8731,8 @@ dependencies = [ [[package]] name = "polkadot-runtime-metrics" -version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" +version = "0.9.36" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" dependencies = [ "bs58", "parity-scale-codec", @@ -8754,8 +8743,8 @@ dependencies = [ [[package]] name = "polkadot-runtime-parachains" -version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" +version = "0.9.36" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" dependencies = [ "bitflags", "bitvec", @@ -8797,12 +8786,11 @@ dependencies = [ [[package]] name = "polkadot-service" -version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" +version = "0.9.36" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" dependencies = [ "async-trait", "beefy-gadget", - "beefy-primitives", "frame-support", "frame-system-rpc-runtime-api", "futures", @@ -8812,6 +8800,7 @@ dependencies = [ "kvdb", "kvdb-rocksdb", "lru", + "mmr-gadget", "pallet-babe", "pallet-im-online", "pallet-staking", @@ -8878,6 +8867,7 @@ dependencies = [ "serde_json", "sp-api", "sp-authority-discovery", + "sp-beefy", "sp-block-builder", "sp-blockchain", "sp-consensus", @@ -8887,6 +8877,7 @@ dependencies = [ "sp-inherents", "sp-io", "sp-keystore", + "sp-mmr-primitives", "sp-offchain", "sp-runtime", "sp-session", @@ -8903,8 +8894,8 @@ dependencies = [ [[package]] name = "polkadot-statement-distribution" -version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" +version = "0.9.36" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" dependencies = [ "arrayvec 0.5.2", "fatality", @@ -8924,8 +8915,8 @@ dependencies = [ [[package]] name = "polkadot-statement-table" -version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" +version = "0.9.36" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" dependencies = [ "parity-scale-codec", "polkadot-primitives", @@ -8978,7 +8969,7 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "precompile-utils" version = "0.1.0" -source = "git+https://github.com/darwinia-network/moonbeam?branch=polkadot-v0.9.33#4ea11a7b2b71e0f4f6d100f5fa04e0f3ea285895" +source = "git+https://github.com/darwinia-network/moonbeam?branch=polkadot-v0.9.36#f5c98d5612bdb7b6311005f41fc873400d5e1481" dependencies = [ "affix", "derive_more", @@ -9008,7 +8999,7 @@ dependencies = [ [[package]] name = "precompile-utils-macro" version = "0.1.0" -source = "git+https://github.com/darwinia-network/moonbeam?branch=polkadot-v0.9.33#4ea11a7b2b71e0f4f6d100f5fa04e0f3ea285895" +source = "git+https://github.com/darwinia-network/moonbeam?branch=polkadot-v0.9.36#f5c98d5612bdb7b6311005f41fc873400d5e1481" dependencies = [ "case", "num_enum", @@ -9518,23 +9509,6 @@ version = "0.6.28" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" -[[package]] -name = "remote-externalities" -version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" -dependencies = [ - "env_logger 0.9.3", - "log", - "parity-scale-codec", - "serde", - "serde_json", - "sp-core", - "sp-io", - "sp-runtime", - "sp-version", - "substrate-rpc-client", -] - [[package]] name = "remove_dir_all" version = "0.5.3" @@ -9623,11 +9597,10 @@ dependencies = [ [[package]] name = "rococo-runtime" -version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" +version = "0.9.36" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" dependencies = [ "beefy-merkle-tree", - "beefy-primitives", "frame-benchmarking", "frame-executive", "frame-support", @@ -9647,7 +9620,6 @@ dependencies = [ "pallet-collective", "pallet-democracy", "pallet-elections-phragmen", - "pallet-gilt", "pallet-grandpa", "pallet-identity", "pallet-im-online", @@ -9655,6 +9627,7 @@ dependencies = [ "pallet-membership", "pallet-mmr", "pallet-multisig", + "pallet-nis", "pallet-offences", "pallet-preimage", "pallet-proxy", @@ -9686,6 +9659,7 @@ dependencies = [ "smallvec", "sp-api", "sp-authority-discovery", + "sp-beefy", "sp-block-builder", "sp-consensus-babe", "sp-core", @@ -9708,8 +9682,8 @@ dependencies = [ [[package]] name = "rococo-runtime-constants" -version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" +version = "0.9.36" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" dependencies = [ "frame-support", "polkadot-primitives", @@ -9879,7 +9853,7 @@ dependencies = [ [[package]] name = "sc-allocator" version = "4.1.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "log", "sp-core", @@ -9890,7 +9864,7 @@ dependencies = [ [[package]] name = "sc-authority-discovery" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "async-trait", "futures", @@ -9917,7 +9891,7 @@ dependencies = [ [[package]] name = "sc-basic-authorship" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "futures", "futures-timer", @@ -9940,7 +9914,7 @@ dependencies = [ [[package]] name = "sc-block-builder" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "parity-scale-codec", "sc-client-api", @@ -9956,7 +9930,7 @@ dependencies = [ [[package]] name = "sc-chain-spec" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "impl-trait-for-tuples", "memmap2", @@ -9973,7 +9947,7 @@ dependencies = [ [[package]] name = "sc-chain-spec-derive" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -9984,7 +9958,7 @@ dependencies = [ [[package]] name = "sc-cli" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "array-bytes 4.2.0", "chrono", @@ -10024,7 +9998,7 @@ dependencies = [ [[package]] name = "sc-client-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "fnv", "futures", @@ -10052,7 +10026,7 @@ dependencies = [ [[package]] name = "sc-client-db" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "hash-db", "kvdb", @@ -10077,13 +10051,14 @@ dependencies = [ [[package]] name = "sc-consensus" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "async-trait", "futures", "futures-timer", "libp2p", "log", + "mockall", "parking_lot 0.12.1", "sc-client-api", "sc-utils", @@ -10101,7 +10076,7 @@ dependencies = [ [[package]] name = "sc-consensus-aura" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "async-trait", "futures", @@ -10130,7 +10105,7 @@ dependencies = [ [[package]] name = "sc-consensus-babe" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "async-trait", "fork-tree", @@ -10171,7 +10146,7 @@ dependencies = [ [[package]] name = "sc-consensus-babe-rpc" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "futures", "jsonrpsee", @@ -10193,7 +10168,7 @@ dependencies = [ [[package]] name = "sc-consensus-epochs" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "fork-tree", "parity-scale-codec", @@ -10206,7 +10181,7 @@ dependencies = [ [[package]] name = "sc-consensus-slots" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "async-trait", "futures", @@ -10230,9 +10205,8 @@ dependencies = [ [[package]] name = "sc-executor" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ - "lazy_static", "lru", "parity-scale-codec", "parking_lot 0.12.1", @@ -10241,7 +10215,6 @@ dependencies = [ "sc-executor-wasmtime", "sp-api", "sp-core", - "sp-core-hashing-proc-macro", "sp-externalities", "sp-io", "sp-panic-handler", @@ -10256,13 +10229,10 @@ dependencies = [ [[package]] name = "sc-executor-common" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ - "environmental", - "parity-scale-codec", "sc-allocator", "sp-maybe-compressed-blob", - "sp-sandbox", "sp-wasm-interface", "thiserror", "wasm-instrument", @@ -10272,14 +10242,12 @@ dependencies = [ [[package]] name = "sc-executor-wasmi" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "log", - "parity-scale-codec", "sc-allocator", "sc-executor-common", "sp-runtime-interface", - "sp-sandbox", "sp-wasm-interface", "wasmi", ] @@ -10287,19 +10255,16 @@ dependencies = [ [[package]] name = "sc-executor-wasmtime" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "cfg-if", "libc", "log", "once_cell", - "parity-scale-codec", - "parity-wasm", "rustix 0.35.13", "sc-allocator", "sc-executor-common", "sp-runtime-interface", - "sp-sandbox", "sp-wasm-interface", "wasmtime", ] @@ -10307,7 +10272,7 @@ dependencies = [ [[package]] name = "sc-finality-grandpa" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "ahash", "array-bytes 4.2.0", @@ -10348,7 +10313,7 @@ dependencies = [ [[package]] name = "sc-finality-grandpa-rpc" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "finality-grandpa", "futures", @@ -10369,13 +10334,12 @@ dependencies = [ [[package]] name = "sc-informant" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "ansi_term", "futures", "futures-timer", "log", - "parity-util-mem", "sc-client-api", "sc-network-common", "sc-transaction-pool-api", @@ -10386,7 +10350,7 @@ dependencies = [ [[package]] name = "sc-keystore" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "array-bytes 4.2.0", "async-trait", @@ -10401,7 +10365,7 @@ dependencies = [ [[package]] name = "sc-network" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "array-bytes 4.2.0", "async-trait", @@ -10448,7 +10412,7 @@ dependencies = [ [[package]] name = "sc-network-bitswap" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "cid", "futures", @@ -10468,7 +10432,7 @@ dependencies = [ [[package]] name = "sc-network-common" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "async-trait", "bitflags", @@ -10494,7 +10458,7 @@ dependencies = [ [[package]] name = "sc-network-gossip" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "ahash", "futures", @@ -10512,7 +10476,7 @@ dependencies = [ [[package]] name = "sc-network-light" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "array-bytes 4.2.0", "futures", @@ -10533,9 +10497,10 @@ dependencies = [ [[package]] name = "sc-network-sync" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "array-bytes 4.2.0", + "async-trait", "fork-tree", "futures", "libp2p", @@ -10557,13 +10522,14 @@ dependencies = [ "sp-core", "sp-finality-grandpa", "sp-runtime", + "substrate-prometheus-endpoint", "thiserror", ] [[package]] name = "sc-network-transactions" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "array-bytes 4.2.0", "futures", @@ -10582,7 +10548,7 @@ dependencies = [ [[package]] name = "sc-offchain" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "array-bytes 4.2.0", "bytes", @@ -10612,7 +10578,7 @@ dependencies = [ [[package]] name = "sc-peerset" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "futures", "libp2p", @@ -10625,7 +10591,7 @@ dependencies = [ [[package]] name = "sc-proposer-metrics" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "log", "substrate-prometheus-endpoint", @@ -10634,7 +10600,7 @@ dependencies = [ [[package]] name = "sc-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "futures", "hash-db", @@ -10664,7 +10630,7 @@ dependencies = [ [[package]] name = "sc-rpc-api" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "futures", "jsonrpsee", @@ -10687,20 +10653,23 @@ dependencies = [ [[package]] name = "sc-rpc-server" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "futures", + "http", "jsonrpsee", "log", "serde_json", "substrate-prometheus-endpoint", "tokio", + "tower", + "tower-http", ] [[package]] name = "sc-rpc-spec-v2" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "futures", "hex", @@ -10719,7 +10688,7 @@ dependencies = [ [[package]] name = "sc-service" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "async-trait", "directories", @@ -10730,7 +10699,6 @@ dependencies = [ "jsonrpsee", "log", "parity-scale-codec", - "parity-util-mem", "parking_lot 0.12.1", "pin-project", "rand 0.7.3", @@ -10790,12 +10758,10 @@ dependencies = [ [[package]] name = "sc-state-db" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "log", "parity-scale-codec", - "parity-util-mem", - "parity-util-mem-derive", "parking_lot 0.12.1", "sc-client-api", "sp-core", @@ -10804,7 +10770,7 @@ dependencies = [ [[package]] name = "sc-sync-state-rpc" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "jsonrpsee", "parity-scale-codec", @@ -10823,7 +10789,7 @@ dependencies = [ [[package]] name = "sc-sysinfo" version = "6.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "futures", "libc", @@ -10842,7 +10808,7 @@ dependencies = [ [[package]] name = "sc-telemetry" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "chrono", "futures", @@ -10860,7 +10826,7 @@ dependencies = [ [[package]] name = "sc-tracing" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "ansi_term", "atty", @@ -10891,7 +10857,7 @@ dependencies = [ [[package]] name = "sc-tracing-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -10902,7 +10868,7 @@ dependencies = [ [[package]] name = "sc-transaction-pool" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "async-trait", "futures", @@ -10910,7 +10876,6 @@ dependencies = [ "linked-hash-map", "log", "parity-scale-codec", - "parity-util-mem", "parking_lot 0.12.1", "sc-client-api", "sc-transaction-pool-api", @@ -10929,7 +10894,7 @@ dependencies = [ [[package]] name = "sc-transaction-pool-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "async-trait", "futures", @@ -10943,7 +10908,7 @@ dependencies = [ [[package]] name = "sc-utils" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "futures", "futures-timer", @@ -11333,8 +11298,8 @@ checksum = "03b634d87b960ab1a38c4fe143b508576f075e7c978bfad18217645ebfdfa2ec" [[package]] name = "slot-range-helper" -version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" +version = "0.9.36" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" dependencies = [ "enumn", "parity-scale-codec", @@ -11401,6 +11366,7 @@ dependencies = [ "bytes", "flate2", "futures", + "http", "httparse", "log", "rand 0.8.5", @@ -11410,7 +11376,7 @@ dependencies = [ [[package]] name = "sp-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "hash-db", "log", @@ -11428,7 +11394,7 @@ dependencies = [ [[package]] name = "sp-api-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "blake2", "proc-macro-crate", @@ -11439,8 +11405,8 @@ dependencies = [ [[package]] name = "sp-application-crypto" -version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +version = "7.0.0" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "parity-scale-codec", "scale-info", @@ -11452,8 +11418,8 @@ dependencies = [ [[package]] name = "sp-arithmetic" -version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +version = "6.0.0" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "integer-sqrt", "num-traits", @@ -11468,7 +11434,7 @@ dependencies = [ [[package]] name = "sp-authority-discovery" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "parity-scale-codec", "scale-info", @@ -11481,7 +11447,7 @@ dependencies = [ [[package]] name = "sp-authorship" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "async-trait", "parity-scale-codec", @@ -11490,10 +11456,27 @@ dependencies = [ "sp-std", ] +[[package]] +name = "sp-beefy" +version = "4.0.0-dev" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +dependencies = [ + "parity-scale-codec", + "scale-info", + "serde", + "sp-api", + "sp-application-crypto", + "sp-core", + "sp-io", + "sp-mmr-primitives", + "sp-runtime", + "sp-std", +] + [[package]] name = "sp-block-builder" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "parity-scale-codec", "sp-api", @@ -11505,7 +11488,7 @@ dependencies = [ [[package]] name = "sp-blockchain" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "futures", "log", @@ -11523,7 +11506,7 @@ dependencies = [ [[package]] name = "sp-consensus" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "async-trait", "futures", @@ -11542,7 +11525,7 @@ dependencies = [ [[package]] name = "sp-consensus-aura" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "async-trait", "parity-scale-codec", @@ -11560,7 +11543,7 @@ dependencies = [ [[package]] name = "sp-consensus-babe" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "async-trait", "merlin", @@ -11583,7 +11566,7 @@ dependencies = [ [[package]] name = "sp-consensus-slots" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "parity-scale-codec", "scale-info", @@ -11597,7 +11580,7 @@ dependencies = [ [[package]] name = "sp-consensus-vrf" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "parity-scale-codec", "scale-info", @@ -11609,8 +11592,8 @@ dependencies = [ [[package]] name = "sp-core" -version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +version = "7.0.0" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "array-bytes 4.2.0", "base58", @@ -11654,8 +11637,8 @@ dependencies = [ [[package]] name = "sp-core-hashing" -version = "4.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +version = "5.0.0" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "blake2", "byteorder", @@ -11669,7 +11652,7 @@ dependencies = [ [[package]] name = "sp-core-hashing-proc-macro" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "proc-macro2", "quote", @@ -11680,7 +11663,7 @@ dependencies = [ [[package]] name = "sp-database" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "kvdb", "parking_lot 0.12.1", @@ -11688,8 +11671,8 @@ dependencies = [ [[package]] name = "sp-debug-derive" -version = "4.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +version = "5.0.0" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "proc-macro2", "quote", @@ -11698,8 +11681,8 @@ dependencies = [ [[package]] name = "sp-externalities" -version = "0.12.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +version = "0.13.0" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "environmental", "parity-scale-codec", @@ -11710,7 +11693,7 @@ dependencies = [ [[package]] name = "sp-finality-grandpa" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "finality-grandpa", "log", @@ -11728,7 +11711,7 @@ dependencies = [ [[package]] name = "sp-inherents" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "async-trait", "impl-trait-for-tuples", @@ -11741,10 +11724,11 @@ dependencies = [ [[package]] name = "sp-io" -version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +version = "7.0.0" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "bytes", + "ed25519-dalek", "futures", "hash-db", "libsecp256k1 0.7.1", @@ -11767,8 +11751,8 @@ dependencies = [ [[package]] name = "sp-keyring" -version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +version = "7.0.0" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "lazy_static", "sp-core", @@ -11778,8 +11762,8 @@ dependencies = [ [[package]] name = "sp-keystore" -version = "0.12.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +version = "0.13.0" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "async-trait", "futures", @@ -11796,7 +11780,7 @@ dependencies = [ [[package]] name = "sp-maybe-compressed-blob" version = "4.1.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "thiserror", "zstd", @@ -11805,8 +11789,9 @@ dependencies = [ [[package]] name = "sp-mmr-primitives" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ + "ckb-merkle-mountain-range", "log", "parity-scale-codec", "scale-info", @@ -11822,7 +11807,7 @@ dependencies = [ [[package]] name = "sp-npos-elections" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "parity-scale-codec", "scale-info", @@ -11836,7 +11821,7 @@ dependencies = [ [[package]] name = "sp-offchain" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "sp-api", "sp-core", @@ -11845,8 +11830,8 @@ dependencies = [ [[package]] name = "sp-panic-handler" -version = "4.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +version = "5.0.0" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "backtrace", "lazy_static", @@ -11856,7 +11841,7 @@ dependencies = [ [[package]] name = "sp-rpc" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "rustc-hash", "serde", @@ -11865,15 +11850,14 @@ dependencies = [ [[package]] name = "sp-runtime" -version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +version = "7.0.0" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "either", "hash256-std-hasher", "impl-trait-for-tuples", "log", "parity-scale-codec", - "parity-util-mem", "paste", "rand 0.7.3", "scale-info", @@ -11888,8 +11872,8 @@ dependencies = [ [[package]] name = "sp-runtime-interface" -version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +version = "7.0.0" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "bytes", "impl-trait-for-tuples", @@ -11906,8 +11890,8 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" -version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +version = "6.0.0" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "Inflector", "proc-macro-crate", @@ -11916,24 +11900,10 @@ dependencies = [ "syn", ] -[[package]] -name = "sp-sandbox" -version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" -dependencies = [ - "log", - "parity-scale-codec", - "sp-core", - "sp-io", - "sp-std", - "sp-wasm-interface", - "wasmi", -] - [[package]] name = "sp-session" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "parity-scale-codec", "scale-info", @@ -11947,18 +11917,19 @@ dependencies = [ [[package]] name = "sp-staking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "parity-scale-codec", "scale-info", + "sp-core", "sp-runtime", "sp-std", ] [[package]] name = "sp-state-machine" -version = "0.12.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +version = "0.13.0" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "hash-db", "log", @@ -11979,13 +11950,13 @@ dependencies = [ [[package]] name = "sp-std" -version = "4.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +version = "5.0.0" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" [[package]] name = "sp-storage" -version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +version = "7.0.0" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "impl-serde 0.4.0", "parity-scale-codec", @@ -11998,7 +11969,7 @@ dependencies = [ [[package]] name = "sp-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "async-trait", "futures-timer", @@ -12013,8 +11984,8 @@ dependencies = [ [[package]] name = "sp-tracing" -version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +version = "6.0.0" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "parity-scale-codec", "sp-std", @@ -12026,7 +11997,7 @@ dependencies = [ [[package]] name = "sp-transaction-pool" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "sp-api", "sp-runtime", @@ -12035,7 +12006,7 @@ dependencies = [ [[package]] name = "sp-transaction-storage-proof" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "async-trait", "log", @@ -12050,8 +12021,8 @@ dependencies = [ [[package]] name = "sp-trie" -version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +version = "7.0.0" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "ahash", "hash-db", @@ -12074,7 +12045,7 @@ dependencies = [ [[package]] name = "sp-version" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "impl-serde 0.4.0", "parity-scale-codec", @@ -12091,7 +12062,7 @@ dependencies = [ [[package]] name = "sp-version-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "parity-scale-codec", "proc-macro2", @@ -12101,8 +12072,8 @@ dependencies = [ [[package]] name = "sp-wasm-interface" -version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +version = "7.0.0" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "impl-trait-for-tuples", "log", @@ -12115,7 +12086,7 @@ dependencies = [ [[package]] name = "sp-weights" version = "4.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", @@ -12294,7 +12265,7 @@ dependencies = [ [[package]] name = "substrate-build-script-utils" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "platforms 2.0.0", ] @@ -12313,7 +12284,7 @@ dependencies = [ [[package]] name = "substrate-frame-rpc-system" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "frame-system-rpc-runtime-api", "futures", @@ -12334,7 +12305,7 @@ dependencies = [ [[package]] name = "substrate-prometheus-endpoint" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "futures-util", "hyper", @@ -12347,7 +12318,7 @@ dependencies = [ [[package]] name = "substrate-rpc-client" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "async-trait", "jsonrpsee", @@ -12360,7 +12331,7 @@ dependencies = [ [[package]] name = "substrate-state-trie-migration-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "jsonrpsee", "log", @@ -12381,7 +12352,7 @@ dependencies = [ [[package]] name = "substrate-wasm-builder" version = "5.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "ansi_term", "build-helper", @@ -12543,6 +12514,17 @@ dependencies = [ "threadpool", ] +[[package]] +name = "tikv-jemalloc-ctl" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e37706572f4b151dff7a0146e040804e9c26fe3a3118591112f05cf12a4216c1" +dependencies = [ + "libc", + "paste", + "tikv-jemalloc-sys", +] + [[package]] name = "tikv-jemalloc-sys" version = "0.5.2+5.3.0-patched" @@ -12702,6 +12684,41 @@ dependencies = [ "toml_datetime", ] +[[package]] +name = "tower" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" +dependencies = [ + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "tower-http" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f873044bf02dd1e8239e9c1293ea39dad76dc594ec16185d0a1bf31d8dc8d858" +dependencies = [ + "bitflags", + "bytes", + "futures-core", + "futures-util", + "http", + "http-body", + "http-range-header", + "pin-project-lite 0.2.9", + "tower-layer", + "tower-service", +] + +[[package]] +name = "tower-layer" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0" + [[package]] name = "tower-service" version = "0.3.2" @@ -12715,6 +12732,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" dependencies = [ "cfg-if", + "log", "pin-project-lite 0.2.9", "tracing-attributes", "tracing-core", @@ -12753,8 +12771,8 @@ dependencies = [ [[package]] name = "tracing-gum" -version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" +version = "0.9.36" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" dependencies = [ "polkadot-node-jaeger", "polkadot-primitives", @@ -12764,8 +12782,8 @@ dependencies = [ [[package]] name = "tracing-gum-proc-macro" -version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" +version = "0.9.36" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" dependencies = [ "expander 0.0.6", "proc-macro-crate", @@ -12870,6 +12888,7 @@ dependencies = [ "smallvec", "thiserror", "tinyvec", + "tokio", "tracing", "url", ] @@ -12889,6 +12908,7 @@ dependencies = [ "resolv-conf", "smallvec", "thiserror", + "tokio", "tracing", "trust-dns-proto", ] @@ -12902,22 +12922,26 @@ checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" [[package]] name = "try-runtime-cli" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.33#2dff067e9f7f6f3cc4dbfdaaa97753eccc407689" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" dependencies = [ "clap", + "frame-remote-externalities", "frame-try-runtime", + "hex", "log", "parity-scale-codec", - "remote-externalities", "sc-chain-spec", "sc-cli", "sc-executor", "sc-service", "serde", + "sp-api", "sp-core", + "sp-debug-derive", "sp-externalities", "sp-io", "sp-keystore", + "sp-rpc", "sp-runtime", "sp-state-machine", "sp-version", @@ -12977,15 +13001,6 @@ dependencies = [ "static_assertions", ] -[[package]] -name = "unicase" -version = "2.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6" -dependencies = [ - "version_check", -] - [[package]] name = "unicode-bidi" version = "0.3.10" @@ -13526,10 +13541,9 @@ dependencies = [ [[package]] name = "westend-runtime" -version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" +version = "0.9.36" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" dependencies = [ - "beefy-primitives", "bitvec", "frame-benchmarking", "frame-election-provider-support", @@ -13593,6 +13607,7 @@ dependencies = [ "smallvec", "sp-api", "sp-authority-discovery", + "sp-beefy", "sp-block-builder", "sp-consensus-babe", "sp-core", @@ -13616,8 +13631,8 @@ dependencies = [ [[package]] name = "westend-runtime-constants" -version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" +version = "0.9.36" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" dependencies = [ "frame-support", "polkadot-primitives", @@ -13850,8 +13865,8 @@ dependencies = [ [[package]] name = "xcm" -version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" +version = "0.9.36" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" dependencies = [ "derivative", "impl-trait-for-tuples", @@ -13864,8 +13879,8 @@ dependencies = [ [[package]] name = "xcm-builder" -version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" +version = "0.9.36" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" dependencies = [ "frame-support", "frame-system", @@ -13884,8 +13899,8 @@ dependencies = [ [[package]] name = "xcm-executor" -version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" +version = "0.9.36" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" dependencies = [ "frame-benchmarking", "frame-support", @@ -13903,7 +13918,7 @@ dependencies = [ [[package]] name = "xcm-primitives" version = "0.1.0" -source = "git+https://github.com/darwinia-network/moonbeam?branch=polkadot-v0.9.33#4ea11a7b2b71e0f4f6d100f5fa04e0f3ea285895" +source = "git+https://github.com/darwinia-network/moonbeam?branch=polkadot-v0.9.36#f5c98d5612bdb7b6311005f41fc873400d5e1481" dependencies = [ "ethereum", "ethereum-types 0.14.1", @@ -13926,8 +13941,8 @@ dependencies = [ [[package]] name = "xcm-procedural" -version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.33#c7d6c21242fc654f6f069e12c00951484dff334d" +version = "0.9.36" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" dependencies = [ "Inflector", "proc-macro2", diff --git a/Cargo.toml b/Cargo.toml index 69296e149..1310fe082 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,3 +9,171 @@ members = [ "precompile/*", "runtime/*", ] + +[patch."https://github.com/paritytech/substrate"] +beefy-gadget = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +beefy-gadget-rpc = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +beefy-merkle-tree = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +frame-benchmarking = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +frame-benchmarking-cli = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +frame-election-provider-solution-type = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +frame-election-provider-support = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +frame-executive = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +frame-support = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +frame-support-procedural = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +frame-support-procedural-tools = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +frame-support-procedural-tools-derive = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +frame-system = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +frame-system-benchmarking = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +frame-system-rpc-runtime-api = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +frame-try-runtime = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +mmr-gadget = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +mmr-rpc = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +pallet-assets = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +pallet-aura = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +pallet-authority-discovery = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +pallet-authorship = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +pallet-babe = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +pallet-bags-list = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +pallet-balances = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +pallet-beefy = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +pallet-beefy-mmr = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +pallet-bounties = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +pallet-child-bounties = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +pallet-collective = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +pallet-conviction-voting = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +pallet-democracy = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +pallet-election-provider-multi-phase = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +pallet-election-provider-support-benchmarking = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +pallet-elections-phragmen = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +pallet-fast-unstake = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +pallet-grandpa = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +pallet-identity = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +pallet-im-online = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +pallet-indices = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +pallet-membership = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +pallet-mmr = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +pallet-multisig = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +pallet-nis = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +pallet-nomination-pools = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +pallet-nomination-pools-benchmarking = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +pallet-nomination-pools-runtime-api = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +pallet-offences = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +pallet-offences-benchmarking = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +pallet-preimage = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +pallet-proxy = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +pallet-ranked-collective = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +pallet-recovery = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +pallet-referenda = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +pallet-scheduler = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +pallet-session = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +pallet-session-benchmarking = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +pallet-society = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +pallet-staking = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +pallet-staking-reward-curve = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +pallet-staking-reward-fn = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +pallet-state-trie-migration = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +pallet-sudo = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +pallet-timestamp = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +pallet-tips = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +pallet-transaction-payment = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +pallet-transaction-payment-rpc = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +pallet-transaction-payment-rpc-runtime-api = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +pallet-treasury = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +pallet-utility = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +pallet-vesting = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +pallet-whitelist = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +sc-allocator = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +sc-authority-discovery = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +sc-basic-authorship = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +sc-block-builder = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +sc-chain-spec = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +sc-chain-spec-derive = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +sc-cli = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +sc-client-api = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +sc-client-db = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +sc-consensus = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +sc-consensus-aura = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +sc-consensus-babe = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +sc-consensus-babe-rpc = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +sc-consensus-epochs = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +sc-consensus-slots = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +sc-executor = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +sc-executor-common = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +sc-executor-wasmi = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +sc-executor-wasmtime = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +sc-finality-grandpa = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +sc-finality-grandpa-rpc = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +sc-informant = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +sc-keystore = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +sc-network = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +sc-network-common = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +sc-network-gossip = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +sc-offchain = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +sc-peerset = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +sc-proposer-metrics = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +sc-rpc = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +sc-rpc-api = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +sc-rpc-server = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +sc-service = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +sc-state-db = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +sc-sync-state-rpc = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +sc-sysinfo = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +sc-telemetry = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +sc-tracing = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +sc-tracing-proc-macro = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +sc-transaction-pool = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +sc-transaction-pool-api = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +sc-utils = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +sp-api = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +sp-api-proc-macro = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +sp-application-crypto = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +sp-arithmetic = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +sp-authority-discovery = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +sp-beefy = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +sp-block-builder = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +sp-blockchain = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +sp-consensus = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +sp-consensus-aura = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +sp-consensus-babe = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +sp-consensus-slots = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +sp-consensus-vrf = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +sp-core = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +sp-database = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +sp-debug-derive = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +sp-externalities = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +sp-finality-grandpa = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +sp-inherents = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +sp-io = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +sp-keyring = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +sp-keystore = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +sp-maybe-compressed-blob = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +sp-mmr-primitives = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +sp-npos-elections = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +sp-offchain = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +sp-panic-handler = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +sp-rpc = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +sp-runtime = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +sp-runtime-interface = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +sp-runtime-interface-proc-macro = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +sp-session = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +sp-staking = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +sp-state-machine = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +sp-std = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +sp-storage = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +sp-timestamp = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +sp-tracing = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +sp-transaction-pool = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +sp-transaction-storage-proof = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +sp-trie = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +sp-version = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +sp-version-proc-macro = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +sp-wasm-interface = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +sp-weights = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +substrate-build-script-utils = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +substrate-frame-rpc-system = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +substrate-prometheus-endpoint = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +substrate-rpc-client = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +substrate-state-trie-migration-rpc = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +substrate-wasm-builder = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +try-runtime-cli = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } diff --git a/core/inflation/Cargo.toml b/core/inflation/Cargo.toml index e9144376a..fab9422d6 100644 --- a/core/inflation/Cargo.toml +++ b/core/inflation/Cargo.toml @@ -20,7 +20,7 @@ dc-types = { path = "../types" } substrate-fixed = { default-features = false, git = "https://github.com/encointer/substrate-fixed" } [dev-dependencies] -sp-arithmetic = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-arithmetic = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } [features] default = ["std"] diff --git a/core/primitives/Cargo.toml b/core/primitives/Cargo.toml index cb9fd0668..06bfcfe0f 100644 --- a/core/primitives/Cargo.toml +++ b/core/primitives/Cargo.toml @@ -14,11 +14,11 @@ version = "6.0.0" dc-types = { path = "../types" } # moonbeam -account = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.33" } +account = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.36" } # substrate -sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } [features] default = ["std"] diff --git a/node/Cargo.toml b/node/Cargo.toml index f9d496488..d2f622827 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -10,7 +10,7 @@ repository = "https://github.com/darwinia-network/darwinia" version = "6.0.0" [build-dependencies] -substrate-build-script-utils = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +substrate-build-script-utils = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } [dependencies] # crates.io @@ -19,21 +19,20 @@ async-trait = { version = "0.1" } clap = { version = "4.0", features = ["derive"] } codec = { package = "parity-scale-codec", version = "3.3" } futures = { version = "0.3" } -jsonrpsee = { version = "0.15", features = ["server"] } +jsonrpsee = { version = "0.16", features = ["server"] } log = { version = "0.4" } serde = { version = "1.0", features = ["derive"] } # cumulus -cumulus-client-cli = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.33" } -cumulus-client-consensus-aura = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.33" } -cumulus-client-consensus-common = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.33" } -cumulus-client-network = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.33" } -cumulus-client-service = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.33" } -cumulus-primitives-core = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.33" } -cumulus-primitives-parachain-inherent = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.33" } -cumulus-relay-chain-inprocess-interface = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.33" } -cumulus-relay-chain-interface = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.33" } -cumulus-relay-chain-minimal-node = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.33" } +cumulus-client-cli = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.36" } +cumulus-client-collator = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.36" } +cumulus-client-consensus-aura = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.36" } +cumulus-client-consensus-common = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.36" } +cumulus-client-network = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.36" } +cumulus-client-service = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.36" } +cumulus-primitives-core = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.36" } +cumulus-primitives-parachain-inherent = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.36" } +cumulus-relay-chain-interface = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.36" } # darwinia crab-runtime = { path = "../runtime/crab" } @@ -42,57 +41,63 @@ dc-primitives = { path = "../core/primitives" } pangolin-runtime = { path = "../runtime/pangolin" } # frontier -fc-cli = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } -fc-db = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } -fc-mapping-sync = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } -fc-rpc = { features = ["rpc_binary_search_estimate"], git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } -fc-rpc-core = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } -fp-evm = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } -fp-rpc = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } -fp-storage = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } +fc-cli = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } +fc-consensus = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } +fc-db = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } +fc-mapping-sync = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } +fc-rpc = { features = ["rpc_binary_search_estimate"], git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } +fc-rpc-core = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } +fp-evm = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } +fp-rpc = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } +fp-storage = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } # polkadot -polkadot-cli = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.33" } -polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.33" } -polkadot-service = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.33" } -xcm = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.33" } +polkadot-cli = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36" } +polkadot-parachain = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36" } +polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36" } +polkadot-service = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36" } +xcm = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36" } # substrate -frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -frame-benchmarking-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-transaction-payment-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sc-basic-authorship = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sc-chain-spec = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sc-cli = { features = ["wasmtime"], git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sc-consensus-aura = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sc-executor = { features = ["wasmtime"], git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sc-network = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sc-network-common = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sc-offchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sc-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sc-service = { features = ["wasmtime"], git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sc-sysinfo = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sc-telemetry = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sc-tracing = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sc-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sc-transaction-pool-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-block-builder = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-consensus = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-consensus-aura = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-offchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-session = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -substrate-frame-rpc-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -substrate-prometheus-endpoint = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -try-runtime-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33", optional = true} +frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +frame-benchmarking-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-transaction-payment-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sc-basic-authorship = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sc-chain-spec = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sc-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sc-consensus-aura = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sc-executor = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sc-keystore = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sc-network = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sc-network-common = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sc-offchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sc-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sc-rpc-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sc-service = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sc-sysinfo = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sc-telemetry = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sc-tracing = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sc-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sc-transaction-pool-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-block-builder = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-consensus = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-consensus-aura = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-inherents = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-offchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-session = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +substrate-frame-rpc-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +substrate-prometheus-endpoint = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +try-runtime-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36", optional = true} [features] default = [] diff --git a/node/src/cli.rs b/node/src/cli.rs index 809159bec..428092f16 100644 --- a/node/src/cli.rs +++ b/node/src/cli.rs @@ -55,7 +55,7 @@ pub enum Subcommand { /// Sub-commands concerned with benchmarking. /// The pallet benchmarking moved to the `pallet` sub-command. #[command(subcommand)] - Benchmark(frame_benchmarking_cli::BenchmarkCmd), + Benchmark(Box), /// Try some testing command against a specified runtime state. #[cfg(feature = "try-runtime")] diff --git a/node/src/command.rs b/node/src/command.rs index 3692eb7a6..19aa62e49 100644 --- a/node/src/command.rs +++ b/node/src/command.rs @@ -450,10 +450,10 @@ pub fn run() -> Result<()> { }) }, Some(Subcommand::Benchmark(cmd)) => { - let runner = cli.create_runner(cmd)?; + let runner = cli.create_runner(&**cmd)?; // Switch on the concrete benchmark sub-command- - match cmd { + match &**cmd { BenchmarkCmd::Pallet(cmd) => if cfg!(feature = "runtime-benchmarks") { runner.sync_run(|config| { @@ -504,22 +504,29 @@ pub fn run() -> Result<()> { let chain_spec = &runner.config().chain_spec; set_default_ss58_version(chain_spec); + + use sc_executor::{sp_wasm_interface::ExtendedHostFunctions, NativeExecutionDispatch}; + type HostFunctionsOf = ExtendedHostFunctions< + sp_io::SubstrateHostFunctions, + ::ExtendHostFunctions, + >; + // grab the task manager. let registry = &runner.config().prometheus_config.as_ref().map(|cfg| &cfg.registry); let task_manager = TaskManager::new(runner.config().tokio_handle.clone(), *registry) .map_err(|e| format!("Error: {:?}", e))?; if chain_spec.is_crab() { - runner.async_run(|config| { - Ok((cmd.run::(config), task_manager)) + runner.async_run(|_| { + Ok((cmd.run::>(), task_manager)) }) } else if chain_spec.is_pangolin() { - runner.async_run(|config| { - Ok((cmd.run::(config), task_manager)) + runner.async_run(|_| { + Ok((cmd.run::>(), task_manager)) }) } else { - runner.async_run(|config| { - Ok((cmd.run::(config), task_manager)) + runner.async_run(|_| { + Ok((cmd.run::>(), task_manager)) }) } }, @@ -570,7 +577,7 @@ pub fn run() -> Result<()> { if config.role.is_authority() { "yes" } else { "no" } ); - if collator_options.relay_chain_rpc_url.is_some() && !cli.relay_chain_args.is_empty() { + if !collator_options.relay_chain_rpc_urls.is_empty() && !cli.relay_chain_args.is_empty() { log::warn!("Detected relay chain node arguments together with --relay-chain-rpc-url. This command starts a minimal Polkadot node that only uses a network-related subset of all relay chain CLI options."); } diff --git a/node/src/service/mod.rs b/node/src/service/mod.rs index 3b19fd8ec..d50bc381f 100644 --- a/node/src/service/mod.rs +++ b/node/src/service/mod.rs @@ -38,6 +38,7 @@ use crate::frontier_service; use darwinia_runtime::AuraId; use dc_primitives::*; // substrate +use sc_consensus::ImportQueue; use sc_network_common::service::NetworkBlock; use sp_core::Pair; use sp_runtime::app_crypto::AppKey; @@ -46,7 +47,11 @@ type FullBackend = sc_service::TFullBackend; type FullClient = sc_service::TFullClient>; type ParachainBlockImport = - cumulus_client_consensus_common::ParachainBlockImport>>; + cumulus_client_consensus_common::ParachainBlockImport< + Block, + Arc>, + FullBackend, + >; /// Can be called for a `Configuration` to check if it is a configuration for the `Crab` network. pub trait IdentifyVariant { @@ -176,7 +181,7 @@ where client.clone(), ); - let block_import = ParachainBlockImport::new(client.clone()); + let block_import = ParachainBlockImport::new(client.clone(), backend.clone()); let import_queue = parachain_build_import_queue( client.clone(), @@ -215,35 +220,6 @@ where }) } -async fn build_relay_chain_interface( - polkadot_config: sc_service::Configuration, - parachain_config: &sc_service::Configuration, - telemetry_worker_handle: Option, - task_manager: &mut sc_service::TaskManager, - collator_options: cumulus_client_cli::CollatorOptions, - hwbench: Option, -) -> cumulus_relay_chain_interface::RelayChainResult<( - Arc<(dyn 'static + cumulus_relay_chain_interface::RelayChainInterface)>, - Option, -)> { - match collator_options.relay_chain_rpc_url { - Some(relay_chain_url) => - cumulus_relay_chain_minimal_node::build_minimal_relay_chain_node( - polkadot_config, - task_manager, - relay_chain_url, - ) - .await, - None => cumulus_relay_chain_inprocess_interface::build_inprocess_relay_chain( - polkadot_config, - parachain_config, - telemetry_worker_handle, - task_manager, - hwbench, - ), - } -} - /// Start a node with the given parachain `Configuration` and relay chain `Configuration`. /// /// This is the actual implementation that is abstract over the executor and the runtime api. @@ -307,21 +283,22 @@ where ), } = new_partial::(¶chain_config, eth_rpc_config)?; - let (relay_chain_interface, collator_key) = build_relay_chain_interface( - polkadot_config, - ¶chain_config, - telemetry_worker_handle, - &mut task_manager, - collator_options.clone(), - hwbench.clone(), - ) - .await - .map_err(|e| match e { - cumulus_relay_chain_interface::RelayChainError::ServiceError( - polkadot_service::Error::Sub(x), - ) => x, - s => s.to_string().into(), - })?; + let (relay_chain_interface, collator_key) = + cumulus_client_service::build_relay_chain_interface( + polkadot_config, + ¶chain_config, + telemetry_worker_handle, + &mut task_manager, + collator_options.clone(), + hwbench.clone(), + ) + .await + .map_err(|e| match e { + cumulus_relay_chain_interface::RelayChainError::ServiceError( + polkadot_service::Error::Sub(x), + ) => x, + s => s.to_string().into(), + })?; let block_announce_validator = cumulus_client_network::BlockAnnounceValidator::new(relay_chain_interface.clone(), para_id); @@ -329,7 +306,7 @@ where let force_authoring = parachain_config.force_authoring; let validator = parachain_config.role.is_authority(); let prometheus_registry = parachain_config.prometheus_registry().cloned(); - let import_queue = cumulus_client_service::SharedImportQueue::new(import_queue); + let import_queue_service = import_queue.service(); let (network, system_rpc_tx, tx_handler_controller, start_network) = sc_service::build_network(sc_service::BuildNetworkParams { @@ -337,12 +314,22 @@ where client: client.clone(), transaction_pool: transaction_pool.clone(), spawn_handle: task_manager.spawn_handle(), - import_queue: import_queue.clone(), + import_queue, block_announce_validator_builder: Some(Box::new(|_| { Box::new(block_announce_validator) })), warp_sync: None, })?; + + if parachain_config.offchain_worker.enabled { + sc_service::build_offchain_workers( + ¶chain_config, + task_manager.spawn_handle(), + client.clone(), + network.clone(), + ); + } + let overrides = frontier_service::overrides_handle(client.clone()); let block_data_cache = Arc::new(fc_rpc::EthBlockDataCacheTask::new( task_manager.spawn_handle(), @@ -452,7 +439,7 @@ where relay_chain_interface, spawner, parachain_consensus, - import_queue, + import_queue: import_queue_service, collator_key: collator_key.expect("Command line arguments do not allow this. qed"), relay_chain_slot_duration, }; @@ -466,7 +453,7 @@ where para_id, relay_chain_interface, relay_chain_slot_duration, - import_queue, + import_queue: import_queue_service, }; cumulus_client_service::start_full_node(params)?; diff --git a/pallet/account-migration/Cargo.toml b/pallet/account-migration/Cargo.toml index 203adcc30..fef26a182 100644 --- a/pallet/account-migration/Cargo.toml +++ b/pallet/account-migration/Cargo.toml @@ -21,18 +21,18 @@ darwinia-staking = { default-features = false, path = "../staking" } dc-primitives = { default-features = false, path = "../../core/primitives" } # substrate -frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-assets = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-balances = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-identity = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-vesting = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-assets = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-balances = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-identity = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-vesting = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } [dev-dependencies] -sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } [features] default = ["std"] diff --git a/pallet/account-migration/src/lib.rs b/pallet/account-migration/src/lib.rs index 8dcb69745..b587517e2 100644 --- a/pallet/account-migration/src/lib.rs +++ b/pallet/account-migration/src/lib.rs @@ -252,7 +252,7 @@ pub mod pallet { if amount >= sum { >::transfer( RawOrigin::Signed(to).into(), - KTON_ID, + KTON_ID.into(), staking_pot, sum, )?; diff --git a/pallet/deposit/Cargo.toml b/pallet/deposit/Cargo.toml index 55ee4d13b..194a6c8d3 100644 --- a/pallet/deposit/Cargo.toml +++ b/pallet/deposit/Cargo.toml @@ -20,18 +20,18 @@ dc-inflation = { default-features = false, path = "../../core/inflation" } dc-types = { path = "../../core/types" } # subtrate -frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } [dev-dependencies] # substrate -pallet-assets = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-assets = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } [features] default = ["std"] diff --git a/pallet/deposit/tests/mock.rs b/pallet/deposit/tests/mock.rs index 48fdb0e94..a28aea9c9 100644 --- a/pallet/deposit/tests/mock.rs +++ b/pallet/deposit/tests/mock.rs @@ -73,6 +73,7 @@ impl pallet_assets::Config for Runtime { type AssetAccountDeposit = (); type AssetDeposit = (); type AssetId = AssetId; + type AssetIdParameter = codec::Compact; type Balance = Balance; type CreateOrigin = frame_support::traits::AsEnsureOriginWithArg< frame_system::EnsureSignedBy, u32>, @@ -83,6 +84,7 @@ impl pallet_assets::Config for Runtime { type Freezer = (); type MetadataDepositBase = (); type MetadataDepositPerByte = (); + type RemoveItemsLimit = (); type RuntimeEvent = RuntimeEvent; type StringLimit = frame_support::traits::ConstU32<4>; type WeightInfo = (); @@ -93,7 +95,7 @@ impl darwinia_deposit::SimpleAsset for KtonAsset { type AccountId = u32; fn mint(beneficiary: &Self::AccountId, amount: Balance) -> sp_runtime::DispatchResult { - Assets::mint(RuntimeOrigin::signed(0), 0, *beneficiary, amount) + Assets::mint(RuntimeOrigin::signed(0), 0.into(), *beneficiary, amount) } fn burn(who: &Self::AccountId, amount: Balance) -> sp_runtime::DispatchResult { @@ -101,7 +103,7 @@ impl darwinia_deposit::SimpleAsset for KtonAsset { Err(>::BalanceLow)?; } - Assets::burn(RuntimeOrigin::signed(0), 0, *who, amount) + Assets::burn(RuntimeOrigin::signed(0), 0.into(), *who, amount) } } impl darwinia_deposit::Config for Runtime { diff --git a/pallet/ecdsa-authority/Cargo.toml b/pallet/ecdsa-authority/Cargo.toml index 6a10ceaeb..cd070c027 100644 --- a/pallet/ecdsa-authority/Cargo.toml +++ b/pallet/ecdsa-authority/Cargo.toml @@ -19,17 +19,17 @@ scale-info = { version = "2.3", default-features = false } dc-primitives = { default-features = false, path = "../../core/primitives" } # substrate -frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-io = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-io = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } [dev-dependencies] array-bytes = { version = "6.0" } libsecp256k1 = { version = "0.7" } -sp-version = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-version = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } [features] default = ["std"] diff --git a/pallet/message-gadget/Cargo.toml b/pallet/message-gadget/Cargo.toml index 2e18d1860..7fd841027 100644 --- a/pallet/message-gadget/Cargo.toml +++ b/pallet/message-gadget/Cargo.toml @@ -15,23 +15,23 @@ codec = { package = "parity-scale-codec", version = "3.3", default-features scale-info = { version = "2.3", default-features = false, features = ["derive"] } # frontier -pallet-evm = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } +pallet-evm = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } # paritytech -frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-io = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-io = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } [dev-dependencies] # crates.io array-bytes = { version = "6.0" } # substrate -pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } [features] default = ["std"] diff --git a/pallet/message-gadget/src/lib.rs b/pallet/message-gadget/src/lib.rs index ed0a1ec2a..e36ca4b40 100644 --- a/pallet/message-gadget/src/lib.rs +++ b/pallet/message-gadget/src/lib.rs @@ -57,6 +57,7 @@ pub mod pallet { pub struct Pallet(_); #[pallet::call] impl Pallet { + #[pallet::call_index(0)] #[pallet::weight(0)] pub fn set_commitment_contract( origin: OriginFor, diff --git a/pallet/message-transact/Cargo.toml b/pallet/message-transact/Cargo.toml index fcd39611d..0a3893435 100644 --- a/pallet/message-transact/Cargo.toml +++ b/pallet/message-transact/Cargo.toml @@ -16,16 +16,16 @@ ethereum = { version = "0.14", default-features = false, features = ["with-cod scale-info = { version = "2.3", default-features = false, features = ["derive"] } # frontier -fp-ethereum = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } -fp-evm = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } -pallet-evm = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } +fp-ethereum = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } +fp-evm = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } +pallet-evm = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } # substrate -frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } [dev-dependencies] array-bytes = { version = "6.0" } @@ -34,21 +34,21 @@ rlp = { version = "0.5" } sha3 = { version = "0.9" } # darwinia -bp-message-dispatch = { git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.33" } -bp-runtime = { git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.33" } -pallet-bridge-dispatch = { git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.33" } +bp-message-dispatch = { git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } +bp-runtime = { git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } +pallet-bridge-dispatch = { git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } # frontier -fp-self-contained = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } -pallet-ethereum = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } +fp-self-contained = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } +pallet-ethereum = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } # moonbeam -precompile-utils = { git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.33", features = ["testing"] } +precompile-utils = { git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.36", features = ["testing"] } # substrate -pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } [features] default = ["std"] diff --git a/pallet/staking/Cargo.toml b/pallet/staking/Cargo.toml index dcdbea2b9..bde5a6416 100644 --- a/pallet/staking/Cargo.toml +++ b/pallet/staking/Cargo.toml @@ -19,13 +19,13 @@ dc-inflation = { default-features = false, path = "../../core/inflation" } dc-types = { path = "../../core/types" } # subtrate -frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-authorship = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-session = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-authorship = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-session = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } [dev-dependencies] # crates.io @@ -35,11 +35,11 @@ pretty_env_logger = { version = "0.4" } darwinia-deposit = { path = "../deposit" } # substrate -pallet-assets = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-session = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-assets = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-session = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } [features] default = ["std"] diff --git a/pallet/staking/tests/mock.rs b/pallet/staking/tests/mock.rs index 980cd862c..91422e9fc 100644 --- a/pallet/staking/tests/mock.rs +++ b/pallet/staking/tests/mock.rs @@ -75,6 +75,7 @@ impl pallet_assets::Config for Runtime { type AssetAccountDeposit = (); type AssetDeposit = (); type AssetId = AssetId; + type AssetIdParameter = codec::Compact; type Balance = Balance; type CreateOrigin = frame_support::traits::AsEnsureOriginWithArg< frame_system::EnsureSignedBy, u32>, @@ -85,6 +86,7 @@ impl pallet_assets::Config for Runtime { type Freezer = (); type MetadataDepositBase = (); type MetadataDepositPerByte = (); + type RemoveItemsLimit = (); type RuntimeEvent = RuntimeEvent; type StringLimit = frame_support::traits::ConstU32<4>; type WeightInfo = (); @@ -108,7 +110,7 @@ impl darwinia_deposit::SimpleAsset for KtonAsset { type AccountId = u32; fn mint(beneficiary: &Self::AccountId, amount: Balance) -> sp_runtime::DispatchResult { - Assets::mint(RuntimeOrigin::signed(0), 0, *beneficiary, amount) + Assets::mint(RuntimeOrigin::signed(0), 0.into(), *beneficiary, amount) } fn burn(who: &Self::AccountId, amount: Balance) -> sp_runtime::DispatchResult { @@ -116,7 +118,7 @@ impl darwinia_deposit::SimpleAsset for KtonAsset { Err(>::BalanceLow)?; } - Assets::burn(RuntimeOrigin::signed(0), 0, *who, amount) + Assets::burn(RuntimeOrigin::signed(0), 0.into(), *who, amount) } } impl darwinia_deposit::Config for Runtime { @@ -202,11 +204,21 @@ impl darwinia_staking::Stake for KtonStaking { type Item = Balance; fn stake(who: &Self::AccountId, item: Self::Item) -> sp_runtime::DispatchResult { - Assets::transfer(RuntimeOrigin::signed(*who), 0, darwinia_staking::account_id(), item) + Assets::transfer( + RuntimeOrigin::signed(*who), + 0.into(), + darwinia_staking::account_id(), + item, + ) } fn unstake(who: &Self::AccountId, item: Self::Item) -> sp_runtime::DispatchResult { - Assets::transfer(RuntimeOrigin::signed(darwinia_staking::account_id()), 0, *who, item) + Assets::transfer( + RuntimeOrigin::signed(darwinia_staking::account_id()), + 0.into(), + *who, + item, + ) } } frame_support::parameter_types! { diff --git a/precompile/assets/Cargo.toml b/precompile/assets/Cargo.toml index 2200c55bd..c68602593 100644 --- a/precompile/assets/Cargo.toml +++ b/precompile/assets/Cargo.toml @@ -11,19 +11,19 @@ version = "6.0.0" [dependencies] # frontier -fp-evm = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } -pallet-evm = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } +fp-evm = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } +pallet-evm = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } # moonbeam -precompile-utils = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.33" } +precompile-utils = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.36" } # paritytech -frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-assets = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-assets = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } [dev-dependencies] # crates.io codec = { package = "parity-scale-codec", version = "3.3" } @@ -31,14 +31,14 @@ scale-info = { version = "2.3", features = ["derive"] } sha3 = { version = "0.8" } # moonbeam -precompile-utils = { git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.33", features = ["testing"] } +precompile-utils = { git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.36", features = ["testing"] } # paritytech -pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } [features] default = ["std"] diff --git a/precompile/assets/src/lib.rs b/precompile/assets/src/lib.rs index 8e14a735f..eab87041e 100644 --- a/precompile/assets/src/lib.rs +++ b/precompile/assets/src/lib.rs @@ -147,7 +147,7 @@ where handle, Some(owner.clone()).into(), pallet_assets::Call::::cancel_approval { - id: asset_id, + id: asset_id.into(), delegate: Runtime::Lookup::unlookup(spender.clone()), }, )?; @@ -156,7 +156,7 @@ where handle, Some(owner).into(), pallet_assets::Call::::approve_transfer { - id: asset_id, + id: asset_id.into(), delegate: Runtime::Lookup::unlookup(spender), amount, }, @@ -190,7 +190,7 @@ where handle, Some(origin).into(), pallet_assets::Call::::transfer { - id: asset_id, + id: asset_id.into(), target: Runtime::Lookup::unlookup(to), amount: value, }, @@ -233,7 +233,7 @@ where handle, Some(caller).into(), pallet_assets::Call::::transfer_approved { - id: asset_id, + id: asset_id.into(), owner: Runtime::Lookup::unlookup(from), destination: Runtime::Lookup::unlookup(to), amount: value, @@ -244,7 +244,7 @@ where handle, Some(from).into(), pallet_assets::Call::::transfer { - id: asset_id, + id: asset_id.into(), target: Runtime::Lookup::unlookup(to), amount: value, }, @@ -306,7 +306,7 @@ where handle, Some(origin).into(), pallet_assets::Call::::mint { - id: asset_id, + id: asset_id.into(), beneficiary: Runtime::Lookup::unlookup(to), amount: value, }, @@ -340,7 +340,7 @@ where handle, Some(origin).into(), pallet_assets::Call::::burn { - id: asset_id, + id: asset_id.into(), who: Runtime::Lookup::unlookup(from), amount: value, }, @@ -372,7 +372,7 @@ where handle, Some(origin).into(), pallet_assets::Call::::transfer_ownership { - id: asset_id, + id: asset_id.into(), owner: Runtime::Lookup::unlookup(owner), }, )?; @@ -394,7 +394,7 @@ where handle, Some(origin).into(), pallet_assets::Call::::freeze { - id: asset_id, + id: asset_id.into(), who: Runtime::Lookup::unlookup(account), }, )?; @@ -416,7 +416,7 @@ where handle, Some(origin).into(), pallet_assets::Call::::thaw { - id: asset_id, + id: asset_id.into(), who: Runtime::Lookup::unlookup(account), }, )?; diff --git a/precompile/assets/src/mock.rs b/precompile/assets/src/mock.rs index b03d21f68..470a5ee2a 100644 --- a/precompile/assets/src/mock.rs +++ b/precompile/assets/src/mock.rs @@ -176,6 +176,7 @@ impl pallet_assets::Config for TestRuntime { type AssetAccountDeposit = (); type AssetDeposit = (); type AssetId = AssetId; + type AssetIdParameter = codec::Compact; type Balance = Balance; type CreateOrigin = frame_support::traits::AsEnsureOriginWithArg< frame_system::EnsureSignedBy, AccountId>, @@ -186,6 +187,7 @@ impl pallet_assets::Config for TestRuntime { type Freezer = (); type MetadataDepositBase = (); type MetadataDepositPerByte = (); + type RemoveItemsLimit = (); type RuntimeEvent = RuntimeEvent; type StringLimit = frame_support::traits::ConstU32<50>; type WeightInfo = (); diff --git a/precompile/assets/src/tests.rs b/precompile/assets/src/tests.rs index 5858987b5..3246fc789 100644 --- a/precompile/assets/src/tests.rs +++ b/precompile/assets/src/tests.rs @@ -20,13 +20,8 @@ use sha3::{Digest, Keccak256}; // darwinia use crate::{ - log3, - mock::{ - Account::{Alice, Bob, Charlie, Precompile}, - Assets, ExtBuilder, InternalCall, PrecompilesValue, RuntimeOrigin, TestPrecompiles, - TestRuntime, TEST_ID, - }, - SELECTOR_LOG_APPROVAL, SELECTOR_LOG_TRANSFER, + mock::{Account::*, *}, + *, }; // moonbeam use precompile_utils::{ @@ -75,7 +70,13 @@ fn selectors() { #[test] fn selector_less_than_four_bytes() { ExtBuilder::default().build().execute_with(|| { - assert_ok!(Assets::force_create(RuntimeOrigin::root(), TEST_ID, Alice.into(), true, 1)); + assert_ok!(Assets::force_create( + RuntimeOrigin::root(), + TEST_ID.into(), + Alice.into(), + true, + 1 + )); // This selector is only three bytes long when four are required. precompiles() .prepare_test(Alice, Precompile, vec![1u8, 2u8, 3u8]) @@ -86,7 +87,13 @@ fn selector_less_than_four_bytes() { #[test] fn no_selector_exists_but_length_is_right() { ExtBuilder::default().build().execute_with(|| { - assert_ok!(Assets::force_create(RuntimeOrigin::root(), TEST_ID, Alice.into(), true, 1)); + assert_ok!(Assets::force_create( + RuntimeOrigin::root(), + TEST_ID.into(), + Alice.into(), + true, + 1 + )); precompiles() .prepare_test(Alice, Precompile, vec![1u8, 2u8, 3u8, 4u8]) @@ -97,7 +104,13 @@ fn no_selector_exists_but_length_is_right() { #[test] fn modifiers() { ExtBuilder::default().with_balances(vec![(Alice.into(), 1000)]).build().execute_with(|| { - assert_ok!(Assets::force_create(RuntimeOrigin::root(), TEST_ID, Alice.into(), true, 1)); + assert_ok!(Assets::force_create( + RuntimeOrigin::root(), + TEST_ID.into(), + Alice.into(), + true, + 1 + )); let mut tester = PrecompilesModifierTester::new(precompiles(), Alice, Precompile); tester.test_view_modifier(InternalCall::balance_of_selectors()); @@ -124,10 +137,16 @@ fn get_total_supply() { .with_balances(vec![(Alice.into(), 1000), (Bob.into(), 2500)]) .build() .execute_with(|| { - assert_ok!(Assets::force_create(RuntimeOrigin::root(), TEST_ID, Alice.into(), true, 1)); + assert_ok!(Assets::force_create( + RuntimeOrigin::root(), + TEST_ID.into(), + Alice.into(), + true, + 1 + )); assert_ok!(Assets::mint( RuntimeOrigin::signed(Alice.into()), - TEST_ID, + TEST_ID.into(), Alice.into(), 1000 )); @@ -142,8 +161,19 @@ fn get_total_supply() { #[test] fn get_balances_known_user() { ExtBuilder::default().with_balances(vec![(Alice.into(), 1000)]).build().execute_with(|| { - assert_ok!(Assets::force_create(RuntimeOrigin::root(), TEST_ID, Alice.into(), true, 1)); - assert_ok!(Assets::mint(RuntimeOrigin::signed(Alice.into()), TEST_ID, Alice.into(), 1000)); + assert_ok!(Assets::force_create( + RuntimeOrigin::root(), + TEST_ID.into(), + Alice.into(), + true, + 1 + )); + assert_ok!(Assets::mint( + RuntimeOrigin::signed(Alice.into()), + TEST_ID.into(), + Alice.into(), + 1000 + )); precompiles() .prepare_test( @@ -159,8 +189,19 @@ fn get_balances_known_user() { #[test] fn get_balances_unknown_user() { ExtBuilder::default().with_balances(vec![(Alice.into(), 1000)]).build().execute_with(|| { - assert_ok!(Assets::force_create(RuntimeOrigin::root(), TEST_ID, Alice.into(), true, 1)); - assert_ok!(Assets::mint(RuntimeOrigin::signed(Alice.into()), TEST_ID, Alice.into(), 1000)); + assert_ok!(Assets::force_create( + RuntimeOrigin::root(), + TEST_ID.into(), + Alice.into(), + true, + 1 + )); + assert_ok!(Assets::mint( + RuntimeOrigin::signed(Alice.into()), + TEST_ID.into(), + Alice.into(), + 1000 + )); precompiles() .prepare_test(Alice, Precompile, InternalCall::balance_of { who: Address(Bob.into()) }) @@ -172,8 +213,19 @@ fn get_balances_unknown_user() { #[test] fn approve() { ExtBuilder::default().with_balances(vec![(Alice.into(), 1000)]).build().execute_with(|| { - assert_ok!(Assets::force_create(RuntimeOrigin::root(), TEST_ID, Alice.into(), true, 1)); - assert_ok!(Assets::mint(RuntimeOrigin::signed(Alice.into()), TEST_ID, Alice.into(), 1000)); + assert_ok!(Assets::force_create( + RuntimeOrigin::root(), + TEST_ID.into(), + Alice.into(), + true, + 1 + )); + assert_ok!(Assets::mint( + RuntimeOrigin::signed(Alice.into()), + TEST_ID.into(), + Alice.into(), + 1000 + )); precompiles() .prepare_test( @@ -195,8 +247,19 @@ fn approve() { #[test] fn approve_overflow() { ExtBuilder::default().with_balances(vec![(Alice.into(), 1000)]).build().execute_with(|| { - assert_ok!(Assets::force_create(RuntimeOrigin::root(), TEST_ID, Alice.into(), true, 1)); - assert_ok!(Assets::mint(RuntimeOrigin::signed(Alice.into()), TEST_ID, Alice.into(), 1000)); + assert_ok!(Assets::force_create( + RuntimeOrigin::root(), + TEST_ID.into(), + Alice.into(), + true, + 1 + )); + assert_ok!(Assets::mint( + RuntimeOrigin::signed(Alice.into()), + TEST_ID.into(), + Alice.into(), + 1000 + )); precompiles() .prepare_test( @@ -211,8 +274,19 @@ fn approve_overflow() { #[test] fn check_allowance_existing() { ExtBuilder::default().with_balances(vec![(Alice.into(), 1000)]).build().execute_with(|| { - assert_ok!(Assets::force_create(RuntimeOrigin::root(), TEST_ID, Alice.into(), true, 1)); - assert_ok!(Assets::mint(RuntimeOrigin::signed(Alice.into()), TEST_ID, Alice.into(), 1000)); + assert_ok!(Assets::force_create( + RuntimeOrigin::root(), + TEST_ID.into(), + Alice.into(), + true, + 1 + )); + assert_ok!(Assets::mint( + RuntimeOrigin::signed(Alice.into()), + TEST_ID.into(), + Alice.into(), + 1000 + )); precompiles() .prepare_test( @@ -240,7 +314,13 @@ fn check_allowance_existing() { #[test] fn check_allowance_not_existing() { ExtBuilder::default().with_balances(vec![(Alice.into(), 1000)]).build().execute_with(|| { - assert_ok!(Assets::force_create(RuntimeOrigin::root(), TEST_ID, Alice.into(), true, 1)); + assert_ok!(Assets::force_create( + RuntimeOrigin::root(), + TEST_ID.into(), + Alice.into(), + true, + 1 + )); precompiles() .prepare_test( @@ -260,8 +340,19 @@ fn check_allowance_not_existing() { #[test] fn transfer() { ExtBuilder::default().with_balances(vec![(Alice.into(), 1000)]).build().execute_with(|| { - assert_ok!(Assets::force_create(RuntimeOrigin::root(), TEST_ID, Alice.into(), true, 1)); - assert_ok!(Assets::mint(RuntimeOrigin::signed(Alice.into()), TEST_ID, Alice.into(), 1000)); + assert_ok!(Assets::force_create( + RuntimeOrigin::root(), + TEST_ID.into(), + Alice.into(), + true, + 1 + )); + assert_ok!(Assets::mint( + RuntimeOrigin::signed(Alice.into()), + TEST_ID.into(), + Alice.into(), + 1000 + )); precompiles() .prepare_test( @@ -298,8 +389,19 @@ fn transfer() { #[test] fn transfer_not_enough_founds() { ExtBuilder::default().with_balances(vec![(Alice.into(), 1000)]).build().execute_with(|| { - assert_ok!(Assets::force_create(RuntimeOrigin::root(), TEST_ID, Alice.into(), true, 1)); - assert_ok!(Assets::mint(RuntimeOrigin::signed(Alice.into()), TEST_ID, Alice.into(), 1)); + assert_ok!(Assets::force_create( + RuntimeOrigin::root(), + TEST_ID.into(), + Alice.into(), + true, + 1 + )); + assert_ok!(Assets::mint( + RuntimeOrigin::signed(Alice.into()), + TEST_ID.into(), + Alice.into(), + 1 + )); precompiles() .prepare_test( @@ -317,8 +419,19 @@ fn transfer_not_enough_founds() { #[test] fn transfer_from() { ExtBuilder::default().with_balances(vec![(Alice.into(), 1000)]).build().execute_with(|| { - assert_ok!(Assets::force_create(RuntimeOrigin::root(), TEST_ID, Alice.into(), true, 1)); - assert_ok!(Assets::mint(RuntimeOrigin::signed(Alice.into()), TEST_ID, Alice.into(), 1000)); + assert_ok!(Assets::force_create( + RuntimeOrigin::root(), + TEST_ID.into(), + Alice.into(), + true, + 1 + )); + assert_ok!(Assets::mint( + RuntimeOrigin::signed(Alice.into()), + TEST_ID.into(), + Alice.into(), + 1000 + )); precompiles() .prepare_test( @@ -389,8 +502,8 @@ fn transfer_from() { #[test] fn transfer_from_non_incremental_approval() { ExtBuilder::default().with_balances(vec![(Alice.into(), 1000)]).build().execute_with(|| { - assert_ok!(Assets::force_create(RuntimeOrigin::root(), TEST_ID, Alice.into(), true, 1)); - assert_ok!(Assets::mint(RuntimeOrigin::signed(Alice.into()), TEST_ID, Alice.into(), 1000)); + assert_ok!(Assets::force_create(RuntimeOrigin::root(), TEST_ID.into(), Alice.into(), true, 1)); + assert_ok!(Assets::mint(RuntimeOrigin::signed(Alice.into()), TEST_ID.into(), Alice.into(), 1000)); // We first approve 500 precompiles() @@ -448,8 +561,19 @@ fn transfer_from_non_incremental_approval() { #[test] fn transfer_from_above_allowance() { ExtBuilder::default().with_balances(vec![(Alice.into(), 1000)]).build().execute_with(|| { - assert_ok!(Assets::force_create(RuntimeOrigin::root(), TEST_ID, Alice.into(), true, 1)); - assert_ok!(Assets::mint(RuntimeOrigin::signed(Alice.into()), TEST_ID, Alice.into(), 1000)); + assert_ok!(Assets::force_create( + RuntimeOrigin::root(), + TEST_ID.into(), + Alice.into(), + true, + 1 + )); + assert_ok!(Assets::mint( + RuntimeOrigin::signed(Alice.into()), + TEST_ID.into(), + Alice.into(), + 1000 + )); precompiles() .prepare_test( @@ -480,8 +604,19 @@ fn transfer_from_above_allowance() { #[test] fn transfer_from_self() { ExtBuilder::default().with_balances(vec![(Alice.into(), 1000)]).build().execute_with(|| { - assert_ok!(Assets::force_create(RuntimeOrigin::root(), TEST_ID, Alice.into(), true, 1)); - assert_ok!(Assets::mint(RuntimeOrigin::signed(Alice.into()), TEST_ID, Alice.into(), 1000)); + assert_ok!(Assets::force_create( + RuntimeOrigin::root(), + TEST_ID.into(), + Alice.into(), + true, + 1 + )); + assert_ok!(Assets::mint( + RuntimeOrigin::signed(Alice.into()), + TEST_ID.into(), + Alice.into(), + 1000 + )); precompiles() .prepare_test( @@ -526,10 +661,16 @@ fn get_metadata() { .with_balances(vec![(Alice.into(), 1000), (Bob.into(), 2500)]) .build() .execute_with(|| { - assert_ok!(Assets::force_create(RuntimeOrigin::root(), TEST_ID, Alice.into(), true, 1)); + assert_ok!(Assets::force_create( + RuntimeOrigin::root(), + TEST_ID.into(), + Alice.into(), + true, + 1 + )); assert_ok!(Assets::force_set_metadata( RuntimeOrigin::root(), - TEST_ID, + TEST_ID.into(), b"TestToken".to_vec(), b"Test".to_vec(), 12, @@ -566,7 +707,13 @@ fn mint() { .with_balances(vec![(Alice.into(), 1000), (Bob.into(), 2500)]) .build() .execute_with(|| { - assert_ok!(Assets::force_create(RuntimeOrigin::root(), TEST_ID, Alice.into(), true, 1)); + assert_ok!(Assets::force_create( + RuntimeOrigin::root(), + TEST_ID.into(), + Alice.into(), + true, + 1 + )); precompiles() .prepare_test( @@ -601,10 +748,16 @@ fn burn() { .with_balances(vec![(Alice.into(), 1000), (Bob.into(), 2500)]) .build() .execute_with(|| { - assert_ok!(Assets::force_create(RuntimeOrigin::root(), TEST_ID, Alice.into(), true, 1)); + assert_ok!(Assets::force_create( + RuntimeOrigin::root(), + TEST_ID.into(), + Alice.into(), + true, + 1 + )); assert_ok!(Assets::mint( RuntimeOrigin::signed(Alice.into()), - TEST_ID, + TEST_ID.into(), Alice.into(), 1000 )); @@ -641,10 +794,16 @@ fn freeze() { .with_balances(vec![(Alice.into(), 1000), (Bob.into(), 2500)]) .build() .execute_with(|| { - assert_ok!(Assets::force_create(RuntimeOrigin::root(), TEST_ID, Alice.into(), true, 1)); + assert_ok!(Assets::force_create( + RuntimeOrigin::root(), + TEST_ID.into(), + Alice.into(), + true, + 1 + )); assert_ok!(Assets::mint( RuntimeOrigin::signed(Alice.into()), - TEST_ID, + TEST_ID.into(), Bob.into(), 1000 )); @@ -677,10 +836,16 @@ fn thaw() { .with_balances(vec![(Alice.into(), 1000), (Bob.into(), 2500)]) .build() .execute_with(|| { - assert_ok!(Assets::force_create(RuntimeOrigin::root(), TEST_ID, Alice.into(), true, 1)); + assert_ok!(Assets::force_create( + RuntimeOrigin::root(), + TEST_ID.into(), + Alice.into(), + true, + 1 + )); assert_ok!(Assets::mint( RuntimeOrigin::signed(Alice.into()), - TEST_ID, + TEST_ID.into(), Bob.into(), 1000 )); @@ -726,10 +891,16 @@ fn transfer_ownership() { .with_balances(vec![(Alice.into(), 1000), (Bob.into(), 2500)]) .build() .execute_with(|| { - assert_ok!(Assets::force_create(RuntimeOrigin::root(), TEST_ID, Alice.into(), true, 1)); + assert_ok!(Assets::force_create( + RuntimeOrigin::root(), + TEST_ID.into(), + Alice.into(), + true, + 1 + )); assert_ok!(Assets::force_set_metadata( RuntimeOrigin::root(), - TEST_ID, + TEST_ID.into(), b"TestToken".to_vec(), b"Test".to_vec(), 12, @@ -771,8 +942,19 @@ fn transfer_ownership() { #[test] fn transfer_amount_overflow() { ExtBuilder::default().with_balances(vec![(Alice.into(), 1000)]).build().execute_with(|| { - assert_ok!(Assets::force_create(RuntimeOrigin::root(), TEST_ID, Alice.into(), true, 1)); - assert_ok!(Assets::mint(RuntimeOrigin::signed(Alice.into()), TEST_ID, Alice.into(), 1000)); + assert_ok!(Assets::force_create( + RuntimeOrigin::root(), + TEST_ID.into(), + Alice.into(), + true, + 1 + )); + assert_ok!(Assets::mint( + RuntimeOrigin::signed(Alice.into()), + TEST_ID.into(), + Alice.into(), + 1000 + )); precompiles() .prepare_test( @@ -810,7 +992,13 @@ fn mint_overflow() { .with_balances(vec![(Alice.into(), 1000), (Bob.into(), 2500)]) .build() .execute_with(|| { - assert_ok!(Assets::force_create(RuntimeOrigin::root(), TEST_ID, Alice.into(), true, 1)); + assert_ok!(Assets::force_create( + RuntimeOrigin::root(), + TEST_ID.into(), + Alice.into(), + true, + 1 + )); precompiles() .prepare_test( @@ -829,8 +1017,19 @@ fn mint_overflow() { #[test] fn transfer_from_overflow() { ExtBuilder::default().with_balances(vec![(Alice.into(), 1000)]).build().execute_with(|| { - assert_ok!(Assets::force_create(RuntimeOrigin::root(), TEST_ID, Alice.into(), true, 1)); - assert_ok!(Assets::mint(RuntimeOrigin::signed(Alice.into()), TEST_ID, Alice.into(), 1000)); + assert_ok!(Assets::force_create( + RuntimeOrigin::root(), + TEST_ID.into(), + Alice.into(), + true, + 1 + )); + assert_ok!(Assets::mint( + RuntimeOrigin::signed(Alice.into()), + TEST_ID.into(), + Alice.into(), + 1000 + )); precompiles() .prepare_test( @@ -861,10 +1060,16 @@ fn burn_overflow() { .with_balances(vec![(Alice.into(), 1000), (Bob.into(), 2500)]) .build() .execute_with(|| { - assert_ok!(Assets::force_create(RuntimeOrigin::root(), TEST_ID, Alice.into(), true, 1)); + assert_ok!(Assets::force_create( + RuntimeOrigin::root(), + TEST_ID.into(), + Alice.into(), + true, + 1 + )); assert_ok!(Assets::mint( RuntimeOrigin::signed(Alice.into()), - TEST_ID, + TEST_ID.into(), Alice.into(), 1000 )); diff --git a/precompile/bls12-381/Cargo.toml b/precompile/bls12-381/Cargo.toml index 9f8bd4455..46ce5f91d 100644 --- a/precompile/bls12-381/Cargo.toml +++ b/precompile/bls12-381/Cargo.toml @@ -14,14 +14,14 @@ version = "6.0.0" milagro_bls = { default-features = false, git = "https://github.com/darwinia-network/milagro_bls" } # frontier -fp-evm = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } -pallet-evm = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } +fp-evm = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } +pallet-evm = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } # moonbeam -precompile-utils = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.33" } +precompile-utils = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.36" } # substrate -sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } [dev-dependencies] # crates.io @@ -29,15 +29,15 @@ codec = { package = "parity-scale-codec", version = "3.3" } scale-info = { version = "2.3", features = ["derive"] } # moonbeam -precompile-utils = { git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.33", features = ["testing"] } +precompile-utils = { git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.36", features = ["testing"] } # substrate -frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } [features] default = ["std"] diff --git a/precompile/deposit/Cargo.toml b/precompile/deposit/Cargo.toml index 38b5ba967..6724504ca 100644 --- a/precompile/deposit/Cargo.toml +++ b/precompile/deposit/Cargo.toml @@ -11,20 +11,20 @@ version = "6.0.0" [dependencies] # frontier -fp-evm = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } -pallet-evm = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } +fp-evm = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } +pallet-evm = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } # darwinia darwinia-deposit = { default-features = false, path = "../../pallet/deposit"} # moonbeam -precompile-utils = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.33" } +precompile-utils = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.36" } # substrate -frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } [dev-dependencies] # crates.io @@ -32,13 +32,13 @@ codec = { package = "parity-scale-codec", version = "3.3" } scale-info = { version = "2.3", features = ["derive"] } # moonbeam -precompile-utils = { git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.33", features = ["testing"] } +precompile-utils = { git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.36", features = ["testing"] } # substrate -pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } [features] default = ["std"] diff --git a/precompile/staking/Cargo.toml b/precompile/staking/Cargo.toml index 373e0103c..9cba6b879 100644 --- a/precompile/staking/Cargo.toml +++ b/precompile/staking/Cargo.toml @@ -11,21 +11,21 @@ version = "6.0.0" [dependencies] # frontier -fp-evm = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } -pallet-evm = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } +fp-evm = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } +pallet-evm = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } # darwinia darwinia-staking = { default-features = false, path = "../../pallet/staking" } # moonbeam -precompile-utils = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.33" } +precompile-utils = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.36" } # substrate -frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } [dev-dependencies] # crates.io @@ -36,13 +36,13 @@ scale-info = { version = "2.3", features = ["derive"] } darwinia-deposit = { path = "../../pallet/deposit" } # moonbeam -precompile-utils = { git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.33", features = ["testing"] } +precompile-utils = { git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.36", features = ["testing"] } # substrate -frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } [features] diff --git a/precompile/state-storage/Cargo.toml b/precompile/state-storage/Cargo.toml index c07c5163c..34fbbdc42 100644 --- a/precompile/state-storage/Cargo.toml +++ b/precompile/state-storage/Cargo.toml @@ -11,15 +11,15 @@ version = "6.0.0" [dependencies] # frontier -fp-evm = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } -pallet-evm = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } +fp-evm = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } +pallet-evm = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } # moonbeam -precompile-utils = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.33" } +precompile-utils = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.36" } # substrate -frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } [dev-dependencies] # crates.io @@ -27,15 +27,15 @@ codec = { package = "parity-scale-codec", version = "3.3" } scale-info = { version = "2.3", features = ["derive"] } # moonbeam -precompile-utils = { git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.33", features = ["testing"] } +precompile-utils = { git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.36", features = ["testing"] } # substrate -frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } [features] default = ["std"] diff --git a/runtime/common/Cargo.toml b/runtime/common/Cargo.toml index 263024b22..7837ac0ba 100644 --- a/runtime/common/Cargo.toml +++ b/runtime/common/Cargo.toml @@ -18,23 +18,23 @@ smallvec = { version = "1.10" } dc-primitives = { default-features = false, path = "../../core/primitives" } # darwinia-messages-substrate -bp-darwinia-core = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.33" } +bp-darwinia-core = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } # moonbeam -account = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.33" } +account = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.36" } # polkadot -xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.33" } -xcm-builder = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.33" } -xcm-executor = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.33" } +xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36" } +xcm-builder = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36" } +xcm-executor = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36" } # substrate -frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-collective = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-io = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-collective = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-io = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } [features] default = ["std"] diff --git a/runtime/common/src/xcm_configs.rs b/runtime/common/src/xcm_configs.rs index 9c690a3d8..ad47ef8e9 100644 --- a/runtime/common/src/xcm_configs.rs +++ b/runtime/common/src/xcm_configs.rs @@ -79,7 +79,7 @@ where } } -// See issue #5233 +// See issue pub struct DenyReserveTransferToRelayChain; impl ShouldExecute for DenyReserveTransferToRelayChain { fn should_execute( diff --git a/runtime/crab/Cargo.toml b/runtime/crab/Cargo.toml index c295578a3..b2f376fcd 100644 --- a/runtime/crab/Cargo.toml +++ b/runtime/crab/Cargo.toml @@ -10,7 +10,7 @@ repository = "https://github.com/darwinia-network/darwinia" version = "6.0.0" [build-dependencies] -substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } [dependencies] # crates.io @@ -21,17 +21,17 @@ static_assertions = { version = "1.1" } array-bytes = { version = "6.0", optional = true } # cumulus -cumulus-pallet-aura-ext = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.33" } -cumulus-pallet-dmp-queue = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.33" } -cumulus-pallet-parachain-system = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.33" } -cumulus-pallet-xcm = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.33" } -cumulus-pallet-xcmp-queue = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.33" } -cumulus-primitives-core = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.33" } -cumulus-primitives-timestamp = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.33" } -cumulus-primitives-utility = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.33" } -parachain-info = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.33" } +cumulus-pallet-aura-ext = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } +cumulus-pallet-dmp-queue = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } +cumulus-pallet-parachain-system = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } +cumulus-pallet-xcm = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } +cumulus-pallet-xcmp-queue = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } +cumulus-primitives-core = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } +cumulus-primitives-timestamp = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } +cumulus-primitives-utility = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } +parachain-info = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } # cumulus optional -cumulus-pallet-session-benchmarking = { optional = true, default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.33" } +cumulus-pallet-session-benchmarking = { optional = true, default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } # darwinia darwinia-account-migration = { default-features = false, path = "../../pallet/account-migration" } @@ -49,89 +49,89 @@ darwinia-staking = { default-features = false, path = "../../pa dc-primitives = { default-features = false, path = "../../core/primitives" } # darwinia-messages-substrate -bp-message-dispatch = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.33" } -bp-messages = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.33" } -bp-polkadot-core = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.33" } -bp-runtime = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.33" } -bridge-runtime-common = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.33" } -pallet-bridge-dispatch = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.33" } -pallet-bridge-grandpa = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.33" } -pallet-bridge-messages = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.33" } -pallet-bridge-parachains = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.33" } -pallet-fee-market = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.33" } +bp-message-dispatch = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } +bp-messages = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } +bp-polkadot-core = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } +bp-runtime = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } +bridge-runtime-common = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } +pallet-bridge-dispatch = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } +pallet-bridge-grandpa = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } +pallet-bridge-messages = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } +pallet-bridge-parachains = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } +pallet-fee-market = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } # frontier -fp-rpc = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } -fp-self-contained = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } -pallet-ethereum = { default-features = false, features = ["forbid-evm-reentrancy"], git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } -pallet-evm = { default-features = false, features = ["forbid-evm-reentrancy"], git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } -pallet-evm-precompile-blake2 = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } -pallet-evm-precompile-bn128 = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } -pallet-evm-precompile-dispatch = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } -pallet-evm-precompile-modexp = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } -pallet-evm-precompile-simple = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } +fp-rpc = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } +fp-self-contained = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } +pallet-ethereum = { default-features = false, features = ["forbid-evm-reentrancy"], git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } +pallet-evm = { default-features = false, features = ["forbid-evm-reentrancy"], git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } +pallet-evm-precompile-blake2 = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } +pallet-evm-precompile-bn128 = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } +pallet-evm-precompile-dispatch = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } +pallet-evm-precompile-modexp = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } +pallet-evm-precompile-simple = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } # moonbeam -precompile-utils = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.33" } -xcm-primitives = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.33" } +precompile-utils = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.36" } +xcm-primitives = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.36" } # polkadot -pallet-xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.33" } -polkadot-parachain = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.33" } -polkadot-runtime-common = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.33" } -xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.33" } -xcm-builder = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.33" } -xcm-executor = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.33" } +pallet-xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36" } +polkadot-parachain = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36" } +polkadot-runtime-common = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36" } +xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36" } +xcm-builder = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36" } +xcm-executor = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36" } # substrate -frame-executive = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -frame-system-rpc-runtime-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-assets = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-aura = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-authorship = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-balances = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-collective = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-democracy = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-elections-phragmen = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-identity = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-membership = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-multisig = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-preimage = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-proxy = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-scheduler = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-session = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-sudo = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-timestamp = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-tips = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-transaction-payment = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-transaction-payment-rpc-runtime-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-treasury = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-utility = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-vesting = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-block-builder = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-consensus-aura = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-inherents = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-io = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-offchain = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-session = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-transaction-pool = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-version = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +frame-executive = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +frame-system-rpc-runtime-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-assets = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-aura = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-authorship = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-balances = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-collective = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-democracy = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-elections-phragmen = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-identity = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-membership = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-multisig = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-preimage = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-proxy = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-scheduler = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-session = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-sudo = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-timestamp = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-tips = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-transaction-payment = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-transaction-payment-rpc-runtime-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-treasury = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-utility = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-vesting = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-block-builder = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-consensus-aura = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-inherents = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-io = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-offchain = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-session = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-transaction-pool = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-version = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } # substrate optional -frame-benchmarking = { optional = true, default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -frame-system-benchmarking = { optional = true, default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -frame-try-runtime = { optional = true, default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +frame-benchmarking = { optional = true, default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +frame-system-benchmarking = { optional = true, default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +frame-try-runtime = { optional = true, default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } [dev-dependencies] # darwinia darwinia-common-runtime = { features = ["test"], path = "../common" } # substrate -sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } [features] default = ["std"] @@ -332,6 +332,7 @@ try-runtime = [ "pallet-fee-market/try-runtime", # frontier + "fp-self-contained/try-runtime", "pallet-ethereum/try-runtime", "pallet-evm/try-runtime", @@ -364,6 +365,7 @@ try-runtime = [ "pallet-treasury/try-runtime", "pallet-utility/try-runtime", "pallet-vesting/try-runtime", + "sp-runtime/try-runtime", # substrate optional "frame-try-runtime/try-runtime", ] diff --git a/runtime/crab/src/lib.rs b/runtime/crab/src/lib.rs index 45196de9d..91e8e9568 100644 --- a/runtime/crab/src/lib.rs +++ b/runtime/crab/src/lib.rs @@ -602,30 +602,26 @@ sp_api::impl_runtime_apis! { #[cfg(feature = "try-runtime")] impl frame_try_runtime::TryRuntime for Runtime { - fn on_runtime_upgrade() -> (Weight, Weight) { + fn on_runtime_upgrade(checks: bool) -> (Weight, Weight) { // substrate use frame_support::log; log::info!("try-runtime::on_runtime_upgrade"); - let weight = Executive::try_runtime_upgrade().unwrap(); + let weight = Executive::try_runtime_upgrade(checks).unwrap(); (weight, RuntimeBlockWeights::get().max_block) } - fn execute_block(block: Block, state_root_check: bool, select: frame_try_runtime::TryStateSelect) -> Weight { - // substrate - use frame_support::log; - - log::info!( - "try-runtime: executing block #{} ({:?}) / root checks: {:?} / sanity-checks: {:?}", - block.header.number, - block.header.hash(), - state_root_check, - select, - ); - - Executive::try_execute_block(block, state_root_check, select).expect("try_execute_block failed") + fn execute_block( + block: Block, + state_root_check: bool, + signature_check: bool, + select: frame_try_runtime::TryStateSelect, + ) -> Weight { + // NOTE: intentional unwrap: we don't want to propagate the error backwards, and want to + // have a backtrace here. + Executive::try_execute_block(block, state_root_check, signature_check, select).unwrap() } } } diff --git a/runtime/crab/src/pallets/assets.rs b/runtime/crab/src/pallets/assets.rs index 19ff27cb8..ed9bd71c4 100644 --- a/runtime/crab/src/pallets/assets.rs +++ b/runtime/crab/src/pallets/assets.rs @@ -33,7 +33,10 @@ impl pallet_assets::Config for Runtime { type AssetAccountDeposit = ConstU128<0>; type AssetDeposit = ConstU128<0>; type AssetId = AssetId; + type AssetIdParameter = codec::Compact; type Balance = Balance; + #[cfg(feature = "runtime-benchmarks")] + type BenchmarkHelper = (); type CreateOrigin = AsEnsureOriginWithArg, AccountId>>; type Currency = Balances; type Extra = (); @@ -41,6 +44,7 @@ impl pallet_assets::Config for Runtime { type Freezer = (); type MetadataDepositBase = ConstU128<0>; type MetadataDepositPerByte = ConstU128<0>; + type RemoveItemsLimit = ConstU32<1000>; type RuntimeEvent = RuntimeEvent; type StringLimit = ConstU32<50>; type WeightInfo = (); diff --git a/runtime/crab/src/pallets/deposit.rs b/runtime/crab/src/pallets/deposit.rs index 2f4082800..f19900945 100644 --- a/runtime/crab/src/pallets/deposit.rs +++ b/runtime/crab/src/pallets/deposit.rs @@ -24,7 +24,12 @@ impl darwinia_deposit::SimpleAsset for CKtonMinting { type AccountId = AccountId; fn mint(beneficiary: &Self::AccountId, amount: Balance) -> sp_runtime::DispatchResult { - Assets::mint(RuntimeOrigin::signed(ROOT), AssetIds::CKton as _, *beneficiary, amount) + Assets::mint( + RuntimeOrigin::signed(ROOT), + (AssetIds::CKton as AssetId).into(), + *beneficiary, + amount, + ) } fn burn(who: &Self::AccountId, amount: Balance) -> sp_runtime::DispatchResult { @@ -34,7 +39,7 @@ impl darwinia_deposit::SimpleAsset for CKtonMinting { Err(>::BalanceLow)?; } - Assets::burn(RuntimeOrigin::signed(ROOT), asset_id, *who, amount) + Assets::burn(RuntimeOrigin::signed(ROOT), asset_id.into(), *who, amount) } } diff --git a/runtime/crab/src/pallets/staking.rs b/runtime/crab/src/pallets/staking.rs index 7ac9221d0..9464a453d 100644 --- a/runtime/crab/src/pallets/staking.rs +++ b/runtime/crab/src/pallets/staking.rs @@ -52,7 +52,7 @@ impl darwinia_staking::Stake for CKtonStaking { fn stake(who: &Self::AccountId, item: Self::Item) -> sp_runtime::DispatchResult { Assets::transfer( RuntimeOrigin::signed(*who), - AssetIds::CKton as AssetId, + (AssetIds::CKton as AssetId).into(), darwinia_staking::account_id(), item, ) @@ -61,7 +61,7 @@ impl darwinia_staking::Stake for CKtonStaking { fn unstake(who: &Self::AccountId, item: Self::Item) -> sp_runtime::DispatchResult { Assets::transfer( RuntimeOrigin::signed(darwinia_staking::account_id()), - AssetIds::CKton as AssetId, + (AssetIds::CKton as AssetId).into(), *who, item, ) diff --git a/runtime/crab/src/pallets/system.rs b/runtime/crab/src/pallets/system.rs index ac01d5c80..43a826035 100644 --- a/runtime/crab/src/pallets/system.rs +++ b/runtime/crab/src/pallets/system.rs @@ -28,9 +28,10 @@ const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(5); pub const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75); /// We allow for 0.5 of a second of compute with a 12 second average block time. -pub const MAXIMUM_BLOCK_WEIGHT: Weight = frame_support::weights::constants::WEIGHT_PER_SECOND - .saturating_div(2) - .set_proof_size(cumulus_primitives_core::relay_chain::v2::MAX_POV_SIZE as u64); +pub const MAXIMUM_BLOCK_WEIGHT: Weight = Weight::from_parts( + frame_support::weights::constants::WEIGHT_REF_TIME_PER_SECOND.saturating_div(2), + cumulus_primitives_core::relay_chain::v2::MAX_POV_SIZE as u64, +); frame_support::parameter_types! { pub const Version: sp_version::RuntimeVersion = VERSION; diff --git a/runtime/crab/src/pallets/timestamp.rs b/runtime/crab/src/pallets/timestamp.rs index 3443326fa..b18b2a162 100644 --- a/runtime/crab/src/pallets/timestamp.rs +++ b/runtime/crab/src/pallets/timestamp.rs @@ -23,6 +23,6 @@ impl pallet_timestamp::Config for Runtime { type MinimumPeriod = ConstU64<{ SLOT_DURATION / 2 }>; /// A timestamp: milliseconds since the unix epoch. type Moment = u64; - type OnTimestampSet = (); + type OnTimestampSet = Aura; type WeightInfo = weights::pallet_timestamp::WeightInfo; } diff --git a/runtime/crab/src/weights/block_weights.rs b/runtime/crab/src/weights/block_weights.rs index c00430733..66279be1b 100644 --- a/runtime/crab/src/weights/block_weights.rs +++ b/runtime/crab/src/weights/block_weights.rs @@ -23,7 +23,7 @@ pub mod constants { parameter_types! { /// Importing a block with 0 Extrinsics. - pub const BlockExecutionWeight: Weight = constants::WEIGHT_PER_NANOS.saturating_mul(5_000_000); + pub const BlockExecutionWeight: Weight = Weight::from_ref_time(constants::WEIGHT_REF_TIME_PER_NANOS.saturating_mul(5_000_000)); } #[cfg(test)] @@ -39,12 +39,12 @@ pub mod constants { // At least 100 µs. assert!( - w.ref_time() >= 100u64 * constants::WEIGHT_PER_MICROS.ref_time(), + w.ref_time() >= 100u64 * constants::WEIGHT_REF_TIME_PER_MICROS, "Weight should be at least 100 µs." ); // At most 50 ms. assert!( - w.ref_time() <= 50u64 * constants::WEIGHT_PER_MILLIS.ref_time(), + w.ref_time() <= 50u64 * constants::WEIGHT_REF_TIME_PER_MILLIS, "Weight should be at most 50 ms." ); } diff --git a/runtime/crab/src/weights/extrinsic_weights.rs b/runtime/crab/src/weights/extrinsic_weights.rs index 3ce6b73d5..488686708 100644 --- a/runtime/crab/src/weights/extrinsic_weights.rs +++ b/runtime/crab/src/weights/extrinsic_weights.rs @@ -23,7 +23,7 @@ pub mod constants { parameter_types! { /// Executing a NO-OP `System::remarks` Extrinsic. - pub const ExtrinsicBaseWeight: Weight = constants::WEIGHT_PER_NANOS.saturating_mul(125_000); + pub const ExtrinsicBaseWeight: Weight = Weight::from_ref_time(constants::WEIGHT_REF_TIME_PER_NANOS.saturating_mul(125_000)); } #[cfg(test)] @@ -39,12 +39,12 @@ pub mod constants { // At least 10 µs. assert!( - w.ref_time() >= 10u64 * constants::WEIGHT_PER_MICROS.ref_time(), + w.ref_time() >= 10u64 * constants::WEIGHT_REF_TIME_PER_MICROS, "Weight should be at least 10 µs." ); // At most 1 ms. assert!( - w.ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(), + w.ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS, "Weight should be at most 1 ms." ); } diff --git a/runtime/crab/src/weights/paritydb_weights.rs b/runtime/crab/src/weights/paritydb_weights.rs index dca7d3483..4338d928d 100644 --- a/runtime/crab/src/weights/paritydb_weights.rs +++ b/runtime/crab/src/weights/paritydb_weights.rs @@ -25,8 +25,8 @@ pub mod constants { /// `ParityDB` can be enabled with a feature flag, but is still experimental. These weights /// are available for brave runtime engineers who may want to try this out as default. pub const ParityDbWeight: RuntimeDbWeight = RuntimeDbWeight { - read: 8_000 * constants::WEIGHT_PER_NANOS.ref_time(), - write: 50_000 * constants::WEIGHT_PER_NANOS.ref_time(), + read: 8_000 * constants::WEIGHT_REF_TIME_PER_NANOS, + write: 50_000 * constants::WEIGHT_REF_TIME_PER_NANOS, }; } @@ -42,20 +42,20 @@ pub mod constants { fn sane() { // At least 1 µs. assert!( - W::get().reads(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(), + W::get().reads(1).ref_time() >= constants::WEIGHT_REF_TIME_PER_MICROS, "Read weight should be at least 1 µs." ); assert!( - W::get().writes(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(), + W::get().writes(1).ref_time() >= constants::WEIGHT_REF_TIME_PER_MICROS, "Write weight should be at least 1 µs." ); // At most 1 ms. assert!( - W::get().reads(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(), + W::get().reads(1).ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS, "Read weight should be at most 1 ms." ); assert!( - W::get().writes(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(), + W::get().writes(1).ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS, "Write weight should be at most 1 ms." ); } diff --git a/runtime/crab/src/weights/rocksdb_weights.rs b/runtime/crab/src/weights/rocksdb_weights.rs index 87867ebfe..1d115d963 100644 --- a/runtime/crab/src/weights/rocksdb_weights.rs +++ b/runtime/crab/src/weights/rocksdb_weights.rs @@ -25,8 +25,8 @@ pub mod constants { /// By default, Substrate uses `RocksDB`, so this will be the weight used throughout /// the runtime. pub const RocksDbWeight: RuntimeDbWeight = RuntimeDbWeight { - read: 25_000 * constants::WEIGHT_PER_NANOS.ref_time(), - write: 100_000 * constants::WEIGHT_PER_NANOS.ref_time(), + read: 25_000 * constants::WEIGHT_REF_TIME_PER_NANOS, + write: 100_000 * constants::WEIGHT_REF_TIME_PER_NANOS, }; } @@ -42,20 +42,20 @@ pub mod constants { fn sane() { // At least 1 µs. assert!( - W::get().reads(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(), + W::get().reads(1).ref_time() >= constants::WEIGHT_REF_TIME_PER_MICROS, "Read weight should be at least 1 µs." ); assert!( - W::get().writes(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(), + W::get().writes(1).ref_time() >= constants::WEIGHT_REF_TIME_PER_MICROS, "Write weight should be at least 1 µs." ); // At most 1 ms. assert!( - W::get().reads(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(), + W::get().reads(1).ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS, "Read weight should be at most 1 ms." ); assert!( - W::get().writes(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(), + W::get().writes(1).ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS, "Write weight should be at most 1 ms." ); } diff --git a/runtime/darwinia/Cargo.toml b/runtime/darwinia/Cargo.toml index 693ca9a30..a1761b51c 100644 --- a/runtime/darwinia/Cargo.toml +++ b/runtime/darwinia/Cargo.toml @@ -10,7 +10,7 @@ repository = "https://github.com/darwinia-network/darwinia" version = "6.0.0" [build-dependencies] -substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } [dependencies] # crates.io @@ -21,17 +21,17 @@ static_assertions = { version = "1.1" } array-bytes = { version = "6.0", optional = true } # cumulus -cumulus-pallet-aura-ext = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.33" } -cumulus-pallet-dmp-queue = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.33" } -cumulus-pallet-parachain-system = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.33" } -cumulus-pallet-xcm = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.33" } -cumulus-pallet-xcmp-queue = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.33" } -cumulus-primitives-core = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.33" } -cumulus-primitives-timestamp = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.33" } -cumulus-primitives-utility = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.33" } -parachain-info = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.33" } +cumulus-pallet-aura-ext = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } +cumulus-pallet-dmp-queue = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } +cumulus-pallet-parachain-system = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } +cumulus-pallet-xcm = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } +cumulus-pallet-xcmp-queue = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } +cumulus-primitives-core = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } +cumulus-primitives-timestamp = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } +cumulus-primitives-utility = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } +parachain-info = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } # cumulus optional -cumulus-pallet-session-benchmarking = { optional = true, default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.33" } +cumulus-pallet-session-benchmarking = { optional = true, default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } # darwinia darwinia-account-migration = { default-features = false, path = "../../pallet/account-migration" } @@ -49,89 +49,89 @@ darwinia-staking = { default-features = false, path = "../../pa dc-primitives = { default-features = false, path = "../../core/primitives" } # darwinia-messages-substrate -bp-message-dispatch = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.33" } -bp-messages = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.33" } -bp-polkadot-core = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.33" } -bp-runtime = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.33" } -bridge-runtime-common = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.33" } -pallet-bridge-dispatch = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.33" } -pallet-bridge-grandpa = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.33" } -pallet-bridge-messages = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.33" } -pallet-bridge-parachains = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.33" } -pallet-fee-market = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.33" } +bp-message-dispatch = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } +bp-messages = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } +bp-polkadot-core = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } +bp-runtime = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } +bridge-runtime-common = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } +pallet-bridge-dispatch = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } +pallet-bridge-grandpa = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } +pallet-bridge-messages = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } +pallet-bridge-parachains = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } +pallet-fee-market = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } # frontier -fp-rpc = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } -fp-self-contained = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } -pallet-ethereum = { default-features = false, features = ["forbid-evm-reentrancy"], git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } -pallet-evm = { default-features = false, features = ["forbid-evm-reentrancy"], git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } -pallet-evm-precompile-blake2 = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } -pallet-evm-precompile-bn128 = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } -pallet-evm-precompile-dispatch = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } -pallet-evm-precompile-modexp = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } -pallet-evm-precompile-simple = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } +fp-rpc = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } +fp-self-contained = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } +pallet-ethereum = { default-features = false, features = ["forbid-evm-reentrancy"], git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } +pallet-evm = { default-features = false, features = ["forbid-evm-reentrancy"], git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } +pallet-evm-precompile-blake2 = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } +pallet-evm-precompile-bn128 = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } +pallet-evm-precompile-dispatch = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } +pallet-evm-precompile-modexp = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } +pallet-evm-precompile-simple = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } # moonbeam -precompile-utils = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.33" } -xcm-primitives = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.33" } +precompile-utils = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.36" } +xcm-primitives = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.36" } # polkadot -pallet-xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.33" } -polkadot-parachain = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.33" } -polkadot-runtime-common = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.33" } -xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.33" } -xcm-builder = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.33" } -xcm-executor = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.33" } +pallet-xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36" } +polkadot-parachain = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36" } +polkadot-runtime-common = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36" } +xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36" } +xcm-builder = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36" } +xcm-executor = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36" } # substrate -frame-executive = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -frame-system-rpc-runtime-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-assets = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-aura = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-authorship = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-balances = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-collective = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-democracy = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-elections-phragmen = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-identity = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-membership = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-multisig = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-preimage = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-proxy = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-scheduler = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-session = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-sudo = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-timestamp = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-tips = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-transaction-payment = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-transaction-payment-rpc-runtime-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-treasury = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-utility = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-vesting = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-block-builder = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-consensus-aura = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-inherents = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-io = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-offchain = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-session = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-transaction-pool = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-version = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +frame-executive = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +frame-system-rpc-runtime-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-assets = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-aura = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-authorship = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-balances = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-collective = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-democracy = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-elections-phragmen = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-identity = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-membership = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-multisig = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-preimage = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-proxy = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-scheduler = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-session = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-sudo = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-timestamp = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-tips = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-transaction-payment = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-transaction-payment-rpc-runtime-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-treasury = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-utility = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-vesting = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-block-builder = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-consensus-aura = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-inherents = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-io = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-offchain = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-session = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-transaction-pool = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-version = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } # substrate optional -frame-benchmarking = { optional = true, default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -frame-system-benchmarking = { optional = true, default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -frame-try-runtime = { optional = true, default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +frame-benchmarking = { optional = true, default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +frame-system-benchmarking = { optional = true, default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +frame-try-runtime = { optional = true, default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } [dev-dependencies] # darwinia darwinia-common-runtime = { features = ["test"], path = "../common" } # substrate -sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } [features] default = ["std"] @@ -332,6 +332,7 @@ try-runtime = [ "pallet-fee-market/try-runtime", # frontier + "fp-self-contained/try-runtime", "pallet-ethereum/try-runtime", "pallet-evm/try-runtime", @@ -364,6 +365,7 @@ try-runtime = [ "pallet-treasury/try-runtime", "pallet-utility/try-runtime", "pallet-vesting/try-runtime", + "sp-runtime/try-runtime", # substrate optional "frame-try-runtime/try-runtime", ] diff --git a/runtime/darwinia/src/lib.rs b/runtime/darwinia/src/lib.rs index bddc318e9..8e00e144c 100644 --- a/runtime/darwinia/src/lib.rs +++ b/runtime/darwinia/src/lib.rs @@ -603,30 +603,26 @@ sp_api::impl_runtime_apis! { #[cfg(feature = "try-runtime")] impl frame_try_runtime::TryRuntime for Runtime { - fn on_runtime_upgrade() -> (Weight, Weight) { + fn on_runtime_upgrade(checks: bool) -> (Weight, Weight) { // substrate use frame_support::log; log::info!("try-runtime::on_runtime_upgrade"); - let weight = Executive::try_runtime_upgrade().unwrap(); + let weight = Executive::try_runtime_upgrade(checks).unwrap(); (weight, RuntimeBlockWeights::get().max_block) } - fn execute_block(block: Block, state_root_check: bool, select: frame_try_runtime::TryStateSelect) -> Weight { - // substrate - use frame_support::log; - - log::info!( - "try-runtime: executing block #{} ({:?}) / root checks: {:?} / sanity-checks: {:?}", - block.header.number, - block.header.hash(), - state_root_check, - select, - ); - - Executive::try_execute_block(block, state_root_check, select).expect("try_execute_block failed") + fn execute_block( + block: Block, + state_root_check: bool, + signature_check: bool, + select: frame_try_runtime::TryStateSelect, + ) -> Weight { + // NOTE: intentional unwrap: we don't want to propagate the error backwards, and want to + // have a backtrace here. + Executive::try_execute_block(block, state_root_check, signature_check, select).unwrap() } } } diff --git a/runtime/darwinia/src/pallets/assets.rs b/runtime/darwinia/src/pallets/assets.rs index 2367bca4e..903856ed4 100644 --- a/runtime/darwinia/src/pallets/assets.rs +++ b/runtime/darwinia/src/pallets/assets.rs @@ -33,7 +33,10 @@ impl pallet_assets::Config for Runtime { type AssetAccountDeposit = ConstU128<0>; type AssetDeposit = ConstU128<0>; type AssetId = AssetId; + type AssetIdParameter = codec::Compact; type Balance = Balance; + #[cfg(feature = "runtime-benchmarks")] + type BenchmarkHelper = (); type CreateOrigin = AsEnsureOriginWithArg, AccountId>>; type Currency = Balances; type Extra = (); @@ -41,6 +44,7 @@ impl pallet_assets::Config for Runtime { type Freezer = (); type MetadataDepositBase = ConstU128<0>; type MetadataDepositPerByte = ConstU128<0>; + type RemoveItemsLimit = ConstU32<1000>; type RuntimeEvent = RuntimeEvent; type StringLimit = ConstU32<50>; type WeightInfo = (); diff --git a/runtime/darwinia/src/pallets/deposit.rs b/runtime/darwinia/src/pallets/deposit.rs index 34a0f3e5e..87ec891ea 100644 --- a/runtime/darwinia/src/pallets/deposit.rs +++ b/runtime/darwinia/src/pallets/deposit.rs @@ -24,7 +24,12 @@ impl darwinia_deposit::SimpleAsset for KtonAsset { type AccountId = AccountId; fn mint(beneficiary: &Self::AccountId, amount: Balance) -> sp_runtime::DispatchResult { - Assets::mint(RuntimeOrigin::signed(ROOT), AssetIds::Kton as _, *beneficiary, amount) + Assets::mint( + RuntimeOrigin::signed(ROOT), + (AssetIds::Kton as AssetId).into(), + *beneficiary, + amount, + ) } fn burn(who: &Self::AccountId, amount: Balance) -> sp_runtime::DispatchResult { @@ -34,7 +39,7 @@ impl darwinia_deposit::SimpleAsset for KtonAsset { Err(>::BalanceLow)?; } - Assets::burn(RuntimeOrigin::signed(ROOT), asset_id, *who, amount) + Assets::burn(RuntimeOrigin::signed(ROOT), asset_id.into(), *who, amount) } } diff --git a/runtime/darwinia/src/pallets/staking.rs b/runtime/darwinia/src/pallets/staking.rs index cc1661eae..7d3aa2d50 100644 --- a/runtime/darwinia/src/pallets/staking.rs +++ b/runtime/darwinia/src/pallets/staking.rs @@ -52,7 +52,7 @@ impl darwinia_staking::Stake for KtonStaking { fn stake(who: &Self::AccountId, item: Self::Item) -> sp_runtime::DispatchResult { Assets::transfer( RuntimeOrigin::signed(*who), - AssetIds::Kton as AssetId, + (AssetIds::Kton as AssetId).into(), darwinia_staking::account_id(), item, ) @@ -61,7 +61,7 @@ impl darwinia_staking::Stake for KtonStaking { fn unstake(who: &Self::AccountId, item: Self::Item) -> sp_runtime::DispatchResult { Assets::transfer( RuntimeOrigin::signed(darwinia_staking::account_id()), - AssetIds::Kton as AssetId, + (AssetIds::Kton as AssetId).into(), *who, item, ) diff --git a/runtime/darwinia/src/pallets/system.rs b/runtime/darwinia/src/pallets/system.rs index ac01d5c80..43a826035 100644 --- a/runtime/darwinia/src/pallets/system.rs +++ b/runtime/darwinia/src/pallets/system.rs @@ -28,9 +28,10 @@ const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(5); pub const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75); /// We allow for 0.5 of a second of compute with a 12 second average block time. -pub const MAXIMUM_BLOCK_WEIGHT: Weight = frame_support::weights::constants::WEIGHT_PER_SECOND - .saturating_div(2) - .set_proof_size(cumulus_primitives_core::relay_chain::v2::MAX_POV_SIZE as u64); +pub const MAXIMUM_BLOCK_WEIGHT: Weight = Weight::from_parts( + frame_support::weights::constants::WEIGHT_REF_TIME_PER_SECOND.saturating_div(2), + cumulus_primitives_core::relay_chain::v2::MAX_POV_SIZE as u64, +); frame_support::parameter_types! { pub const Version: sp_version::RuntimeVersion = VERSION; diff --git a/runtime/darwinia/src/pallets/timestamp.rs b/runtime/darwinia/src/pallets/timestamp.rs index 3443326fa..b18b2a162 100644 --- a/runtime/darwinia/src/pallets/timestamp.rs +++ b/runtime/darwinia/src/pallets/timestamp.rs @@ -23,6 +23,6 @@ impl pallet_timestamp::Config for Runtime { type MinimumPeriod = ConstU64<{ SLOT_DURATION / 2 }>; /// A timestamp: milliseconds since the unix epoch. type Moment = u64; - type OnTimestampSet = (); + type OnTimestampSet = Aura; type WeightInfo = weights::pallet_timestamp::WeightInfo; } diff --git a/runtime/darwinia/src/weights/block_weights.rs b/runtime/darwinia/src/weights/block_weights.rs index c00430733..66279be1b 100644 --- a/runtime/darwinia/src/weights/block_weights.rs +++ b/runtime/darwinia/src/weights/block_weights.rs @@ -23,7 +23,7 @@ pub mod constants { parameter_types! { /// Importing a block with 0 Extrinsics. - pub const BlockExecutionWeight: Weight = constants::WEIGHT_PER_NANOS.saturating_mul(5_000_000); + pub const BlockExecutionWeight: Weight = Weight::from_ref_time(constants::WEIGHT_REF_TIME_PER_NANOS.saturating_mul(5_000_000)); } #[cfg(test)] @@ -39,12 +39,12 @@ pub mod constants { // At least 100 µs. assert!( - w.ref_time() >= 100u64 * constants::WEIGHT_PER_MICROS.ref_time(), + w.ref_time() >= 100u64 * constants::WEIGHT_REF_TIME_PER_MICROS, "Weight should be at least 100 µs." ); // At most 50 ms. assert!( - w.ref_time() <= 50u64 * constants::WEIGHT_PER_MILLIS.ref_time(), + w.ref_time() <= 50u64 * constants::WEIGHT_REF_TIME_PER_MILLIS, "Weight should be at most 50 ms." ); } diff --git a/runtime/darwinia/src/weights/extrinsic_weights.rs b/runtime/darwinia/src/weights/extrinsic_weights.rs index 3ce6b73d5..488686708 100644 --- a/runtime/darwinia/src/weights/extrinsic_weights.rs +++ b/runtime/darwinia/src/weights/extrinsic_weights.rs @@ -23,7 +23,7 @@ pub mod constants { parameter_types! { /// Executing a NO-OP `System::remarks` Extrinsic. - pub const ExtrinsicBaseWeight: Weight = constants::WEIGHT_PER_NANOS.saturating_mul(125_000); + pub const ExtrinsicBaseWeight: Weight = Weight::from_ref_time(constants::WEIGHT_REF_TIME_PER_NANOS.saturating_mul(125_000)); } #[cfg(test)] @@ -39,12 +39,12 @@ pub mod constants { // At least 10 µs. assert!( - w.ref_time() >= 10u64 * constants::WEIGHT_PER_MICROS.ref_time(), + w.ref_time() >= 10u64 * constants::WEIGHT_REF_TIME_PER_MICROS, "Weight should be at least 10 µs." ); // At most 1 ms. assert!( - w.ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(), + w.ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS, "Weight should be at most 1 ms." ); } diff --git a/runtime/darwinia/src/weights/paritydb_weights.rs b/runtime/darwinia/src/weights/paritydb_weights.rs index dca7d3483..4338d928d 100644 --- a/runtime/darwinia/src/weights/paritydb_weights.rs +++ b/runtime/darwinia/src/weights/paritydb_weights.rs @@ -25,8 +25,8 @@ pub mod constants { /// `ParityDB` can be enabled with a feature flag, but is still experimental. These weights /// are available for brave runtime engineers who may want to try this out as default. pub const ParityDbWeight: RuntimeDbWeight = RuntimeDbWeight { - read: 8_000 * constants::WEIGHT_PER_NANOS.ref_time(), - write: 50_000 * constants::WEIGHT_PER_NANOS.ref_time(), + read: 8_000 * constants::WEIGHT_REF_TIME_PER_NANOS, + write: 50_000 * constants::WEIGHT_REF_TIME_PER_NANOS, }; } @@ -42,20 +42,20 @@ pub mod constants { fn sane() { // At least 1 µs. assert!( - W::get().reads(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(), + W::get().reads(1).ref_time() >= constants::WEIGHT_REF_TIME_PER_MICROS, "Read weight should be at least 1 µs." ); assert!( - W::get().writes(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(), + W::get().writes(1).ref_time() >= constants::WEIGHT_REF_TIME_PER_MICROS, "Write weight should be at least 1 µs." ); // At most 1 ms. assert!( - W::get().reads(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(), + W::get().reads(1).ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS, "Read weight should be at most 1 ms." ); assert!( - W::get().writes(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(), + W::get().writes(1).ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS, "Write weight should be at most 1 ms." ); } diff --git a/runtime/darwinia/src/weights/rocksdb_weights.rs b/runtime/darwinia/src/weights/rocksdb_weights.rs index 87867ebfe..1d115d963 100644 --- a/runtime/darwinia/src/weights/rocksdb_weights.rs +++ b/runtime/darwinia/src/weights/rocksdb_weights.rs @@ -25,8 +25,8 @@ pub mod constants { /// By default, Substrate uses `RocksDB`, so this will be the weight used throughout /// the runtime. pub const RocksDbWeight: RuntimeDbWeight = RuntimeDbWeight { - read: 25_000 * constants::WEIGHT_PER_NANOS.ref_time(), - write: 100_000 * constants::WEIGHT_PER_NANOS.ref_time(), + read: 25_000 * constants::WEIGHT_REF_TIME_PER_NANOS, + write: 100_000 * constants::WEIGHT_REF_TIME_PER_NANOS, }; } @@ -42,20 +42,20 @@ pub mod constants { fn sane() { // At least 1 µs. assert!( - W::get().reads(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(), + W::get().reads(1).ref_time() >= constants::WEIGHT_REF_TIME_PER_MICROS, "Read weight should be at least 1 µs." ); assert!( - W::get().writes(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(), + W::get().writes(1).ref_time() >= constants::WEIGHT_REF_TIME_PER_MICROS, "Write weight should be at least 1 µs." ); // At most 1 ms. assert!( - W::get().reads(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(), + W::get().reads(1).ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS, "Read weight should be at most 1 ms." ); assert!( - W::get().writes(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(), + W::get().writes(1).ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS, "Write weight should be at most 1 ms." ); } diff --git a/runtime/pangolin/Cargo.toml b/runtime/pangolin/Cargo.toml index f3da526f8..b5610ac1b 100644 --- a/runtime/pangolin/Cargo.toml +++ b/runtime/pangolin/Cargo.toml @@ -10,7 +10,7 @@ repository = "https://github.com/darwinia-network/darwinia" version = "6.0.0" [build-dependencies] -substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } [dependencies] # crates.io @@ -21,17 +21,17 @@ static_assertions = { version = "1.1" } array-bytes = { version = "6.0", optional = true } # cumulus -cumulus-pallet-aura-ext = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.33" } -cumulus-pallet-dmp-queue = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.33" } -cumulus-pallet-parachain-system = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.33" } -cumulus-pallet-xcm = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.33" } -cumulus-pallet-xcmp-queue = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.33" } -cumulus-primitives-core = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.33" } -cumulus-primitives-timestamp = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.33" } -cumulus-primitives-utility = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.33" } -parachain-info = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.33" } +cumulus-pallet-aura-ext = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } +cumulus-pallet-dmp-queue = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } +cumulus-pallet-parachain-system = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } +cumulus-pallet-xcm = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } +cumulus-pallet-xcmp-queue = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } +cumulus-primitives-core = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } +cumulus-primitives-timestamp = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } +cumulus-primitives-utility = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } +parachain-info = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } # cumulus optional -cumulus-pallet-session-benchmarking = { optional = true, default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.33" } +cumulus-pallet-session-benchmarking = { optional = true, default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } # darwinia darwinia-account-migration = { default-features = false, path = "../../pallet/account-migration" } @@ -49,89 +49,89 @@ darwinia-staking = { default-features = false, path = "../../pa dc-primitives = { default-features = false, path = "../../core/primitives" } # darwinia-messages-substrate -bp-message-dispatch = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.33" } -bp-messages = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.33" } -bp-polkadot-core = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.33" } -bp-runtime = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.33" } -bridge-runtime-common = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.33" } -pallet-bridge-dispatch = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.33" } -pallet-bridge-grandpa = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.33" } -pallet-bridge-messages = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.33" } -pallet-bridge-parachains = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.33" } -pallet-fee-market = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.33" } +bp-message-dispatch = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } +bp-messages = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } +bp-polkadot-core = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } +bp-runtime = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } +bridge-runtime-common = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } +pallet-bridge-dispatch = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } +pallet-bridge-grandpa = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } +pallet-bridge-messages = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } +pallet-bridge-parachains = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } +pallet-fee-market = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } # frontier -fp-rpc = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } -fp-self-contained = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } -pallet-ethereum = { default-features = false, features = ["forbid-evm-reentrancy"], git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } -pallet-evm = { default-features = false, features = ["forbid-evm-reentrancy"], git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } -pallet-evm-precompile-blake2 = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } -pallet-evm-precompile-bn128 = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } -pallet-evm-precompile-dispatch = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } -pallet-evm-precompile-modexp = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } -pallet-evm-precompile-simple = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.33" } +fp-rpc = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } +fp-self-contained = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } +pallet-ethereum = { default-features = false, features = ["forbid-evm-reentrancy"], git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } +pallet-evm = { default-features = false, features = ["forbid-evm-reentrancy"], git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } +pallet-evm-precompile-blake2 = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } +pallet-evm-precompile-bn128 = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } +pallet-evm-precompile-dispatch = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } +pallet-evm-precompile-modexp = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } +pallet-evm-precompile-simple = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } # moonbeam -precompile-utils = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.33" } -xcm-primitives = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.33" } +precompile-utils = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.36" } +xcm-primitives = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.36" } # polkadot -pallet-xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.33" } -polkadot-parachain = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.33" } -polkadot-runtime-common = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.33" } -xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.33" } -xcm-builder = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.33" } -xcm-executor = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.33" } +pallet-xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36" } +polkadot-parachain = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36" } +polkadot-runtime-common = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36" } +xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36" } +xcm-builder = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36" } +xcm-executor = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36" } # substrate -frame-executive = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -frame-system-rpc-runtime-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-assets = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-aura = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-authorship = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-balances = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-collective = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-democracy = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-elections-phragmen = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-identity = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-membership = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-multisig = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-preimage = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-proxy = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-scheduler = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-session = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-sudo = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-timestamp = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-tips = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-transaction-payment = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-transaction-payment-rpc-runtime-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-treasury = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-utility = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -pallet-vesting = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-block-builder = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-consensus-aura = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-inherents = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-io = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-offchain = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-session = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-transaction-pool = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -sp-version = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +frame-executive = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +frame-system-rpc-runtime-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-assets = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-aura = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-authorship = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-balances = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-collective = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-democracy = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-elections-phragmen = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-identity = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-membership = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-multisig = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-preimage = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-proxy = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-scheduler = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-session = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-sudo = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-timestamp = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-tips = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-transaction-payment = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-transaction-payment-rpc-runtime-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-treasury = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-utility = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-vesting = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-block-builder = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-consensus-aura = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-inherents = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-io = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-offchain = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-session = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-transaction-pool = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-version = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } # substrate optional -frame-benchmarking = { optional = true, default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -frame-system-benchmarking = { optional = true, default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } -frame-try-runtime = { optional = true, default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +frame-benchmarking = { optional = true, default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +frame-system-benchmarking = { optional = true, default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +frame-try-runtime = { optional = true, default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } [dev-dependencies] # darwinia darwinia-common-runtime = { features = ["test"], path = "../common" } # substrate -sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" } +sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } [features] default = ["std"] @@ -332,6 +332,7 @@ try-runtime = [ "pallet-fee-market/try-runtime", # frontier + "fp-self-contained/try-runtime", "pallet-ethereum/try-runtime", "pallet-evm/try-runtime", @@ -364,6 +365,7 @@ try-runtime = [ "pallet-treasury/try-runtime", "pallet-utility/try-runtime", "pallet-vesting/try-runtime", + "sp-runtime/try-runtime", # substrate optional "frame-try-runtime/try-runtime", ] diff --git a/runtime/pangolin/src/lib.rs b/runtime/pangolin/src/lib.rs index fb5b9cbc7..8dfa46d6c 100644 --- a/runtime/pangolin/src/lib.rs +++ b/runtime/pangolin/src/lib.rs @@ -582,30 +582,26 @@ sp_api::impl_runtime_apis! { #[cfg(feature = "try-runtime")] impl frame_try_runtime::TryRuntime for Runtime { - fn on_runtime_upgrade() -> (Weight, Weight) { + fn on_runtime_upgrade(checks: bool) -> (Weight, Weight) { // substrate use frame_support::log; log::info!("try-runtime::on_runtime_upgrade"); - let weight = Executive::try_runtime_upgrade().unwrap(); + let weight = Executive::try_runtime_upgrade(checks).unwrap(); (weight, RuntimeBlockWeights::get().max_block) } - fn execute_block(block: Block, state_root_check: bool, select: frame_try_runtime::TryStateSelect) -> Weight { - // substrate - use frame_support::log; - - log::info!( - "try-runtime: executing block #{} ({:?}) / root checks: {:?} / sanity-checks: {:?}", - block.header.number, - block.header.hash(), - state_root_check, - select, - ); - - Executive::try_execute_block(block, state_root_check, select).expect("try_execute_block failed") + fn execute_block( + block: Block, + state_root_check: bool, + signature_check: bool, + select: frame_try_runtime::TryStateSelect, + ) -> Weight { + // NOTE: intentional unwrap: we don't want to propagate the error backwards, and want to + // have a backtrace here. + Executive::try_execute_block(block, state_root_check, signature_check, select).unwrap() } } } diff --git a/runtime/pangolin/src/pallets/assets.rs b/runtime/pangolin/src/pallets/assets.rs index d1a5335fe..8ff110b0e 100644 --- a/runtime/pangolin/src/pallets/assets.rs +++ b/runtime/pangolin/src/pallets/assets.rs @@ -33,7 +33,10 @@ impl pallet_assets::Config for Runtime { type AssetAccountDeposit = ConstU128<0>; type AssetDeposit = ConstU128<0>; type AssetId = AssetId; + type AssetIdParameter = codec::Compact; type Balance = Balance; + #[cfg(feature = "runtime-benchmarks")] + type BenchmarkHelper = (); type CreateOrigin = AsEnsureOriginWithArg, AccountId>>; type Currency = Balances; type Extra = (); @@ -41,6 +44,7 @@ impl pallet_assets::Config for Runtime { type Freezer = (); type MetadataDepositBase = ConstU128<0>; type MetadataDepositPerByte = ConstU128<0>; + type RemoveItemsLimit = ConstU32<1000>; type RuntimeEvent = RuntimeEvent; type StringLimit = ConstU32<50>; type WeightInfo = (); diff --git a/runtime/pangolin/src/pallets/deposit.rs b/runtime/pangolin/src/pallets/deposit.rs index 2febd939d..fbde4efca 100644 --- a/runtime/pangolin/src/pallets/deposit.rs +++ b/runtime/pangolin/src/pallets/deposit.rs @@ -24,7 +24,12 @@ impl darwinia_deposit::SimpleAsset for PKtonMinting { type AccountId = AccountId; fn mint(beneficiary: &Self::AccountId, amount: Balance) -> sp_runtime::DispatchResult { - Assets::mint(RuntimeOrigin::signed(ROOT), AssetIds::PKton as _, *beneficiary, amount) + Assets::mint( + RuntimeOrigin::signed(ROOT), + (AssetIds::PKton as AssetId).into(), + *beneficiary, + amount, + ) } fn burn(who: &Self::AccountId, amount: Balance) -> sp_runtime::DispatchResult { @@ -34,7 +39,7 @@ impl darwinia_deposit::SimpleAsset for PKtonMinting { Err(>::BalanceLow)?; } - Assets::burn(RuntimeOrigin::signed(ROOT), asset_id, *who, amount) + Assets::burn(RuntimeOrigin::signed(ROOT), asset_id.into(), *who, amount) } } diff --git a/runtime/pangolin/src/pallets/staking.rs b/runtime/pangolin/src/pallets/staking.rs index 83e0ea7fa..79ea8fe70 100644 --- a/runtime/pangolin/src/pallets/staking.rs +++ b/runtime/pangolin/src/pallets/staking.rs @@ -52,7 +52,7 @@ impl darwinia_staking::Stake for PKtonStaking { fn stake(who: &Self::AccountId, item: Self::Item) -> sp_runtime::DispatchResult { Assets::transfer( RuntimeOrigin::signed(*who), - AssetIds::PKton as AssetId, + (AssetIds::PKton as AssetId).into(), darwinia_staking::account_id(), item, ) @@ -61,7 +61,7 @@ impl darwinia_staking::Stake for PKtonStaking { fn unstake(who: &Self::AccountId, item: Self::Item) -> sp_runtime::DispatchResult { Assets::transfer( RuntimeOrigin::signed(darwinia_staking::account_id()), - AssetIds::PKton as AssetId, + (AssetIds::PKton as AssetId).into(), *who, item, ) diff --git a/runtime/pangolin/src/pallets/system.rs b/runtime/pangolin/src/pallets/system.rs index ac01d5c80..43a826035 100644 --- a/runtime/pangolin/src/pallets/system.rs +++ b/runtime/pangolin/src/pallets/system.rs @@ -28,9 +28,10 @@ const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(5); pub const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75); /// We allow for 0.5 of a second of compute with a 12 second average block time. -pub const MAXIMUM_BLOCK_WEIGHT: Weight = frame_support::weights::constants::WEIGHT_PER_SECOND - .saturating_div(2) - .set_proof_size(cumulus_primitives_core::relay_chain::v2::MAX_POV_SIZE as u64); +pub const MAXIMUM_BLOCK_WEIGHT: Weight = Weight::from_parts( + frame_support::weights::constants::WEIGHT_REF_TIME_PER_SECOND.saturating_div(2), + cumulus_primitives_core::relay_chain::v2::MAX_POV_SIZE as u64, +); frame_support::parameter_types! { pub const Version: sp_version::RuntimeVersion = VERSION; diff --git a/runtime/pangolin/src/pallets/timestamp.rs b/runtime/pangolin/src/pallets/timestamp.rs index 3443326fa..b18b2a162 100644 --- a/runtime/pangolin/src/pallets/timestamp.rs +++ b/runtime/pangolin/src/pallets/timestamp.rs @@ -23,6 +23,6 @@ impl pallet_timestamp::Config for Runtime { type MinimumPeriod = ConstU64<{ SLOT_DURATION / 2 }>; /// A timestamp: milliseconds since the unix epoch. type Moment = u64; - type OnTimestampSet = (); + type OnTimestampSet = Aura; type WeightInfo = weights::pallet_timestamp::WeightInfo; } diff --git a/runtime/pangolin/src/weights/block_weights.rs b/runtime/pangolin/src/weights/block_weights.rs index c00430733..66279be1b 100644 --- a/runtime/pangolin/src/weights/block_weights.rs +++ b/runtime/pangolin/src/weights/block_weights.rs @@ -23,7 +23,7 @@ pub mod constants { parameter_types! { /// Importing a block with 0 Extrinsics. - pub const BlockExecutionWeight: Weight = constants::WEIGHT_PER_NANOS.saturating_mul(5_000_000); + pub const BlockExecutionWeight: Weight = Weight::from_ref_time(constants::WEIGHT_REF_TIME_PER_NANOS.saturating_mul(5_000_000)); } #[cfg(test)] @@ -39,12 +39,12 @@ pub mod constants { // At least 100 µs. assert!( - w.ref_time() >= 100u64 * constants::WEIGHT_PER_MICROS.ref_time(), + w.ref_time() >= 100u64 * constants::WEIGHT_REF_TIME_PER_MICROS, "Weight should be at least 100 µs." ); // At most 50 ms. assert!( - w.ref_time() <= 50u64 * constants::WEIGHT_PER_MILLIS.ref_time(), + w.ref_time() <= 50u64 * constants::WEIGHT_REF_TIME_PER_MILLIS, "Weight should be at most 50 ms." ); } diff --git a/runtime/pangolin/src/weights/extrinsic_weights.rs b/runtime/pangolin/src/weights/extrinsic_weights.rs index 3ce6b73d5..488686708 100644 --- a/runtime/pangolin/src/weights/extrinsic_weights.rs +++ b/runtime/pangolin/src/weights/extrinsic_weights.rs @@ -23,7 +23,7 @@ pub mod constants { parameter_types! { /// Executing a NO-OP `System::remarks` Extrinsic. - pub const ExtrinsicBaseWeight: Weight = constants::WEIGHT_PER_NANOS.saturating_mul(125_000); + pub const ExtrinsicBaseWeight: Weight = Weight::from_ref_time(constants::WEIGHT_REF_TIME_PER_NANOS.saturating_mul(125_000)); } #[cfg(test)] @@ -39,12 +39,12 @@ pub mod constants { // At least 10 µs. assert!( - w.ref_time() >= 10u64 * constants::WEIGHT_PER_MICROS.ref_time(), + w.ref_time() >= 10u64 * constants::WEIGHT_REF_TIME_PER_MICROS, "Weight should be at least 10 µs." ); // At most 1 ms. assert!( - w.ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(), + w.ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS, "Weight should be at most 1 ms." ); } diff --git a/runtime/pangolin/src/weights/paritydb_weights.rs b/runtime/pangolin/src/weights/paritydb_weights.rs index dca7d3483..4338d928d 100644 --- a/runtime/pangolin/src/weights/paritydb_weights.rs +++ b/runtime/pangolin/src/weights/paritydb_weights.rs @@ -25,8 +25,8 @@ pub mod constants { /// `ParityDB` can be enabled with a feature flag, but is still experimental. These weights /// are available for brave runtime engineers who may want to try this out as default. pub const ParityDbWeight: RuntimeDbWeight = RuntimeDbWeight { - read: 8_000 * constants::WEIGHT_PER_NANOS.ref_time(), - write: 50_000 * constants::WEIGHT_PER_NANOS.ref_time(), + read: 8_000 * constants::WEIGHT_REF_TIME_PER_NANOS, + write: 50_000 * constants::WEIGHT_REF_TIME_PER_NANOS, }; } @@ -42,20 +42,20 @@ pub mod constants { fn sane() { // At least 1 µs. assert!( - W::get().reads(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(), + W::get().reads(1).ref_time() >= constants::WEIGHT_REF_TIME_PER_MICROS, "Read weight should be at least 1 µs." ); assert!( - W::get().writes(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(), + W::get().writes(1).ref_time() >= constants::WEIGHT_REF_TIME_PER_MICROS, "Write weight should be at least 1 µs." ); // At most 1 ms. assert!( - W::get().reads(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(), + W::get().reads(1).ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS, "Read weight should be at most 1 ms." ); assert!( - W::get().writes(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(), + W::get().writes(1).ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS, "Write weight should be at most 1 ms." ); } diff --git a/runtime/pangolin/src/weights/rocksdb_weights.rs b/runtime/pangolin/src/weights/rocksdb_weights.rs index 87867ebfe..1d115d963 100644 --- a/runtime/pangolin/src/weights/rocksdb_weights.rs +++ b/runtime/pangolin/src/weights/rocksdb_weights.rs @@ -25,8 +25,8 @@ pub mod constants { /// By default, Substrate uses `RocksDB`, so this will be the weight used throughout /// the runtime. pub const RocksDbWeight: RuntimeDbWeight = RuntimeDbWeight { - read: 25_000 * constants::WEIGHT_PER_NANOS.ref_time(), - write: 100_000 * constants::WEIGHT_PER_NANOS.ref_time(), + read: 25_000 * constants::WEIGHT_REF_TIME_PER_NANOS, + write: 100_000 * constants::WEIGHT_REF_TIME_PER_NANOS, }; } @@ -42,20 +42,20 @@ pub mod constants { fn sane() { // At least 1 µs. assert!( - W::get().reads(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(), + W::get().reads(1).ref_time() >= constants::WEIGHT_REF_TIME_PER_MICROS, "Read weight should be at least 1 µs." ); assert!( - W::get().writes(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(), + W::get().writes(1).ref_time() >= constants::WEIGHT_REF_TIME_PER_MICROS, "Write weight should be at least 1 µs." ); // At most 1 ms. assert!( - W::get().reads(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(), + W::get().reads(1).ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS, "Read weight should be at most 1 ms." ); assert!( - W::get().writes(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(), + W::get().writes(1).ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS, "Write weight should be at most 1 ms." ); } From b69b7b5bd6c58d727b8257f71fa37c50adedf7ea Mon Sep 17 00:00:00 2001 From: bear Date: Wed, 8 Feb 2023 13:21:24 +0800 Subject: [PATCH 132/189] Migrate `pallet-assets` (#260) * Anchor polkadot-v0.9.36 * Companion for paritytech/cumulus#1860 * Companion for paritytech/cumulus#1876 * Companion for paritytech/cumulus#1904 * Companion for paritytech/substrate#12310 * Companion for paritytech/substrate#12740 * Bump array-bytes to 6.0.0 * Companion for paritytech/substrate#12868 * Companion for paritytech/cumulus#1930 * Companion for paritytech/cumulus#1905 * Companion for paritytech/cumulus#1880 * Companion for paritytech/cumulus#1997 * Companion for paritytech/cumulus#1559 * Prepare messages-substrate * Companion for paritytech/substrate#12684 * Companion for paritytech/substrate#12740 * Fix compile paritytech/substrate#12740 * Compile done * Format * Add call index * Compile done * Fix CI * Bump moonbeam * Fix CI * Try fix tests * Use into instead of `Compact` * Patch substrate & Fix compile * Fix try-runtime * Remove parity-util-mem * Companion for https://github.com/paritytech/substrate/pull/12310 * Update state processor * Add type link * Fix review issues * Format --------- Co-authored-by: Guantong --- runtime/pangolin/src/lib.rs | 1 + tool/state-processor/src/system/mod.rs | 2 +- tool/state-processor/src/tests.rs | 7 ++++++- tool/state-processor/src/type_registry.rs | 15 ++++++++++++++- 4 files changed, 22 insertions(+), 3 deletions(-) diff --git a/runtime/pangolin/src/lib.rs b/runtime/pangolin/src/lib.rs index 8dfa46d6c..b74f68d6b 100644 --- a/runtime/pangolin/src/lib.rs +++ b/runtime/pangolin/src/lib.rs @@ -89,6 +89,7 @@ pub type Executive = frame_executive::Executive< frame_system::ChainContext, Runtime, AllPalletsWithSystem, + pallet_assets::migration::v1::MigrateToV1, >; /// Darwinia proposal base fee. diff --git a/tool/state-processor/src/system/mod.rs b/tool/state-processor/src/system/mod.rs index 64fe8b154..b74824c07 100644 --- a/tool/state-processor/src/system/mod.rs +++ b/tool/state-processor/src/system/mod.rs @@ -96,7 +96,7 @@ where sufficients: Default::default(), accounts: Default::default(), approvals: Default::default(), - is_frozen: false, + status: Default::default(), }; log::info!("increase `EVM::AccountCodes`'s `sufficients` and set `Assets::Account`, `System::Account`, `AccountMigration::KtonAccounts` and `AccountMigration::Accounts`"); diff --git a/tool/state-processor/src/tests.rs b/tool/state-processor/src/tests.rs index 075b4b3aa..52cfa2430 100644 --- a/tool/state-processor/src/tests.rs +++ b/tool/state-processor/src/tests.rs @@ -359,10 +359,15 @@ fn asset_creation() { &blake2_128_concat_to_string(KTON_ID.encode()), &mut details, ); - assert!(details.accounts > 0); + assert_eq!(details.owner, ROOT); assert!(details.supply != 0); + assert_eq!(details.deposit, 0); assert_eq!(details.min_balance, 1); + assert_eq!(details.is_sufficient, true); assert_eq!(details.sufficients, details.accounts); + assert!(details.accounts > 0); + assert_eq!(details.approvals, 0); + assert_eq!(details.status, AssetStatus::Live); }); } diff --git a/tool/state-processor/src/type_registry.rs b/tool/state-processor/src/type_registry.rs index b0517ebb2..8bba8a9ac 100644 --- a/tool/state-processor/src/type_registry.rs +++ b/tool/state-processor/src/type_registry.rs @@ -62,7 +62,20 @@ pub struct AssetDetails { pub accounts: u32, pub sufficients: u32, pub approvals: u32, - pub is_frozen: bool, + pub status: AssetStatus, +} + +// https://github.com/paritytech/substrate/blob/polkadot-v0.9.36/frame/assets/src/types.rs#L35 +#[derive(Debug, Encode, Decode, PartialEq)] +pub enum AssetStatus { + Live, + Frozen, + Destroying, +} +impl Default for AssetStatus { + fn default() -> Self { + AssetStatus::Live + } } // https://github.dev/paritytech/substrate/blob/polkadot-v0.9.30/frame/assets/src/types.rs#L115 From 93aff17d60cf6dd503e1718e1ddf59a6ad4b04b1 Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Wed, 8 Feb 2023 18:36:09 +0800 Subject: [PATCH 133/189] Clean imports (#271) * Clean imports * Fix tests --- pallet/message-transact/src/mock.rs | 24 ++- pallet/message-transact/src/tests/mod.rs | 3 +- precompile/assets/src/mock.rs | 3 +- precompile/deposit/src/mock.rs | 3 +- precompile/staking/src/mock.rs | 3 +- precompile/state-storage/src/mock.rs | 4 +- runtime/common/src/lib.rs | 4 +- runtime/crab/src/lib.rs | 137 ++++++++---------- runtime/crab/src/pallets/assets.rs | 6 +- runtime/crab/src/pallets/bridge_dispatch.rs | 4 +- runtime/crab/src/pallets/dmp_queue.rs | 4 +- runtime/crab/src/pallets/evm.rs | 28 ++-- runtime/crab/src/pallets/parachain_system.rs | 6 +- runtime/crab/src/pallets/polkadot_xcm.rs | 2 +- runtime/crab/src/pallets/preimage.rs | 2 +- runtime/crab/src/pallets/system.rs | 21 +-- .../crab/src/pallets/transaction_payment.rs | 2 +- runtime/crab/src/pallets/vesting.rs | 6 +- runtime/crab/src/pallets/xcmp_queue.rs | 6 +- runtime/crab/src/weights/block_weights.rs | 20 +-- runtime/crab/src/weights/extrinsic_weights.rs | 19 +-- runtime/darwinia/src/lib.rs | 137 ++++++++---------- runtime/darwinia/src/pallets/assets.rs | 6 +- .../darwinia/src/pallets/bridge_dispatch.rs | 4 +- runtime/darwinia/src/pallets/dmp_queue.rs | 4 +- runtime/darwinia/src/pallets/evm.rs | 28 ++-- .../darwinia/src/pallets/parachain_system.rs | 6 +- runtime/darwinia/src/pallets/polkadot_xcm.rs | 2 +- runtime/darwinia/src/pallets/preimage.rs | 2 +- runtime/darwinia/src/pallets/system.rs | 21 +-- .../src/pallets/transaction_payment.rs | 2 +- runtime/darwinia/src/pallets/vesting.rs | 6 +- runtime/darwinia/src/pallets/xcmp_queue.rs | 6 +- runtime/darwinia/src/weights/block_weights.rs | 20 +-- .../darwinia/src/weights/extrinsic_weights.rs | 19 +-- runtime/pangolin/src/lib.rs | 137 ++++++++---------- runtime/pangolin/src/pallets/assets.rs | 6 +- runtime/pangolin/src/pallets/dmp_queue.rs | 4 +- runtime/pangolin/src/pallets/evm.rs | 28 ++-- .../pangolin/src/pallets/parachain_system.rs | 6 +- runtime/pangolin/src/pallets/polkadot_xcm.rs | 2 +- runtime/pangolin/src/pallets/preimage.rs | 2 +- runtime/pangolin/src/pallets/system.rs | 21 +-- .../src/pallets/transaction_payment.rs | 2 +- runtime/pangolin/src/pallets/vesting.rs | 6 +- runtime/pangolin/src/pallets/xcmp_queue.rs | 6 +- runtime/pangolin/src/weights/block_weights.rs | 20 +-- .../pangolin/src/weights/extrinsic_weights.rs | 19 +-- 48 files changed, 389 insertions(+), 440 deletions(-) diff --git a/pallet/message-transact/src/mock.rs b/pallet/message-transact/src/mock.rs index ea496d865..c6a9344b7 100644 --- a/pallet/message-transact/src/mock.rs +++ b/pallet/message-transact/src/mock.rs @@ -27,10 +27,8 @@ use pallet_ethereum::IntermediateStateRoot; use frame_support::{ dispatch::RawOrigin, ensure, - pallet_prelude::Weight, traits::{ConstU32, Everything}, }; -use sp_core::{H256, U256}; use sp_runtime::{ testing::Header, traits::{BlakeTwo256, DispatchInfoOf, IdentifyAccount, IdentityLookup, Verify}, @@ -43,7 +41,7 @@ use bp_message_dispatch::{CallValidate, IntoDispatchOrigin as IntoDispatchOrigin pub type Block = frame_system::mocking::MockBlock; pub type Balance = u64; -pub type AccountId = H160; +pub type AccountId = sp_core::H160; pub type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; frame_support::parameter_types! { @@ -58,7 +56,7 @@ impl frame_system::Config for TestRuntime { type BlockNumber = u64; type BlockWeights = (); type DbWeight = (); - type Hash = H256; + type Hash = sp_core::H256; type Hashing = BlakeTwo256; type Header = Header; type Index = u64; @@ -105,14 +103,14 @@ impl pallet_timestamp::Config for TestRuntime { frame_support::parameter_types! { pub const TransactionByteFee: u64 = 1; pub const ChainId: u64 = 42; - pub const BlockGasLimit: U256 = U256::MAX; - pub const WeightPerGas: Weight = Weight::from_ref_time(20_000); + pub const BlockGasLimit: sp_core::U256 = sp_core::U256::MAX; + pub const WeightPerGas: frame_support::weights::Weight = frame_support::weights::Weight::from_ref_time(20_000); } pub struct FixedGasPrice; impl FeeCalculator for FixedGasPrice { - fn min_gas_price() -> (U256, Weight) { - (U256::from(5), Weight::zero()) + fn min_gas_price() -> (sp_core::U256, frame_support::weights::Weight) { + (sp_core::U256::from(5), frame_support::weights::Weight::zero()) } } @@ -141,8 +139,8 @@ impl pallet_ethereum::Config for TestRuntime { } pub struct MockAccountIdConverter; -impl sp_runtime::traits::Convert for MockAccountIdConverter { - fn convert(hash: H256) -> AccountId { +impl sp_runtime::traits::Convert for MockAccountIdConverter { + fn convert(hash: sp_core::H256) -> AccountId { hash.into() } } @@ -266,7 +264,7 @@ frame_support::construct_runtime! { } impl fp_self_contained::SelfContainedCall for RuntimeCall { - type SignedInfo = H160; + type SignedInfo = sp_core::H160; fn is_self_contained(&self) -> bool { match self { @@ -323,8 +321,8 @@ impl fp_self_contained::SelfContainedCall for RuntimeCall { } pub(crate) struct AccountInfo { - pub address: H160, - pub private_key: H256, + pub address: sp_core::H160, + pub private_key: sp_core::H256, } pub(crate) fn address_build(seed: u8) -> AccountInfo { diff --git a/pallet/message-transact/src/tests/mod.rs b/pallet/message-transact/src/tests/mod.rs index 9119ddef2..412a3a423 100644 --- a/pallet/message-transact/src/tests/mod.rs +++ b/pallet/message-transact/src/tests/mod.rs @@ -32,14 +32,13 @@ use crate::mock::*; use bp_message_dispatch::{CallOrigin, MessageDispatch, MessagePayload, SpecVersion}; use bp_runtime::messages::DispatchFeePayment; // substrate -use frame_support::pallet_prelude::Weight; use sp_core::{H256, U256}; pub(crate) const TEST_SPEC_VERSION: SpecVersion = 0; pub(crate) type SubChainId = [u8; 4]; pub(crate) const SOURCE_CHAIN_ID: SubChainId = *b"srce"; pub(crate) const TARGET_CHAIN_ID: SubChainId = *b"trgt"; -pub(crate) const TEST_WEIGHT: Weight = Weight::from_ref_time(1_000_000_000_000); +pub(crate) const TEST_WEIGHT: frame_support::weights::Weight = frame_support::weights::Weight::from_ref_time(1_000_000_000_000); // This ERC-20 contract mints the maximum amount of tokens to the contract creator. // pragma solidity ^0.5.0; diff --git a/precompile/assets/src/mock.rs b/precompile/assets/src/mock.rs index 470a5ee2a..41eba8fbb 100644 --- a/precompile/assets/src/mock.rs +++ b/precompile/assets/src/mock.rs @@ -21,7 +21,6 @@ use codec::{Decode, Encode, MaxEncodedLen}; // frontier use fp_evm::{Precompile, PrecompileSet}; // parity -use frame_support::pallet_prelude::Weight; use sp_core::{H160, H256, U256}; use sp_std::{marker::PhantomData, prelude::*}; // darwinia @@ -148,7 +147,7 @@ impl AccountToAssetId for AssetIdConverter { frame_support::parameter_types! { pub const BlockGasLimit: U256 = U256::MAX; - pub const WeightPerGas: Weight = Weight::from_ref_time(20_000); + pub const WeightPerGas: frame_support::weights::Weight = frame_support::weights::Weight::from_ref_time(20_000); pub PrecompilesValue: TestPrecompiles = TestPrecompiles::<_>::new(); } diff --git a/precompile/deposit/src/mock.rs b/precompile/deposit/src/mock.rs index 6fbc0cc5d..860170ffc 100644 --- a/precompile/deposit/src/mock.rs +++ b/precompile/deposit/src/mock.rs @@ -23,7 +23,6 @@ use crate::*; // frontier use fp_evm::{Precompile, PrecompileSet}; // substrate -use frame_support::pallet_prelude::Weight; use sp_core::{ConstU32, H160, H256, U256}; pub(crate) type Balance = u128; @@ -150,7 +149,7 @@ fn addr(a: u64) -> H160 { frame_support::parameter_types! { pub const BlockGasLimit: U256 = U256::MAX; - pub const WeightPerGas: Weight = Weight::from_ref_time(20_000); + pub const WeightPerGas: frame_support::weights::Weight = frame_support::weights::Weight::from_ref_time(20_000); pub PrecompilesValue: TestPrecompiles = TestPrecompiles::<_>::new(); } diff --git a/precompile/staking/src/mock.rs b/precompile/staking/src/mock.rs index 879e35dfb..2ee0d9026 100644 --- a/precompile/staking/src/mock.rs +++ b/precompile/staking/src/mock.rs @@ -23,7 +23,6 @@ use crate::*; // frontier use fp_evm::{Precompile, PrecompileSet}; // substrate -use frame_support::pallet_prelude::Weight; use sp_core::{ConstU32, H160, H256, U256}; pub(crate) type Balance = u128; @@ -154,7 +153,7 @@ pub type PCall = StakingCall; frame_support::parameter_types! { pub const BlockGasLimit: U256 = U256::MAX; - pub const WeightPerGas: Weight = Weight::from_ref_time(20_000); + pub const WeightPerGas: frame_support::weights::Weight = frame_support::weights::Weight::from_ref_time(20_000); pub PrecompilesValue: TestPrecompiles = TestPrecompiles::<_>::new(); } diff --git a/precompile/state-storage/src/mock.rs b/precompile/state-storage/src/mock.rs index b080d2ebc..bed68beed 100644 --- a/precompile/state-storage/src/mock.rs +++ b/precompile/state-storage/src/mock.rs @@ -21,7 +21,7 @@ use codec::{Decode, Encode, MaxEncodedLen}; // frontier use fp_evm::{Precompile, PrecompileSet}; // substrate -use frame_support::{pallet_prelude::Weight, StorageHasher, Twox128}; +use frame_support::{StorageHasher, Twox128}; use sp_core::{H160, H256, U256}; use sp_std::{marker::PhantomData, prelude::*}; // darwinia @@ -134,7 +134,7 @@ fn addr(a: u64) -> H160 { frame_support::parameter_types! { pub const BlockGasLimit: U256 = U256::MAX; - pub const WeightPerGas: Weight = Weight::from_ref_time(20_000); + pub const WeightPerGas: frame_support::weights::Weight = frame_support::weights::Weight::from_ref_time(20_000); pub PrecompilesValue: TestPrecompiles = TestPrecompiles::<_>::new(); } diff --git a/runtime/common/src/lib.rs b/runtime/common/src/lib.rs index 5bb1198cd..8966a564a 100644 --- a/runtime/common/src/lib.rs +++ b/runtime/common/src/lib.rs @@ -91,7 +91,7 @@ pub const fn darwinia_deposit(items: u32, bytes: u32) -> Balance { macro_rules! impl_self_contained_call { () => { impl fp_self_contained::SelfContainedCall for RuntimeCall { - type SignedInfo = H160; + type SignedInfo = sp_core::H160; fn is_self_contained(&self) -> bool { match self { @@ -119,7 +119,7 @@ macro_rules! impl_self_contained_call { info: &Self::SignedInfo, dispatch_info: &sp_runtime::traits::DispatchInfoOf, len: usize, - ) -> Option { + ) -> Option { match self { RuntimeCall::Ethereum(call) => call.validate_self_contained(info, dispatch_info, len), diff --git a/runtime/crab/src/lib.rs b/runtime/crab/src/lib.rs index 91e8e9568..8558a5c24 100644 --- a/runtime/crab/src/lib.rs +++ b/runtime/crab/src/lib.rs @@ -36,34 +36,14 @@ pub use darwinia_common_runtime::*; pub use dc_primitives::*; pub use sp_consensus_aura::sr25519::AuthorityId as AuraId; -// cumulus -use cumulus_pallet_parachain_system::RelayNumberStrictlyIncreases; -// polkadot -use xcm_executor::XcmExecutor; // substrate -use frame_support::{ - dispatch::DispatchClass, - traits::{AsEnsureOriginWithArg, Imbalance, IsInVec, OnUnbalanced, WithdrawReasons}, - weights::{ConstantMultiplier, Weight}, -}; -use frame_system::{EnsureRoot, EnsureSignedBy}; -use sp_core::{crypto::KeyTypeId, OpaqueMetadata, H160, H256, U256}; -use sp_runtime::{ - generic, - traits::Block as BlockT, - transaction_validity::{TransactionSource, TransactionValidity}, - ApplyExtrinsicResult, Perbill, Permill, -}; use sp_std::prelude::*; -#[cfg(feature = "std")] -use sp_version::NativeVersion; -use sp_version::RuntimeVersion; /// Block type as expected by this runtime. -pub type Block = generic::Block; +pub type Block = sp_runtime::generic::Block; /// A Block signed with a Justification -pub type SignedBlock = generic::SignedBlock; +pub type SignedBlock = sp_runtime::generic::SignedBlock; /// The SignedExtension to the basic transaction logic. pub type SignedExtra = ( @@ -84,7 +64,7 @@ pub type UncheckedExtrinsic = /// Extrinsic type that has already been checked. pub type CheckedExtrinsic = - fp_self_contained::CheckedExtrinsic; + fp_self_contained::CheckedExtrinsic; /// Executive: handles dispatch to the various modules. pub type Executive = frame_executive::Executive< @@ -100,7 +80,7 @@ pub const DARWINIA_PROPOSAL_REQUIREMENT: Balance = 5000 * UNIT; /// Runtime version. #[sp_version::runtime_version] -pub const VERSION: RuntimeVersion = RuntimeVersion { +pub const VERSION: sp_version::RuntimeVersion = sp_version::RuntimeVersion { spec_name: sp_runtime::create_runtime_str!("Crab2"), impl_name: sp_runtime::create_runtime_str!("DarwiniaOfficialRust"), authoring_version: 0, @@ -118,37 +98,48 @@ impl frame_support::traits::OnUnbalanced: OnUnbalanced>, + pallet_treasury::Pallet: + frame_support::traits::OnUnbalanced>, { // this seems to be called for substrate-based transactions fn on_unbalanceds( mut fees_then_tips: impl Iterator>, ) { if let Some(fees) = fees_then_tips.next() { + // substrate + use frame_support::traits::Imbalance; + // for fees, 80% are burned, 20% to the treasury let (_, to_treasury) = fees.ration(80, 20); // Balances pallet automatically burns dropped Negative Imbalances by decreasing // total_supply accordingly - as OnUnbalanced<_>>::on_unbalanced(to_treasury); + as frame_support::traits::OnUnbalanced<_>>::on_unbalanced( + to_treasury, + ); } } // this is called from pallet_evm for Ethereum-based transactions // (technically, it calls on_unbalanced, which calls this when non-zero) fn on_nonzero_unbalanced(amount: pallet_balances::NegativeImbalance) { + // substrate + use frame_support::traits::Imbalance; + // Balances pallet automatically burns dropped Negative Imbalances by decreasing // total_supply accordingly let (_, to_treasury) = amount.ration(80, 20); - as OnUnbalanced<_>>::on_unbalanced(to_treasury); + as frame_support::traits::OnUnbalanced<_>>::on_unbalanced( + to_treasury, + ); } } /// The version information used to identify this runtime when compiled natively. #[cfg(feature = "std")] -pub fn native_version() -> NativeVersion { - NativeVersion { runtime_version: VERSION, can_author_with: Default::default() } +pub fn native_version() -> sp_version::NativeVersion { + sp_version::NativeVersion { runtime_version: VERSION, can_author_with: Default::default() } } // Create the runtime by composing the FRAME pallets that were previously configured. @@ -255,7 +246,7 @@ sp_api::impl_runtime_apis! { } impl sp_api::Core for Runtime { - fn version() -> RuntimeVersion { + fn version() -> sp_version::RuntimeVersion { VERSION } @@ -263,27 +254,27 @@ sp_api::impl_runtime_apis! { Executive::execute_block(block) } - fn initialize_block(header: &::Header) { + fn initialize_block(header: &::Header) { Executive::initialize_block(header) } } impl sp_api::Metadata for Runtime { - fn metadata() -> OpaqueMetadata { - OpaqueMetadata::new(Runtime::metadata().into()) + fn metadata() -> sp_core::OpaqueMetadata { + sp_core::OpaqueMetadata::new(Runtime::metadata().into()) } } impl sp_block_builder::BlockBuilder for Runtime { - fn apply_extrinsic(extrinsic: ::Extrinsic) -> ApplyExtrinsicResult { + fn apply_extrinsic(extrinsic: ::Extrinsic) -> sp_runtime::ApplyExtrinsicResult { Executive::apply_extrinsic(extrinsic) } - fn finalize_block() -> ::Header { + fn finalize_block() -> ::Header { Executive::finalize_block() } - fn inherent_extrinsics(data: sp_inherents::InherentData) -> Vec<::Extrinsic> { + fn inherent_extrinsics(data: sp_inherents::InherentData) -> Vec<::Extrinsic> { data.create_extrinsics() } @@ -297,16 +288,16 @@ sp_api::impl_runtime_apis! { impl sp_transaction_pool::runtime_api::TaggedTransactionQueue for Runtime { fn validate_transaction( - source: TransactionSource, - tx: ::Extrinsic, - block_hash: ::Hash, - ) -> TransactionValidity { + source: sp_runtime::transaction_validity::TransactionSource, + tx: ::Extrinsic, + block_hash: ::Hash, + ) -> sp_runtime::transaction_validity::TransactionValidity { Executive::validate_transaction(source, tx, block_hash) } } impl sp_offchain::OffchainWorkerApi for Runtime { - fn offchain_worker(header: &::Header) { + fn offchain_worker(header: &::Header) { Executive::offchain_worker(header) } } @@ -318,7 +309,7 @@ sp_api::impl_runtime_apis! { fn decode_session_keys( encoded: Vec, - ) -> Option, KeyTypeId)>> { + ) -> Option, sp_runtime::KeyTypeId)>> { SessionKeys::decode_into_raw_public_keys(&encoded) } } @@ -331,13 +322,13 @@ sp_api::impl_runtime_apis! { impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi for Runtime { fn query_info( - uxt: ::Extrinsic, + uxt: ::Extrinsic, len: u32, ) -> pallet_transaction_payment_rpc_runtime_api::RuntimeDispatchInfo { TransactionPayment::query_info(uxt, len) } fn query_fee_details( - uxt: ::Extrinsic, + uxt: ::Extrinsic, len: u32, ) -> pallet_transaction_payment::FeeDetails { TransactionPayment::query_fee_details(uxt, len) @@ -362,7 +353,7 @@ sp_api::impl_runtime_apis! { } impl cumulus_primitives_core::CollectCollationInfo for Runtime { - fn collect_collation_info(header: &::Header) -> cumulus_primitives_core::CollationInfo { + fn collect_collation_info(header: &::Header) -> cumulus_primitives_core::CollationInfo { ParachainSystem::collect_collation_info(header) } } @@ -372,13 +363,13 @@ sp_api::impl_runtime_apis! { <::ChainId as frame_support::traits::Get>::get() } - fn account_basic(address: H160) -> pallet_evm::Account { + fn account_basic(address: sp_core::H160) -> pallet_evm::Account { let (account, _) = Evm::account_basic(&address); account } - fn gas_price() -> U256 { + fn gas_price() -> sp_core::U256 { // frontier use pallet_evm::FeeCalculator; @@ -387,33 +378,33 @@ sp_api::impl_runtime_apis! { gas_price } - fn account_code_at(address: H160) -> Vec { + fn account_code_at(address: sp_core::H160) -> Vec { Evm::account_codes(address) } - fn author() -> H160 { + fn author() -> sp_core::H160 { >::find_author() } - fn storage_at(address: H160, index: U256) -> H256 { + fn storage_at(address: sp_core::H160, index: sp_core::U256) -> sp_core::H256 { let mut tmp = [0u8; 32]; index.to_big_endian(&mut tmp); - Evm::account_storages(address, H256::from_slice(&tmp[..])) + Evm::account_storages(address, sp_core::H256::from_slice(&tmp[..])) } fn call( - from: H160, - to: H160, + from: sp_core::H160, + to: sp_core::H160, data: Vec, - value: U256, - gas_limit: U256, - max_fee_per_gas: Option, - max_priority_fee_per_gas: Option, - nonce: Option, + value: sp_core::U256, + gas_limit: sp_core::U256, + max_fee_per_gas: Option, + max_priority_fee_per_gas: Option, + nonce: Option, estimate: bool, - access_list: Option)>>, + access_list: Option)>>, ) -> Result { // frontier use pallet_evm::Runner; @@ -449,15 +440,15 @@ sp_api::impl_runtime_apis! { } fn create( - from: H160, + from: sp_core::H160, data: Vec, - value: U256, - gas_limit: U256, - max_fee_per_gas: Option, - max_priority_fee_per_gas: Option, - nonce: Option, + value: sp_core::U256, + gas_limit: sp_core::U256, + max_fee_per_gas: Option, + max_priority_fee_per_gas: Option, + nonce: Option, estimate: bool, - access_list: Option)>>, + access_list: Option)>>, ) -> Result { // frontier use pallet_evm::Runner; @@ -516,7 +507,7 @@ sp_api::impl_runtime_apis! { } fn extrinsic_filter( - xts: Vec<::Extrinsic>, + xts: Vec<::Extrinsic>, ) -> Vec { xts.into_iter().filter_map(|xt| match xt.0.function { RuntimeCall::Ethereum( @@ -526,7 +517,7 @@ sp_api::impl_runtime_apis! { }).collect::>() } - fn elasticity() -> Option { + fn elasticity() -> Option { None } @@ -536,7 +527,7 @@ sp_api::impl_runtime_apis! { impl fp_rpc::ConvertTransactionRuntimeApi for Runtime { fn convert_transaction( transaction: pallet_ethereum::Transaction - ) -> ::Extrinsic { + ) -> ::Extrinsic { UncheckedExtrinsic::new_unsigned( pallet_ethereum::Call::::transact { transaction }.into(), ) @@ -602,7 +593,7 @@ sp_api::impl_runtime_apis! { #[cfg(feature = "try-runtime")] impl frame_try_runtime::TryRuntime for Runtime { - fn on_runtime_upgrade(checks: bool) -> (Weight, Weight) { + fn on_runtime_upgrade(checks: bool) -> (Weight, frame_support::weights::Weight) { // substrate use frame_support::log; @@ -656,15 +647,13 @@ cumulus_pallet_parachain_system::register_validate_block! { #[cfg(test)] mod tests { // darwinia - use super::{Runtime, WeightPerGas}; - // substrate - use frame_support::dispatch::DispatchClass; + use super::*; #[test] fn configured_base_extrinsic_weight_is_evm_compatible() { let min_ethereum_transaction_weight = WeightPerGas::get() * 21_000; let base_extrinsic = ::BlockWeights::get() - .get(DispatchClass::Normal) + .get(frame_support::dispatch::DispatchClass::Normal) .base_extrinsic; assert!(base_extrinsic.ref_time() <= min_ethereum_transaction_weight.ref_time()); diff --git a/runtime/crab/src/pallets/assets.rs b/runtime/crab/src/pallets/assets.rs index ed9bd71c4..73f6c29f8 100644 --- a/runtime/crab/src/pallets/assets.rs +++ b/runtime/crab/src/pallets/assets.rs @@ -37,10 +37,12 @@ impl pallet_assets::Config for Runtime { type Balance = Balance; #[cfg(feature = "runtime-benchmarks")] type BenchmarkHelper = (); - type CreateOrigin = AsEnsureOriginWithArg, AccountId>>; + type CreateOrigin = frame_support::traits::AsEnsureOriginWithArg< + frame_system::EnsureSignedBy, AccountId>, + >; type Currency = Balances; type Extra = (); - type ForceOrigin = EnsureRoot; + type ForceOrigin = frame_system::EnsureRoot; type Freezer = (); type MetadataDepositBase = ConstU128<0>; type MetadataDepositPerByte = ConstU128<0>; diff --git a/runtime/crab/src/pallets/bridge_dispatch.rs b/runtime/crab/src/pallets/bridge_dispatch.rs index 8fb3d7a7e..b89d78a20 100644 --- a/runtime/crab/src/pallets/bridge_dispatch.rs +++ b/runtime/crab/src/pallets/bridge_dispatch.rs @@ -34,7 +34,7 @@ impl bp_message_dispatch::CallValidate fo let total_payment = darwinia_message_transact::total_payment::((&**tx).into()); let relayer = - pallet_evm::Pallet::::account_basic(&H160(relayer_account.0)).0; + pallet_evm::Pallet::::account_basic(&sp_core::H160(relayer_account.0)).0; frame_support::ensure!(relayer.balance >= total_payment, "Insufficient balance"); Ok(()) @@ -87,7 +87,7 @@ impl bp_message_dispatch::IntoDispatchOrigin darwinia_message_transact::LcmpEthOrigin::MessageTransact(H160(id.0)).into(), + }) => darwinia_message_transact::LcmpEthOrigin::MessageTransact(sp_core::H160(id.0)).into(), _ => frame_system::RawOrigin::Signed(*id).into(), } } diff --git a/runtime/crab/src/pallets/dmp_queue.rs b/runtime/crab/src/pallets/dmp_queue.rs index d31b45437..17313c1b7 100644 --- a/runtime/crab/src/pallets/dmp_queue.rs +++ b/runtime/crab/src/pallets/dmp_queue.rs @@ -20,7 +20,7 @@ use crate::*; impl cumulus_pallet_dmp_queue::Config for Runtime { - type ExecuteOverweightOrigin = EnsureRoot; + type ExecuteOverweightOrigin = frame_system::EnsureRoot; type RuntimeEvent = RuntimeEvent; - type XcmExecutor = XcmExecutor; + type XcmExecutor = xcm_executor::XcmExecutor; } diff --git a/runtime/crab/src/pallets/evm.rs b/runtime/crab/src/pallets/evm.rs index 9f07703cb..38982cf37 100644 --- a/runtime/crab/src/pallets/evm.rs +++ b/runtime/crab/src/pallets/evm.rs @@ -24,16 +24,16 @@ use pallet_evm::Precompile; const WEIGHT_PER_GAS: u64 = 40_000; frame_support::parameter_types! { - pub BlockGasLimit: U256 = U256::from(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT.ref_time() / WEIGHT_PER_GAS); + pub BlockGasLimit: sp_core::U256 = sp_core::U256::from(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT.ref_time() / WEIGHT_PER_GAS); pub PrecompilesValue: CrabPrecompiles = CrabPrecompiles::<_>::new(); - pub WeightPerGas: Weight = Weight::from_ref_time(WEIGHT_PER_GAS); + pub WeightPerGas: frame_support::weights::Weight = frame_support::weights::Weight::from_ref_time(WEIGHT_PER_GAS); } pub struct FindAuthorTruncated(sp_std::marker::PhantomData); -impl> frame_support::traits::FindAuthor +impl> frame_support::traits::FindAuthor for FindAuthorTruncated { - fn find_author<'a, I>(digests: I) -> Option + fn find_author<'a, I>(digests: I) -> Option where I: 'a + IntoIterator, { @@ -45,7 +45,7 @@ impl> frame_support::traits::FindAutho let raw = id.to_raw_vec(); if raw.len() >= 24 { - Some(H160::from_slice(&raw[4..24])) + Some(sp_core::H160::from_slice(&raw[4..24])) } else { None } @@ -56,8 +56,8 @@ impl> frame_support::traits::FindAutho pub struct FixedGasPrice; impl pallet_evm::FeeCalculator for FixedGasPrice { - fn min_gas_price() -> (U256, Weight) { - (U256::from(GWEI), Weight::zero()) + fn min_gas_price() -> (sp_core::U256, frame_support::weights::Weight) { + (sp_core::U256::from(GWEI), frame_support::weights::Weight::zero()) } } @@ -65,9 +65,9 @@ impl pallet_evm::FeeCalculator for FixedGasPrice { pub struct FromH160; impl pallet_evm::AddressMapping for FromH160 where - T: From, + T: From, { - fn into_account_id(address: H160) -> T { + fn into_account_id(address: sp_core::H160) -> T { address.into() } } @@ -75,7 +75,7 @@ where pub struct AssetIdConverter; impl darwinia_precompile_assets::AccountToAssetId for AssetIdConverter { fn account_to_asset_id(account_id: AccountId) -> AssetId { - let addr: H160 = account_id.into(); + let addr: sp_core::H160 = account_id.into(); addr.to_low_u64_be() } } @@ -90,7 +90,7 @@ where Self(Default::default()) } - pub fn used_addresses() -> [H160; 15] { + pub fn used_addresses() -> [sp_core::H160; 15] { [ addr(1), addr(2), @@ -164,7 +164,7 @@ where } } - fn is_precompile(&self, address: H160) -> bool { + fn is_precompile(&self, address: sp_core::H160) -> bool { Self::used_addresses().contains(&address) } } @@ -188,6 +188,6 @@ impl pallet_evm::Config for Runtime { type WithdrawOrigin = pallet_evm::EnsureAddressNever; } -fn addr(a: u64) -> H160 { - H160::from_low_u64_be(a) +fn addr(a: u64) -> sp_core::H160 { + sp_core::H160::from_low_u64_be(a) } diff --git a/runtime/crab/src/pallets/parachain_system.rs b/runtime/crab/src/pallets/parachain_system.rs index 42af96265..0f776807b 100644 --- a/runtime/crab/src/pallets/parachain_system.rs +++ b/runtime/crab/src/pallets/parachain_system.rs @@ -20,12 +20,12 @@ use crate::*; frame_support::parameter_types! { - pub const ReservedXcmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT.saturating_div(4); - pub const ReservedDmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT.saturating_div(4); + pub const ReservedXcmpWeight: frame_support::weights::Weight = MAXIMUM_BLOCK_WEIGHT.saturating_div(4); + pub const ReservedDmpWeight: frame_support::weights::Weight = MAXIMUM_BLOCK_WEIGHT.saturating_div(4); } impl cumulus_pallet_parachain_system::Config for Runtime { - type CheckAssociatedRelayNumber = RelayNumberStrictlyIncreases; + type CheckAssociatedRelayNumber = cumulus_pallet_parachain_system::RelayNumberStrictlyIncreases; type DmpMessageHandler = DmpQueue; type OnSystemEvent = (); type OutboundXcmpMessageSource = XcmpQueue; diff --git a/runtime/crab/src/pallets/polkadot_xcm.rs b/runtime/crab/src/pallets/polkadot_xcm.rs index 5046b8de2..4d0b7ba09 100644 --- a/runtime/crab/src/pallets/polkadot_xcm.rs +++ b/runtime/crab/src/pallets/polkadot_xcm.rs @@ -135,7 +135,7 @@ impl xcm_executor::Config for XcmExecutorConfig { type RuntimeCall = RuntimeCall; type SubscriptionService = PolkadotXcm; type Trader = xcm_configs::LocalAssetTrader< - ConstantMultiplier, + frame_support::weights::ConstantMultiplier, AnchoringSelfReserve, AccountId, Balances, diff --git a/runtime/crab/src/pallets/preimage.rs b/runtime/crab/src/pallets/preimage.rs index fc31bb737..d049ef1c0 100644 --- a/runtime/crab/src/pallets/preimage.rs +++ b/runtime/crab/src/pallets/preimage.rs @@ -23,7 +23,7 @@ impl pallet_preimage::Config for Runtime { type BaseDeposit = ConstU128<{ 500 * UNIT }>; type ByteDeposit = ConstU128<{ darwinia_deposit(0, 1) }>; type Currency = Balances; - type ManagerOrigin = EnsureRoot; + type ManagerOrigin = frame_system::EnsureRoot; type RuntimeEvent = RuntimeEvent; type WeightInfo = (); } diff --git a/runtime/crab/src/pallets/system.rs b/runtime/crab/src/pallets/system.rs index 43a826035..e5f331a7f 100644 --- a/runtime/crab/src/pallets/system.rs +++ b/runtime/crab/src/pallets/system.rs @@ -21,17 +21,18 @@ use crate::*; /// We assume that ~5% of the block weight is consumed by `on_initialize` handlers. This is /// used to limit the maximal weight of a single extrinsic. -const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(5); +const AVERAGE_ON_INITIALIZE_RATIO: sp_runtime::Perbill = sp_runtime::Perbill::from_percent(5); /// We allow `Normal` extrinsics to fill up the block up to 75%, the rest can be used by /// `Operational` extrinsics. -pub const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75); +pub const NORMAL_DISPATCH_RATIO: sp_runtime::Perbill = sp_runtime::Perbill::from_percent(75); /// We allow for 0.5 of a second of compute with a 12 second average block time. -pub const MAXIMUM_BLOCK_WEIGHT: Weight = Weight::from_parts( - frame_support::weights::constants::WEIGHT_REF_TIME_PER_SECOND.saturating_div(2), - cumulus_primitives_core::relay_chain::v2::MAX_POV_SIZE as u64, -); +pub const MAXIMUM_BLOCK_WEIGHT: frame_support::weights::Weight = + frame_support::weights::Weight::from_parts( + frame_support::weights::constants::WEIGHT_REF_TIME_PER_SECOND.saturating_div(2), + cumulus_primitives_core::relay_chain::v2::MAX_POV_SIZE as u64, + ); frame_support::parameter_types! { pub const Version: sp_version::RuntimeVersion = VERSION; @@ -39,13 +40,13 @@ frame_support::parameter_types! { frame_system::limits::BlockLength::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO); pub RuntimeBlockWeights: frame_system::limits::BlockWeights = frame_system::limits::BlockWeights::builder() .base_block(weights::BlockExecutionWeight::get()) - .for_class(DispatchClass::all(), |weights| { + .for_class(frame_support::dispatch::DispatchClass::all(), |weights| { weights.base_extrinsic = weights::ExtrinsicBaseWeight::get(); }) - .for_class(DispatchClass::Normal, |weights| { + .for_class(frame_support::dispatch::DispatchClass::Normal, |weights| { weights.max_total = Some(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT); }) - .for_class(DispatchClass::Operational, |weights| { + .for_class(frame_support::dispatch::DispatchClass::Operational, |weights| { weights.max_total = Some(MAXIMUM_BLOCK_WEIGHT); // Operational transactions have some extra reserved space, so that they // are included even if block reached `MAXIMUM_BLOCK_WEIGHT`. @@ -79,7 +80,7 @@ impl frame_system::Config for Runtime { /// The hashing algorithm used. type Hashing = Hashing; /// The header type. - type Header = generic::Header; + type Header = sp_runtime::generic::Header; /// The index type for storing how many extrinsics an account has signed. type Index = Index; /// The lookup mechanism to get account ID from whatever is passed in dispatchers. diff --git a/runtime/crab/src/pallets/transaction_payment.rs b/runtime/crab/src/pallets/transaction_payment.rs index 970135a54..6080dfeba 100644 --- a/runtime/crab/src/pallets/transaction_payment.rs +++ b/runtime/crab/src/pallets/transaction_payment.rs @@ -22,7 +22,7 @@ use crate::*; impl pallet_transaction_payment::Config for Runtime { type FeeMultiplierUpdate = polkadot_runtime_common::SlowAdjustingFeeUpdate; // Relay Chain `TransactionByteFee` / 10 - type LengthToFee = ConstantMultiplier>; + type LengthToFee = frame_support::weights::ConstantMultiplier>; type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter>; type OperationalFeeMultiplier = sp_runtime::traits::ConstU8<5>; diff --git a/runtime/crab/src/pallets/vesting.rs b/runtime/crab/src/pallets/vesting.rs index ca01513ea..1c0b0b6e6 100644 --- a/runtime/crab/src/pallets/vesting.rs +++ b/runtime/crab/src/pallets/vesting.rs @@ -20,8 +20,10 @@ use crate::*; frame_support::parameter_types! { - pub UnvestedFundsAllowedWithdrawReasons: WithdrawReasons = - WithdrawReasons::except(WithdrawReasons::TRANSFER | WithdrawReasons::RESERVE); + pub UnvestedFundsAllowedWithdrawReasons: frame_support::traits::WithdrawReasons = + frame_support::traits::WithdrawReasons::except( + frame_support::traits::WithdrawReasons::TRANSFER | frame_support::traits::WithdrawReasons::RESERVE + ); } impl pallet_vesting::Config for Runtime { diff --git a/runtime/crab/src/pallets/xcmp_queue.rs b/runtime/crab/src/pallets/xcmp_queue.rs index e90975a6c..f3f8d642d 100644 --- a/runtime/crab/src/pallets/xcmp_queue.rs +++ b/runtime/crab/src/pallets/xcmp_queue.rs @@ -21,11 +21,11 @@ use crate::*; impl cumulus_pallet_xcmp_queue::Config for Runtime { type ChannelInfo = ParachainSystem; - type ControllerOrigin = EnsureRoot; + type ControllerOrigin = frame_system::EnsureRoot; type ControllerOriginConverter = XcmOriginToTransactDispatchOrigin; - type ExecuteOverweightOrigin = EnsureRoot; + type ExecuteOverweightOrigin = frame_system::EnsureRoot; type RuntimeEvent = RuntimeEvent; type VersionWrapper = (); type WeightInfo = weights::cumulus_pallet_xcmp_queue::WeightInfo; - type XcmExecutor = XcmExecutor; + type XcmExecutor = xcm_executor::XcmExecutor; } diff --git a/runtime/crab/src/weights/block_weights.rs b/runtime/crab/src/weights/block_weights.rs index 66279be1b..8da49f757 100644 --- a/runtime/crab/src/weights/block_weights.rs +++ b/runtime/crab/src/weights/block_weights.rs @@ -16,35 +16,31 @@ // limitations under the License. pub mod constants { - use frame_support::{ - parameter_types, - weights::{constants, Weight}, - }; - - parameter_types! { + frame_support::parameter_types! { /// Importing a block with 0 Extrinsics. - pub const BlockExecutionWeight: Weight = Weight::from_ref_time(constants::WEIGHT_REF_TIME_PER_NANOS.saturating_mul(5_000_000)); + pub const BlockExecutionWeight: frame_support::weights::Weight = + frame_support::weights::Weight::from_ref_time(frame_support::weights::constants::WEIGHT_REF_TIME_PER_NANOS.saturating_mul(5_000_000)); } #[cfg(test)] mod test_weights { - use frame_support::weights::constants; - /// Checks that the weight exists and is sane. // NOTE: If this test fails but you are sure that the generated values are fine, // you can delete it. #[test] fn sane() { - let w = super::constants::BlockExecutionWeight::get(); + let w = frame_support::weights::constants::BlockExecutionWeight::get(); // At least 100 µs. assert!( - w.ref_time() >= 100u64 * constants::WEIGHT_REF_TIME_PER_MICROS, + w.ref_time() + >= 100u64 * frame_support::weights::constants::WEIGHT_REF_TIME_PER_MICROS, "Weight should be at least 100 µs." ); // At most 50 ms. assert!( - w.ref_time() <= 50u64 * constants::WEIGHT_REF_TIME_PER_MILLIS, + w.ref_time() + <= 50u64 * frame_support::weights::constants::WEIGHT_REF_TIME_PER_MILLIS, "Weight should be at most 50 ms." ); } diff --git a/runtime/crab/src/weights/extrinsic_weights.rs b/runtime/crab/src/weights/extrinsic_weights.rs index 488686708..0c17b0de9 100644 --- a/runtime/crab/src/weights/extrinsic_weights.rs +++ b/runtime/crab/src/weights/extrinsic_weights.rs @@ -16,35 +16,30 @@ // limitations under the License. pub mod constants { - use frame_support::{ - parameter_types, - weights::{constants, Weight}, - }; - - parameter_types! { + frame_support::parameter_types! { /// Executing a NO-OP `System::remarks` Extrinsic. - pub const ExtrinsicBaseWeight: Weight = Weight::from_ref_time(constants::WEIGHT_REF_TIME_PER_NANOS.saturating_mul(125_000)); + pub const ExtrinsicBaseWeight: frame_support::weights::Weight = + frame_support::weights::Weight::from_ref_time(frame_support::weights::constants::WEIGHT_REF_TIME_PER_NANOS.saturating_mul(125_000)); } #[cfg(test)] mod test_weights { - use frame_support::weights::constants; - /// Checks that the weight exists and is sane. // NOTE: If this test fails but you are sure that the generated values are fine, // you can delete it. #[test] fn sane() { - let w = super::constants::ExtrinsicBaseWeight::get(); + let w = frame_support::weights::constants::ExtrinsicBaseWeight::get(); // At least 10 µs. assert!( - w.ref_time() >= 10u64 * constants::WEIGHT_REF_TIME_PER_MICROS, + w.ref_time() + >= 10u64 * frame_support::weights::constants::WEIGHT_REF_TIME_PER_MICROS, "Weight should be at least 10 µs." ); // At most 1 ms. assert!( - w.ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS, + w.ref_time() <= frame_support::weights::constants::WEIGHT_REF_TIME_PER_MILLIS, "Weight should be at most 1 ms." ); } diff --git a/runtime/darwinia/src/lib.rs b/runtime/darwinia/src/lib.rs index 8e00e144c..edd48fe39 100644 --- a/runtime/darwinia/src/lib.rs +++ b/runtime/darwinia/src/lib.rs @@ -36,34 +36,14 @@ pub use darwinia_common_runtime::*; pub use dc_primitives::*; pub use sp_consensus_aura::sr25519::AuthorityId as AuraId; -// cumulus -use cumulus_pallet_parachain_system::RelayNumberStrictlyIncreases; -// polkadot -use xcm_executor::XcmExecutor; // substrate -use frame_support::{ - dispatch::DispatchClass, - traits::{AsEnsureOriginWithArg, Imbalance, IsInVec, OnUnbalanced, WithdrawReasons}, - weights::{ConstantMultiplier, Weight}, -}; -use frame_system::{EnsureRoot, EnsureSignedBy}; -use sp_core::{crypto::KeyTypeId, OpaqueMetadata, H160, H256, U256}; -use sp_runtime::{ - generic, - traits::Block as BlockT, - transaction_validity::{TransactionSource, TransactionValidity}, - ApplyExtrinsicResult, Perbill, Permill, -}; use sp_std::prelude::*; -#[cfg(feature = "std")] -use sp_version::NativeVersion; -use sp_version::RuntimeVersion; /// Block type as expected by this runtime. -pub type Block = generic::Block; +pub type Block = sp_runtime::generic::Block; /// A Block signed with a Justification -pub type SignedBlock = generic::SignedBlock; +pub type SignedBlock = sp_runtime::generic::SignedBlock; /// The SignedExtension to the basic transaction logic. pub type SignedExtra = ( @@ -84,7 +64,7 @@ pub type UncheckedExtrinsic = /// Extrinsic type that has already been checked. pub type CheckedExtrinsic = - fp_self_contained::CheckedExtrinsic; + fp_self_contained::CheckedExtrinsic; /// Executive: handles dispatch to the various modules. pub type Executive = frame_executive::Executive< @@ -100,7 +80,7 @@ pub const DARWINIA_PROPOSAL_REQUIREMENT: Balance = 5000 * UNIT; /// Runtime version. #[sp_version::runtime_version] -pub const VERSION: RuntimeVersion = RuntimeVersion { +pub const VERSION: sp_version::RuntimeVersion = sp_version::RuntimeVersion { spec_name: sp_runtime::create_runtime_str!("Darwinia2"), impl_name: sp_runtime::create_runtime_str!("DarwiniaOfficialRust"), authoring_version: 0, @@ -118,37 +98,48 @@ impl frame_support::traits::OnUnbalanced: OnUnbalanced>, + pallet_treasury::Pallet: + frame_support::traits::OnUnbalanced>, { // this seems to be called for substrate-based transactions fn on_unbalanceds( mut fees_then_tips: impl Iterator>, ) { if let Some(fees) = fees_then_tips.next() { + // substrate + use frame_support::traits::Imbalance; + // for fees, 80% are burned, 20% to the treasury let (_, to_treasury) = fees.ration(80, 20); // Balances pallet automatically burns dropped Negative Imbalances by decreasing // total_supply accordingly - as OnUnbalanced<_>>::on_unbalanced(to_treasury); + as frame_support::traits::OnUnbalanced<_>>::on_unbalanced( + to_treasury, + ); } } // this is called from pallet_evm for Ethereum-based transactions // (technically, it calls on_unbalanced, which calls this when non-zero) fn on_nonzero_unbalanced(amount: pallet_balances::NegativeImbalance) { + // substrate + use frame_support::traits::Imbalance; + // Balances pallet automatically burns dropped Negative Imbalances by decreasing // total_supply accordingly let (_, to_treasury) = amount.ration(80, 20); - as OnUnbalanced<_>>::on_unbalanced(to_treasury); + as frame_support::traits::OnUnbalanced<_>>::on_unbalanced( + to_treasury, + ); } } /// The version information used to identify this runtime when compiled natively. #[cfg(feature = "std")] -pub fn native_version() -> NativeVersion { - NativeVersion { runtime_version: VERSION, can_author_with: Default::default() } +pub fn native_version() -> sp_version::NativeVersion { + sp_version::NativeVersion { runtime_version: VERSION, can_author_with: Default::default() } } // Create the runtime by composing the FRAME pallets that were previously configured. @@ -255,7 +246,7 @@ sp_api::impl_runtime_apis! { } impl sp_api::Core for Runtime { - fn version() -> RuntimeVersion { + fn version() -> sp_version::RuntimeVersion { VERSION } @@ -263,27 +254,27 @@ sp_api::impl_runtime_apis! { Executive::execute_block(block) } - fn initialize_block(header: &::Header) { + fn initialize_block(header: &::Header) { Executive::initialize_block(header) } } impl sp_api::Metadata for Runtime { - fn metadata() -> OpaqueMetadata { - OpaqueMetadata::new(Runtime::metadata().into()) + fn metadata() -> sp_core::OpaqueMetadata { + sp_core::OpaqueMetadata::new(Runtime::metadata().into()) } } impl sp_block_builder::BlockBuilder for Runtime { - fn apply_extrinsic(extrinsic: ::Extrinsic) -> ApplyExtrinsicResult { + fn apply_extrinsic(extrinsic: ::Extrinsic) -> sp_runtime::ApplyExtrinsicResult { Executive::apply_extrinsic(extrinsic) } - fn finalize_block() -> ::Header { + fn finalize_block() -> ::Header { Executive::finalize_block() } - fn inherent_extrinsics(data: sp_inherents::InherentData) -> Vec<::Extrinsic> { + fn inherent_extrinsics(data: sp_inherents::InherentData) -> Vec<::Extrinsic> { data.create_extrinsics() } @@ -297,16 +288,16 @@ sp_api::impl_runtime_apis! { impl sp_transaction_pool::runtime_api::TaggedTransactionQueue for Runtime { fn validate_transaction( - source: TransactionSource, - tx: ::Extrinsic, - block_hash: ::Hash, - ) -> TransactionValidity { + source: sp_runtime::transaction_validity::TransactionSource, + tx: ::Extrinsic, + block_hash: ::Hash, + ) -> sp_runtime::transaction_validity::TransactionValidity { Executive::validate_transaction(source, tx, block_hash) } } impl sp_offchain::OffchainWorkerApi for Runtime { - fn offchain_worker(header: &::Header) { + fn offchain_worker(header: &::Header) { Executive::offchain_worker(header) } } @@ -318,7 +309,7 @@ sp_api::impl_runtime_apis! { fn decode_session_keys( encoded: Vec, - ) -> Option, KeyTypeId)>> { + ) -> Option, sp_runtime::KeyTypeId)>> { SessionKeys::decode_into_raw_public_keys(&encoded) } } @@ -331,13 +322,13 @@ sp_api::impl_runtime_apis! { impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi for Runtime { fn query_info( - uxt: ::Extrinsic, + uxt: ::Extrinsic, len: u32, ) -> pallet_transaction_payment_rpc_runtime_api::RuntimeDispatchInfo { TransactionPayment::query_info(uxt, len) } fn query_fee_details( - uxt: ::Extrinsic, + uxt: ::Extrinsic, len: u32, ) -> pallet_transaction_payment::FeeDetails { TransactionPayment::query_fee_details(uxt, len) @@ -362,7 +353,7 @@ sp_api::impl_runtime_apis! { } impl cumulus_primitives_core::CollectCollationInfo for Runtime { - fn collect_collation_info(header: &::Header) -> cumulus_primitives_core::CollationInfo { + fn collect_collation_info(header: &::Header) -> cumulus_primitives_core::CollationInfo { ParachainSystem::collect_collation_info(header) } } @@ -372,13 +363,13 @@ sp_api::impl_runtime_apis! { <::ChainId as frame_support::traits::Get>::get() } - fn account_basic(address: H160) -> pallet_evm::Account { + fn account_basic(address: sp_core::H160) -> pallet_evm::Account { let (account, _) = Evm::account_basic(&address); account } - fn gas_price() -> U256 { + fn gas_price() -> sp_core::U256 { // frontier use pallet_evm::FeeCalculator; @@ -387,33 +378,33 @@ sp_api::impl_runtime_apis! { gas_price } - fn account_code_at(address: H160) -> Vec { + fn account_code_at(address: sp_core::H160) -> Vec { Evm::account_codes(address) } - fn author() -> H160 { + fn author() -> sp_core::H160 { >::find_author() } - fn storage_at(address: H160, index: U256) -> H256 { + fn storage_at(address: sp_core::H160, index: sp_core::U256) -> sp_core::H256 { let mut tmp = [0u8; 32]; index.to_big_endian(&mut tmp); - Evm::account_storages(address, H256::from_slice(&tmp[..])) + Evm::account_storages(address, sp_core::H256::from_slice(&tmp[..])) } fn call( - from: H160, - to: H160, + from: sp_core::H160, + to: sp_core::H160, data: Vec, - value: U256, - gas_limit: U256, - max_fee_per_gas: Option, - max_priority_fee_per_gas: Option, - nonce: Option, + value: sp_core::U256, + gas_limit: sp_core::U256, + max_fee_per_gas: Option, + max_priority_fee_per_gas: Option, + nonce: Option, estimate: bool, - access_list: Option)>>, + access_list: Option)>>, ) -> Result { // frontier use pallet_evm::Runner; @@ -449,15 +440,15 @@ sp_api::impl_runtime_apis! { } fn create( - from: H160, + from: sp_core::H160, data: Vec, - value: U256, - gas_limit: U256, - max_fee_per_gas: Option, - max_priority_fee_per_gas: Option, - nonce: Option, + value: sp_core::U256, + gas_limit: sp_core::U256, + max_fee_per_gas: Option, + max_priority_fee_per_gas: Option, + nonce: Option, estimate: bool, - access_list: Option)>>, + access_list: Option)>>, ) -> Result { // frontier use pallet_evm::Runner; @@ -516,7 +507,7 @@ sp_api::impl_runtime_apis! { } fn extrinsic_filter( - xts: Vec<::Extrinsic>, + xts: Vec<::Extrinsic>, ) -> Vec { xts.into_iter().filter_map(|xt| match xt.0.function { RuntimeCall::Ethereum( @@ -526,7 +517,7 @@ sp_api::impl_runtime_apis! { }).collect::>() } - fn elasticity() -> Option { + fn elasticity() -> Option { None } @@ -537,7 +528,7 @@ sp_api::impl_runtime_apis! { impl fp_rpc::ConvertTransactionRuntimeApi for Runtime { fn convert_transaction( transaction: pallet_ethereum::Transaction - ) -> ::Extrinsic { + ) -> ::Extrinsic { UncheckedExtrinsic::new_unsigned( pallet_ethereum::Call::::transact { transaction }.into(), ) @@ -603,7 +594,7 @@ sp_api::impl_runtime_apis! { #[cfg(feature = "try-runtime")] impl frame_try_runtime::TryRuntime for Runtime { - fn on_runtime_upgrade(checks: bool) -> (Weight, Weight) { + fn on_runtime_upgrade(checks: bool) -> (Weight, frame_support::weights::Weight) { // substrate use frame_support::log; @@ -657,15 +648,13 @@ cumulus_pallet_parachain_system::register_validate_block! { #[cfg(test)] mod tests { // darwinia - use super::{Runtime, WeightPerGas}; - // substrate - use frame_support::dispatch::DispatchClass; + use super::*; #[test] fn configured_base_extrinsic_weight_is_evm_compatible() { let min_ethereum_transaction_weight = WeightPerGas::get() * 21_000; let base_extrinsic = ::BlockWeights::get() - .get(DispatchClass::Normal) + .get(frame_support::dispatch::DispatchClass::Normal) .base_extrinsic; assert!(base_extrinsic.ref_time() <= min_ethereum_transaction_weight.ref_time()); diff --git a/runtime/darwinia/src/pallets/assets.rs b/runtime/darwinia/src/pallets/assets.rs index 903856ed4..ebd52e789 100644 --- a/runtime/darwinia/src/pallets/assets.rs +++ b/runtime/darwinia/src/pallets/assets.rs @@ -37,10 +37,12 @@ impl pallet_assets::Config for Runtime { type Balance = Balance; #[cfg(feature = "runtime-benchmarks")] type BenchmarkHelper = (); - type CreateOrigin = AsEnsureOriginWithArg, AccountId>>; + type CreateOrigin = frame_support::traits::AsEnsureOriginWithArg< + frame_system::EnsureSignedBy, AccountId>, + >; type Currency = Balances; type Extra = (); - type ForceOrigin = EnsureRoot; + type ForceOrigin = frame_system::EnsureRoot; type Freezer = (); type MetadataDepositBase = ConstU128<0>; type MetadataDepositPerByte = ConstU128<0>; diff --git a/runtime/darwinia/src/pallets/bridge_dispatch.rs b/runtime/darwinia/src/pallets/bridge_dispatch.rs index 978cf7f13..4db969007 100644 --- a/runtime/darwinia/src/pallets/bridge_dispatch.rs +++ b/runtime/darwinia/src/pallets/bridge_dispatch.rs @@ -34,7 +34,7 @@ impl bp_message_dispatch::CallValidate fo let total_payment = darwinia_message_transact::total_payment::((&**tx).into()); let relayer = - pallet_evm::Pallet::::account_basic(&H160(relayer_account.0)).0; + pallet_evm::Pallet::::account_basic(&sp_core::H160(relayer_account.0)).0; frame_support::ensure!(relayer.balance >= total_payment, "Insufficient balance"); Ok(()) @@ -87,7 +87,7 @@ impl bp_message_dispatch::IntoDispatchOrigin darwinia_message_transact::LcmpEthOrigin::MessageTransact(H160(id.0)).into(), + }) => darwinia_message_transact::LcmpEthOrigin::MessageTransact(sp_core::H160(id.0)).into(), _ => frame_system::RawOrigin::Signed(*id).into(), } } diff --git a/runtime/darwinia/src/pallets/dmp_queue.rs b/runtime/darwinia/src/pallets/dmp_queue.rs index d31b45437..17313c1b7 100644 --- a/runtime/darwinia/src/pallets/dmp_queue.rs +++ b/runtime/darwinia/src/pallets/dmp_queue.rs @@ -20,7 +20,7 @@ use crate::*; impl cumulus_pallet_dmp_queue::Config for Runtime { - type ExecuteOverweightOrigin = EnsureRoot; + type ExecuteOverweightOrigin = frame_system::EnsureRoot; type RuntimeEvent = RuntimeEvent; - type XcmExecutor = XcmExecutor; + type XcmExecutor = xcm_executor::XcmExecutor; } diff --git a/runtime/darwinia/src/pallets/evm.rs b/runtime/darwinia/src/pallets/evm.rs index 8578cc1b7..a5f35c3e2 100644 --- a/runtime/darwinia/src/pallets/evm.rs +++ b/runtime/darwinia/src/pallets/evm.rs @@ -24,16 +24,16 @@ use pallet_evm::Precompile; const WEIGHT_PER_GAS: u64 = 40_000; frame_support::parameter_types! { - pub BlockGasLimit: U256 = U256::from(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT.ref_time() / WEIGHT_PER_GAS); + pub BlockGasLimit: sp_core::U256 = sp_core::U256::from(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT.ref_time() / WEIGHT_PER_GAS); pub PrecompilesValue: DarwiniaPrecompiles = DarwiniaPrecompiles::<_>::new(); - pub WeightPerGas: Weight = Weight::from_ref_time(WEIGHT_PER_GAS); + pub WeightPerGas: frame_support::weights::Weight = frame_support::weights::Weight::from_ref_time(WEIGHT_PER_GAS); } pub struct FindAuthorTruncated(sp_std::marker::PhantomData); -impl> frame_support::traits::FindAuthor +impl> frame_support::traits::FindAuthor for FindAuthorTruncated { - fn find_author<'a, I>(digests: I) -> Option + fn find_author<'a, I>(digests: I) -> Option where I: 'a + IntoIterator, { @@ -45,7 +45,7 @@ impl> frame_support::traits::FindAutho let raw = id.to_raw_vec(); if raw.len() >= 24 { - Some(H160::from_slice(&raw[4..24])) + Some(sp_core::H160::from_slice(&raw[4..24])) } else { None } @@ -56,8 +56,8 @@ impl> frame_support::traits::FindAutho pub struct FixedGasPrice; impl pallet_evm::FeeCalculator for FixedGasPrice { - fn min_gas_price() -> (U256, Weight) { - (U256::from(GWEI), Weight::zero()) + fn min_gas_price() -> (sp_core::U256, frame_support::weights::Weight) { + (sp_core::U256::from(GWEI), frame_support::weights::Weight::zero()) } } @@ -65,9 +65,9 @@ impl pallet_evm::FeeCalculator for FixedGasPrice { pub struct FromH160; impl pallet_evm::AddressMapping for FromH160 where - T: From, + T: From, { - fn into_account_id(address: H160) -> T { + fn into_account_id(address: sp_core::H160) -> T { address.into() } } @@ -75,7 +75,7 @@ where pub struct AssetIdConverter; impl darwinia_precompile_assets::AccountToAssetId for AssetIdConverter { fn account_to_asset_id(account_id: AccountId) -> AssetId { - let addr: H160 = account_id.into(); + let addr: sp_core::H160 = account_id.into(); addr.to_low_u64_be() } } @@ -90,7 +90,7 @@ where Self(Default::default()) } - pub fn used_addresses() -> [H160; 15] { + pub fn used_addresses() -> [sp_core::H160; 15] { [ addr(1), addr(2), @@ -164,7 +164,7 @@ where } } - fn is_precompile(&self, address: H160) -> bool { + fn is_precompile(&self, address: sp_core::H160) -> bool { Self::used_addresses().contains(&address) } } @@ -188,6 +188,6 @@ impl pallet_evm::Config for Runtime { type WithdrawOrigin = pallet_evm::EnsureAddressNever; } -fn addr(a: u64) -> H160 { - H160::from_low_u64_be(a) +fn addr(a: u64) -> sp_core::H160 { + sp_core::H160::from_low_u64_be(a) } diff --git a/runtime/darwinia/src/pallets/parachain_system.rs b/runtime/darwinia/src/pallets/parachain_system.rs index 42af96265..0f776807b 100644 --- a/runtime/darwinia/src/pallets/parachain_system.rs +++ b/runtime/darwinia/src/pallets/parachain_system.rs @@ -20,12 +20,12 @@ use crate::*; frame_support::parameter_types! { - pub const ReservedXcmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT.saturating_div(4); - pub const ReservedDmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT.saturating_div(4); + pub const ReservedXcmpWeight: frame_support::weights::Weight = MAXIMUM_BLOCK_WEIGHT.saturating_div(4); + pub const ReservedDmpWeight: frame_support::weights::Weight = MAXIMUM_BLOCK_WEIGHT.saturating_div(4); } impl cumulus_pallet_parachain_system::Config for Runtime { - type CheckAssociatedRelayNumber = RelayNumberStrictlyIncreases; + type CheckAssociatedRelayNumber = cumulus_pallet_parachain_system::RelayNumberStrictlyIncreases; type DmpMessageHandler = DmpQueue; type OnSystemEvent = (); type OutboundXcmpMessageSource = XcmpQueue; diff --git a/runtime/darwinia/src/pallets/polkadot_xcm.rs b/runtime/darwinia/src/pallets/polkadot_xcm.rs index 907858780..cb15c743a 100644 --- a/runtime/darwinia/src/pallets/polkadot_xcm.rs +++ b/runtime/darwinia/src/pallets/polkadot_xcm.rs @@ -135,7 +135,7 @@ impl xcm_executor::Config for XcmExecutorConfig { type RuntimeCall = RuntimeCall; type SubscriptionService = PolkadotXcm; type Trader = xcm_configs::LocalAssetTrader< - ConstantMultiplier, + frame_support::weights::ConstantMultiplier, AnchoringSelfReserve, AccountId, Balances, diff --git a/runtime/darwinia/src/pallets/preimage.rs b/runtime/darwinia/src/pallets/preimage.rs index fc31bb737..d049ef1c0 100644 --- a/runtime/darwinia/src/pallets/preimage.rs +++ b/runtime/darwinia/src/pallets/preimage.rs @@ -23,7 +23,7 @@ impl pallet_preimage::Config for Runtime { type BaseDeposit = ConstU128<{ 500 * UNIT }>; type ByteDeposit = ConstU128<{ darwinia_deposit(0, 1) }>; type Currency = Balances; - type ManagerOrigin = EnsureRoot; + type ManagerOrigin = frame_system::EnsureRoot; type RuntimeEvent = RuntimeEvent; type WeightInfo = (); } diff --git a/runtime/darwinia/src/pallets/system.rs b/runtime/darwinia/src/pallets/system.rs index 43a826035..e5f331a7f 100644 --- a/runtime/darwinia/src/pallets/system.rs +++ b/runtime/darwinia/src/pallets/system.rs @@ -21,17 +21,18 @@ use crate::*; /// We assume that ~5% of the block weight is consumed by `on_initialize` handlers. This is /// used to limit the maximal weight of a single extrinsic. -const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(5); +const AVERAGE_ON_INITIALIZE_RATIO: sp_runtime::Perbill = sp_runtime::Perbill::from_percent(5); /// We allow `Normal` extrinsics to fill up the block up to 75%, the rest can be used by /// `Operational` extrinsics. -pub const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75); +pub const NORMAL_DISPATCH_RATIO: sp_runtime::Perbill = sp_runtime::Perbill::from_percent(75); /// We allow for 0.5 of a second of compute with a 12 second average block time. -pub const MAXIMUM_BLOCK_WEIGHT: Weight = Weight::from_parts( - frame_support::weights::constants::WEIGHT_REF_TIME_PER_SECOND.saturating_div(2), - cumulus_primitives_core::relay_chain::v2::MAX_POV_SIZE as u64, -); +pub const MAXIMUM_BLOCK_WEIGHT: frame_support::weights::Weight = + frame_support::weights::Weight::from_parts( + frame_support::weights::constants::WEIGHT_REF_TIME_PER_SECOND.saturating_div(2), + cumulus_primitives_core::relay_chain::v2::MAX_POV_SIZE as u64, + ); frame_support::parameter_types! { pub const Version: sp_version::RuntimeVersion = VERSION; @@ -39,13 +40,13 @@ frame_support::parameter_types! { frame_system::limits::BlockLength::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO); pub RuntimeBlockWeights: frame_system::limits::BlockWeights = frame_system::limits::BlockWeights::builder() .base_block(weights::BlockExecutionWeight::get()) - .for_class(DispatchClass::all(), |weights| { + .for_class(frame_support::dispatch::DispatchClass::all(), |weights| { weights.base_extrinsic = weights::ExtrinsicBaseWeight::get(); }) - .for_class(DispatchClass::Normal, |weights| { + .for_class(frame_support::dispatch::DispatchClass::Normal, |weights| { weights.max_total = Some(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT); }) - .for_class(DispatchClass::Operational, |weights| { + .for_class(frame_support::dispatch::DispatchClass::Operational, |weights| { weights.max_total = Some(MAXIMUM_BLOCK_WEIGHT); // Operational transactions have some extra reserved space, so that they // are included even if block reached `MAXIMUM_BLOCK_WEIGHT`. @@ -79,7 +80,7 @@ impl frame_system::Config for Runtime { /// The hashing algorithm used. type Hashing = Hashing; /// The header type. - type Header = generic::Header; + type Header = sp_runtime::generic::Header; /// The index type for storing how many extrinsics an account has signed. type Index = Index; /// The lookup mechanism to get account ID from whatever is passed in dispatchers. diff --git a/runtime/darwinia/src/pallets/transaction_payment.rs b/runtime/darwinia/src/pallets/transaction_payment.rs index 970135a54..6080dfeba 100644 --- a/runtime/darwinia/src/pallets/transaction_payment.rs +++ b/runtime/darwinia/src/pallets/transaction_payment.rs @@ -22,7 +22,7 @@ use crate::*; impl pallet_transaction_payment::Config for Runtime { type FeeMultiplierUpdate = polkadot_runtime_common::SlowAdjustingFeeUpdate; // Relay Chain `TransactionByteFee` / 10 - type LengthToFee = ConstantMultiplier>; + type LengthToFee = frame_support::weights::ConstantMultiplier>; type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter>; type OperationalFeeMultiplier = sp_runtime::traits::ConstU8<5>; diff --git a/runtime/darwinia/src/pallets/vesting.rs b/runtime/darwinia/src/pallets/vesting.rs index ca01513ea..1c0b0b6e6 100644 --- a/runtime/darwinia/src/pallets/vesting.rs +++ b/runtime/darwinia/src/pallets/vesting.rs @@ -20,8 +20,10 @@ use crate::*; frame_support::parameter_types! { - pub UnvestedFundsAllowedWithdrawReasons: WithdrawReasons = - WithdrawReasons::except(WithdrawReasons::TRANSFER | WithdrawReasons::RESERVE); + pub UnvestedFundsAllowedWithdrawReasons: frame_support::traits::WithdrawReasons = + frame_support::traits::WithdrawReasons::except( + frame_support::traits::WithdrawReasons::TRANSFER | frame_support::traits::WithdrawReasons::RESERVE + ); } impl pallet_vesting::Config for Runtime { diff --git a/runtime/darwinia/src/pallets/xcmp_queue.rs b/runtime/darwinia/src/pallets/xcmp_queue.rs index e90975a6c..f3f8d642d 100644 --- a/runtime/darwinia/src/pallets/xcmp_queue.rs +++ b/runtime/darwinia/src/pallets/xcmp_queue.rs @@ -21,11 +21,11 @@ use crate::*; impl cumulus_pallet_xcmp_queue::Config for Runtime { type ChannelInfo = ParachainSystem; - type ControllerOrigin = EnsureRoot; + type ControllerOrigin = frame_system::EnsureRoot; type ControllerOriginConverter = XcmOriginToTransactDispatchOrigin; - type ExecuteOverweightOrigin = EnsureRoot; + type ExecuteOverweightOrigin = frame_system::EnsureRoot; type RuntimeEvent = RuntimeEvent; type VersionWrapper = (); type WeightInfo = weights::cumulus_pallet_xcmp_queue::WeightInfo; - type XcmExecutor = XcmExecutor; + type XcmExecutor = xcm_executor::XcmExecutor; } diff --git a/runtime/darwinia/src/weights/block_weights.rs b/runtime/darwinia/src/weights/block_weights.rs index 66279be1b..8da49f757 100644 --- a/runtime/darwinia/src/weights/block_weights.rs +++ b/runtime/darwinia/src/weights/block_weights.rs @@ -16,35 +16,31 @@ // limitations under the License. pub mod constants { - use frame_support::{ - parameter_types, - weights::{constants, Weight}, - }; - - parameter_types! { + frame_support::parameter_types! { /// Importing a block with 0 Extrinsics. - pub const BlockExecutionWeight: Weight = Weight::from_ref_time(constants::WEIGHT_REF_TIME_PER_NANOS.saturating_mul(5_000_000)); + pub const BlockExecutionWeight: frame_support::weights::Weight = + frame_support::weights::Weight::from_ref_time(frame_support::weights::constants::WEIGHT_REF_TIME_PER_NANOS.saturating_mul(5_000_000)); } #[cfg(test)] mod test_weights { - use frame_support::weights::constants; - /// Checks that the weight exists and is sane. // NOTE: If this test fails but you are sure that the generated values are fine, // you can delete it. #[test] fn sane() { - let w = super::constants::BlockExecutionWeight::get(); + let w = frame_support::weights::constants::BlockExecutionWeight::get(); // At least 100 µs. assert!( - w.ref_time() >= 100u64 * constants::WEIGHT_REF_TIME_PER_MICROS, + w.ref_time() + >= 100u64 * frame_support::weights::constants::WEIGHT_REF_TIME_PER_MICROS, "Weight should be at least 100 µs." ); // At most 50 ms. assert!( - w.ref_time() <= 50u64 * constants::WEIGHT_REF_TIME_PER_MILLIS, + w.ref_time() + <= 50u64 * frame_support::weights::constants::WEIGHT_REF_TIME_PER_MILLIS, "Weight should be at most 50 ms." ); } diff --git a/runtime/darwinia/src/weights/extrinsic_weights.rs b/runtime/darwinia/src/weights/extrinsic_weights.rs index 488686708..0c17b0de9 100644 --- a/runtime/darwinia/src/weights/extrinsic_weights.rs +++ b/runtime/darwinia/src/weights/extrinsic_weights.rs @@ -16,35 +16,30 @@ // limitations under the License. pub mod constants { - use frame_support::{ - parameter_types, - weights::{constants, Weight}, - }; - - parameter_types! { + frame_support::parameter_types! { /// Executing a NO-OP `System::remarks` Extrinsic. - pub const ExtrinsicBaseWeight: Weight = Weight::from_ref_time(constants::WEIGHT_REF_TIME_PER_NANOS.saturating_mul(125_000)); + pub const ExtrinsicBaseWeight: frame_support::weights::Weight = + frame_support::weights::Weight::from_ref_time(frame_support::weights::constants::WEIGHT_REF_TIME_PER_NANOS.saturating_mul(125_000)); } #[cfg(test)] mod test_weights { - use frame_support::weights::constants; - /// Checks that the weight exists and is sane. // NOTE: If this test fails but you are sure that the generated values are fine, // you can delete it. #[test] fn sane() { - let w = super::constants::ExtrinsicBaseWeight::get(); + let w = frame_support::weights::constants::ExtrinsicBaseWeight::get(); // At least 10 µs. assert!( - w.ref_time() >= 10u64 * constants::WEIGHT_REF_TIME_PER_MICROS, + w.ref_time() + >= 10u64 * frame_support::weights::constants::WEIGHT_REF_TIME_PER_MICROS, "Weight should be at least 10 µs." ); // At most 1 ms. assert!( - w.ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS, + w.ref_time() <= frame_support::weights::constants::WEIGHT_REF_TIME_PER_MILLIS, "Weight should be at most 1 ms." ); } diff --git a/runtime/pangolin/src/lib.rs b/runtime/pangolin/src/lib.rs index b74f68d6b..a425177f3 100644 --- a/runtime/pangolin/src/lib.rs +++ b/runtime/pangolin/src/lib.rs @@ -33,34 +33,14 @@ pub use darwinia_common_runtime::*; pub use dc_primitives::*; pub use sp_consensus_aura::sr25519::AuthorityId as AuraId; -// cumulus -use cumulus_pallet_parachain_system::RelayNumberStrictlyIncreases; -// polkadot -use xcm_executor::XcmExecutor; // substrate -use frame_support::{ - dispatch::DispatchClass, - traits::{AsEnsureOriginWithArg, Imbalance, IsInVec, OnUnbalanced, WithdrawReasons}, - weights::{ConstantMultiplier, Weight}, -}; -use frame_system::{EnsureRoot, EnsureSignedBy}; -use sp_core::{crypto::KeyTypeId, OpaqueMetadata, H160, H256, U256}; -use sp_runtime::{ - generic, - traits::Block as BlockT, - transaction_validity::{TransactionSource, TransactionValidity}, - ApplyExtrinsicResult, Perbill, Permill, -}; use sp_std::prelude::*; -#[cfg(feature = "std")] -use sp_version::NativeVersion; -use sp_version::RuntimeVersion; /// Block type as expected by this runtime. -pub type Block = generic::Block; +pub type Block = sp_runtime::generic::Block; /// A Block signed with a Justification -pub type SignedBlock = generic::SignedBlock; +pub type SignedBlock = sp_runtime::generic::SignedBlock; /// The SignedExtension to the basic transaction logic. pub type SignedExtra = ( @@ -80,7 +60,7 @@ pub type UncheckedExtrinsic = /// Extrinsic type that has already been checked. pub type CheckedExtrinsic = - fp_self_contained::CheckedExtrinsic; + fp_self_contained::CheckedExtrinsic; /// Executive: handles dispatch to the various modules. pub type Executive = frame_executive::Executive< @@ -97,7 +77,7 @@ pub const DARWINIA_PROPOSAL_REQUIREMENT: Balance = 5000 * UNIT; /// Runtime version. #[sp_version::runtime_version] -pub const VERSION: RuntimeVersion = RuntimeVersion { +pub const VERSION: sp_version::RuntimeVersion = sp_version::RuntimeVersion { spec_name: sp_runtime::create_runtime_str!("Pangolin2"), impl_name: sp_runtime::create_runtime_str!("DarwiniaOfficialRust"), authoring_version: 0, @@ -115,37 +95,48 @@ impl frame_support::traits::OnUnbalanced: OnUnbalanced>, + pallet_treasury::Pallet: + frame_support::traits::OnUnbalanced>, { // this seems to be called for substrate-based transactions fn on_unbalanceds( mut fees_then_tips: impl Iterator>, ) { if let Some(fees) = fees_then_tips.next() { + // substrate + use frame_support::traits::Imbalance; + // for fees, 80% are burned, 20% to the treasury let (_, to_treasury) = fees.ration(80, 20); // Balances pallet automatically burns dropped Negative Imbalances by decreasing // total_supply accordingly - as OnUnbalanced<_>>::on_unbalanced(to_treasury); + as frame_support::traits::OnUnbalanced<_>>::on_unbalanced( + to_treasury, + ); } } // this is called from pallet_evm for Ethereum-based transactions // (technically, it calls on_unbalanced, which calls this when non-zero) fn on_nonzero_unbalanced(amount: pallet_balances::NegativeImbalance) { + // substrate + use frame_support::traits::Imbalance; + // Balances pallet automatically burns dropped Negative Imbalances by decreasing // total_supply accordingly let (_, to_treasury) = amount.ration(80, 20); - as OnUnbalanced<_>>::on_unbalanced(to_treasury); + as frame_support::traits::OnUnbalanced<_>>::on_unbalanced( + to_treasury, + ); } } /// The version information used to identify this runtime when compiled natively. #[cfg(feature = "std")] -pub fn native_version() -> NativeVersion { - NativeVersion { runtime_version: VERSION, can_author_with: Default::default() } +pub fn native_version() -> sp_version::NativeVersion { + sp_version::NativeVersion { runtime_version: VERSION, can_author_with: Default::default() } } // Create the runtime by composing the FRAME pallets that were previously configured. @@ -235,7 +226,7 @@ sp_api::impl_runtime_apis! { } impl sp_api::Core for Runtime { - fn version() -> RuntimeVersion { + fn version() -> sp_version::RuntimeVersion { VERSION } @@ -243,27 +234,27 @@ sp_api::impl_runtime_apis! { Executive::execute_block(block) } - fn initialize_block(header: &::Header) { + fn initialize_block(header: &::Header) { Executive::initialize_block(header) } } impl sp_api::Metadata for Runtime { - fn metadata() -> OpaqueMetadata { - OpaqueMetadata::new(Runtime::metadata().into()) + fn metadata() -> sp_core::OpaqueMetadata { + sp_core::OpaqueMetadata::new(Runtime::metadata().into()) } } impl sp_block_builder::BlockBuilder for Runtime { - fn apply_extrinsic(extrinsic: ::Extrinsic) -> ApplyExtrinsicResult { + fn apply_extrinsic(extrinsic: ::Extrinsic) -> sp_runtime::ApplyExtrinsicResult { Executive::apply_extrinsic(extrinsic) } - fn finalize_block() -> ::Header { + fn finalize_block() -> ::Header { Executive::finalize_block() } - fn inherent_extrinsics(data: sp_inherents::InherentData) -> Vec<::Extrinsic> { + fn inherent_extrinsics(data: sp_inherents::InherentData) -> Vec<::Extrinsic> { data.create_extrinsics() } @@ -277,16 +268,16 @@ sp_api::impl_runtime_apis! { impl sp_transaction_pool::runtime_api::TaggedTransactionQueue for Runtime { fn validate_transaction( - source: TransactionSource, - tx: ::Extrinsic, - block_hash: ::Hash, - ) -> TransactionValidity { + source: sp_runtime::transaction_validity::TransactionSource, + tx: ::Extrinsic, + block_hash: ::Hash, + ) -> sp_runtime::transaction_validity::TransactionValidity { Executive::validate_transaction(source, tx, block_hash) } } impl sp_offchain::OffchainWorkerApi for Runtime { - fn offchain_worker(header: &::Header) { + fn offchain_worker(header: &::Header) { Executive::offchain_worker(header) } } @@ -298,7 +289,7 @@ sp_api::impl_runtime_apis! { fn decode_session_keys( encoded: Vec, - ) -> Option, KeyTypeId)>> { + ) -> Option, sp_runtime::KeyTypeId)>> { SessionKeys::decode_into_raw_public_keys(&encoded) } } @@ -311,13 +302,13 @@ sp_api::impl_runtime_apis! { impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi for Runtime { fn query_info( - uxt: ::Extrinsic, + uxt: ::Extrinsic, len: u32, ) -> pallet_transaction_payment_rpc_runtime_api::RuntimeDispatchInfo { TransactionPayment::query_info(uxt, len) } fn query_fee_details( - uxt: ::Extrinsic, + uxt: ::Extrinsic, len: u32, ) -> pallet_transaction_payment::FeeDetails { TransactionPayment::query_fee_details(uxt, len) @@ -342,7 +333,7 @@ sp_api::impl_runtime_apis! { } impl cumulus_primitives_core::CollectCollationInfo for Runtime { - fn collect_collation_info(header: &::Header) -> cumulus_primitives_core::CollationInfo { + fn collect_collation_info(header: &::Header) -> cumulus_primitives_core::CollationInfo { ParachainSystem::collect_collation_info(header) } } @@ -352,13 +343,13 @@ sp_api::impl_runtime_apis! { <::ChainId as frame_support::traits::Get>::get() } - fn account_basic(address: H160) -> pallet_evm::Account { + fn account_basic(address: sp_core::H160) -> pallet_evm::Account { let (account, _) = Evm::account_basic(&address); account } - fn gas_price() -> U256 { + fn gas_price() -> sp_core::U256 { // frontier use pallet_evm::FeeCalculator; @@ -367,33 +358,33 @@ sp_api::impl_runtime_apis! { gas_price } - fn account_code_at(address: H160) -> Vec { + fn account_code_at(address: sp_core::H160) -> Vec { Evm::account_codes(address) } - fn author() -> H160 { + fn author() -> sp_core::H160 { >::find_author() } - fn storage_at(address: H160, index: U256) -> H256 { + fn storage_at(address: sp_core::H160, index: sp_core::U256) -> sp_core::H256 { let mut tmp = [0u8; 32]; index.to_big_endian(&mut tmp); - Evm::account_storages(address, H256::from_slice(&tmp[..])) + Evm::account_storages(address, sp_core::H256::from_slice(&tmp[..])) } fn call( - from: H160, - to: H160, + from: sp_core::H160, + to: sp_core::H160, data: Vec, - value: U256, - gas_limit: U256, - max_fee_per_gas: Option, - max_priority_fee_per_gas: Option, - nonce: Option, + value: sp_core::U256, + gas_limit: sp_core::U256, + max_fee_per_gas: Option, + max_priority_fee_per_gas: Option, + nonce: Option, estimate: bool, - access_list: Option)>>, + access_list: Option)>>, ) -> Result { // frontier use pallet_evm::Runner; @@ -429,15 +420,15 @@ sp_api::impl_runtime_apis! { } fn create( - from: H160, + from: sp_core::H160, data: Vec, - value: U256, - gas_limit: U256, - max_fee_per_gas: Option, - max_priority_fee_per_gas: Option, - nonce: Option, + value: sp_core::U256, + gas_limit: sp_core::U256, + max_fee_per_gas: Option, + max_priority_fee_per_gas: Option, + nonce: Option, estimate: bool, - access_list: Option)>>, + access_list: Option)>>, ) -> Result { // frontier use pallet_evm::Runner; @@ -496,7 +487,7 @@ sp_api::impl_runtime_apis! { } fn extrinsic_filter( - xts: Vec<::Extrinsic>, + xts: Vec<::Extrinsic>, ) -> Vec { xts.into_iter().filter_map(|xt| match xt.0.function { RuntimeCall::Ethereum( @@ -506,7 +497,7 @@ sp_api::impl_runtime_apis! { }).collect::>() } - fn elasticity() -> Option { + fn elasticity() -> Option { None } @@ -517,7 +508,7 @@ sp_api::impl_runtime_apis! { impl fp_rpc::ConvertTransactionRuntimeApi for Runtime { fn convert_transaction( transaction: pallet_ethereum::Transaction - ) -> ::Extrinsic { + ) -> ::Extrinsic { UncheckedExtrinsic::new_unsigned( pallet_ethereum::Call::::transact { transaction }.into(), ) @@ -583,7 +574,7 @@ sp_api::impl_runtime_apis! { #[cfg(feature = "try-runtime")] impl frame_try_runtime::TryRuntime for Runtime { - fn on_runtime_upgrade(checks: bool) -> (Weight, Weight) { + fn on_runtime_upgrade(checks: bool) -> (Weight, frame_support::weights::Weight) { // substrate use frame_support::log; @@ -637,15 +628,13 @@ cumulus_pallet_parachain_system::register_validate_block! { #[cfg(test)] mod tests { // darwinia - use super::{Runtime, WeightPerGas}; - // substrate - use frame_support::dispatch::DispatchClass; + use super::*; #[test] fn configured_base_extrinsic_weight_is_evm_compatible() { let min_ethereum_transaction_weight = WeightPerGas::get() * 21_000; let base_extrinsic = ::BlockWeights::get() - .get(DispatchClass::Normal) + .get(frame_support::dispatch::DispatchClass::Normal) .base_extrinsic; assert!(base_extrinsic.ref_time() <= min_ethereum_transaction_weight.ref_time()); diff --git a/runtime/pangolin/src/pallets/assets.rs b/runtime/pangolin/src/pallets/assets.rs index 8ff110b0e..1dc4dd543 100644 --- a/runtime/pangolin/src/pallets/assets.rs +++ b/runtime/pangolin/src/pallets/assets.rs @@ -37,10 +37,12 @@ impl pallet_assets::Config for Runtime { type Balance = Balance; #[cfg(feature = "runtime-benchmarks")] type BenchmarkHelper = (); - type CreateOrigin = AsEnsureOriginWithArg, AccountId>>; + type CreateOrigin = frame_support::traits::AsEnsureOriginWithArg< + frame_system::EnsureSignedBy, AccountId>, + >; type Currency = Balances; type Extra = (); - type ForceOrigin = EnsureRoot; + type ForceOrigin = frame_system::EnsureRoot; type Freezer = (); type MetadataDepositBase = ConstU128<0>; type MetadataDepositPerByte = ConstU128<0>; diff --git a/runtime/pangolin/src/pallets/dmp_queue.rs b/runtime/pangolin/src/pallets/dmp_queue.rs index d31b45437..17313c1b7 100644 --- a/runtime/pangolin/src/pallets/dmp_queue.rs +++ b/runtime/pangolin/src/pallets/dmp_queue.rs @@ -20,7 +20,7 @@ use crate::*; impl cumulus_pallet_dmp_queue::Config for Runtime { - type ExecuteOverweightOrigin = EnsureRoot; + type ExecuteOverweightOrigin = frame_system::EnsureRoot; type RuntimeEvent = RuntimeEvent; - type XcmExecutor = XcmExecutor; + type XcmExecutor = xcm_executor::XcmExecutor; } diff --git a/runtime/pangolin/src/pallets/evm.rs b/runtime/pangolin/src/pallets/evm.rs index 0174f96c2..821ea50c1 100644 --- a/runtime/pangolin/src/pallets/evm.rs +++ b/runtime/pangolin/src/pallets/evm.rs @@ -24,16 +24,16 @@ use pallet_evm::Precompile; const WEIGHT_PER_GAS: u64 = 40_000; frame_support::parameter_types! { - pub BlockGasLimit: U256 = U256::from(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT.ref_time() / WEIGHT_PER_GAS); + pub BlockGasLimit: sp_core::U256 = sp_core::U256::from(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT.ref_time() / WEIGHT_PER_GAS); pub PrecompilesValue: PangolinPrecompiles = PangolinPrecompiles::<_>::new(); - pub WeightPerGas: Weight = Weight::from_ref_time(WEIGHT_PER_GAS); + pub WeightPerGas: frame_support::weights::Weight = frame_support::weights::Weight::from_ref_time(WEIGHT_PER_GAS); } pub struct FindAuthorTruncated(sp_std::marker::PhantomData); -impl> frame_support::traits::FindAuthor +impl> frame_support::traits::FindAuthor for FindAuthorTruncated { - fn find_author<'a, I>(digests: I) -> Option + fn find_author<'a, I>(digests: I) -> Option where I: 'a + IntoIterator, { @@ -45,7 +45,7 @@ impl> frame_support::traits::FindAutho let raw = id.to_raw_vec(); if raw.len() >= 24 { - Some(H160::from_slice(&raw[4..24])) + Some(sp_core::H160::from_slice(&raw[4..24])) } else { None } @@ -56,8 +56,8 @@ impl> frame_support::traits::FindAutho pub struct FixedGasPrice; impl pallet_evm::FeeCalculator for FixedGasPrice { - fn min_gas_price() -> (U256, Weight) { - (U256::from(GWEI), Weight::zero()) + fn min_gas_price() -> (sp_core::U256, frame_support::weights::Weight) { + (sp_core::U256::from(GWEI), frame_support::weights::Weight::zero()) } } @@ -65,9 +65,9 @@ impl pallet_evm::FeeCalculator for FixedGasPrice { pub struct FromH160; impl pallet_evm::AddressMapping for FromH160 where - T: From, + T: From, { - fn into_account_id(address: H160) -> T { + fn into_account_id(address: sp_core::H160) -> T { address.into() } } @@ -75,7 +75,7 @@ where pub struct AssetIdConverter; impl darwinia_precompile_assets::AccountToAssetId for AssetIdConverter { fn account_to_asset_id(account_id: AccountId) -> AssetId { - let addr: H160 = account_id.into(); + let addr: sp_core::H160 = account_id.into(); addr.to_low_u64_be() } } @@ -90,7 +90,7 @@ where Self(Default::default()) } - pub fn used_addresses() -> [H160; 15] { + pub fn used_addresses() -> [sp_core::H160; 15] { [ addr(1), addr(2), @@ -164,7 +164,7 @@ where } } - fn is_precompile(&self, address: H160) -> bool { + fn is_precompile(&self, address: sp_core::H160) -> bool { Self::used_addresses().contains(&address) } } @@ -188,6 +188,6 @@ impl pallet_evm::Config for Runtime { type WithdrawOrigin = pallet_evm::EnsureAddressNever; } -fn addr(a: u64) -> H160 { - H160::from_low_u64_be(a) +fn addr(a: u64) -> sp_core::H160 { + sp_core::H160::from_low_u64_be(a) } diff --git a/runtime/pangolin/src/pallets/parachain_system.rs b/runtime/pangolin/src/pallets/parachain_system.rs index 42af96265..0f776807b 100644 --- a/runtime/pangolin/src/pallets/parachain_system.rs +++ b/runtime/pangolin/src/pallets/parachain_system.rs @@ -20,12 +20,12 @@ use crate::*; frame_support::parameter_types! { - pub const ReservedXcmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT.saturating_div(4); - pub const ReservedDmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT.saturating_div(4); + pub const ReservedXcmpWeight: frame_support::weights::Weight = MAXIMUM_BLOCK_WEIGHT.saturating_div(4); + pub const ReservedDmpWeight: frame_support::weights::Weight = MAXIMUM_BLOCK_WEIGHT.saturating_div(4); } impl cumulus_pallet_parachain_system::Config for Runtime { - type CheckAssociatedRelayNumber = RelayNumberStrictlyIncreases; + type CheckAssociatedRelayNumber = cumulus_pallet_parachain_system::RelayNumberStrictlyIncreases; type DmpMessageHandler = DmpQueue; type OnSystemEvent = (); type OutboundXcmpMessageSource = XcmpQueue; diff --git a/runtime/pangolin/src/pallets/polkadot_xcm.rs b/runtime/pangolin/src/pallets/polkadot_xcm.rs index 7a0c8f6d4..2b64726c0 100644 --- a/runtime/pangolin/src/pallets/polkadot_xcm.rs +++ b/runtime/pangolin/src/pallets/polkadot_xcm.rs @@ -135,7 +135,7 @@ impl xcm_executor::Config for XcmExecutorConfig { type RuntimeCall = RuntimeCall; type SubscriptionService = PolkadotXcm; type Trader = xcm_configs::LocalAssetTrader< - ConstantMultiplier, + frame_support::weights::ConstantMultiplier, AnchoringSelfReserve, AccountId, Balances, diff --git a/runtime/pangolin/src/pallets/preimage.rs b/runtime/pangolin/src/pallets/preimage.rs index fc31bb737..d049ef1c0 100644 --- a/runtime/pangolin/src/pallets/preimage.rs +++ b/runtime/pangolin/src/pallets/preimage.rs @@ -23,7 +23,7 @@ impl pallet_preimage::Config for Runtime { type BaseDeposit = ConstU128<{ 500 * UNIT }>; type ByteDeposit = ConstU128<{ darwinia_deposit(0, 1) }>; type Currency = Balances; - type ManagerOrigin = EnsureRoot; + type ManagerOrigin = frame_system::EnsureRoot; type RuntimeEvent = RuntimeEvent; type WeightInfo = (); } diff --git a/runtime/pangolin/src/pallets/system.rs b/runtime/pangolin/src/pallets/system.rs index 43a826035..e5f331a7f 100644 --- a/runtime/pangolin/src/pallets/system.rs +++ b/runtime/pangolin/src/pallets/system.rs @@ -21,17 +21,18 @@ use crate::*; /// We assume that ~5% of the block weight is consumed by `on_initialize` handlers. This is /// used to limit the maximal weight of a single extrinsic. -const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(5); +const AVERAGE_ON_INITIALIZE_RATIO: sp_runtime::Perbill = sp_runtime::Perbill::from_percent(5); /// We allow `Normal` extrinsics to fill up the block up to 75%, the rest can be used by /// `Operational` extrinsics. -pub const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75); +pub const NORMAL_DISPATCH_RATIO: sp_runtime::Perbill = sp_runtime::Perbill::from_percent(75); /// We allow for 0.5 of a second of compute with a 12 second average block time. -pub const MAXIMUM_BLOCK_WEIGHT: Weight = Weight::from_parts( - frame_support::weights::constants::WEIGHT_REF_TIME_PER_SECOND.saturating_div(2), - cumulus_primitives_core::relay_chain::v2::MAX_POV_SIZE as u64, -); +pub const MAXIMUM_BLOCK_WEIGHT: frame_support::weights::Weight = + frame_support::weights::Weight::from_parts( + frame_support::weights::constants::WEIGHT_REF_TIME_PER_SECOND.saturating_div(2), + cumulus_primitives_core::relay_chain::v2::MAX_POV_SIZE as u64, + ); frame_support::parameter_types! { pub const Version: sp_version::RuntimeVersion = VERSION; @@ -39,13 +40,13 @@ frame_support::parameter_types! { frame_system::limits::BlockLength::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO); pub RuntimeBlockWeights: frame_system::limits::BlockWeights = frame_system::limits::BlockWeights::builder() .base_block(weights::BlockExecutionWeight::get()) - .for_class(DispatchClass::all(), |weights| { + .for_class(frame_support::dispatch::DispatchClass::all(), |weights| { weights.base_extrinsic = weights::ExtrinsicBaseWeight::get(); }) - .for_class(DispatchClass::Normal, |weights| { + .for_class(frame_support::dispatch::DispatchClass::Normal, |weights| { weights.max_total = Some(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT); }) - .for_class(DispatchClass::Operational, |weights| { + .for_class(frame_support::dispatch::DispatchClass::Operational, |weights| { weights.max_total = Some(MAXIMUM_BLOCK_WEIGHT); // Operational transactions have some extra reserved space, so that they // are included even if block reached `MAXIMUM_BLOCK_WEIGHT`. @@ -79,7 +80,7 @@ impl frame_system::Config for Runtime { /// The hashing algorithm used. type Hashing = Hashing; /// The header type. - type Header = generic::Header; + type Header = sp_runtime::generic::Header; /// The index type for storing how many extrinsics an account has signed. type Index = Index; /// The lookup mechanism to get account ID from whatever is passed in dispatchers. diff --git a/runtime/pangolin/src/pallets/transaction_payment.rs b/runtime/pangolin/src/pallets/transaction_payment.rs index 970135a54..6080dfeba 100644 --- a/runtime/pangolin/src/pallets/transaction_payment.rs +++ b/runtime/pangolin/src/pallets/transaction_payment.rs @@ -22,7 +22,7 @@ use crate::*; impl pallet_transaction_payment::Config for Runtime { type FeeMultiplierUpdate = polkadot_runtime_common::SlowAdjustingFeeUpdate; // Relay Chain `TransactionByteFee` / 10 - type LengthToFee = ConstantMultiplier>; + type LengthToFee = frame_support::weights::ConstantMultiplier>; type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter>; type OperationalFeeMultiplier = sp_runtime::traits::ConstU8<5>; diff --git a/runtime/pangolin/src/pallets/vesting.rs b/runtime/pangolin/src/pallets/vesting.rs index ca01513ea..1c0b0b6e6 100644 --- a/runtime/pangolin/src/pallets/vesting.rs +++ b/runtime/pangolin/src/pallets/vesting.rs @@ -20,8 +20,10 @@ use crate::*; frame_support::parameter_types! { - pub UnvestedFundsAllowedWithdrawReasons: WithdrawReasons = - WithdrawReasons::except(WithdrawReasons::TRANSFER | WithdrawReasons::RESERVE); + pub UnvestedFundsAllowedWithdrawReasons: frame_support::traits::WithdrawReasons = + frame_support::traits::WithdrawReasons::except( + frame_support::traits::WithdrawReasons::TRANSFER | frame_support::traits::WithdrawReasons::RESERVE + ); } impl pallet_vesting::Config for Runtime { diff --git a/runtime/pangolin/src/pallets/xcmp_queue.rs b/runtime/pangolin/src/pallets/xcmp_queue.rs index e90975a6c..f3f8d642d 100644 --- a/runtime/pangolin/src/pallets/xcmp_queue.rs +++ b/runtime/pangolin/src/pallets/xcmp_queue.rs @@ -21,11 +21,11 @@ use crate::*; impl cumulus_pallet_xcmp_queue::Config for Runtime { type ChannelInfo = ParachainSystem; - type ControllerOrigin = EnsureRoot; + type ControllerOrigin = frame_system::EnsureRoot; type ControllerOriginConverter = XcmOriginToTransactDispatchOrigin; - type ExecuteOverweightOrigin = EnsureRoot; + type ExecuteOverweightOrigin = frame_system::EnsureRoot; type RuntimeEvent = RuntimeEvent; type VersionWrapper = (); type WeightInfo = weights::cumulus_pallet_xcmp_queue::WeightInfo; - type XcmExecutor = XcmExecutor; + type XcmExecutor = xcm_executor::XcmExecutor; } diff --git a/runtime/pangolin/src/weights/block_weights.rs b/runtime/pangolin/src/weights/block_weights.rs index 66279be1b..8da49f757 100644 --- a/runtime/pangolin/src/weights/block_weights.rs +++ b/runtime/pangolin/src/weights/block_weights.rs @@ -16,35 +16,31 @@ // limitations under the License. pub mod constants { - use frame_support::{ - parameter_types, - weights::{constants, Weight}, - }; - - parameter_types! { + frame_support::parameter_types! { /// Importing a block with 0 Extrinsics. - pub const BlockExecutionWeight: Weight = Weight::from_ref_time(constants::WEIGHT_REF_TIME_PER_NANOS.saturating_mul(5_000_000)); + pub const BlockExecutionWeight: frame_support::weights::Weight = + frame_support::weights::Weight::from_ref_time(frame_support::weights::constants::WEIGHT_REF_TIME_PER_NANOS.saturating_mul(5_000_000)); } #[cfg(test)] mod test_weights { - use frame_support::weights::constants; - /// Checks that the weight exists and is sane. // NOTE: If this test fails but you are sure that the generated values are fine, // you can delete it. #[test] fn sane() { - let w = super::constants::BlockExecutionWeight::get(); + let w = frame_support::weights::constants::BlockExecutionWeight::get(); // At least 100 µs. assert!( - w.ref_time() >= 100u64 * constants::WEIGHT_REF_TIME_PER_MICROS, + w.ref_time() + >= 100u64 * frame_support::weights::constants::WEIGHT_REF_TIME_PER_MICROS, "Weight should be at least 100 µs." ); // At most 50 ms. assert!( - w.ref_time() <= 50u64 * constants::WEIGHT_REF_TIME_PER_MILLIS, + w.ref_time() + <= 50u64 * frame_support::weights::constants::WEIGHT_REF_TIME_PER_MILLIS, "Weight should be at most 50 ms." ); } diff --git a/runtime/pangolin/src/weights/extrinsic_weights.rs b/runtime/pangolin/src/weights/extrinsic_weights.rs index 488686708..0c17b0de9 100644 --- a/runtime/pangolin/src/weights/extrinsic_weights.rs +++ b/runtime/pangolin/src/weights/extrinsic_weights.rs @@ -16,35 +16,30 @@ // limitations under the License. pub mod constants { - use frame_support::{ - parameter_types, - weights::{constants, Weight}, - }; - - parameter_types! { + frame_support::parameter_types! { /// Executing a NO-OP `System::remarks` Extrinsic. - pub const ExtrinsicBaseWeight: Weight = Weight::from_ref_time(constants::WEIGHT_REF_TIME_PER_NANOS.saturating_mul(125_000)); + pub const ExtrinsicBaseWeight: frame_support::weights::Weight = + frame_support::weights::Weight::from_ref_time(frame_support::weights::constants::WEIGHT_REF_TIME_PER_NANOS.saturating_mul(125_000)); } #[cfg(test)] mod test_weights { - use frame_support::weights::constants; - /// Checks that the weight exists and is sane. // NOTE: If this test fails but you are sure that the generated values are fine, // you can delete it. #[test] fn sane() { - let w = super::constants::ExtrinsicBaseWeight::get(); + let w = frame_support::weights::constants::ExtrinsicBaseWeight::get(); // At least 10 µs. assert!( - w.ref_time() >= 10u64 * constants::WEIGHT_REF_TIME_PER_MICROS, + w.ref_time() + >= 10u64 * frame_support::weights::constants::WEIGHT_REF_TIME_PER_MICROS, "Weight should be at least 10 µs." ); // At most 1 ms. assert!( - w.ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS, + w.ref_time() <= frame_support::weights::constants::WEIGHT_REF_TIME_PER_MILLIS, "Weight should be at most 1 ms." ); } From 9057d498a8f1c4155431b5ce4ce89b1acbd11edd Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Thu, 9 Feb 2023 13:32:13 +0800 Subject: [PATCH 134/189] Migrate multisig (#272) * Migrate multisig * Unit tests * Doc * Fix * More checks * Doc * Reject duplicative submission --- Cargo.lock | 2 + pallet/account-migration/Cargo.toml | 3 + pallet/account-migration/src/lib.rs | 275 ++++++++++++++++++++---- pallet/account-migration/src/tests.rs | 48 ----- pallet/account-migration/tests/mock.rs | 206 ++++++++++++++++++ pallet/account-migration/tests/tests.rs | 161 ++++++++++++++ runtime/crab/src/pallets/deposit.rs | 4 +- runtime/crab/src/pallets/system.rs | 2 +- runtime/darwinia/src/pallets/deposit.rs | 4 +- runtime/darwinia/src/pallets/system.rs | 2 +- runtime/pangolin/src/pallets/deposit.rs | 4 +- runtime/pangolin/src/pallets/system.rs | 2 +- 12 files changed, 610 insertions(+), 103 deletions(-) delete mode 100644 pallet/account-migration/src/tests.rs create mode 100644 pallet/account-migration/tests/mock.rs create mode 100644 pallet/account-migration/tests/tests.rs diff --git a/Cargo.lock b/Cargo.lock index 84ef1b928..db93345a4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2275,9 +2275,11 @@ dependencies = [ "parity-scale-codec", "scale-info", "sp-core", + "sp-io", "sp-keyring", "sp-runtime", "sp-std", + "sp-version", ] [[package]] diff --git a/pallet/account-migration/Cargo.toml b/pallet/account-migration/Cargo.toml index fef26a182..5538841be 100644 --- a/pallet/account-migration/Cargo.toml +++ b/pallet/account-migration/Cargo.toml @@ -28,11 +28,13 @@ pallet-balances = { default-features = false, git = "https://github.com/parityte pallet-identity = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } pallet-vesting = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-io = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } [dev-dependencies] sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-version = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } [features] default = ["std"] @@ -54,6 +56,7 @@ std = [ "pallet-identity/std", "pallet-vesting/std", "sp-core/std", + "sp-io/std", "sp-runtime/std", "sp-std/std", ] diff --git a/pallet/account-migration/src/lib.rs b/pallet/account-migration/src/lib.rs index b587517e2..25082aadb 100644 --- a/pallet/account-migration/src/lib.rs +++ b/pallet/account-migration/src/lib.rs @@ -43,9 +43,6 @@ #![cfg_attr(not(feature = "std"), no_std)] #![deny(missing_docs)] -#[cfg(test)] -mod tests; - // darwinia use darwinia_deposit::Deposit; use darwinia_staking::Ledger; @@ -62,8 +59,9 @@ use pallet_balances::AccountData; use pallet_identity::Registration; use pallet_vesting::VestingInfo; use sp_core::sr25519::{Public, Signature}; +use sp_io::hashing; use sp_runtime::{ - traits::{IdentityLookup, Verify}, + traits::{IdentityLookup, TrailingZeroInput, Verify}, AccountId32, RuntimeDebug, }; use sp_std::prelude::*; @@ -74,6 +72,17 @@ pub mod pallet { const KTON_ID: u64 = 1026; + /// The migration destination was already taken by someone. + pub const E_ACCOUNT_ALREADY_EXISTED: u8 = 0; + /// The migration source was not exist. + pub const E_ACCOUNT_NOT_FOUND: u8 = 1; + /// Invalid signature. + pub const E_INVALID_SIGNATURE: u8 = 2; + /// Duplicative submission. + pub const E_DUPLICATIVE_SUBMISSION: u8 = 3; + /// The account is not a member of the multisig. + pub const E_NOT_MULTISIG_MEMBER: u8 = 4; + #[pallet::pallet] pub struct Pallet(PhantomData); @@ -110,6 +119,8 @@ pub mod pallet { ExceedMaxVestings, /// Exceed maximum deposit count. ExceedMaxDeposits, + /// The migration destination was already taken by someone. + AccountAlreadyExisted, } /// [`frame_system::Account`] data. @@ -123,7 +134,6 @@ pub mod pallet { /// [`pallet_asset::AssetAccount`] data. /// /// https://github.dev/paritytech/substrate/blob/polkadot-v0.9.30/frame/assets/src/types.rs#L115 - // The size of encoded `pallet_asset::AssetAccount` is 18 bytes. #[pallet::storage] #[pallet::getter(fn kton_account_of)] pub type KtonAccounts = StorageMap<_, Blake2_128Concat, AccountId32, AssetAccount>; @@ -160,6 +170,12 @@ pub mod pallet { #[pallet::getter(fn ledger_of)] pub type Ledgers = StorageMap<_, Blake2_128Concat, AccountId32, Ledger>; + /// Multisig migration caches. + #[pallet::storage] + #[pallet::unbounded] + #[pallet::getter(fn multisig_of)] + pub type Multisigs = StorageMap<_, Identity, AccountId32, Multisig>; + #[pallet::call] impl Pallet { /// Migrate all the account data under the `from` to `to`. @@ -173,8 +189,180 @@ pub mod pallet { ) -> DispatchResult { ensure_none(origin)?; + Self::migrate_inner(from, to)?; + + Ok(()) + } + + /// Similar to `migrate` but for multisig accounts. + /// + /// The `_signature` should be provided by `who`. + #[pallet::call_index(1)] + #[pallet::weight(0)] + pub fn migrate_multisig( + origin: OriginFor, + submitter: AccountId32, + others: Vec, + threshold: u16, + to: AccountId20, + _signature: Signature, + ) -> DispatchResult { + ensure_none(origin)?; + + let (members, multisig) = multisig_of(submitter.clone(), others, threshold); + + if threshold < 2 { + Self::migrate_inner(multisig, to)?; + } else { + let mut members = members.into_iter().map(|m| (m, false)).collect::>(); + + // Set the status to `true`. + // + // Because the `_signature` was already been verified in `pre_dispatch`. + members + .iter_mut() + .find(|(who, _)| who == &submitter) + .expect("[pallet::account-migration] `who` must be existed; qed") + .1 = true; + + >::insert(multisig, Multisig { migrate_to: to, members, threshold }); + } + + Ok(()) + } + + /// To complete the pending multisig migration. + /// + /// The `_signature` should be provided by `submitter`. + #[pallet::call_index(2)] + #[pallet::weight(0)] + pub fn complete_multisig_migration( + origin: OriginFor, + multisig: AccountId32, + submitter: AccountId32, + _signature: Signature, + ) -> DispatchResult { + ensure_none(origin)?; + + let mut multisig_info = >::take(&multisig) + .expect("[pallet::account-migration] already checked in `pre_dispatch`; qed"); + + // Kill the storage, if the `migrate_to` was created during the migration. + // + // Require to redo the `migrate_multisig` operation. + if >::contains_key(multisig_info.migrate_to) { + Err(>::AccountAlreadyExisted)?; + } + + // Set the status to `true`. + // + // Because the `_signature` was already been verified in `pre_dispatch`. + multisig_info + .members + .iter_mut() + .find(|(who, _)| who == &submitter) + .expect("[pallet::account-migration] already checked in `pre_dispatch`; qed") + .1 = true; + + if multisig_info.members.iter().fold(0, |acc, (_, ok)| if *ok { acc + 1 } else { acc }) + >= multisig_info.threshold + { + Self::migrate_inner(multisig, multisig_info.migrate_to)?; + } else { + >::insert(multisig, multisig_info); + } + + Ok(()) + } + } + #[pallet::validate_unsigned] + impl ValidateUnsigned for Pallet { + type Call = Call; + + fn validate_unsigned(_source: TransactionSource, call: &Self::Call) -> TransactionValidity { + match call { + Call::migrate { from, to, signature } => { + Self::pre_check_existing(from, to)?; + + Self::pre_check_signature(from, to, signature) + }, + Call::migrate_multisig { submitter, others, threshold, to, signature } => { + let (_, multisig) = + multisig_of(submitter.to_owned(), others.to_owned(), *threshold); + + Self::pre_check_existing(&multisig, to)?; + + Self::pre_check_signature(submitter, to, signature) + }, + Call::complete_multisig_migration { multisig, submitter, signature } => { + let Some(multisig_info) = >::get(multisig) else { + return InvalidTransaction::Custom(E_ACCOUNT_NOT_FOUND).into(); + }; + let mut is_member = false; + + for (who, ok) in multisig_info.members.iter() { + if who == submitter { + // Reject duplicative submission. + if *ok { + return InvalidTransaction::Custom(E_DUPLICATIVE_SUBMISSION).into(); + } + + is_member = true; + + break; + } + } + + if !is_member { + return InvalidTransaction::Custom(E_NOT_MULTISIG_MEMBER).into(); + } + + Self::pre_check_signature(submitter, &multisig_info.migrate_to, signature) + }, + _ => InvalidTransaction::Call.into(), + } + } + } + impl Pallet + where + T: Config, + { + fn pre_check_existing( + from: &AccountId32, + to: &AccountId20, + ) -> Result<(), TransactionValidityError> { + if !>::contains_key(from) { + Err(InvalidTransaction::Custom(E_ACCOUNT_NOT_FOUND))?; + } + if >::contains_key(to) { + Err(InvalidTransaction::Custom(E_ACCOUNT_ALREADY_EXISTED))?; + } + + Ok(()) + } + + fn pre_check_signature( + from: &AccountId32, + to: &AccountId20, + signature: &Signature, + ) -> TransactionValidity { + let message = sr25519_signable_message(T::Version::get().spec_name.as_ref(), to); + + if verify_sr25519_signature(from, &message, signature) { + ValidTransaction::with_tag_prefix("account-migration") + .and_provides(from) + .priority(100) + .longevity(TransactionLongevity::max_value()) + .propagate(true) + .build() + } else { + InvalidTransaction::Custom(E_INVALID_SIGNATURE).into() + } + } + + fn migrate_inner(from: AccountId32, to: AccountId20) -> DispatchResult { let account = >::take(&from) - .ok_or("[pallet::account-migration] already checked in `pre_dispatch`; qed")?; + .expect("[pallet::account-migration] already checked in `pre_dispatch`; qed"); >::insert(to, account); @@ -266,45 +454,6 @@ pub mod pallet { Ok(()) } - - // TODO: migrate multi-sig - } - #[pallet::validate_unsigned] - impl ValidateUnsigned for Pallet { - type Call = Call; - - fn validate_unsigned(_source: TransactionSource, call: &Self::Call) -> TransactionValidity { - // The migration destination was already taken by someone. - const E_ACCOUNT_ALREADY_EXISTED: u8 = 0; - // The migration source was not exist. - const E_ACCOUNT_NOT_FOUND: u8 = 1; - // Invalid signature. - const E_INVALID_SIGNATURE: u8 = 2; - - let Call::migrate { from, to, signature } = call else { - return InvalidTransaction::Call.into(); - }; - - if !>::contains_key(from) { - return InvalidTransaction::Custom(E_ACCOUNT_NOT_FOUND).into(); - } - if >::contains_key(to) { - return InvalidTransaction::Custom(E_ACCOUNT_ALREADY_EXISTED).into(); - } - - let message = sr25519_signable_message(T::Version::get().spec_name.as_ref(), to); - - if verify_sr25519_signature(from, &message, signature) { - ValidTransaction::with_tag_prefix("account-migration") - .and_provides(from) - .priority(100) - .longevity(TransactionLongevity::max_value()) - .propagate(true) - .build() - } else { - InvalidTransaction::Custom(E_INVALID_SIGNATURE).into() - } - } } } pub use pallet::*; @@ -332,6 +481,14 @@ pub enum ExistenceReason { DepositRefunded, } +#[allow(missing_docs)] +#[derive(Encode, Decode, TypeInfo, RuntimeDebug)] +pub struct Multisig { + pub migrate_to: AccountId20, + pub members: Vec<(AccountId32, bool)>, + pub threshold: u16, +} + /// Build a Darwinia account migration message. pub fn sr25519_signable_message(spec_name: &[u8], account_id_20: &AccountId20) -> Vec { [ @@ -350,7 +507,8 @@ pub fn sr25519_signable_message(spec_name: &[u8], account_id_20: &AccountId20) - .concat() } -fn verify_sr25519_signature( +/// Verify the Sr25519 signature. +pub fn verify_sr25519_signature( public_key: &AccountId32, message: &[u8], signature: &Signature, @@ -365,3 +523,28 @@ fn verify_sr25519_signature( signature.verify(message, public_key) } + +/// Calculate the multisig account. +pub fn multisig_of( + who: AccountId32, + others: Vec, + threshold: u16, +) -> (Vec, AccountId32) { + // https://github.com/paritytech/substrate/blob/3bc3742d5c0c5269353d7809d9f8f91104a93273/frame/multisig/src/lib.rs#L525 + fn multisig_of_inner(members: &[AccountId32], threshold: u16) -> AccountId32 { + let entropy = (b"modlpy/utilisuba", members, threshold).using_encoded(hashing::blake2_256); + + Decode::decode(&mut TrailingZeroInput::new(entropy.as_ref())).expect( + "[pallet::account-migration] infinite length input; no invalid inputs for type; qed", + ) + } + + let mut members = others; + + members.push(who); + members.sort(); + + let multisig = multisig_of_inner(&members, threshold); + + (members, multisig) +} diff --git a/pallet/account-migration/src/tests.rs b/pallet/account-migration/src/tests.rs deleted file mode 100644 index f4f033726..000000000 --- a/pallet/account-migration/src/tests.rs +++ /dev/null @@ -1,48 +0,0 @@ -// This file is part of Darwinia. -// -// Copyright (C) 2018-2023 Darwinia Network -// SPDX-License-Identifier: GPL-3.0 -// -// Darwinia is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// Darwinia 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 Darwinia. If not, see . - -// darwinia -use crate::*; -// substrate -use sp_keyring::sr25519::Keyring; - -#[test] -fn sr25519_signable_message_should_work() { - ["Darwinia2", "Crab2", "Pangolin2"].iter().for_each(|s| { - assert_eq!( - sr25519_signable_message(s.as_bytes(), &Default::default()), - format!( - "I authorize the migration to {}, an unused address on {}. Sign this message to authorize using the Substrate key associated with the account on {} that you wish to migrate.", - "0x0000000000000000000000000000000000000000", - s, - &s[..s.len() - 1], - ).as_bytes() - ); - }); -} - -#[test] -fn verify_sr25519_signature_should_work() { - Keyring::iter().enumerate().for_each(|(i, from)| { - let to = [i as _; 20]; - let message = sr25519_signable_message(b"Darwinia2", &to.into()); - let signature = from.sign(&message); - - assert!(verify_sr25519_signature(&from.public().0.into(), &message, &signature)); - }); -} diff --git a/pallet/account-migration/tests/mock.rs b/pallet/account-migration/tests/mock.rs new file mode 100644 index 000000000..afcab1f14 --- /dev/null +++ b/pallet/account-migration/tests/mock.rs @@ -0,0 +1,206 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +pub use dc_primitives::*; + +// substrate +use sp_io::TestExternalities; + +pub struct Dummy; +impl darwinia_deposit::SimpleAsset for Dummy { + type AccountId = AccountId; + + fn mint(_: &Self::AccountId, _: Balance) -> sp_runtime::DispatchResult { + Ok(()) + } + + fn burn(_: &Self::AccountId, _: Balance) -> sp_runtime::DispatchResult { + Ok(()) + } +} +impl darwinia_staking::Stake for Dummy { + type AccountId = AccountId; + type Item = Balance; + + fn stake(_: &Self::AccountId, _: Self::Item) -> sp_runtime::DispatchResult { + Ok(()) + } + + fn unstake(_: &Self::AccountId, _: Self::Item) -> sp_runtime::DispatchResult { + Ok(()) + } +} +impl frame_support::traits::UnixTime for Dummy { + fn now() -> core::time::Duration { + core::time::Duration::new(0, 0) + } +} + +#[sp_version::runtime_version] +pub const VERSION: sp_version::RuntimeVersion = sp_version::RuntimeVersion { + spec_name: sp_runtime::create_runtime_str!("Darwinia2"), + impl_name: sp_runtime::create_runtime_str!("DarwiniaOfficialRust"), + authoring_version: 0, + spec_version: 6_0_0_0, + impl_version: 0, + apis: sp_version::create_apis_vec!([]), + transaction_version: 0, + state_version: 0, +}; +frame_support::parameter_types! { + pub const Version: sp_version::RuntimeVersion = VERSION; +} +impl frame_system::Config for Runtime { + type AccountData = pallet_balances::AccountData; + type AccountId = AccountId; + type BaseCallFilter = frame_support::traits::Everything; + type BlockHashCount = (); + type BlockLength = (); + type BlockNumber = BlockNumber; + type BlockWeights = (); + type DbWeight = (); + type Hash = sp_core::H256; + type Hashing = sp_runtime::traits::BlakeTwo256; + type Header = sp_runtime::generic::Header; + type Index = Index; + type Lookup = sp_runtime::traits::IdentityLookup; + type MaxConsumers = frame_support::traits::ConstU32<16>; + type OnKilledAccount = (); + type OnNewAccount = (); + type OnSetCode = (); + type PalletInfo = PalletInfo; + type RuntimeCall = RuntimeCall; + type RuntimeEvent = RuntimeEvent; + type RuntimeOrigin = RuntimeOrigin; + type SS58Prefix = (); + type SystemWeightInfo = (); + type Version = Version; +} + +impl pallet_balances::Config for Runtime { + type AccountStore = System; + type Balance = Balance; + type DustRemoval = (); + type ExistentialDeposit = (); + type MaxLocks = (); + type MaxReserves = (); + type ReserveIdentifier = [u8; 8]; + type RuntimeEvent = RuntimeEvent; + type WeightInfo = (); +} + +impl pallet_assets::Config for Runtime { + type ApprovalDeposit = (); + type AssetAccountDeposit = (); + type AssetDeposit = (); + type AssetId = AssetId; + type AssetIdParameter = codec::Compact; + type Balance = Balance; + type CreateOrigin = + frame_support::traits::AsEnsureOriginWithArg>; + type Currency = Balances; + type Extra = (); + type ForceOrigin = frame_system::EnsureSigned; + type Freezer = (); + type MetadataDepositBase = (); + type MetadataDepositPerByte = (); + type RemoveItemsLimit = (); + type RuntimeEvent = RuntimeEvent; + type StringLimit = (); + type WeightInfo = (); +} + +frame_support::parameter_types! { + pub UnvestedFundsAllowedWithdrawReasons: frame_support::traits::WithdrawReasons = + frame_support::traits::WithdrawReasons::except( + frame_support::traits::WithdrawReasons::TRANSFER | frame_support::traits::WithdrawReasons::RESERVE + ); +} +impl pallet_vesting::Config for Runtime { + type BlockNumberToBalance = sp_runtime::traits::ConvertInto; + type Currency = Balances; + type MinVestedTransfer = (); + type RuntimeEvent = RuntimeEvent; + type UnvestedFundsAllowedWithdrawReasons = UnvestedFundsAllowedWithdrawReasons; + type WeightInfo = (); + + const MAX_VESTING_SCHEDULES: u32 = 1; +} + +impl darwinia_deposit::Config for Runtime { + type Kton = Dummy; + type MaxDeposits = (); + type MinLockingAmount = (); + type Ring = Balances; + type RuntimeEvent = RuntimeEvent; + type UnixTime = Dummy; +} + +impl darwinia_staking::Config for Runtime { + type Deposit = Deposit; + type Kton = Dummy; + type MaxDeposits = (); + type MaxUnstakings = (); + type MinStakingDuration = (); + type PayoutFraction = (); + type RewardRemainder = (); + type Ring = Dummy; + type RingCurrency = Balances; + type RuntimeEvent = RuntimeEvent; + type UnixTime = Dummy; +} + +impl pallet_identity::Config for Runtime { + type BasicDeposit = (); + type Currency = Balances; + type FieldDeposit = (); + type ForceOrigin = frame_system::EnsureSigned; + type MaxAdditionalFields = (); + type MaxRegistrars = (); + type MaxSubAccounts = (); + type RegistrarOrigin = frame_system::EnsureSigned; + type RuntimeEvent = RuntimeEvent; + type Slashed = (); + type SubAccountDeposit = (); + type WeightInfo = (); +} + +impl darwinia_account_migration::Config for Runtime { + type RuntimeEvent = RuntimeEvent; +} + +frame_support::construct_runtime!( + pub enum Runtime where + Block = frame_system::mocking::MockBlock, + NodeBlock = frame_system::mocking::MockBlock, + UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic, + { + System: frame_system, + Balances: pallet_balances, + Assets: pallet_assets, + Vesting: pallet_vesting, + Deposit: darwinia_deposit, + Staking: darwinia_staking, + Identity: pallet_identity, + AccountMigration: darwinia_account_migration, + } +); + +pub fn new_test_ext() -> TestExternalities { + frame_system::GenesisConfig::default().build_storage::().unwrap().into() +} diff --git a/pallet/account-migration/tests/tests.rs b/pallet/account-migration/tests/tests.rs new file mode 100644 index 000000000..091bbf923 --- /dev/null +++ b/pallet/account-migration/tests/tests.rs @@ -0,0 +1,161 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +mod mock; +use mock::*; + +// darwinia +use darwinia_account_migration::*; +// substrate +use frame_support::{assert_noop, assert_ok}; +use frame_system::AccountInfo; +use pallet_balances::AccountData; +use sp_keyring::sr25519::Keyring; +use sp_runtime::{ + traits::ValidateUnsigned, + transaction_validity::{InvalidTransaction, TransactionValidityError}, +}; + +#[test] +fn sr25519_signable_message_should_work() { + ["Darwinia2", "Crab2", "Pangolin2"].iter().for_each(|s| { + assert_eq!( + sr25519_signable_message(s.as_bytes(), &Default::default()), + format!( + "I authorize the migration to {}, an unused address on {}. Sign this message to authorize using the Substrate key associated with the account on {} that you wish to migrate.", + "0x0000000000000000000000000000000000000000", + s, + &s[..s.len() - 1], + ).as_bytes() + ); + }); +} + +#[test] +fn verify_sr25519_signature_should_work() { + Keyring::iter().enumerate().for_each(|(i, from)| { + let to = [i as _; 20]; + let message = sr25519_signable_message(b"Darwinia2", &to.into()); + let signature = from.sign(&message); + + assert!(verify_sr25519_signature(&from.public().0.into(), &message, &signature)); + }); +} + +#[test] +fn multisig_of_should_work() { + let (_, multisig) = multisig_of( + // Xavier + array_bytes::hex_n_into_unchecked( + "0xe66972adc51faaf978614e8eb4015e5536e236a05875cf9253dc421ed6c2ec4b", + ), + vec![ + // Alex + array_bytes::hex_n_into_unchecked( + "0x26fe37ba5d35ac650ba37c5cc84525ed135e772063941ae221a1caca192fff49", + ), + // Denny + array_bytes::hex_n_into_unchecked( + "0x0a66532a23c418cca12183fee5f6afece770a0bb8725f459d7d1b1b598f91c49", + ), + ], + 2, + ); + + assert_eq!( + multisig, + // Sudo + array_bytes::hex_n_into_unchecked( + "0xc778fc2665f3f6ee9623594e5d1fab9dbd557149542c5edacbcc543a82c9d780" + ) + ); +} + +#[test] +fn migrate_multisig_should_work() { + let a = Keyring::Alice; + let b = Keyring::Bob; + let c = Keyring::Charlie; + let d = Keyring::Dave; + let (_, multisig) = + multisig_of(a.public().0.into(), vec![b.public().0.into(), c.public().0.into()], 2); + let to = Default::default(); + let message = sr25519_signable_message(b"Darwinia2", &to); + + new_test_ext().execute_with(|| { + >::insert( + &multisig, + AccountInfo::> { consumers: 1, ..Default::default() }, + ); + + assert!(>::get(&multisig).is_none()); + assert_eq!(>::get(&to).consumers, 0); + + // Alice starts the migration. + let signature = a.sign(&message); + + assert_ok!(AccountMigration::pre_dispatch(&Call::migrate_multisig { + submitter: a.public().0.into(), + others: vec![b.public().0.into(), c.public().0.into()], + threshold: 2, + to: to.clone(), + signature: signature.clone() + })); + assert_ok!(AccountMigration::migrate_multisig( + RuntimeOrigin::none(), + a.public().0.into(), + vec![b.public().0.into(), c.public().0.into()], + 2, + to, + signature, + )); + + assert!(>::get(&multisig).is_some()); + assert_eq!(>::get(&to).consumers, 0); + + // Dave tries to hack the multisig. + let signature = d.sign(&message); + + assert_noop!( + AccountMigration::pre_dispatch(&Call::complete_multisig_migration { + multisig: multisig.clone(), + submitter: d.public().0.into(), + signature + }), + TransactionValidityError::Invalid(InvalidTransaction::Custom(E_NOT_MULTISIG_MEMBER)) + ); + + // Charlie completes the migration. + let signature = c.sign(&message); + + assert_ok!(AccountMigration::pre_dispatch(&Call::complete_multisig_migration { + multisig: multisig.clone(), + submitter: c.public().0.into(), + signature: signature.clone() + })); + assert_ok!(AccountMigration::complete_multisig_migration( + RuntimeOrigin::none(), + multisig.clone(), + c.public().0.into(), + signature + )); + + assert!(>::get(&multisig).is_none()); + assert_eq!(>::get(&to).consumers, 1); + }); +} diff --git a/runtime/crab/src/pallets/deposit.rs b/runtime/crab/src/pallets/deposit.rs index f19900945..6cc968c53 100644 --- a/runtime/crab/src/pallets/deposit.rs +++ b/runtime/crab/src/pallets/deposit.rs @@ -45,8 +45,8 @@ impl darwinia_deposit::SimpleAsset for CKtonMinting { impl darwinia_deposit::Config for Runtime { type Kton = CKtonMinting; - type MaxDeposits = frame_support::traits::ConstU32<16>; - type MinLockingAmount = frame_support::traits::ConstU128; + type MaxDeposits = ConstU32<16>; + type MinLockingAmount = ConstU128; type Ring = Balances; type RuntimeEvent = RuntimeEvent; type UnixTime = Timestamp; diff --git a/runtime/crab/src/pallets/system.rs b/runtime/crab/src/pallets/system.rs index e5f331a7f..96faace69 100644 --- a/runtime/crab/src/pallets/system.rs +++ b/runtime/crab/src/pallets/system.rs @@ -85,7 +85,7 @@ impl frame_system::Config for Runtime { type Index = Index; /// The lookup mechanism to get account ID from whatever is passed in dispatchers. type Lookup = sp_runtime::traits::IdentityLookup; - type MaxConsumers = frame_support::traits::ConstU32<16>; + type MaxConsumers = ConstU32<16>; /// What to do if an account is fully reaped from the system. type OnKilledAccount = (); /// What to do if a new account is created. diff --git a/runtime/darwinia/src/pallets/deposit.rs b/runtime/darwinia/src/pallets/deposit.rs index 87ec891ea..dbfd17088 100644 --- a/runtime/darwinia/src/pallets/deposit.rs +++ b/runtime/darwinia/src/pallets/deposit.rs @@ -45,8 +45,8 @@ impl darwinia_deposit::SimpleAsset for KtonAsset { impl darwinia_deposit::Config for Runtime { type Kton = KtonAsset; - type MaxDeposits = frame_support::traits::ConstU32<16>; - type MinLockingAmount = frame_support::traits::ConstU128; + type MaxDeposits = ConstU32<16>; + type MinLockingAmount = ConstU128; type Ring = Balances; type RuntimeEvent = RuntimeEvent; type UnixTime = Timestamp; diff --git a/runtime/darwinia/src/pallets/system.rs b/runtime/darwinia/src/pallets/system.rs index e5f331a7f..96faace69 100644 --- a/runtime/darwinia/src/pallets/system.rs +++ b/runtime/darwinia/src/pallets/system.rs @@ -85,7 +85,7 @@ impl frame_system::Config for Runtime { type Index = Index; /// The lookup mechanism to get account ID from whatever is passed in dispatchers. type Lookup = sp_runtime::traits::IdentityLookup; - type MaxConsumers = frame_support::traits::ConstU32<16>; + type MaxConsumers = ConstU32<16>; /// What to do if an account is fully reaped from the system. type OnKilledAccount = (); /// What to do if a new account is created. diff --git a/runtime/pangolin/src/pallets/deposit.rs b/runtime/pangolin/src/pallets/deposit.rs index fbde4efca..66f606f67 100644 --- a/runtime/pangolin/src/pallets/deposit.rs +++ b/runtime/pangolin/src/pallets/deposit.rs @@ -45,8 +45,8 @@ impl darwinia_deposit::SimpleAsset for PKtonMinting { impl darwinia_deposit::Config for Runtime { type Kton = PKtonMinting; - type MaxDeposits = frame_support::traits::ConstU32<16>; - type MinLockingAmount = frame_support::traits::ConstU128; + type MaxDeposits = ConstU32<16>; + type MinLockingAmount = ConstU128; type Ring = Balances; type RuntimeEvent = RuntimeEvent; type UnixTime = Timestamp; diff --git a/runtime/pangolin/src/pallets/system.rs b/runtime/pangolin/src/pallets/system.rs index e5f331a7f..96faace69 100644 --- a/runtime/pangolin/src/pallets/system.rs +++ b/runtime/pangolin/src/pallets/system.rs @@ -85,7 +85,7 @@ impl frame_system::Config for Runtime { type Index = Index; /// The lookup mechanism to get account ID from whatever is passed in dispatchers. type Lookup = sp_runtime::traits::IdentityLookup; - type MaxConsumers = frame_support::traits::ConstU32<16>; + type MaxConsumers = ConstU32<16>; /// What to do if an account is fully reaped from the system. type OnKilledAccount = (); /// What to do if a new account is created. From 0e336a20f58d05900838719e2c2903969010da24 Mon Sep 17 00:00:00 2001 From: bear Date: Thu, 9 Feb 2023 18:40:16 +0800 Subject: [PATCH 135/189] Add special accounts migration test (#268) * Part 1 * Part 2 * Rename * Better function names --- tool/state-processor/src/system/mod.rs | 2 +- tool/state-processor/src/tests.rs | 430 ++++++++++++++++--------- 2 files changed, 277 insertions(+), 155 deletions(-) diff --git a/tool/state-processor/src/system/mod.rs b/tool/state-processor/src/system/mod.rs index b74824c07..edbbb9d64 100644 --- a/tool/state-processor/src/system/mod.rs +++ b/tool/state-processor/src/system/mod.rs @@ -119,7 +119,7 @@ where if key.ends_with("000000000000") { if let Some(s) = try_get_sub_seed(&key) { - log::info!("migrate special Account(`{s}`)"); + log::info!("migrate special Account(`{s}`): {key}"); is_special_account = true; } else if key diff --git a/tool/state-processor/src/tests.rs b/tool/state-processor/src/tests.rs index 52cfa2430..2416d4503 100644 --- a/tool/state-processor/src/tests.rs +++ b/tool/state-processor/src/tests.rs @@ -117,12 +117,12 @@ where // --- System & Balances & Assets --- #[test] -fn solo_chain_substrate_account_adjust() { +fn solo_chain_substrate_account() { run_test(|tester| { // the purest account { - let test_addr = "0xcefc2d75238c60c67b4b02867f061a7c36f9b37f625854d4e5daac2cbf58f42d"; - let solo_account = tester.solo_accounts.get(test_addr).unwrap(); + let addr = "0xcefc2d75238c60c67b4b02867f061a7c36f9b37f625854d4e5daac2cbf58f42d"; + let solo_account = tester.solo_accounts.get(addr).unwrap(); assert_eq!(solo_account.nonce, 0); assert_eq!(solo_account.consumers, 0); assert_eq!(solo_account.providers, 1); @@ -132,43 +132,43 @@ fn solo_chain_substrate_account_adjust() { // after migrate - let migrated_account = tester.migration_accounts.get(test_addr).unwrap(); - assert_eq!(migrated_account.nonce, 0); - assert_eq!(migrated_account.consumers, 0); - assert_eq!(migrated_account.providers, 1); - assert_eq!(migrated_account.sufficients, 0); - assert_eq!(migrated_account.data.free, solo_account.data.free * GWEI); - assert_eq!(migrated_account.data.reserved, 0); + let m_account = tester.migration_accounts.get(addr).unwrap(); + assert_eq!(m_account.nonce, 0); + assert_eq!(m_account.consumers, 0); + assert_eq!(m_account.providers, 1); + assert_eq!(m_account.sufficients, 0); + assert_eq!(m_account.data.free, solo_account.data.free * GWEI); + assert_eq!(m_account.data.reserved, 0); } // account nonce reset { - let test_addr = "0x82e54b190ef8dbe7864b7cdca3de6b3e8b5483e0a3e9419ba2a41a16531aaa0b"; - let solo_account = tester.solo_accounts.get(test_addr).unwrap(); + let addr = "0x82e54b190ef8dbe7864b7cdca3de6b3e8b5483e0a3e9419ba2a41a16531aaa0b"; + let solo_account = tester.solo_accounts.get(addr).unwrap(); assert_ne!(solo_account.nonce, 0); // after migrate - let migrated_account = tester.migration_accounts.get(test_addr).unwrap(); - assert_eq!(migrated_account.nonce, 0); + let m_account = tester.migration_accounts.get(addr).unwrap(); + assert_eq!(m_account.nonce, 0); } // account staking without deposit items { - let test_addr = "0x82e54b190ef8dbe7864b7cdca3de6b3e8b5483e0a3e9419ba2a41a16531aaa0b"; - let solo_account = tester.solo_accounts.get(test_addr).unwrap(); + let addr = "0x82e54b190ef8dbe7864b7cdca3de6b3e8b5483e0a3e9419ba2a41a16531aaa0b"; + let solo_account = tester.solo_accounts.get(addr).unwrap(); assert_eq!(solo_account.consumers, 2); // after migrate - let migrated_account = tester.migration_accounts.get(test_addr).unwrap(); - assert_eq!(migrated_account.consumers, 1); + let m_account = tester.migration_accounts.get(addr).unwrap(); + assert_eq!(m_account.consumers, 1); } // account has kton with ledger and deposit items { - let test_addr = "0xf4171e1b64c96cc17f601f28d002cb5fcd27eab8b6585e296f4652be5bf05550"; - let solo_account = tester.solo_accounts.get(test_addr).unwrap(); + let addr = "0xf4171e1b64c96cc17f601f28d002cb5fcd27eab8b6585e296f4652be5bf05550"; + let solo_account = tester.solo_accounts.get(addr).unwrap(); assert_eq!(solo_account.consumers, 3); assert_eq!(solo_account.providers, 1); assert_eq!(solo_account.sufficients, 0); @@ -177,14 +177,14 @@ fn solo_chain_substrate_account_adjust() { // after migrate - let migrated_account = tester.migration_accounts.get(test_addr).unwrap(); - assert_eq!(migrated_account.consumers, 2); - assert_eq!(migrated_account.providers, 1); - assert_eq!(migrated_account.sufficients, 1); - assert_eq!(migrated_account.data.free, solo_account.data.free * GWEI); - assert_eq!(migrated_account.data.free_kton_or_misc_frozen, 0); + let m_account = tester.migration_accounts.get(addr).unwrap(); + assert_eq!(m_account.consumers, 2); + assert_eq!(m_account.providers, 1); + assert_eq!(m_account.sufficients, 1); + assert_eq!(m_account.data.free, solo_account.data.free * GWEI); + assert_eq!(m_account.data.free_kton_or_misc_frozen, 0); // the kton part moved to the asset pallet - let asset_account = tester.migration_kton_accounts.get(test_addr).unwrap(); + let asset_account = tester.migration_kton_accounts.get(addr).unwrap(); assert_eq!(asset_account.balance, solo_account.data.free_kton_or_misc_frozen * GWEI); assert!(!asset_account.is_frozen); } @@ -192,77 +192,77 @@ fn solo_chain_substrate_account_adjust() { } #[test] -fn solo_chain_substrate_account_adjust_with_remaining_balance() { +fn solo_chain_substrate_account_with_remaining_balance() { run_test(|tester| { - let test_addr = "0xfe129f56cc498227acacc4231f70ae15a2f4e8f9ccfa51f4de268c75516fa350"; + let addr = "0xfe129f56cc498227acacc4231f70ae15a2f4e8f9ccfa51f4de268c75516fa350"; - let solo_account = tester.solo_accounts.get(test_addr).unwrap(); - let remaining_balance = tester.solo_remaining_ring.get(test_addr).unwrap(); + let solo_account = tester.solo_accounts.get(addr).unwrap(); + let remaining_balance = tester.solo_remaining_ring.get(addr).unwrap(); assert_ne!(*remaining_balance, 0); // after migrate - let migrated_account = tester.migration_accounts.get(test_addr).unwrap(); + let m_account = tester.migration_accounts.get(addr).unwrap(); assert_eq!( - migrated_account.data.free + migrated_account.data.reserved, + m_account.data.free + m_account.data.reserved, (solo_account.data.free + solo_account.data.reserved) * GWEI + remaining_balance ); }); } #[test] -fn combine_solo_account_with_para_account() { +fn combine_solo_and_para_account() { run_test(|tester| { - let test_addr = "0x2a997fbf3423723ab73fae76567b320de6979664cb3287c0e6ce24099d0eff68"; + let addr = "0x2a997fbf3423723ab73fae76567b320de6979664cb3287c0e6ce24099d0eff68"; // solo - let solo_account = tester.solo_accounts.get(test_addr).unwrap(); - let remaining_balance = tester.solo_remaining_ring.get(test_addr).unwrap(); + let solo_account = tester.solo_accounts.get(addr).unwrap(); + let remaining_balance = tester.solo_remaining_ring.get(addr).unwrap(); assert_ne!(solo_account.nonce, 0); // para - let para_account = tester.para_accounts.get(test_addr).unwrap(); + let para_account = tester.para_accounts.get(addr).unwrap(); assert_ne!(para_account.nonce, 0); // after migrate - let migrated_account = tester.migration_accounts.get(test_addr).unwrap(); + let m_account = tester.migration_accounts.get(addr).unwrap(); assert_eq!( - migrated_account.data.free, + m_account.data.free, solo_account.data.free * GWEI + remaining_balance + para_account.data.free ); // reset the nonce - assert_eq!(migrated_account.nonce, 0); + assert_eq!(m_account.nonce, 0); }); } #[test] -fn evm_account_adjust() { +fn evm_account() { run_test(|tester| { - let test_addr = "0x64766d3a00000000000000aef71b03670f1c52cd3d8efc2ced3ad68ad91e33f3"; + let addr = "0x64766d3a00000000000000aef71b03670f1c52cd3d8efc2ced3ad68ad91e33f3"; - let solo_account = tester.solo_accounts.get(test_addr).unwrap(); + let solo_account = tester.solo_accounts.get(addr).unwrap(); assert_ne!(solo_account.nonce, 0); assert_ne!(solo_account.data.free, 0); assert_ne!(solo_account.data.free_kton_or_misc_frozen, 0); - let solo_remaining_kton = tester.solo_remaining_kton.get(test_addr).unwrap(); + let solo_remaining_kton = tester.solo_remaining_kton.get(addr).unwrap(); assert_ne!(*solo_remaining_kton, 0); // after migrate - let migrate_addr = "0xaef71b03670f1c52cd3d8efc2ced3ad68ad91e33"; - let migrated_account = tester.shell_system_accounts.get(migrate_addr).unwrap(); + let m_addr = "0xaef71b03670f1c52cd3d8efc2ced3ad68ad91e33"; + let m_account = tester.shell_system_accounts.get(m_addr).unwrap(); // nonce doesn't changed. - assert_eq!(migrated_account.nonce, solo_account.nonce); - assert_eq!(migrated_account.consumers, solo_account.consumers); - assert_eq!(migrated_account.providers, solo_account.providers); + assert_eq!(m_account.nonce, solo_account.nonce); + assert_eq!(m_account.consumers, solo_account.consumers); + assert_eq!(m_account.providers, solo_account.providers); // sufficient increase by one because of the asset pallet. - assert_eq!(migrated_account.sufficients, solo_account.sufficients + 1); - assert_eq!(migrated_account.data.free, solo_account.data.free * GWEI); - assert_eq!(migrated_account.data.free_kton_or_misc_frozen, 0); + assert_eq!(m_account.sufficients, solo_account.sufficients + 1); + assert_eq!(m_account.data.free, solo_account.data.free * GWEI); + assert_eq!(m_account.data.free_kton_or_misc_frozen, 0); // the kton part moved to the asset pallet let mut asset_account = AssetAccount::default(); - let migrate_addr = + let m_addr = array_bytes::hex2array_unchecked::<_, 20>("0xaef71b03670f1c52cd3d8efc2ced3ad68ad91e33"); tester.shell_state.get_value( b"Assets", @@ -270,7 +270,7 @@ fn evm_account_adjust() { &format!( "{}{}", blake2_128_concat_to_string(KTON_ID.encode()), - blake2_128_concat_to_string(migrate_addr.encode()), + blake2_128_concat_to_string(m_addr.encode()), ), &mut asset_account, ); @@ -283,17 +283,17 @@ fn evm_account_adjust() { } #[test] -fn evm_contract_account_adjust_sufficients() { +fn evm_contract_account_sufficients() { run_test(|tester| { - let test_addr = "0x64766d3a000000000000000050f880c35c31c13bfd9cbb7d28aafaeca3abd2d0"; - let solo_account = tester.solo_accounts.get(test_addr).unwrap(); + let addr = "0x64766d3a000000000000000050f880c35c31c13bfd9cbb7d28aafaeca3abd2d0"; + let solo_account = tester.solo_accounts.get(addr).unwrap(); assert_eq!(solo_account.sufficients, 0); - // after migrated + // after migrate - let migrate_addr = "0x0050f880c35c31c13bfd9cbb7d28aafaeca3abd2"; - let migrated_account = tester.shell_system_accounts.get(migrate_addr).unwrap(); - assert_eq!(migrated_account.sufficients, 1); + let m_addr = "0x0050f880c35c31c13bfd9cbb7d28aafaeca3abd2"; + let m_account = tester.shell_system_accounts.get(m_addr).unwrap(); + assert_eq!(m_account.sufficients, 1); }); } @@ -309,6 +309,7 @@ fn ring_total_issuance() { assert_ne!(para_issuance, 0); // after migrate + let mut migrated_total_issuance = u128::default(); tester.shell_state.get_value( b"Balances", @@ -330,6 +331,7 @@ fn kton_total_issuance() { assert_ne!(total_issuance, 0); // after migrate + let mut migrated_total_issuance = u128::default(); tester.shell_state.get_value( b"Balances", @@ -388,40 +390,153 @@ fn asset_metadata() { } #[test] -fn identities_reservation_adjust() { +fn identities_reservation() { run_test(|tester| { { // https://crab.subscan.io/account/5CXHjmXetspzSTWci8UKXnPjBeJGpibitrWX7fDDMqbggyap - let test_addr = "0x14466f29bc873ce014367d897940e3a4d4a22c1c70d83469bcd7647e921d1557"; + let addr = "0x14466f29bc873ce014367d897940e3a4d4a22c1c70d83469bcd7647e921d1557"; - let solo_account = tester.solo_accounts.get(test_addr).unwrap(); - let remaining = tester.solo_remaining_ring.get(test_addr).unwrap(); + let solo_account = tester.solo_accounts.get(addr).unwrap(); + let remaining = tester.solo_remaining_ring.get(addr).unwrap(); assert_eq!(solo_account.data.reserved, 10000000000); let total = (solo_account.data.free + solo_account.data.reserved) * GWEI + remaining; // after migrate - let migrated_account = tester.migration_accounts.get(test_addr).unwrap(); - assert_eq!(migrated_account.data.reserved, 100025800000000000000); - assert_eq!(migrated_account.data.reserved + migrated_account.data.free, total); + let m_account = tester.migration_accounts.get(addr).unwrap(); + assert_eq!(m_account.data.reserved, 100025800000000000000); + assert_eq!(m_account.data.reserved + m_account.data.free, total); } // can not afford the latest reservation amount { // https://crab.subscan.io/account/5HTysESF4MCRABBJ2Pmm8Sx3JrJToQgz1nwiBctGXGUKZLeP - let test_addr = "0xeeedb4805e781b16db87edc6fc2bb0982bf70a435e6a5acac37ede09131d8b8b"; + let addr = "0xeeedb4805e781b16db87edc6fc2bb0982bf70a435e6a5acac37ede09131d8b8b"; - let solo_account = tester.solo_accounts.get(test_addr).unwrap(); + let solo_account = tester.solo_accounts.get(addr).unwrap(); assert_ne!(solo_account.data.free, 0); assert_eq!(solo_account.data.reserved, 10000000000); let total = (solo_account.data.free + solo_account.data.reserved) * GWEI; // after migrate - let migrated_account = tester.migration_accounts.get(test_addr).unwrap(); - assert_eq!(migrated_account.data.free, 0); - assert_eq!(migrated_account.data.reserved, 10800000000000000000); - assert_eq!(migrated_account.data.reserved + migrated_account.data.free, total); + let m_account = tester.migration_accounts.get(addr).unwrap(); + assert_eq!(m_account.data.free, 0); + assert_eq!(m_account.data.reserved, 10800000000000000000); + assert_eq!(m_account.data.reserved + m_account.data.free, total); + } + }); +} + +#[test] +fn special_accounts() { + run_test(|tester| { + { + // sibling:2023 + // https://crab-parachain.subscan.io/account/5Eg2fntNdR73Xc3d8jr1954TYnT173qFgSZmDhMTn2K4ewsT + let addr_1 = "0x7369626ce7070000000000000000000000000000000000000000000000000000"; + let para_account_1 = tester.para_accounts.get(addr_1).unwrap(); + assert_ne!(para_account_1.data.free, 0); + + // sibling:2000 + // https://crab-parachain.subscan.io/account/5Eg2fntJ27qsari4FGrGhrMqKFDRnkNSR6UshkZYBGXmSuC8 + let addr_2 = "0x7369626cd0070000000000000000000000000000000000000000000000000000"; + let para_account_2 = tester.para_accounts.get(addr_2).unwrap(); + assert_ne!(para_account_2.data.free, 0); + + // sibling:2004 + // https://crab-parachain.subscan.io/account/5Eg2fntJpc4bfLRHXnmBUav7hms6NC6vowNAEBDnYSfeMPCw + let addr_3 = "0x7369626cd4070000000000000000000000000000000000000000000000000000"; + let para_account_3 = tester.para_accounts.get(addr_3).unwrap(); + assert_ne!(para_account_3.data.free, 0); + + // after migrate + + let m_account_1 = tester.shell_system_accounts.get(&addr_1[..42]).unwrap(); + assert_eq!(m_account_1.data.free, para_account_1.data.free); + let m_account_2 = tester.shell_system_accounts.get(&addr_2[..42]).unwrap(); + assert_eq!(m_account_2.data.free, para_account_2.data.free); + let m_account_3 = tester.shell_system_accounts.get(&addr_3[..42]).unwrap(); + assert_eq!(m_account_3.data.free, para_account_3.data.free); + } + + { + // PalletId(da/paais) + let addr_1 = "0x6d6f646c64612f70616169730000000000000000000000000000000000000000"; + let para_account_1 = tester.para_accounts.get(addr_1).unwrap(); + assert!(para_account_1.providers > 1); + + // PalletId(PotStake) + let addr_2 = "0x6d6f646c506f745374616b650000000000000000000000000000000000000000"; + let para_account_2 = tester.para_accounts.get(addr_2).unwrap(); + assert_eq!(para_account_2.data.free, 1); + + // PalletId(da/ethrl) + let addr_3 = "0x6d6f646c64612f657468726c0000000000000000000000000000000000000000"; + let solo_account_3 = tester.solo_accounts.get(addr_3).unwrap(); + assert_ne!(solo_account_3.data.free, 0); + + // PalletId(da/trsry) + let addr_4 = "0x6d6f646c64612f74727372790000000000000000000000000000000000000000"; + let solo_account_4 = tester.solo_accounts.get(addr_4).unwrap(); + let para_account_4 = tester.para_accounts.get(addr_4).unwrap(); + assert_ne!(solo_account_4.data.free, 0); + assert_ne!(para_account_4.data.free, 0); + + // PalletId(py/trsry) + let addr_5 = "0x6d6f646c70792f74727372790000000000000000000000000000000000000000"; + let solo_account_5 = tester.solo_accounts.get(addr_5).unwrap(); + assert_ne!(solo_account_5.data.free, 0); + assert_ne!(solo_account_5.data.free_kton_or_misc_frozen, 0); + + // after migrate + + let m_account_1 = tester.shell_system_accounts.get(&addr_1[..42]).unwrap(); + assert_eq!(m_account_1.providers, 1); + + let m_account_2 = tester.shell_system_accounts.get(&addr_2[..42]).unwrap(); + assert_eq!(m_account_2.data.free, para_account_2.data.free); + + let m_account_3 = tester.shell_system_accounts.get(&addr_3[..42]).unwrap(); + assert_eq!(m_account_3.data.free, solo_account_3.data.free * GWEI); + + let m_account_4 = tester.shell_system_accounts.get(&addr_4[..42]).unwrap(); + assert_eq!( + m_account_4.data.free, + solo_account_4.data.free * GWEI + para_account_4.data.free + ); + + let m_account_5 = tester.shell_system_accounts.get(&addr_5[..42]).unwrap(); + assert_eq!(m_account_5.data.free, solo_account_5.data.free * GWEI); + assert_eq!(m_account_5.data.free_kton_or_misc_frozen, 0); + let m_addr = array_bytes::hex2array_unchecked::<_, 20>(&addr_5[..42]); + let mut asset_account = AssetAccount::default(); + tester.shell_state.get_value( + b"Assets", + b"Account", + &format!( + "{}{}", + blake2_128_concat_to_string(KTON_ID.encode()), + blake2_128_concat_to_string(m_addr.encode()), + ), + &mut asset_account, + ); + assert_eq!(asset_account.balance, solo_account_5.data.free_kton_or_misc_frozen * GWEI); + } + + { + let addr = "0x0000000000000000000000000000000000000000000000000000000000000000"; + let solo_account = tester.solo_accounts.get(addr).unwrap(); + assert_ne!(solo_account.data.free, 0); + assert_ne!(solo_account.data.reserved, 0); + + // after migrate + + let m_account = tester.shell_system_accounts.get(&addr[..42]).unwrap(); + assert_eq!( + m_account.data.free, + (solo_account.data.free + solo_account.data.reserved) * GWEI + ); } }); } @@ -429,17 +544,17 @@ fn identities_reservation_adjust() { // --- EVM & Ethereum --- #[test] -fn evm_code_migrate() { +fn evm_code() { run_test(|tester| { { - let test_addr = "0x0050f880c35c31c13bfd9cbb7d28aafaeca3abd2"; + let addr = "0x0050f880c35c31c13bfd9cbb7d28aafaeca3abd2"; - let code = tester.solo_evm_codes.get(test_addr).unwrap(); + let code = tester.solo_evm_codes.get(addr).unwrap(); assert_ne!(code.len(), 0); // after migrate - let migrated_code = tester.shell_evm_codes.get(test_addr).unwrap(); + let migrated_code = tester.shell_evm_codes.get(addr).unwrap(); assert_eq!(*code, *migrated_code); } @@ -452,7 +567,7 @@ fn evm_code_migrate() { } #[test] -fn precompiles_code_should_work() { +fn precompiles_code() { run_test(|tester| { let addrs = ["001", "009", "400", "402", "600", "601"]; @@ -464,17 +579,17 @@ fn precompiles_code_should_work() { } #[test] -fn evm_account_storage_migrate() { +fn evm_contract_account_storage() { run_test(|tester| { // https://crab.subscan.io/account/0x0050f880c35c31c13bfd9cbb7d28aafaeca3abd2 - let test_addr = + let addr = array_bytes::hex2array_unchecked::<_, 20>("0x0050f880c35c31c13bfd9cbb7d28aafaeca3abd2"); let storage_item_len = tester.solo_state.map.iter().fold(0u32, |sum, (k, _)| { if k.starts_with(&full_key( b"EVM", b"AccountStorages", - &blake2_128_concat_to_string(test_addr.encode()), + &blake2_128_concat_to_string(addr.encode()), )) { sum + 1 } else { @@ -492,7 +607,7 @@ fn evm_account_storage_migrate() { b"AccountStorages", &format!( "{}{}", - &blake2_128_concat_to_string(test_addr.encode()), + &blake2_128_concat_to_string(addr.encode()), &blake2_128_concat_to_string(storage_key), ), &mut storage_value, @@ -500,11 +615,12 @@ fn evm_account_storage_migrate() { assert_ne!(storage_value, H256::zero()); // after migrate + let migrated_storage_item_len = tester.shell_state.map.iter().fold(0u32, |sum, (k, _)| { if k.starts_with(&full_key( b"Evm", b"AccountStorages", - &blake2_128_concat_to_string(test_addr.encode()), + &blake2_128_concat_to_string(addr.encode()), )) { sum + 1 } else { @@ -519,7 +635,7 @@ fn evm_account_storage_migrate() { b"AccountStorages", &format!( "{}{}", - &blake2_128_concat_to_string(test_addr.encode()), + &blake2_128_concat_to_string(addr.encode()), &blake2_128_concat_to_string(storage_key), ), &mut migrated_storage_value, @@ -531,10 +647,10 @@ fn evm_account_storage_migrate() { // --- Staking --- #[test] -fn deposit_items_migrate() { +fn stake_deposit_items() { run_test(|tester| { // https://crab.subscan.io/account/5Dfh9agy74KFmdYqxNGEWae9fE9pdzYnyCUJKqK47Ac64zqM - let test_addr = array_bytes::hex2array_unchecked::<_, 32>( + let addr = array_bytes::hex2array_unchecked::<_, 32>( "0x46eb701bdc7f74ffda9c4335d82b3ae8d4e52c5ac630e50d68ab99822e29b3f6", ); @@ -542,37 +658,38 @@ fn deposit_items_migrate() { tester.solo_state.get_value( b"Staking", b"Ledger", - &blake2_128_concat_to_string(test_addr.encode()), + &blake2_128_concat_to_string(addr.encode()), &mut ledger, ); assert_ne!(ledger.deposit_items.len(), 0); let deposits_sum: u128 = ledger.deposit_items.iter().map(|i| i.value).sum(); // after migrate - let mut migrated_deposits = Vec::::new(); + + let mut m_deposits = Vec::::new(); tester.shell_state.get_value( b"AccountMigration", b"Deposits", - &blake2_128_concat_to_string(test_addr.encode()), - &mut migrated_deposits, + &blake2_128_concat_to_string(addr.encode()), + &mut m_deposits, ); - assert_eq!(migrated_deposits.len(), ledger.deposit_items.len()); - ledger.deposit_items.iter().zip(migrated_deposits.iter()).for_each(|(old, new)| { + assert_eq!(m_deposits.len(), ledger.deposit_items.len()); + ledger.deposit_items.iter().zip(m_deposits.iter()).for_each(|(old, new)| { assert_eq!(new.value, old.value * GWEI); assert_eq!(new.start_time, old.start_time as u128); assert_eq!(new.expired_time, old.expire_time as u128); assert!(new.in_use); }); - let migrated_deposits_sum: u128 = migrated_deposits.iter().map(|i| i.value).sum(); + let migrated_deposits_sum: u128 = m_deposits.iter().map(|i| i.value).sum(); assert_eq!(migrated_deposits_sum, deposits_sum * GWEI); }); } #[test] -fn ledgers_staked_value_migrate() { +fn stake_ledgers_values() { run_test(|tester| { // https://crab.subscan.io/account/5Dfh9agy74KFmdYqxNGEWae9fE9pdzYnyCUJKqK47Ac64zqM - let test_addr = array_bytes::hex2array_unchecked::<_, 32>( + let addr = array_bytes::hex2array_unchecked::<_, 32>( "0x46eb701bdc7f74ffda9c4335d82b3ae8d4e52c5ac630e50d68ab99822e29b3f6", ); @@ -580,30 +697,31 @@ fn ledgers_staked_value_migrate() { tester.solo_state.get_value( b"Staking", b"Ledger", - &blake2_128_concat_to_string(test_addr.encode()), + &blake2_128_concat_to_string(addr.encode()), &mut ledger, ); assert_ne!(ledger.active, 0); assert_ne!(ledger.active_kton, 0); // after migrate - let mut migrated_ledger = Ledger::default(); + + let mut m_ledger = Ledger::default(); tester.shell_state.get_value( b"AccountMigration", b"Ledgers", - &blake2_128_concat_to_string(test_addr.encode()), - &mut migrated_ledger, + &blake2_128_concat_to_string(addr.encode()), + &mut m_ledger, ); - assert_eq!(migrated_ledger.staked_ring, ledger.active * GWEI); - assert_eq!(migrated_ledger.staked_kton, ledger.active_kton * GWEI); + assert_eq!(m_ledger.staked_ring, ledger.active * GWEI); + assert_eq!(m_ledger.staked_kton, ledger.active_kton * GWEI); }); } #[test] -fn ledgers_unbondings_migrate() { +fn stake_ledgers_unbonding() { run_test(|tester| { // https://crab.subscan.io/account/5FGL7pMZFZK4zWX2y3CRABeqMpMjBq77LhfYipWoBAT9gJsa - let test_addr = array_bytes::hex2array_unchecked::<_, 32>( + let addr = array_bytes::hex2array_unchecked::<_, 32>( "0x8d92774046fd3dc60d41825023506ad5ad91bd0d66e9c1df325fc3cf89c2d317", ); @@ -611,79 +729,80 @@ fn ledgers_unbondings_migrate() { tester.solo_state.get_value( b"Staking", b"Ledger", - &blake2_128_concat_to_string(test_addr.encode()), + &blake2_128_concat_to_string(addr.encode()), &mut ledger, ); assert_ne!(ledger.ring_staking_lock.unbondings.len(), 0); // after migrate - let mut migrated_ledger = Ledger::default(); + + let mut m_ledger = Ledger::default(); tester.shell_state.get_value( b"AccountMigration", b"Ledgers", - &blake2_128_concat_to_string(test_addr.encode()), - &mut migrated_ledger, + &blake2_128_concat_to_string(addr.encode()), + &mut m_ledger, ); - ledger - .ring_staking_lock - .unbondings - .iter() - .zip(migrated_ledger.unstaking_ring.iter()) - .for_each(|(old, (amount, util))| { + ledger.ring_staking_lock.unbondings.iter().zip(m_ledger.unstaking_ring.iter()).for_each( + |(old, (amount, util))| { assert_eq!(*amount, old.amount * GWEI); assert!(*util < old.until); - }); + }, + ); }); } #[test] -fn ring_pool_migrate() { +fn stake_ring_pool() { run_test(|tester| { let mut ring_pool = u128::default(); tester.solo_state.get_value(b"Staking", b"RingPool", "", &mut ring_pool); assert_ne!(ring_pool, 0); // after migrate - let mut migrated_ring_pool = u128::default(); - tester.shell_state.get_value(b"Staking", b"RingPool", "", &mut migrated_ring_pool); - assert_eq!(migrated_ring_pool, ring_pool * GWEI); + let mut m_ring_pool = u128::default(); + tester.shell_state.get_value(b"Staking", b"RingPool", "", &mut m_ring_pool); + assert_eq!(m_ring_pool, ring_pool * GWEI); }); } #[test] -fn kton_pool_migrate() { +fn stake_kton_pool() { run_test(|tester| { let mut kton_pool = u128::default(); tester.solo_state.get_value(b"Staking", b"KtonPool", "", &mut kton_pool); assert_ne!(kton_pool, 0); // after migrate - let mut migrated_kton_pool = u128::default(); - tester.shell_state.get_value(b"Staking", b"KtonPool", "", &mut migrated_kton_pool); - assert_eq!(migrated_kton_pool, kton_pool * GWEI); + + let mut m_kton_pool = u128::default(); + tester.shell_state.get_value(b"Staking", b"KtonPool", "", &mut m_kton_pool); + assert_eq!(m_kton_pool, kton_pool * GWEI); }); } #[test] -fn elapsed_time_migrate() { +fn stake_elapsed_time() { run_test(|tester| { let mut elapsed_time = u64::default(); tester.solo_state.get_value(b"Staking", b"LivingTime", "", &mut elapsed_time); assert_ne!(elapsed_time, 0); // after migrate - let mut migrated_elapsed_time = u128::default(); - tester.shell_state.get_value(b"Staking", b"ElapsedTime", "", &mut migrated_elapsed_time); - assert_eq!(migrated_elapsed_time, elapsed_time as u128); + + let mut m_elapsed_time = u128::default(); + tester.shell_state.get_value(b"Staking", b"ElapsedTime", "", &mut m_elapsed_time); + assert_eq!(m_elapsed_time, elapsed_time as u128); }); } // --- Vesting --- + #[test] -fn vesting_info_adjust() { +fn vesting_info() { run_test(|tester| { // https://crab.subscan.io/account/5EFJA3K6uRfkLxqjhHyrkJoQjfhmhyVyVEG5XtPPBM6yCCxM - let test_addr = array_bytes::hex2array_unchecked::<_, 32>( + let addr = array_bytes::hex2array_unchecked::<_, 32>( "0x608c62275934b164899ca6270c4b89c5d84b2390d4316fda980cd1b3acfad525", ); @@ -691,34 +810,35 @@ fn vesting_info_adjust() { tester.solo_state.get_value( b"Vesting", b"Vesting", - &blake2_128_concat_to_string(test_addr.encode()), + &blake2_128_concat_to_string(addr.encode()), &mut vesting_info, ); assert_ne!(vesting_info.locked, 0); assert_ne!(vesting_info.starting_block, 0); // after migrate - let mut migrated_vesting_info = VestingInfo::default(); + + let mut m_vesting_info = VestingInfo::default(); tester.shell_state.get_value( b"AccountMigration", b"Vestings", - &blake2_128_concat_to_string(test_addr.encode()), - &mut migrated_vesting_info, + &blake2_128_concat_to_string(addr.encode()), + &mut m_vesting_info, ); - assert_eq!(migrated_vesting_info.locked, vesting_info.locked * GWEI); - assert_eq!(migrated_vesting_info.per_block, vesting_info.per_block * GWEI * 2); - assert!(migrated_vesting_info.starting_block < vesting_info.starting_block); + assert_eq!(m_vesting_info.locked, vesting_info.locked * GWEI); + assert_eq!(m_vesting_info.per_block, vesting_info.per_block * GWEI * 2); + assert!(m_vesting_info.starting_block < vesting_info.starting_block); }); } // --- Identity --- #[test] -fn identities_adjust() { +fn identities() { run_test(|tester| { // https://crab.subscan.io/account/5Ct3V8cbYgJiUoQQhYMyyWChL5YwJnZ4yak7MKegNkpPptAP - let test_addr = array_bytes::hex2array_unchecked::<_, 32>( + let addr = array_bytes::hex2array_unchecked::<_, 32>( "0x241a9c2aa8a83e1c5f02fc2b7112bd1873249a8e55a4f919c7d42cf1164be35c", ); @@ -726,7 +846,7 @@ fn identities_adjust() { tester.solo_state.get_value( b"Identity", b"IdentityOf", - &two_x64_concat_to_string(test_addr.encode()), + &two_x64_concat_to_string(addr.encode()), &mut registration, ); assert_ne!(registration.deposit, 0); @@ -734,39 +854,41 @@ fn identities_adjust() { assert_eq!(registration.info.email, Data::Raw(b"pjdamondamon@gmail.com".to_vec())); assert_eq!(registration.info.twitter, Data::Raw(b"@DPedroJuan".to_vec())); - // after migrated - let mut migrated_registration = Registration::default(); + // after migrate + + let mut m_registration = Registration::default(); tester.shell_state.get_value( b"AccountMigration", b"Identities", - &two_x64_concat_to_string(test_addr.encode()), - &mut migrated_registration, + &two_x64_concat_to_string(addr.encode()), + &mut m_registration, ); - assert_eq!(migrated_registration.deposit, registration.deposit * GWEI); - registration.judgements.iter().zip(migrated_registration.judgements.iter()).for_each( + assert_eq!(m_registration.deposit, registration.deposit * GWEI); + registration.judgements.iter().zip(m_registration.judgements.iter()).for_each( |((_, r), (_, m_r))| match (r, m_r) { (Judgement::FeePaid(a), Judgement::FeePaid(m_a)) => assert_eq!(a * GWEI, *m_a), _ => assert_eq!(*r, *m_r), }, ); - assert_eq!(migrated_registration.info.display, registration.info.display); - assert_eq!(migrated_registration.info.email, registration.info.email); - assert_eq!(migrated_registration.info.twitter, registration.info.twitter); + assert_eq!(m_registration.info.display, registration.info.display); + assert_eq!(m_registration.info.email, registration.info.email); + assert_eq!(m_registration.info.twitter, registration.info.twitter); }); } #[test] -fn registrars_adjust() { +fn registrars() { run_test(|tester| { let mut rs: Vec>> = Vec::new(); tester.solo_state.get_value(b"Identity", b"Registrars", "", &mut rs); assert!(!rs.is_empty()); - // after migrated - let mut migrated_rs: Vec>> = Vec::new(); - tester.shell_state.get_value(b"Identity", b"Registrars", "", &mut migrated_rs); + // after migrate + + let mut m_rs: Vec>> = Vec::new(); + tester.shell_state.get_value(b"Identity", b"Registrars", "", &mut m_rs); - rs.iter().zip(migrated_rs.iter()).for_each(|(r, m_r)| match (r, m_r) { + rs.iter().zip(m_rs.iter()).for_each(|(r, m_r)| match (r, m_r) { (Some(r), Some(m_r)) => { assert_eq!(r.account[..20], m_r.account); assert_eq!(r.fee * GWEI, m_r.fee); From 4c13c4c7ec34438e3a031e3584b619a8e261d21f Mon Sep 17 00:00:00 2001 From: bear Date: Thu, 9 Feb 2023 20:17:29 +0800 Subject: [PATCH 136/189] Update state storage filter (#273) * Let ethereum go * Update pallet name * Fix --------- Co-authored-by: Xavier Lau --- pallet/message-transact/src/tests/mod.rs | 3 ++- precompile/state-storage/src/lib.rs | 6 +++--- precompile/state-storage/src/mock.rs | 2 +- runtime/crab/src/pallets/bridge_dispatch.rs | 6 ++++-- runtime/crab/src/pallets/evm.rs | 2 +- runtime/crab/src/pallets/polkadot_xcm.rs | 5 ++++- runtime/crab/src/pallets/transaction_payment.rs | 3 ++- runtime/darwinia/src/pallets/bridge_dispatch.rs | 6 ++++-- runtime/darwinia/src/pallets/evm.rs | 2 +- runtime/darwinia/src/pallets/polkadot_xcm.rs | 5 ++++- runtime/darwinia/src/pallets/transaction_payment.rs | 3 ++- runtime/pangolin/src/pallets/evm.rs | 2 +- runtime/pangolin/src/pallets/polkadot_xcm.rs | 5 ++++- runtime/pangolin/src/pallets/transaction_payment.rs | 3 ++- 14 files changed, 35 insertions(+), 18 deletions(-) diff --git a/pallet/message-transact/src/tests/mod.rs b/pallet/message-transact/src/tests/mod.rs index 412a3a423..504962de0 100644 --- a/pallet/message-transact/src/tests/mod.rs +++ b/pallet/message-transact/src/tests/mod.rs @@ -38,7 +38,8 @@ pub(crate) const TEST_SPEC_VERSION: SpecVersion = 0; pub(crate) type SubChainId = [u8; 4]; pub(crate) const SOURCE_CHAIN_ID: SubChainId = *b"srce"; pub(crate) const TARGET_CHAIN_ID: SubChainId = *b"trgt"; -pub(crate) const TEST_WEIGHT: frame_support::weights::Weight = frame_support::weights::Weight::from_ref_time(1_000_000_000_000); +pub(crate) const TEST_WEIGHT: frame_support::weights::Weight = + frame_support::weights::Weight::from_ref_time(1_000_000_000_000); // This ERC-20 contract mints the maximum amount of tokens to the contract creator. // pragma solidity ^0.5.0; diff --git a/precompile/state-storage/src/lib.rs b/precompile/state-storage/src/lib.rs index 5eb34cf30..26051e2c3 100644 --- a/precompile/state-storage/src/lib.rs +++ b/precompile/state-storage/src/lib.rs @@ -63,9 +63,9 @@ where } } -pub struct EthereumStorageFilter; -impl StorageFilterT for EthereumStorageFilter { +pub struct StateStorageFilter; +impl StorageFilterT for StateStorageFilter { fn allow(prefix: &[u8]) -> bool { - prefix != Twox128::hash(b"EVM") && prefix != Twox128::hash(b"Ethereum") + prefix != Twox128::hash(b"Evm") } } diff --git a/precompile/state-storage/src/mock.rs b/precompile/state-storage/src/mock.rs index bed68beed..a16bd2ed5 100644 --- a/precompile/state-storage/src/mock.rs +++ b/precompile/state-storage/src/mock.rs @@ -166,7 +166,7 @@ frame_support::construct_runtime! { System: frame_system, Timestamp: pallet_timestamp, Balances: pallet_balances, - EVM: pallet_evm, + Evm: pallet_evm, } } diff --git a/runtime/crab/src/pallets/bridge_dispatch.rs b/runtime/crab/src/pallets/bridge_dispatch.rs index b89d78a20..1f54382a2 100644 --- a/runtime/crab/src/pallets/bridge_dispatch.rs +++ b/runtime/crab/src/pallets/bridge_dispatch.rs @@ -34,7 +34,8 @@ impl bp_message_dispatch::CallValidate fo let total_payment = darwinia_message_transact::total_payment::((&**tx).into()); let relayer = - pallet_evm::Pallet::::account_basic(&sp_core::H160(relayer_account.0)).0; + pallet_evm::Pallet::::account_basic(&sp_core::H160(relayer_account.0)) + .0; frame_support::ensure!(relayer.balance >= total_payment, "Insufficient balance"); Ok(()) @@ -87,7 +88,8 @@ impl bp_message_dispatch::IntoDispatchOrigin darwinia_message_transact::LcmpEthOrigin::MessageTransact(sp_core::H160(id.0)).into(), + }) => darwinia_message_transact::LcmpEthOrigin::MessageTransact(sp_core::H160(id.0)) + .into(), _ => frame_system::RawOrigin::Signed(*id).into(), } } diff --git a/runtime/crab/src/pallets/evm.rs b/runtime/crab/src/pallets/evm.rs index 38982cf37..1265be053 100644 --- a/runtime/crab/src/pallets/evm.rs +++ b/runtime/crab/src/pallets/evm.rs @@ -143,7 +143,7 @@ where // Darwinia precompiles: [1024, 2048) for stable precompiles. a if a == addr(1024) => Some(>::execute(handle)), a if a == addr(1025) => Some(>::execute(handle)), diff --git a/runtime/crab/src/pallets/polkadot_xcm.rs b/runtime/crab/src/pallets/polkadot_xcm.rs index 4d0b7ba09..ba6375318 100644 --- a/runtime/crab/src/pallets/polkadot_xcm.rs +++ b/runtime/crab/src/pallets/polkadot_xcm.rs @@ -135,7 +135,10 @@ impl xcm_executor::Config for XcmExecutorConfig { type RuntimeCall = RuntimeCall; type SubscriptionService = PolkadotXcm; type Trader = xcm_configs::LocalAssetTrader< - frame_support::weights::ConstantMultiplier, + frame_support::weights::ConstantMultiplier< + Balance, + darwinia_common_runtime::xcm_configs::XcmBaseWeightFee, + >, AnchoringSelfReserve, AccountId, Balances, diff --git a/runtime/crab/src/pallets/transaction_payment.rs b/runtime/crab/src/pallets/transaction_payment.rs index 6080dfeba..63620c02c 100644 --- a/runtime/crab/src/pallets/transaction_payment.rs +++ b/runtime/crab/src/pallets/transaction_payment.rs @@ -22,7 +22,8 @@ use crate::*; impl pallet_transaction_payment::Config for Runtime { type FeeMultiplierUpdate = polkadot_runtime_common::SlowAdjustingFeeUpdate; // Relay Chain `TransactionByteFee` / 10 - type LengthToFee = frame_support::weights::ConstantMultiplier>; + type LengthToFee = + frame_support::weights::ConstantMultiplier>; type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter>; type OperationalFeeMultiplier = sp_runtime::traits::ConstU8<5>; diff --git a/runtime/darwinia/src/pallets/bridge_dispatch.rs b/runtime/darwinia/src/pallets/bridge_dispatch.rs index 4db969007..f6cf7ea3d 100644 --- a/runtime/darwinia/src/pallets/bridge_dispatch.rs +++ b/runtime/darwinia/src/pallets/bridge_dispatch.rs @@ -34,7 +34,8 @@ impl bp_message_dispatch::CallValidate fo let total_payment = darwinia_message_transact::total_payment::((&**tx).into()); let relayer = - pallet_evm::Pallet::::account_basic(&sp_core::H160(relayer_account.0)).0; + pallet_evm::Pallet::::account_basic(&sp_core::H160(relayer_account.0)) + .0; frame_support::ensure!(relayer.balance >= total_payment, "Insufficient balance"); Ok(()) @@ -87,7 +88,8 @@ impl bp_message_dispatch::IntoDispatchOrigin darwinia_message_transact::LcmpEthOrigin::MessageTransact(sp_core::H160(id.0)).into(), + }) => darwinia_message_transact::LcmpEthOrigin::MessageTransact(sp_core::H160(id.0)) + .into(), _ => frame_system::RawOrigin::Signed(*id).into(), } } diff --git a/runtime/darwinia/src/pallets/evm.rs b/runtime/darwinia/src/pallets/evm.rs index a5f35c3e2..1603052a3 100644 --- a/runtime/darwinia/src/pallets/evm.rs +++ b/runtime/darwinia/src/pallets/evm.rs @@ -143,7 +143,7 @@ where // Darwinia precompiles: [1024, 2048) for stable precompiles. a if a == addr(1024) => Some(>::execute(handle)), a if a == addr(1025) => Some(>::execute(handle)), diff --git a/runtime/darwinia/src/pallets/polkadot_xcm.rs b/runtime/darwinia/src/pallets/polkadot_xcm.rs index cb15c743a..7eb1fbefa 100644 --- a/runtime/darwinia/src/pallets/polkadot_xcm.rs +++ b/runtime/darwinia/src/pallets/polkadot_xcm.rs @@ -135,7 +135,10 @@ impl xcm_executor::Config for XcmExecutorConfig { type RuntimeCall = RuntimeCall; type SubscriptionService = PolkadotXcm; type Trader = xcm_configs::LocalAssetTrader< - frame_support::weights::ConstantMultiplier, + frame_support::weights::ConstantMultiplier< + Balance, + darwinia_common_runtime::xcm_configs::XcmBaseWeightFee, + >, AnchoringSelfReserve, AccountId, Balances, diff --git a/runtime/darwinia/src/pallets/transaction_payment.rs b/runtime/darwinia/src/pallets/transaction_payment.rs index 6080dfeba..63620c02c 100644 --- a/runtime/darwinia/src/pallets/transaction_payment.rs +++ b/runtime/darwinia/src/pallets/transaction_payment.rs @@ -22,7 +22,8 @@ use crate::*; impl pallet_transaction_payment::Config for Runtime { type FeeMultiplierUpdate = polkadot_runtime_common::SlowAdjustingFeeUpdate; // Relay Chain `TransactionByteFee` / 10 - type LengthToFee = frame_support::weights::ConstantMultiplier>; + type LengthToFee = + frame_support::weights::ConstantMultiplier>; type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter>; type OperationalFeeMultiplier = sp_runtime::traits::ConstU8<5>; diff --git a/runtime/pangolin/src/pallets/evm.rs b/runtime/pangolin/src/pallets/evm.rs index 821ea50c1..dd75c0bf0 100644 --- a/runtime/pangolin/src/pallets/evm.rs +++ b/runtime/pangolin/src/pallets/evm.rs @@ -143,7 +143,7 @@ where // Darwinia precompiles: [1024, 2048) for stable precompiles. a if a == addr(1024) => Some(>::execute(handle)), a if a == addr(1025) => Some(>::execute(handle)), diff --git a/runtime/pangolin/src/pallets/polkadot_xcm.rs b/runtime/pangolin/src/pallets/polkadot_xcm.rs index 2b64726c0..4aec5bbe3 100644 --- a/runtime/pangolin/src/pallets/polkadot_xcm.rs +++ b/runtime/pangolin/src/pallets/polkadot_xcm.rs @@ -135,7 +135,10 @@ impl xcm_executor::Config for XcmExecutorConfig { type RuntimeCall = RuntimeCall; type SubscriptionService = PolkadotXcm; type Trader = xcm_configs::LocalAssetTrader< - frame_support::weights::ConstantMultiplier, + frame_support::weights::ConstantMultiplier< + Balance, + darwinia_common_runtime::xcm_configs::XcmBaseWeightFee, + >, AnchoringSelfReserve, AccountId, Balances, diff --git a/runtime/pangolin/src/pallets/transaction_payment.rs b/runtime/pangolin/src/pallets/transaction_payment.rs index 6080dfeba..63620c02c 100644 --- a/runtime/pangolin/src/pallets/transaction_payment.rs +++ b/runtime/pangolin/src/pallets/transaction_payment.rs @@ -22,7 +22,8 @@ use crate::*; impl pallet_transaction_payment::Config for Runtime { type FeeMultiplierUpdate = polkadot_runtime_common::SlowAdjustingFeeUpdate; // Relay Chain `TransactionByteFee` / 10 - type LengthToFee = frame_support::weights::ConstantMultiplier>; + type LengthToFee = + frame_support::weights::ConstantMultiplier>; type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter>; type OperationalFeeMultiplier = sp_runtime::traits::ConstU8<5>; From 1a63edb658d29a044fa20b6223f1b8451096b3ff Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Thu, 9 Feb 2023 21:31:35 +0800 Subject: [PATCH 137/189] Manage runtime through features (#274) * Format * Manage runtime through features --- .github/workflows/checks.yml | 2 +- .github/workflows/staging.yml | 176 ++++++++++++------------ node/Cargo.toml | 72 ++++++---- node/src/chain_spec/mod.rs | 46 +++++-- node/src/command.rs | 179 ++++++++++++++++++------- node/src/service/executors.rs | 6 + node/src/service/mod.rs | 12 +- runtime/crab/src/lib.rs | 5 +- runtime/crab/src/pallets/aura.rs | 2 +- runtime/darwinia/src/lib.rs | 5 +- runtime/darwinia/src/pallets/aura.rs | 2 +- runtime/pangolin/src/lib.rs | 5 +- runtime/pangolin/src/pallets/aura.rs | 2 +- tool/state-processor/src/system/mod.rs | 2 +- 14 files changed, 325 insertions(+), 191 deletions(-) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index b97dafdcd..b0f64fd44 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -65,7 +65,7 @@ jobs: key: sccache-${{ matrix.action }}-${{ env.GITHUB_CACHE_VERSION }}-${{ hashFiles('**/Cargo.lock') }} restore-keys: sccache-${{ matrix.action }}-${{ env.GITHUB_CACHE_VERSION }}- - name: Action ${{ matrix.action }} - run: cargo ${{ matrix.action }} --release --locked --features all-native + run: cargo ${{ matrix.action }} --release --locked --features all-natives - name: Change path if: matrix.action != 'test' run: mv target/release/darwinia . diff --git a/.github/workflows/staging.yml b/.github/workflows/staging.yml index 3c255a531..7c3e9cd29 100644 --- a/.github/workflows/staging.yml +++ b/.github/workflows/staging.yml @@ -1,91 +1,85 @@ -name: Staging - -on: - push: - branches: [ main ] - workflow_dispatch: - -env: - DOCKER_REGISTRY: ghcr.io - -jobs: - build-package: - name: Build package [linux] - runs-on: ubuntu-latest - container: - image: ubuntu:18.04 - steps: - - uses: actions/checkout@v3 - - - name: Install dependencies - run: | - apt update -y - apt install --no-install-recommends -y \ - ca-certificates curl git python3-pip \ - clang make gcc g++ protobuf-compiler - pip3 install --upgrade pip - pip3 install cmake --upgrade - - - name: Install Rust toolchain - uses: actions-rs/toolchain@v1 - with: - toolchain: nightly - - - name: Build - uses: actions-rs/cargo@v1 - with: - command: build - args: --release --locked - - - name: Collect shared - run: | - mkdir -p shared - tar cjSf \ - shared/darwinia2-x86_64-linux-gnu.tar.bz2 \ - -C \ - target/release \ - darwinia - - name: Upload shared - uses: actions/upload-artifact@v2 - with: - name: darwinia-artifact - path: shared - - - build-docker-image: - name: Build image - runs-on: ubuntu-latest - needs: [build-package] - steps: - - name: Fetch latest code - uses: actions/checkout@v3 - - - uses: benjlevesque/short-sha@v1.2 - - - name: Docker login - uses: docker/login-action@v1 - with: - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - registry: ${{ env.DOCKER_REGISTRY }} - - - name: Download shared - uses: actions/download-artifact@v2 - with: - name: darwinia-artifact - path: shared - - - name: Extract shared - run: | - mkdir -p dist - tar -xvf shared/darwinia2-x86_64-linux-gnu.tar.bz2 -C dist/ - - - name: Publish docker image - uses: docker/build-push-action@v3 - with: - push: true - context: . - file: .maintain/docker/Dockerfile - tags: ${{ env.DOCKER_REGISTRY }}/${{ github.repository }}:sha-${{ env.SHA }} - - +name: Staging + +on: + push: + branches: [main] + workflow_dispatch: + +env: + DOCKER_REGISTRY: ghcr.io + +jobs: + build-package: + name: Build package [linux] + runs-on: ubuntu-latest + container: + image: ubuntu:18.04 + steps: + - uses: actions/checkout@v3 + + - name: Install dependencies + run: | + apt update -y + apt install --no-install-recommends -y \ + ca-certificates curl git python3-pip \ + clang make gcc g++ protobuf-compiler + pip3 install --upgrade pip + pip3 install cmake --upgrade + + - name: Install Rust toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: nightly + + - name: Build + run: cargo build --release --locked --features all-natives + + - name: Collect shared + run: | + mkdir -p shared + tar cjSf \ + shared/darwinia2-x86_64-linux-gnu.tar.bz2 \ + -C \ + target/release \ + darwinia + - name: Upload shared + uses: actions/upload-artifact@v2 + with: + name: darwinia-artifact + path: shared + + build-docker-image: + name: Build image + runs-on: ubuntu-latest + needs: [build-package] + steps: + - name: Fetch latest code + uses: actions/checkout@v3 + + - uses: benjlevesque/short-sha@v1.2 + + - name: Docker login + uses: docker/login-action@v1 + with: + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + registry: ${{ env.DOCKER_REGISTRY }} + + - name: Download shared + uses: actions/download-artifact@v2 + with: + name: darwinia-artifact + path: shared + + - name: Extract shared + run: | + mkdir -p dist + tar -xvf shared/darwinia2-x86_64-linux-gnu.tar.bz2 -C dist/ + + - name: Publish docker image + uses: docker/build-push-action@v3 + with: + push: true + context: . + file: .maintain/docker/Dockerfile + tags: ${{ env.DOCKER_REGISTRY }}/${{ github.repository }}:sha-${{ env.SHA }} diff --git a/node/Cargo.toml b/node/Cargo.toml index d2f622827..b3f12eeb4 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -24,21 +24,21 @@ log = { version = "0.4" } serde = { version = "1.0", features = ["derive"] } # cumulus -cumulus-client-cli = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.36" } -cumulus-client-collator = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.36" } -cumulus-client-consensus-aura = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.36" } -cumulus-client-consensus-common = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.36" } -cumulus-client-network = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.36" } -cumulus-client-service = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.36" } -cumulus-primitives-core = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.36" } -cumulus-primitives-parachain-inherent = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.36" } -cumulus-relay-chain-interface = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.36" } +cumulus-client-cli = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.36" } +cumulus-client-collator = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.36" } +cumulus-client-consensus-aura = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.36" } +cumulus-client-consensus-common = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.36" } +cumulus-client-network = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.36" } +cumulus-client-service = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.36" } +cumulus-primitives-core = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.36" } +cumulus-primitives-parachain-inherent = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.36" } +cumulus-relay-chain-interface = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.36" } # darwinia -crab-runtime = { path = "../runtime/crab" } -darwinia-runtime = { path = "../runtime/darwinia" } +crab-runtime = { optional = true, path = "../runtime/crab" } +darwinia-runtime = { optional = true, path = "../runtime/darwinia" } dc-primitives = { path = "../core/primitives" } -pangolin-runtime = { path = "../runtime/pangolin" } +pangolin-runtime = { optional = true, path = "../runtime/pangolin" } # frontier fc-cli = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } @@ -97,16 +97,26 @@ sp-timestamp = { git = "https://github.com/paritytech/substrat sp-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } substrate-frame-rpc-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } substrate-prometheus-endpoint = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -try-runtime-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36", optional = true} +try-runtime-cli = { optional = true, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } [features] -default = [] +default = [ + "crab-native", + "darwinia-native", +] -fast-runtime = [] +fast-runtime = [ + # darwinia + "crab-runtime?/fast-runtime", + "darwinia-runtime?/fast-runtime", + "pangolin-runtime?/fast-runtime", +] runtime-benchmarks = [ # darwinia - "darwinia-runtime/runtime-benchmarks", + "crab-runtime?/runtime-benchmarks", + "darwinia-runtime?/runtime-benchmarks", + "pangolin-runtime?/runtime-benchmarks", # polkadot "polkadot-cli/runtime-benchmarks", @@ -114,24 +124,38 @@ runtime-benchmarks = [ try-runtime = [ # darwinia - "crab-runtime/try-runtime", - "darwinia-runtime/try-runtime", - "pangolin-runtime/try-runtime", + "crab-runtime?/try-runtime", + "darwinia-runtime?/try-runtime", + "pangolin-runtime?/try-runtime", # substrate "try-runtime-cli/try-runtime", ] -all-native = [ +all-natives = [ # darwinia - "kusama-native", - "rococo-native", + "crab-native", + "darwinia-native", + "pangolin-native", ] -kusama-native = [ +crab-native = [ + # darwinia + "crab-runtime", + # polkadot "polkadot-cli/kusama-native", ] -rococo-native = [ +darwinia-native = [ + # darwinia + "darwinia-runtime", + + # polkadot + "polkadot-cli/polkadot-native", +] +pangolin-native = [ + # darwinia + "pangolin-runtime", + # polkadot "polkadot-cli/rococo-native", ] diff --git a/node/src/chain_spec/mod.rs b/node/src/chain_spec/mod.rs index 5f3478017..c8407eaa9 100644 --- a/node/src/chain_spec/mod.rs +++ b/node/src/chain_spec/mod.rs @@ -18,14 +18,39 @@ #![allow(clippy::derive_partial_eq_without_eq)] +#[cfg(feature = "darwinia-native")] pub mod darwinia; +#[cfg(feature = "darwinia-native")] pub use darwinia::{self as darwinia_chain_spec, ChainSpec as DarwiniaChainSpec}; +#[cfg(not(feature = "darwinia-native"))] +pub type DarwiniaChainSpec = DummyChainSpec; +#[cfg(feature = "crab-native")] pub mod crab; +#[cfg(feature = "crab-native")] pub use crab::{self as crab_chain_spec, ChainSpec as CrabChainSpec}; +#[cfg(not(feature = "crab-native"))] +pub type CrabChainSpec = DummyChainSpec; +#[cfg(feature = "pangolin-native")] pub mod pangolin; +#[cfg(feature = "pangolin-native")] pub use pangolin::{self as pangolin_chain_spec, ChainSpec as PangolinChainSpec}; +#[cfg(not(feature = "pangolin-native"))] +pub type PangolinChainSpec = DummyChainSpec; + +#[cfg(feature = "pangolin-native")] +mod testnet_keys { + pub const C1: &str = "0x0eef9fabb6eb6fed2ab24a842931f8950426070a"; + pub const C1_AURA: &str = "0xeed007f04d568b2d3bf329945a48c21a8ed030c81ca1dce61ad41c916599f405"; + pub const C2: &str = "0xa858cde8f6cf178786578a3b0becf5c27d18300c"; + pub const C2_AURA: &str = "0x28273ae24cc6048c515e6bcaefe98cbfaa50c69290d70cf8eca1de3329015c2f"; + pub const C3: &str = "0x986b41d07776aa48f6d7a80caad49485f9a71714"; + pub const C3_AURA: &str = "0xe25d860707bd1b88b9851cf40df3af3368cd57e5e82824cabac9c75fe537600f"; + pub const SUDO: &str = "0x2748def2f9c3cfbbb963002935bc6d2e1c36ce2e"; +} +#[cfg(feature = "pangolin-native")] +use testnet_keys::*; // crates.io use serde::{Deserialize, Serialize}; @@ -34,26 +59,21 @@ use sc_chain_spec::{ChainSpecExtension, ChainSpecGroup, Properties}; use sp_consensus_aura::sr25519::AuthorityId as AuraId; use sp_core::{Pair, Public}; -// This is the simplest bytecode to revert without returning any data. -// We will pre-deploy it under all of our precompiles to ensure they can be called from within -// contracts. (PUSH1 0x00 PUSH1 0x00 REVERT) -const REVERT_BYTECODE: [u8; 5] = [0x60, 0x00, 0x60, 0x00, 0xFD]; +// Dummy chain spec, in case when we don't have the native runtime. +#[allow(unused)] +pub type DummyChainSpec = sc_service::GenericChainSpec<(), Extensions>; -// These are devnet-only keys. const ALITH: &str = "0xf24FF3a9CF04c71Dbc94D0b566f7A27B94566cac"; const BALTATHAR: &str = "0x3Cd0A705a2DC65e5b1E1205896BaA2be8A07c6e0"; const CHARLETH: &str = "0x798d4Ba9baf0064Ec19eB4F0a1a45785ae9D6DFc"; const DOROTHY: &str = "0x773539d4Ac0e786233D90A233654ccEE26a613D9"; const ETHAN: &str = "0xFf64d3F6efE2317EE2807d223a0Bdc4c0c49dfDB"; const FAITH: &str = "0xC0F0f4ab324C46e55D02D0033343B4Be8A55532d"; -// These are testnet-only keys. -const C1: &str = "0x0eef9fabb6eb6fed2ab24a842931f8950426070a"; -const C1_AURA: &str = "0xeed007f04d568b2d3bf329945a48c21a8ed030c81ca1dce61ad41c916599f405"; -const C2: &str = "0xa858cde8f6cf178786578a3b0becf5c27d18300c"; -const C2_AURA: &str = "0x28273ae24cc6048c515e6bcaefe98cbfaa50c69290d70cf8eca1de3329015c2f"; -const C3: &str = "0x986b41d07776aa48f6d7a80caad49485f9a71714"; -const C3_AURA: &str = "0xe25d860707bd1b88b9851cf40df3af3368cd57e5e82824cabac9c75fe537600f"; -const SUDO: &str = "0x2748def2f9c3cfbbb963002935bc6d2e1c36ce2e"; + +// This is the simplest bytecode to revert without returning any data. +// We will pre-deploy it under all of our precompiles to ensure they can be called from within +// contracts. (PUSH1 0x00 PUSH1 0x00 REVERT) +const REVERT_BYTECODE: [u8; 5] = [0x60, 0x00, 0x60, 0x00, 0xFD]; // The default XCM version to set in genesis config. const SAFE_XCM_VERSION: u32 = xcm::prelude::XCM_VERSION; diff --git a/node/src/command.rs b/node/src/command.rs index 19aa62e49..b360b3309 100644 --- a/node/src/command.rs +++ b/node/src/command.rs @@ -81,13 +81,22 @@ impl SubstrateCli for Cli { } fn native_runtime_version(spec: &Box) -> &'static RuntimeVersion { + #[cfg(feature = "crab-native")] if spec.is_crab() { - &crab_runtime::VERSION - } else if spec.is_pangolin() { - &pangolin_runtime::VERSION - } else { - &darwinia_runtime::VERSION + return &crab_runtime::VERSION; } + + #[cfg(feature = "pangolin-native")] + if spec.is_pangolin() { + return &pangolin_runtime::VERSION; + } + + #[cfg(feature = "darwinia-native")] + if spec.is_darwinia() { + return &darwinia_runtime::VERSION; + } + + panic!("No runtime feature (crab, darwinia, pangolin) is enabled"); } } @@ -267,27 +276,39 @@ impl CliConfiguration for RelayChainCli { pub fn run() -> Result<()> { /// Creates partial components for the runtimes that are supported by the benchmarks. macro_rules! construct_benchmark_partials { - ($config:expr, $cli:ident, |$partials:ident| $code:expr) => { + ($config:expr, $cli:ident, |$partials:ident| $code:expr) => {{ + #[cfg(feature = "crab-native")] if $config.chain_spec.is_crab() { let $partials = new_partial::( &$config, &$cli.eth_args.build_eth_rpc_config(), )?; - $code - } else if $config.chain_spec.is_pangolin() { + + return $code; + } + + #[cfg(feature = "pangolin-native")] + if $config.chain_spec.is_pangolin() { let $partials = new_partial::( &$config, &$cli.eth_args.build_eth_rpc_config(), )?; - $code - } else { + + return $code; + } + + #[cfg(feature = "darwinia-native")] + if $config.chain_spec.is_darwinia() { let $partials = new_partial::( &$config, &$cli.eth_args.build_eth_rpc_config(), )?; - $code + + return $code; } - }; + + panic!("No runtime feature (polkadot, kusama, westend, rococo) is enabled"); + }}; } macro_rules! construct_async_run { @@ -297,8 +318,9 @@ pub fn run() -> Result<()> { set_default_ss58_version(chain_spec); + #[cfg(feature = "crab-native")] if chain_spec.is_crab() { - runner.async_run(|$config| { + return runner.async_run(|$config| { let $components = service::new_partial::< CrabRuntimeApi, CrabRuntimeExecutor, @@ -307,10 +329,14 @@ pub fn run() -> Result<()> { &$cli.eth_args.build_eth_rpc_config() )?; let task_manager = $components.task_manager; + { $( $code )* }.map(|v| (v, task_manager)) - }) - } else if chain_spec.is_pangolin() { - runner.async_run(|$config| { + }); + } + + #[cfg(feature = "pangolin-native")] + if chain_spec.is_pangolin() { + return runner.async_run(|$config| { let $components = service::new_partial::< PangolinRuntimeApi, PangolinRuntimeExecutor, @@ -319,10 +345,14 @@ pub fn run() -> Result<()> { &$cli.eth_args.build_eth_rpc_config() )?; let task_manager = $components.task_manager; + { $( $code )* }.map(|v| (v, task_manager)) - }) - } else { - runner.async_run(|$config| { + }); + } + + #[cfg(feature = "darwinia-native")] + if chain_spec.is_darwinia() { + return runner.async_run(|$config| { let $components = service::new_partial::< DarwiniaRuntimeApi, DarwiniaRuntimeExecutor, @@ -331,9 +361,12 @@ pub fn run() -> Result<()> { &$cli.eth_args.build_eth_rpc_config() )?; let task_manager = $components.task_manager; + { $( $code )* }.map(|v| (v, task_manager)) - }) + }); } + + panic!("No runtime feature (crab, darwinia, pangolin) is enabled"); }} } @@ -425,28 +458,40 @@ pub fn run() -> Result<()> { let runner = cli.create_runner(cmd)?; runner.sync_run(|config| { + #[cfg(feature = "crab-native")] if config.chain_spec.is_crab() { let PartialComponents { client, other: (frontier_backend, ..), .. } = service::new_partial::( &config, &cli.eth_args.build_eth_rpc_config(), )?; - cmd.run::<_, dc_primitives::Block>(client, frontier_backend) - } else if config.chain_spec.is_pangolin() { + + return cmd.run::<_, dc_primitives::Block>(client, frontier_backend); + } + + #[cfg(feature = "pangolin-native")] + if config.chain_spec.is_pangolin() { let PartialComponents { client, other: (frontier_backend, ..), .. } = service::new_partial::( &config, &cli.eth_args.build_eth_rpc_config(), )?; - cmd.run::<_, dc_primitives::Block>(client, frontier_backend) - } else { + + return cmd.run::<_, dc_primitives::Block>(client, frontier_backend); + } + + #[cfg(feature = "darwinia-native")] + if config.chain_spec.is_darwinia() { let PartialComponents { client, other: (frontier_backend, ..), .. } = service::new_partial::( &config, &cli.eth_args.build_eth_rpc_config(), )?; - cmd.run::<_, dc_primitives::Block>(client, frontier_backend) + + return cmd.run::<_, dc_primitives::Block>(client, frontier_backend); } + + panic!("No runtime feature (polkadot, kusama, westend, rococo) is enabled"); }) }, Some(Subcommand::Benchmark(cmd)) => { @@ -457,13 +502,24 @@ pub fn run() -> Result<()> { BenchmarkCmd::Pallet(cmd) => if cfg!(feature = "runtime-benchmarks") { runner.sync_run(|config| { + #[cfg(feature = "crab-native")] if config.chain_spec.is_crab() { - cmd.run::(config) - } else if config.chain_spec.is_pangolin() { - cmd.run::(config) - } else { - cmd.run::(config) + return cmd.run::(config); } + + #[cfg(feature = "pangolin-native")] + if config.chain_spec.is_pangolin() { + return cmd.run::(config); + } + + #[cfg(feature = "darwinia-native")] + if config.chain_spec.is_darwinia() { + return cmd.run::(config); + } + + panic!( + "No runtime feature (polkadot, kusama, westend, rococo) is enabled" + ); }) } else { Err("Benchmarking wasn't enabled when building the node. \ @@ -492,7 +548,6 @@ pub fn run() -> Result<()> { runner.sync_run(|config| cmd.run(&config, SUBSTRATE_REFERENCE_HARDWARE.clone())), // NOTE: this allows the Client to leniently implement // new benchmark commands without requiring a companion MR. - #[allow(unreachable_patterns)] _ => Err("Benchmarking sub-command unsupported".into()), } }, @@ -582,33 +637,41 @@ pub fn run() -> Result<()> { } if chain_spec.is_dev() { - return if chain_spec.is_crab() { - service::start_dev_node::( + #[cfg(feature = "crab-native")] + if chain_spec.is_crab() { + return service::start_dev_node::( config, ð_rpc_config, ) - .map_err(Into::into) - } else if chain_spec.is_pangolin() { - service::start_dev_node::( + .map_err(Into::into); + } + + #[cfg(feature = "pangolin-native")] + if chain_spec.is_pangolin() { + return service::start_dev_node::( config, ð_rpc_config, ) .map_err(Into::into) - } else { - service::start_dev_node::( + } + + #[cfg(feature = "darwinia-native")] + { + return service::start_dev_node::( config, ð_rpc_config, ) .map_err(Into::into) - }; + } } let polkadot_config = SubstrateCli::create_configuration(&polkadot_cli, &polkadot_cli, tokio_handle) .map_err(|err| format!("Relay chain argument error: {}", err))?; + #[cfg(feature = "crab-native")] if chain_spec.is_crab() { - service::start_parachain_node::( + return service::start_parachain_node::( config, polkadot_config, collator_options, @@ -618,9 +681,12 @@ pub fn run() -> Result<()> { ) .await .map(|r| r.0) - .map_err(Into::into) - } else if chain_spec.is_pangolin() { - service::start_parachain_node::( + .map_err(Into::into); + } + + #[cfg(feature = "pangolin-native")] + if chain_spec.is_pangolin() { + return service::start_parachain_node::( config, polkadot_config, collator_options, @@ -630,9 +696,12 @@ pub fn run() -> Result<()> { ) .await .map(|r| r.0) - .map_err(Into::into) - } else { - service::start_parachain_node::( + .map_err(Into::into); + } + + #[cfg(feature = "darwinia-native")] + if chain_spec.is_darwinia() { + return service::start_parachain_node::( config, polkadot_config, collator_options, @@ -642,8 +711,10 @@ pub fn run() -> Result<()> { ) .await .map(|r| r.0) - .map_err(Into::into) + .map_err(Into::into); } + + panic!("No runtime feature (crab, darwinia, pangolin) is enabled"); }) }, } @@ -661,18 +732,30 @@ fn load_spec(id: &str) -> std::result::Result, String> { id }; - Ok(match id.to_lowercase().as_ref() { + Ok(match id.to_lowercase().as_str() { + #[cfg(feature = "darwinia-native")] "darwinia" => Box::new(darwinia_chain_spec::config()), + #[cfg(feature = "darwinia-native")] "darwinia-genesis" => Box::new(darwinia_chain_spec::genesis_config()), + #[cfg(feature = "darwinia-native")] "darwinia-dev" => Box::new(darwinia_chain_spec::development_config()), + #[cfg(feature = "darwinia-native")] "darwinia-local" => Box::new(darwinia_chain_spec::local_config()), + #[cfg(feature = "crab-native")] "crab" => Box::new(crab_chain_spec::config()), + #[cfg(feature = "crab-native")] "crab-genesis" => Box::new(crab_chain_spec::genesis_config()), + #[cfg(feature = "crab-native")] "crab-dev" => Box::new(crab_chain_spec::development_config()), + #[cfg(feature = "crab-native")] "crab-local" => Box::new(crab_chain_spec::local_config()), + #[cfg(feature = "pangolin-native")] "pangolin" => Box::new(pangolin_chain_spec::config()), + #[cfg(feature = "pangolin-native")] "pangolin-genesis" => Box::new(pangolin_chain_spec::genesis_config()), + #[cfg(feature = "pangolin-native")] "pangolin-dev" => Box::new(pangolin_chain_spec::development_config()), + #[cfg(feature = "pangolin-native")] "pangolin-local" => Box::new(pangolin_chain_spec::local_config()), _ => { let path = PathBuf::from(id); diff --git a/node/src/service/executors.rs b/node/src/service/executors.rs index c1a20db53..f1f71e1ea 100644 --- a/node/src/service/executors.rs +++ b/node/src/service/executors.rs @@ -20,7 +20,9 @@ use sc_executor::{NativeExecutionDispatch, NativeVersion}; /// Darwinia native executor instance. +#[cfg(feature = "darwinia-native")] pub struct DarwiniaRuntimeExecutor; +#[cfg(feature = "darwinia-native")] impl NativeExecutionDispatch for DarwiniaRuntimeExecutor { #[cfg(feature = "runtime-benchmarks")] type ExtendHostFunctions = frame_benchmarking::benchmarking::HostFunctions; @@ -37,7 +39,9 @@ impl NativeExecutionDispatch for DarwiniaRuntimeExecutor { } /// Crab native executor instance. +#[cfg(feature = "crab-native")] pub struct CrabRuntimeExecutor; +#[cfg(feature = "crab-native")] impl NativeExecutionDispatch for CrabRuntimeExecutor { #[cfg(feature = "runtime-benchmarks")] type ExtendHostFunctions = frame_benchmarking::benchmarking::HostFunctions; @@ -54,7 +58,9 @@ impl NativeExecutionDispatch for CrabRuntimeExecutor { } /// Pangolin native executor instance. +#[cfg(feature = "pangolin-native")] pub struct PangolinRuntimeExecutor; +#[cfg(feature = "pangolin-native")] impl NativeExecutionDispatch for PangolinRuntimeExecutor { #[cfg(feature = "runtime-benchmarks")] type ExtendHostFunctions = frame_benchmarking::benchmarking::HostFunctions; diff --git a/node/src/service/mod.rs b/node/src/service/mod.rs index d50bc381f..a53ca98f1 100644 --- a/node/src/service/mod.rs +++ b/node/src/service/mod.rs @@ -23,8 +23,11 @@ pub use executors::*; mod instant_finalize; +#[cfg(feature = "crab-native")] pub use crab_runtime::RuntimeApi as CrabRuntimeApi; +#[cfg(feature = "darwinia-native")] pub use darwinia_runtime::RuntimeApi as DarwiniaRuntimeApi; +#[cfg(feature = "pangolin-native")] pub use pangolin_runtime::RuntimeApi as PangolinRuntimeApi; // std @@ -35,8 +38,8 @@ use std::{ }; // darwinia use crate::frontier_service; -use darwinia_runtime::AuraId; use dc_primitives::*; +use sp_consensus_aura::sr25519::AuthorityId as AuraId; // substrate use sc_consensus::ImportQueue; use sc_network_common::service::NetworkBlock; @@ -58,6 +61,9 @@ pub trait IdentifyVariant { /// Returns if this is a configuration for the `Crab` network. fn is_crab(&self) -> bool; + /// Returns if this is a configuration for the `Darwinia` network. + fn is_darwinia(&self) -> bool; + /// Returns if this is a configuration for the `Pangolin` network. fn is_pangolin(&self) -> bool; @@ -69,6 +75,10 @@ impl IdentifyVariant for Box { self.id().starts_with("crab") } + fn is_darwinia(&self) -> bool { + self.id().starts_with("darwinia") + } + fn is_pangolin(&self) -> bool { self.id().starts_with("pangolin") } diff --git a/runtime/crab/src/lib.rs b/runtime/crab/src/lib.rs index 8558a5c24..55afe2b95 100644 --- a/runtime/crab/src/lib.rs +++ b/runtime/crab/src/lib.rs @@ -34,7 +34,6 @@ mod weights; pub use darwinia_common_runtime::*; pub use dc_primitives::*; -pub use sp_consensus_aura::sr25519::AuthorityId as AuraId; // substrate use sp_std::prelude::*; @@ -235,12 +234,12 @@ bridge_runtime_common::generate_bridge_reject_obsolete_headers_and_messages! { } sp_api::impl_runtime_apis! { - impl sp_consensus_aura::AuraApi for Runtime { + impl sp_consensus_aura::AuraApi for Runtime { fn slot_duration() -> sp_consensus_aura::SlotDuration { sp_consensus_aura::SlotDuration::from_millis(Aura::slot_duration()) } - fn authorities() -> Vec { + fn authorities() -> Vec { Aura::authorities().into_inner() } } diff --git a/runtime/crab/src/pallets/aura.rs b/runtime/crab/src/pallets/aura.rs index acb41b680..1da134500 100644 --- a/runtime/crab/src/pallets/aura.rs +++ b/runtime/crab/src/pallets/aura.rs @@ -20,7 +20,7 @@ use crate::*; impl pallet_aura::Config for Runtime { - type AuthorityId = AuraId; + type AuthorityId = sp_consensus_aura::sr25519::AuthorityId; type DisabledValidators = (); type MaxAuthorities = ConstU32<100_000>; } diff --git a/runtime/darwinia/src/lib.rs b/runtime/darwinia/src/lib.rs index edd48fe39..5159a8746 100644 --- a/runtime/darwinia/src/lib.rs +++ b/runtime/darwinia/src/lib.rs @@ -34,7 +34,6 @@ mod weights; pub use darwinia_common_runtime::*; pub use dc_primitives::*; -pub use sp_consensus_aura::sr25519::AuthorityId as AuraId; // substrate use sp_std::prelude::*; @@ -235,12 +234,12 @@ bridge_runtime_common::generate_bridge_reject_obsolete_headers_and_messages! { } sp_api::impl_runtime_apis! { - impl sp_consensus_aura::AuraApi for Runtime { + impl sp_consensus_aura::AuraApi for Runtime { fn slot_duration() -> sp_consensus_aura::SlotDuration { sp_consensus_aura::SlotDuration::from_millis(Aura::slot_duration()) } - fn authorities() -> Vec { + fn authorities() -> Vec { Aura::authorities().into_inner() } } diff --git a/runtime/darwinia/src/pallets/aura.rs b/runtime/darwinia/src/pallets/aura.rs index acb41b680..1da134500 100644 --- a/runtime/darwinia/src/pallets/aura.rs +++ b/runtime/darwinia/src/pallets/aura.rs @@ -20,7 +20,7 @@ use crate::*; impl pallet_aura::Config for Runtime { - type AuthorityId = AuraId; + type AuthorityId = sp_consensus_aura::sr25519::AuthorityId; type DisabledValidators = (); type MaxAuthorities = ConstU32<100_000>; } diff --git a/runtime/pangolin/src/lib.rs b/runtime/pangolin/src/lib.rs index a425177f3..48e55a1b6 100644 --- a/runtime/pangolin/src/lib.rs +++ b/runtime/pangolin/src/lib.rs @@ -31,7 +31,6 @@ mod weights; pub use darwinia_common_runtime::*; pub use dc_primitives::*; -pub use sp_consensus_aura::sr25519::AuthorityId as AuraId; // substrate use sp_std::prelude::*; @@ -215,12 +214,12 @@ frame_benchmarking::define_benchmarks! { impl_self_contained_call!(); sp_api::impl_runtime_apis! { - impl sp_consensus_aura::AuraApi for Runtime { + impl sp_consensus_aura::AuraApi for Runtime { fn slot_duration() -> sp_consensus_aura::SlotDuration { sp_consensus_aura::SlotDuration::from_millis(Aura::slot_duration()) } - fn authorities() -> Vec { + fn authorities() -> Vec { Aura::authorities().into_inner() } } diff --git a/runtime/pangolin/src/pallets/aura.rs b/runtime/pangolin/src/pallets/aura.rs index acb41b680..1da134500 100644 --- a/runtime/pangolin/src/pallets/aura.rs +++ b/runtime/pangolin/src/pallets/aura.rs @@ -20,7 +20,7 @@ use crate::*; impl pallet_aura::Config for Runtime { - type AuthorityId = AuraId; + type AuthorityId = sp_consensus_aura::sr25519::AuthorityId; type DisabledValidators = (); type MaxAuthorities = ConstU32<100_000>; } diff --git a/tool/state-processor/src/system/mod.rs b/tool/state-processor/src/system/mod.rs index edbbb9d64..75d44ed56 100644 --- a/tool/state-processor/src/system/mod.rs +++ b/tool/state-processor/src/system/mod.rs @@ -119,7 +119,7 @@ where if key.ends_with("000000000000") { if let Some(s) = try_get_sub_seed(&key) { - log::info!("migrate special Account(`{s}`): {key}"); + log::info!("migrate special Account(`{s} {key}`)"); is_special_account = true; } else if key From 6a75a6a25afb6278a89c85223e812bf1d3ac6f30 Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Fri, 10 Feb 2023 17:05:37 +0800 Subject: [PATCH 138/189] Total issuance assertions (#276) --- tool/state-processor/src/system/mod.rs | 13 ++++++++----- tool/state-processor/src/tests.rs | 9 ++++++--- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/tool/state-processor/src/system/mod.rs b/tool/state-processor/src/system/mod.rs index 75d44ed56..009277671 100644 --- a/tool/state-processor/src/system/mod.rs +++ b/tool/state-processor/src/system/mod.rs @@ -20,7 +20,8 @@ where pub fn process_system(&mut self) -> &mut Self { // System storage items. // https://github.dev/darwinia-network/substrate/blob/darwinia-v0.12.5/frame/system/src/lib.rs#L545 - let solo_account_infos = self.process_solo_account_infos(); + let (solo_account_infos, ring_remaining, kton_remaining) = + self.process_solo_account_infos(); let para_account_infos = self.process_para_account_infos(); let (ring_total_issuance_storage, kton_total_issuance_storage) = self.process_balances(); let mut accounts = Map::default(); @@ -77,12 +78,14 @@ where log::info!("`ring_total_issuance({ring_total_issuance})`"); log::info!("`ring_total_issuance_storage({ring_total_issuance_storage})`"); + assert_eq!(ring_total_issuance - ring_remaining, ring_total_issuance_storage); log::info!("set `Balances::TotalIssuance`"); self.shell_state.insert_value(b"Balances", b"TotalIssuance", "", ring_total_issuance); log::info!("`kton_total_issuance({kton_total_issuance})`"); log::info!("`kton_total_issuance_storage({kton_total_issuance_storage})`"); + assert_eq!(kton_total_issuance - kton_remaining, kton_total_issuance_storage); let mut kton_details = AssetDetails { owner: ROOT, @@ -228,7 +231,7 @@ where self } - fn process_solo_account_infos(&mut self) -> Map { + fn process_solo_account_infos(&mut self) -> (Map, Balance, Balance) { let mut account_infos = >::default(); let mut remaining_ring = >::default(); let mut remaining_kton = >::default(); @@ -257,6 +260,8 @@ where ); } }); + log::info!("total_remaining_ring({total_remaining_ring})"); + remaining_kton.into_iter().for_each(|(k, v)| { if let Some(a) = account_infos.get_mut(&k) { total_remaining_kton += v; @@ -268,11 +273,9 @@ where ); } }); - - log::info!("total_remaining_ring({total_remaining_ring})"); log::info!("total_remaining_kton({total_remaining_kton})"); - account_infos + (account_infos, total_remaining_ring, total_remaining_kton) } fn process_para_account_infos(&mut self) -> Map { diff --git a/tool/state-processor/src/tests.rs b/tool/state-processor/src/tests.rs index 2416d4503..eb2df3b54 100644 --- a/tool/state-processor/src/tests.rs +++ b/tool/state-processor/src/tests.rs @@ -318,8 +318,10 @@ fn ring_total_issuance() { &mut migrated_total_issuance, ); - // FIXME: https://github.com/darwinia-network/darwinia-2.0/issues/244 - // assert_eq!(migrated_total_issuance, solo_issuance * GWEI + para_issuance); + assert_eq!( + migrated_total_issuance - 155_223_151_710_u128, + solo_issuance * GWEI + para_issuance + ); }); } @@ -347,7 +349,8 @@ fn kton_total_issuance() { &blake2_128_concat_to_string(KTON_ID.encode()), &mut details, ); - assert!(details.supply - total_issuance * GWEI < 200 * GWEI); + + assert_eq!(details.supply - 4_999_999_999_u128, total_issuance * GWEI); }); } From a661f998c018d717b0fa8401238ab5e107633159 Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Tue, 14 Feb 2023 02:47:59 +0800 Subject: [PATCH 139/189] Process parachain system (#278) --- tool/state-processor/src/main.rs | 1 + .../src/parachain_system/README.md | 3 ++ .../src/parachain_system/mod.rs | 30 +++++++++++++++++++ tool/state-processor/src/processor.rs | 19 ++++++++++-- 4 files changed, 51 insertions(+), 2 deletions(-) create mode 100644 tool/state-processor/src/parachain_system/README.md create mode 100644 tool/state-processor/src/parachain_system/mod.rs diff --git a/tool/state-processor/src/main.rs b/tool/state-processor/src/main.rs index b64393358..41a6ed389 100644 --- a/tool/state-processor/src/main.rs +++ b/tool/state-processor/src/main.rs @@ -16,6 +16,7 @@ use type_registry::*; mod balances; mod evm; mod identity; +mod parachain_system; mod staking; mod system; mod vesting; diff --git a/tool/state-processor/src/parachain_system/README.md b/tool/state-processor/src/parachain_system/README.md new file mode 100644 index 000000000..d06f772f0 --- /dev/null +++ b/tool/state-processor/src/parachain_system/README.md @@ -0,0 +1,3 @@ +### Process steps +- take para `ParachainSystem::LastDmqMqcHead` and `ParachainSystem::LastHrmpMqcHeads` +- set `ParachainSystem::LastDmqMqcHead` and `ParachainSystem::LastHrmpMqcHeads` diff --git a/tool/state-processor/src/parachain_system/mod.rs b/tool/state-processor/src/parachain_system/mod.rs new file mode 100644 index 000000000..df090dd85 --- /dev/null +++ b/tool/state-processor/src/parachain_system/mod.rs @@ -0,0 +1,30 @@ +// darwinia +use crate::*; + +impl Processor { + pub fn process_parachain_system(&mut self) -> &mut Self { + // Storage items. + // https://github.com/darwinia-network/darwinia-2.0/issues/275#issuecomment-1427725708 + // https://github.com/paritytech/cumulus/blob/09418fc04c2608b123f36ca80f16df3d2096753b/pallets/parachain-system/src/lib.rs#L582-L595 + let last_dmq_mqc_head_key = + "0x45323df7cc47150b3930e2666b0aa313911a5dd3f1155f5b7d0c5aa102a757f9"; + let last_hrmp_mqc_heads_key = + "0x45323df7cc47150b3930e2666b0aa3133dca42deb008c6559ee789c9b9f70a2c"; + let mut last_dmq_mqc_head = String::new(); + let mut last_hrmp_mqc_heads = String::new(); + + log::info!( + "take para `ParachainSystem::LastDmqMqcHead` and `ParachainSystem::LastHrmpMqcHeads`" + ); + self.solo_state + .take_raw_value(last_dmq_mqc_head_key, &mut last_dmq_mqc_head) + .take_raw_value(last_hrmp_mqc_heads_key, &mut last_hrmp_mqc_heads); + + log::info!("set `ParachainSystem::LastDmqMqcHead` and `ParachainSystem::LastHrmpMqcHeads`"); + self.shell_state + .insert_raw_key_raw_value(last_dmq_mqc_head_key.into(), last_dmq_mqc_head) + .insert_raw_key_raw_value(last_hrmp_mqc_heads_key.into(), last_hrmp_mqc_heads); + + self + } +} diff --git a/tool/state-processor/src/processor.rs b/tool/state-processor/src/processor.rs index 0c3b86355..26c56b343 100644 --- a/tool/state-processor/src/processor.rs +++ b/tool/state-processor/src/processor.rs @@ -74,7 +74,12 @@ where assert!(*_guard != 0); - self.process_system().process_identity().process_vesting().process_staking().process_evm(); + self.process_parachain_system() + .process_system() + .process_identity() + .process_vesting() + .process_staking() + .process_evm(); self } @@ -192,6 +197,16 @@ impl State { self.map.keys().into_iter().any(|k| k.starts_with(&item_key(pallet, item))) } + pub fn take_raw_value(&mut self, key: &str, value: &mut String) -> &mut Self { + if let Some(v) = self.map.remove(key) { + *value = v; + } else { + log::error!("`key({key})` not found"); + } + + self + } + pub fn take_raw_map( &mut self, prefix: &str, @@ -237,7 +252,7 @@ impl State { } } else { log::error!( - "key not found `{}::{}::{hash}`", + "`key({}::{}::{hash})` not found", String::from_utf8_lossy(pallet), String::from_utf8_lossy(item), ); From efb94401a7aaced843b3e72c962d40bed6091af5 Mon Sep 17 00:00:00 2001 From: bear Date: Tue, 14 Feb 2023 11:12:29 +0800 Subject: [PATCH 140/189] Try workspace's new feature (#277) * Update crate info * Update deps 1 * Update deps 2 * Update deps 3 * Update deps 4 * Format * Fix review --- Cargo.lock | 95 ++----------- Cargo.toml | 181 ++++++++++++++++++++++++ core/inflation/Cargo.toml | 15 +- core/primitives/Cargo.toml | 19 ++- core/types/Cargo.toml | 11 +- node/Cargo.toml | 149 ++++++++++---------- pallet/account-migration/Cargo.toml | 47 +++---- pallet/deposit/Cargo.toml | 39 +++--- pallet/ecdsa-authority/Cargo.toml | 35 +++-- pallet/message-gadget/Cargo.toml | 35 +++-- pallet/message-transact/Cargo.toml | 55 ++++---- pallet/staking/Cargo.toml | 45 +++--- precompile/assets/Cargo.toml | 45 +++--- precompile/bls12-381/Cargo.toml | 37 +++-- precompile/deposit/Cargo.toml | 41 +++--- precompile/staking/Cargo.toml | 46 +++--- precompile/state-storage/Cargo.toml | 39 +++--- runtime/common/Cargo.toml | 37 +++-- runtime/crab/Cargo.toml | 210 ++++++++++++++-------------- runtime/darwinia/Cargo.toml | 207 ++++++++++++++------------- runtime/pangolin/Cargo.toml | 208 ++++++++++++++------------- 21 files changed, 826 insertions(+), 770 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index db93345a4..03d3606ae 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -20,7 +20,7 @@ dependencies = [ "blake2-rfc", "hex", "impl-serde 0.3.2", - "libsecp256k1 0.7.1", + "libsecp256k1", "log", "parity-scale-codec", "scale-info", @@ -439,12 +439,6 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6107fe1be6682a68940da878d9e9f5e90ca5745b3dec9fd1bb393c8777d4f581" -[[package]] -name = "base64" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff" - [[package]] name = "base64" version = "0.13.1" @@ -2324,14 +2318,14 @@ dependencies = [ [[package]] name = "darwinia-ecdsa-authority" -version = "2.10.1" +version = "6.0.0" dependencies = [ "array-bytes 6.0.0", "dc-primitives", "ethabi", "frame-support", "frame-system", - "libsecp256k1 0.7.1", + "libsecp256k1", "parity-scale-codec", "scale-info", "sp-core", @@ -2372,7 +2366,7 @@ dependencies = [ "fp-self-contained", "frame-support", "frame-system", - "libsecp256k1 0.5.0", + "libsecp256k1", "pallet-balances", "pallet-bridge-dispatch", "pallet-ethereum", @@ -2403,7 +2397,7 @@ dependencies = [ "parity-scale-codec", "precompile-utils", "scale-info", - "sha3 0.8.2", + "sha3 0.9.1", "sp-core", "sp-io", "sp-runtime", @@ -3350,7 +3344,7 @@ dependencies = [ "futures", "hex", "jsonrpsee", - "libsecp256k1 0.7.1", + "libsecp256k1", "log", "lru", "parity-scale-codec", @@ -5333,25 +5327,6 @@ dependencies = [ "tikv-jemalloc-sys", ] -[[package]] -name = "libsecp256k1" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd1137239ab33b41aa9637a88a28249e5e70c40a42ccc92db7f12cc356c1fcd7" -dependencies = [ - "arrayref", - "base64 0.12.3", - "digest 0.9.0", - "hmac-drbg", - "libsecp256k1-core 0.2.2", - "libsecp256k1-gen-ecmult 0.2.1", - "libsecp256k1-gen-genmult 0.2.1", - "rand 0.7.3", - "serde", - "sha2 0.9.9", - "typenum 1.16.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "libsecp256k1" version = "0.7.1" @@ -5362,26 +5337,15 @@ dependencies = [ "base64 0.13.1", "digest 0.9.0", "hmac-drbg", - "libsecp256k1-core 0.3.0", - "libsecp256k1-gen-ecmult 0.3.0", - "libsecp256k1-gen-genmult 0.3.0", + "libsecp256k1-core", + "libsecp256k1-gen-ecmult", + "libsecp256k1-gen-genmult", "rand 0.8.5", "serde", "sha2 0.9.9", "typenum 1.16.0 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "libsecp256k1-core" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0f6ab710cec28cef759c5f18671a27dae2a5f952cdaaee1d8e2908cb2478a80" -dependencies = [ - "crunchy", - "digest 0.9.0", - "subtle", -] - [[package]] name = "libsecp256k1-core" version = "0.3.0" @@ -5393,31 +5357,13 @@ dependencies = [ "subtle", ] -[[package]] -name = "libsecp256k1-gen-ecmult" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccab96b584d38fac86a83f07e659f0deafd0253dc096dab5a36d53efe653c5c3" -dependencies = [ - "libsecp256k1-core 0.2.2", -] - [[package]] name = "libsecp256k1-gen-ecmult" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3038c808c55c87e8a172643a7d87187fc6c4174468159cb3090659d55bcb4809" dependencies = [ - "libsecp256k1-core 0.3.0", -] - -[[package]] -name = "libsecp256k1-gen-genmult" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67abfe149395e3aa1c48a2beb32b068e2334402df8181f818d3aee2b304c4f5d" -dependencies = [ - "libsecp256k1-core 0.2.2", + "libsecp256k1-core", ] [[package]] @@ -5426,7 +5372,7 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3db8d6ba2cec9eacc40e6e8ccc98931840301f1006e95647ceb2dd5c3aa06f7c" dependencies = [ - "libsecp256k1-core 0.3.0", + "libsecp256k1-core", ] [[package]] @@ -8680,7 +8626,7 @@ dependencies = [ "frame-support", "frame-system", "impl-trait-for-tuples", - "libsecp256k1 0.7.1", + "libsecp256k1", "log", "pallet-authorship", "pallet-babe", @@ -11172,19 +11118,6 @@ dependencies = [ "digest 0.10.6", ] -[[package]] -name = "sha3" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd26bc0e7a2e3a7c959bc494caf58b72ee0c71d67704e9520f736ca7e4853ecf" -dependencies = [ - "block-buffer 0.7.3", - "byte-tools", - "digest 0.8.1", - "keccak", - "opaque-debug 0.2.3", -] - [[package]] name = "sha3" version = "0.9.1" @@ -11609,7 +11542,7 @@ dependencies = [ "hash256-std-hasher", "impl-serde 0.4.0", "lazy_static", - "libsecp256k1 0.7.1", + "libsecp256k1", "log", "merlin", "num-traits", @@ -11733,7 +11666,7 @@ dependencies = [ "ed25519-dalek", "futures", "hash-db", - "libsecp256k1 0.7.1", + "libsecp256k1", "log", "parity-scale-codec", "parking_lot 0.12.1", diff --git a/Cargo.toml b/Cargo.toml index 1310fe082..8ffe5daa7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,14 @@ [profile.release] panic = "unwind" +[workspace.package] +authors = ["Darwinia Network "] +edition = "2021" +homepage = "https://darwinia.network" +license = "GPL-3.0" +repository = "https://github.com/darwinia-network/darwinia" +version = "6.0.0" + [workspace] members = [ "core/*", @@ -10,6 +18,179 @@ members = [ "runtime/*", ] +[workspace.dependencies] +# crates.io +array-bytes = { version = "6.0" } +codec = { package = "parity-scale-codec", version = "3.3", default-features = false, features = ["derive"] } +libsecp256k1 = { version = "0.7" } +scale-info = { version = "2.3", default-features = false, features = ["derive"] } +sha3 = { version = "0.9" } +static_assertions = { version = "1.1" } + +# cumulus +cumulus-pallet-aura-ext = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } +cumulus-pallet-dmp-queue = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } +cumulus-pallet-parachain-system = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } +cumulus-pallet-session-benchmarking = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } +cumulus-pallet-xcm = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } +cumulus-pallet-xcmp-queue = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } +cumulus-primitives-core = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } +cumulus-primitives-timestamp = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } +cumulus-primitives-utility = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } +parachain-info = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } +cumulus-client-cli = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.36" } +cumulus-client-collator = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.36" } +cumulus-client-consensus-aura = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.36" } +cumulus-client-consensus-common = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.36" } +cumulus-client-network = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.36" } +cumulus-client-service = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.36" } +cumulus-primitives-parachain-inherent = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.36" } +cumulus-relay-chain-interface = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.36" } + +# darwinia +dc-types = { path = "core/types" } +darwinia-account-migration = { default-features = false, path = "pallet/account-migration" } +darwinia-common-runtime = { default-features = false, path = "runtime/common" } +darwinia-deposit = { default-features = false, path = "pallet/deposit" } +darwinia-ecdsa-authority = { default-features = false, path = "pallet/ecdsa-authority" } +darwinia-message-gadget = { default-features = false, path = "pallet/message-gadget" } +darwinia-message-transact = { default-features = false, path = "pallet/message-transact" } +darwinia-precompile-assets = { default-features = false, path = "precompile/assets" } +darwinia-precompile-bls12-381 = { default-features = false, path = "precompile/bls12-381" } +darwinia-precompile-deposit = { default-features = false, path = "precompile/deposit" } +darwinia-precompile-staking = { default-features = false, path = "precompile/staking" } +darwinia-precompile-state-storage = { default-features = false, path = "precompile/state-storage" } +darwinia-staking = { default-features = false, path = "pallet/staking" } +dc-primitives = { default-features = false, path = "core/primitives" } +dc-inflation = { default-features = false, path = "core/inflation" } +crab-runtime = { path = "runtime/crab" } +darwinia-runtime = { path = "runtime/darwinia" } +pangolin-runtime = { path = "runtime/pangolin" } + +# darwinia-messages-substrate +bp-darwinia-core = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } +bp-messages = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } +bp-message-dispatch = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } +bp-polkadot-core = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } +bp-runtime = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } +bridge-runtime-common = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } +pallet-bridge-dispatch = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } +pallet-bridge-grandpa = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } +pallet-bridge-messages = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } +pallet-bridge-parachains = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } +pallet-fee-market = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } + +# frontier +fp-ethereum = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } +fp-evm = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } +fp-self-contained = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } +fp-rpc = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } +pallet-ethereum = { default-features = false, features = ["forbid-evm-reentrancy"], git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } +pallet-evm = { default-features = false, features = ["forbid-evm-reentrancy"], git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } +pallet-evm-precompile-blake2 = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } +pallet-evm-precompile-bn128 = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } +pallet-evm-precompile-dispatch = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } +pallet-evm-precompile-modexp = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } +pallet-evm-precompile-simple = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } +fc-cli = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } +fc-consensus = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } +fc-db = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } +fc-mapping-sync = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } +fc-rpc = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } +fc-rpc-core = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } +fp-storage = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } + +# moonbeam +account = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.36" } +precompile-utils = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.36" } +xcm-primitives = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.36" } + +# polkadot +pallet-xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36" } +polkadot-parachain = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36" } +polkadot-runtime-common = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36" } +xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36" } +xcm-builder = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36" } +xcm-executor = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36" } +polkadot-cli = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36" } +polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36" } +polkadot-service = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36" } + +# substrate +frame-benchmarking = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +frame-executive = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +frame-system-benchmarking = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +frame-system-rpc-runtime-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +frame-try-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-assets = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-aura = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-authorship = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-balances = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-collective = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-democracy = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-elections-phragmen = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-identity = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-membership = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-multisig = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-preimage = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-proxy = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-scheduler = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-session = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-sudo = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-timestamp = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-tips = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-transaction-payment = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-transaction-payment-rpc-runtime-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-treasury = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-utility = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-vesting = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-arithmetic = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-block-builder = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-consensus-aura = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-inherents = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-io = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-keyring = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-offchain = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-session = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-transaction-pool = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-version = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +frame-benchmarking-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-transaction-payment-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sc-basic-authorship = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sc-chain-spec = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sc-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sc-consensus-aura = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sc-executor = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sc-keystore = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sc-network = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sc-network-common = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sc-offchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sc-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sc-rpc-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sc-service = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sc-sysinfo = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sc-telemetry = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sc-tracing = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sc-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sc-transaction-pool-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-consensus = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +substrate-frame-rpc-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +substrate-prometheus-endpoint = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +substrate-build-script-utils = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +try-runtime-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } + [patch."https://github.com/paritytech/substrate"] beefy-gadget = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } beefy-gadget-rpc = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } diff --git a/core/inflation/Cargo.toml b/core/inflation/Cargo.toml index fab9422d6..cb516fb9c 100644 --- a/core/inflation/Cargo.toml +++ b/core/inflation/Cargo.toml @@ -1,26 +1,23 @@ [package] -authors = ["Darwinia Network "] -description = "Darwinia economic inflation mechanism implementation." -edition = "2021" -homepage = "https://darwinia.network" -license = "GPL-3.0" name = "dc-inflation" +description = "Darwinia economic inflation mechanism implementation." readme = "README.md" -repository = "https://github.com/darwinia-network/darwinia" -version = "6.0.0" +authors = { workspace = true } +edition = { workspace = true } +version = { workspace = true } [dependencies] # crates.io primitive-types = { version = "0.12", default-features = false } # darwinia -dc-types = { path = "../types" } +dc-types = { workspace = true } # github substrate-fixed = { default-features = false, git = "https://github.com/encointer/substrate-fixed" } [dev-dependencies] -sp-arithmetic = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-arithmetic = { workspace = true } [features] default = ["std"] diff --git a/core/primitives/Cargo.toml b/core/primitives/Cargo.toml index 06bfcfe0f..d984ac6e7 100644 --- a/core/primitives/Cargo.toml +++ b/core/primitives/Cargo.toml @@ -1,24 +1,21 @@ [package] -authors = ["Darwinia Network "] -description = "Darwinia chain core primitives." -edition = "2021" -homepage = "https://darwinia.network" -license = "GPL-3.0" name = "dc-primitives" +description = "Darwinia chain core primitives." readme = "README.md" -repository = "https://github.com/darwinia-network/darwinia" -version = "6.0.0" +authors = { workspace = true } +edition = { workspace = true } +version = { workspace = true } [dependencies] # darwinia -dc-types = { path = "../types" } +dc-types = { workspace = true } # moonbeam -account = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.36" } +account = { workspace = true } # substrate -sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-core = { workspace = true } +sp-runtime = { workspace = true } [features] default = ["std"] diff --git a/core/types/Cargo.toml b/core/types/Cargo.toml index ddacce0de..029b234e0 100644 --- a/core/types/Cargo.toml +++ b/core/types/Cargo.toml @@ -1,10 +1,7 @@ [package] -authors = ["Darwinia Network "] -description = "Darwinia core types." -edition = "2021" -homepage = "https://darwinia.network" -license = "GPL-3.0" name = "dc-types" +description = "Darwinia core types." readme = "README.md" -repository = "https://github.com/darwinia-network/darwinia" -version = "6.0.0" +authors = { workspace = true } +edition = { workspace = true } +version = { workspace = true } diff --git a/node/Cargo.toml b/node/Cargo.toml index b3f12eeb4..b34834439 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -1,103 +1,100 @@ [package] -authors = ["Darwinia Network "] -description = "Darwinia node." -edition = "2021" -homepage = "https://darwinia.network" -license = "GPL-3.0" name = "darwinia" +description = "Darwinia node." readme = "README.md" -repository = "https://github.com/darwinia-network/darwinia" -version = "6.0.0" +authors = { workspace = true } +edition = { workspace = true } +version = { workspace = true } [build-dependencies] -substrate-build-script-utils = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +substrate-build-script-utils = { workspace = true } [dependencies] # crates.io -array-bytes = { version = "6.0" } +array-bytes = { workspace = true } async-trait = { version = "0.1" } clap = { version = "4.0", features = ["derive"] } -codec = { package = "parity-scale-codec", version = "3.3" } +codec = { package = "parity-scale-codec", workspace = true } futures = { version = "0.3" } jsonrpsee = { version = "0.16", features = ["server"] } log = { version = "0.4" } serde = { version = "1.0", features = ["derive"] } # cumulus -cumulus-client-cli = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.36" } -cumulus-client-collator = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.36" } -cumulus-client-consensus-aura = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.36" } -cumulus-client-consensus-common = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.36" } -cumulus-client-network = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.36" } -cumulus-client-service = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.36" } -cumulus-primitives-core = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.36" } -cumulus-primitives-parachain-inherent = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.36" } -cumulus-relay-chain-interface = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.36" } +cumulus-client-cli = { workspace = true } +cumulus-client-collator = { workspace = true } +cumulus-client-consensus-aura = { workspace = true } +cumulus-client-consensus-common = { workspace = true } +cumulus-client-network = { workspace = true } +cumulus-client-service = { workspace = true } +cumulus-primitives-core = { workspace = true, features = ["std"] } +cumulus-primitives-parachain-inherent = { workspace = true } +cumulus-relay-chain-interface = { workspace = true } # darwinia -crab-runtime = { optional = true, path = "../runtime/crab" } -darwinia-runtime = { optional = true, path = "../runtime/darwinia" } -dc-primitives = { path = "../core/primitives" } -pangolin-runtime = { optional = true, path = "../runtime/pangolin" } +crab-runtime = { optional = true, workspace = true } +darwinia-runtime = { optional = true, workspace = true } +dc-primitives = { workspace = true } +pangolin-runtime = { optional = true, workspace = true } # frontier -fc-cli = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } -fc-consensus = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } -fc-db = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } -fc-mapping-sync = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } -fc-rpc = { features = ["rpc_binary_search_estimate"], git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } -fc-rpc-core = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } -fp-evm = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } -fp-rpc = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } -fp-storage = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } +fc-cli = { workspace = true } +fc-consensus = { workspace = true } +fc-db = { workspace = true } +fc-mapping-sync = { workspace = true } +fc-rpc = { features = ["rpc_binary_search_estimate"], workspace = true } +fc-rpc-core = { workspace = true } +fp-evm = { workspace = true } +fp-rpc = { workspace = true } +fp-storage = { workspace = true } # polkadot -polkadot-cli = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36" } -polkadot-parachain = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36" } -polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36" } -polkadot-service = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36" } -xcm = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36" } +polkadot-cli = { workspace = true } +polkadot-parachain = { workspace = true } +polkadot-primitives = { workspace = true } +polkadot-service = { workspace = true } +xcm = { workspace = true } # substrate -frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -frame-benchmarking-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-transaction-payment-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sc-basic-authorship = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sc-chain-spec = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sc-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sc-consensus-aura = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sc-executor = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sc-keystore = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sc-network = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sc-network-common = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sc-offchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sc-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sc-rpc-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sc-service = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sc-sysinfo = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sc-telemetry = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sc-tracing = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sc-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sc-transaction-pool-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-block-builder = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-consensus = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-consensus-aura = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-inherents = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-offchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-session = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -substrate-frame-rpc-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -substrate-prometheus-endpoint = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -try-runtime-cli = { optional = true, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +frame-benchmarking = { workspace = true } +frame-benchmarking-cli = { workspace = true } +pallet-transaction-payment-rpc = { workspace = true } +sc-basic-authorship = { workspace = true } +sc-chain-spec = { workspace = true } +sc-cli = { workspace = true } +sc-client-api = { workspace = true } +sc-consensus = { workspace = true } +sc-consensus-aura = { workspace = true } +sc-executor = { workspace = true } +sc-keystore = { workspace = true } +sc-network = { workspace = true } +sc-network-common = { workspace = true } +sc-offchain = { workspace = true } +sc-rpc = { workspace = true } +sc-rpc-api = { workspace = true } +sc-service = { workspace = true } +sc-sysinfo = { workspace = true } +sc-telemetry = { workspace = true } +sc-tracing = { workspace = true } +sc-transaction-pool = { workspace = true } +sc-transaction-pool-api = { workspace = true } +sp-api = { workspace = true } +sp-block-builder = { workspace = true } +sp-blockchain = { workspace = true } +sp-consensus = { workspace = true } +sp-consensus-aura = { workspace = true } +sp-core = { workspace = true } +sp-inherents = { workspace = true } +sp-io = { workspace = true } +sp-keystore = { workspace = true } +sp-offchain = { workspace = true } +sp-runtime = { workspace = true } +sp-session = { workspace = true } +sp-timestamp = { workspace = true } +sp-transaction-pool = { workspace = true } +substrate-frame-rpc-system = { workspace = true } +substrate-prometheus-endpoint = { workspace = true } +try-runtime-cli = { optional = true, workspace = true } [features] default = [ diff --git a/pallet/account-migration/Cargo.toml b/pallet/account-migration/Cargo.toml index 5538841be..de1f6061d 100644 --- a/pallet/account-migration/Cargo.toml +++ b/pallet/account-migration/Cargo.toml @@ -1,40 +1,37 @@ [package] -authors = ["Darwinia Network "] -description = "Darwinia SR25519 to ECDSA account migration." -edition = "2021" -homepage = "https://darwinia.network" -license = "GPL-3.0" name = "darwinia-account-migration" +description = "Darwinia SR25519 to ECDSA account migration." readme = "README.md" -repository = "https://github.com/darwinia-network/darwinia" -version = "6.0.0" +authors = { workspace = true } +edition = { workspace = true } +version = { workspace = true } [dependencies] # crates.io -array-bytes = { version = "6.0" } -codec = { package = "parity-scale-codec", version = "3.3", default-features = false, features = ["derive"] } -scale-info = { version = "2.3", default-features = false, features = ["derive"] } +array-bytes = { workspace = true } +codec = { package = "parity-scale-codec", workspace = true } +scale-info = { workspace = true } # darwinia -darwinia-deposit = { default-features = false, path = "../deposit" } -darwinia-staking = { default-features = false, path = "../staking" } -dc-primitives = { default-features = false, path = "../../core/primitives" } +darwinia-deposit = { workspace = true } +darwinia-staking = { workspace = true } +dc-primitives = { workspace = true } # substrate -frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-assets = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-balances = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-identity = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-vesting = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-io = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +frame-support = { workspace = true } +frame-system = { workspace = true } +pallet-assets = { workspace = true } +pallet-balances = { workspace = true } +pallet-identity = { workspace = true } +pallet-vesting = { workspace = true } +sp-core = { workspace = true } +sp-io = { workspace = true } +sp-runtime = { workspace = true } +sp-std = { workspace = true } [dev-dependencies] -sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-version = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-keyring = { workspace = true } +sp-version = { workspace = true } [features] default = ["std"] diff --git a/pallet/deposit/Cargo.toml b/pallet/deposit/Cargo.toml index 194a6c8d3..f8144e4c8 100644 --- a/pallet/deposit/Cargo.toml +++ b/pallet/deposit/Cargo.toml @@ -1,37 +1,34 @@ [package] -authors = ["Darwinia Network "] -description = "Darwinia deposit mechanism implementation." -edition = "2021" -homepage = "https://darwinia.network" -license = "GPL-3.0" name = "darwinia-deposit" +description = "Darwinia deposit mechanism implementation." readme = "README.md" -repository = "https://github.com/darwinia-network/darwinia" -version = "6.0.0" +authors = { workspace = true } +edition = { workspace = true } +version = { workspace = true } [dependencies] # crates.io -codec = { package = "parity-scale-codec", version = "3.3", default-features = false, features = ["derive"] } -scale-info = { version = "2.3", default-features = false } +codec = { package = "parity-scale-codec", workspace = true } +scale-info = { workspace = true } # darwinia -darwinia-staking = { default-features = false, path = "../staking" } -dc-inflation = { default-features = false, path = "../../core/inflation" } -dc-types = { path = "../../core/types" } +darwinia-staking = { workspace = true } +dc-inflation = { workspace = true } +dc-types = { workspace = true } # subtrate -frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +frame-support = { workspace = true } +frame-system = { workspace = true } +sp-core = { workspace = true } +sp-runtime = { workspace = true } +sp-std = { workspace = true } [dev-dependencies] # substrate -pallet-assets = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-assets = { workspace = true, features = ["std"] } +pallet-balances = { workspace = true, features = ["std"] } +pallet-timestamp = { workspace = true, features = ["std"] } +sp-io = { workspace = true } [features] default = ["std"] diff --git a/pallet/ecdsa-authority/Cargo.toml b/pallet/ecdsa-authority/Cargo.toml index cd070c027..c36ea71da 100644 --- a/pallet/ecdsa-authority/Cargo.toml +++ b/pallet/ecdsa-authority/Cargo.toml @@ -1,35 +1,32 @@ [package] -authors = ["Darwinia Network "] -description = "Relayer Authorities Protocal Implementation" -edition = "2021" -homepage = "https://darwinia.network" -license = "GPL-3.0" name = "darwinia-ecdsa-authority" +description = "Relayer Authorities Protocal Implementation" readme = "README.md" -repository = "https://github.com/darwinia-network/darwinia-common" -version = "2.10.1" +authors = { workspace = true } +edition = { workspace = true } +version = { workspace = true } [dependencies] # crates.io -codec = { package = "parity-scale-codec", version = "3.3", default-features = false, features = ["derive"] } +codec = { package = "parity-scale-codec", workspace = true } ethabi = { version = "17.0", default-features = false } -scale-info = { version = "2.3", default-features = false } +scale-info = { workspace = true } # darwinia -dc-primitives = { default-features = false, path = "../../core/primitives" } +dc-primitives = { workspace = true } # substrate -frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-io = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +frame-support = { workspace = true} +frame-system = { workspace = true} +sp-core = { workspace = true} +sp-io = { workspace = true} +sp-runtime = { workspace = true} +sp-std = { workspace = true} [dev-dependencies] -array-bytes = { version = "6.0" } -libsecp256k1 = { version = "0.7" } -sp-version = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +array-bytes = { workspace = true } +libsecp256k1 = { workspace = true } +sp-version = { workspace = true } [features] default = ["std"] diff --git a/pallet/message-gadget/Cargo.toml b/pallet/message-gadget/Cargo.toml index 7fd841027..f789df761 100644 --- a/pallet/message-gadget/Cargo.toml +++ b/pallet/message-gadget/Cargo.toml @@ -1,37 +1,34 @@ [package] -authors = ["Darwinia Network "] -description = "Darwinia messages gadget." -edition = "2021" -homepage = "https://darwinia.network" -license = "GPL-3.0" name = "darwinia-message-gadget" +description = "Darwinia messages gadget." readme = "README.md" -repository = "https://github.com/darwinia-network/darwinia" -version = "6.0.0" +authors = { workspace = true } +edition = { workspace = true } +version = { workspace = true } [dependencies] # crates.io -codec = { package = "parity-scale-codec", version = "3.3", default-features = false } -scale-info = { version = "2.3", default-features = false, features = ["derive"] } +codec = { package = "parity-scale-codec", workspace = true } +scale-info = { workspace = true } # frontier -pallet-evm = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } +pallet-evm = { workspace = true } # paritytech -frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-io = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +frame-support = { workspace = true } +frame-system = { workspace = true } +sp-core = { workspace = true } +sp-io = { workspace = true } +sp-std = { workspace = true } [dev-dependencies] # crates.io -array-bytes = { version = "6.0" } +array-bytes = { workspace = true } # substrate -pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-balances = { workspace = true, features = ["std"] } +pallet-timestamp = { workspace = true, features = ["std"] } +sp-runtime = { workspace = true } [features] default = ["std"] diff --git a/pallet/message-transact/Cargo.toml b/pallet/message-transact/Cargo.toml index 0a3893435..35e4997eb 100644 --- a/pallet/message-transact/Cargo.toml +++ b/pallet/message-transact/Cargo.toml @@ -1,54 +1,51 @@ [package] -authors = ["Darwinia Network "] -description = "State storage precompiles for EVM pallet." -edition = "2021" -homepage = "https://darwinia.network" -license = "GPL-3.0" name = "darwinia-message-transact" +description = "LCMP evm message execution." readme = "README.md" -repository = "https://github.com/darwinia-network/darwinia" -version = "6.0.0" +authors = { workspace = true } +edition = { workspace = true } +version = { workspace = true } [dependencies] # crates.io -codec = { package = "parity-scale-codec", version = "3.3", default-features = false, features = ["derive"] } +codec = { package = "parity-scale-codec", workspace = true } ethereum = { version = "0.14", default-features = false, features = ["with-codec"] } -scale-info = { version = "2.3", default-features = false, features = ["derive"] } +scale-info = { workspace = true } # frontier -fp-ethereum = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } -fp-evm = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } -pallet-evm = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } +fp-ethereum = { workspace = true } +fp-evm = { workspace = true } +pallet-evm = { workspace = true } # substrate -frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +frame-support = { workspace = true } +frame-system = { workspace = true } +sp-core = { workspace = true } +sp-runtime = { workspace = true } +sp-std = { workspace = true } [dev-dependencies] -array-bytes = { version = "6.0" } -libsecp256k1 = { version = "0.5", features = ["static-context", "hmac"] } +array-bytes = { workspace = true } +libsecp256k1 = { workspace = true } rlp = { version = "0.5" } -sha3 = { version = "0.9" } +sha3 = { workspace = true } # darwinia -bp-message-dispatch = { git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } -bp-runtime = { git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } -pallet-bridge-dispatch = { git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } +bp-message-dispatch = { workspace = true, features = ["std"] } +bp-runtime = { workspace = true } +pallet-bridge-dispatch = { workspace = true } # frontier -fp-self-contained = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } -pallet-ethereum = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } +fp-self-contained = { workspace = true } +pallet-ethereum = { workspace = true } # moonbeam -precompile-utils = { git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.36", features = ["testing"] } +precompile-utils = { workspace = true, features = ["testing"] } # substrate -pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-balances = { workspace = true, features = ["std"] } +pallet-timestamp = { workspace = true, features = ["std"] } +sp-io = { workspace = true } [features] default = ["std"] diff --git a/pallet/staking/Cargo.toml b/pallet/staking/Cargo.toml index bde5a6416..ebf535729 100644 --- a/pallet/staking/Cargo.toml +++ b/pallet/staking/Cargo.toml @@ -1,45 +1,42 @@ [package] -authors = ["Darwinia Network "] -description = "Darwinia parachain staking." -edition = "2021" -homepage = "https://darwinia.network" -license = "GPL-3.0" name = "darwinia-staking" +description = "Darwinia parachain staking." readme = "README.md" -repository = "https://github.com/darwinia-network/darwinia" -version = "6.0.0" +authors = { workspace = true } +edition = { workspace = true } +version = { workspace = true } [dependencies] # crates.io -codec = { package = "parity-scale-codec", version = "3.3", default-features = false, features = ["derive"] } -scale-info = { version = "2.3", default-features = false } +codec = { package = "parity-scale-codec", workspace = true } +scale-info = { workspace = true } # darwinia -dc-inflation = { default-features = false, path = "../../core/inflation" } -dc-types = { path = "../../core/types" } +dc-inflation = { workspace = true } +dc-types = { workspace = true } # subtrate -frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-authorship = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-session = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +frame-support = { workspace = true } +frame-system = { workspace = true } +pallet-authorship = { workspace = true } +pallet-session = { workspace = true } +sp-core = { workspace = true } +sp-runtime = { workspace = true } +sp-std = { workspace = true } [dev-dependencies] # crates.io pretty_env_logger = { version = "0.4" } # darwinia -darwinia-deposit = { path = "../deposit" } +darwinia-deposit = { workspace = true } # substrate -pallet-assets = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-session = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-assets = { workspace = true, features = ["std"] } +pallet-balances = { workspace = true, features = ["std"] } +pallet-session = { workspace = true, features = ["std"] } +pallet-timestamp = { workspace = true, features = ["std"] } +sp-io = { workspace = true } [features] default = ["std"] diff --git a/precompile/assets/Cargo.toml b/precompile/assets/Cargo.toml index c68602593..5b31ea4bb 100644 --- a/precompile/assets/Cargo.toml +++ b/precompile/assets/Cargo.toml @@ -1,44 +1,41 @@ [package] -authors = ["Darwinia Network "] -description = "Assets precompiles for EVM pallet." -edition = "2021" -homepage = "https://darwinia.network" -license = "GPL-3.0" name = "darwinia-precompile-assets" +description = "Assets precompile for EVM pallet." readme = "README.md" -repository = "https://github.com/darwinia-network/darwinia" -version = "6.0.0" +authors = { workspace = true } +edition = { workspace = true } +version = { workspace = true } [dependencies] # frontier -fp-evm = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } -pallet-evm = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } +fp-evm = { workspace = true } +pallet-evm = { workspace = true } # moonbeam -precompile-utils = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.36" } +precompile-utils = { workspace = true} # paritytech -frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-assets = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +frame-support = { workspace = true } +frame-system = { workspace = true } +pallet-assets = { workspace = true } +sp-core = { workspace = true } +sp-std = { workspace = true } -sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } [dev-dependencies] # crates.io -codec = { package = "parity-scale-codec", version = "3.3" } -scale-info = { version = "2.3", features = ["derive"] } -sha3 = { version = "0.8" } +codec = { package = "parity-scale-codec", workspace = true } +scale-info = { workspace = true } +sha3 = { workspace = true } # moonbeam -precompile-utils = { git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.36", features = ["testing"] } +precompile-utils = { workspace = true, features = ["testing"] } # paritytech -pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-balances = { workspace = true, features = ["std"] } +pallet-timestamp = { workspace = true, features = ["std"] } +sp-core = { workspace = true } +sp-io = { workspace = true } +sp-runtime = { workspace = true } [features] default = ["std"] diff --git a/precompile/bls12-381/Cargo.toml b/precompile/bls12-381/Cargo.toml index 46ce5f91d..a350b5adf 100644 --- a/precompile/bls12-381/Cargo.toml +++ b/precompile/bls12-381/Cargo.toml @@ -1,43 +1,40 @@ [package] -authors = ["Darwinia Network "] -description = "State storage precompiles for EVM pallet." -edition = "2021" -homepage = "https://darwinia.network" -license = "GPL-3.0" name = "darwinia-precompile-bls12-381" +description = "BLS12-381 implementation for EVM pallet." readme = "README.md" -repository = "https://github.com/darwinia-network/darwinia" -version = "6.0.0" +authors = { workspace = true } +edition = { workspace = true } +version = { workspace = true } [dependencies] # crates.io milagro_bls = { default-features = false, git = "https://github.com/darwinia-network/milagro_bls" } # frontier -fp-evm = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } -pallet-evm = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } +fp-evm = { workspace = true } +pallet-evm = { workspace = true } # moonbeam -precompile-utils = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.36" } +precompile-utils = { workspace = true } # substrate -sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-std = { workspace = true } [dev-dependencies] # crates.io -codec = { package = "parity-scale-codec", version = "3.3" } -scale-info = { version = "2.3", features = ["derive"] } +codec = { package = "parity-scale-codec", workspace = true } +scale-info = { workspace = true } # moonbeam -precompile-utils = { git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.36", features = ["testing"] } +precompile-utils = { workspace = true, features = ["testing"] } # substrate -frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +frame-system = { workspace = true } +pallet-balances = { workspace = true, features = ["std"] } +pallet-timestamp = { workspace = true, features = ["std"] } +sp-core = { workspace = true } +sp-io = { workspace = true } +sp-runtime = { workspace = true } [features] default = ["std"] diff --git a/precompile/deposit/Cargo.toml b/precompile/deposit/Cargo.toml index 6724504ca..fac91b93b 100644 --- a/precompile/deposit/Cargo.toml +++ b/precompile/deposit/Cargo.toml @@ -1,44 +1,41 @@ [package] -authors = ["Darwinia Network "] -description = "State storage precompiles for EVM pallet." -edition = "2021" -homepage = "https://darwinia.network" -license = "GPL-3.0" name = "darwinia-precompile-deposit" +description = "Deposit precompile for EVM pallet." readme = "README.md" -repository = "https://github.com/darwinia-network/darwinia" -version = "6.0.0" +authors = { workspace = true } +edition = { workspace = true } +version = { workspace = true } [dependencies] # frontier -fp-evm = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } -pallet-evm = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } +fp-evm = { workspace = true } +pallet-evm = { workspace = true } # darwinia -darwinia-deposit = { default-features = false, path = "../../pallet/deposit"} +darwinia-deposit = { workspace = true } # moonbeam -precompile-utils = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.36" } +precompile-utils = { workspace = true } # substrate -frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +frame-support = { workspace = true } +frame-system = { workspace = true } +sp-core = { workspace = true } +sp-std = { workspace = true } [dev-dependencies] # crates.io -codec = { package = "parity-scale-codec", version = "3.3" } -scale-info = { version = "2.3", features = ["derive"] } +codec = { package = "parity-scale-codec", workspace = true } +scale-info = { workspace = true } # moonbeam -precompile-utils = { git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.36", features = ["testing"] } +precompile-utils = { workspace = true, features = ["testing"] } # substrate -pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +pallet-balances = { workspace = true, features = ["std"] } +pallet-timestamp = { workspace = true, features = ["std"] } +sp-io = { workspace = true } +sp-runtime = { workspace = true } [features] default = ["std"] diff --git a/precompile/staking/Cargo.toml b/precompile/staking/Cargo.toml index 9cba6b879..1e9d72f38 100644 --- a/precompile/staking/Cargo.toml +++ b/precompile/staking/Cargo.toml @@ -1,49 +1,45 @@ [package] -authors = ["Darwinia Network "] -description = "State storage precompiles for EVM pallet." -edition = "2021" -homepage = "https://darwinia.network" -license = "GPL-3.0" name = "darwinia-precompile-staking" +description = "Staking precompile for EVM pallet." readme = "README.md" -repository = "https://github.com/darwinia-network/darwinia" -version = "6.0.0" +authors = { workspace = true } +edition = { workspace = true } +version = { workspace = true } [dependencies] # frontier -fp-evm = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } -pallet-evm = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } +fp-evm = { workspace = true } +pallet-evm = { workspace = true } # darwinia -darwinia-staking = { default-features = false, path = "../../pallet/staking" } +darwinia-staking = { workspace = true } # moonbeam -precompile-utils = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.36" } +precompile-utils = { workspace = true } # substrate -frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +frame-support = { workspace = true } +frame-system = { workspace = true } +sp-core = { workspace = true } +sp-runtime = { workspace = true } +sp-std = { workspace = true } [dev-dependencies] # crates.io -codec = { package = "parity-scale-codec", version = "3.3" } -scale-info = { version = "2.3", features = ["derive"] } +codec = { package = "parity-scale-codec", workspace = true } +scale-info = { workspace = true } # darwinia -darwinia-deposit = { path = "../../pallet/deposit" } +darwinia-deposit = { workspace = true } # moonbeam -precompile-utils = { git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.36", features = ["testing"] } +precompile-utils = { workspace = true, features = ["testing"] } # substrate -frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } - +frame-system = { workspace = true } +pallet-balances = { workspace = true, features = ["std"] } +pallet-timestamp = { workspace = true, features = ["std"] } +sp-io = { workspace = true } [features] default = ["std"] diff --git a/precompile/state-storage/Cargo.toml b/precompile/state-storage/Cargo.toml index 34fbbdc42..3efc198e3 100644 --- a/precompile/state-storage/Cargo.toml +++ b/precompile/state-storage/Cargo.toml @@ -1,41 +1,38 @@ [package] -authors = ["Darwinia Network "] -description = "State storage precompile for EVM pallet." -edition = "2021" -homepage = "https://darwinia.network" -license = "GPL-3.0" name = "darwinia-precompile-state-storage" +description = "State storage precompile for EVM pallet." readme = "README.md" -repository = "https://github.com/darwinia-network/darwinia" -version = "6.0.0" +authors = { workspace = true } +edition = { workspace = true } +version = { workspace = true } [dependencies] # frontier -fp-evm = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } -pallet-evm = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } +fp-evm = { workspace = true } +pallet-evm = { workspace = true } # moonbeam -precompile-utils = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.36" } +precompile-utils = { workspace = true } # substrate -frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +frame-support = { workspace = true } +sp-std = { workspace = true } [dev-dependencies] # crates.io -codec = { package = "parity-scale-codec", version = "3.3" } -scale-info = { version = "2.3", features = ["derive"] } +codec = { package = "parity-scale-codec", workspace = true } +scale-info = { workspace = true } # moonbeam -precompile-utils = { git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.36", features = ["testing"] } +precompile-utils = { workspace = true, features = ["testing"] } # substrate -frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +frame-system = { workspace = true } +pallet-balances = { workspace = true, features = ["std"] } +pallet-timestamp = { workspace = true, features = ["std"] } +sp-core = { workspace = true } +sp-io = { workspace = true } +sp-runtime = { workspace = true } [features] default = ["std"] diff --git a/runtime/common/Cargo.toml b/runtime/common/Cargo.toml index 7837ac0ba..4f6c85299 100644 --- a/runtime/common/Cargo.toml +++ b/runtime/common/Cargo.toml @@ -1,40 +1,37 @@ [package] -authors = ["Darwinia Network "] -description = "Darwinia Common Runtime" -edition = "2021" -homepage = "https://darwinia.network/" -license = "GPL-3.0" name = "darwinia-common-runtime" +description = "Darwinia Common Runtime" readme = "README.md" -repository = "https://github.com/darwinia-network/darwinia" -version = "6.0.0" +authors = { workspace = true } +edition = { workspace = true } +version = { workspace = true } [dependencies] # crates.io -codec = { package = "parity-scale-codec", version = "3.3", default-features = false } +codec = { package = "parity-scale-codec", workspace = true } smallvec = { version = "1.10" } # darwinia -dc-primitives = { default-features = false, path = "../../core/primitives" } +dc-primitives = { workspace = true } # darwinia-messages-substrate -bp-darwinia-core = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } +bp-darwinia-core = { workspace = true } # moonbeam -account = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.36" } +account = { workspace = true } # polkadot -xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36" } -xcm-builder = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36" } -xcm-executor = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36" } +xcm = { workspace = true } +xcm-builder = { workspace = true } +xcm-executor = { workspace = true } # substrate -frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-collective = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-io = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +frame-support = { workspace = true } +frame-system = { workspace = true } +pallet-collective = { workspace = true } +sp-io = { workspace = true } +sp-runtime = { workspace = true } +sp-std = { workspace = true } [features] default = ["std"] diff --git a/runtime/crab/Cargo.toml b/runtime/crab/Cargo.toml index b2f376fcd..0e78a8a2a 100644 --- a/runtime/crab/Cargo.toml +++ b/runtime/crab/Cargo.toml @@ -1,137 +1,134 @@ [package] -authors = ["Darwinia Network "] -description = "Crab runtime." -edition = "2021" -homepage = "https://darwinia.network" -license = "GPL-3.0" name = "crab-runtime" +description = "Crab runtime." readme = "README.md" -repository = "https://github.com/darwinia-network/darwinia" -version = "6.0.0" +authors = { workspace = true } +edition = { workspace = true } +version = { workspace = true } [build-dependencies] -substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +substrate-wasm-builder = { workspace = true } [dependencies] # crates.io -codec = { package = "parity-scale-codec", version = "3.3", default-features = false, features = ["derive"] } -scale-info = { version = "2.3", default-features = false, features = ["derive"] } -static_assertions = { version = "1.1" } +codec = { package = "parity-scale-codec", workspace = true } +scale-info = { workspace = true } +static_assertions = { workspace = true } # crates.io optional -array-bytes = { version = "6.0", optional = true } +array-bytes = { optional = true, workspace = true } # cumulus -cumulus-pallet-aura-ext = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } -cumulus-pallet-dmp-queue = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } -cumulus-pallet-parachain-system = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } -cumulus-pallet-xcm = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } -cumulus-pallet-xcmp-queue = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } -cumulus-primitives-core = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } -cumulus-primitives-timestamp = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } -cumulus-primitives-utility = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } -parachain-info = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } +cumulus-pallet-aura-ext = { workspace = true } +cumulus-pallet-dmp-queue = { workspace = true } +cumulus-pallet-parachain-system = { workspace = true } +cumulus-pallet-xcm = { workspace = true } +cumulus-pallet-xcmp-queue = { workspace = true } +cumulus-primitives-core = { workspace = true } +cumulus-primitives-timestamp = { workspace = true } +cumulus-primitives-utility = { workspace = true } +parachain-info = { workspace = true } # cumulus optional -cumulus-pallet-session-benchmarking = { optional = true, default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } +cumulus-pallet-session-benchmarking = { optional = true, workspace = true } # darwinia -darwinia-account-migration = { default-features = false, path = "../../pallet/account-migration" } -darwinia-common-runtime = { default-features = false, path = "../common" } -darwinia-deposit = { default-features = false, path = "../../pallet/deposit" } -darwinia-ecdsa-authority = { default-features = false, path = "../../pallet/ecdsa-authority" } -darwinia-message-gadget = { default-features = false, path = "../../pallet/message-gadget" } -darwinia-message-transact = { default-features = false, path = "../../pallet/message-transact" } -darwinia-precompile-assets = { default-features = false, path = "../../precompile/assets" } -darwinia-precompile-bls12-381 = { default-features = false, path = "../../precompile/bls12-381" } -darwinia-precompile-deposit = { default-features = false, path = "../../precompile/deposit" } -darwinia-precompile-staking = { default-features = false, path = "../../precompile/staking" } -darwinia-precompile-state-storage = { default-features = false, path = "../../precompile/state-storage" } -darwinia-staking = { default-features = false, path = "../../pallet/staking" } -dc-primitives = { default-features = false, path = "../../core/primitives" } +darwinia-account-migration = { workspace = true } +darwinia-common-runtime = { workspace = true } +darwinia-deposit = { workspace = true } +darwinia-ecdsa-authority = { workspace = true } +darwinia-message-gadget = { workspace = true } +darwinia-message-transact = { workspace = true } +darwinia-precompile-assets = { workspace = true } +darwinia-precompile-bls12-381 = { workspace = true } +darwinia-precompile-deposit = { workspace = true } +darwinia-precompile-staking = { workspace = true } +darwinia-precompile-state-storage = { workspace = true } +darwinia-staking = { workspace = true } +dc-primitives = { workspace = true } # darwinia-messages-substrate -bp-message-dispatch = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } -bp-messages = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } -bp-polkadot-core = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } -bp-runtime = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } -bridge-runtime-common = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } -pallet-bridge-dispatch = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } -pallet-bridge-grandpa = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } -pallet-bridge-messages = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } -pallet-bridge-parachains = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } -pallet-fee-market = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } +bp-message-dispatch = { workspace = true } +bp-messages = { workspace = true } +bp-polkadot-core = { workspace = true } +bp-runtime = { workspace = true } +bridge-runtime-common = { workspace = true } +pallet-bridge-dispatch = { workspace = true } +pallet-bridge-grandpa = { workspace = true } +pallet-bridge-messages = { workspace = true } +pallet-bridge-parachains = { workspace = true } +pallet-fee-market = { workspace = true } # frontier -fp-rpc = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } -fp-self-contained = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } -pallet-ethereum = { default-features = false, features = ["forbid-evm-reentrancy"], git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } -pallet-evm = { default-features = false, features = ["forbid-evm-reentrancy"], git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } -pallet-evm-precompile-blake2 = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } -pallet-evm-precompile-bn128 = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } -pallet-evm-precompile-dispatch = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } -pallet-evm-precompile-modexp = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } -pallet-evm-precompile-simple = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } +fp-rpc = { workspace = true } +fp-self-contained = { workspace = true } +pallet-ethereum = { workspace = true, features = ["forbid-evm-reentrancy"] } +pallet-evm = { workspace = true, features = ["forbid-evm-reentrancy"] } +pallet-evm-precompile-blake2 = { workspace = true } +pallet-evm-precompile-bn128 = { workspace = true } +pallet-evm-precompile-dispatch = { workspace = true } +pallet-evm-precompile-modexp = { workspace = true } +pallet-evm-precompile-simple = { workspace = true } # moonbeam -precompile-utils = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.36" } -xcm-primitives = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.36" } +precompile-utils = { workspace = true } +xcm-primitives = { workspace = true } # polkadot -pallet-xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36" } -polkadot-parachain = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36" } -polkadot-runtime-common = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36" } -xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36" } -xcm-builder = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36" } -xcm-executor = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36" } +pallet-xcm = { workspace = true } +polkadot-parachain = { workspace = true } +polkadot-runtime-common = { workspace = true } +xcm = { workspace = true } +xcm-builder = { workspace = true } +xcm-executor = { workspace = true } # substrate -frame-executive = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -frame-system-rpc-runtime-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-assets = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-aura = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-authorship = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-balances = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-collective = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-democracy = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-elections-phragmen = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-identity = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-membership = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-multisig = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-preimage = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-proxy = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-scheduler = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-session = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-sudo = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-timestamp = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-tips = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-transaction-payment = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-transaction-payment-rpc-runtime-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-treasury = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-utility = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-vesting = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-block-builder = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-consensus-aura = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-inherents = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-io = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-offchain = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-session = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-transaction-pool = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-version = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +frame-executive = { workspace = true } +frame-support = { workspace = true } +frame-system = { workspace = true } +frame-system-rpc-runtime-api = { workspace = true } +pallet-assets = { workspace = true } +pallet-aura = { workspace = true } +pallet-authorship = { workspace = true } +pallet-balances = { workspace = true } +pallet-collective = { workspace = true } +pallet-democracy = { workspace = true } +pallet-elections-phragmen = { workspace = true } +pallet-identity = { workspace = true } +pallet-membership = { workspace = true } +pallet-multisig = { workspace = true } +pallet-preimage = { workspace = true } +pallet-proxy = { workspace = true } +pallet-scheduler = { workspace = true } +pallet-session = { workspace = true } +pallet-sudo = { workspace = true } +pallet-timestamp = { workspace = true } +pallet-tips = { workspace = true } +pallet-transaction-payment = { workspace = true } +pallet-transaction-payment-rpc-runtime-api = { workspace = true } +pallet-treasury = { workspace = true } +pallet-utility = { workspace = true } +pallet-vesting = { workspace = true } +sp-api = { workspace = true } +sp-block-builder = { workspace = true } +sp-consensus-aura = { workspace = true } +sp-core = { workspace = true } +sp-inherents = { workspace = true } +sp-io = { workspace = true } +sp-offchain = { workspace = true } +sp-runtime = { workspace = true } +sp-session = { workspace = true } +sp-std = { workspace = true } +sp-transaction-pool = { workspace = true } +sp-version = { workspace = true } # substrate optional -frame-benchmarking = { optional = true, default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -frame-system-benchmarking = { optional = true, default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -frame-try-runtime = { optional = true, default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +frame-benchmarking = { optional = true, workspace = true } +frame-system-benchmarking = { optional = true, workspace = true } +frame-try-runtime = { optional = true, workspace = true } [dev-dependencies] # darwinia -darwinia-common-runtime = { features = ["test"], path = "../common" } +darwinia-common-runtime = { features = ["test"], workspace = true } # substrate -sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-keyring = { workspace = true } [features] default = ["std"] @@ -245,8 +242,7 @@ std = [ # substrate optional "frame-benchmarking?/std", "frame-system-benchmarking?/std", - "frame-try-runtime?/std", - + "frame-try-runtime?/std" ] fast-runtime = [] diff --git a/runtime/darwinia/Cargo.toml b/runtime/darwinia/Cargo.toml index a1761b51c..3a632c1d1 100644 --- a/runtime/darwinia/Cargo.toml +++ b/runtime/darwinia/Cargo.toml @@ -1,137 +1,134 @@ [package] -authors = ["Darwinia Network "] -description = "Darwinia runtime." -edition = "2021" -homepage = "https://darwinia.network" -license = "GPL-3.0" name = "darwinia-runtime" +description = "Darwinia runtime." readme = "README.md" -repository = "https://github.com/darwinia-network/darwinia" -version = "6.0.0" +authors = { workspace = true } +edition = { workspace = true } +version = { workspace = true } [build-dependencies] -substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +substrate-wasm-builder = { workspace = true } [dependencies] # crates.io -codec = { package = "parity-scale-codec", version = "3.3", default-features = false, features = ["derive"] } -scale-info = { version = "2.3", default-features = false, features = ["derive"] } -static_assertions = { version = "1.1" } +codec = { workspace = true, package = "parity-scale-codec" } +scale-info = { workspace = true } +static_assertions = { workspace = true } # crates.io optional -array-bytes = { version = "6.0", optional = true } +array-bytes = { optional = true, workspace = true } # cumulus -cumulus-pallet-aura-ext = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } -cumulus-pallet-dmp-queue = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } -cumulus-pallet-parachain-system = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } -cumulus-pallet-xcm = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } -cumulus-pallet-xcmp-queue = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } -cumulus-primitives-core = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } -cumulus-primitives-timestamp = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } -cumulus-primitives-utility = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } -parachain-info = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } +cumulus-pallet-aura-ext = { workspace = true } +cumulus-pallet-dmp-queue = { workspace = true } +cumulus-pallet-parachain-system = { workspace = true } +cumulus-pallet-xcm = { workspace = true } +cumulus-pallet-xcmp-queue = { workspace = true } +cumulus-primitives-core = { workspace = true } +cumulus-primitives-timestamp = { workspace = true } +cumulus-primitives-utility = { workspace = true } +parachain-info = { workspace = true } # cumulus optional -cumulus-pallet-session-benchmarking = { optional = true, default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } +cumulus-pallet-session-benchmarking = { optional = true, workspace = true } # darwinia -darwinia-account-migration = { default-features = false, path = "../../pallet/account-migration" } -darwinia-common-runtime = { default-features = false, path = "../common" } -darwinia-deposit = { default-features = false, path = "../../pallet/deposit" } -darwinia-ecdsa-authority = { default-features = false, path = "../../pallet/ecdsa-authority" } -darwinia-message-gadget = { default-features = false, path = "../../pallet/message-gadget" } -darwinia-message-transact = { default-features = false, path = "../../pallet/message-transact" } -darwinia-precompile-assets = { default-features = false, path = "../../precompile/assets" } -darwinia-precompile-bls12-381 = { default-features = false, path = "../../precompile/bls12-381" } -darwinia-precompile-deposit = { default-features = false, path = "../../precompile/deposit" } -darwinia-precompile-staking = { default-features = false, path = "../../precompile/staking" } -darwinia-precompile-state-storage = { default-features = false, path = "../../precompile/state-storage" } -darwinia-staking = { default-features = false, path = "../../pallet/staking" } -dc-primitives = { default-features = false, path = "../../core/primitives" } +darwinia-account-migration = { workspace = true } +darwinia-common-runtime = { workspace = true } +darwinia-deposit = { workspace = true } +darwinia-ecdsa-authority = { workspace = true } +darwinia-message-gadget = { workspace = true } +darwinia-message-transact = { workspace = true } +darwinia-precompile-assets = { workspace = true } +darwinia-precompile-bls12-381 = { workspace = true } +darwinia-precompile-deposit = { workspace = true } +darwinia-precompile-staking = { workspace = true } +darwinia-precompile-state-storage = { workspace = true } +darwinia-staking = { workspace = true } +dc-primitives = { workspace = true } # darwinia-messages-substrate -bp-message-dispatch = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } -bp-messages = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } -bp-polkadot-core = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } -bp-runtime = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } -bridge-runtime-common = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } -pallet-bridge-dispatch = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } -pallet-bridge-grandpa = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } -pallet-bridge-messages = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } -pallet-bridge-parachains = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } -pallet-fee-market = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } +bp-message-dispatch = { workspace = true } +bp-messages = { workspace = true } +bp-polkadot-core = { workspace = true } +bp-runtime = { workspace = true } +bridge-runtime-common = { workspace = true } +pallet-bridge-dispatch = { workspace = true } +pallet-bridge-grandpa = { workspace = true } +pallet-bridge-messages = { workspace = true } +pallet-bridge-parachains = { workspace = true } +pallet-fee-market = { workspace = true } # frontier -fp-rpc = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } -fp-self-contained = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } -pallet-ethereum = { default-features = false, features = ["forbid-evm-reentrancy"], git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } -pallet-evm = { default-features = false, features = ["forbid-evm-reentrancy"], git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } -pallet-evm-precompile-blake2 = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } -pallet-evm-precompile-bn128 = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } -pallet-evm-precompile-dispatch = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } -pallet-evm-precompile-modexp = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } -pallet-evm-precompile-simple = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } +fp-rpc = { workspace = true } +fp-self-contained = { workspace = true } +pallet-ethereum = { features = ["forbid-evm-reentrancy"], workspace = true } +pallet-evm = { features = ["forbid-evm-reentrancy"], workspace = true } +pallet-evm-precompile-blake2 = { workspace = true } +pallet-evm-precompile-bn128 = { workspace = true } +pallet-evm-precompile-dispatch = { workspace = true } +pallet-evm-precompile-modexp = { workspace = true } +pallet-evm-precompile-simple = { workspace = true } # moonbeam -precompile-utils = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.36" } -xcm-primitives = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.36" } +precompile-utils = { workspace = true } +xcm-primitives = { workspace = true } # polkadot -pallet-xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36" } -polkadot-parachain = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36" } -polkadot-runtime-common = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36" } -xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36" } -xcm-builder = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36" } -xcm-executor = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36" } +pallet-xcm = { workspace = true} +polkadot-parachain = { workspace = true} +polkadot-runtime-common = { workspace = true} +xcm = { workspace = true} +xcm-builder = { workspace = true} +xcm-executor = { workspace = true} # substrate -frame-executive = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -frame-system-rpc-runtime-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-assets = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-aura = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-authorship = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-balances = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-collective = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-democracy = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-elections-phragmen = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-identity = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-membership = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-multisig = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-preimage = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-proxy = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-scheduler = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-session = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-sudo = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-timestamp = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-tips = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-transaction-payment = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-transaction-payment-rpc-runtime-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-treasury = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-utility = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-vesting = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-block-builder = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-consensus-aura = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-inherents = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-io = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-offchain = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-session = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-transaction-pool = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-version = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +frame-executive = { workspace = true } +frame-support = { workspace = true } +frame-system = { workspace = true } +frame-system-rpc-runtime-api = { workspace = true } +pallet-assets = { workspace = true } +pallet-aura = { workspace = true } +pallet-authorship = { workspace = true } +pallet-balances = { workspace = true } +pallet-collective = { workspace = true } +pallet-democracy = { workspace = true } +pallet-elections-phragmen = { workspace = true } +pallet-identity = { workspace = true } +pallet-membership = { workspace = true } +pallet-multisig = { workspace = true } +pallet-preimage = { workspace = true } +pallet-proxy = { workspace = true } +pallet-scheduler = { workspace = true } +pallet-session = { workspace = true } +pallet-sudo = { workspace = true } +pallet-timestamp = { workspace = true } +pallet-tips = { workspace = true } +pallet-transaction-payment = { workspace = true } +pallet-transaction-payment-rpc-runtime-api = { workspace = true } +pallet-treasury = { workspace = true } +pallet-utility = { workspace = true } +pallet-vesting = { workspace = true } +sp-api = { workspace = true } +sp-block-builder = { workspace = true } +sp-consensus-aura = { workspace = true } +sp-core = { workspace = true } +sp-inherents = { workspace = true } +sp-io = { workspace = true } +sp-offchain = { workspace = true } +sp-runtime = { workspace = true } +sp-session = { workspace = true } +sp-std = { workspace = true } +sp-transaction-pool = { workspace = true } +sp-version = { workspace = true } # substrate optional -frame-benchmarking = { optional = true, default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -frame-system-benchmarking = { optional = true, default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -frame-try-runtime = { optional = true, default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +frame-benchmarking = { optional = true, workspace = true } +frame-system-benchmarking = { optional = true, workspace = true } +frame-try-runtime = { optional = true, workspace = true } [dev-dependencies] # darwinia -darwinia-common-runtime = { features = ["test"], path = "../common" } +darwinia-common-runtime = { features = ["test"], workspace = true } # substrate -sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-keyring = { workspace = true } [features] default = ["std"] diff --git a/runtime/pangolin/Cargo.toml b/runtime/pangolin/Cargo.toml index b5610ac1b..bc920c7d9 100644 --- a/runtime/pangolin/Cargo.toml +++ b/runtime/pangolin/Cargo.toml @@ -1,137 +1,135 @@ [package] -authors = ["Darwinia Network "] -description = "Pangolin runtime." -edition = "2021" -homepage = "https://darwinia.network" -license = "GPL-3.0" name = "pangolin-runtime" +description = "Pangolin runtime." readme = "README.md" -repository = "https://github.com/darwinia-network/darwinia" -version = "6.0.0" +authors = { workspace = true } +edition = { workspace = true } +version = { workspace = true } [build-dependencies] -substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +substrate-wasm-builder = { workspace = true } [dependencies] # crates.io -codec = { package = "parity-scale-codec", version = "3.3", default-features = false, features = ["derive"] } -scale-info = { version = "2.3", default-features = false, features = ["derive"] } -static_assertions = { version = "1.1" } +codec = { package = "parity-scale-codec", workspace = true } +scale-info = { workspace = true } +static_assertions = { workspace = true } # crates.io optional -array-bytes = { version = "6.0", optional = true } +array-bytes = { optional = true, workspace = true } # cumulus -cumulus-pallet-aura-ext = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } -cumulus-pallet-dmp-queue = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } -cumulus-pallet-parachain-system = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } -cumulus-pallet-xcm = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } -cumulus-pallet-xcmp-queue = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } -cumulus-primitives-core = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } -cumulus-primitives-timestamp = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } -cumulus-primitives-utility = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } -parachain-info = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } +cumulus-pallet-aura-ext = { workspace = true } +cumulus-pallet-dmp-queue = { workspace = true } +cumulus-pallet-parachain-system = { workspace = true } +cumulus-pallet-xcm = { workspace = true } +cumulus-pallet-xcmp-queue = { workspace = true } +cumulus-primitives-core = { workspace = true } +cumulus-primitives-timestamp = { workspace = true } +cumulus-primitives-utility = { workspace = true } +parachain-info = { workspace = true } # cumulus optional -cumulus-pallet-session-benchmarking = { optional = true, default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } +cumulus-pallet-session-benchmarking = { optional = true, workspace = true } # darwinia -darwinia-account-migration = { default-features = false, path = "../../pallet/account-migration" } -darwinia-common-runtime = { default-features = false, path = "../common" } -darwinia-deposit = { default-features = false, path = "../../pallet/deposit" } -darwinia-ecdsa-authority = { default-features = false, path = "../../pallet/ecdsa-authority" } -darwinia-message-gadget = { default-features = false, path = "../../pallet/message-gadget" } -darwinia-message-transact = { default-features = false, path = "../../pallet/message-transact" } -darwinia-precompile-assets = { default-features = false, path = "../../precompile/assets" } -darwinia-precompile-bls12-381 = { default-features = false, path = "../../precompile/bls12-381" } -darwinia-precompile-deposit = { default-features = false, path = "../../precompile/deposit" } -darwinia-precompile-staking = { default-features = false, path = "../../precompile/staking" } -darwinia-precompile-state-storage = { default-features = false, path = "../../precompile/state-storage" } -darwinia-staking = { default-features = false, path = "../../pallet/staking" } -dc-primitives = { default-features = false, path = "../../core/primitives" } +darwinia-account-migration = { workspace = true } +darwinia-common-runtime = { workspace = true } +darwinia-deposit = { workspace = true } +darwinia-ecdsa-authority = { workspace = true } +darwinia-message-gadget = { workspace = true } +darwinia-message-transact = { workspace = true } +darwinia-precompile-assets = { workspace = true } +darwinia-precompile-bls12-381 = { workspace = true } +darwinia-precompile-deposit = { workspace = true } +darwinia-precompile-staking = { workspace = true } +darwinia-precompile-state-storage = { workspace = true } +darwinia-staking = { workspace = true } +dc-primitives = { workspace = true } + # darwinia-messages-substrate -bp-message-dispatch = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } -bp-messages = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } -bp-polkadot-core = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } -bp-runtime = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } -bridge-runtime-common = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } -pallet-bridge-dispatch = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } -pallet-bridge-grandpa = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } -pallet-bridge-messages = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } -pallet-bridge-parachains = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } -pallet-fee-market = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } +bp-message-dispatch = { workspace = true } +bp-messages = { workspace = true } +bp-polkadot-core = { workspace = true } +bp-runtime = { workspace = true } +bridge-runtime-common = { workspace = true } +pallet-bridge-dispatch = { workspace = true } +pallet-bridge-grandpa = { workspace = true } +pallet-bridge-messages = { workspace = true } +pallet-bridge-parachains = { workspace = true } +pallet-fee-market = { workspace = true } # frontier -fp-rpc = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } -fp-self-contained = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } -pallet-ethereum = { default-features = false, features = ["forbid-evm-reentrancy"], git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } -pallet-evm = { default-features = false, features = ["forbid-evm-reentrancy"], git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } -pallet-evm-precompile-blake2 = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } -pallet-evm-precompile-bn128 = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } -pallet-evm-precompile-dispatch = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } -pallet-evm-precompile-modexp = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } -pallet-evm-precompile-simple = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } +fp-rpc = { workspace = true } +fp-self-contained = { workspace = true } +pallet-ethereum = { features = ["forbid-evm-reentrancy"], workspace = true } +pallet-evm = { features = ["forbid-evm-reentrancy"], workspace = true } +pallet-evm-precompile-blake2 = { workspace = true } +pallet-evm-precompile-bn128 = { workspace = true } +pallet-evm-precompile-dispatch = { workspace = true } +pallet-evm-precompile-modexp = { workspace = true } +pallet-evm-precompile-simple = { workspace = true } # moonbeam -precompile-utils = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.36" } -xcm-primitives = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.36" } +precompile-utils = { workspace = true } +xcm-primitives = { workspace = true } # polkadot -pallet-xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36" } -polkadot-parachain = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36" } -polkadot-runtime-common = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36" } -xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36" } -xcm-builder = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36" } -xcm-executor = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36" } +pallet-xcm = { workspace = true } +polkadot-parachain = { workspace = true } +polkadot-runtime-common = { workspace = true } +xcm = { workspace = true } +xcm-builder = { workspace = true } +xcm-executor = { workspace = true } # substrate -frame-executive = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -frame-system-rpc-runtime-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-assets = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-aura = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-authorship = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-balances = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-collective = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-democracy = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-elections-phragmen = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-identity = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-membership = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-multisig = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-preimage = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-proxy = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-scheduler = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-session = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-sudo = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-timestamp = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-tips = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-transaction-payment = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-transaction-payment-rpc-runtime-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-treasury = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-utility = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-vesting = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-block-builder = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-consensus-aura = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-inherents = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-io = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-offchain = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-session = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-transaction-pool = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-version = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +frame-executive = { workspace = true } +frame-support = { workspace = true } +frame-system = { workspace = true } +frame-system-rpc-runtime-api = { workspace = true } +pallet-assets = { workspace = true } +pallet-aura = { workspace = true } +pallet-authorship = { workspace = true } +pallet-balances = { workspace = true } +pallet-collective = { workspace = true } +pallet-democracy = { workspace = true } +pallet-elections-phragmen = { workspace = true } +pallet-identity = { workspace = true } +pallet-membership = { workspace = true } +pallet-multisig = { workspace = true } +pallet-preimage = { workspace = true } +pallet-proxy = { workspace = true } +pallet-scheduler = { workspace = true } +pallet-session = { workspace = true } +pallet-sudo = { workspace = true } +pallet-timestamp = { workspace = true } +pallet-tips = { workspace = true } +pallet-transaction-payment = { workspace = true } +pallet-transaction-payment-rpc-runtime-api = { workspace = true } +pallet-treasury = { workspace = true } +pallet-utility = { workspace = true } +pallet-vesting = { workspace = true } +sp-api = { workspace = true } +sp-block-builder = { workspace = true } +sp-consensus-aura = { workspace = true } +sp-core = { workspace = true } +sp-inherents = { workspace = true } +sp-io = { workspace = true } +sp-offchain = { workspace = true } +sp-runtime = { workspace = true } +sp-session = { workspace = true } +sp-std = { workspace = true } +sp-transaction-pool = { workspace = true } +sp-version = { workspace = true } # substrate optional -frame-benchmarking = { optional = true, default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -frame-system-benchmarking = { optional = true, default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -frame-try-runtime = { optional = true, default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +frame-benchmarking = { optional = true, workspace = true } +frame-system-benchmarking = { optional = true, workspace = true } +frame-try-runtime = { optional = true, workspace = true } [dev-dependencies] # darwinia -darwinia-common-runtime = { features = ["test"], path = "../common" } +darwinia-common-runtime = { features = ["test"], workspace = true } # substrate -sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } +sp-keyring = { workspace = true } [features] default = ["std"] From ef31b5993831dd7d7d9e11aaae1c5d5cb26238ea Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Tue, 14 Feb 2023 11:15:13 +0800 Subject: [PATCH 141/189] Rename `Staking` to `DarwiniaStaking` (#279) * Rename to `DarwiniaStaking` * Rename --- node/src/chain_spec/crab.rs | 4 ++-- node/src/chain_spec/darwinia.rs | 4 ++-- node/src/chain_spec/pangolin.rs | 4 ++-- runtime/common/src/test.rs | 4 ++-- runtime/crab/src/lib.rs | 2 +- runtime/crab/src/pallets/authorship.rs | 2 +- runtime/crab/src/pallets/proxy.rs | 4 ++-- runtime/crab/src/pallets/session.rs | 2 +- runtime/darwinia/src/lib.rs | 2 +- runtime/darwinia/src/pallets/authorship.rs | 2 +- runtime/darwinia/src/pallets/proxy.rs | 4 ++-- runtime/darwinia/src/pallets/session.rs | 2 +- runtime/pangolin/src/lib.rs | 5 ++-- runtime/pangolin/src/migration.rs | 27 ++++++++++++++++++++++ runtime/pangolin/src/pallets/authorship.rs | 2 +- runtime/pangolin/src/pallets/proxy.rs | 4 ++-- runtime/pangolin/src/pallets/session.rs | 2 +- 17 files changed, 52 insertions(+), 24 deletions(-) create mode 100644 runtime/pangolin/src/migration.rs diff --git a/node/src/chain_spec/crab.rs b/node/src/chain_spec/crab.rs index bcf14134c..45bee456f 100644 --- a/node/src/chain_spec/crab.rs +++ b/node/src/chain_spec/crab.rs @@ -165,7 +165,7 @@ pub fn genesis_config() -> ChainSpec { vesting: Default::default(), // Consensus stuff. - staking: StakingConfig { + darwinia_staking: DarwiniaStakingConfig { now: SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_millis(), elapsed_time: 0, collator_count: 3, @@ -269,7 +269,7 @@ fn testnet_genesis( vesting: Default::default(), // Consensus stuff. - staking: StakingConfig { + darwinia_staking: DarwiniaStakingConfig { now: SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_millis(), elapsed_time: 0, collator_count: collators.len() as _, diff --git a/node/src/chain_spec/darwinia.rs b/node/src/chain_spec/darwinia.rs index 2d3a843f2..bf2b6ee79 100644 --- a/node/src/chain_spec/darwinia.rs +++ b/node/src/chain_spec/darwinia.rs @@ -165,7 +165,7 @@ pub fn genesis_config() -> ChainSpec { vesting: Default::default(), // Consensus stuff. - staking: StakingConfig { + darwinia_staking: DarwiniaStakingConfig { now: SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_millis(), elapsed_time: 0, collator_count: 3, @@ -269,7 +269,7 @@ fn testnet_genesis( vesting: Default::default(), // Consensus stuff. - staking: StakingConfig { + darwinia_staking: DarwiniaStakingConfig { now: SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_millis(), elapsed_time: 0, collator_count: collators.len() as _, diff --git a/node/src/chain_spec/pangolin.rs b/node/src/chain_spec/pangolin.rs index c66c10cb0..0b9c4c16a 100644 --- a/node/src/chain_spec/pangolin.rs +++ b/node/src/chain_spec/pangolin.rs @@ -168,7 +168,7 @@ pub fn genesis_config() -> ChainSpec { vesting: Default::default(), // Consensus stuff. - staking: StakingConfig { + darwinia_staking: DarwiniaStakingConfig { now: SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_millis(), elapsed_time: 11_516_352_020, collator_count: 3, @@ -288,7 +288,7 @@ fn testnet_genesis( vesting: Default::default(), // Consensus stuff. - staking: StakingConfig { + darwinia_staking: DarwiniaStakingConfig { now: SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_millis(), elapsed_time: 0, collator_count: collators.len() as _, diff --git a/runtime/common/src/test.rs b/runtime/common/src/test.rs index 30983d4e1..e6e08ebe9 100644 --- a/runtime/common/src/test.rs +++ b/runtime/common/src/test.rs @@ -301,8 +301,8 @@ macro_rules! impl_account_migration_tests { .unwrap(), 20 ); - assert_eq!(Staking::ledger_of(to).unwrap().staked_ring, 20); - assert_eq!(Staking::ledger_of(to).unwrap().staked_kton, 20); + assert_eq!(DarwiniaStaking::ledger_of(to).unwrap().staked_ring, 20); + assert_eq!(DarwiniaStaking::ledger_of(to).unwrap().staked_kton, 20); }); } diff --git a/runtime/crab/src/lib.rs b/runtime/crab/src/lib.rs index 55afe2b95..2fbb4baae 100644 --- a/runtime/crab/src/lib.rs +++ b/runtime/crab/src/lib.rs @@ -166,7 +166,7 @@ frame_support::construct_runtime! { // Consensus stuff. Authorship: pallet_authorship = 11, - Staking: darwinia_staking = 12, + DarwiniaStaking: darwinia_staking = 12, Session: pallet_session = 13, Aura: pallet_aura = 14, AuraExt: cumulus_pallet_aura_ext = 15, diff --git a/runtime/crab/src/pallets/authorship.rs b/runtime/crab/src/pallets/authorship.rs index 6b92a8a19..5b5f8109d 100644 --- a/runtime/crab/src/pallets/authorship.rs +++ b/runtime/crab/src/pallets/authorship.rs @@ -20,7 +20,7 @@ use crate::*; impl pallet_authorship::Config for Runtime { - type EventHandler = (Staking,); + type EventHandler = (DarwiniaStaking,); type FilterUncle = (); type FindAuthor = pallet_session::FindAccountFromAuthorIndex; type UncleGenerations = ConstU32<0>; diff --git a/runtime/crab/src/pallets/proxy.rs b/runtime/crab/src/pallets/proxy.rs index 8017c8bd0..866900465 100644 --- a/runtime/crab/src/pallets/proxy.rs +++ b/runtime/crab/src/pallets/proxy.rs @@ -58,7 +58,7 @@ impl frame_support::traits::InstanceFilter for ProxyType { | RuntimeCall::Assets(..) | RuntimeCall::Vesting(pallet_vesting::Call::vested_transfer { .. }) | RuntimeCall::Deposit(..) - | RuntimeCall::Staking(..) + | RuntimeCall::DarwiniaStaking(..) // Might contains transfer { | RuntimeCall::Utility(..) | RuntimeCall::Proxy(..) @@ -78,7 +78,7 @@ impl frame_support::traits::InstanceFilter for ProxyType { ProxyType::Staking => { matches!( c, - RuntimeCall::Session(..) | RuntimeCall::Deposit(..) | RuntimeCall::Staking(..) + RuntimeCall::Session(..) | RuntimeCall::Deposit(..) | RuntimeCall::DarwiniaStaking(..) ) }, ProxyType::IdentityJudgement => diff --git a/runtime/crab/src/pallets/session.rs b/runtime/crab/src/pallets/session.rs index 7cdd2521f..383efa998 100644 --- a/runtime/crab/src/pallets/session.rs +++ b/runtime/crab/src/pallets/session.rs @@ -35,7 +35,7 @@ impl pallet_session::Config for Runtime { type RuntimeEvent = RuntimeEvent; // Essentially just AURA, but lets be pedantic. type SessionHandler = ::KeyTypeIdProviders; - type SessionManager = Staking; + type SessionManager = DarwiniaStaking; type ShouldEndSession = pallet_session::PeriodicSessions; type ValidatorId = ::AccountId; // We don't have stash and controller, thus we don't need the convert as well. diff --git a/runtime/darwinia/src/lib.rs b/runtime/darwinia/src/lib.rs index 5159a8746..768f68af4 100644 --- a/runtime/darwinia/src/lib.rs +++ b/runtime/darwinia/src/lib.rs @@ -166,7 +166,7 @@ frame_support::construct_runtime! { // Consensus stuff. Authorship: pallet_authorship = 11, - Staking: darwinia_staking = 12, + DarwiniaStaking: darwinia_staking = 12, Session: pallet_session = 13, Aura: pallet_aura = 14, AuraExt: cumulus_pallet_aura_ext = 15, diff --git a/runtime/darwinia/src/pallets/authorship.rs b/runtime/darwinia/src/pallets/authorship.rs index 6b92a8a19..5b5f8109d 100644 --- a/runtime/darwinia/src/pallets/authorship.rs +++ b/runtime/darwinia/src/pallets/authorship.rs @@ -20,7 +20,7 @@ use crate::*; impl pallet_authorship::Config for Runtime { - type EventHandler = (Staking,); + type EventHandler = (DarwiniaStaking,); type FilterUncle = (); type FindAuthor = pallet_session::FindAccountFromAuthorIndex; type UncleGenerations = ConstU32<0>; diff --git a/runtime/darwinia/src/pallets/proxy.rs b/runtime/darwinia/src/pallets/proxy.rs index 3c5f767be..ccacf162b 100644 --- a/runtime/darwinia/src/pallets/proxy.rs +++ b/runtime/darwinia/src/pallets/proxy.rs @@ -58,7 +58,7 @@ impl frame_support::traits::InstanceFilter for ProxyType { | RuntimeCall::Assets(..) | RuntimeCall::Vesting(pallet_vesting::Call::vested_transfer { .. }) | RuntimeCall::Deposit(..) - | RuntimeCall::Staking(..) + | RuntimeCall::DarwiniaStaking(..) // Might contains transfer { | RuntimeCall::Utility(..) | RuntimeCall::Proxy(..) @@ -78,7 +78,7 @@ impl frame_support::traits::InstanceFilter for ProxyType { ProxyType::Staking => { matches!( c, - RuntimeCall::Session(..) | RuntimeCall::Deposit(..) | RuntimeCall::Staking(..) + RuntimeCall::Session(..) | RuntimeCall::Deposit(..) | RuntimeCall::DarwiniaStaking(..) ) }, ProxyType::IdentityJudgement => diff --git a/runtime/darwinia/src/pallets/session.rs b/runtime/darwinia/src/pallets/session.rs index 7cdd2521f..383efa998 100644 --- a/runtime/darwinia/src/pallets/session.rs +++ b/runtime/darwinia/src/pallets/session.rs @@ -35,7 +35,7 @@ impl pallet_session::Config for Runtime { type RuntimeEvent = RuntimeEvent; // Essentially just AURA, but lets be pedantic. type SessionHandler = ::KeyTypeIdProviders; - type SessionManager = Staking; + type SessionManager = DarwiniaStaking; type ShouldEndSession = pallet_session::PeriodicSessions; type ValidatorId = ::AccountId; // We don't have stash and controller, thus we don't need the convert as well. diff --git a/runtime/pangolin/src/lib.rs b/runtime/pangolin/src/lib.rs index 48e55a1b6..f016f5717 100644 --- a/runtime/pangolin/src/lib.rs +++ b/runtime/pangolin/src/lib.rs @@ -27,6 +27,7 @@ include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); mod pallets; pub use pallets::*; +mod migration; mod weights; pub use darwinia_common_runtime::*; @@ -68,7 +69,7 @@ pub type Executive = frame_executive::Executive< frame_system::ChainContext, Runtime, AllPalletsWithSystem, - pallet_assets::migration::v1::MigrateToV1, + migration::CustomOnRuntimeUpgrade, >; /// Darwinia proposal base fee. @@ -163,7 +164,7 @@ frame_support::construct_runtime! { // Consensus stuff. Authorship: pallet_authorship = 11, - Staking: darwinia_staking = 12, + DarwiniaStaking: darwinia_staking = 12, Session: pallet_session = 13, Aura: pallet_aura = 14, AuraExt: cumulus_pallet_aura_ext = 15, diff --git a/runtime/pangolin/src/migration.rs b/runtime/pangolin/src/migration.rs new file mode 100644 index 000000000..c925ec809 --- /dev/null +++ b/runtime/pangolin/src/migration.rs @@ -0,0 +1,27 @@ +// darwinia +use crate::*; + +pub struct CustomOnRuntimeUpgrade; +impl frame_support::traits::OnRuntimeUpgrade for CustomOnRuntimeUpgrade { + #[cfg(feature = "try-runtime")] + fn pre_upgrade() -> Result<(), &'static str> { + Ok(()) + } + + #[cfg(feature = "try-runtime")] + fn post_upgrade(_state: Vec) -> Result<(), &'static str> { + Ok(()) + } + + fn on_runtime_upgrade() -> frame_support::weights::Weight { + migrate() + } +} + +fn migrate() -> frame_support::weights::Weight { + as frame_support::traits::OnRuntimeUpgrade>::on_runtime_upgrade(); + frame_support::migration::move_pallet(b"Staking", b"DarwiniaStaking"); + + // frame_support::weights::Weight::zero() + RuntimeBlockWeights::get().max_block +} diff --git a/runtime/pangolin/src/pallets/authorship.rs b/runtime/pangolin/src/pallets/authorship.rs index 6b92a8a19..5b5f8109d 100644 --- a/runtime/pangolin/src/pallets/authorship.rs +++ b/runtime/pangolin/src/pallets/authorship.rs @@ -20,7 +20,7 @@ use crate::*; impl pallet_authorship::Config for Runtime { - type EventHandler = (Staking,); + type EventHandler = (DarwiniaStaking,); type FilterUncle = (); type FindAuthor = pallet_session::FindAccountFromAuthorIndex; type UncleGenerations = ConstU32<0>; diff --git a/runtime/pangolin/src/pallets/proxy.rs b/runtime/pangolin/src/pallets/proxy.rs index fe3843ca0..9da74c43d 100644 --- a/runtime/pangolin/src/pallets/proxy.rs +++ b/runtime/pangolin/src/pallets/proxy.rs @@ -57,7 +57,7 @@ impl frame_support::traits::InstanceFilter for ProxyType { | RuntimeCall::Assets(..) | RuntimeCall::Vesting(pallet_vesting::Call::vested_transfer { .. }) | RuntimeCall::Deposit(..) - | RuntimeCall::Staking(..) + | RuntimeCall::DarwiniaStaking(..) // Might contains transfer { | RuntimeCall::Utility(..) | RuntimeCall::Proxy(..) @@ -77,7 +77,7 @@ impl frame_support::traits::InstanceFilter for ProxyType { ProxyType::Staking => { matches!( c, - RuntimeCall::Session(..) | RuntimeCall::Deposit(..) | RuntimeCall::Staking(..) + RuntimeCall::Session(..) | RuntimeCall::Deposit(..) | RuntimeCall::DarwiniaStaking(..) ) }, ProxyType::IdentityJudgement => diff --git a/runtime/pangolin/src/pallets/session.rs b/runtime/pangolin/src/pallets/session.rs index 7cdd2521f..383efa998 100644 --- a/runtime/pangolin/src/pallets/session.rs +++ b/runtime/pangolin/src/pallets/session.rs @@ -35,7 +35,7 @@ impl pallet_session::Config for Runtime { type RuntimeEvent = RuntimeEvent; // Essentially just AURA, but lets be pedantic. type SessionHandler = ::KeyTypeIdProviders; - type SessionManager = Staking; + type SessionManager = DarwiniaStaking; type ShouldEndSession = pallet_session::PeriodicSessions; type ValidatorId = ::AccountId; // We don't have stash and controller, thus we don't need the convert as well. From af75e3a15b50a24a7688f672f906dbf436dc4685 Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Tue, 14 Feb 2023 13:07:53 +0800 Subject: [PATCH 142/189] Format (#280) --- Cargo.toml | 346 ++++++++++++++-------------- core/inflation/Cargo.toml | 12 +- core/primitives/Cargo.toml | 13 +- core/types/Cargo.toml | 12 +- node/Cargo.toml | 12 +- pallet/account-migration/Cargo.toml | 12 +- pallet/deposit/Cargo.toml | 14 +- pallet/ecdsa-authority/Cargo.toml | 24 +- pallet/message-gadget/Cargo.toml | 12 +- pallet/message-transact/Cargo.toml | 12 +- pallet/staking/Cargo.toml | 12 +- precompile/assets/Cargo.toml | 14 +- precompile/bls12-381/Cargo.toml | 14 +- precompile/deposit/Cargo.toml | 12 +- precompile/staking/Cargo.toml | 12 +- precompile/state-storage/Cargo.toml | 12 +- runtime/common/Cargo.toml | 12 +- runtime/crab/Cargo.toml | 14 +- runtime/darwinia/Cargo.toml | 24 +- runtime/pangolin/Cargo.toml | 12 +- 20 files changed, 304 insertions(+), 303 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 8ffe5daa7..1420c5e7d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,14 +1,6 @@ [profile.release] panic = "unwind" -[workspace.package] -authors = ["Darwinia Network "] -edition = "2021" -homepage = "https://darwinia.network" -license = "GPL-3.0" -repository = "https://github.com/darwinia-network/darwinia" -version = "6.0.0" - [workspace] members = [ "core/*", @@ -18,178 +10,186 @@ members = [ "runtime/*", ] -[workspace.dependencies] -# crates.io -array-bytes = { version = "6.0" } -codec = { package = "parity-scale-codec", version = "3.3", default-features = false, features = ["derive"] } -libsecp256k1 = { version = "0.7" } -scale-info = { version = "2.3", default-features = false, features = ["derive"] } -sha3 = { version = "0.9" } -static_assertions = { version = "1.1" } + [workspace.package] + authors = ["Darwinia Network "] + edition = "2021" + homepage = "https://darwinia.network" + license = "GPL-3.0" + repository = "https://github.com/darwinia-network/darwinia" + version = "6.0.0" + + [workspace.dependencies] + # crates.io + array-bytes = { version = "6.0" } + codec = { package = "parity-scale-codec", version = "3.3", default-features = false, features = ["derive"] } + libsecp256k1 = { version = "0.7" } + scale-info = { version = "2.3", default-features = false, features = ["derive"] } + sha3 = { version = "0.9" } + static_assertions = { version = "1.1" } -# cumulus -cumulus-pallet-aura-ext = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } -cumulus-pallet-dmp-queue = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } -cumulus-pallet-parachain-system = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } -cumulus-pallet-session-benchmarking = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } -cumulus-pallet-xcm = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } -cumulus-pallet-xcmp-queue = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } -cumulus-primitives-core = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } -cumulus-primitives-timestamp = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } -cumulus-primitives-utility = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } -parachain-info = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } -cumulus-client-cli = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.36" } -cumulus-client-collator = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.36" } -cumulus-client-consensus-aura = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.36" } -cumulus-client-consensus-common = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.36" } -cumulus-client-network = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.36" } -cumulus-client-service = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.36" } -cumulus-primitives-parachain-inherent = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.36" } -cumulus-relay-chain-interface = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.36" } + # cumulus + cumulus-client-cli = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.36" } + cumulus-client-collator = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.36" } + cumulus-client-consensus-aura = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.36" } + cumulus-client-consensus-common = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.36" } + cumulus-client-network = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.36" } + cumulus-client-service = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.36" } + cumulus-pallet-aura-ext = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } + cumulus-pallet-dmp-queue = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } + cumulus-pallet-parachain-system = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } + cumulus-pallet-session-benchmarking = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } + cumulus-pallet-xcm = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } + cumulus-pallet-xcmp-queue = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } + cumulus-primitives-core = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } + cumulus-primitives-parachain-inherent = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.36" } + cumulus-primitives-timestamp = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } + cumulus-primitives-utility = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } + cumulus-relay-chain-interface = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.36" } + parachain-info = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } -# darwinia -dc-types = { path = "core/types" } -darwinia-account-migration = { default-features = false, path = "pallet/account-migration" } -darwinia-common-runtime = { default-features = false, path = "runtime/common" } -darwinia-deposit = { default-features = false, path = "pallet/deposit" } -darwinia-ecdsa-authority = { default-features = false, path = "pallet/ecdsa-authority" } -darwinia-message-gadget = { default-features = false, path = "pallet/message-gadget" } -darwinia-message-transact = { default-features = false, path = "pallet/message-transact" } -darwinia-precompile-assets = { default-features = false, path = "precompile/assets" } -darwinia-precompile-bls12-381 = { default-features = false, path = "precompile/bls12-381" } -darwinia-precompile-deposit = { default-features = false, path = "precompile/deposit" } -darwinia-precompile-staking = { default-features = false, path = "precompile/staking" } -darwinia-precompile-state-storage = { default-features = false, path = "precompile/state-storage" } -darwinia-staking = { default-features = false, path = "pallet/staking" } -dc-primitives = { default-features = false, path = "core/primitives" } -dc-inflation = { default-features = false, path = "core/inflation" } -crab-runtime = { path = "runtime/crab" } -darwinia-runtime = { path = "runtime/darwinia" } -pangolin-runtime = { path = "runtime/pangolin" } + # darwinia + crab-runtime = { path = "runtime/crab" } + darwinia-account-migration = { default-features = false, path = "pallet/account-migration" } + darwinia-common-runtime = { default-features = false, path = "runtime/common" } + darwinia-deposit = { default-features = false, path = "pallet/deposit" } + darwinia-ecdsa-authority = { default-features = false, path = "pallet/ecdsa-authority" } + darwinia-message-gadget = { default-features = false, path = "pallet/message-gadget" } + darwinia-message-transact = { default-features = false, path = "pallet/message-transact" } + darwinia-precompile-assets = { default-features = false, path = "precompile/assets" } + darwinia-precompile-bls12-381 = { default-features = false, path = "precompile/bls12-381" } + darwinia-precompile-deposit = { default-features = false, path = "precompile/deposit" } + darwinia-precompile-staking = { default-features = false, path = "precompile/staking" } + darwinia-precompile-state-storage = { default-features = false, path = "precompile/state-storage" } + darwinia-runtime = { path = "runtime/darwinia" } + darwinia-staking = { default-features = false, path = "pallet/staking" } + dc-inflation = { default-features = false, path = "core/inflation" } + dc-primitives = { default-features = false, path = "core/primitives" } + dc-types = { path = "core/types" } + pangolin-runtime = { path = "runtime/pangolin" } -# darwinia-messages-substrate -bp-darwinia-core = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } -bp-messages = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } -bp-message-dispatch = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } -bp-polkadot-core = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } -bp-runtime = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } -bridge-runtime-common = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } -pallet-bridge-dispatch = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } -pallet-bridge-grandpa = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } -pallet-bridge-messages = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } -pallet-bridge-parachains = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } -pallet-fee-market = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } + # darwinia-messages-substrate + bp-darwinia-core = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } + bp-message-dispatch = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } + bp-messages = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } + bp-polkadot-core = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } + bp-runtime = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } + bridge-runtime-common = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } + pallet-bridge-dispatch = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } + pallet-bridge-grandpa = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } + pallet-bridge-messages = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } + pallet-bridge-parachains = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } + pallet-fee-market = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } -# frontier -fp-ethereum = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } -fp-evm = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } -fp-self-contained = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } -fp-rpc = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } -pallet-ethereum = { default-features = false, features = ["forbid-evm-reentrancy"], git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } -pallet-evm = { default-features = false, features = ["forbid-evm-reentrancy"], git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } -pallet-evm-precompile-blake2 = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } -pallet-evm-precompile-bn128 = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } -pallet-evm-precompile-dispatch = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } -pallet-evm-precompile-modexp = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } -pallet-evm-precompile-simple = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } -fc-cli = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } -fc-consensus = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } -fc-db = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } -fc-mapping-sync = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } -fc-rpc = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } -fc-rpc-core = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } -fp-storage = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } + # frontier + fc-cli = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } + fc-consensus = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } + fc-db = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } + fc-mapping-sync = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } + fc-rpc = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } + fc-rpc-core = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } + fp-ethereum = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } + fp-evm = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } + fp-rpc = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } + fp-self-contained = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } + fp-storage = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } + pallet-ethereum = { default-features = false, features = ["forbid-evm-reentrancy"], git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } + pallet-evm = { default-features = false, features = ["forbid-evm-reentrancy"], git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } + pallet-evm-precompile-blake2 = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } + pallet-evm-precompile-bn128 = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } + pallet-evm-precompile-dispatch = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } + pallet-evm-precompile-modexp = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } + pallet-evm-precompile-simple = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } -# moonbeam -account = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.36" } -precompile-utils = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.36" } -xcm-primitives = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.36" } + # moonbeam + account = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.36" } + precompile-utils = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.36" } + xcm-primitives = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.36" } -# polkadot -pallet-xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36" } -polkadot-parachain = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36" } -polkadot-runtime-common = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36" } -xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36" } -xcm-builder = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36" } -xcm-executor = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36" } -polkadot-cli = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36" } -polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36" } -polkadot-service = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36" } + # polkadot + pallet-xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36" } + polkadot-cli = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36" } + polkadot-parachain = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36" } + polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36" } + polkadot-runtime-common = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36" } + polkadot-service = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36" } + xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36" } + xcm-builder = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36" } + xcm-executor = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36" } -# substrate -frame-benchmarking = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -frame-executive = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -frame-system-benchmarking = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -frame-system-rpc-runtime-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -frame-try-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-assets = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-aura = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-authorship = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-balances = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-collective = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-democracy = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-elections-phragmen = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-identity = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-membership = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-multisig = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-preimage = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-proxy = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-scheduler = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-session = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-sudo = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-timestamp = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-tips = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-transaction-payment = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-transaction-payment-rpc-runtime-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-treasury = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-utility = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-vesting = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-arithmetic = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-block-builder = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-consensus-aura = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-inherents = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-io = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-keyring = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-offchain = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-session = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-transaction-pool = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-version = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -frame-benchmarking-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -pallet-transaction-payment-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sc-basic-authorship = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sc-chain-spec = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sc-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sc-consensus-aura = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sc-executor = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sc-keystore = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sc-network = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sc-network-common = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sc-offchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sc-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sc-rpc-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sc-service = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sc-sysinfo = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sc-telemetry = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sc-tracing = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sc-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sc-transaction-pool-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-consensus = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -substrate-frame-rpc-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -substrate-prometheus-endpoint = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -substrate-build-script-utils = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } -try-runtime-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } + # substrate + frame-benchmarking = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } + frame-benchmarking-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } + frame-executive = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } + frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } + frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } + frame-system-benchmarking = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } + frame-system-rpc-runtime-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } + frame-try-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } + pallet-assets = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } + pallet-aura = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } + pallet-authorship = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } + pallet-balances = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } + pallet-collective = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } + pallet-democracy = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } + pallet-elections-phragmen = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } + pallet-identity = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } + pallet-membership = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } + pallet-multisig = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } + pallet-preimage = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } + pallet-proxy = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } + pallet-scheduler = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } + pallet-session = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } + pallet-sudo = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } + pallet-timestamp = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } + pallet-tips = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } + pallet-transaction-payment = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } + pallet-transaction-payment-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } + pallet-transaction-payment-rpc-runtime-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } + pallet-treasury = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } + pallet-utility = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } + pallet-vesting = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } + sc-basic-authorship = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } + sc-chain-spec = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } + sc-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } + sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } + sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } + sc-consensus-aura = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } + sc-executor = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } + sc-keystore = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } + sc-network = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } + sc-network-common = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } + sc-offchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } + sc-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } + sc-rpc-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } + sc-service = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } + sc-sysinfo = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } + sc-telemetry = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } + sc-tracing = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } + sc-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } + sc-transaction-pool-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } + sp-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } + sp-arithmetic = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } + sp-block-builder = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } + sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } + sp-consensus = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } + sp-consensus-aura = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } + sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } + sp-inherents = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } + sp-io = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } + sp-keyring = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } + sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } + sp-offchain = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } + sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } + sp-session = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } + sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } + sp-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } + sp-transaction-pool = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } + sp-version = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } + substrate-build-script-utils = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } + substrate-frame-rpc-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } + substrate-prometheus-endpoint = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } + substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } + try-runtime-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } [patch."https://github.com/paritytech/substrate"] beefy-gadget = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } diff --git a/core/inflation/Cargo.toml b/core/inflation/Cargo.toml index cb516fb9c..70abf4491 100644 --- a/core/inflation/Cargo.toml +++ b/core/inflation/Cargo.toml @@ -1,10 +1,10 @@ [package] -name = "dc-inflation" -description = "Darwinia economic inflation mechanism implementation." -readme = "README.md" -authors = { workspace = true } -edition = { workspace = true } -version = { workspace = true } +authors.workspace = true +description = "Darwinia economic inflation mechanism implementation." +edition.workspace = true +name = "dc-inflation" +readme = "README.md" +version.workspace = true [dependencies] # crates.io diff --git a/core/primitives/Cargo.toml b/core/primitives/Cargo.toml index d984ac6e7..65e205d44 100644 --- a/core/primitives/Cargo.toml +++ b/core/primitives/Cargo.toml @@ -1,10 +1,10 @@ [package] -name = "dc-primitives" -description = "Darwinia chain core primitives." -readme = "README.md" -authors = { workspace = true } -edition = { workspace = true } -version = { workspace = true } +authors.workspace = true +description = "Darwinia chain core primitives." +edition.workspace = true +name = "dc-primitives" +readme = "README.md" +version.workspace = true [dependencies] # darwinia @@ -22,6 +22,7 @@ default = ["std"] std = [ # moonbeam "account/std", + # substrate "sp-core/std", "sp-runtime/std", diff --git a/core/types/Cargo.toml b/core/types/Cargo.toml index 029b234e0..d16c1c4b7 100644 --- a/core/types/Cargo.toml +++ b/core/types/Cargo.toml @@ -1,7 +1,7 @@ [package] -name = "dc-types" -description = "Darwinia core types." -readme = "README.md" -authors = { workspace = true } -edition = { workspace = true } -version = { workspace = true } +authors.workspace = true +description = "Darwinia core types." +edition.workspace = true +name = "dc-types" +readme = "README.md" +version.workspace = true diff --git a/node/Cargo.toml b/node/Cargo.toml index b34834439..df606523a 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -1,10 +1,10 @@ [package] -name = "darwinia" -description = "Darwinia node." -readme = "README.md" -authors = { workspace = true } -edition = { workspace = true } -version = { workspace = true } +authors.workspace = true +description = "Darwinia node." +edition.workspace = true +name = "darwinia" +readme = "README.md" +version.workspace = true [build-dependencies] substrate-build-script-utils = { workspace = true } diff --git a/pallet/account-migration/Cargo.toml b/pallet/account-migration/Cargo.toml index de1f6061d..f7b9be10a 100644 --- a/pallet/account-migration/Cargo.toml +++ b/pallet/account-migration/Cargo.toml @@ -1,10 +1,10 @@ [package] -name = "darwinia-account-migration" -description = "Darwinia SR25519 to ECDSA account migration." -readme = "README.md" -authors = { workspace = true } -edition = { workspace = true } -version = { workspace = true } +authors.workspace = true +description = "Darwinia SR25519 to ECDSA account migration." +edition.workspace = true +name = "darwinia-account-migration" +readme = "README.md" +version.workspace = true [dependencies] # crates.io diff --git a/pallet/deposit/Cargo.toml b/pallet/deposit/Cargo.toml index f8144e4c8..8445a26dd 100644 --- a/pallet/deposit/Cargo.toml +++ b/pallet/deposit/Cargo.toml @@ -1,10 +1,10 @@ [package] -name = "darwinia-deposit" -description = "Darwinia deposit mechanism implementation." -readme = "README.md" -authors = { workspace = true } -edition = { workspace = true } -version = { workspace = true } +authors.workspace = true +description = "Darwinia deposit mechanism implementation." +edition.workspace = true +name = "darwinia-deposit" +readme = "README.md" +version.workspace = true [dependencies] # crates.io @@ -26,7 +26,7 @@ sp-std = { workspace = true } [dev-dependencies] # substrate pallet-assets = { workspace = true, features = ["std"] } -pallet-balances = { workspace = true, features = ["std"] } +pallet-balances = { workspace = true, features = ["std"] } pallet-timestamp = { workspace = true, features = ["std"] } sp-io = { workspace = true } diff --git a/pallet/ecdsa-authority/Cargo.toml b/pallet/ecdsa-authority/Cargo.toml index c36ea71da..50844af3e 100644 --- a/pallet/ecdsa-authority/Cargo.toml +++ b/pallet/ecdsa-authority/Cargo.toml @@ -1,10 +1,10 @@ [package] -name = "darwinia-ecdsa-authority" -description = "Relayer Authorities Protocal Implementation" -readme = "README.md" -authors = { workspace = true } -edition = { workspace = true } -version = { workspace = true } +authors.workspace = true +description = "Relayer Authorities Protocal Implementation" +edition.workspace = true +name = "darwinia-ecdsa-authority" +readme = "README.md" +version.workspace = true [dependencies] # crates.io @@ -16,12 +16,12 @@ scale-info = { workspace = true } dc-primitives = { workspace = true } # substrate -frame-support = { workspace = true} -frame-system = { workspace = true} -sp-core = { workspace = true} -sp-io = { workspace = true} -sp-runtime = { workspace = true} -sp-std = { workspace = true} +frame-support = { workspace = true } +frame-system = { workspace = true } +sp-core = { workspace = true } +sp-io = { workspace = true } +sp-runtime = { workspace = true } +sp-std = { workspace = true } [dev-dependencies] array-bytes = { workspace = true } diff --git a/pallet/message-gadget/Cargo.toml b/pallet/message-gadget/Cargo.toml index f789df761..64c07163c 100644 --- a/pallet/message-gadget/Cargo.toml +++ b/pallet/message-gadget/Cargo.toml @@ -1,10 +1,10 @@ [package] -name = "darwinia-message-gadget" -description = "Darwinia messages gadget." -readme = "README.md" -authors = { workspace = true } -edition = { workspace = true } -version = { workspace = true } +authors.workspace = true +description = "Darwinia messages gadget." +edition.workspace = true +name = "darwinia-message-gadget" +readme = "README.md" +version.workspace = true [dependencies] # crates.io diff --git a/pallet/message-transact/Cargo.toml b/pallet/message-transact/Cargo.toml index 35e4997eb..4dd967889 100644 --- a/pallet/message-transact/Cargo.toml +++ b/pallet/message-transact/Cargo.toml @@ -1,10 +1,10 @@ [package] -name = "darwinia-message-transact" -description = "LCMP evm message execution." -readme = "README.md" -authors = { workspace = true } -edition = { workspace = true } -version = { workspace = true } +authors.workspace = true +description = "LCMP evm message execution." +edition.workspace = true +name = "darwinia-message-transact" +readme = "README.md" +version.workspace = true [dependencies] # crates.io diff --git a/pallet/staking/Cargo.toml b/pallet/staking/Cargo.toml index ebf535729..79c4b1992 100644 --- a/pallet/staking/Cargo.toml +++ b/pallet/staking/Cargo.toml @@ -1,10 +1,10 @@ [package] -name = "darwinia-staking" -description = "Darwinia parachain staking." -readme = "README.md" -authors = { workspace = true } -edition = { workspace = true } -version = { workspace = true } +authors.workspace = true +description = "Darwinia parachain staking." +edition.workspace = true +name = "darwinia-staking" +readme = "README.md" +version.workspace = true [dependencies] # crates.io diff --git a/precompile/assets/Cargo.toml b/precompile/assets/Cargo.toml index 5b31ea4bb..e97dd3129 100644 --- a/precompile/assets/Cargo.toml +++ b/precompile/assets/Cargo.toml @@ -1,10 +1,10 @@ [package] -name = "darwinia-precompile-assets" -description = "Assets precompile for EVM pallet." -readme = "README.md" -authors = { workspace = true } -edition = { workspace = true } -version = { workspace = true } +authors.workspace = true +description = "Assets precompile for EVM pallet." +edition.workspace = true +name = "darwinia-precompile-assets" +readme = "README.md" +version.workspace = true [dependencies] # frontier @@ -12,7 +12,7 @@ fp-evm = { workspace = true } pallet-evm = { workspace = true } # moonbeam -precompile-utils = { workspace = true} +precompile-utils = { workspace = true } # paritytech frame-support = { workspace = true } diff --git a/precompile/bls12-381/Cargo.toml b/precompile/bls12-381/Cargo.toml index a350b5adf..66d6bd758 100644 --- a/precompile/bls12-381/Cargo.toml +++ b/precompile/bls12-381/Cargo.toml @@ -1,10 +1,10 @@ [package] -name = "darwinia-precompile-bls12-381" -description = "BLS12-381 implementation for EVM pallet." -readme = "README.md" -authors = { workspace = true } -edition = { workspace = true } -version = { workspace = true } +authors.workspace = true +description = "BLS12-381 implementation for EVM pallet." +edition.workspace = true +name = "darwinia-precompile-bls12-381" +readme = "README.md" +version.workspace = true [dependencies] # crates.io @@ -18,7 +18,7 @@ pallet-evm = { workspace = true } precompile-utils = { workspace = true } # substrate -sp-std = { workspace = true } +sp-std = { workspace = true } [dev-dependencies] # crates.io diff --git a/precompile/deposit/Cargo.toml b/precompile/deposit/Cargo.toml index fac91b93b..235219b7e 100644 --- a/precompile/deposit/Cargo.toml +++ b/precompile/deposit/Cargo.toml @@ -1,10 +1,10 @@ [package] -name = "darwinia-precompile-deposit" -description = "Deposit precompile for EVM pallet." -readme = "README.md" -authors = { workspace = true } -edition = { workspace = true } -version = { workspace = true } +authors.workspace = true +description = "Deposit precompile for EVM pallet." +edition.workspace = true +name = "darwinia-precompile-deposit" +readme = "README.md" +version.workspace = true [dependencies] # frontier diff --git a/precompile/staking/Cargo.toml b/precompile/staking/Cargo.toml index 1e9d72f38..3f1d2dc61 100644 --- a/precompile/staking/Cargo.toml +++ b/precompile/staking/Cargo.toml @@ -1,10 +1,10 @@ [package] -name = "darwinia-precompile-staking" -description = "Staking precompile for EVM pallet." -readme = "README.md" -authors = { workspace = true } -edition = { workspace = true } -version = { workspace = true } +authors.workspace = true +description = "Staking precompile for EVM pallet." +edition.workspace = true +name = "darwinia-precompile-staking" +readme = "README.md" +version.workspace = true [dependencies] # frontier diff --git a/precompile/state-storage/Cargo.toml b/precompile/state-storage/Cargo.toml index 3efc198e3..91af015b9 100644 --- a/precompile/state-storage/Cargo.toml +++ b/precompile/state-storage/Cargo.toml @@ -1,10 +1,10 @@ [package] -name = "darwinia-precompile-state-storage" -description = "State storage precompile for EVM pallet." -readme = "README.md" -authors = { workspace = true } -edition = { workspace = true } -version = { workspace = true } +authors.workspace = true +description = "State storage precompile for EVM pallet." +edition.workspace = true +name = "darwinia-precompile-state-storage" +readme = "README.md" +version.workspace = true [dependencies] # frontier diff --git a/runtime/common/Cargo.toml b/runtime/common/Cargo.toml index 4f6c85299..5d6f56847 100644 --- a/runtime/common/Cargo.toml +++ b/runtime/common/Cargo.toml @@ -1,10 +1,10 @@ [package] -name = "darwinia-common-runtime" -description = "Darwinia Common Runtime" -readme = "README.md" -authors = { workspace = true } -edition = { workspace = true } -version = { workspace = true } +authors.workspace = true +description = "Darwinia Common Runtime" +edition.workspace = true +name = "darwinia-common-runtime" +readme = "README.md" +version.workspace = true [dependencies] # crates.io diff --git a/runtime/crab/Cargo.toml b/runtime/crab/Cargo.toml index 0e78a8a2a..9ff8066f5 100644 --- a/runtime/crab/Cargo.toml +++ b/runtime/crab/Cargo.toml @@ -1,10 +1,10 @@ [package] -name = "crab-runtime" -description = "Crab runtime." -readme = "README.md" -authors = { workspace = true } -edition = { workspace = true } -version = { workspace = true } +authors.workspace = true +description = "Crab runtime." +edition.workspace = true +name = "crab-runtime" +readme = "README.md" +version.workspace = true [build-dependencies] substrate-wasm-builder = { workspace = true } @@ -242,7 +242,7 @@ std = [ # substrate optional "frame-benchmarking?/std", "frame-system-benchmarking?/std", - "frame-try-runtime?/std" + "frame-try-runtime?/std", ] fast-runtime = [] diff --git a/runtime/darwinia/Cargo.toml b/runtime/darwinia/Cargo.toml index 3a632c1d1..e766d0a7e 100644 --- a/runtime/darwinia/Cargo.toml +++ b/runtime/darwinia/Cargo.toml @@ -1,10 +1,10 @@ [package] -name = "darwinia-runtime" -description = "Darwinia runtime." -readme = "README.md" -authors = { workspace = true } -edition = { workspace = true } -version = { workspace = true } +authors.workspace = true +description = "Darwinia runtime." +edition.workspace = true +name = "darwinia-runtime" +readme = "README.md" +version.workspace = true [build-dependencies] substrate-wasm-builder = { workspace = true } @@ -73,12 +73,12 @@ precompile-utils = { workspace = true } xcm-primitives = { workspace = true } # polkadot -pallet-xcm = { workspace = true} -polkadot-parachain = { workspace = true} -polkadot-runtime-common = { workspace = true} -xcm = { workspace = true} -xcm-builder = { workspace = true} -xcm-executor = { workspace = true} +pallet-xcm = { workspace = true } +polkadot-parachain = { workspace = true } +polkadot-runtime-common = { workspace = true } +xcm = { workspace = true } +xcm-builder = { workspace = true } +xcm-executor = { workspace = true } # substrate frame-executive = { workspace = true } diff --git a/runtime/pangolin/Cargo.toml b/runtime/pangolin/Cargo.toml index bc920c7d9..1d758828b 100644 --- a/runtime/pangolin/Cargo.toml +++ b/runtime/pangolin/Cargo.toml @@ -1,10 +1,10 @@ [package] -name = "pangolin-runtime" -description = "Pangolin runtime." -readme = "README.md" -authors = { workspace = true } -edition = { workspace = true } -version = { workspace = true } +authors.workspace = true +description = "Pangolin runtime." +edition.workspace = true +name = "pangolin-runtime" +readme = "README.md" +version.workspace = true [build-dependencies] substrate-wasm-builder = { workspace = true } From 49a48ebf4f99ecf36fd3ba83bdd3dddfd4db24f6 Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Wed, 15 Feb 2023 11:53:28 +0800 Subject: [PATCH 143/189] Add Pangoro2 (#281) * Format * Deduplicate * Add Pangoro2 * Rename * Fix * Fix * Rename * Doc * Set SS58 in runtime and remove from chain spec --- Cargo.lock | 106 ++++ Cargo.toml | 1 + node/Cargo.toml | 12 + node/src/chain_spec/crab.rs | 2 +- node/src/chain_spec/darwinia.rs | 2 +- node/src/chain_spec/mod.rs | 14 +- node/src/chain_spec/pangolin.rs | 2 +- node/src/chain_spec/pangoro.rs | 362 +++++++++++ node/src/command.rs | 235 +++++-- node/src/service/executors.rs | 19 + node/src/service/mod.rs | 11 +- runtime/common/Cargo.toml | 4 + runtime/common/src/lib.rs | 44 ++ runtime/crab/src/lib.rs | 47 +- runtime/crab/src/pallets/deposit.rs | 6 +- runtime/crab/src/pallets/evm.rs | 3 +- runtime/crab/src/pallets/staking.rs | 12 +- runtime/crab/src/pallets/system.rs | 2 +- runtime/darwinia/src/lib.rs | 45 -- runtime/darwinia/src/pallets/evm.rs | 3 +- runtime/pangolin/Cargo.toml | 1 - runtime/pangolin/src/lib.rs | 47 +- runtime/pangolin/src/migration.rs | 1 + runtime/pangolin/src/pallets/deposit.rs | 6 +- runtime/pangolin/src/pallets/evm.rs | 3 +- runtime/pangolin/src/pallets/staking.rs | 12 +- runtime/pangolin/src/pallets/system.rs | 2 +- runtime/pangoro/Cargo.toml | 368 +++++++++++ runtime/pangoro/build.rs | 24 + runtime/pangoro/src/lib.rs | 597 ++++++++++++++++++ runtime/pangoro/src/migration.rs | 43 ++ .../pangoro/src/pallets/account_migration.rs | 24 + runtime/pangoro/src/pallets/assets.rs | 53 ++ runtime/pangoro/src/pallets/aura.rs | 26 + runtime/pangoro/src/pallets/aura_ext.rs | 22 + runtime/pangoro/src/pallets/authorship.rs | 27 + runtime/pangoro/src/pallets/balances.rs | 32 + runtime/pangoro/src/pallets/collective.rs | 50 ++ runtime/pangoro/src/pallets/democracy.rs | 64 ++ runtime/pangoro/src/pallets/deposit.rs | 53 ++ runtime/pangoro/src/pallets/dmp_queue.rs | 26 + .../pangoro/src/pallets/ecdsa_authority.rs | 39 ++ .../pangoro/src/pallets/elections_phragmen.rs | 49 ++ runtime/pangoro/src/pallets/ethereum.rs | 25 + runtime/pangoro/src/pallets/evm.rs | 194 ++++++ runtime/pangoro/src/pallets/identity.rs | 39 ++ runtime/pangoro/src/pallets/membership.rs | 33 + runtime/pangoro/src/pallets/message_gadget.rs | 22 + .../pangoro/src/pallets/message_transact.rs | 25 + runtime/pangoro/src/pallets/mod.rs | 111 ++++ runtime/pangoro/src/pallets/multisig.rs | 32 + .../pangoro/src/pallets/parachain_info_.rs | 22 + .../pangoro/src/pallets/parachain_system.rs | 37 ++ runtime/pangoro/src/pallets/polkadot_xcm.rs | 186 ++++++ runtime/pangoro/src/pallets/preimage.rs | 29 + runtime/pangoro/src/pallets/proxy.rs | 120 ++++ runtime/pangoro/src/pallets/scheduler.rs | 63 ++ runtime/pangoro/src/pallets/session.rs | 44 ++ runtime/pangoro/src/pallets/staking.rs | 87 +++ runtime/pangoro/src/pallets/sudo.rs | 25 + runtime/pangoro/src/pallets/system.rs | 109 ++++ runtime/pangoro/src/pallets/timestamp.rs | 28 + runtime/pangoro/src/pallets/tips.rs | 35 + .../src/pallets/transaction_payment.rs | 32 + runtime/pangoro/src/pallets/treasury.rs | 47 ++ runtime/pangoro/src/pallets/utility.rs | 27 + runtime/pangoro/src/pallets/vesting.rs | 40 ++ runtime/pangoro/src/pallets/xcmp_queue.rs | 31 + runtime/pangoro/src/weights/block_weights.rs | 48 ++ .../src/weights/cumulus_pallet_xcmp_queue.rs | 67 ++ .../pangoro/src/weights/extrinsic_weights.rs | 47 ++ runtime/pangoro/src/weights/frame_system.rs | 88 +++ runtime/pangoro/src/weights/mod.rs | 39 ++ .../pangoro/src/weights/pallet_balances.rs | 97 +++ runtime/pangoro/src/weights/pallet_session.rs | 69 ++ .../pangoro/src/weights/pallet_timestamp.rs | 64 ++ .../pangoro/src/weights/paritydb_weights.rs | 63 ++ .../pangoro/src/weights/rocksdb_weights.rs | 63 ++ runtime/pangoro/tests/mock.rs | 65 ++ runtime/pangoro/tests/tests.rs | 3 + 80 files changed, 4419 insertions(+), 238 deletions(-) create mode 100644 node/src/chain_spec/pangoro.rs create mode 100644 runtime/pangoro/Cargo.toml create mode 100644 runtime/pangoro/build.rs create mode 100644 runtime/pangoro/src/lib.rs create mode 100644 runtime/pangoro/src/migration.rs create mode 100644 runtime/pangoro/src/pallets/account_migration.rs create mode 100644 runtime/pangoro/src/pallets/assets.rs create mode 100644 runtime/pangoro/src/pallets/aura.rs create mode 100644 runtime/pangoro/src/pallets/aura_ext.rs create mode 100644 runtime/pangoro/src/pallets/authorship.rs create mode 100644 runtime/pangoro/src/pallets/balances.rs create mode 100644 runtime/pangoro/src/pallets/collective.rs create mode 100644 runtime/pangoro/src/pallets/democracy.rs create mode 100644 runtime/pangoro/src/pallets/deposit.rs create mode 100644 runtime/pangoro/src/pallets/dmp_queue.rs create mode 100644 runtime/pangoro/src/pallets/ecdsa_authority.rs create mode 100644 runtime/pangoro/src/pallets/elections_phragmen.rs create mode 100644 runtime/pangoro/src/pallets/ethereum.rs create mode 100644 runtime/pangoro/src/pallets/evm.rs create mode 100644 runtime/pangoro/src/pallets/identity.rs create mode 100644 runtime/pangoro/src/pallets/membership.rs create mode 100644 runtime/pangoro/src/pallets/message_gadget.rs create mode 100644 runtime/pangoro/src/pallets/message_transact.rs create mode 100644 runtime/pangoro/src/pallets/mod.rs create mode 100644 runtime/pangoro/src/pallets/multisig.rs create mode 100644 runtime/pangoro/src/pallets/parachain_info_.rs create mode 100644 runtime/pangoro/src/pallets/parachain_system.rs create mode 100644 runtime/pangoro/src/pallets/polkadot_xcm.rs create mode 100644 runtime/pangoro/src/pallets/preimage.rs create mode 100644 runtime/pangoro/src/pallets/proxy.rs create mode 100644 runtime/pangoro/src/pallets/scheduler.rs create mode 100644 runtime/pangoro/src/pallets/session.rs create mode 100644 runtime/pangoro/src/pallets/staking.rs create mode 100644 runtime/pangoro/src/pallets/sudo.rs create mode 100644 runtime/pangoro/src/pallets/system.rs create mode 100644 runtime/pangoro/src/pallets/timestamp.rs create mode 100644 runtime/pangoro/src/pallets/tips.rs create mode 100644 runtime/pangoro/src/pallets/transaction_payment.rs create mode 100644 runtime/pangoro/src/pallets/treasury.rs create mode 100644 runtime/pangoro/src/pallets/utility.rs create mode 100644 runtime/pangoro/src/pallets/vesting.rs create mode 100644 runtime/pangoro/src/pallets/xcmp_queue.rs create mode 100644 runtime/pangoro/src/weights/block_weights.rs create mode 100644 runtime/pangoro/src/weights/cumulus_pallet_xcmp_queue.rs create mode 100644 runtime/pangoro/src/weights/extrinsic_weights.rs create mode 100644 runtime/pangoro/src/weights/frame_system.rs create mode 100644 runtime/pangoro/src/weights/mod.rs create mode 100644 runtime/pangoro/src/weights/pallet_balances.rs create mode 100644 runtime/pangoro/src/weights/pallet_session.rs create mode 100644 runtime/pangoro/src/weights/pallet_timestamp.rs create mode 100644 runtime/pangoro/src/weights/paritydb_weights.rs create mode 100644 runtime/pangoro/src/weights/rocksdb_weights.rs create mode 100644 runtime/pangoro/tests/mock.rs create mode 100644 runtime/pangoro/tests/tests.rs diff --git a/Cargo.lock b/Cargo.lock index 03d3606ae..8063c4a11 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2206,6 +2206,7 @@ dependencies = [ "log", "pallet-transaction-payment-rpc", "pangolin-runtime", + "pangoro-runtime", "parity-scale-codec", "polkadot-cli", "polkadot-parachain", @@ -2285,7 +2286,9 @@ dependencies = [ "dc-primitives", "frame-support", "frame-system", + "pallet-balances", "pallet-collective", + "pallet-treasury", "parity-scale-codec", "smallvec", "sp-io", @@ -7455,6 +7458,109 @@ dependencies = [ "xcm-primitives", ] +[[package]] +name = "pangoro-runtime" +version = "6.0.0" +dependencies = [ + "array-bytes 6.0.0", + "bp-message-dispatch", + "bp-messages", + "bp-polkadot-core", + "bp-runtime", + "bridge-runtime-common", + "cumulus-pallet-aura-ext", + "cumulus-pallet-dmp-queue", + "cumulus-pallet-parachain-system", + "cumulus-pallet-session-benchmarking", + "cumulus-pallet-xcm", + "cumulus-pallet-xcmp-queue", + "cumulus-primitives-core", + "cumulus-primitives-timestamp", + "cumulus-primitives-utility", + "darwinia-account-migration", + "darwinia-common-runtime", + "darwinia-deposit", + "darwinia-ecdsa-authority", + "darwinia-message-gadget", + "darwinia-message-transact", + "darwinia-precompile-assets", + "darwinia-precompile-bls12-381", + "darwinia-precompile-deposit", + "darwinia-precompile-staking", + "darwinia-precompile-state-storage", + "darwinia-staking", + "dc-primitives", + "fp-rpc", + "fp-self-contained", + "frame-benchmarking", + "frame-executive", + "frame-support", + "frame-system", + "frame-system-benchmarking", + "frame-system-rpc-runtime-api", + "frame-try-runtime", + "pallet-assets", + "pallet-aura", + "pallet-authorship", + "pallet-balances", + "pallet-bridge-dispatch", + "pallet-bridge-grandpa", + "pallet-bridge-messages", + "pallet-bridge-parachains", + "pallet-collective", + "pallet-democracy", + "pallet-elections-phragmen", + "pallet-ethereum", + "pallet-evm", + "pallet-evm-precompile-blake2", + "pallet-evm-precompile-bn128", + "pallet-evm-precompile-dispatch", + "pallet-evm-precompile-modexp", + "pallet-evm-precompile-simple", + "pallet-fee-market", + "pallet-identity", + "pallet-membership", + "pallet-multisig", + "pallet-preimage", + "pallet-proxy", + "pallet-scheduler", + "pallet-session", + "pallet-sudo", + "pallet-timestamp", + "pallet-tips", + "pallet-transaction-payment", + "pallet-transaction-payment-rpc-runtime-api", + "pallet-treasury", + "pallet-utility", + "pallet-vesting", + "pallet-xcm", + "parachain-info", + "parity-scale-codec", + "polkadot-parachain", + "polkadot-runtime-common", + "precompile-utils", + "scale-info", + "sp-api", + "sp-block-builder", + "sp-consensus-aura", + "sp-core", + "sp-inherents", + "sp-io", + "sp-keyring", + "sp-offchain", + "sp-runtime", + "sp-session", + "sp-std", + "sp-transaction-pool", + "sp-version", + "static_assertions", + "substrate-wasm-builder", + "xcm", + "xcm-builder", + "xcm-executor", + "xcm-primitives", +] + [[package]] name = "parachain-info" version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml index 1420c5e7d..cce2c62f5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -66,6 +66,7 @@ members = [ dc-primitives = { default-features = false, path = "core/primitives" } dc-types = { path = "core/types" } pangolin-runtime = { path = "runtime/pangolin" } + pangoro-runtime = { path = "runtime/pangoro" } # darwinia-messages-substrate bp-darwinia-core = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } diff --git a/node/Cargo.toml b/node/Cargo.toml index df606523a..79e405702 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -36,6 +36,7 @@ crab-runtime = { optional = true, workspace = true } darwinia-runtime = { optional = true, workspace = true } dc-primitives = { workspace = true } pangolin-runtime = { optional = true, workspace = true } +pangoro-runtime = { optional = true, workspace = true } # frontier fc-cli = { workspace = true } @@ -107,6 +108,7 @@ fast-runtime = [ "crab-runtime?/fast-runtime", "darwinia-runtime?/fast-runtime", "pangolin-runtime?/fast-runtime", + "pangoro-runtime?/fast-runtime", ] runtime-benchmarks = [ @@ -114,6 +116,7 @@ runtime-benchmarks = [ "crab-runtime?/runtime-benchmarks", "darwinia-runtime?/runtime-benchmarks", "pangolin-runtime?/runtime-benchmarks", + "pangoro-runtime?/runtime-benchmarks", # polkadot "polkadot-cli/runtime-benchmarks", @@ -124,6 +127,7 @@ try-runtime = [ "crab-runtime?/try-runtime", "darwinia-runtime?/try-runtime", "pangolin-runtime?/try-runtime", + "pangoro-runtime?/try-runtime", # substrate "try-runtime-cli/try-runtime", @@ -134,6 +138,7 @@ all-natives = [ "crab-native", "darwinia-native", "pangolin-native", + "pangoro-native", ] crab-native = [ # darwinia @@ -156,3 +161,10 @@ pangolin-native = [ # polkadot "polkadot-cli/rococo-native", ] +pangoro-native = [ + # darwinia + "pangoro-runtime", + + # polkadot + "polkadot-cli/rococo-native", +] diff --git a/node/src/chain_spec/crab.rs b/node/src/chain_spec/crab.rs index 45bee456f..a9b1c997e 100644 --- a/node/src/chain_spec/crab.rs +++ b/node/src/chain_spec/crab.rs @@ -40,7 +40,7 @@ use sp_core::H160; pub type ChainSpec = sc_service::GenericChainSpec; fn properties() -> Properties { - super::properties("CRAB", 42) + super::properties("CRAB") } // Generate the session keys from individual elements. diff --git a/node/src/chain_spec/darwinia.rs b/node/src/chain_spec/darwinia.rs index bf2b6ee79..781efc6a9 100644 --- a/node/src/chain_spec/darwinia.rs +++ b/node/src/chain_spec/darwinia.rs @@ -40,7 +40,7 @@ use sp_core::H160; pub type ChainSpec = sc_service::GenericChainSpec; fn properties() -> Properties { - super::properties("RING", 18) + super::properties("RING") } // Generate the session keys from individual elements. diff --git a/node/src/chain_spec/mod.rs b/node/src/chain_spec/mod.rs index c8407eaa9..11f5e099c 100644 --- a/node/src/chain_spec/mod.rs +++ b/node/src/chain_spec/mod.rs @@ -39,7 +39,14 @@ pub use pangolin::{self as pangolin_chain_spec, ChainSpec as PangolinChainSpec}; #[cfg(not(feature = "pangolin-native"))] pub type PangolinChainSpec = DummyChainSpec; -#[cfg(feature = "pangolin-native")] +#[cfg(feature = "pangoro-native")] +pub mod pangoro; +#[cfg(feature = "pangoro-native")] +pub use pangoro::{self as pangoro_chain_spec, ChainSpec as PangoroChainSpec}; +#[cfg(not(feature = "pangoro-native"))] +pub type PangoroChainSpec = DummyChainSpec; + +#[cfg(any(feature = "pangolin-native", feature = "pangoro-native"))] mod testnet_keys { pub const C1: &str = "0x0eef9fabb6eb6fed2ab24a842931f8950426070a"; pub const C1_AURA: &str = "0xeed007f04d568b2d3bf329945a48c21a8ed030c81ca1dce61ad41c916599f405"; @@ -49,7 +56,7 @@ mod testnet_keys { pub const C3_AURA: &str = "0xe25d860707bd1b88b9851cf40df3af3368cd57e5e82824cabac9c75fe537600f"; pub const SUDO: &str = "0x2748def2f9c3cfbbb963002935bc6d2e1c36ce2e"; } -#[cfg(feature = "pangolin-native")] +#[cfg(any(feature = "pangolin-native", feature = "pangoro-native"))] use testnet_keys::*; // crates.io @@ -96,12 +103,11 @@ impl Extensions { } } -fn properties(token_symbol: &str, ss58_format: u16) -> Properties { +fn properties(token_symbol: &str) -> Properties { let mut properties = Properties::new(); properties.insert("tokenSymbol".into(), token_symbol.into()); properties.insert("tokenDecimals".into(), 18.into()); - properties.insert("ss58Format".into(), ss58_format.into()); properties } diff --git a/node/src/chain_spec/pangolin.rs b/node/src/chain_spec/pangolin.rs index 0b9c4c16a..404d6bf31 100644 --- a/node/src/chain_spec/pangolin.rs +++ b/node/src/chain_spec/pangolin.rs @@ -40,7 +40,7 @@ use sp_core::{crypto::UncheckedInto, H160}; pub type ChainSpec = sc_service::GenericChainSpec; fn properties() -> Properties { - super::properties("PRING", 42) + super::properties("PRING") } // Generate the session keys from individual elements. diff --git a/node/src/chain_spec/pangoro.rs b/node/src/chain_spec/pangoro.rs new file mode 100644 index 000000000..02e034cb6 --- /dev/null +++ b/node/src/chain_spec/pangoro.rs @@ -0,0 +1,362 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +#![allow(clippy::derive_partial_eq_without_eq)] + +// std +use std::{ + collections::BTreeMap, + str::FromStr, + time::{SystemTime, UNIX_EPOCH}, +}; +// cumulus +use cumulus_primitives_core::ParaId; +// darwinia +use super::*; +use pangoro_runtime::*; +// frontier +use fp_evm::GenesisAccount; +// substrate +use sc_chain_spec::Properties; +use sc_service::ChainType; +use sp_core::{crypto::UncheckedInto, H160}; + +/// Specialized `ChainSpec` for the normal parachain runtime. +pub type ChainSpec = sc_service::GenericChainSpec; + +fn properties() -> Properties { + super::properties("ORING") +} + +// Generate the session keys from individual elements. +// +// The input must be a tuple of individual keys (a single arg for now since we have just one key). +fn session_keys(keys: AuraId) -> SessionKeys { + SessionKeys { aura: keys } +} + +pub fn development_config() -> ChainSpec { + ChainSpec::from_genesis( + "Pangoro2 Development", + "pangoro2-development", + ChainType::Development, + move || { + testnet_genesis( + vec![ + // Bind the `Alice` to `Alith` to make `--alice` available for testnet. + ( + array_bytes::hex_n_into_unchecked(ALITH), + get_collator_keys_from_seed("Alice"), + ), + ], + vec![ + array_bytes::hex_n_into_unchecked(ALITH), + array_bytes::hex_n_into_unchecked(BALTATHAR), + array_bytes::hex_n_into_unchecked(CHARLETH), + array_bytes::hex_n_into_unchecked(DOROTHY), + array_bytes::hex_n_into_unchecked(ETHAN), + array_bytes::hex_n_into_unchecked(FAITH), + ], + 2046.into(), + ) + }, + Vec::new(), + None, + Some(PROTOCOL_ID), + None, + Some(properties()), + Extensions { + relay_chain: "rococo-local".into(), // You MUST set this to the correct network! + para_id: 2046, + }, + ) +} + +pub fn local_config() -> ChainSpec { + ChainSpec::from_genesis( + "Pangoro2 Local", + "pangoro2-local", + ChainType::Local, + move || { + testnet_genesis( + vec![ + // Bind the `Alice` to `Alith` to make `--alice` available for testnet. + ( + array_bytes::hex_n_into_unchecked(ALITH), + get_collator_keys_from_seed("Alice"), + ), + // Bind the `Bob` to `Balthar` to make `--bob` available for testnet. + ( + array_bytes::hex_n_into_unchecked(BALTATHAR), + get_collator_keys_from_seed("Bob"), + ), + // Bind the `Charlie` to `CHARLETH` to make `--charlie` available for testnet. + ( + array_bytes::hex_n_into_unchecked(CHARLETH), + get_collator_keys_from_seed("Charlie"), + ), + ], + vec![ + array_bytes::hex_n_into_unchecked(ALITH), + array_bytes::hex_n_into_unchecked(BALTATHAR), + array_bytes::hex_n_into_unchecked(CHARLETH), + array_bytes::hex_n_into_unchecked(DOROTHY), + array_bytes::hex_n_into_unchecked(ETHAN), + array_bytes::hex_n_into_unchecked(FAITH), + ], + 2046.into(), + ) + }, + Vec::new(), + None, + Some(PROTOCOL_ID), + None, + Some(properties()), + Extensions { + relay_chain: "rococo-local".into(), // You MUST set this to the correct network! + para_id: 2046, + }, + ) +} + +pub fn genesis_config() -> ChainSpec { + ChainSpec::from_genesis( + "Pangoro2", + "pangoro2", + ChainType::Live, + move || { + GenesisConfig { + // System stuff. + system: SystemConfig { code: WASM_BINARY.unwrap().to_vec() }, + parachain_system: Default::default(), + parachain_info: ParachainInfoConfig { parachain_id: 2046.into() }, + + // Monetary stuff. + balances: BalancesConfig { + balances: vec![ + (array_bytes::hex_n_into_unchecked(C1), 10_000 * UNIT), + (array_bytes::hex_n_into_unchecked(C2), 10_000 * UNIT), + (array_bytes::hex_n_into_unchecked(C3), 10_000 * UNIT), + ], + }, + transaction_payment: Default::default(), + assets: AssetsConfig { + assets: vec![(AssetIds::OKton as _, ROOT, true, 1)], + metadata: vec![( + AssetIds::OKton as _, + b"Pangoro Commitment Token".to_vec(), + b"OKTON".to_vec(), + 18, + )], + ..Default::default() + }, + vesting: Default::default(), + + // Consensus stuff. + darwinia_staking: DarwiniaStakingConfig { + now: SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_millis(), + elapsed_time: 11_516_352_020, + collator_count: 3, + collators: vec![ + (array_bytes::hex_n_into_unchecked(C1), UNIT), + (array_bytes::hex_n_into_unchecked(C2), UNIT), + (array_bytes::hex_n_into_unchecked(C3), UNIT), + ], + }, + session: SessionConfig { + keys: vec![ + ( + array_bytes::hex_n_into_unchecked(C1), + array_bytes::hex_n_into_unchecked(C1), + session_keys( + array_bytes::hex2array_unchecked(C1_AURA).unchecked_into(), + ), + ), + ( + array_bytes::hex_n_into_unchecked(C2), + array_bytes::hex_n_into_unchecked(C2), + session_keys( + array_bytes::hex2array_unchecked(C2_AURA).unchecked_into(), + ), + ), + ( + array_bytes::hex_n_into_unchecked(C3), + array_bytes::hex_n_into_unchecked(C3), + session_keys( + array_bytes::hex2array_unchecked(C3_AURA).unchecked_into(), + ), + ), + ], + }, + aura: Default::default(), + aura_ext: Default::default(), + message_gadget: Default::default(), + ecdsa_authority: Default::default(), + + // Governance stuff. + democracy: Default::default(), + council: Default::default(), + technical_committee: Default::default(), + phragmen_election: Default::default(), + technical_membership: Default::default(), + treasury: Default::default(), + + // Utility stuff. + sudo: SudoConfig { key: Some(array_bytes::hex_n_into_unchecked(SUDO)) }, + + // XCM stuff. + polkadot_xcm: PolkadotXcmConfig { safe_xcm_version: Some(SAFE_XCM_VERSION) }, + + // EVM stuff. + ethereum: Default::default(), + evm: EvmConfig { + accounts: { + BTreeMap::from_iter( + PangoroPrecompiles::::used_addresses().iter().map(|p| { + ( + p.to_owned(), + GenesisAccount { + nonce: Default::default(), + balance: Default::default(), + storage: Default::default(), + code: REVERT_BYTECODE.to_vec(), + }, + ) + }), + ) + }, + }, + } + }, + Vec::new(), + None, + Some(PROTOCOL_ID), + None, + Some(properties()), + Extensions { + relay_chain: "rococo".into(), // You MUST set this to the correct network! + para_id: 2046, + }, + ) +} + +pub fn config() -> ChainSpec { + unimplemented!("TODO") +} + +fn testnet_genesis( + collators: Vec<(AccountId, AuraId)>, + endowed_accounts: Vec, + id: ParaId, +) -> GenesisConfig { + GenesisConfig { + // System stuff. + system: SystemConfig { code: WASM_BINARY.unwrap().to_vec() }, + parachain_system: Default::default(), + parachain_info: ParachainInfoConfig { parachain_id: id }, + + // Monetary stuff. + balances: BalancesConfig { + balances: endowed_accounts.iter().cloned().map(|k| (k, 100_000_000 * UNIT)).collect(), + }, + transaction_payment: Default::default(), + assets: AssetsConfig { + assets: vec![(AssetIds::OKton as _, ROOT, true, 1)], + metadata: vec![( + AssetIds::OKton as _, + b"Pangoro Commitment Token".to_vec(), + b"OKTON".to_vec(), + 18, + )], + ..Default::default() + }, + vesting: Default::default(), + + // Consensus stuff. + darwinia_staking: DarwiniaStakingConfig { + now: SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_millis(), + elapsed_time: 0, + collator_count: collators.len() as _, + collators: collators.iter().map(|(a, _)| (a.to_owned(), UNIT)).collect(), + }, + session: SessionConfig { + keys: collators + .into_iter() + .map(|(acc, aura)| { + ( + acc, // account id + acc, // validator id + session_keys(aura), // session keys + ) + }) + .collect(), + }, + aura: Default::default(), + aura_ext: Default::default(), + message_gadget: Default::default(), + ecdsa_authority: Default::default(), + + // Governance stuff. + democracy: Default::default(), + council: Default::default(), + technical_committee: Default::default(), + phragmen_election: Default::default(), + technical_membership: Default::default(), + treasury: Default::default(), + + // Utility stuff. + sudo: SudoConfig { key: Some(array_bytes::hex_n_into_unchecked(ALITH)) }, + + // XCM stuff. + polkadot_xcm: PolkadotXcmConfig { safe_xcm_version: Some(SAFE_XCM_VERSION) }, + + // EVM stuff. + ethereum: Default::default(), + evm: EvmConfig { + accounts: { + BTreeMap::from_iter( + PangoroPrecompiles::::used_addresses() + .iter() + .map(|p| { + ( + p.to_owned(), + GenesisAccount { + nonce: Default::default(), + balance: Default::default(), + storage: Default::default(), + code: REVERT_BYTECODE.to_vec(), + }, + ) + }) + .chain([ + // Benchmarking account. + ( + H160::from_str("1000000000000000000000000000000000000001").unwrap(), + GenesisAccount { + nonce: 1.into(), + balance: (10_000_000 * UNIT).into(), + storage: Default::default(), + code: vec![0x00], + }, + ), + ]), + ) + }, + }, + } +} diff --git a/node/src/command.rs b/node/src/command.rs index b360b3309..bab287d18 100644 --- a/node/src/command.rs +++ b/node/src/command.rs @@ -57,9 +57,9 @@ impl SubstrateCli for Cli { fn description() -> String { format!( "Darwinia\n\nThe command-line arguments provided first will be \ - passed to the parachain node, while the arguments provided after -- will be passed \ - to the relay chain node.\n\n\ - {} -- ", + passed to the parachain node, while the arguments provided after -- will be passed \ + to the relay chain node.\n\n\ + {} -- ", Self::executable_name() ) } @@ -69,11 +69,11 @@ impl SubstrateCli for Cli { } fn support_url() -> String { - "https://github.com/paritytech/cumulus/issues/new".into() + "https://github.com/darwinia-network/darwinia/issues/new".into() } fn copyright_start_year() -> i32 { - 2020 + 2018 } fn load_spec(&self, id: &str) -> std::result::Result, String> { @@ -86,17 +86,24 @@ impl SubstrateCli for Cli { return &crab_runtime::VERSION; } + #[cfg(feature = "darwinia-native")] + if spec.is_darwinia() { + return &darwinia_runtime::VERSION; + } + #[cfg(feature = "pangolin-native")] if spec.is_pangolin() { return &pangolin_runtime::VERSION; } - #[cfg(feature = "darwinia-native")] - if spec.is_darwinia() { - return &darwinia_runtime::VERSION; + #[cfg(feature = "pangoro-native")] + if spec.is_pangoro() { + return &pangoro_runtime::VERSION; } - panic!("No runtime feature (crab, darwinia, pangolin) is enabled"); + panic!( + "No feature(crab-native, darwinia-native, pangolin-native, pangoro-native) is enabled!" + ); } } @@ -112,9 +119,9 @@ impl SubstrateCli for RelayChainCli { fn description() -> String { format!( "Darwinia\n\nThe command-line arguments provided first will be \ - passed to the parachain node, while the arguments provided after -- will be passed \ - to the relay chain node.\n\n\ - {} -- ", + passed to the parachain node, while the arguments provided after -- will be passed \ + to the relay chain node.\n\n\ + {} -- ", Self::executable_name() ) } @@ -287,6 +294,16 @@ pub fn run() -> Result<()> { return $code; } + #[cfg(feature = "darwinia-native")] + if $config.chain_spec.is_darwinia() { + let $partials = new_partial::( + &$config, + &$cli.eth_args.build_eth_rpc_config(), + )?; + + return $code; + } + #[cfg(feature = "pangolin-native")] if $config.chain_spec.is_pangolin() { let $partials = new_partial::( @@ -297,9 +314,9 @@ pub fn run() -> Result<()> { return $code; } - #[cfg(feature = "darwinia-native")] - if $config.chain_spec.is_darwinia() { - let $partials = new_partial::( + #[cfg(feature = "pangoro-native")] + if $config.chain_spec.is_pangoro() { + let $partials = new_partial::( &$config, &$cli.eth_args.build_eth_rpc_config(), )?; @@ -307,7 +324,7 @@ pub fn run() -> Result<()> { return $code; } - panic!("No runtime feature (polkadot, kusama, westend, rococo) is enabled"); + panic!("No feature(crab-native, darwinia-native, pangolin-native, pangoro-native) is enabled!"); }}; } @@ -334,6 +351,22 @@ pub fn run() -> Result<()> { }); } + #[cfg(feature = "darwinia-native")] + if chain_spec.is_darwinia() { + return runner.async_run(|$config| { + let $components = service::new_partial::< + DarwiniaRuntimeApi, + DarwiniaRuntimeExecutor, + >( + &$config, + &$cli.eth_args.build_eth_rpc_config() + )?; + let task_manager = $components.task_manager; + + { $( $code )* }.map(|v| (v, task_manager)) + }); + } + #[cfg(feature = "pangolin-native")] if chain_spec.is_pangolin() { return runner.async_run(|$config| { @@ -350,12 +383,12 @@ pub fn run() -> Result<()> { }); } - #[cfg(feature = "darwinia-native")] - if chain_spec.is_darwinia() { + #[cfg(feature = "pangoro-native")] + if chain_spec.is_pangoro() { return runner.async_run(|$config| { let $components = service::new_partial::< - DarwiniaRuntimeApi, - DarwiniaRuntimeExecutor, + PangoroRuntimeApi, + PangoroRuntimeExecutor, >( &$config, &$cli.eth_args.build_eth_rpc_config() @@ -366,7 +399,7 @@ pub fn run() -> Result<()> { }); } - panic!("No runtime feature (crab, darwinia, pangolin) is enabled"); + panic!("No feature(crab-native, darwinia-native, pangolin-native, pangoro-native) is enabled!"); }} } @@ -469,6 +502,17 @@ pub fn run() -> Result<()> { return cmd.run::<_, dc_primitives::Block>(client, frontier_backend); } + #[cfg(feature = "darwinia-native")] + if config.chain_spec.is_darwinia() { + let PartialComponents { client, other: (frontier_backend, ..), .. } = + service::new_partial::( + &config, + &cli.eth_args.build_eth_rpc_config(), + )?; + + return cmd.run::<_, dc_primitives::Block>(client, frontier_backend); + } + #[cfg(feature = "pangolin-native")] if config.chain_spec.is_pangolin() { let PartialComponents { client, other: (frontier_backend, ..), .. } = @@ -480,10 +524,10 @@ pub fn run() -> Result<()> { return cmd.run::<_, dc_primitives::Block>(client, frontier_backend); } - #[cfg(feature = "darwinia-native")] - if config.chain_spec.is_darwinia() { + #[cfg(feature = "pangoro-native")] + if config.chain_spec.is_pangoro() { let PartialComponents { client, other: (frontier_backend, ..), .. } = - service::new_partial::( + service::new_partial::( &config, &cli.eth_args.build_eth_rpc_config(), )?; @@ -491,7 +535,7 @@ pub fn run() -> Result<()> { return cmd.run::<_, dc_primitives::Block>(client, frontier_backend); } - panic!("No runtime feature (polkadot, kusama, westend, rococo) is enabled"); + panic!("No feature(crab-native, darwinia-native, pangolin-native, pangoro-native) is enabled!"); }) }, Some(Subcommand::Benchmark(cmd)) => { @@ -507,33 +551,32 @@ pub fn run() -> Result<()> { return cmd.run::(config); } + #[cfg(feature = "darwinia-native")] + if config.chain_spec.is_darwinia() { + return cmd.run::(config); + } + #[cfg(feature = "pangolin-native")] if config.chain_spec.is_pangolin() { return cmd.run::(config); } - #[cfg(feature = "darwinia-native")] - if config.chain_spec.is_darwinia() { - return cmd.run::(config); + #[cfg(feature = "pangoro-native")] + if config.chain_spec.is_pangoro() { + return cmd.run::(config); } - panic!( - "No runtime feature (polkadot, kusama, westend, rococo) is enabled" - ); + panic!("No feature(crab-native, darwinia-native, pangolin-native, pangoro-native) is enabled!"); }) } else { - Err("Benchmarking wasn't enabled when building the node. \ - You can enable it with `--features runtime-benchmarks`." - .into()) + Err("Benchmarking wasn't enabled when building the node. You can enable it with `--features runtime-benchmarks`.".into()) }, BenchmarkCmd::Block(cmd) => runner.sync_run(|config| { construct_benchmark_partials!(config, cli, |partials| cmd.run(partials.client)) }), #[cfg(not(feature = "runtime-benchmarks"))] BenchmarkCmd::Storage(_) => Err(sc_cli::Error::Input( - "Compile with --features=runtime-benchmarks \ - to enable storage benchmarks." - .into(), + "Compile with --features=runtime-benchmarks to enable storage benchmarks.".into(), )), #[cfg(feature = "runtime-benchmarks")] BenchmarkCmd::Storage(cmd) => runner.sync_run(|config| { @@ -572,23 +615,35 @@ pub fn run() -> Result<()> { .map_err(|e| format!("Error: {:?}", e))?; if chain_spec.is_crab() { - runner.async_run(|_| { + return runner.async_run(|_| { Ok((cmd.run::>(), task_manager)) - }) - } else if chain_spec.is_pangolin() { - runner.async_run(|_| { - Ok((cmd.run::>(), task_manager)) - }) - } else { - runner.async_run(|_| { + }); + } + + if chain_spec.is_darwinia() { + return runner.async_run(|_| { Ok((cmd.run::>(), task_manager)) - }) + }); } + + if chain_spec.is_pangolin() { + return runner.async_run(|_| { + Ok((cmd.run::>(), task_manager)) + }); + } + + if chain_spec.is_pangoro() { + return runner.async_run(|_| { + Ok((cmd.run::>(), task_manager)) + }); + } + + panic!("No feature(crab-native, darwinia-native, pangolin-native, pangoro-native) is enabled!"); }, #[cfg(not(feature = "try-runtime"))] - Some(Subcommand::TryRuntime) => Err("Try-runtime was not enabled when building the node. \ - You can enable it with `--features try-runtime`." - .into()), + Some(Subcommand::TryRuntime) => Err( + "Try-runtime was not enabled when building the node. You can enable it with `--features try-runtime`.".into() + ), None => { let runner = cli.create_runner(&cli.run.normalize())?; let collator_options = cli.run.collator_options(); @@ -646,6 +701,15 @@ pub fn run() -> Result<()> { .map_err(Into::into); } + #[cfg(feature = "darwinia-native")] + if chain_spec.is_darwinia() { + return service::start_dev_node::( + config, + ð_rpc_config, + ) + .map_err(Into::into) + } + #[cfg(feature = "pangolin-native")] if chain_spec.is_pangolin() { return service::start_dev_node::( @@ -655,9 +719,9 @@ pub fn run() -> Result<()> { .map_err(Into::into) } - #[cfg(feature = "darwinia-native")] - { - return service::start_dev_node::( + #[cfg(feature = "pangoro-native")] + if chain_spec.is_pangoro() { + return service::start_dev_node::( config, ð_rpc_config, ) @@ -684,6 +748,21 @@ pub fn run() -> Result<()> { .map_err(Into::into); } + #[cfg(feature = "darwinia-native")] + if chain_spec.is_darwinia() { + return service::start_parachain_node::( + config, + polkadot_config, + collator_options, + id, + hwbench, + ð_rpc_config, + ) + .await + .map(|r| r.0) + .map_err(Into::into); + } + #[cfg(feature = "pangolin-native")] if chain_spec.is_pangolin() { return service::start_parachain_node::( @@ -699,9 +778,9 @@ pub fn run() -> Result<()> { .map_err(Into::into); } - #[cfg(feature = "darwinia-native")] + #[cfg(feature = "pangoro-native")] if chain_spec.is_darwinia() { - return service::start_parachain_node::( + return service::start_parachain_node::( config, polkadot_config, collator_options, @@ -714,7 +793,7 @@ pub fn run() -> Result<()> { .map_err(Into::into); } - panic!("No runtime feature (crab, darwinia, pangolin) is enabled"); + panic!("No feature(crab-native, darwinia-native, pangolin-native, pangoro-native) is enabled!"); }) }, } @@ -733,14 +812,6 @@ fn load_spec(id: &str) -> std::result::Result, String> { }; Ok(match id.to_lowercase().as_str() { - #[cfg(feature = "darwinia-native")] - "darwinia" => Box::new(darwinia_chain_spec::config()), - #[cfg(feature = "darwinia-native")] - "darwinia-genesis" => Box::new(darwinia_chain_spec::genesis_config()), - #[cfg(feature = "darwinia-native")] - "darwinia-dev" => Box::new(darwinia_chain_spec::development_config()), - #[cfg(feature = "darwinia-native")] - "darwinia-local" => Box::new(darwinia_chain_spec::local_config()), #[cfg(feature = "crab-native")] "crab" => Box::new(crab_chain_spec::config()), #[cfg(feature = "crab-native")] @@ -749,6 +820,14 @@ fn load_spec(id: &str) -> std::result::Result, String> { "crab-dev" => Box::new(crab_chain_spec::development_config()), #[cfg(feature = "crab-native")] "crab-local" => Box::new(crab_chain_spec::local_config()), + #[cfg(feature = "darwinia-native")] + "darwinia" => Box::new(darwinia_chain_spec::config()), + #[cfg(feature = "darwinia-native")] + "darwinia-genesis" => Box::new(darwinia_chain_spec::genesis_config()), + #[cfg(feature = "darwinia-native")] + "darwinia-dev" => Box::new(darwinia_chain_spec::development_config()), + #[cfg(feature = "darwinia-native")] + "darwinia-local" => Box::new(darwinia_chain_spec::local_config()), #[cfg(feature = "pangolin-native")] "pangolin" => Box::new(pangolin_chain_spec::config()), #[cfg(feature = "pangolin-native")] @@ -757,18 +836,36 @@ fn load_spec(id: &str) -> std::result::Result, String> { "pangolin-dev" => Box::new(pangolin_chain_spec::development_config()), #[cfg(feature = "pangolin-native")] "pangolin-local" => Box::new(pangolin_chain_spec::local_config()), + #[cfg(feature = "pangoro-native")] + "pangoro" => Box::new(pangoro_chain_spec::config()), + #[cfg(feature = "pangoro-native")] + "pangoro-genesis" => Box::new(pangoro_chain_spec::genesis_config()), + #[cfg(feature = "pangoro-native")] + "pangoro-dev" => Box::new(pangoro_chain_spec::development_config()), + #[cfg(feature = "pangoro-native")] + "pangoro-local" => Box::new(pangoro_chain_spec::local_config()), _ => { let path = PathBuf::from(id); let chain_spec = - Box::new(DarwiniaChainSpec::from_json_file(path.clone())?) as Box; + Box::new(DummyChainSpec::from_json_file(path.clone())?) as Box; if chain_spec.is_crab() { - Box::new(CrabChainSpec::from_json_file(path)?) - } else if chain_spec.is_pangolin() { - Box::new(PangolinChainSpec::from_json_file(path)?) - } else { - chain_spec + return Ok(Box::new(CrabChainSpec::from_json_file(path)?)); + } + + if chain_spec.is_darwinia() { + return Ok(Box::new(DarwiniaChainSpec::from_json_file(path)?)); + } + + if chain_spec.is_pangolin() { + return Ok(Box::new(PangolinChainSpec::from_json_file(path)?)); + } + + if chain_spec.is_pangoro() { + return Ok(Box::new(PangoroChainSpec::from_json_file(path)?)); } + + panic!("No feature(crab-native, darwinia-native, pangolin-native, pangoro-native) is enabled!") }, }) } diff --git a/node/src/service/executors.rs b/node/src/service/executors.rs index f1f71e1ea..9fab59621 100644 --- a/node/src/service/executors.rs +++ b/node/src/service/executors.rs @@ -75,3 +75,22 @@ impl NativeExecutionDispatch for PangolinRuntimeExecutor { pangolin_runtime::native_version() } } + +/// Pangoro native executor instance. +#[cfg(feature = "pangoro-native")] +pub struct PangoroRuntimeExecutor; +#[cfg(feature = "pangoro-native")] +impl NativeExecutionDispatch for PangoroRuntimeExecutor { + #[cfg(feature = "runtime-benchmarks")] + type ExtendHostFunctions = frame_benchmarking::benchmarking::HostFunctions; + #[cfg(not(feature = "runtime-benchmarks"))] + type ExtendHostFunctions = (); + + fn dispatch(method: &str, data: &[u8]) -> Option> { + pangoro_runtime::api::dispatch(method, data) + } + + fn native_version() -> NativeVersion { + pangoro_runtime::native_version() + } +} diff --git a/node/src/service/mod.rs b/node/src/service/mod.rs index a53ca98f1..3f1369aa1 100644 --- a/node/src/service/mod.rs +++ b/node/src/service/mod.rs @@ -29,6 +29,8 @@ pub use crab_runtime::RuntimeApi as CrabRuntimeApi; pub use darwinia_runtime::RuntimeApi as DarwiniaRuntimeApi; #[cfg(feature = "pangolin-native")] pub use pangolin_runtime::RuntimeApi as PangolinRuntimeApi; +#[cfg(feature = "pangoro-native")] +pub use pangoro_runtime::RuntimeApi as PangoroRuntimeApi; // std use std::{ @@ -56,7 +58,7 @@ type ParachainBlockImport = FullBackend, >; -/// Can be called for a `Configuration` to check if it is a configuration for the `Crab` network. +/// Can be called for a `Configuration` to check if it is the specific network. pub trait IdentifyVariant { /// Returns if this is a configuration for the `Crab` network. fn is_crab(&self) -> bool; @@ -67,6 +69,9 @@ pub trait IdentifyVariant { /// Returns if this is a configuration for the `Pangolin` network. fn is_pangolin(&self) -> bool; + /// Returns if this is a configuration for the `Pangoro` network. + fn is_pangoro(&self) -> bool; + /// Returns true if this configuration is for a development network. fn is_dev(&self) -> bool; } @@ -83,6 +88,10 @@ impl IdentifyVariant for Box { self.id().starts_with("pangolin") } + fn is_pangoro(&self) -> bool { + self.id().starts_with("pangoro") + } + fn is_dev(&self) -> bool { self.id().ends_with("development") } diff --git a/runtime/common/Cargo.toml b/runtime/common/Cargo.toml index 5d6f56847..65a879853 100644 --- a/runtime/common/Cargo.toml +++ b/runtime/common/Cargo.toml @@ -28,7 +28,9 @@ xcm-executor = { workspace = true } # substrate frame-support = { workspace = true } frame-system = { workspace = true } +pallet-balances = { workspace = true } pallet-collective = { workspace = true } +pallet-treasury = { workspace = true } sp-io = { workspace = true } sp-runtime = { workspace = true } sp-std = { workspace = true } @@ -56,7 +58,9 @@ std = [ # substrate "frame-support/std", "frame-system/std", + "pallet-balances/std", "pallet-collective/std", + "pallet-treasury/std", "sp-io/std", "sp-runtime/std", "sp-std/std", diff --git a/runtime/common/src/lib.rs b/runtime/common/src/lib.rs index 8966a564a..3952e1960 100644 --- a/runtime/common/src/lib.rs +++ b/runtime/common/src/lib.rs @@ -79,6 +79,50 @@ impl WeightToFeePolynomial for WeightToFee { } } +pub struct DealWithFees(sp_std::marker::PhantomData); +impl frame_support::traits::OnUnbalanced> + for DealWithFees +where + R: pallet_balances::Config, + R: pallet_balances::Config + pallet_treasury::Config, + pallet_treasury::Pallet: + frame_support::traits::OnUnbalanced>, +{ + // this seems to be called for substrate-based transactions + fn on_unbalanceds( + mut fees_then_tips: impl Iterator>, + ) { + if let Some(fees) = fees_then_tips.next() { + // substrate + use frame_support::traits::Imbalance; + + // for fees, 80% are burned, 20% to the treasury + let (_, to_treasury) = fees.ration(80, 20); + + // Balances pallet automatically burns dropped Negative Imbalances by decreasing + // total_supply accordingly + as frame_support::traits::OnUnbalanced<_>>::on_unbalanced( + to_treasury, + ); + } + } + + // this is called from pallet_evm for Ethereum-based transactions + // (technically, it calls on_unbalanced, which calls this when non-zero) + fn on_nonzero_unbalanced(amount: pallet_balances::NegativeImbalance) { + // substrate + use frame_support::traits::Imbalance; + + // Balances pallet automatically burns dropped Negative Imbalances by decreasing + // total_supply accordingly + let (_, to_treasury) = amount.ration(80, 20); + + as frame_support::traits::OnUnbalanced<_>>::on_unbalanced( + to_treasury, + ); + } +} + /// Deposit calculator for Darwinia. /// 100 UNIT for the base fee, 102.4 UNIT/MB. pub const fn darwinia_deposit(items: u32, bytes: u32) -> Balance { diff --git a/runtime/crab/src/lib.rs b/runtime/crab/src/lib.rs index 2fbb4baae..93193bdd9 100644 --- a/runtime/crab/src/lib.rs +++ b/runtime/crab/src/lib.rs @@ -16,7 +16,7 @@ // You should have received a copy of the GNU General Public License // along with Darwinia. If not, see . -//! Darwinia runtime. +//! Crab runtime. #![cfg_attr(not(feature = "std"), no_std)] #![recursion_limit = "256"] @@ -90,51 +90,6 @@ pub const VERSION: sp_version::RuntimeVersion = sp_version::RuntimeVersion { state_version: 0, }; -// TODO: move to impl.rs -pub struct DealWithFees(sp_std::marker::PhantomData); -impl frame_support::traits::OnUnbalanced> - for DealWithFees -where - R: pallet_balances::Config, - R: pallet_balances::Config + pallet_treasury::Config, - pallet_treasury::Pallet: - frame_support::traits::OnUnbalanced>, -{ - // this seems to be called for substrate-based transactions - fn on_unbalanceds( - mut fees_then_tips: impl Iterator>, - ) { - if let Some(fees) = fees_then_tips.next() { - // substrate - use frame_support::traits::Imbalance; - - // for fees, 80% are burned, 20% to the treasury - let (_, to_treasury) = fees.ration(80, 20); - - // Balances pallet automatically burns dropped Negative Imbalances by decreasing - // total_supply accordingly - as frame_support::traits::OnUnbalanced<_>>::on_unbalanced( - to_treasury, - ); - } - } - - // this is called from pallet_evm for Ethereum-based transactions - // (technically, it calls on_unbalanced, which calls this when non-zero) - fn on_nonzero_unbalanced(amount: pallet_balances::NegativeImbalance) { - // substrate - use frame_support::traits::Imbalance; - - // Balances pallet automatically burns dropped Negative Imbalances by decreasing - // total_supply accordingly - let (_, to_treasury) = amount.ration(80, 20); - - as frame_support::traits::OnUnbalanced<_>>::on_unbalanced( - to_treasury, - ); - } -} - /// The version information used to identify this runtime when compiled natively. #[cfg(feature = "std")] pub fn native_version() -> sp_version::NativeVersion { diff --git a/runtime/crab/src/pallets/deposit.rs b/runtime/crab/src/pallets/deposit.rs index 6cc968c53..a37e0be81 100644 --- a/runtime/crab/src/pallets/deposit.rs +++ b/runtime/crab/src/pallets/deposit.rs @@ -19,8 +19,8 @@ // darwinia use crate::*; -pub enum CKtonMinting {} -impl darwinia_deposit::SimpleAsset for CKtonMinting { +pub enum KtonMinting {} +impl darwinia_deposit::SimpleAsset for KtonMinting { type AccountId = AccountId; fn mint(beneficiary: &Self::AccountId, amount: Balance) -> sp_runtime::DispatchResult { @@ -44,7 +44,7 @@ impl darwinia_deposit::SimpleAsset for CKtonMinting { } impl darwinia_deposit::Config for Runtime { - type Kton = CKtonMinting; + type Kton = KtonMinting; type MaxDeposits = ConstU32<16>; type MinLockingAmount = ConstU128; type Ring = Balances; diff --git a/runtime/crab/src/pallets/evm.rs b/runtime/crab/src/pallets/evm.rs index 1265be053..cbdb9578a 100644 --- a/runtime/crab/src/pallets/evm.rs +++ b/runtime/crab/src/pallets/evm.rs @@ -103,7 +103,8 @@ where addr(9), addr(1024), addr(1025), - addr(1026), // For KTON asset + // For KTON asset. + addr(1026), addr(1536), addr(1537), addr(2048), diff --git a/runtime/crab/src/pallets/staking.rs b/runtime/crab/src/pallets/staking.rs index 9464a453d..2abda17e3 100644 --- a/runtime/crab/src/pallets/staking.rs +++ b/runtime/crab/src/pallets/staking.rs @@ -21,8 +21,8 @@ use crate::*; fast_runtime_or_not!(MinStakingDuration, ConstU32<{ 5 * MINUTES }>, ConstU32<{ 14 * DAYS }>); -pub enum CrabStaking {} -impl darwinia_staking::Stake for CrabStaking { +pub enum RingStaking {} +impl darwinia_staking::Stake for RingStaking { type AccountId = AccountId; type Item = Balance; @@ -44,8 +44,8 @@ impl darwinia_staking::Stake for CrabStaking { ) } } -pub enum CKtonStaking {} -impl darwinia_staking::Stake for CKtonStaking { +pub enum KtonStaking {} +impl darwinia_staking::Stake for KtonStaking { type AccountId = AccountId; type Item = Balance; @@ -74,13 +74,13 @@ frame_support::parameter_types! { impl darwinia_staking::Config for Runtime { type Deposit = Deposit; - type Kton = CKtonStaking; + type Kton = KtonStaking; type MaxDeposits = ConstU32<16>; type MaxUnstakings = ConstU32<16>; type MinStakingDuration = MinStakingDuration; type PayoutFraction = PayoutFraction; type RewardRemainder = Treasury; - type Ring = CrabStaking; + type Ring = RingStaking; type RingCurrency = Balances; type RuntimeEvent = RuntimeEvent; type UnixTime = Timestamp; diff --git a/runtime/crab/src/pallets/system.rs b/runtime/crab/src/pallets/system.rs index 96faace69..74d82b74c 100644 --- a/runtime/crab/src/pallets/system.rs +++ b/runtime/crab/src/pallets/system.rs @@ -101,7 +101,7 @@ impl frame_system::Config for Runtime { /// The ubiquitous origin type. type RuntimeOrigin = RuntimeOrigin; /// This is used as an identifier of the chain. 42 is the generic substrate prefix. - type SS58Prefix = ConstU16<18>; + type SS58Prefix = ConstU16<42>; /// Weight information for the extrinsics of this pallet. type SystemWeightInfo = weights::frame_system::WeightInfo; /// Runtime version. diff --git a/runtime/darwinia/src/lib.rs b/runtime/darwinia/src/lib.rs index 768f68af4..761def089 100644 --- a/runtime/darwinia/src/lib.rs +++ b/runtime/darwinia/src/lib.rs @@ -90,51 +90,6 @@ pub const VERSION: sp_version::RuntimeVersion = sp_version::RuntimeVersion { state_version: 0, }; -// TODO: move to impl.rs -pub struct DealWithFees(sp_std::marker::PhantomData); -impl frame_support::traits::OnUnbalanced> - for DealWithFees -where - R: pallet_balances::Config, - R: pallet_balances::Config + pallet_treasury::Config, - pallet_treasury::Pallet: - frame_support::traits::OnUnbalanced>, -{ - // this seems to be called for substrate-based transactions - fn on_unbalanceds( - mut fees_then_tips: impl Iterator>, - ) { - if let Some(fees) = fees_then_tips.next() { - // substrate - use frame_support::traits::Imbalance; - - // for fees, 80% are burned, 20% to the treasury - let (_, to_treasury) = fees.ration(80, 20); - - // Balances pallet automatically burns dropped Negative Imbalances by decreasing - // total_supply accordingly - as frame_support::traits::OnUnbalanced<_>>::on_unbalanced( - to_treasury, - ); - } - } - - // this is called from pallet_evm for Ethereum-based transactions - // (technically, it calls on_unbalanced, which calls this when non-zero) - fn on_nonzero_unbalanced(amount: pallet_balances::NegativeImbalance) { - // substrate - use frame_support::traits::Imbalance; - - // Balances pallet automatically burns dropped Negative Imbalances by decreasing - // total_supply accordingly - let (_, to_treasury) = amount.ration(80, 20); - - as frame_support::traits::OnUnbalanced<_>>::on_unbalanced( - to_treasury, - ); - } -} - /// The version information used to identify this runtime when compiled natively. #[cfg(feature = "std")] pub fn native_version() -> sp_version::NativeVersion { diff --git a/runtime/darwinia/src/pallets/evm.rs b/runtime/darwinia/src/pallets/evm.rs index 1603052a3..4a6d3f967 100644 --- a/runtime/darwinia/src/pallets/evm.rs +++ b/runtime/darwinia/src/pallets/evm.rs @@ -103,7 +103,8 @@ where addr(9), addr(1024), addr(1025), - addr(1026), // For KTON asset + // For KTON asset. + addr(1026), addr(1536), addr(1537), addr(2048), diff --git a/runtime/pangolin/Cargo.toml b/runtime/pangolin/Cargo.toml index 1d758828b..c0983e38b 100644 --- a/runtime/pangolin/Cargo.toml +++ b/runtime/pangolin/Cargo.toml @@ -45,7 +45,6 @@ darwinia-precompile-state-storage = { workspace = true } darwinia-staking = { workspace = true } dc-primitives = { workspace = true } - # darwinia-messages-substrate bp-message-dispatch = { workspace = true } bp-messages = { workspace = true } diff --git a/runtime/pangolin/src/lib.rs b/runtime/pangolin/src/lib.rs index f016f5717..5b5f8e1c8 100644 --- a/runtime/pangolin/src/lib.rs +++ b/runtime/pangolin/src/lib.rs @@ -16,7 +16,7 @@ // You should have received a copy of the GNU General Public License // along with Darwinia. If not, see . -//! Darwinia runtime. +//! Pangolin runtime. #![cfg_attr(not(feature = "std"), no_std)] #![recursion_limit = "256"] @@ -88,51 +88,6 @@ pub const VERSION: sp_version::RuntimeVersion = sp_version::RuntimeVersion { state_version: 0, }; -// TODO: move to impl.rs -pub struct DealWithFees(sp_std::marker::PhantomData); -impl frame_support::traits::OnUnbalanced> - for DealWithFees -where - R: pallet_balances::Config, - R: pallet_balances::Config + pallet_treasury::Config, - pallet_treasury::Pallet: - frame_support::traits::OnUnbalanced>, -{ - // this seems to be called for substrate-based transactions - fn on_unbalanceds( - mut fees_then_tips: impl Iterator>, - ) { - if let Some(fees) = fees_then_tips.next() { - // substrate - use frame_support::traits::Imbalance; - - // for fees, 80% are burned, 20% to the treasury - let (_, to_treasury) = fees.ration(80, 20); - - // Balances pallet automatically burns dropped Negative Imbalances by decreasing - // total_supply accordingly - as frame_support::traits::OnUnbalanced<_>>::on_unbalanced( - to_treasury, - ); - } - } - - // this is called from pallet_evm for Ethereum-based transactions - // (technically, it calls on_unbalanced, which calls this when non-zero) - fn on_nonzero_unbalanced(amount: pallet_balances::NegativeImbalance) { - // substrate - use frame_support::traits::Imbalance; - - // Balances pallet automatically burns dropped Negative Imbalances by decreasing - // total_supply accordingly - let (_, to_treasury) = amount.ration(80, 20); - - as frame_support::traits::OnUnbalanced<_>>::on_unbalanced( - to_treasury, - ); - } -} - /// The version information used to identify this runtime when compiled natively. #[cfg(feature = "std")] pub fn native_version() -> sp_version::NativeVersion { diff --git a/runtime/pangolin/src/migration.rs b/runtime/pangolin/src/migration.rs index c925ec809..f725e52b7 100644 --- a/runtime/pangolin/src/migration.rs +++ b/runtime/pangolin/src/migration.rs @@ -1,4 +1,5 @@ // darwinia +#[allow(unused_imports)] use crate::*; pub struct CustomOnRuntimeUpgrade; diff --git a/runtime/pangolin/src/pallets/deposit.rs b/runtime/pangolin/src/pallets/deposit.rs index 66f606f67..9b60262fe 100644 --- a/runtime/pangolin/src/pallets/deposit.rs +++ b/runtime/pangolin/src/pallets/deposit.rs @@ -19,8 +19,8 @@ // darwinia use crate::*; -pub enum PKtonMinting {} -impl darwinia_deposit::SimpleAsset for PKtonMinting { +pub enum KtonMinting {} +impl darwinia_deposit::SimpleAsset for KtonMinting { type AccountId = AccountId; fn mint(beneficiary: &Self::AccountId, amount: Balance) -> sp_runtime::DispatchResult { @@ -44,7 +44,7 @@ impl darwinia_deposit::SimpleAsset for PKtonMinting { } impl darwinia_deposit::Config for Runtime { - type Kton = PKtonMinting; + type Kton = KtonMinting; type MaxDeposits = ConstU32<16>; type MinLockingAmount = ConstU128; type Ring = Balances; diff --git a/runtime/pangolin/src/pallets/evm.rs b/runtime/pangolin/src/pallets/evm.rs index dd75c0bf0..138e263bb 100644 --- a/runtime/pangolin/src/pallets/evm.rs +++ b/runtime/pangolin/src/pallets/evm.rs @@ -103,7 +103,8 @@ where addr(9), addr(1024), addr(1025), - addr(1026), // For KTON asset + // For KTON asset. + addr(1026), addr(1536), addr(1537), addr(2048), diff --git a/runtime/pangolin/src/pallets/staking.rs b/runtime/pangolin/src/pallets/staking.rs index 79ea8fe70..0c76fe413 100644 --- a/runtime/pangolin/src/pallets/staking.rs +++ b/runtime/pangolin/src/pallets/staking.rs @@ -21,8 +21,8 @@ use crate::*; fast_runtime_or_not!(MinStakingDuration, ConstU32<{ 5 * MINUTES }>, ConstU32<{ 14 * DAYS }>); -pub enum PRingStaking {} -impl darwinia_staking::Stake for PRingStaking { +pub enum RingStaking {} +impl darwinia_staking::Stake for RingStaking { type AccountId = AccountId; type Item = Balance; @@ -44,8 +44,8 @@ impl darwinia_staking::Stake for PRingStaking { ) } } -pub enum PKtonStaking {} -impl darwinia_staking::Stake for PKtonStaking { +pub enum KtonStaking {} +impl darwinia_staking::Stake for KtonStaking { type AccountId = AccountId; type Item = Balance; @@ -74,13 +74,13 @@ frame_support::parameter_types! { impl darwinia_staking::Config for Runtime { type Deposit = Deposit; - type Kton = PKtonStaking; + type Kton = KtonStaking; type MaxDeposits = ConstU32<16>; type MaxUnstakings = ConstU32<16>; type MinStakingDuration = MinStakingDuration; type PayoutFraction = PayoutFraction; type RewardRemainder = Treasury; - type Ring = PRingStaking; + type Ring = RingStaking; type RingCurrency = Balances; type RuntimeEvent = RuntimeEvent; type UnixTime = Timestamp; diff --git a/runtime/pangolin/src/pallets/system.rs b/runtime/pangolin/src/pallets/system.rs index 96faace69..74d82b74c 100644 --- a/runtime/pangolin/src/pallets/system.rs +++ b/runtime/pangolin/src/pallets/system.rs @@ -101,7 +101,7 @@ impl frame_system::Config for Runtime { /// The ubiquitous origin type. type RuntimeOrigin = RuntimeOrigin; /// This is used as an identifier of the chain. 42 is the generic substrate prefix. - type SS58Prefix = ConstU16<18>; + type SS58Prefix = ConstU16<42>; /// Weight information for the extrinsics of this pallet. type SystemWeightInfo = weights::frame_system::WeightInfo; /// Runtime version. diff --git a/runtime/pangoro/Cargo.toml b/runtime/pangoro/Cargo.toml new file mode 100644 index 000000000..d474ca305 --- /dev/null +++ b/runtime/pangoro/Cargo.toml @@ -0,0 +1,368 @@ +[package] +authors.workspace = true +description = "Pangoro runtime." +edition.workspace = true +name = "pangoro-runtime" +readme = "README.md" +version.workspace = true + +[build-dependencies] +substrate-wasm-builder = { workspace = true } + +[dependencies] +# crates.io +codec = { package = "parity-scale-codec", workspace = true } +scale-info = { workspace = true } +static_assertions = { workspace = true } +# crates.io optional +array-bytes = { optional = true, workspace = true } + +# cumulus +cumulus-pallet-aura-ext = { workspace = true } +cumulus-pallet-dmp-queue = { workspace = true } +cumulus-pallet-parachain-system = { workspace = true } +cumulus-pallet-xcm = { workspace = true } +cumulus-pallet-xcmp-queue = { workspace = true } +cumulus-primitives-core = { workspace = true } +cumulus-primitives-timestamp = { workspace = true } +cumulus-primitives-utility = { workspace = true } +parachain-info = { workspace = true } +# cumulus optional +cumulus-pallet-session-benchmarking = { optional = true, workspace = true } + +# darwinia +darwinia-account-migration = { workspace = true } +darwinia-common-runtime = { workspace = true } +darwinia-deposit = { workspace = true } +darwinia-ecdsa-authority = { workspace = true } +darwinia-message-gadget = { workspace = true } +darwinia-message-transact = { workspace = true } +darwinia-precompile-assets = { workspace = true } +darwinia-precompile-bls12-381 = { workspace = true } +darwinia-precompile-deposit = { workspace = true } +darwinia-precompile-staking = { workspace = true } +darwinia-precompile-state-storage = { workspace = true } +darwinia-staking = { workspace = true } +dc-primitives = { workspace = true } + +# darwinia-messages-substrate +bp-message-dispatch = { workspace = true } +bp-messages = { workspace = true } +bp-polkadot-core = { workspace = true } +bp-runtime = { workspace = true } +bridge-runtime-common = { workspace = true } +pallet-bridge-dispatch = { workspace = true } +pallet-bridge-grandpa = { workspace = true } +pallet-bridge-messages = { workspace = true } +pallet-bridge-parachains = { workspace = true } +pallet-fee-market = { workspace = true } + +# frontier +fp-rpc = { workspace = true } +fp-self-contained = { workspace = true } +pallet-ethereum = { features = ["forbid-evm-reentrancy"], workspace = true } +pallet-evm = { features = ["forbid-evm-reentrancy"], workspace = true } +pallet-evm-precompile-blake2 = { workspace = true } +pallet-evm-precompile-bn128 = { workspace = true } +pallet-evm-precompile-dispatch = { workspace = true } +pallet-evm-precompile-modexp = { workspace = true } +pallet-evm-precompile-simple = { workspace = true } + +# moonbeam +precompile-utils = { workspace = true } +xcm-primitives = { workspace = true } + +# polkadot +pallet-xcm = { workspace = true } +polkadot-parachain = { workspace = true } +polkadot-runtime-common = { workspace = true } +xcm = { workspace = true } +xcm-builder = { workspace = true } +xcm-executor = { workspace = true } + +# substrate +frame-executive = { workspace = true } +frame-support = { workspace = true } +frame-system = { workspace = true } +frame-system-rpc-runtime-api = { workspace = true } +pallet-assets = { workspace = true } +pallet-aura = { workspace = true } +pallet-authorship = { workspace = true } +pallet-balances = { workspace = true } +pallet-collective = { workspace = true } +pallet-democracy = { workspace = true } +pallet-elections-phragmen = { workspace = true } +pallet-identity = { workspace = true } +pallet-membership = { workspace = true } +pallet-multisig = { workspace = true } +pallet-preimage = { workspace = true } +pallet-proxy = { workspace = true } +pallet-scheduler = { workspace = true } +pallet-session = { workspace = true } +pallet-sudo = { workspace = true } +pallet-timestamp = { workspace = true } +pallet-tips = { workspace = true } +pallet-transaction-payment = { workspace = true } +pallet-transaction-payment-rpc-runtime-api = { workspace = true } +pallet-treasury = { workspace = true } +pallet-utility = { workspace = true } +pallet-vesting = { workspace = true } +sp-api = { workspace = true } +sp-block-builder = { workspace = true } +sp-consensus-aura = { workspace = true } +sp-core = { workspace = true } +sp-inherents = { workspace = true } +sp-io = { workspace = true } +sp-offchain = { workspace = true } +sp-runtime = { workspace = true } +sp-session = { workspace = true } +sp-std = { workspace = true } +sp-transaction-pool = { workspace = true } +sp-version = { workspace = true } +# substrate optional +frame-benchmarking = { optional = true, workspace = true } +frame-system-benchmarking = { optional = true, workspace = true } +frame-try-runtime = { optional = true, workspace = true } + +[dev-dependencies] +# darwinia +darwinia-common-runtime = { features = ["test"], workspace = true } +# substrate +sp-keyring = { workspace = true } + +[features] +default = ["std"] +std = [ + # crates.io + "codec/std", + "scale-info/std", + + # cumulus + "cumulus-pallet-aura-ext/std", + "cumulus-pallet-dmp-queue/std", + "cumulus-pallet-parachain-system/std", + "cumulus-pallet-xcm/std", + "cumulus-pallet-xcmp-queue/std", + "cumulus-primitives-core/std", + "cumulus-primitives-timestamp/std", + "cumulus-primitives-utility/std", + "parachain-info/std", + # cumulus optional + "cumulus-pallet-session-benchmarking?/std", + + # darwinia + "darwinia-account-migration/std", + "darwinia-common-runtime/std", + "darwinia-deposit/std", + "darwinia-ecdsa-authority/std", + "darwinia-message-gadget/std", + "darwinia-message-transact/std", + "darwinia-precompile-assets/std", + "darwinia-precompile-bls12-381/std", + "darwinia-precompile-deposit/std", + "darwinia-precompile-staking/std", + "darwinia-precompile-state-storage/std", + "darwinia-staking/std", + "dc-primitives/std", + + # darwinia-messages-substrate + "bp-message-dispatch/std", + "bp-messages/std", + "bp-runtime/std", + "bp-polkadot-core/std", + "bridge-runtime-common/std", + "pallet-bridge-dispatch/std", + "pallet-bridge-grandpa/std", + "pallet-bridge-messages/std", + "pallet-bridge-parachains/std", + "pallet-fee-market/std", + + # frontier + "fp-rpc/std", + "fp-self-contained/std", + "pallet-ethereum/std", + "pallet-evm/std", + "pallet-evm-precompile-blake2/std", + "pallet-evm-precompile-bn128/std", + "pallet-evm-precompile-dispatch/std", + "pallet-evm-precompile-modexp/std", + "pallet-evm-precompile-simple/std", + + # moonbeam + "precompile-utils/std", + "xcm-primitives/std", + + # polkadot + "pallet-xcm/std", + "polkadot-parachain/std", + "polkadot-runtime-common/std", + "xcm/std", + "xcm-builder/std", + "xcm-executor/std", + + # substrate + "frame-executive/std", + "frame-support/std", + "frame-system/std", + "frame-system-rpc-runtime-api/std", + "pallet-assets/std", + "pallet-aura/std", + "pallet-authorship/std", + "pallet-balances/std", + "pallet-collective/std", + "pallet-democracy/std", + "pallet-elections-phragmen/std", + "pallet-membership/std", + "pallet-identity/std", + "pallet-multisig/std", + "pallet-preimage/std", + "pallet-proxy/std", + "pallet-scheduler/std", + "pallet-session/std", + "pallet-sudo/std", + "pallet-timestamp/std", + "pallet-tips/std", + "pallet-transaction-payment-rpc-runtime-api/std", + "pallet-transaction-payment/std", + "pallet-treasury/std", + "pallet-utility/std", + "pallet-vesting/std", + "sp-api/std", + "sp-block-builder/std", + "sp-consensus-aura/std", + "sp-core/std", + "sp-inherents/std", + "sp-io/std", + "sp-offchain/std", + "sp-runtime/std", + "sp-session/std", + "sp-std/std", + "sp-transaction-pool/std", + "sp-version/std", + # substrate optional + "frame-benchmarking?/std", + "frame-system-benchmarking?/std", + "frame-try-runtime?/std", + +] + +runtime-benchmarks = [ + # crates.io + "array-bytes", + + # cumulus + "cumulus-pallet-parachain-system/runtime-benchmarks", + "cumulus-pallet-xcmp-queue/runtime-benchmarks", + # cumulus optional + "cumulus-pallet-session-benchmarking/runtime-benchmarks", + + # darwinia-messages-substrate + "bridge-runtime-common/runtime-benchmarks", + "pallet-bridge-grandpa/runtime-benchmarks", + "pallet-bridge-messages/runtime-benchmarks", + "pallet-bridge-parachains/runtime-benchmarks", + "pallet-fee-market/runtime-benchmarks", + + # frontier + "pallet-ethereum/runtime-benchmarks", + "pallet-evm/runtime-benchmarks", + + # moonbeam + "xcm-primitives/runtime-benchmarks", + + # polkadot + "pallet-xcm/runtime-benchmarks", + "polkadot-parachain/runtime-benchmarks", + "polkadot-runtime-common/runtime-benchmarks", + "xcm-builder/runtime-benchmarks", + "xcm-executor/runtime-benchmarks", + + # substrate + "frame-support/runtime-benchmarks", + "frame-system/runtime-benchmarks", + "pallet-assets/runtime-benchmarks", + "pallet-balances/runtime-benchmarks", + "pallet-collective/runtime-benchmarks", + "pallet-democracy/runtime-benchmarks", + "pallet-elections-phragmen/runtime-benchmarks", + "pallet-membership/runtime-benchmarks", + "pallet-identity/runtime-benchmarks", + "pallet-multisig/runtime-benchmarks", + "pallet-preimage/runtime-benchmarks", + "pallet-proxy/runtime-benchmarks", + "pallet-scheduler/runtime-benchmarks", + "pallet-timestamp/runtime-benchmarks", + "pallet-tips/runtime-benchmarks", + "pallet-treasury/runtime-benchmarks", + "pallet-utility/runtime-benchmarks", + "pallet-vesting/runtime-benchmarks", + "sp-runtime/runtime-benchmarks", + # substrate optional + "frame-benchmarking/runtime-benchmarks", + "frame-system-benchmarking/runtime-benchmarks", +] + +fast-runtime = [] + +try-runtime = [ + # cumulus + "cumulus-pallet-aura-ext/try-runtime", + "cumulus-pallet-dmp-queue/try-runtime", + "cumulus-pallet-parachain-system/try-runtime", + "cumulus-pallet-xcm/try-runtime", + "cumulus-pallet-xcmp-queue/try-runtime", + "parachain-info/try-runtime", + + # darwinia + "darwinia-account-migration/try-runtime", + "darwinia-deposit/try-runtime", + "darwinia-ecdsa-authority/try-runtime", + "darwinia-message-gadget/try-runtime", + "darwinia-message-transact/try-runtime", + "darwinia-staking/try-runtime", + + # darwinia-messages-substrate + "pallet-bridge-dispatch/try-runtime", + "pallet-bridge-grandpa/try-runtime", + "pallet-bridge-messages/try-runtime", + "pallet-bridge-parachains/try-runtime", + "pallet-fee-market/try-runtime", + + # frontier + "fp-self-contained/try-runtime", + "pallet-ethereum/try-runtime", + "pallet-evm/try-runtime", + + # polkadot + "pallet-xcm/try-runtime", + "polkadot-runtime-common/try-runtime", + + # substrate + "frame-executive/try-runtime", + "frame-support/try-runtime", + "frame-system/try-runtime", + "pallet-assets/try-runtime", + "pallet-aura/try-runtime", + "pallet-authorship/try-runtime", + "pallet-balances/try-runtime", + "pallet-collective/try-runtime", + "pallet-democracy/try-runtime", + "pallet-elections-phragmen/try-runtime", + "pallet-membership/try-runtime", + "pallet-identity/try-runtime", + "pallet-multisig/try-runtime", + "pallet-preimage/try-runtime", + "pallet-proxy/try-runtime", + "pallet-scheduler/try-runtime", + "pallet-session/try-runtime", + "pallet-sudo/try-runtime", + "pallet-timestamp/try-runtime", + "pallet-tips/try-runtime", + "pallet-transaction-payment/try-runtime", + "pallet-treasury/try-runtime", + "pallet-utility/try-runtime", + "pallet-vesting/try-runtime", + "sp-runtime/try-runtime", + # substrate optional + "frame-try-runtime/try-runtime", +] diff --git a/runtime/pangoro/build.rs b/runtime/pangoro/build.rs new file mode 100644 index 000000000..4a1101a97 --- /dev/null +++ b/runtime/pangoro/build.rs @@ -0,0 +1,24 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// crates.io +use substrate_wasm_builder::WasmBuilder; + +fn main() { + WasmBuilder::new().with_current_project().export_heap_base().import_memory().build() +} diff --git a/runtime/pangoro/src/lib.rs b/runtime/pangoro/src/lib.rs new file mode 100644 index 000000000..e0169758d --- /dev/null +++ b/runtime/pangoro/src/lib.rs @@ -0,0 +1,597 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Pangoro runtime. + +#![cfg_attr(not(feature = "std"), no_std)] +#![recursion_limit = "256"] + +#[cfg(feature = "std")] +include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); + +mod pallets; +pub use pallets::*; + +mod migration; +mod weights; + +pub use darwinia_common_runtime::*; +pub use dc_primitives::*; + +// substrate +use sp_std::prelude::*; + +/// Block type as expected by this runtime. +pub type Block = sp_runtime::generic::Block; + +/// A Block signed with a Justification +pub type SignedBlock = sp_runtime::generic::SignedBlock; + +/// The SignedExtension to the basic transaction logic. +pub type SignedExtra = ( + frame_system::CheckNonZeroSender, + frame_system::CheckSpecVersion, + frame_system::CheckTxVersion, + frame_system::CheckGenesis, + frame_system::CheckEra, + frame_system::CheckNonce, + frame_system::CheckWeight, + pallet_transaction_payment::ChargeTransactionPayment, +); + +/// Unchecked extrinsic type as expected by this runtime. +pub type UncheckedExtrinsic = + fp_self_contained::UncheckedExtrinsic; + +/// Extrinsic type that has already been checked. +pub type CheckedExtrinsic = + fp_self_contained::CheckedExtrinsic; + +/// Executive: handles dispatch to the various modules. +pub type Executive = frame_executive::Executive< + Runtime, + Block, + frame_system::ChainContext, + Runtime, + AllPalletsWithSystem, + migration::CustomOnRuntimeUpgrade, +>; + +/// Darwinia proposal base fee. +pub const DARWINIA_PROPOSAL_REQUIREMENT: Balance = 5000 * UNIT; + +/// Runtime version. +#[sp_version::runtime_version] +pub const VERSION: sp_version::RuntimeVersion = sp_version::RuntimeVersion { + spec_name: sp_runtime::create_runtime_str!("Pangoro2"), + impl_name: sp_runtime::create_runtime_str!("DarwiniaOfficialRust"), + authoring_version: 0, + spec_version: 6_0_0_2, + impl_version: 0, + apis: RUNTIME_API_VERSIONS, + transaction_version: 0, + state_version: 0, +}; + +/// The version information used to identify this runtime when compiled natively. +#[cfg(feature = "std")] +pub fn native_version() -> sp_version::NativeVersion { + sp_version::NativeVersion { runtime_version: VERSION, can_author_with: Default::default() } +} + +// Create the runtime by composing the FRAME pallets that were previously configured. +frame_support::construct_runtime! { + pub enum Runtime where + Block = Block, + NodeBlock = dc_primitives::Block, + UncheckedExtrinsic = UncheckedExtrinsic, + { + // System stuff. + System: frame_system = 0, + ParachainSystem: cumulus_pallet_parachain_system = 1, + Timestamp: pallet_timestamp = 2, + ParachainInfo: parachain_info = 3, + + // Monetary stuff. + // Leave 4 here. + // To keep balances consistent with the existing XCM configurations. + Balances: pallet_balances = 5, + TransactionPayment: pallet_transaction_payment = 6, + Assets: pallet_assets = 7, + Vesting: pallet_vesting = 8, + Deposit: darwinia_deposit = 9, + AccountMigration: darwinia_account_migration = 10, + + // Consensus stuff. + Authorship: pallet_authorship = 11, + DarwiniaStaking: darwinia_staking = 12, + Session: pallet_session = 13, + Aura: pallet_aura = 14, + AuraExt: cumulus_pallet_aura_ext = 15, + MessageGadget: darwinia_message_gadget = 16, + EcdsaAuthority: darwinia_ecdsa_authority = 17, + + // Governance stuff. + Democracy: pallet_democracy = 18, + Council: pallet_collective:: = 19, + TechnicalCommittee: pallet_collective:: = 20, + PhragmenElection: pallet_elections_phragmen = 21, + TechnicalMembership: pallet_membership:: = 22, + Treasury: pallet_treasury = 23, + Tips: pallet_tips = 24, + + // Utility stuff. + Sudo: pallet_sudo = 25, + Utility: pallet_utility = 26, + Identity: pallet_identity = 27, + Scheduler: pallet_scheduler = 28, + Preimage: pallet_preimage = 29, + Proxy: pallet_proxy = 30, + Multisig: pallet_multisig = 31, + + // XCM stuff. + XcmpQueue: cumulus_pallet_xcmp_queue = 32, + PolkadotXcm: pallet_xcm = 33, + CumulusXcm: cumulus_pallet_xcm = 34, + DmpQueue: cumulus_pallet_dmp_queue = 35, + + // EVM stuff. + Ethereum: pallet_ethereum = 36, + Evm: pallet_evm = 37, + MessageTransact: darwinia_message_transact = 38, + } +} + +#[cfg(feature = "runtime-benchmarks")] +frame_benchmarking::define_benchmarks! { + [frame_system, SystemBench::] + [pallet_balances, Balances] + [pallet_session, SessionBench::] + [pallet_timestamp, Timestamp] + [pallet_collator_selection, CollatorSelection] + [cumulus_pallet_xcmp_queue, XcmpQueue] +} + +impl_self_contained_call!(); + +sp_api::impl_runtime_apis! { + impl sp_consensus_aura::AuraApi for Runtime { + fn slot_duration() -> sp_consensus_aura::SlotDuration { + sp_consensus_aura::SlotDuration::from_millis(Aura::slot_duration()) + } + + fn authorities() -> Vec { + Aura::authorities().into_inner() + } + } + + impl sp_api::Core for Runtime { + fn version() -> sp_version::RuntimeVersion { + VERSION + } + + fn execute_block(block: Block) { + Executive::execute_block(block) + } + + fn initialize_block(header: &::Header) { + Executive::initialize_block(header) + } + } + + impl sp_api::Metadata for Runtime { + fn metadata() -> sp_core::OpaqueMetadata { + sp_core::OpaqueMetadata::new(Runtime::metadata().into()) + } + } + + impl sp_block_builder::BlockBuilder for Runtime { + fn apply_extrinsic(extrinsic: ::Extrinsic) -> sp_runtime::ApplyExtrinsicResult { + Executive::apply_extrinsic(extrinsic) + } + + fn finalize_block() -> ::Header { + Executive::finalize_block() + } + + fn inherent_extrinsics(data: sp_inherents::InherentData) -> Vec<::Extrinsic> { + data.create_extrinsics() + } + + fn check_inherents( + block: Block, + data: sp_inherents::InherentData, + ) -> sp_inherents::CheckInherentsResult { + data.check_extrinsics(&block) + } + } + + impl sp_transaction_pool::runtime_api::TaggedTransactionQueue for Runtime { + fn validate_transaction( + source: sp_runtime::transaction_validity::TransactionSource, + tx: ::Extrinsic, + block_hash: ::Hash, + ) -> sp_runtime::transaction_validity::TransactionValidity { + Executive::validate_transaction(source, tx, block_hash) + } + } + + impl sp_offchain::OffchainWorkerApi for Runtime { + fn offchain_worker(header: &::Header) { + Executive::offchain_worker(header) + } + } + + impl sp_session::SessionKeys for Runtime { + fn generate_session_keys(seed: Option>) -> Vec { + SessionKeys::generate(seed) + } + + fn decode_session_keys( + encoded: Vec, + ) -> Option, sp_runtime::KeyTypeId)>> { + SessionKeys::decode_into_raw_public_keys(&encoded) + } + } + + impl frame_system_rpc_runtime_api::AccountNonceApi for Runtime { + fn account_nonce(account: AccountId) -> Nonce { + System::account_nonce(account) + } + } + + impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi for Runtime { + fn query_info( + uxt: ::Extrinsic, + len: u32, + ) -> pallet_transaction_payment_rpc_runtime_api::RuntimeDispatchInfo { + TransactionPayment::query_info(uxt, len) + } + fn query_fee_details( + uxt: ::Extrinsic, + len: u32, + ) -> pallet_transaction_payment::FeeDetails { + TransactionPayment::query_fee_details(uxt, len) + } + } + + impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentCallApi + for Runtime + { + fn query_call_info( + call: RuntimeCall, + len: u32, + ) -> pallet_transaction_payment::RuntimeDispatchInfo { + TransactionPayment::query_call_info(call, len) + } + fn query_call_fee_details( + call: RuntimeCall, + len: u32, + ) -> pallet_transaction_payment::FeeDetails { + TransactionPayment::query_call_fee_details(call, len) + } + } + + impl cumulus_primitives_core::CollectCollationInfo for Runtime { + fn collect_collation_info(header: &::Header) -> cumulus_primitives_core::CollationInfo { + ParachainSystem::collect_collation_info(header) + } + } + + impl fp_rpc::EthereumRuntimeRPCApi for Runtime { + fn chain_id() -> u64 { + <::ChainId as frame_support::traits::Get>::get() + } + + fn account_basic(address: sp_core::H160) -> pallet_evm::Account { + let (account, _) = Evm::account_basic(&address); + + account + } + + fn gas_price() -> sp_core::U256 { + // frontier + use pallet_evm::FeeCalculator; + + let (gas_price, _) = ::FeeCalculator::min_gas_price(); + + gas_price + } + + fn account_code_at(address: sp_core::H160) -> Vec { + Evm::account_codes(address) + } + + fn author() -> sp_core::H160 { + >::find_author() + } + + fn storage_at(address: sp_core::H160, index: sp_core::U256) -> sp_core::H256 { + let mut tmp = [0u8; 32]; + + index.to_big_endian(&mut tmp); + + Evm::account_storages(address, sp_core::H256::from_slice(&tmp[..])) + } + + fn call( + from: sp_core::H160, + to: sp_core::H160, + data: Vec, + value: sp_core::U256, + gas_limit: sp_core::U256, + max_fee_per_gas: Option, + max_priority_fee_per_gas: Option, + nonce: Option, + estimate: bool, + access_list: Option)>>, + ) -> Result { + // frontier + use pallet_evm::Runner; + // substrate + use sp_runtime::traits::UniqueSaturatedInto; + + let config = if estimate { + let mut config = ::config().clone(); + config.estimate = true; + Some(config) + } else { + None + }; + + let is_transactional = false; + let validate = true; + #[allow(clippy::or_fun_call)] + let evm_config = config.as_ref().unwrap_or(::config()); + ::Runner::call( + from, + to, + data, + value, + gas_limit.unique_saturated_into(), + max_fee_per_gas, + max_priority_fee_per_gas, + nonce, + access_list.unwrap_or_default(), + is_transactional, + validate, + evm_config, + ).map_err(|err| err.error.into()) + } + + fn create( + from: sp_core::H160, + data: Vec, + value: sp_core::U256, + gas_limit: sp_core::U256, + max_fee_per_gas: Option, + max_priority_fee_per_gas: Option, + nonce: Option, + estimate: bool, + access_list: Option)>>, + ) -> Result { + // frontier + use pallet_evm::Runner; + // substrate + use sp_runtime::traits::UniqueSaturatedInto; + + let config = if estimate { + let mut config = ::config().clone(); + config.estimate = true; + Some(config) + } else { + None + }; + + let is_transactional = false; + let validate = true; + #[allow(clippy::or_fun_call)] + let evm_config = config.as_ref().unwrap_or(::config()); + ::Runner::create( + from, + data, + value, + gas_limit.unique_saturated_into(), + max_fee_per_gas, + max_priority_fee_per_gas, + nonce, + access_list.unwrap_or_default(), + is_transactional, + validate, + evm_config, + ).map_err(|err| err.error.into()) + } + + fn current_transaction_statuses() -> Option> { + Ethereum::current_transaction_statuses() + } + + fn current_block() -> Option { + Ethereum::current_block() + } + + fn current_receipts() -> Option> { + Ethereum::current_receipts() + } + + fn current_all() -> ( + Option, + Option>, + Option> + ) { + ( + Ethereum::current_block(), + Ethereum::current_receipts(), + Ethereum::current_transaction_statuses() + ) + } + + fn extrinsic_filter( + xts: Vec<::Extrinsic>, + ) -> Vec { + xts.into_iter().filter_map(|xt| match xt.0.function { + RuntimeCall::Ethereum( + pallet_ethereum::Call::::transact { transaction } + ) => Some(transaction), + _ => None + }).collect::>() + } + + fn elasticity() -> Option { + None + } + + fn gas_limit_multiplier_support() { + } + } + + impl fp_rpc::ConvertTransactionRuntimeApi for Runtime { + fn convert_transaction( + transaction: pallet_ethereum::Transaction + ) -> ::Extrinsic { + UncheckedExtrinsic::new_unsigned( + pallet_ethereum::Call::::transact { transaction }.into(), + ) + } + } + + #[cfg(feature = "runtime-benchmarks")] + impl frame_benchmarking::Benchmark for Runtime { + fn benchmark_metadata(extra: bool) -> ( + Vec, + Vec, + ) { + // substrate + use frame_benchmarking::*; + use frame_support::traits::StorageInfoTrait; + use frame_system_benchmarking::Pallet as SystemBench; + use cumulus_pallet_session_benchmarking::Pallet as SessionBench; + + let mut list = Vec::::new(); + + list_benchmarks!(list, extra); + + let storage_info = AllPalletsWithSystem::storage_info(); + + (list, storage_info) + } + + fn dispatch_benchmark( + config: frame_benchmarking::BenchmarkConfig + ) -> Result, sp_runtime::RuntimeString> { + // substrate + use frame_benchmarking::*; + + use frame_system_benchmarking::Pallet as SystemBench; + impl frame_system_benchmarking::Config for Runtime {} + + use cumulus_pallet_session_benchmarking::Pallet as SessionBench; + impl cumulus_pallet_session_benchmarking::Config for Runtime {} + + let whitelist: Vec = vec![ + // Block Number + array_bytes::hex_into_unchecked("26aa394eea5630e07c48ae0c9558cef702a5c1b19ab7a04f536c519aca4983ac"), + // Total Issuance + array_bytes::hex_into_unchecked("c2261276cc9d1f8598ea4b6a74b15c2f57c875e4cff74148e4628f264b974c80"), + // Execution Phase + array_bytes::hex_into_unchecked("26aa394eea5630e07c48ae0c9558cef7ff553b5a9862a516939d82b3d3d8661a"), + // Event Count + array_bytes::hex_into_unchecked("26aa394eea5630e07c48ae0c9558cef70a98fdbe9ce6c55837576c60c7af3850"), + // System Events + array_bytes::hex_into_unchecked("26aa394eea5630e07c48ae0c9558cef780d41e5e16056765bc8461851072c9d7"), + ]; + + let mut batches = Vec::::new(); + let params = (&config, &whitelist); + + add_benchmarks!(params, batches); + + if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) } + + Ok(batches) + } + } + + #[cfg(feature = "try-runtime")] + impl frame_try_runtime::TryRuntime for Runtime { + fn on_runtime_upgrade(checks: bool) -> (Weight, frame_support::weights::Weight) { + // substrate + use frame_support::log; + + log::info!("try-runtime::on_runtime_upgrade"); + + let weight = Executive::try_runtime_upgrade(checks).unwrap(); + + (weight, RuntimeBlockWeights::get().max_block) + } + + fn execute_block( + block: Block, + state_root_check: bool, + signature_check: bool, + select: frame_try_runtime::TryStateSelect, + ) -> Weight { + // NOTE: intentional unwrap: we don't want to propagate the error backwards, and want to + // have a backtrace here. + Executive::try_execute_block(block, state_root_check, signature_check, select).unwrap() + } + } +} + +struct CheckInherents; +impl cumulus_pallet_parachain_system::CheckInherents for CheckInherents { + fn check_inherents( + block: &Block, + relay_state_proof: &cumulus_pallet_parachain_system::RelayChainStateProof, + ) -> sp_inherents::CheckInherentsResult { + let relay_chain_slot = relay_state_proof + .read_slot() + .expect("Could not read the relay chain slot from the proof"); + + let inherent_data = + cumulus_primitives_timestamp::InherentDataProvider::from_relay_chain_slot_and_duration( + relay_chain_slot, + sp_std::time::Duration::from_secs(6), + ) + .create_inherent_data() + .expect("Could not create the timestamp inherent data"); + + inherent_data.check_extrinsics(block) + } +} +cumulus_pallet_parachain_system::register_validate_block! { + Runtime = Runtime, + BlockExecutor = cumulus_pallet_aura_ext::BlockExecutor::, + CheckInherents = CheckInherents, +} + +#[cfg(test)] +mod tests { + // darwinia + use super::*; + + #[test] + fn configured_base_extrinsic_weight_is_evm_compatible() { + let min_ethereum_transaction_weight = WeightPerGas::get() * 21_000; + let base_extrinsic = ::BlockWeights::get() + .get(frame_support::dispatch::DispatchClass::Normal) + .base_extrinsic; + + assert!(base_extrinsic.ref_time() <= min_ethereum_transaction_weight.ref_time()); + } +} diff --git a/runtime/pangoro/src/migration.rs b/runtime/pangoro/src/migration.rs new file mode 100644 index 000000000..f453df013 --- /dev/null +++ b/runtime/pangoro/src/migration.rs @@ -0,0 +1,43 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +#[allow(unused_imports)] +use crate::*; + +pub struct CustomOnRuntimeUpgrade; +impl frame_support::traits::OnRuntimeUpgrade for CustomOnRuntimeUpgrade { + #[cfg(feature = "try-runtime")] + fn pre_upgrade() -> Result<(), &'static str> { + Ok(()) + } + + #[cfg(feature = "try-runtime")] + fn post_upgrade(_state: Vec) -> Result<(), &'static str> { + Ok(()) + } + + fn on_runtime_upgrade() -> frame_support::weights::Weight { + migrate() + } +} + +fn migrate() -> frame_support::weights::Weight { + frame_support::weights::Weight::zero() + // RuntimeBlockWeights::get().max_block +} diff --git a/runtime/pangoro/src/pallets/account_migration.rs b/runtime/pangoro/src/pallets/account_migration.rs new file mode 100644 index 000000000..5e230b464 --- /dev/null +++ b/runtime/pangoro/src/pallets/account_migration.rs @@ -0,0 +1,24 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +impl darwinia_account_migration::Config for Runtime { + type RuntimeEvent = RuntimeEvent; +} diff --git a/runtime/pangoro/src/pallets/assets.rs b/runtime/pangoro/src/pallets/assets.rs new file mode 100644 index 000000000..9dc10c67c --- /dev/null +++ b/runtime/pangoro/src/pallets/assets.rs @@ -0,0 +1,53 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +/// List of the assets existed in this runtime. +pub enum AssetIds { + OKton = 1026, +} + +frame_support::parameter_types! { + pub Creators: Vec = vec![ROOT]; +} + +impl pallet_assets::Config for Runtime { + type ApprovalDeposit = ConstU128<0>; + type AssetAccountDeposit = ConstU128<0>; + type AssetDeposit = ConstU128<0>; + type AssetId = AssetId; + type AssetIdParameter = codec::Compact; + type Balance = Balance; + #[cfg(feature = "runtime-benchmarks")] + type BenchmarkHelper = (); + type CreateOrigin = frame_support::traits::AsEnsureOriginWithArg< + frame_system::EnsureSignedBy, AccountId>, + >; + type Currency = Balances; + type Extra = (); + type ForceOrigin = frame_system::EnsureRoot; + type Freezer = (); + type MetadataDepositBase = ConstU128<0>; + type MetadataDepositPerByte = ConstU128<0>; + type RemoveItemsLimit = ConstU32<1000>; + type RuntimeEvent = RuntimeEvent; + type StringLimit = ConstU32<50>; + type WeightInfo = (); +} diff --git a/runtime/pangoro/src/pallets/aura.rs b/runtime/pangoro/src/pallets/aura.rs new file mode 100644 index 000000000..1da134500 --- /dev/null +++ b/runtime/pangoro/src/pallets/aura.rs @@ -0,0 +1,26 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +impl pallet_aura::Config for Runtime { + type AuthorityId = sp_consensus_aura::sr25519::AuthorityId; + type DisabledValidators = (); + type MaxAuthorities = ConstU32<100_000>; +} diff --git a/runtime/pangoro/src/pallets/aura_ext.rs b/runtime/pangoro/src/pallets/aura_ext.rs new file mode 100644 index 000000000..d36000a52 --- /dev/null +++ b/runtime/pangoro/src/pallets/aura_ext.rs @@ -0,0 +1,22 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +impl cumulus_pallet_aura_ext::Config for Runtime {} diff --git a/runtime/pangoro/src/pallets/authorship.rs b/runtime/pangoro/src/pallets/authorship.rs new file mode 100644 index 000000000..5b5f8109d --- /dev/null +++ b/runtime/pangoro/src/pallets/authorship.rs @@ -0,0 +1,27 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +impl pallet_authorship::Config for Runtime { + type EventHandler = (DarwiniaStaking,); + type FilterUncle = (); + type FindAuthor = pallet_session::FindAccountFromAuthorIndex; + type UncleGenerations = ConstU32<0>; +} diff --git a/runtime/pangoro/src/pallets/balances.rs b/runtime/pangoro/src/pallets/balances.rs new file mode 100644 index 000000000..94a42eac2 --- /dev/null +++ b/runtime/pangoro/src/pallets/balances.rs @@ -0,0 +1,32 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +impl pallet_balances::Config for Runtime { + type AccountStore = System; + type Balance = Balance; + type DustRemoval = (); + type ExistentialDeposit = ConstU128<0>; + type MaxLocks = ConstU32<50>; + type MaxReserves = ConstU32<50>; + type ReserveIdentifier = [u8; 8]; + type RuntimeEvent = RuntimeEvent; + type WeightInfo = weights::pallet_balances::WeightInfo; +} diff --git a/runtime/pangoro/src/pallets/collective.rs b/runtime/pangoro/src/pallets/collective.rs new file mode 100644 index 000000000..7dfbc2623 --- /dev/null +++ b/runtime/pangoro/src/pallets/collective.rs @@ -0,0 +1,50 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +pub use pallet_collective::{Instance1 as CouncilCollective, Instance2 as TechnicalCollective}; + +// darwinia +use crate::*; + +pub const COLLECTIVE_DESIRED_MEMBERS: u32 = 7; +pub const COLLECTIVE_MAX_MEMBERS: u32 = 100; +pub const COLLECTIVE_MAX_PROPOSALS: u32 = 100; + +// Make sure that there are no more than `COLLECTIVE_MAX_MEMBERS` members elected via phragmen. +static_assertions::const_assert!(COLLECTIVE_DESIRED_MEMBERS <= COLLECTIVE_MAX_MEMBERS); + +impl pallet_collective::Config for Runtime { + type DefaultVote = pallet_collective::PrimeDefaultVote; + type MaxMembers = ConstU32; + type MaxProposals = ConstU32<100>; + type MotionDuration = ConstU32<{ 3 * DAYS }>; + type Proposal = RuntimeCall; + type RuntimeEvent = RuntimeEvent; + type RuntimeOrigin = RuntimeOrigin; + type WeightInfo = (); +} +impl pallet_collective::Config for Runtime { + type DefaultVote = pallet_collective::PrimeDefaultVote; + type MaxMembers = ConstU32; + type MaxProposals = ConstU32<100>; + type MotionDuration = ConstU32<{ 3 * DAYS }>; + type Proposal = RuntimeCall; + type RuntimeEvent = RuntimeEvent; + type RuntimeOrigin = RuntimeOrigin; + type WeightInfo = (); +} diff --git a/runtime/pangoro/src/pallets/democracy.rs b/runtime/pangoro/src/pallets/democracy.rs new file mode 100644 index 000000000..e28b4f392 --- /dev/null +++ b/runtime/pangoro/src/pallets/democracy.rs @@ -0,0 +1,64 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +const ENACTMENT_PERIOD: u32 = 28 * DAYS; + +impl pallet_democracy::Config for Runtime { + type BlacklistOrigin = Root; + // To cancel a proposal before it has been passed, the technical committee must be unanimous or + // Root must agree. + type CancelProposalOrigin = RootOrAll; + // To cancel a proposal which has been passed, 2/3 of the council must agree to it. + type CancellationOrigin = RootOrAtLeastTwoThird; + type CooloffPeriod = ConstU32<{ 7 * DAYS }>; + type Currency = Balances; + type EnactmentPeriod = ConstU32; + /// A unanimous council can have the next scheduled referendum be a straight default-carries + /// (NTB) vote. + type ExternalDefaultOrigin = RootOrAll; + /// A majority can have the next scheduled referendum be a straight majority-carries vote. + type ExternalMajorityOrigin = RootOrAtLeastHalf; + /// A straight majority of the council can decide what their next motion is. + type ExternalOrigin = RootOrAtLeastHalf; + /// Two thirds of the technical committee can have an ExternalMajority/ExternalDefault vote + /// be tabled immediately and with a shorter voting/enactment period. + type FastTrackOrigin = RootOrAtLeastTwoThird; + type FastTrackVotingPeriod = ConstU32<{ 3 * HOURS }>; + type InstantAllowed = ConstBool; + type InstantOrigin = RootOrAll; + type LaunchPeriod = ConstU32<{ 28 * DAYS }>; + type MaxBlacklisted = ConstU32<100>; + type MaxDeposits = ConstU32<100>; + type MaxProposals = ConstU32<100>; + type MaxVotes = ConstU32<100>; + type MinimumDeposit = ConstU128; + type PalletsOrigin = OriginCaller; + type Preimages = Preimage; + type RuntimeEvent = RuntimeEvent; + type Scheduler = Scheduler; + type Slash = Treasury; + // Any single technical committee member may veto a coming council proposal, however they can + // only do it once and it lasts only for the cool-off period. + type VetoOrigin = pallet_collective::EnsureMember; + type VoteLockingPeriod = ConstU32; + type VotingPeriod = ConstU32<{ 28 * DAYS }>; + type WeightInfo = (); +} diff --git a/runtime/pangoro/src/pallets/deposit.rs b/runtime/pangoro/src/pallets/deposit.rs new file mode 100644 index 000000000..f20d43b53 --- /dev/null +++ b/runtime/pangoro/src/pallets/deposit.rs @@ -0,0 +1,53 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +pub enum KtonMinting {} +impl darwinia_deposit::SimpleAsset for KtonMinting { + type AccountId = AccountId; + + fn mint(beneficiary: &Self::AccountId, amount: Balance) -> sp_runtime::DispatchResult { + Assets::mint( + RuntimeOrigin::signed(ROOT), + (AssetIds::OKton as AssetId).into(), + *beneficiary, + amount, + ) + } + + fn burn(who: &Self::AccountId, amount: Balance) -> sp_runtime::DispatchResult { + let asset_id = AssetIds::OKton as _; + + if Assets::balance(asset_id, who) < amount { + Err(>::BalanceLow)?; + } + + Assets::burn(RuntimeOrigin::signed(ROOT), asset_id.into(), *who, amount) + } +} + +impl darwinia_deposit::Config for Runtime { + type Kton = KtonMinting; + type MaxDeposits = ConstU32<16>; + type MinLockingAmount = ConstU128; + type Ring = Balances; + type RuntimeEvent = RuntimeEvent; + type UnixTime = Timestamp; +} diff --git a/runtime/pangoro/src/pallets/dmp_queue.rs b/runtime/pangoro/src/pallets/dmp_queue.rs new file mode 100644 index 000000000..17313c1b7 --- /dev/null +++ b/runtime/pangoro/src/pallets/dmp_queue.rs @@ -0,0 +1,26 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +impl cumulus_pallet_dmp_queue::Config for Runtime { + type ExecuteOverweightOrigin = frame_system::EnsureRoot; + type RuntimeEvent = RuntimeEvent; + type XcmExecutor = xcm_executor::XcmExecutor; +} diff --git a/runtime/pangoro/src/pallets/ecdsa_authority.rs b/runtime/pangoro/src/pallets/ecdsa_authority.rs new file mode 100644 index 000000000..05fc7dfcd --- /dev/null +++ b/runtime/pangoro/src/pallets/ecdsa_authority.rs @@ -0,0 +1,39 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +const MAX_PENDING_PERIOD: BlockNumber = 100; +const SYNC_INTERVAL: BlockNumber = 10; + +frame_support::parameter_types! { + pub const SignThreshold: sp_runtime::Perbill = sp_runtime::Perbill::from_percent(60); +} +static_assertions::const_assert!(MAX_PENDING_PERIOD > SYNC_INTERVAL); + +impl darwinia_ecdsa_authority::Config for Runtime { + type ChainId = ::ChainId; + type MaxAuthorities = ConstU32<3>; + type MaxPendingPeriod = ConstU32; + type MessageRoot = darwinia_message_gadget::MessageRootGetter; + type RuntimeEvent = RuntimeEvent; + type SignThreshold = SignThreshold; + type SyncInterval = ConstU32; + type WeightInfo = (); +} diff --git a/runtime/pangoro/src/pallets/elections_phragmen.rs b/runtime/pangoro/src/pallets/elections_phragmen.rs new file mode 100644 index 000000000..133b89054 --- /dev/null +++ b/runtime/pangoro/src/pallets/elections_phragmen.rs @@ -0,0 +1,49 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +const MAX_CANDIDATES: u32 = 30; + +frame_support::parameter_types! { + pub const PhragmenElectionPalletId: frame_support::traits::LockIdentifier = *b"phrelect"; +} + +impl pallet_elections_phragmen::Config for Runtime { + type CandidacyBond = ConstU128<{ 100 * MILLIUNIT }>; + type ChangeMembers = Council; + type Currency = Balances; + type CurrencyToVote = frame_support::traits::U128CurrencyToVote; + type DesiredMembers = ConstU32; + type DesiredRunnersUp = ConstU32<7>; + type InitializeMembers = Council; + type KickedMember = Treasury; + type LoserCandidate = Treasury; + type MaxCandidates = ConstU32; + type MaxVoters = ConstU32<{ 10 * MAX_CANDIDATES }>; + type PalletId = PhragmenElectionPalletId; + type RuntimeEvent = RuntimeEvent; + // Daily council elections. + type TermDuration = ConstU32<{ 7 * DAYS }>; + // 1 storage item created, key size is 32 bytes, value size is 16+16. + type VotingBondBase = ConstU128<{ darwinia_deposit(1, 64) }>; + // Additional data per vote is 32 bytes (account id). + type VotingBondFactor = ConstU128<{ darwinia_deposit(0, 32) }>; + type WeightInfo = (); +} diff --git a/runtime/pangoro/src/pallets/ethereum.rs b/runtime/pangoro/src/pallets/ethereum.rs new file mode 100644 index 000000000..8d53d1276 --- /dev/null +++ b/runtime/pangoro/src/pallets/ethereum.rs @@ -0,0 +1,25 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +impl pallet_ethereum::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type StateRoot = pallet_ethereum::IntermediateStateRoot; +} diff --git a/runtime/pangoro/src/pallets/evm.rs b/runtime/pangoro/src/pallets/evm.rs new file mode 100644 index 000000000..8c8c68452 --- /dev/null +++ b/runtime/pangoro/src/pallets/evm.rs @@ -0,0 +1,194 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; +// frontier +use pallet_evm::Precompile; + +const WEIGHT_PER_GAS: u64 = 40_000; + +frame_support::parameter_types! { + pub BlockGasLimit: sp_core::U256 = sp_core::U256::from(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT.ref_time() / WEIGHT_PER_GAS); + pub PrecompilesValue: PangoroPrecompiles = PangoroPrecompiles::<_>::new(); + pub WeightPerGas: frame_support::weights::Weight = frame_support::weights::Weight::from_ref_time(WEIGHT_PER_GAS); +} + +pub struct FindAuthorTruncated(sp_std::marker::PhantomData); +impl> frame_support::traits::FindAuthor + for FindAuthorTruncated +{ + fn find_author<'a, I>(digests: I) -> Option + where + I: 'a + IntoIterator, + { + // substrate + use sp_core::crypto::ByteArray; + + F::find_author(digests).and_then(|i| { + Aura::authorities().get(i as usize).and_then(|id| { + let raw = id.to_raw_vec(); + + if raw.len() >= 24 { + Some(sp_core::H160::from_slice(&raw[4..24])) + } else { + None + } + }) + }) + } +} + +pub struct FixedGasPrice; +impl pallet_evm::FeeCalculator for FixedGasPrice { + fn min_gas_price() -> (sp_core::U256, frame_support::weights::Weight) { + (sp_core::U256::from(GWEI), frame_support::weights::Weight::zero()) + } +} + +// TODO: Integrate to the upstream repo +pub struct FromH160; +impl pallet_evm::AddressMapping for FromH160 +where + T: From, +{ + fn into_account_id(address: sp_core::H160) -> T { + address.into() + } +} + +pub struct AssetIdConverter; +impl darwinia_precompile_assets::AccountToAssetId for AssetIdConverter { + fn account_to_asset_id(account_id: AccountId) -> AssetId { + let addr: sp_core::H160 = account_id.into(); + addr.to_low_u64_be() + } +} + +pub struct PangoroPrecompiles(sp_std::marker::PhantomData); +impl PangoroPrecompiles +where + R: pallet_evm::Config, +{ + #[allow(clippy::new_without_default)] + pub fn new() -> Self { + Self(Default::default()) + } + + pub fn used_addresses() -> [sp_core::H160; 15] { + [ + addr(1), + addr(2), + addr(3), + addr(4), + addr(5), + addr(6), + addr(7), + addr(8), + addr(9), + addr(1024), + addr(1025), + // For KTON asset. + addr(1026), + addr(1536), + addr(1537), + addr(2048), + ] + } +} +impl pallet_evm::PrecompileSet for PangoroPrecompiles +where + R: pallet_evm::Config, +{ + fn execute( + &self, + handle: &mut impl pallet_evm::PrecompileHandle, + ) -> Option { + // darwinia + use darwinia_precompile_assets::AccountToAssetId; + + let (code_addr, context_addr) = (handle.code_address(), handle.context().address); + // Filter known precompile addresses except Ethereum officials + if self.is_precompile(code_addr) && code_addr > addr(9) && code_addr != context_addr { + return Some(Err(precompile_utils::revert( + "cannot be called with DELEGATECALL or CALLCODE", + ))); + }; + + match code_addr { + // Ethereum precompiles: + a if a == addr(1) => Some(pallet_evm_precompile_simple::ECRecover::execute(handle)), + a if a == addr(2) => Some(pallet_evm_precompile_simple::Sha256::execute(handle)), + a if a == addr(3) => Some(pallet_evm_precompile_simple::Ripemd160::execute(handle)), + a if a == addr(4) => Some(pallet_evm_precompile_simple::Identity::execute(handle)), + a if a == addr(5) => Some(pallet_evm_precompile_modexp::Modexp::execute(handle)), + a if a == addr(6) => Some(pallet_evm_precompile_bn128::Bn128Add::execute(handle)), + a if a == addr(7) => Some(pallet_evm_precompile_bn128::Bn128Mul::execute(handle)), + a if a == addr(8) => Some(pallet_evm_precompile_bn128::Bn128Pairing::execute(handle)), + a if a == addr(9) => Some(pallet_evm_precompile_blake2::Blake2F::execute(handle)), + // Darwinia precompiles: [1024, 2048) for stable precompiles. + a if a == addr(1024) => Some(>::execute(handle)), + a if a == addr(1025) => + Some(>::execute(handle)), + // [1026, 1536) reserved for assets precompiles. + a if (1026..1536).contains(&AssetIdConverter::account_to_asset_id(a.into())) => + Some(>::execute( + handle, + )), + // [1536, 2048) reserved for other stable precompiles. + a if a == addr(1536) => + Some(>::execute(handle)), + a if a == addr(1537) => + Some(>::execute(handle)), + // [2048..) reserved for the experimental precompiles. + a if a == addr(2048) => + Some(>::execute(handle)), + _ => None, + } + } + + fn is_precompile(&self, address: sp_core::H160) -> bool { + Self::used_addresses().contains(&address) + } +} + +impl pallet_evm::Config for Runtime { + type AddressMapping = FromH160; + type BlockGasLimit = BlockGasLimit; + type BlockHashMapping = pallet_ethereum::EthereumBlockHashMapping; + type CallOrigin = pallet_evm::EnsureAddressRoot; + type ChainId = ConstU64<45>; + type Currency = Balances; + type FeeCalculator = FixedGasPrice; + type FindAuthor = FindAuthorTruncated; + type GasWeightMapping = pallet_evm::FixedGasWeightMapping; + type OnChargeTransaction = (); + type PrecompilesType = PangoroPrecompiles; + type PrecompilesValue = PrecompilesValue; + type Runner = pallet_evm::runner::stack::Runner; + type RuntimeEvent = RuntimeEvent; + type WeightPerGas = WeightPerGas; + type WithdrawOrigin = pallet_evm::EnsureAddressNever; +} + +fn addr(a: u64) -> sp_core::H160 { + sp_core::H160::from_low_u64_be(a) +} diff --git a/runtime/pangoro/src/pallets/identity.rs b/runtime/pangoro/src/pallets/identity.rs new file mode 100644 index 000000000..b12f0b3a9 --- /dev/null +++ b/runtime/pangoro/src/pallets/identity.rs @@ -0,0 +1,39 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +impl pallet_identity::Config for Runtime { + // Minimum 100 bytes/UNIT deposited (1 MILLIUNIT/byte). + // 258 bytes on-chain. + type BasicDeposit = ConstU128<{ darwinia_deposit(1, 258) }>; + type Currency = Balances; + // 66 bytes on-chain. + type FieldDeposit = ConstU128<{ darwinia_deposit(0, 66) }>; + type ForceOrigin = RootOrMoreThanHalf; + type MaxAdditionalFields = ConstU32<100>; + type MaxRegistrars = ConstU32<20>; + type MaxSubAccounts = ConstU32<100>; + type RegistrarOrigin = RootOrMoreThanHalf; + type RuntimeEvent = RuntimeEvent; + type Slashed = Treasury; + // 53 bytes on-chain. + type SubAccountDeposit = ConstU128<{ darwinia_deposit(1, 53) }>; + type WeightInfo = (); +} diff --git a/runtime/pangoro/src/pallets/membership.rs b/runtime/pangoro/src/pallets/membership.rs new file mode 100644 index 000000000..3064d4b5e --- /dev/null +++ b/runtime/pangoro/src/pallets/membership.rs @@ -0,0 +1,33 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +impl pallet_membership::Config for Runtime { + type AddOrigin = RootOrMoreThanHalf; + type MaxMembers = ConstU32; + type MembershipChanged = TechnicalCommittee; + type MembershipInitialized = TechnicalCommittee; + type PrimeOrigin = RootOrMoreThanHalf; + type RemoveOrigin = RootOrMoreThanHalf; + type ResetOrigin = RootOrMoreThanHalf; + type RuntimeEvent = RuntimeEvent; + type SwapOrigin = RootOrMoreThanHalf; + type WeightInfo = (); +} diff --git a/runtime/pangoro/src/pallets/message_gadget.rs b/runtime/pangoro/src/pallets/message_gadget.rs new file mode 100644 index 000000000..25cf8aeeb --- /dev/null +++ b/runtime/pangoro/src/pallets/message_gadget.rs @@ -0,0 +1,22 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +impl darwinia_message_gadget::Config for Runtime {} diff --git a/runtime/pangoro/src/pallets/message_transact.rs b/runtime/pangoro/src/pallets/message_transact.rs new file mode 100644 index 000000000..99077281e --- /dev/null +++ b/runtime/pangoro/src/pallets/message_transact.rs @@ -0,0 +1,25 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +impl darwinia_message_transact::Config for Runtime { + type LcmpEthOrigin = darwinia_message_transact::EnsureLcmpEthOrigin; + type ValidatedTransaction = pallet_ethereum::ValidatedTransaction; +} diff --git a/runtime/pangoro/src/pallets/mod.rs b/runtime/pangoro/src/pallets/mod.rs new file mode 100644 index 000000000..c07ec8c74 --- /dev/null +++ b/runtime/pangoro/src/pallets/mod.rs @@ -0,0 +1,111 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +mod shared_imports { + // darwinia + pub use darwinia_common_runtime::gov_origin::*; + // substrate + pub use sp_runtime::traits::{ConstBool, ConstU128, ConstU16, ConstU32, ConstU64, ConstU8}; +} +pub use shared_imports::*; + +// System stuffs. +mod system; +pub use system::*; + +mod parachain_system; + +mod timestamp; + +mod parachain_info_; + +// Monetary stuff. +mod balances; + +mod transaction_payment; + +mod assets; +pub use assets::*; + +mod vesting; + +mod deposit; + +mod account_migration; + +// Consensus stuff. +mod authorship; + +mod staking; + +mod session; +pub use session::*; + +mod aura; + +mod aura_ext; + +mod message_gadget; + +mod ecdsa_authority; + +// Governance stuff. +mod democracy; + +mod collective; +pub use collective::*; + +mod elections_phragmen; + +mod membership; + +mod treasury; +pub use treasury::*; + +mod tips; + +// Utility stuff. +mod sudo; + +mod utility; + +mod identity; + +mod scheduler; + +mod preimage; + +mod proxy; + +mod multisig; + +// XCM stuff. +mod xcmp_queue; + +mod polkadot_xcm; +pub use polkadot_xcm::*; + +mod dmp_queue; + +// EVM stuff. +mod ethereum; + +mod evm; +pub use evm::*; + +mod message_transact; diff --git a/runtime/pangoro/src/pallets/multisig.rs b/runtime/pangoro/src/pallets/multisig.rs new file mode 100644 index 000000000..c47262b26 --- /dev/null +++ b/runtime/pangoro/src/pallets/multisig.rs @@ -0,0 +1,32 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +impl pallet_multisig::Config for Runtime { + type Currency = Balances; + // One storage item; key size is 32; value is size 4+4+16+32 bytes = 56 bytes. + type DepositBase = ConstU128<{ darwinia_deposit(1, 88) }>; + // Additional storage item size of 32 bytes. + type DepositFactor = ConstU128<{ darwinia_deposit(0, 32) }>; + type MaxSignatories = ConstU32<100>; + type RuntimeCall = RuntimeCall; + type RuntimeEvent = RuntimeEvent; + type WeightInfo = (); +} diff --git a/runtime/pangoro/src/pallets/parachain_info_.rs b/runtime/pangoro/src/pallets/parachain_info_.rs new file mode 100644 index 000000000..aed03fc0e --- /dev/null +++ b/runtime/pangoro/src/pallets/parachain_info_.rs @@ -0,0 +1,22 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +impl parachain_info::Config for Runtime {} diff --git a/runtime/pangoro/src/pallets/parachain_system.rs b/runtime/pangoro/src/pallets/parachain_system.rs new file mode 100644 index 000000000..0f776807b --- /dev/null +++ b/runtime/pangoro/src/pallets/parachain_system.rs @@ -0,0 +1,37 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +frame_support::parameter_types! { + pub const ReservedXcmpWeight: frame_support::weights::Weight = MAXIMUM_BLOCK_WEIGHT.saturating_div(4); + pub const ReservedDmpWeight: frame_support::weights::Weight = MAXIMUM_BLOCK_WEIGHT.saturating_div(4); +} + +impl cumulus_pallet_parachain_system::Config for Runtime { + type CheckAssociatedRelayNumber = cumulus_pallet_parachain_system::RelayNumberStrictlyIncreases; + type DmpMessageHandler = DmpQueue; + type OnSystemEvent = (); + type OutboundXcmpMessageSource = XcmpQueue; + type ReservedDmpWeight = ReservedDmpWeight; + type ReservedXcmpWeight = ReservedXcmpWeight; + type RuntimeEvent = RuntimeEvent; + type SelfParaId = parachain_info::Pallet; + type XcmpMessageHandler = XcmpQueue; +} diff --git a/runtime/pangoro/src/pallets/polkadot_xcm.rs b/runtime/pangoro/src/pallets/polkadot_xcm.rs new file mode 100644 index 000000000..4aec5bbe3 --- /dev/null +++ b/runtime/pangoro/src/pallets/polkadot_xcm.rs @@ -0,0 +1,186 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; +// substrate +use frame_support::traits::Currency; + +/// Means for transacting assets on this chain. +pub type LocalAssetTransactor = xcm_builder::CurrencyAdapter< + // Use this currency: + Balances, + // Use this currency when it is a fungible asset matching the given location or name: + xcm_builder::IsConcrete, + // Do a simple punn to convert an AccountId32 MultiLocation into a native chain account ID: + LocationToAccountId, + // Our chain's account ID type (we can't get away without mentioning it explicitly): + AccountId, + // We don't track any teleports. + (), +>; + +frame_support::parameter_types! { + pub const RelayNetwork: xcm::latest::prelude::NetworkId = xcm::latest::prelude::NetworkId::Any; + pub RelayChainOrigin: RuntimeOrigin = cumulus_pallet_xcm::Origin::Relay.into(); +} +/// Type for specifying how a `MultiLocation` can be converted into an `AccountId`. This is used +/// when determining ownership of accounts for asset transacting and when attempting to use XCM +/// `Transact` in order to determine the dispatch Origin. +pub type LocationToAccountId = ( + // The parent (Relay-chain) origin converts to the parent `AccountId`. + xcm_builder::ParentIsPreset, + // Sibling parachain origins convert to AccountId via the `ParaId::into`. + xcm_builder::SiblingParachainConvertsVia, + // Straight up local `AccountId20` origins just alias directly to `AccountId`. + xcm_builder::AccountKey20Aliases, + // The rest of locations are converted via hashing it. + darwinia_common_runtime::xcm_configs::Account20Hash, +); +/// This is the type we use to convert an (incoming) XCM origin into a local `Origin` instance, +/// ready for dispatching a transaction with Xcm's `Transact`. There is an `OriginKind` which can +/// biases the kind of local `Origin` it will become. +pub type XcmOriginToTransactDispatchOrigin = ( + // Sovereign account converter; this attempts to derive an `AccountId` from the origin location + // using `LocationToAccountId` and then turn that into the usual `Signed` origin. Useful for + // foreign chains who want to have a local sovereign account on this chain which they control. + xcm_builder::SovereignSignedViaLocation, + // Native converter for Relay-chain (Parent) location; will converts to a `Relay` origin when + // recognized. + xcm_builder::RelayChainAsNative, + // Native converter for sibling Parachains; will convert to a `SiblingPara` origin when + // recognized. + xcm_builder::SiblingParachainAsNative, + // Native signed account converter; this just converts an `AccountKey20` origin into a normal + // `RuntimeOrigin::Signed` origin of the same 20-byte value. + xcm_builder::SignedAccountKey20AsNative, + // Xcm origins can be represented natively under the Xcm pallet's Xcm origin. + pallet_xcm::XcmPassthrough, +); + +pub type Barrier = darwinia_common_runtime::xcm_configs::DenyThenTry< + darwinia_common_runtime::xcm_configs::DenyReserveTransferToRelayChain, + ( + xcm_builder::TakeWeightCredit, + xcm_builder::AllowTopLevelPaidExecutionFrom, + // Parent and its exec plurality get free execution + xcm_builder::AllowUnpaidExecutionFrom< + darwinia_common_runtime::xcm_configs::ParentOrParentsExecutivePlurality, + >, + // Expected responses are OK. + xcm_builder::AllowKnownQueryResponses, + // Subscriptions for version tracking are OK. + xcm_builder::AllowSubscriptionsFrom, + ), +>; + +frame_support::parameter_types! { + pub const MaxInstructions: u32 = 100; + pub AnchoringSelfReserve: xcm::latest::prelude::MultiLocation = xcm::latest::prelude::MultiLocation::new( + 0, + xcm::latest::prelude::X1(xcm::latest::prelude::PalletInstance(::index() as u8)) + ); + // One XCM operation is 1_000_000_000 weight - almost certainly a conservative estimate. + pub Ancestry: xcm::latest::prelude::MultiLocation = xcm::latest::prelude::Parachain(ParachainInfo::parachain_id().into()).into(); + pub UnitWeightCost: u64 = 1_000_000_000; +} + +pub struct ToTreasury; +impl xcm_builder::TakeRevenue for ToTreasury { + fn take_revenue(revenue: xcm::latest::prelude::MultiAsset) { + if let xcm::latest::prelude::MultiAsset { + id: xcm::latest::prelude::Concrete(_location), + fun: xcm::latest::prelude::Fungible(amount), + } = revenue + { + let treasury_account = Treasury::account_id(); + let _ = Balances::deposit_creating(&treasury_account, amount); + + frame_support::log::trace!( + target: "xcm::weight", + "LocalAssetTrader::to_treasury amount: {amount:?}, treasury: {treasury_account:?}" + ); + } + } +} + +pub struct XcmExecutorConfig; +impl xcm_executor::Config for XcmExecutorConfig { + type AssetClaims = PolkadotXcm; + // How to withdraw and deposit an asset. + type AssetTransactor = LocalAssetTransactor; + type AssetTrap = PolkadotXcm; + type Barrier = Barrier; + type IsReserve = xcm_builder::NativeAsset; + type IsTeleporter = (); + // Teleporting is disabled. + type LocationInverter = xcm_builder::LocationInverter; + type OriginConverter = XcmOriginToTransactDispatchOrigin; + type ResponseHandler = PolkadotXcm; + type RuntimeCall = RuntimeCall; + type SubscriptionService = PolkadotXcm; + type Trader = xcm_configs::LocalAssetTrader< + frame_support::weights::ConstantMultiplier< + Balance, + darwinia_common_runtime::xcm_configs::XcmBaseWeightFee, + >, + AnchoringSelfReserve, + AccountId, + Balances, + DealWithFees, + ToTreasury, + >; + type Weigher = xcm_builder::FixedWeightBounds; + type XcmSender = XcmRouter; +} + +/// No local origins on this chain are allowed to dispatch XCM sends/executions. +pub type LocalOriginToLocation = + xcm_primitives::SignedToAccountId20; +/// The means for routing XCM messages which are not for local execution into the right message +/// queues. +pub type XcmRouter = ( + // Two routers - use UMP to communicate with the relay chain: + cumulus_primitives_utility::ParentAsUmp, + // ..and XCMP to communicate with the sibling chains. + XcmpQueue, +); + +impl pallet_xcm::Config for Runtime { + // ^ Override for AdvertisedXcmVersion default + type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion; + type ExecuteXcmOrigin = xcm_builder::EnsureXcmOrigin; + type LocationInverter = xcm_builder::LocationInverter; + type RuntimeCall = RuntimeCall; + type RuntimeEvent = RuntimeEvent; + type RuntimeOrigin = RuntimeOrigin; + type SendXcmOrigin = xcm_builder::EnsureXcmOrigin; + type Weigher = xcm_builder::FixedWeightBounds; + type XcmExecuteFilter = frame_support::traits::Everything; + type XcmExecutor = xcm_executor::XcmExecutor; + type XcmReserveTransferFilter = frame_support::traits::Everything; + type XcmRouter = XcmRouter; + type XcmTeleportFilter = frame_support::traits::Nothing; + + const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100; +} + +impl cumulus_pallet_xcm::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type XcmExecutor = xcm_executor::XcmExecutor; +} diff --git a/runtime/pangoro/src/pallets/preimage.rs b/runtime/pangoro/src/pallets/preimage.rs new file mode 100644 index 000000000..d049ef1c0 --- /dev/null +++ b/runtime/pangoro/src/pallets/preimage.rs @@ -0,0 +1,29 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +impl pallet_preimage::Config for Runtime { + type BaseDeposit = ConstU128<{ 500 * UNIT }>; + type ByteDeposit = ConstU128<{ darwinia_deposit(0, 1) }>; + type Currency = Balances; + type ManagerOrigin = frame_system::EnsureRoot; + type RuntimeEvent = RuntimeEvent; + type WeightInfo = (); +} diff --git a/runtime/pangoro/src/pallets/proxy.rs b/runtime/pangoro/src/pallets/proxy.rs new file mode 100644 index 000000000..9da74c43d --- /dev/null +++ b/runtime/pangoro/src/pallets/proxy.rs @@ -0,0 +1,120 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +/// The type used to represent the kinds of proxying allowed. +#[derive( + Copy, + Clone, + Eq, + PartialEq, + Ord, + PartialOrd, + codec::Encode, + codec::Decode, + codec::MaxEncodedLen, + scale_info::TypeInfo, + sp_runtime::RuntimeDebug, +)] +pub enum ProxyType { + Any, + NonTransfer, + Governance, + Staking, + IdentityJudgement, + CancelProxy, + EcdsaBridge, +} +impl Default for ProxyType { + fn default() -> Self { + Self::Any + } +} +impl frame_support::traits::InstanceFilter for ProxyType { + fn filter(&self, c: &RuntimeCall) -> bool { + match self { + ProxyType::Any => true, + ProxyType::NonTransfer => !matches!( + c, + RuntimeCall::Balances(..) + | RuntimeCall::Assets(..) + | RuntimeCall::Vesting(pallet_vesting::Call::vested_transfer { .. }) + | RuntimeCall::Deposit(..) + | RuntimeCall::DarwiniaStaking(..) + // Might contains transfer { + | RuntimeCall::Utility(..) + | RuntimeCall::Proxy(..) + | RuntimeCall::Multisig(..) + | RuntimeCall::PolkadotXcm(..) + | RuntimeCall::Ethereum(..) // } + ), + ProxyType::Governance => matches!( + c, + RuntimeCall::Democracy(..) + | RuntimeCall::Council(..) + | RuntimeCall::TechnicalCommittee(..) + | RuntimeCall::PhragmenElection(..) + | RuntimeCall::Treasury(..) + | RuntimeCall::Tips(..) + ), + ProxyType::Staking => { + matches!( + c, + RuntimeCall::Session(..) | RuntimeCall::Deposit(..) | RuntimeCall::DarwiniaStaking(..) + ) + }, + ProxyType::IdentityJudgement => + matches!(c, RuntimeCall::Identity(pallet_identity::Call::provide_judgement { .. })), + ProxyType::CancelProxy => { + matches!(c, RuntimeCall::Proxy(pallet_proxy::Call::reject_announcement { .. })) + }, + ProxyType::EcdsaBridge => { + matches!(c, RuntimeCall::EcdsaAuthority(..)) + }, + } + } + + fn is_superset(&self, o: &Self) -> bool { + match (self, o) { + (x, y) if x == y => true, + (ProxyType::Any, _) => true, + (_, ProxyType::Any) => false, + (ProxyType::NonTransfer, _) => true, + _ => false, + } + } +} + +impl pallet_proxy::Config for Runtime { + type AnnouncementDepositBase = ConstU128<{ darwinia_deposit(1, 8) }>; + type AnnouncementDepositFactor = ConstU128<{ darwinia_deposit(0, 66) }>; + type CallHasher = Hashing; + type Currency = Balances; + type MaxPending = ConstU32<32>; + type MaxProxies = ConstU32<32>; + // One storage item; key size 32, value size 8; . + type ProxyDepositBase = ConstU128<{ darwinia_deposit(1, 8) }>; + // Additional storage item size of 33 bytes. + type ProxyDepositFactor = ConstU128<{ darwinia_deposit(0, 33) }>; + type ProxyType = ProxyType; + type RuntimeCall = RuntimeCall; + type RuntimeEvent = RuntimeEvent; + type WeightInfo = (); +} diff --git a/runtime/pangoro/src/pallets/scheduler.rs b/runtime/pangoro/src/pallets/scheduler.rs new file mode 100644 index 000000000..2f0197405 --- /dev/null +++ b/runtime/pangoro/src/pallets/scheduler.rs @@ -0,0 +1,63 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +/// Used the compare the privilege of an origin inside the scheduler. +pub struct OriginPrivilegeCmp; +impl frame_support::traits::PrivilegeCmp for OriginPrivilegeCmp { + fn cmp_privilege(left: &OriginCaller, right: &OriginCaller) -> Option { + if left == right { + return Some(core::cmp::Ordering::Equal); + } + + match (left, right) { + // Root is greater than anything. + (OriginCaller::system(frame_system::RawOrigin::Root), _) => + Some(core::cmp::Ordering::Greater), + // Check which one has more yes votes. + ( + OriginCaller::Council(pallet_collective::RawOrigin::Members(l_yes_votes, l_count)), + OriginCaller::Council(pallet_collective::RawOrigin::Members(r_yes_votes, r_count)), + ) => Some((l_yes_votes * r_count).cmp(&(r_yes_votes * l_count))), + // For every other origin we don't care, as they are not used for `ScheduleOrigin`. + _ => None, + } + } +} + +frame_support::parameter_types! { + pub MaximumSchedulerWeight: frame_support::weights::Weight = sp_runtime::Perbill::from_percent(80) + * RuntimeBlockWeights::get().max_block; + // Retry a scheduled item every 10 blocks (1 minute) until the preimage exists. + pub const NoPreimagePostponement: Option = Some(10); +} + +impl pallet_scheduler::Config for Runtime { + type MaxScheduledPerBlock = ConstU32<50>; + type MaximumWeight = MaximumSchedulerWeight; + type OriginPrivilegeCmp = OriginPrivilegeCmp; + type PalletsOrigin = OriginCaller; + type Preimages = Preimage; + type RuntimeCall = RuntimeCall; + type RuntimeEvent = RuntimeEvent; + type RuntimeOrigin = RuntimeOrigin; + type ScheduleOrigin = Root; + type WeightInfo = (); +} diff --git a/runtime/pangoro/src/pallets/session.rs b/runtime/pangoro/src/pallets/session.rs new file mode 100644 index 000000000..383efa998 --- /dev/null +++ b/runtime/pangoro/src/pallets/session.rs @@ -0,0 +1,44 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +sp_runtime::impl_opaque_keys! { + pub struct SessionKeys { + pub aura: Aura, + } +} + +fast_runtime_or_not!(Period, ConstU32<{ 5 * MINUTES }>, ConstU32<{ 6 * HOURS }>); + +type Offset = ConstU32<0>; + +impl pallet_session::Config for Runtime { + type Keys = SessionKeys; + type NextSessionRotation = pallet_session::PeriodicSessions; + type RuntimeEvent = RuntimeEvent; + // Essentially just AURA, but lets be pedantic. + type SessionHandler = ::KeyTypeIdProviders; + type SessionManager = DarwiniaStaking; + type ShouldEndSession = pallet_session::PeriodicSessions; + type ValidatorId = ::AccountId; + // We don't have stash and controller, thus we don't need the convert as well. + type ValidatorIdOf = darwinia_staking::IdentityCollator; + type WeightInfo = weights::pallet_session::WeightInfo; +} diff --git a/runtime/pangoro/src/pallets/staking.rs b/runtime/pangoro/src/pallets/staking.rs new file mode 100644 index 000000000..50e17ac96 --- /dev/null +++ b/runtime/pangoro/src/pallets/staking.rs @@ -0,0 +1,87 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +fast_runtime_or_not!(MinStakingDuration, ConstU32<{ 5 * MINUTES }>, ConstU32<{ 14 * DAYS }>); + +pub enum RingStaking {} +impl darwinia_staking::Stake for RingStaking { + type AccountId = AccountId; + type Item = Balance; + + fn stake(who: &Self::AccountId, item: Self::Item) -> sp_runtime::DispatchResult { + >::transfer( + who, + &darwinia_staking::account_id(), + item, + frame_support::traits::ExistenceRequirement::KeepAlive, + ) + } + + fn unstake(who: &Self::AccountId, item: Self::Item) -> sp_runtime::DispatchResult { + >::transfer( + &darwinia_staking::account_id(), + who, + item, + frame_support::traits::ExistenceRequirement::AllowDeath, + ) + } +} +pub enum KtonStaking {} +impl darwinia_staking::Stake for KtonStaking { + type AccountId = AccountId; + type Item = Balance; + + fn stake(who: &Self::AccountId, item: Self::Item) -> sp_runtime::DispatchResult { + Assets::transfer( + RuntimeOrigin::signed(*who), + (AssetIds::OKton as AssetId).into(), + darwinia_staking::account_id(), + item, + ) + } + + fn unstake(who: &Self::AccountId, item: Self::Item) -> sp_runtime::DispatchResult { + Assets::transfer( + RuntimeOrigin::signed(darwinia_staking::account_id()), + (AssetIds::OKton as AssetId).into(), + *who, + item, + ) + } +} + +frame_support::parameter_types! { + pub const PayoutFraction: sp_runtime::Perbill = sp_runtime::Perbill::from_percent(20); +} + +impl darwinia_staking::Config for Runtime { + type Deposit = Deposit; + type Kton = KtonStaking; + type MaxDeposits = ConstU32<16>; + type MaxUnstakings = ConstU32<16>; + type MinStakingDuration = MinStakingDuration; + type PayoutFraction = PayoutFraction; + type RewardRemainder = Treasury; + type Ring = RingStaking; + type RingCurrency = Balances; + type RuntimeEvent = RuntimeEvent; + type UnixTime = Timestamp; +} diff --git a/runtime/pangoro/src/pallets/sudo.rs b/runtime/pangoro/src/pallets/sudo.rs new file mode 100644 index 000000000..fbefaf4c7 --- /dev/null +++ b/runtime/pangoro/src/pallets/sudo.rs @@ -0,0 +1,25 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +impl pallet_sudo::Config for Runtime { + type RuntimeCall = RuntimeCall; + type RuntimeEvent = RuntimeEvent; +} diff --git a/runtime/pangoro/src/pallets/system.rs b/runtime/pangoro/src/pallets/system.rs new file mode 100644 index 000000000..96faace69 --- /dev/null +++ b/runtime/pangoro/src/pallets/system.rs @@ -0,0 +1,109 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +/// We assume that ~5% of the block weight is consumed by `on_initialize` handlers. This is +/// used to limit the maximal weight of a single extrinsic. +const AVERAGE_ON_INITIALIZE_RATIO: sp_runtime::Perbill = sp_runtime::Perbill::from_percent(5); + +/// We allow `Normal` extrinsics to fill up the block up to 75%, the rest can be used by +/// `Operational` extrinsics. +pub const NORMAL_DISPATCH_RATIO: sp_runtime::Perbill = sp_runtime::Perbill::from_percent(75); + +/// We allow for 0.5 of a second of compute with a 12 second average block time. +pub const MAXIMUM_BLOCK_WEIGHT: frame_support::weights::Weight = + frame_support::weights::Weight::from_parts( + frame_support::weights::constants::WEIGHT_REF_TIME_PER_SECOND.saturating_div(2), + cumulus_primitives_core::relay_chain::v2::MAX_POV_SIZE as u64, + ); + +frame_support::parameter_types! { + pub const Version: sp_version::RuntimeVersion = VERSION; + pub RuntimeBlockLength: frame_system::limits::BlockLength = + frame_system::limits::BlockLength::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO); + pub RuntimeBlockWeights: frame_system::limits::BlockWeights = frame_system::limits::BlockWeights::builder() + .base_block(weights::BlockExecutionWeight::get()) + .for_class(frame_support::dispatch::DispatchClass::all(), |weights| { + weights.base_extrinsic = weights::ExtrinsicBaseWeight::get(); + }) + .for_class(frame_support::dispatch::DispatchClass::Normal, |weights| { + weights.max_total = Some(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT); + }) + .for_class(frame_support::dispatch::DispatchClass::Operational, |weights| { + weights.max_total = Some(MAXIMUM_BLOCK_WEIGHT); + // Operational transactions have some extra reserved space, so that they + // are included even if block reached `MAXIMUM_BLOCK_WEIGHT`. + weights.reserved = Some( + MAXIMUM_BLOCK_WEIGHT - NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT + ); + }) + .avg_block_initialization(AVERAGE_ON_INITIALIZE_RATIO) + .build_or_panic(); +} + +impl frame_system::Config for Runtime { + /// The data to be stored in an account. + type AccountData = pallet_balances::AccountData; + /// The identifier used to distinguish between accounts. + type AccountId = AccountId; + /// The basic call filter to use in dispatchable. + type BaseCallFilter = frame_support::traits::Everything; + /// Maximum number of block number to block hash mappings to keep (oldest pruned first). + type BlockHashCount = ConstU32<2400>; + /// The maximum length of a block (in bytes). + type BlockLength = RuntimeBlockLength; + /// The index type for blocks. + type BlockNumber = BlockNumber; + /// Block & extrinsics weights: base values and limits. + type BlockWeights = RuntimeBlockWeights; + /// The weight of database operations that the runtime can invoke. + type DbWeight = weights::RocksDbWeight; + /// The type for hashing blocks and tries. + type Hash = Hash; + /// The hashing algorithm used. + type Hashing = Hashing; + /// The header type. + type Header = sp_runtime::generic::Header; + /// The index type for storing how many extrinsics an account has signed. + type Index = Index; + /// The lookup mechanism to get account ID from whatever is passed in dispatchers. + type Lookup = sp_runtime::traits::IdentityLookup; + type MaxConsumers = ConstU32<16>; + /// What to do if an account is fully reaped from the system. + type OnKilledAccount = (); + /// What to do if a new account is created. + type OnNewAccount = (); + /// The action to take on a Runtime Upgrade + type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode; + /// Converts a module to an index of this module in the runtime. + type PalletInfo = PalletInfo; + /// The aggregated dispatch type that is available for extrinsics. + type RuntimeCall = RuntimeCall; + /// The ubiquitous event type. + type RuntimeEvent = RuntimeEvent; + /// The ubiquitous origin type. + type RuntimeOrigin = RuntimeOrigin; + /// This is used as an identifier of the chain. 42 is the generic substrate prefix. + type SS58Prefix = ConstU16<18>; + /// Weight information for the extrinsics of this pallet. + type SystemWeightInfo = weights::frame_system::WeightInfo; + /// Runtime version. + type Version = Version; +} diff --git a/runtime/pangoro/src/pallets/timestamp.rs b/runtime/pangoro/src/pallets/timestamp.rs new file mode 100644 index 000000000..b18b2a162 --- /dev/null +++ b/runtime/pangoro/src/pallets/timestamp.rs @@ -0,0 +1,28 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +impl pallet_timestamp::Config for Runtime { + type MinimumPeriod = ConstU64<{ SLOT_DURATION / 2 }>; + /// A timestamp: milliseconds since the unix epoch. + type Moment = u64; + type OnTimestampSet = Aura; + type WeightInfo = weights::pallet_timestamp::WeightInfo; +} diff --git a/runtime/pangoro/src/pallets/tips.rs b/runtime/pangoro/src/pallets/tips.rs new file mode 100644 index 000000000..6500a1b3a --- /dev/null +++ b/runtime/pangoro/src/pallets/tips.rs @@ -0,0 +1,35 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +frame_support::parameter_types! { + pub const TipFindersFee: sp_runtime::Percent = sp_runtime::Percent::from_percent(20); +} + +impl pallet_tips::Config for Runtime { + type DataDepositPerByte = ConstU128<{ darwinia_deposit(0, 1) }>; + type MaximumReasonLength = ConstU32<16384>; + type RuntimeEvent = RuntimeEvent; + type TipCountdown = ConstU32; + type TipFindersFee = TipFindersFee; + type TipReportDepositBase = ConstU128<{ 100 * UNIT }>; + type Tippers = PhragmenElection; + type WeightInfo = (); +} diff --git a/runtime/pangoro/src/pallets/transaction_payment.rs b/runtime/pangoro/src/pallets/transaction_payment.rs new file mode 100644 index 000000000..63620c02c --- /dev/null +++ b/runtime/pangoro/src/pallets/transaction_payment.rs @@ -0,0 +1,32 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +impl pallet_transaction_payment::Config for Runtime { + type FeeMultiplierUpdate = polkadot_runtime_common::SlowAdjustingFeeUpdate; + // Relay Chain `TransactionByteFee` / 10 + type LengthToFee = + frame_support::weights::ConstantMultiplier>; + type OnChargeTransaction = + pallet_transaction_payment::CurrencyAdapter>; + type OperationalFeeMultiplier = sp_runtime::traits::ConstU8<5>; + type RuntimeEvent = RuntimeEvent; + type WeightToFee = WeightToFee; +} diff --git a/runtime/pangoro/src/pallets/treasury.rs b/runtime/pangoro/src/pallets/treasury.rs new file mode 100644 index 000000000..3febca02f --- /dev/null +++ b/runtime/pangoro/src/pallets/treasury.rs @@ -0,0 +1,47 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +frame_support::parameter_types! { + pub const TreasuryPalletId: frame_support::PalletId = frame_support::PalletId(*b"da/trsry"); + pub const ProposalBond: sp_runtime::Permill = sp_runtime::Permill::from_percent(5); + pub const Burn: sp_runtime::Permill = sp_runtime::Permill::from_percent(1); +} + +// In order to use `Tips`, which bounded by `pallet_treasury::Config` rather +// `pallet_treasury::Config` Still use `DefaultInstance` here instead `Instance1` +impl pallet_treasury::Config for Runtime { + type ApproveOrigin = RootOrAtLeastThreeFifth; + type Burn = Burn; + type BurnDestination = (); + type Currency = Balances; + type MaxApprovals = ConstU32<100>; + type OnSlash = Treasury; + type PalletId = TreasuryPalletId; + type ProposalBond = ProposalBond; + type ProposalBondMaximum = (); + type ProposalBondMinimum = ConstU128; + type RejectOrigin = RootOrMoreThanHalf; + type RuntimeEvent = RuntimeEvent; + type SpendFunds = (); + type SpendOrigin = frame_support::traits::NeverEnsureOrigin; + type SpendPeriod = ConstU32<{ 24 * DAYS }>; + type WeightInfo = (); +} diff --git a/runtime/pangoro/src/pallets/utility.rs b/runtime/pangoro/src/pallets/utility.rs new file mode 100644 index 000000000..2c0f49ddf --- /dev/null +++ b/runtime/pangoro/src/pallets/utility.rs @@ -0,0 +1,27 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +impl pallet_utility::Config for Runtime { + type PalletsOrigin = OriginCaller; + type RuntimeCall = RuntimeCall; + type RuntimeEvent = RuntimeEvent; + type WeightInfo = (); +} diff --git a/runtime/pangoro/src/pallets/vesting.rs b/runtime/pangoro/src/pallets/vesting.rs new file mode 100644 index 000000000..1c0b0b6e6 --- /dev/null +++ b/runtime/pangoro/src/pallets/vesting.rs @@ -0,0 +1,40 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +frame_support::parameter_types! { + pub UnvestedFundsAllowedWithdrawReasons: frame_support::traits::WithdrawReasons = + frame_support::traits::WithdrawReasons::except( + frame_support::traits::WithdrawReasons::TRANSFER | frame_support::traits::WithdrawReasons::RESERVE + ); +} + +impl pallet_vesting::Config for Runtime { + type BlockNumberToBalance = sp_runtime::traits::ConvertInto; + type Currency = Balances; + type MinVestedTransfer = ConstU128; + type RuntimeEvent = RuntimeEvent; + type UnvestedFundsAllowedWithdrawReasons = UnvestedFundsAllowedWithdrawReasons; + type WeightInfo = (); + + // `VestingInfo` encode length is 36bytes. 28 schedules gets encoded as 1009 bytes, which is the + // highest number of schedules that encodes less than 2^10. + const MAX_VESTING_SCHEDULES: u32 = 28; +} diff --git a/runtime/pangoro/src/pallets/xcmp_queue.rs b/runtime/pangoro/src/pallets/xcmp_queue.rs new file mode 100644 index 000000000..f3f8d642d --- /dev/null +++ b/runtime/pangoro/src/pallets/xcmp_queue.rs @@ -0,0 +1,31 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; + +impl cumulus_pallet_xcmp_queue::Config for Runtime { + type ChannelInfo = ParachainSystem; + type ControllerOrigin = frame_system::EnsureRoot; + type ControllerOriginConverter = XcmOriginToTransactDispatchOrigin; + type ExecuteOverweightOrigin = frame_system::EnsureRoot; + type RuntimeEvent = RuntimeEvent; + type VersionWrapper = (); + type WeightInfo = weights::cumulus_pallet_xcmp_queue::WeightInfo; + type XcmExecutor = xcm_executor::XcmExecutor; +} diff --git a/runtime/pangoro/src/weights/block_weights.rs b/runtime/pangoro/src/weights/block_weights.rs new file mode 100644 index 000000000..8da49f757 --- /dev/null +++ b/runtime/pangoro/src/weights/block_weights.rs @@ -0,0 +1,48 @@ +// This file is part of Substrate. + +// Copyright (C) 2022 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. + +pub mod constants { + frame_support::parameter_types! { + /// Importing a block with 0 Extrinsics. + pub const BlockExecutionWeight: frame_support::weights::Weight = + frame_support::weights::Weight::from_ref_time(frame_support::weights::constants::WEIGHT_REF_TIME_PER_NANOS.saturating_mul(5_000_000)); + } + + #[cfg(test)] + mod test_weights { + /// Checks that the weight exists and is sane. + // NOTE: If this test fails but you are sure that the generated values are fine, + // you can delete it. + #[test] + fn sane() { + let w = frame_support::weights::constants::BlockExecutionWeight::get(); + + // At least 100 µs. + assert!( + w.ref_time() + >= 100u64 * frame_support::weights::constants::WEIGHT_REF_TIME_PER_MICROS, + "Weight should be at least 100 µs." + ); + // At most 50 ms. + assert!( + w.ref_time() + <= 50u64 * frame_support::weights::constants::WEIGHT_REF_TIME_PER_MILLIS, + "Weight should be at most 50 ms." + ); + } + } +} diff --git a/runtime/pangoro/src/weights/cumulus_pallet_xcmp_queue.rs b/runtime/pangoro/src/weights/cumulus_pallet_xcmp_queue.rs new file mode 100644 index 000000000..3271b31e4 --- /dev/null +++ b/runtime/pangoro/src/weights/cumulus_pallet_xcmp_queue.rs @@ -0,0 +1,67 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `cumulus_pallet_xcmp_queue` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2022-11-09, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `inv.cafe`, CPU: `AMD Ryzen 9 5950X 16-Core Processor` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("local"), DB CACHE: 1024 + +// Executed Command: +// target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --chain +// local +// --output +// runtime/src/weights +// --extrinsic +// * +// --pallet +// cumulus-pallet-xcmp-queue + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `cumulus_pallet_xcmp_queue`. +pub struct WeightInfo(PhantomData); +impl cumulus_pallet_xcmp_queue::WeightInfo for WeightInfo { + // Storage: XcmpQueue QueueConfig (r:1 w:1) + fn set_config_with_u32() -> Weight { + Weight::from_ref_time(13_340_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: XcmpQueue QueueConfig (r:1 w:1) + fn set_config_with_weight() -> Weight { + Weight::from_ref_time(12_610_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } +} diff --git a/runtime/pangoro/src/weights/extrinsic_weights.rs b/runtime/pangoro/src/weights/extrinsic_weights.rs new file mode 100644 index 000000000..0c17b0de9 --- /dev/null +++ b/runtime/pangoro/src/weights/extrinsic_weights.rs @@ -0,0 +1,47 @@ +// This file is part of Substrate. + +// Copyright (C) 2022 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. + +pub mod constants { + frame_support::parameter_types! { + /// Executing a NO-OP `System::remarks` Extrinsic. + pub const ExtrinsicBaseWeight: frame_support::weights::Weight = + frame_support::weights::Weight::from_ref_time(frame_support::weights::constants::WEIGHT_REF_TIME_PER_NANOS.saturating_mul(125_000)); + } + + #[cfg(test)] + mod test_weights { + /// Checks that the weight exists and is sane. + // NOTE: If this test fails but you are sure that the generated values are fine, + // you can delete it. + #[test] + fn sane() { + let w = frame_support::weights::constants::ExtrinsicBaseWeight::get(); + + // At least 10 µs. + assert!( + w.ref_time() + >= 10u64 * frame_support::weights::constants::WEIGHT_REF_TIME_PER_MICROS, + "Weight should be at least 10 µs." + ); + // At most 1 ms. + assert!( + w.ref_time() <= frame_support::weights::constants::WEIGHT_REF_TIME_PER_MILLIS, + "Weight should be at most 1 ms." + ); + } + } +} diff --git a/runtime/pangoro/src/weights/frame_system.rs b/runtime/pangoro/src/weights/frame_system.rs new file mode 100644 index 000000000..2361f7517 --- /dev/null +++ b/runtime/pangoro/src/weights/frame_system.rs @@ -0,0 +1,88 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `frame_system` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2022-11-09, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `inv.cafe`, CPU: `AMD Ryzen 9 5950X 16-Core Processor` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("local"), DB CACHE: 1024 + +// Executed Command: +// target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --chain +// local +// --output +// runtime/src/weights +// --extrinsic +// * +// --pallet +// frame-system + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `frame_system`. +pub struct WeightInfo(PhantomData); +impl frame_system::WeightInfo for WeightInfo { + /// The range of component `b` is `[0, 3932160]`. + fn remark(_b: u32, ) -> Weight { + Weight::from_ref_time(1_074_555_000 as u64) + } + /// The range of component `b` is `[0, 3932160]`. + fn remark_with_event(_b: u32, ) -> Weight { + Weight::from_ref_time(4_724_488_000 as u64) + } + // Storage: System Digest (r:1 w:1) + // Storage: unknown [0x3a686561707061676573] (r:0 w:1) + fn set_heap_pages() -> Weight { + Weight::from_ref_time(14_110_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) + } + // Storage: Skipped Metadata (r:0 w:0) + /// The range of component `i` is `[1, 1000]`. + fn set_storage(_i: u32, ) -> Weight { + Weight::from_ref_time(655_299_000 as u64) + .saturating_add(T::DbWeight::get().writes(1000 as u64)) + } + // Storage: Skipped Metadata (r:0 w:0) + /// The range of component `i` is `[1, 1000]`. + fn kill_storage(_i: u32, ) -> Weight { + Weight::from_ref_time(555_697_000 as u64) + .saturating_add(T::DbWeight::get().writes(1000 as u64)) + } + // Storage: Skipped Metadata (r:0 w:0) + /// The range of component `p` is `[1, 1000]`. + fn kill_prefix(_p: u32, ) -> Weight { + Weight::from_ref_time(1_089_395_000 as u64) + .saturating_add(T::DbWeight::get().writes(1000 as u64)) + } +} diff --git a/runtime/pangoro/src/weights/mod.rs b/runtime/pangoro/src/weights/mod.rs new file mode 100644 index 000000000..caf9386da --- /dev/null +++ b/runtime/pangoro/src/weights/mod.rs @@ -0,0 +1,39 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Expose the auto generated weight files. + +#![allow(clippy::unnecessary_cast)] + +pub mod block_weights; +pub use block_weights::constants::BlockExecutionWeight; + +pub mod extrinsic_weights; +pub use extrinsic_weights::constants::ExtrinsicBaseWeight; + +pub mod paritydb_weights; +pub use paritydb_weights::constants::ParityDbWeight; + +pub mod rocksdb_weights; +pub use rocksdb_weights::constants::RocksDbWeight; + +pub mod cumulus_pallet_xcmp_queue; +pub mod frame_system; +pub mod pallet_balances; +pub mod pallet_session; +pub mod pallet_timestamp; diff --git a/runtime/pangoro/src/weights/pallet_balances.rs b/runtime/pangoro/src/weights/pallet_balances.rs new file mode 100644 index 000000000..f7acd35fb --- /dev/null +++ b/runtime/pangoro/src/weights/pallet_balances.rs @@ -0,0 +1,97 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `pallet_balances` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2022-11-09, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `inv.cafe`, CPU: `AMD Ryzen 9 5950X 16-Core Processor` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("local"), DB CACHE: 1024 + +// Executed Command: +// target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --chain +// local +// --output +// runtime/src/weights +// --extrinsic +// * +// --pallet +// pallet-balances + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_balances`. +pub struct WeightInfo(PhantomData); +impl pallet_balances::WeightInfo for WeightInfo { + // Storage: System Account (r:1 w:1) + fn transfer() -> Weight { + Weight::from_ref_time(57_141_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: System Account (r:1 w:1) + fn transfer_keep_alive() -> Weight { + Weight::from_ref_time(43_271_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: System Account (r:1 w:1) + fn set_balance_creating() -> Weight { + Weight::from_ref_time(29_941_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: System Account (r:1 w:1) + fn set_balance_killing() -> Weight { + Weight::from_ref_time(34_490_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: System Account (r:2 w:2) + fn force_transfer() -> Weight { + Weight::from_ref_time(54_911_000 as u64) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) + } + // Storage: System Account (r:1 w:1) + fn transfer_all() -> Weight { + Weight::from_ref_time(49_671_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: System Account (r:1 w:1) + fn force_unreserve() -> Weight { + Weight::from_ref_time(26_120_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } +} diff --git a/runtime/pangoro/src/weights/pallet_session.rs b/runtime/pangoro/src/weights/pallet_session.rs new file mode 100644 index 000000000..25b1d6d3e --- /dev/null +++ b/runtime/pangoro/src/weights/pallet_session.rs @@ -0,0 +1,69 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `pallet_session` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2022-11-09, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `inv.cafe`, CPU: `AMD Ryzen 9 5950X 16-Core Processor` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("local"), DB CACHE: 1024 + +// Executed Command: +// target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --chain +// local +// --output +// runtime/src/weights +// --extrinsic +// * +// --pallet +// pallet-session + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_session`. +pub struct WeightInfo(PhantomData); +impl pallet_session::WeightInfo for WeightInfo { + // Storage: Session NextKeys (r:1 w:1) + // Storage: Session KeyOwner (r:1 w:1) + fn set_keys() -> Weight { + Weight::from_ref_time(30_781_000 as u64) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) + } + // Storage: Session NextKeys (r:1 w:1) + // Storage: Session KeyOwner (r:0 w:1) + fn purge_keys() -> Weight { + Weight::from_ref_time(22_911_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) + } +} diff --git a/runtime/pangoro/src/weights/pallet_timestamp.rs b/runtime/pangoro/src/weights/pallet_timestamp.rs new file mode 100644 index 000000000..7f420bd5a --- /dev/null +++ b/runtime/pangoro/src/weights/pallet_timestamp.rs @@ -0,0 +1,64 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `pallet_timestamp` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2022-11-09, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `inv.cafe`, CPU: `AMD Ryzen 9 5950X 16-Core Processor` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("local"), DB CACHE: 1024 + +// Executed Command: +// target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --chain +// local +// --output +// runtime/src/weights +// --extrinsic +// * +// --pallet +// pallet-timestamp + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_timestamp`. +pub struct WeightInfo(PhantomData); +impl pallet_timestamp::WeightInfo for WeightInfo { + // Storage: Timestamp Now (r:1 w:1) + fn set() -> Weight { + Weight::from_ref_time(13_230_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + fn on_finalize() -> Weight { + Weight::from_ref_time(5_710_000 as u64) + } +} diff --git a/runtime/pangoro/src/weights/paritydb_weights.rs b/runtime/pangoro/src/weights/paritydb_weights.rs new file mode 100644 index 000000000..4338d928d --- /dev/null +++ b/runtime/pangoro/src/weights/paritydb_weights.rs @@ -0,0 +1,63 @@ +// This file is part of Substrate. + +// Copyright (C) 2022 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. + +pub mod constants { + use frame_support::{ + parameter_types, + weights::{constants, RuntimeDbWeight}, + }; + + parameter_types! { + /// `ParityDB` can be enabled with a feature flag, but is still experimental. These weights + /// are available for brave runtime engineers who may want to try this out as default. + pub const ParityDbWeight: RuntimeDbWeight = RuntimeDbWeight { + read: 8_000 * constants::WEIGHT_REF_TIME_PER_NANOS, + write: 50_000 * constants::WEIGHT_REF_TIME_PER_NANOS, + }; + } + + #[cfg(test)] + mod test_db_weights { + use super::constants::ParityDbWeight as W; + use frame_support::weights::constants; + + /// Checks that all weights exist and have sane values. + // NOTE: If this test fails but you are sure that the generated values are fine, + // you can delete it. + #[test] + fn sane() { + // At least 1 µs. + assert!( + W::get().reads(1).ref_time() >= constants::WEIGHT_REF_TIME_PER_MICROS, + "Read weight should be at least 1 µs." + ); + assert!( + W::get().writes(1).ref_time() >= constants::WEIGHT_REF_TIME_PER_MICROS, + "Write weight should be at least 1 µs." + ); + // At most 1 ms. + assert!( + W::get().reads(1).ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS, + "Read weight should be at most 1 ms." + ); + assert!( + W::get().writes(1).ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS, + "Write weight should be at most 1 ms." + ); + } + } +} diff --git a/runtime/pangoro/src/weights/rocksdb_weights.rs b/runtime/pangoro/src/weights/rocksdb_weights.rs new file mode 100644 index 000000000..1d115d963 --- /dev/null +++ b/runtime/pangoro/src/weights/rocksdb_weights.rs @@ -0,0 +1,63 @@ +// This file is part of Substrate. + +// Copyright (C) 2022 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. + +pub mod constants { + use frame_support::{ + parameter_types, + weights::{constants, RuntimeDbWeight}, + }; + + parameter_types! { + /// By default, Substrate uses `RocksDB`, so this will be the weight used throughout + /// the runtime. + pub const RocksDbWeight: RuntimeDbWeight = RuntimeDbWeight { + read: 25_000 * constants::WEIGHT_REF_TIME_PER_NANOS, + write: 100_000 * constants::WEIGHT_REF_TIME_PER_NANOS, + }; + } + + #[cfg(test)] + mod test_db_weights { + use super::constants::RocksDbWeight as W; + use frame_support::weights::constants; + + /// Checks that all weights exist and have sane values. + // NOTE: If this test fails but you are sure that the generated values are fine, + // you can delete it. + #[test] + fn sane() { + // At least 1 µs. + assert!( + W::get().reads(1).ref_time() >= constants::WEIGHT_REF_TIME_PER_MICROS, + "Read weight should be at least 1 µs." + ); + assert!( + W::get().writes(1).ref_time() >= constants::WEIGHT_REF_TIME_PER_MICROS, + "Write weight should be at least 1 µs." + ); + // At most 1 ms. + assert!( + W::get().reads(1).ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS, + "Read weight should be at most 1 ms." + ); + assert!( + W::get().writes(1).ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS, + "Write weight should be at most 1 ms." + ); + } + } +} diff --git a/runtime/pangoro/tests/mock.rs b/runtime/pangoro/tests/mock.rs new file mode 100644 index 000000000..cc2e8df91 --- /dev/null +++ b/runtime/pangoro/tests/mock.rs @@ -0,0 +1,65 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2022 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +pub use pangoro_runtime::*; + +// substrate +use frame_support::traits::GenesisBuild; +use sp_io::TestExternalities; + +pub const KTON_ID: u64 = AssetIds::OKton as _; + +#[derive(Clone, Default)] +pub struct ExtBuilder { + balances: Vec<(AccountId, Balance)>, + assets_accounts: Vec<(u64, AccountId, Balance)>, +} +impl ExtBuilder { + pub fn with_balances(&mut self, balances: Vec<(AccountId, Balance)>) -> &mut Self { + self.balances = balances; + + self + } + + pub fn with_assets_accounts(&mut self, accounts: Vec<(u64, AccountId, Balance)>) -> &mut Self { + self.assets_accounts = accounts; + + self + } + + pub fn build(&mut self) -> TestExternalities { + let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); + + pallet_balances::GenesisConfig:: { balances: self.balances.clone() } + .assimilate_storage(&mut t) + .unwrap(); + pallet_assets::GenesisConfig:: { + assets: vec![(KTON_ID, ROOT, true, 1)], + metadata: vec![(KTON_ID, b"Pangoro Commitment Token".to_vec(), b"OKTON".to_vec(), 18)], + accounts: self.assets_accounts.clone(), + } + .assimilate_storage(&mut t) + .unwrap(); + + let mut ext = TestExternalities::new(t); + + ext.execute_with(|| System::set_block_number(1)); + + ext + } +} diff --git a/runtime/pangoro/tests/tests.rs b/runtime/pangoro/tests/tests.rs new file mode 100644 index 000000000..43b5d3724 --- /dev/null +++ b/runtime/pangoro/tests/tests.rs @@ -0,0 +1,3 @@ +pub mod mock; + +darwinia_common_runtime::impl_account_migration_tests! {} From e6c048c1f52ea47248f99bc6f4956571ad1cea84 Mon Sep 17 00:00:00 2001 From: Guantong Date: Wed, 15 Feb 2023 16:04:04 +0800 Subject: [PATCH 144/189] To `polkadot-v0.9.37` (#266) * Anchor polkadot-v0.9.37 * Companion for paritytech/substrate#12307 * Companion for paritytech/cumulus#2057 * Use prepare branch for test * Companion for paritytech/frontier#981 * Remove collator selection in bench * Fix BenchmarkHelper * Fix compile * Format * Fix compile * Fix compile feature benchmark * Fix test * Format toml * Format * Pangoro2 0.9.37 * Fix try-runtime * Fix try-runtime cmd * Format * Fix review * Use `Vec` * Typo --------- Co-authored-by: Xavier Lau --- Cargo.lock | 2214 ++++++++++++++++-------- Cargo.toml | 596 +++---- node/Cargo.toml | 2 +- node/src/command.rs | 4 + pallet/account-migration/tests/mock.rs | 1 + pallet/deposit/tests/mock.rs | 1 + pallet/message-gadget/src/lib.rs | 4 +- pallet/message-gadget/tests/tests.rs | 1 + pallet/message-transact/src/mock.rs | 1 + pallet/staking/tests/mock.rs | 1 + precompile/assets/src/mock.rs | 2 + precompile/bls12-381/src/lib.rs | 2 +- precompile/deposit/src/mock.rs | 1 + precompile/staking/src/lib.rs | 2 +- precompile/staking/src/mock.rs | 1 + precompile/state-storage/src/mock.rs | 1 + runtime/common/Cargo.toml | 6 + runtime/common/src/lib.rs | 10 + runtime/crab/Cargo.toml | 3 + runtime/crab/src/lib.rs | 5 +- runtime/crab/src/pallets/assets.rs | 3 +- runtime/crab/src/pallets/evm.rs | 1 + runtime/crab/src/pallets/proxy.rs | 4 +- runtime/darwinia/Cargo.toml | 3 + runtime/darwinia/src/lib.rs | 5 +- runtime/darwinia/src/pallets/assets.rs | 3 +- runtime/darwinia/src/pallets/evm.rs | 1 + runtime/darwinia/src/pallets/proxy.rs | 4 +- runtime/pangolin/Cargo.toml | 3 + runtime/pangolin/src/lib.rs | 5 +- runtime/pangolin/src/migration.rs | 5 +- runtime/pangolin/src/pallets/assets.rs | 3 +- runtime/pangolin/src/pallets/evm.rs | 1 + runtime/pangolin/src/pallets/proxy.rs | 4 +- runtime/pangoro/Cargo.toml | 3 + runtime/pangoro/src/lib.rs | 5 +- runtime/pangoro/src/migration.rs | 4 +- runtime/pangoro/src/pallets/assets.rs | 3 +- runtime/pangoro/src/pallets/evm.rs | 1 + runtime/pangoro/src/pallets/proxy.rs | 4 +- 40 files changed, 1865 insertions(+), 1058 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8063c4a11..361af4c6b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -15,7 +15,7 @@ dependencies = [ [[package]] name = "account" version = "0.1.1" -source = "git+https://github.com/darwinia-network/moonbeam?branch=polkadot-v0.9.36#f5c98d5612bdb7b6311005f41fc873400d5e1481" +source = "git+https://github.com/darwinia-network/moonbeam?branch=polkadot-v0.9.37#3e272b5e0fad227e09880cd5a7c1c709a69f0a92" dependencies = [ "blake2-rfc", "hex", @@ -57,6 +57,15 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +[[package]] +name = "aead" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fc95d1bdb8e6666b2b217308eeeb09f2d6728d104be3e31916cc74d15420331" +dependencies = [ + "generic-array 0.14.6", +] + [[package]] name = "aead" version = "0.4.3" @@ -64,6 +73,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b613b8e1e3cf911a086f53f03bf286f52fd7a7258e4fa606f0ef220d39d8877" dependencies = [ "generic-array 0.14.6", + "rand_core 0.6.4", +] + +[[package]] +name = "aes" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "884391ef1066acaa41e766ba8f596341b96e93ce34f9a43e7d24bf0a0eaf0561" +dependencies = [ + "aes-soft", + "aesni", + "cipher 0.2.5", ] [[package]] @@ -73,25 +94,59 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e8b47f52ea9bae42228d07ec09eb676433d7c4ed1ebdf0f1d1c29ed446f1ab8" dependencies = [ "cfg-if", - "cipher", + "cipher 0.3.0", "cpufeatures", "opaque-debug 0.3.0", ] +[[package]] +name = "aes-gcm" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5278b5fabbb9bd46e24aa69b2fdea62c99088e0a950a9be40e3e0101298f88da" +dependencies = [ + "aead 0.3.2", + "aes 0.6.0", + "cipher 0.2.5", + "ctr 0.6.0", + "ghash 0.3.1", + "subtle", +] + [[package]] name = "aes-gcm" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "df5f85a83a7d8b0442b6aa7b504b8212c1733da07b98aae43d4bc21b2cb3cdf6" dependencies = [ - "aead", - "aes", - "cipher", - "ctr", - "ghash", + "aead 0.4.3", + "aes 0.7.5", + "cipher 0.3.0", + "ctr 0.8.0", + "ghash 0.4.4", "subtle", ] +[[package]] +name = "aes-soft" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be14c7498ea50828a38d0e24a765ed2effe92a705885b57d029cd67d45744072" +dependencies = [ + "cipher 0.2.5", + "opaque-debug 0.3.0", +] + +[[package]] +name = "aesni" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea2e11f5e94c2f7d386164cc2aa1f97823fed6f259e486940a71c174dd01b0ce" +dependencies = [ + "cipher 0.2.5", + "opaque-debug 0.3.0", +] + [[package]] name = "affix" version = "0.1.2" @@ -165,6 +220,12 @@ dependencies = [ "num-traits", ] +[[package]] +name = "arc-swap" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bddcadddf5e9015d310179a59bb28c4d4b9920ad0f11e8e14dbadf654890c9a6" + [[package]] name = "array-bytes" version = "4.2.0" @@ -205,66 +266,83 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" [[package]] -name = "asn1_der" -version = "0.7.5" +name = "asn1-rs" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e22d1f4b888c298a027c99dc9048015fac177587de20fc30232a057dfbe24a21" +checksum = "30ff05a702273012438132f449575dbc804e27b2f3cbe3069aa237d26c98fa33" +dependencies = [ + "asn1-rs-derive 0.1.0", + "asn1-rs-impl", + "displaydoc", + "nom", + "num-traits", + "rusticata-macros", + "thiserror", + "time 0.3.17", +] [[package]] -name = "assert_matches" -version = "1.5.0" +name = "asn1-rs" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b34d609dfbaf33d6889b2b7106d3ca345eacad44200913df5ba02bfd31d2ba9" +checksum = "cf6690c370453db30743b373a60ba498fc0d6d83b11f4abfd87a84a075db5dd4" +dependencies = [ + "asn1-rs-derive 0.4.0", + "asn1-rs-impl", + "displaydoc", + "nom", + "num-traits", + "rusticata-macros", + "thiserror", + "time 0.3.17", +] [[package]] -name = "async-attributes" -version = "1.1.2" +name = "asn1-rs-derive" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3203e79f4dd9bdda415ed03cf14dae5a2bf775c683a00f94e9cd1faf0f596e5" +checksum = "db8b7511298d5b7784b40b092d9e9dcd3a627a5707e4b5e507931ab0d44eeebf" dependencies = [ + "proc-macro2", "quote", "syn", + "synstructure", ] [[package]] -name = "async-channel" -version = "1.8.0" +name = "asn1-rs-derive" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf46fee83e5ccffc220104713af3292ff9bc7c64c7de289f66dae8e38d826833" +checksum = "726535892e8eae7e70657b4c8ea93d26b8553afb1ce617caee529ef96d7dee6c" dependencies = [ - "concurrent-queue", - "event-listener", - "futures-core", + "proc-macro2", + "quote", + "syn", + "synstructure", ] [[package]] -name = "async-executor" -version = "1.5.0" +name = "asn1-rs-impl" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17adb73da160dfb475c183343c8cccd80721ea5a605d3eb57125f0a7b7a92d0b" +checksum = "2777730b2039ac0f95f093556e61b6d26cebed5393ca6f152717777cec3a42ed" dependencies = [ - "async-lock", - "async-task", - "concurrent-queue", - "fastrand", - "futures-lite", - "slab", + "proc-macro2", + "quote", + "syn", ] [[package]] -name = "async-global-executor" -version = "2.3.1" +name = "asn1_der" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1b6f5d7df27bd294849f8eec66ecfc63d11814df7a4f5d74168a2394467b776" -dependencies = [ - "async-channel", - "async-executor", - "async-io", - "async-lock", - "blocking", - "futures-lite", - "once_cell", -] +checksum = "e22d1f4b888c298a027c99dc9048015fac177587de20fc30232a057dfbe24a21" + +[[package]] +name = "assert_matches" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b34d609dfbaf33d6889b2b7106d3ca345eacad44200913df5ba02bfd31d2ba9" [[package]] name = "async-io" @@ -296,57 +374,6 @@ dependencies = [ "futures-lite", ] -[[package]] -name = "async-process" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6381ead98388605d0d9ff86371043b5aa922a3905824244de40dc263a14fcba4" -dependencies = [ - "async-io", - "async-lock", - "autocfg", - "blocking", - "cfg-if", - "event-listener", - "futures-lite", - "libc", - "signal-hook", - "windows-sys 0.42.0", -] - -[[package]] -name = "async-std" -version = "1.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62565bb4402e926b29953c785397c6dc0391b7b446e45008b0049eb43cec6f5d" -dependencies = [ - "async-attributes", - "async-channel", - "async-global-executor", - "async-io", - "async-lock", - "crossbeam-utils", - "futures-channel", - "futures-core", - "futures-io", - "futures-lite", - "gloo-timers", - "kv-log-macro", - "log", - "memchr", - "once_cell", - "pin-project-lite 0.2.9", - "pin-utils", - "slab", - "wasm-bindgen-futures", -] - -[[package]] -name = "async-task" -version = "4.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a40729d2133846d9ed0ea60a8b9541bccddab49cd30f0715a1da672fe9a2524" - [[package]] name = "async-trait" version = "0.1.64" @@ -469,20 +496,17 @@ dependencies = [ [[package]] name = "beefy-gadget" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "array-bytes 4.2.0", "async-trait", "fnv", "futures", - "futures-timer", "log", "parity-scale-codec", "parking_lot 0.12.1", - "sc-chain-spec", "sc-client-api", "sc-consensus", - "sc-finality-grandpa", "sc-keystore", "sc-network", "sc-network-common", @@ -506,7 +530,7 @@ dependencies = [ [[package]] name = "beefy-gadget-rpc" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "beefy-gadget", "futures", @@ -515,7 +539,6 @@ dependencies = [ "parity-scale-codec", "parking_lot 0.12.1", "sc-rpc", - "sc-utils", "serde", "sp-beefy", "sp-core", @@ -526,7 +549,7 @@ dependencies = [ [[package]] name = "beefy-merkle-tree" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "sp-api", "sp-beefy", @@ -665,6 +688,16 @@ dependencies = [ "generic-array 0.14.6", ] +[[package]] +name = "block-modes" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57a0e8073e8baa88212fb5823574c02ebccb395136ba9a164ab89379ec6072f0" +dependencies = [ + "block-padding 0.2.1", + "cipher 0.2.5", +] + [[package]] name = "block-padding" version = "0.1.5" @@ -680,20 +713,6 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae" -[[package]] -name = "blocking" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c67b173a56acffd6d2326fb7ab938ba0b00a71480e14902b2591c87bc5741e8" -dependencies = [ - "async-channel", - "async-lock", - "async-task", - "atomic-waker", - "fastrand", - "futures-lite", -] - [[package]] name = "bounded-vec" version = "0.6.0" @@ -706,7 +725,7 @@ dependencies = [ [[package]] name = "bp-darwinia-core" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.36#3cb281ddcd5a85b15da08bc2380f130d69ea2279" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.37#1092b5c91cb64c508dc581bfa2e58f0801970d32" dependencies = [ "account", "bp-messages", @@ -723,7 +742,7 @@ dependencies = [ [[package]] name = "bp-header-chain" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.36#3cb281ddcd5a85b15da08bc2380f130d69ea2279" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.37#1092b5c91cb64c508dc581bfa2e58f0801970d32" dependencies = [ "bp-runtime", "finality-grandpa", @@ -740,7 +759,7 @@ dependencies = [ [[package]] name = "bp-message-dispatch" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.36#3cb281ddcd5a85b15da08bc2380f130d69ea2279" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.37#1092b5c91cb64c508dc581bfa2e58f0801970d32" dependencies = [ "bp-runtime", "frame-support", @@ -753,7 +772,7 @@ dependencies = [ [[package]] name = "bp-messages" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.36#3cb281ddcd5a85b15da08bc2380f130d69ea2279" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.37#1092b5c91cb64c508dc581bfa2e58f0801970d32" dependencies = [ "bitvec", "bp-runtime", @@ -770,7 +789,7 @@ dependencies = [ [[package]] name = "bp-parachains" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.36#3cb281ddcd5a85b15da08bc2380f130d69ea2279" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.37#1092b5c91cb64c508dc581bfa2e58f0801970d32" dependencies = [ "bp-polkadot-core", "bp-runtime", @@ -783,7 +802,7 @@ dependencies = [ [[package]] name = "bp-polkadot-core" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.36#3cb281ddcd5a85b15da08bc2380f130d69ea2279" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.37#1092b5c91cb64c508dc581bfa2e58f0801970d32" dependencies = [ "bp-messages", "bp-runtime", @@ -802,7 +821,7 @@ dependencies = [ [[package]] name = "bp-runtime" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.36#3cb281ddcd5a85b15da08bc2380f130d69ea2279" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.37#1092b5c91cb64c508dc581bfa2e58f0801970d32" dependencies = [ "frame-support", "frame-system", @@ -823,7 +842,7 @@ dependencies = [ [[package]] name = "bp-test-utils" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.36#3cb281ddcd5a85b15da08bc2380f130d69ea2279" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.37#1092b5c91cb64c508dc581bfa2e58f0801970d32" dependencies = [ "bp-header-chain", "ed25519-dalek", @@ -838,7 +857,7 @@ dependencies = [ [[package]] name = "bridge-runtime-common" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.36#3cb281ddcd5a85b15da08bc2380f130d69ea2279" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.37#1092b5c91cb64c508dc581bfa2e58f0801970d32" dependencies = [ "bp-header-chain", "bp-message-dispatch", @@ -866,7 +885,6 @@ dependencies = [ "sp-state-machine", "sp-std", "sp-trie", - "sp-version", ] [[package]] @@ -992,6 +1010,17 @@ dependencies = [ "jobserver", ] +[[package]] +name = "ccm" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5aca1a8fbc20b50ac9673ff014abfb2b5f4085ee1a850d408f14a159c5853ac7" +dependencies = [ + "aead 0.3.2", + "cipher 0.2.5", + "subtle", +] + [[package]] name = "cexpr" version = "0.6.0" @@ -1029,7 +1058,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c80e5460aa66fe3b91d40bcbdab953a597b60053e34d684ac6903f863b680a6" dependencies = [ "cfg-if", - "cipher", + "cipher 0.3.0", "cpufeatures", "zeroize", ] @@ -1040,9 +1069,9 @@ version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a18446b09be63d457bbec447509e85f662f32952b035ce892290396bc0b0cff5" dependencies = [ - "aead", + "aead 0.4.3", "chacha20", - "cipher", + "cipher 0.3.0", "poly1305", "zeroize", ] @@ -1057,7 +1086,7 @@ dependencies = [ "js-sys", "num-integer", "num-traits", - "time", + "time 0.1.45", "wasm-bindgen", "winapi", ] @@ -1075,6 +1104,15 @@ dependencies = [ "unsigned-varint", ] +[[package]] +name = "cipher" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12f8e7987cbd042a63249497f41aed09f8e65add917ea6566effbc56578d6801" +dependencies = [ + "generic-array 0.14.6", +] + [[package]] name = "cipher" version = "0.3.0" @@ -1278,6 +1316,12 @@ dependencies = [ "libc", ] +[[package]] +name = "cpuid-bool" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcb25d077389e53838a8158c8e99174c5a9d902dee4904320db714f3c653ffba" + [[package]] name = "crab-runtime" version = "6.0.0" @@ -1479,6 +1523,21 @@ dependencies = [ "wasmtime-types", ] +[[package]] +name = "crc" +version = "3.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86ec7a15cbe22e59248fc7eadb1907dab5ba09372595da4d73dd805ed4417dfe" +dependencies = [ + "crc-catalog", +] + +[[package]] +name = "crc-catalog" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9cace84e55f07e7301bae1c519df89cdad8cc3cd868413d3fdbdeca9ff3db484" + [[package]] name = "crc32fast" version = "1.3.2" @@ -1579,6 +1638,16 @@ dependencies = [ "subtle", ] +[[package]] +name = "crypto-mac" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bff07008ec701e8028e2ceb8f83f0e4274ee62bd2dbdc4fefff2e9a91824081a" +dependencies = [ + "generic-array 0.14.6", + "subtle", +] + [[package]] name = "crypto-mac" version = "0.11.1" @@ -1590,13 +1659,12 @@ dependencies = [ ] [[package]] -name = "ctor" -version = "0.1.26" +name = "ctr" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d2301688392eb071b0bf1a37be05c469d3cc4dbbd95df672fe28ab021e6a096" +checksum = "fb4a30d54f7443bf3d6191dcd486aca19e67cb3c49fa7a06a319966346707e7f" dependencies = [ - "quote", - "syn", + "cipher 0.2.5", ] [[package]] @@ -1605,13 +1673,13 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "049bb91fb4aaf0e3c7efa6cd5ef877dbbbd15b39dad06d9948de4ec8a75761ea" dependencies = [ - "cipher", + "cipher 0.3.0", ] [[package]] name = "cumulus-client-cli" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.36#afe528af891f464b318293f183f6d3eefbc979b0" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.37#09418fc04c2608b123f36ca80f16df3d2096753b" dependencies = [ "clap", "parity-scale-codec", @@ -1626,7 +1694,7 @@ dependencies = [ [[package]] name = "cumulus-client-collator" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.36#afe528af891f464b318293f183f6d3eefbc979b0" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.37#09418fc04c2608b123f36ca80f16df3d2096753b" dependencies = [ "cumulus-client-consensus-common", "cumulus-client-network", @@ -1649,7 +1717,7 @@ dependencies = [ [[package]] name = "cumulus-client-consensus-aura" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.36#afe528af891f464b318293f183f6d3eefbc979b0" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.37#09418fc04c2608b123f36ca80f16df3d2096753b" dependencies = [ "async-trait", "cumulus-client-consensus-common", @@ -1678,7 +1746,7 @@ dependencies = [ [[package]] name = "cumulus-client-consensus-common" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.36#afe528af891f464b318293f183f6d3eefbc979b0" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.37#09418fc04c2608b123f36ca80f16df3d2096753b" dependencies = [ "async-trait", "cumulus-client-pov-recovery", @@ -1701,7 +1769,7 @@ dependencies = [ [[package]] name = "cumulus-client-network" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.36#afe528af891f464b318293f183f6d3eefbc979b0" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.37#09418fc04c2608b123f36ca80f16df3d2096753b" dependencies = [ "async-trait", "cumulus-relay-chain-interface", @@ -1724,7 +1792,7 @@ dependencies = [ [[package]] name = "cumulus-client-pov-recovery" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.36#afe528af891f464b318293f183f6d3eefbc979b0" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.37#09418fc04c2608b123f36ca80f16df3d2096753b" dependencies = [ "cumulus-primitives-core", "cumulus-relay-chain-interface", @@ -1747,7 +1815,7 @@ dependencies = [ [[package]] name = "cumulus-client-service" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.36#afe528af891f464b318293f183f6d3eefbc979b0" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.37#09418fc04c2608b123f36ca80f16df3d2096753b" dependencies = [ "cumulus-client-cli", "cumulus-client-collator", @@ -1775,7 +1843,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-aura-ext" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.36#afe528af891f464b318293f183f6d3eefbc979b0" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.37#09418fc04c2608b123f36ca80f16df3d2096753b" dependencies = [ "frame-support", "frame-system", @@ -1791,7 +1859,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-dmp-queue" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.36#afe528af891f464b318293f183f6d3eefbc979b0" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.37#09418fc04c2608b123f36ca80f16df3d2096753b" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -1808,7 +1876,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-parachain-system" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.36#afe528af891f464b318293f183f6d3eefbc979b0" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.37#09418fc04c2608b123f36ca80f16df3d2096753b" dependencies = [ "bytes", "cumulus-pallet-parachain-system-proc-macro", @@ -1836,7 +1904,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-parachain-system-proc-macro" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.36#afe528af891f464b318293f183f6d3eefbc979b0" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.37#09418fc04c2608b123f36ca80f16df3d2096753b" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -1847,7 +1915,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-session-benchmarking" version = "3.0.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.36#afe528af891f464b318293f183f6d3eefbc979b0" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.37#09418fc04c2608b123f36ca80f16df3d2096753b" dependencies = [ "frame-benchmarking", "frame-support", @@ -1861,7 +1929,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-xcm" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.36#afe528af891f464b318293f183f6d3eefbc979b0" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.37#09418fc04c2608b123f36ca80f16df3d2096753b" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -1877,7 +1945,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-xcmp-queue" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.36#afe528af891f464b318293f183f6d3eefbc979b0" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.37#09418fc04c2608b123f36ca80f16df3d2096753b" dependencies = [ "cumulus-primitives-core", "frame-benchmarking", @@ -1896,7 +1964,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-core" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.36#afe528af891f464b318293f183f6d3eefbc979b0" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.37#09418fc04c2608b123f36ca80f16df3d2096753b" dependencies = [ "parity-scale-codec", "polkadot-core-primitives", @@ -1911,7 +1979,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-parachain-inherent" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.36#afe528af891f464b318293f183f6d3eefbc979b0" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.37#09418fc04c2608b123f36ca80f16df3d2096753b" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -1934,7 +2002,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-timestamp" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.36#afe528af891f464b318293f183f6d3eefbc979b0" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.37#09418fc04c2608b123f36ca80f16df3d2096753b" dependencies = [ "cumulus-primitives-core", "futures", @@ -1947,7 +2015,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-utility" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.36#afe528af891f464b318293f183f6d3eefbc979b0" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.37#09418fc04c2608b123f36ca80f16df3d2096753b" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -1963,7 +2031,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-inprocess-interface" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.36#afe528af891f464b318293f183f6d3eefbc979b0" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.37#09418fc04c2608b123f36ca80f16df3d2096753b" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -1988,7 +2056,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-interface" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.36#afe528af891f464b318293f183f6d3eefbc979b0" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.37#09418fc04c2608b123f36ca80f16df3d2096753b" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -2008,7 +2076,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-minimal-node" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.36#afe528af891f464b318293f183f6d3eefbc979b0" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.37#09418fc04c2608b123f36ca80f16df3d2096753b" dependencies = [ "array-bytes 6.0.0", "async-trait", @@ -2048,7 +2116,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-rpc-interface" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.36#afe528af891f464b318293f183f6d3eefbc979b0" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.37#09418fc04c2608b123f36ca80f16df3d2096753b" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -2077,7 +2145,7 @@ dependencies = [ [[package]] name = "cumulus-test-relay-sproof-builder" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.36#afe528af891f464b318293f183f6d3eefbc979b0" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.37#09418fc04c2608b123f36ca80f16df3d2096753b" dependencies = [ "cumulus-primitives-core", "parity-scale-codec", @@ -2171,6 +2239,41 @@ dependencies = [ "syn", ] +[[package]] +name = "darling" +version = "0.14.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0808e1bd8671fb44a113a14e13497557533369847788fa2ae912b6ebfce9fa8" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.14.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "001d80444f28e193f30c2f293455da62dcf9a6b29918a4253152ae2b1de592cb" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn", +] + +[[package]] +name = "darling_macro" +version = "0.14.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b36230598a2d5de7ec1c6f51f72d8a99a9208daff41de2084d06e3fd3ea56685" +dependencies = [ + "darling_core", + "quote", + "syn", +] + [[package]] name = "darwinia" version = "6.0.0" @@ -2286,6 +2389,7 @@ dependencies = [ "dc-primitives", "frame-support", "frame-system", + "pallet-assets", "pallet-balances", "pallet-collective", "pallet-treasury", @@ -2669,9 +2773,38 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f1a467a65c5e759bce6e65eaf91cc29f466cdc57cb65777bd646872a8a1fd4de" dependencies = [ "const-oid", + "pem-rfc7468", "zeroize", ] +[[package]] +name = "der-parser" +version = "7.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe398ac75057914d7d07307bf67dc7f3f574a26783b4fc7805a20ffa9f506e82" +dependencies = [ + "asn1-rs 0.3.1", + "displaydoc", + "nom", + "num-bigint", + "num-traits", + "rusticata-macros", +] + +[[package]] +name = "der-parser" +version = "8.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42d4bc9b0db0a0df9ae64634ac5bdefb7afcb534e182275ca0beadbe486701c1" +dependencies = [ + "asn1-rs 0.5.1", + "displaydoc", + "nom", + "num-bigint", + "num-traits", + "rusticata-macros", +] + [[package]] name = "derivative" version = "2.2.0" @@ -2695,24 +2828,55 @@ dependencies = [ ] [[package]] -name = "derive_more" -version = "0.99.17" +name = "derive_builder" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" +checksum = "d07adf7be193b71cc36b193d0f5fe60b918a3a9db4dad0449f57bcfd519704a3" dependencies = [ - "convert_case 0.4.0", + "derive_builder_macro", +] + +[[package]] +name = "derive_builder_core" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f91d4cfa921f1c05904dc3c57b4a32c38aed3340cce209f3a6fd1478babafc4" +dependencies = [ + "darling", "proc-macro2", "quote", - "rustc_version", "syn", ] [[package]] -name = "difflib" -version = "0.4.0" +name = "derive_builder_macro" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6184e33543162437515c2e2b48714794e37845ec9851711914eec9d308f6ebe8" - +checksum = "8f0314b72bed045f3a68671b3c86328386762c93f82d98c65c3cb5e5f573dd68" +dependencies = [ + "derive_builder_core", + "syn", +] + +[[package]] +name = "derive_more" +version = "0.99.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" +dependencies = [ + "convert_case 0.4.0", + "proc-macro2", + "quote", + "rustc_version", + "syn", +] + +[[package]] +name = "difflib" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6184e33543162437515c2e2b48714794e37845ec9851711914eec9d308f6ebe8" + [[package]] name = "digest" version = "0.8.1" @@ -2784,13 +2948,14 @@ dependencies = [ ] [[package]] -name = "dns-parser" -version = "0.8.0" +name = "displaydoc" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4d33be9473d06f75f58220f71f7a9317aca647dc061dbd3c361b0bef505fbea" +checksum = "3bf95dc3f046b9da4f2d51833c0d3547d8564ef6910f5c1ed130306a75b92886" dependencies = [ - "byteorder", - "quick-error", + "proc-macro2", + "quote", + "syn", ] [[package]] @@ -2906,6 +3071,9 @@ dependencies = [ "ff", "generic-array 0.14.6", "group", + "hkdf", + "pem-rfc7468", + "pkcs8", "rand_core 0.6.4", "sec1", "subtle", @@ -3259,7 +3427,7 @@ dependencies = [ [[package]] name = "fc-cli" version = "1.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.36#63309df8e9a4b19ab4ceb2fd1a37f7968c111de9" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.37#6783dcd10ffcdb06a52793e0ffb793161881a5f2" dependencies = [ "clap", "ethereum-types 0.14.1", @@ -3267,7 +3435,6 @@ dependencies = [ "fp-rpc", "fp-storage", "sc-cli", - "sc-service", "serde", "serde_json", "sp-api", @@ -3278,7 +3445,7 @@ dependencies = [ [[package]] name = "fc-consensus" version = "2.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.36#63309df8e9a4b19ab4ceb2fd1a37f7968c111de9" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.37#6783dcd10ffcdb06a52793e0ffb793161881a5f2" dependencies = [ "async-trait", "fc-db", @@ -3297,7 +3464,7 @@ dependencies = [ [[package]] name = "fc-db" version = "2.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.36#63309df8e9a4b19ab4ceb2fd1a37f7968c111de9" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.37#6783dcd10ffcdb06a52793e0ffb793161881a5f2" dependencies = [ "fp-storage", "kvdb-rocksdb", @@ -3316,7 +3483,7 @@ dependencies = [ [[package]] name = "fc-mapping-sync" version = "2.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.36#63309df8e9a4b19ab4ceb2fd1a37f7968c111de9" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.37#6783dcd10ffcdb06a52793e0ffb793161881a5f2" dependencies = [ "fc-db", "fp-consensus", @@ -3333,7 +3500,7 @@ dependencies = [ [[package]] name = "fc-rpc" version = "2.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.36#63309df8e9a4b19ab4ceb2fd1a37f7968c111de9" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.37#6783dcd10ffcdb06a52793e0ffb793161881a5f2" dependencies = [ "ethereum", "ethereum-types 0.14.1", @@ -3341,7 +3508,6 @@ dependencies = [ "fc-db", "fc-rpc-core", "fp-ethereum", - "fp-evm", "fp-rpc", "fp-storage", "futures", @@ -3376,12 +3542,11 @@ dependencies = [ [[package]] name = "fc-rpc-core" version = "1.1.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.36#63309df8e9a4b19ab4ceb2fd1a37f7968c111de9" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.37#6783dcd10ffcdb06a52793e0ffb793161881a5f2" dependencies = [ "ethereum", "ethereum-types 0.14.1", "jsonrpsee", - "rlp", "rustc-hex", "serde", "serde_json", @@ -3509,7 +3674,7 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "fork-tree" version = "3.0.0" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "parity-scale-codec", ] @@ -3526,7 +3691,7 @@ dependencies = [ [[package]] name = "fp-consensus" version = "2.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.36#63309df8e9a4b19ab4ceb2fd1a37f7968c111de9" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.37#6783dcd10ffcdb06a52793e0ffb793161881a5f2" dependencies = [ "ethereum", "parity-scale-codec", @@ -3538,7 +3703,7 @@ dependencies = [ [[package]] name = "fp-ethereum" version = "1.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.36#63309df8e9a4b19ab4ceb2fd1a37f7968c111de9" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.37#6783dcd10ffcdb06a52793e0ffb793161881a5f2" dependencies = [ "ethereum", "ethereum-types 0.14.1", @@ -3546,14 +3711,13 @@ dependencies = [ "frame-support", "num_enum", "parity-scale-codec", - "sp-core", "sp-std", ] [[package]] name = "fp-evm" version = "3.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.36#63309df8e9a4b19ab4ceb2fd1a37f7968c111de9" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.37#6783dcd10ffcdb06a52793e0ffb793161881a5f2" dependencies = [ "evm", "frame-support", @@ -3566,7 +3730,7 @@ dependencies = [ [[package]] name = "fp-rpc" version = "3.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.36#63309df8e9a4b19ab4ceb2fd1a37f7968c111de9" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.37#6783dcd10ffcdb06a52793e0ffb793161881a5f2" dependencies = [ "ethereum", "ethereum-types 0.14.1", @@ -3575,7 +3739,6 @@ dependencies = [ "scale-info", "sp-api", "sp-core", - "sp-io", "sp-runtime", "sp-std", ] @@ -3583,9 +3746,8 @@ dependencies = [ [[package]] name = "fp-self-contained" version = "1.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.36#63309df8e9a4b19ab4ceb2fd1a37f7968c111de9" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.37#6783dcd10ffcdb06a52793e0ffb793161881a5f2" dependencies = [ - "ethereum", "frame-support", "parity-scale-codec", "scale-info", @@ -3596,7 +3758,7 @@ dependencies = [ [[package]] name = "fp-storage" version = "2.0.0" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.36#63309df8e9a4b19ab4ceb2fd1a37f7968c111de9" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.37#6783dcd10ffcdb06a52793e0ffb793161881a5f2" dependencies = [ "parity-scale-codec", "serde", @@ -3611,7 +3773,7 @@ checksum = "6c2141d6d6c8512188a7891b4b01590a45f6dac67afb4f255c4124dbb86d4eaa" [[package]] name = "frame-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "frame-support", "frame-system", @@ -3634,7 +3796,7 @@ dependencies = [ [[package]] name = "frame-benchmarking-cli" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "Inflector", "array-bytes 4.2.0", @@ -3646,16 +3808,13 @@ dependencies = [ "frame-system", "gethostname", "handlebars", - "hash-db", "itertools", - "kvdb", "lazy_static", "linked-hash-map", "log", - "memory-db", "parity-scale-codec", "rand 0.8.5", - "rand_pcg 0.3.1", + "rand_pcg", "sc-block-builder", "sc-cli", "sc-client-api", @@ -3665,7 +3824,6 @@ dependencies = [ "sc-sysinfo", "serde", "serde_json", - "serde_nanos", "sp-api", "sp-blockchain", "sp-core", @@ -3678,7 +3836,6 @@ dependencies = [ "sp-std", "sp-storage", "sp-trie", - "tempfile", "thiserror", "thousands", ] @@ -3686,7 +3843,7 @@ dependencies = [ [[package]] name = "frame-election-provider-solution-type" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -3697,7 +3854,7 @@ dependencies = [ [[package]] name = "frame-election-provider-support" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "frame-election-provider-solution-type", "frame-support", @@ -3714,7 +3871,7 @@ dependencies = [ [[package]] name = "frame-executive" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "frame-support", "frame-system", @@ -3743,18 +3900,15 @@ dependencies = [ [[package]] name = "frame-remote-externalities" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ - "env_logger 0.9.3", "futures", "log", "parity-scale-codec", "serde", - "serde_json", "sp-core", "sp-io", "sp-runtime", - "sp-version", "substrate-rpc-client", "tokio", ] @@ -3762,7 +3916,7 @@ dependencies = [ [[package]] name = "frame-support" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "bitflags", "frame-metadata", @@ -3795,7 +3949,7 @@ dependencies = [ [[package]] name = "frame-support-procedural" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "Inflector", "cfg-expr", @@ -3810,7 +3964,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "frame-support-procedural-tools-derive", "proc-macro-crate", @@ -3822,7 +3976,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools-derive" version = "3.0.0" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "proc-macro2", "quote", @@ -3832,7 +3986,7 @@ dependencies = [ [[package]] name = "frame-system" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "frame-support", "log", @@ -3850,7 +4004,7 @@ dependencies = [ [[package]] name = "frame-system-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "frame-benchmarking", "frame-support", @@ -3865,7 +4019,7 @@ dependencies = [ [[package]] name = "frame-system-rpc-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "parity-scale-codec", "sp-api", @@ -3874,7 +4028,7 @@ dependencies = [ [[package]] name = "frame-try-runtime" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "frame-support", "parity-scale-codec", @@ -3993,8 +4147,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2411eed028cdf8c8034eaf21f9915f956b6c3abec4d4c7949ee67f0721127bd" dependencies = [ "futures-io", - "rustls", - "webpki", + "rustls 0.20.8", + "webpki 0.22.0", ] [[package]] @@ -4078,10 +4232,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" dependencies = [ "cfg-if", - "js-sys", "libc", "wasi 0.9.0+wasi-snapshot-preview1", - "wasm-bindgen", ] [[package]] @@ -4095,6 +4247,16 @@ dependencies = [ "wasi 0.11.0+wasi-snapshot-preview1", ] +[[package]] +name = "ghash" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97304e4cd182c3846f7575ced3890c53012ce534ad9114046b0a9e00bb30a375" +dependencies = [ + "opaque-debug 0.3.0", + "polyval 0.4.5", +] + [[package]] name = "ghash" version = "0.4.4" @@ -4102,7 +4264,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1583cc1656d7839fd3732b80cf4f38850336cdb9b8ded1cd399ca62958de3c99" dependencies = [ "opaque-debug 0.3.0", - "polyval", + "polyval 0.5.3", ] [[package]] @@ -4141,18 +4303,6 @@ dependencies = [ "regex", ] -[[package]] -name = "gloo-timers" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b995a66bb87bebce9a0f4a95aed01daca4872c050bfcb21653361c03bc35e5c" -dependencies = [ - "futures-channel", - "futures-core", - "js-sys", - "wasm-bindgen", -] - [[package]] name = "group" version = "0.12.1" @@ -4257,6 +4407,15 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" +[[package]] +name = "hkdf" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "791a029f6b9fc27657f6f188ec6e5e43f6911f6f878e0dc5501396e09809d437" +dependencies = [ + "hmac 0.12.1", +] + [[package]] name = "hmac" version = "0.8.1" @@ -4267,6 +4426,16 @@ dependencies = [ "digest 0.9.0", ] +[[package]] +name = "hmac" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1441c6b1e930e2817404b5046f1f989899143a12bf92de603b69f4e0aee1e15" +dependencies = [ + "crypto-mac 0.10.1", + "digest 0.9.0", +] + [[package]] name = "hmac" version = "0.11.0" @@ -4396,7 +4565,7 @@ dependencies = [ "http", "hyper", "log", - "rustls", + "rustls 0.20.8", "rustls-native-certs", "tokio", "tokio-rustls", @@ -4426,6 +4595,12 @@ dependencies = [ "cxx-build", ] +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + [[package]] name = "idna" version = "0.2.3" @@ -4459,9 +4634,9 @@ dependencies = [ [[package]] name = "if-watch" -version = "2.0.0" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "065c008e570a43c00de6aed9714035e5ea6a498c255323db9091722af6ee67dd" +checksum = "ba7abdbb86e485125dad06c2691e1e393bf3b08c7b743b43aa162a00fd39062e" dependencies = [ "async-io", "core-foundation", @@ -4472,6 +4647,7 @@ dependencies = [ "log", "rtnetlink", "system-configuration", + "tokio", "windows", ] @@ -4557,6 +4733,25 @@ dependencies = [ "num-traits", ] +[[package]] +name = "interceptor" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e8a11ae2da61704edada656798b61c94b35ecac2c58eb955156987d5e6be90b" +dependencies = [ + "async-trait", + "bytes", + "log", + "rand 0.8.5", + "rtcp", + "rtp", + "thiserror", + "tokio", + "waitgroup", + "webrtc-srtp", + "webrtc-util", +] + [[package]] name = "io-lifetimes" version = "0.7.5" @@ -4789,8 +4984,8 @@ dependencies = [ [[package]] name = "kusama-runtime" -version = "0.9.36" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" +version = "0.9.37" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" dependencies = [ "bitvec", "frame-benchmarking", @@ -4886,8 +5081,8 @@ dependencies = [ [[package]] name = "kusama-runtime-constants" -version = "0.9.36" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" +version = "0.9.37" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" dependencies = [ "frame-support", "polkadot-primitives", @@ -4898,15 +5093,6 @@ dependencies = [ "sp-weights", ] -[[package]] -name = "kv-log-macro" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0de8b303297635ad57c9f5059fd9cee7a47f8e8daa09df0fcd07dd39fb22977f" -dependencies = [ - "log", -] - [[package]] name = "kvdb" version = "0.13.0" @@ -4985,16 +5171,15 @@ checksum = "348108ab3fba42ec82ff6e9564fc4ca0247bdccdc68dd8af9764bbc79c3c8ffb" [[package]] name = "libp2p" -version = "0.49.0" +version = "0.50.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec878fda12ebec479186b3914ebc48ff180fa4c51847e11a1a68bf65249e02c1" +checksum = "2e0a0d2f693675f49ded13c5d510c48b78069e23cbd9108d7ccd59f6dc568819" dependencies = [ "bytes", "futures", "futures-timer", "getrandom 0.2.8", "instant", - "lazy_static", "libp2p-core", "libp2p-dns", "libp2p-identify", @@ -5004,11 +5189,12 @@ dependencies = [ "libp2p-mplex", "libp2p-noise", "libp2p-ping", + "libp2p-quic", "libp2p-request-response", "libp2p-swarm", - "libp2p-swarm-derive", "libp2p-tcp", "libp2p-wasm-ext", + "libp2p-webrtc", "libp2p-websocket", "libp2p-yamux", "multiaddr", @@ -5019,9 +5205,9 @@ dependencies = [ [[package]] name = "libp2p-core" -version = "0.37.0" +version = "0.38.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "799676bb0807c788065e57551c6527d461ad572162b0519d1958946ff9e0539d" +checksum = "b6a8fcd392ff67af6cc3f03b1426c41f7f26b6b9aff2dc632c1c56dd649e571f" dependencies = [ "asn1_der", "bs58", @@ -5031,17 +5217,18 @@ dependencies = [ "futures", "futures-timer", "instant", - "lazy_static", "log", "multiaddr", "multihash", "multistream-select", + "once_cell", "parking_lot 0.12.1", "pin-project", "prost", "prost-build", "rand 0.8.5", "rw-stream-sink", + "sec1", "sha2 0.10.6", "smallvec", "thiserror", @@ -5052,9 +5239,9 @@ dependencies = [ [[package]] name = "libp2p-dns" -version = "0.37.0" +version = "0.38.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2322c9fb40d99101def6a01612ee30500c89abbbecb6297b3cd252903a4c1720" +checksum = "8e42a271c1b49f789b92f7fc87749fa79ce5c7bdc88cbdfacb818a4bca47fec5" dependencies = [ "futures", "libp2p-core", @@ -5066,9 +5253,9 @@ dependencies = [ [[package]] name = "libp2p-identify" -version = "0.40.0" +version = "0.41.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcf9a121f699e8719bda2e6e9e9b6ddafc6cff4602471d6481c1067930ccb29b" +checksum = "c052d0026f4817b44869bfb6810f4e1112f43aec8553f2cb38881c524b563abf" dependencies = [ "asynchronous-codec", "futures", @@ -5087,9 +5274,9 @@ dependencies = [ [[package]] name = "libp2p-kad" -version = "0.41.0" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6721c200e2021f6c3fab8b6cf0272ead8912d871610ee194ebd628cecf428f22" +checksum = "2766dcd2be8c87d5e1f35487deb22d765f49c6ae1251b3633efe3b25698bd3d2" dependencies = [ "arrayvec 0.7.2", "asynchronous-codec", @@ -5115,12 +5302,11 @@ dependencies = [ [[package]] name = "libp2p-mdns" -version = "0.41.0" +version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "761704e727f7d68d58d7bc2231eafae5fc1b9814de24290f126df09d4bd37a15" +checksum = "04f378264aade9872d6ccd315c0accc18be3a35d15fc1b9c36e5b6f983b62b5b" dependencies = [ "data-encoding", - "dns-parser", "futures", "if-watch", "libp2p-core", @@ -5130,14 +5316,15 @@ dependencies = [ "smallvec", "socket2", "tokio", + "trust-dns-proto", "void", ] [[package]] name = "libp2p-metrics" -version = "0.10.0" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ee31b08e78b7b8bfd1c4204a9dd8a87b4fcdf6dafc57eb51701c1c264a81cb9" +checksum = "5ad8a64f29da86005c86a4d2728b8a0719e9b192f4092b609fd8790acb9dec55" dependencies = [ "libp2p-core", "libp2p-identify", @@ -5149,9 +5336,9 @@ dependencies = [ [[package]] name = "libp2p-mplex" -version = "0.37.0" +version = "0.38.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "692664acfd98652de739a8acbb0a0d670f1d67190a49be6b4395e22c37337d89" +checksum = "03805b44107aa013e7cbbfa5627b31c36cbedfdfb00603c0311998882bc4bace" dependencies = [ "asynchronous-codec", "bytes", @@ -5167,31 +5354,32 @@ dependencies = [ [[package]] name = "libp2p-noise" -version = "0.40.0" +version = "0.41.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "048155686bd81fe6cb5efdef0c6290f25ad32a0a42e8f4f72625cf6a505a206f" +checksum = "a978cb57efe82e892ec6f348a536bfbd9fee677adbe5689d7a93ad3a9bffbf2e" dependencies = [ "bytes", "curve25519-dalek 3.2.0", "futures", - "lazy_static", "libp2p-core", "log", + "once_cell", "prost", "prost-build", "rand 0.8.5", "sha2 0.10.6", "snow", "static_assertions", - "x25519-dalek", + "thiserror", + "x25519-dalek 1.1.1", "zeroize", ] [[package]] name = "libp2p-ping" -version = "0.40.1" +version = "0.41.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7228b9318d34689521349a86eb39a3c3a802c9efc99a0568062ffb80913e3f91" +checksum = "929fcace45a112536e22b3dcfd4db538723ef9c3cb79f672b98be2cc8e25f37f" dependencies = [ "futures", "futures-timer", @@ -5203,11 +5391,32 @@ dependencies = [ "void", ] +[[package]] +name = "libp2p-quic" +version = "0.7.0-alpha" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01e7c867e95c8130667b24409d236d37598270e6da69b3baf54213ba31ffca59" +dependencies = [ + "bytes", + "futures", + "futures-timer", + "if-watch", + "libp2p-core", + "libp2p-tls", + "log", + "parking_lot 0.12.1", + "quinn-proto", + "rand 0.8.5", + "rustls 0.20.8", + "thiserror", + "tokio", +] + [[package]] name = "libp2p-request-response" -version = "0.22.1" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8827af16a017b65311a410bb626205a9ad92ec0473967618425039fa5231adc1" +checksum = "3236168796727bfcf4927f766393415361e2c644b08bedb6a6b13d957c9a4884" dependencies = [ "async-trait", "bytes", @@ -5223,9 +5432,9 @@ dependencies = [ [[package]] name = "libp2p-swarm" -version = "0.40.1" +version = "0.41.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46d13df7c37807965d82930c0e4b04a659efcb6cca237373b206043db5398ecf" +checksum = "b2a35472fe3276b3855c00f1c032ea8413615e030256429ad5349cdf67c6e1a0" dependencies = [ "either", "fnv", @@ -5233,19 +5442,21 @@ dependencies = [ "futures-timer", "instant", "libp2p-core", + "libp2p-swarm-derive", "log", "pin-project", "rand 0.8.5", "smallvec", "thiserror", + "tokio", "void", ] [[package]] name = "libp2p-swarm-derive" -version = "0.30.1" +version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0eddc4497a8b5a506013c40e8189864f9c3a00db2b25671f428ae9007f3ba32" +checksum = "9d527d5827582abd44a6d80c07ff8b50b4ee238a8979e05998474179e79dc400" dependencies = [ "heck", "quote", @@ -5254,9 +5465,9 @@ dependencies = [ [[package]] name = "libp2p-tcp" -version = "0.37.0" +version = "0.38.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9839d96761491c6d3e238e70554b856956fca0ab60feb9de2cd08eed4473fa92" +checksum = "b4b257baf6df8f2df39678b86c578961d48cc8b68642a12f0f763f56c8e5858d" dependencies = [ "futures", "futures-timer", @@ -5268,11 +5479,29 @@ dependencies = [ "tokio", ] +[[package]] +name = "libp2p-tls" +version = "0.1.0-alpha" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7905ce0d040576634e8a3229a7587cc8beab83f79db6023800f1792895defa8" +dependencies = [ + "futures", + "futures-rustls", + "libp2p-core", + "rcgen 0.10.0", + "ring", + "rustls 0.20.8", + "thiserror", + "webpki 0.22.0", + "x509-parser 0.14.0", + "yasna", +] + [[package]] name = "libp2p-wasm-ext" -version = "0.37.0" +version = "0.38.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a17b5b8e7a73e379e47b1b77f8a82c4721e97eca01abcd18e9cd91a23ca6ce97" +checksum = "1bb1a35299860e0d4b3c02a3e74e3b293ad35ae0cee8a056363b0c862d082069" dependencies = [ "futures", "js-sys", @@ -5282,11 +5511,42 @@ dependencies = [ "wasm-bindgen-futures", ] +[[package]] +name = "libp2p-webrtc" +version = "0.4.0-alpha" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdb6cd86dd68cba72308ea05de1cebf3ba0ae6e187c40548167955d4e3970f6a" +dependencies = [ + "async-trait", + "asynchronous-codec", + "bytes", + "futures", + "futures-timer", + "hex", + "if-watch", + "libp2p-core", + "libp2p-noise", + "log", + "multihash", + "prost", + "prost-build", + "prost-codec", + "rand 0.8.5", + "rcgen 0.9.3", + "serde", + "stun", + "thiserror", + "tinytemplate", + "tokio", + "tokio-util", + "webrtc", +] + [[package]] name = "libp2p-websocket" -version = "0.39.0" +version = "0.40.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3758ae6f89b2531a24b6d9f5776bda6a626b60a57600d7185d43dfa75ca5ecc4" +checksum = "1d705506030d5c0aaf2882437c70dab437605f21c5f9811978f694e6917a3b54" dependencies = [ "either", "futures", @@ -5303,9 +5563,9 @@ dependencies = [ [[package]] name = "libp2p-yamux" -version = "0.41.1" +version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d6874d66543c4f7e26e3b8ca9a6bead351563a13ab4fafd43c7927f7c0d6c12" +checksum = "4f63594a0aa818642d9d4915c791945053877253f08a3626f13416b5cd928a29" dependencies = [ "futures", "libp2p-core", @@ -5452,7 +5712,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" dependencies = [ "cfg-if", - "value-bag", ] [[package]] @@ -5532,6 +5791,15 @@ dependencies = [ "rawpointer", ] +[[package]] +name = "md-5" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6365506850d44bff6e2fbcb5176cf63650e48bd45ef2fe2665ae1570e0f4b9ca" +dependencies = [ + "digest 0.10.6", +] + [[package]] name = "memchr" version = "2.5.0" @@ -5653,7 +5921,7 @@ dependencies = [ [[package]] name = "mmr-gadget" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "futures", "log", @@ -5665,7 +5933,6 @@ dependencies = [ "sp-blockchain", "sp-consensus", "sp-core", - "sp-io", "sp-mmr-primitives", "sp-runtime", ] @@ -5673,7 +5940,7 @@ dependencies = [ [[package]] name = "mmr-rpc" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "anyhow", "jsonrpsee", @@ -5715,14 +5982,14 @@ dependencies = [ [[package]] name = "multiaddr" -version = "0.14.0" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c580bfdd8803cce319b047d239559a22f809094aaea4ac13902a1fdcfcd4261" +checksum = "a4aebdb21e90f81d13ed01dc84123320838e53963c2ca94b60b305d3fa64f31e" dependencies = [ "arrayref", - "bs58", "byteorder", "data-encoding", + "multibase", "multihash", "percent-encoding", "serde", @@ -5896,11 +6163,11 @@ version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "260e21fbb6f3d253a14df90eb0000a6066780a15dd901a7519ce02d77a94985b" dependencies = [ - "async-io", "bytes", "futures", "libc", "log", + "tokio", ] [[package]] @@ -5912,6 +6179,7 @@ dependencies = [ "bitflags", "cfg-if", "libc", + "memoffset 0.6.5", ] [[package]] @@ -6090,6 +6358,24 @@ dependencies = [ "memchr", ] +[[package]] +name = "oid-registry" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38e20717fa0541f39bd146692035c37bedfa532b3e5071b35761082407546b2a" +dependencies = [ + "asn1-rs 0.3.1", +] + +[[package]] +name = "oid-registry" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bedf36ffb6ba96c2eb7144ef6270557b52e54b20c0a8e1eb2ff99a6c6959bff" +dependencies = [ + "asn1-rs 0.5.1", +] + [[package]] name = "once_cell" version = "1.17.0" @@ -6116,9 +6402,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "orchestra" -version = "0.0.2" +version = "0.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0aab54694ddaa8a9b703724c6ef04272b2d27bc32d2c855aae5cdd1857216b43" +checksum = "17e7d5b6bb115db09390bed8842c94180893dd83df3dfce7354f2a2aa090a4ee" dependencies = [ "async-trait", "dyn-clonable", @@ -6133,9 +6419,9 @@ dependencies = [ [[package]] name = "orchestra-proc-macro" -version = "0.0.2" +version = "0.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a702b2f6bf592b3eb06c00d80d05afaf7a8eff6b41bb361e397d799acc21b45a" +checksum = "c2af4dabb2286b0be0e9711d2d24e25f6217048b71210cffd3daddc3b5c84e1f" dependencies = [ "expander 0.0.6", "itertools", @@ -6158,7 +6444,7 @@ dependencies = [ [[package]] name = "orml-traits" version = "0.4.1-dev" -source = "git+https://github.com/open-web3-stack/open-runtime-module-library?branch=polkadot-v0.9.36#db0381f6363e0c8e781082b6f552c092b688fb1c" +source = "git+https://github.com/open-web3-stack/open-runtime-module-library?branch=polkadot-v0.9.37#16b6c1149a15674d21c87244b7988a667e2c14d9" dependencies = [ "frame-support", "impl-trait-for-tuples", @@ -6175,7 +6461,7 @@ dependencies = [ [[package]] name = "orml-utilities" version = "0.4.1-dev" -source = "git+https://github.com/open-web3-stack/open-runtime-module-library?branch=polkadot-v0.9.36#db0381f6363e0c8e781082b6f552c092b688fb1c" +source = "git+https://github.com/open-web3-stack/open-runtime-module-library?branch=polkadot-v0.9.37#16b6c1149a15674d21c87244b7988a667e2c14d9" dependencies = [ "frame-support", "parity-scale-codec", @@ -6191,6 +6477,28 @@ version = "6.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b7820b9daea5457c9f21c69448905d723fbd21136ccf521748f23fd49e723ee" +[[package]] +name = "p256" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51f44edd08f51e2ade572f141051021c5af22677e42b7dd28a88155151c33594" +dependencies = [ + "ecdsa", + "elliptic-curve", + "sha2 0.10.6", +] + +[[package]] +name = "p384" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfc8c5bf642dde52bb9e87c0ecd8ca5a76faac2eeed98dedb7c717997e1080aa" +dependencies = [ + "ecdsa", + "elliptic-curve", + "sha2 0.10.6", +] + [[package]] name = "packed_simd_2" version = "0.3.8" @@ -6204,7 +6512,7 @@ dependencies = [ [[package]] name = "pallet-assets" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "frame-benchmarking", "frame-support", @@ -6219,7 +6527,7 @@ dependencies = [ [[package]] name = "pallet-aura" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "frame-support", "frame-system", @@ -6235,7 +6543,7 @@ dependencies = [ [[package]] name = "pallet-authority-discovery" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "frame-support", "frame-system", @@ -6251,7 +6559,7 @@ dependencies = [ [[package]] name = "pallet-authorship" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "frame-support", "frame-system", @@ -6266,7 +6574,7 @@ dependencies = [ [[package]] name = "pallet-babe" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "frame-benchmarking", "frame-support", @@ -6290,7 +6598,7 @@ dependencies = [ [[package]] name = "pallet-bags-list" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -6310,7 +6618,7 @@ dependencies = [ [[package]] name = "pallet-balances" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "frame-benchmarking", "frame-support", @@ -6325,7 +6633,7 @@ dependencies = [ [[package]] name = "pallet-beefy" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "frame-support", "frame-system", @@ -6341,7 +6649,7 @@ dependencies = [ [[package]] name = "pallet-beefy-mmr" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "array-bytes 4.2.0", "beefy-merkle-tree", @@ -6364,7 +6672,7 @@ dependencies = [ [[package]] name = "pallet-bounties" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "frame-benchmarking", "frame-support", @@ -6382,7 +6690,7 @@ dependencies = [ [[package]] name = "pallet-bridge-dispatch" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.36#3cb281ddcd5a85b15da08bc2380f130d69ea2279" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.37#1092b5c91cb64c508dc581bfa2e58f0801970d32" dependencies = [ "bp-message-dispatch", "bp-runtime", @@ -6398,7 +6706,7 @@ dependencies = [ [[package]] name = "pallet-bridge-grandpa" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.36#3cb281ddcd5a85b15da08bc2380f130d69ea2279" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.37#1092b5c91cb64c508dc581bfa2e58f0801970d32" dependencies = [ "bp-header-chain", "bp-runtime", @@ -6420,7 +6728,7 @@ dependencies = [ [[package]] name = "pallet-bridge-messages" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.36#3cb281ddcd5a85b15da08bc2380f130d69ea2279" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.37#1092b5c91cb64c508dc581bfa2e58f0801970d32" dependencies = [ "bitvec", "bp-message-dispatch", @@ -6441,7 +6749,7 @@ dependencies = [ [[package]] name = "pallet-bridge-parachains" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.36#3cb281ddcd5a85b15da08bc2380f130d69ea2279" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.37#1092b5c91cb64c508dc581bfa2e58f0801970d32" dependencies = [ "bp-parachains", "bp-polkadot-core", @@ -6462,7 +6770,7 @@ dependencies = [ [[package]] name = "pallet-child-bounties" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "frame-benchmarking", "frame-support", @@ -6481,7 +6789,7 @@ dependencies = [ [[package]] name = "pallet-collective" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "frame-benchmarking", "frame-support", @@ -6498,7 +6806,7 @@ dependencies = [ [[package]] name = "pallet-conviction-voting" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "assert_matches", "frame-benchmarking", @@ -6515,7 +6823,7 @@ dependencies = [ [[package]] name = "pallet-democracy" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "frame-benchmarking", "frame-support", @@ -6533,7 +6841,7 @@ dependencies = [ [[package]] name = "pallet-election-provider-multi-phase" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -6542,7 +6850,7 @@ dependencies = [ "log", "pallet-election-provider-support-benchmarking", "parity-scale-codec", - "rand 0.7.3", + "rand 0.8.5", "scale-info", "sp-arithmetic", "sp-core", @@ -6550,14 +6858,13 @@ dependencies = [ "sp-npos-elections", "sp-runtime", "sp-std", - "static_assertions", "strum", ] [[package]] name = "pallet-election-provider-support-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -6570,7 +6877,7 @@ dependencies = [ [[package]] name = "pallet-elections-phragmen" version = "5.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "frame-benchmarking", "frame-support", @@ -6588,7 +6895,7 @@ dependencies = [ [[package]] name = "pallet-ethereum" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.36#63309df8e9a4b19ab4ceb2fd1a37f7968c111de9" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.37#6783dcd10ffcdb06a52793e0ffb793161881a5f2" dependencies = [ "ethereum", "ethereum-types 0.14.1", @@ -6606,7 +6913,6 @@ dependencies = [ "parity-scale-codec", "rlp", "scale-info", - "serde", "sp-io", "sp-runtime", "sp-std", @@ -6615,7 +6921,7 @@ dependencies = [ [[package]] name = "pallet-evm" version = "6.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.36#63309df8e9a4b19ab4ceb2fd1a37f7968c111de9" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.37#6783dcd10ffcdb06a52793e0ffb793161881a5f2" dependencies = [ "environmental", "evm", @@ -6624,13 +6930,12 @@ dependencies = [ "frame-support", "frame-system", "hex", + "impl-trait-for-tuples", "log", "pallet-timestamp", "parity-scale-codec", - "primitive-types 0.12.1", "rlp", "scale-info", - "serde", "sp-core", "sp-io", "sp-runtime", @@ -6640,7 +6945,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-blake2" version = "2.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.36#63309df8e9a4b19ab4ceb2fd1a37f7968c111de9" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.37#6783dcd10ffcdb06a52793e0ffb793161881a5f2" dependencies = [ "fp-evm", ] @@ -6648,7 +6953,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-bn128" version = "2.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.36#63309df8e9a4b19ab4ceb2fd1a37f7968c111de9" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.37#6783dcd10ffcdb06a52793e0ffb793161881a5f2" dependencies = [ "fp-evm", "sp-core", @@ -6658,7 +6963,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-dispatch" version = "2.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.36#63309df8e9a4b19ab4ceb2fd1a37f7968c111de9" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.37#6783dcd10ffcdb06a52793e0ffb793161881a5f2" dependencies = [ "fp-evm", "frame-support", @@ -6668,7 +6973,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-modexp" version = "2.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.36#63309df8e9a4b19ab4ceb2fd1a37f7968c111de9" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.37#6783dcd10ffcdb06a52793e0ffb793161881a5f2" dependencies = [ "fp-evm", "num", @@ -6677,7 +6982,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-simple" version = "2.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.36#63309df8e9a4b19ab4ceb2fd1a37f7968c111de9" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.37#6783dcd10ffcdb06a52793e0ffb793161881a5f2" dependencies = [ "fp-evm", "ripemd", @@ -6687,7 +6992,7 @@ dependencies = [ [[package]] name = "pallet-fast-unstake" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -6705,7 +7010,7 @@ dependencies = [ [[package]] name = "pallet-fee-market" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.36#3cb281ddcd5a85b15da08bc2380f130d69ea2279" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.37#1092b5c91cb64c508dc581bfa2e58f0801970d32" dependencies = [ "bp-messages", "bp-runtime", @@ -6724,7 +7029,7 @@ dependencies = [ [[package]] name = "pallet-grandpa" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "frame-benchmarking", "frame-support", @@ -6747,7 +7052,7 @@ dependencies = [ [[package]] name = "pallet-identity" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "enumflags2", "frame-benchmarking", @@ -6763,7 +7068,7 @@ dependencies = [ [[package]] name = "pallet-im-online" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "frame-benchmarking", "frame-support", @@ -6783,7 +7088,7 @@ dependencies = [ [[package]] name = "pallet-indices" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "frame-benchmarking", "frame-support", @@ -6800,7 +7105,7 @@ dependencies = [ [[package]] name = "pallet-membership" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "frame-benchmarking", "frame-support", @@ -6817,7 +7122,7 @@ dependencies = [ [[package]] name = "pallet-mmr" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "frame-benchmarking", "frame-support", @@ -6834,7 +7139,7 @@ dependencies = [ [[package]] name = "pallet-multisig" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "frame-benchmarking", "frame-support", @@ -6850,7 +7155,7 @@ dependencies = [ [[package]] name = "pallet-nis" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "frame-benchmarking", "frame-support", @@ -6866,7 +7171,7 @@ dependencies = [ [[package]] name = "pallet-nomination-pools" version = "1.0.0" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "frame-support", "frame-system", @@ -6883,7 +7188,7 @@ dependencies = [ [[package]] name = "pallet-nomination-pools-benchmarking" version = "1.0.0" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -6903,7 +7208,7 @@ dependencies = [ [[package]] name = "pallet-nomination-pools-runtime-api" version = "1.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "parity-scale-codec", "sp-api", @@ -6913,7 +7218,7 @@ dependencies = [ [[package]] name = "pallet-offences" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "frame-support", "frame-system", @@ -6930,7 +7235,7 @@ dependencies = [ [[package]] name = "pallet-offences-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -6953,7 +7258,7 @@ dependencies = [ [[package]] name = "pallet-preimage" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "frame-benchmarking", "frame-support", @@ -6970,7 +7275,7 @@ dependencies = [ [[package]] name = "pallet-proxy" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "frame-benchmarking", "frame-support", @@ -6985,7 +7290,7 @@ dependencies = [ [[package]] name = "pallet-ranked-collective" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "frame-benchmarking", "frame-support", @@ -7003,7 +7308,7 @@ dependencies = [ [[package]] name = "pallet-recovery" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "frame-benchmarking", "frame-support", @@ -7018,7 +7323,7 @@ dependencies = [ [[package]] name = "pallet-referenda" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "assert_matches", "frame-benchmarking", @@ -7037,7 +7342,7 @@ dependencies = [ [[package]] name = "pallet-scheduler" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "frame-benchmarking", "frame-support", @@ -7054,7 +7359,7 @@ dependencies = [ [[package]] name = "pallet-session" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "frame-support", "frame-system", @@ -7075,14 +7380,14 @@ dependencies = [ [[package]] name = "pallet-session-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "frame-benchmarking", "frame-support", "frame-system", "pallet-session", "pallet-staking", - "rand 0.7.3", + "rand 0.8.5", "sp-runtime", "sp-session", "sp-std", @@ -7091,7 +7396,7 @@ dependencies = [ [[package]] name = "pallet-society" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "frame-support", "frame-system", @@ -7105,7 +7410,7 @@ dependencies = [ [[package]] name = "pallet-staking" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -7128,7 +7433,7 @@ dependencies = [ [[package]] name = "pallet-staking-reward-curve" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -7139,7 +7444,7 @@ dependencies = [ [[package]] name = "pallet-staking-reward-fn" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "log", "sp-arithmetic", @@ -7148,7 +7453,7 @@ dependencies = [ [[package]] name = "pallet-state-trie-migration" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "frame-benchmarking", "frame-support", @@ -7165,7 +7470,7 @@ dependencies = [ [[package]] name = "pallet-sudo" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "frame-support", "frame-system", @@ -7179,7 +7484,7 @@ dependencies = [ [[package]] name = "pallet-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "frame-benchmarking", "frame-support", @@ -7197,7 +7502,7 @@ dependencies = [ [[package]] name = "pallet-tips" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "frame-benchmarking", "frame-support", @@ -7216,7 +7521,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "frame-support", "frame-system", @@ -7232,7 +7537,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "jsonrpsee", "pallet-transaction-payment-rpc-runtime-api", @@ -7248,7 +7553,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "pallet-transaction-payment", "parity-scale-codec", @@ -7260,7 +7565,7 @@ dependencies = [ [[package]] name = "pallet-treasury" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "frame-benchmarking", "frame-support", @@ -7277,7 +7582,7 @@ dependencies = [ [[package]] name = "pallet-utility" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "frame-benchmarking", "frame-support", @@ -7293,7 +7598,7 @@ dependencies = [ [[package]] name = "pallet-vesting" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "frame-benchmarking", "frame-support", @@ -7308,7 +7613,7 @@ dependencies = [ [[package]] name = "pallet-whitelist" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "frame-benchmarking", "frame-support", @@ -7322,8 +7627,8 @@ dependencies = [ [[package]] name = "pallet-xcm" -version = "0.9.36" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" +version = "0.9.37" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" dependencies = [ "frame-support", "frame-system", @@ -7340,8 +7645,8 @@ dependencies = [ [[package]] name = "pallet-xcm-benchmarks" -version = "0.9.36" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" +version = "0.9.37" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" dependencies = [ "frame-benchmarking", "frame-support", @@ -7564,7 +7869,7 @@ dependencies = [ [[package]] name = "parachain-info" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.36#afe528af891f464b318293f183f6d3eefbc979b0" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.37#09418fc04c2608b123f36ca80f16df3d2096753b" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -7693,20 +7998,20 @@ checksum = "d01a5bd0424d00070b0098dd17ebca6f961a959dead1dbcbbbc1d1cd8d3deeba" [[package]] name = "pbkdf2" -version = "0.4.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "216eaa586a190f0a738f2f918511eecfa90f13295abec0e457cdebcceda80cbd" +checksum = "d95f5254224e617595d2cc3cc73ff0a5eaf2637519e25f03388154e9378b6ffa" dependencies = [ - "crypto-mac 0.8.0", + "crypto-mac 0.11.1", ] [[package]] name = "pbkdf2" -version = "0.8.0" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d95f5254224e617595d2cc3cc73ff0a5eaf2637519e25f03388154e9378b6ffa" +checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917" dependencies = [ - "crypto-mac 0.11.1", + "digest 0.10.6", ] [[package]] @@ -7716,11 +8021,29 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" [[package]] -name = "percent-encoding" -version = "2.2.0" +name = "pem" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" - +checksum = "a8835c273a76a90455d7344889b0964598e3316e2a79ede8e36f16bdcf2228b8" +dependencies = [ + "base64 0.13.1", +] + +[[package]] +name = "pem-rfc7468" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d159833a9105500e0398934e205e0773f0b27529557134ecfc51c27646adac" +dependencies = [ + "base64ct", +] + +[[package]] +name = "percent-encoding" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" + [[package]] name = "pest" version = "2.5.4" @@ -7843,14 +8166,14 @@ checksum = "e3d7ddaed09e0eb771a79ab0fd64609ba0afb0a8366421957936ad14cbd13630" [[package]] name = "polkadot-approval-distribution" -version = "0.9.36" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" +version = "0.9.37" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" dependencies = [ "futures", + "polkadot-node-metrics", "polkadot-node-network-protocol", "polkadot-node-primitives", "polkadot-node-subsystem", - "polkadot-node-subsystem-util", "polkadot-primitives", "rand 0.8.5", "tracing-gum", @@ -7858,8 +8181,8 @@ dependencies = [ [[package]] name = "polkadot-availability-bitfield-distribution" -version = "0.9.36" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" +version = "0.9.37" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" dependencies = [ "futures", "polkadot-node-network-protocol", @@ -7872,8 +8195,8 @@ dependencies = [ [[package]] name = "polkadot-availability-distribution" -version = "0.9.36" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" +version = "0.9.37" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" dependencies = [ "derive_more", "fatality", @@ -7895,8 +8218,8 @@ dependencies = [ [[package]] name = "polkadot-availability-recovery" -version = "0.9.36" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" +version = "0.9.37" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" dependencies = [ "fatality", "futures", @@ -7916,8 +8239,8 @@ dependencies = [ [[package]] name = "polkadot-cli" -version = "0.9.36" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" +version = "0.9.37" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" dependencies = [ "clap", "frame-benchmarking-cli", @@ -7943,8 +8266,8 @@ dependencies = [ [[package]] name = "polkadot-client" -version = "0.9.36" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" +version = "0.9.37" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" dependencies = [ "async-trait", "frame-benchmarking", @@ -7987,8 +8310,8 @@ dependencies = [ [[package]] name = "polkadot-collator-protocol" -version = "0.9.36" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" +version = "0.9.37" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" dependencies = [ "always-assert", "bitvec", @@ -8009,8 +8332,8 @@ dependencies = [ [[package]] name = "polkadot-core-primitives" -version = "0.9.36" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" +version = "0.9.37" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" dependencies = [ "parity-scale-codec", "scale-info", @@ -8021,8 +8344,8 @@ dependencies = [ [[package]] name = "polkadot-dispute-distribution" -version = "0.9.36" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" +version = "0.9.37" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" dependencies = [ "derive_more", "fatality", @@ -8046,8 +8369,8 @@ dependencies = [ [[package]] name = "polkadot-erasure-coding" -version = "0.9.36" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" +version = "0.9.37" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" dependencies = [ "parity-scale-codec", "polkadot-node-primitives", @@ -8060,8 +8383,8 @@ dependencies = [ [[package]] name = "polkadot-gossip-support" -version = "0.9.36" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" +version = "0.9.37" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" dependencies = [ "futures", "futures-timer", @@ -8080,8 +8403,8 @@ dependencies = [ [[package]] name = "polkadot-network-bridge" -version = "0.9.36" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" +version = "0.9.37" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" dependencies = [ "always-assert", "async-trait", @@ -8090,9 +8413,9 @@ dependencies = [ "futures", "parity-scale-codec", "parking_lot 0.12.1", + "polkadot-node-metrics", "polkadot-node-network-protocol", "polkadot-node-subsystem", - "polkadot-node-subsystem-util", "polkadot-overseer", "polkadot-primitives", "sc-network", @@ -8104,8 +8427,8 @@ dependencies = [ [[package]] name = "polkadot-node-collation-generation" -version = "0.9.36" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" +version = "0.9.37" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" dependencies = [ "futures", "parity-scale-codec", @@ -8122,8 +8445,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-approval-voting" -version = "0.9.36" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" +version = "0.9.37" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" dependencies = [ "bitvec", "derive_more", @@ -8151,8 +8474,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-av-store" -version = "0.9.36" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" +version = "0.9.37" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" dependencies = [ "bitvec", "futures", @@ -8171,8 +8494,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-backing" -version = "0.9.36" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" +version = "0.9.37" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" dependencies = [ "bitvec", "fatality", @@ -8190,8 +8513,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-bitfield-signing" -version = "0.9.36" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" +version = "0.9.37" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" dependencies = [ "futures", "polkadot-node-subsystem", @@ -8205,17 +8528,17 @@ dependencies = [ [[package]] name = "polkadot-node-core-candidate-validation" -version = "0.9.36" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" +version = "0.9.37" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" dependencies = [ "async-trait", "futures", "futures-timer", "parity-scale-codec", "polkadot-node-core-pvf", + "polkadot-node-metrics", "polkadot-node-primitives", "polkadot-node-subsystem", - "polkadot-node-subsystem-util", "polkadot-parachain", "polkadot-primitives", "sp-maybe-compressed-blob", @@ -8224,12 +8547,12 @@ dependencies = [ [[package]] name = "polkadot-node-core-chain-api" -version = "0.9.36" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" +version = "0.9.37" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" dependencies = [ "futures", + "polkadot-node-metrics", "polkadot-node-subsystem", - "polkadot-node-subsystem-util", "polkadot-primitives", "sc-client-api", "sc-consensus-babe", @@ -8239,8 +8562,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-chain-selection" -version = "0.9.36" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" +version = "0.9.37" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" dependencies = [ "futures", "futures-timer", @@ -8256,8 +8579,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-dispute-coordinator" -version = "0.9.36" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" +version = "0.9.37" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" dependencies = [ "fatality", "futures", @@ -8275,8 +8598,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-parachains-inherent" -version = "0.9.36" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" +version = "0.9.37" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" dependencies = [ "async-trait", "futures", @@ -8286,15 +8609,14 @@ dependencies = [ "polkadot-primitives", "sp-blockchain", "sp-inherents", - "sp-runtime", "thiserror", "tracing-gum", ] [[package]] name = "polkadot-node-core-provisioner" -version = "0.9.36" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" +version = "0.9.37" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" dependencies = [ "bitvec", "fatality", @@ -8311,13 +8633,11 @@ dependencies = [ [[package]] name = "polkadot-node-core-pvf" -version = "0.9.36" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" +version = "0.9.37" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" dependencies = [ "always-assert", "assert_matches", - "async-process", - "async-std", "cpu-time", "futures", "futures-timer", @@ -8339,13 +8659,14 @@ dependencies = [ "sp-tracing", "sp-wasm-interface", "tempfile", + "tokio", "tracing-gum", ] [[package]] name = "polkadot-node-core-pvf-checker" -version = "0.9.36" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" +version = "0.9.37" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" dependencies = [ "futures", "polkadot-node-primitives", @@ -8360,14 +8681,14 @@ dependencies = [ [[package]] name = "polkadot-node-core-runtime-api" -version = "0.9.36" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" +version = "0.9.37" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" dependencies = [ "futures", "lru", + "polkadot-node-metrics", "polkadot-node-subsystem", "polkadot-node-subsystem-types", - "polkadot-node-subsystem-util", "polkadot-primitives", "sp-consensus-babe", "tracing-gum", @@ -8375,8 +8696,8 @@ dependencies = [ [[package]] name = "polkadot-node-jaeger" -version = "0.9.36" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" +version = "0.9.37" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" dependencies = [ "lazy_static", "log", @@ -8393,8 +8714,8 @@ dependencies = [ [[package]] name = "polkadot-node-metrics" -version = "0.9.36" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" +version = "0.9.37" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" dependencies = [ "bs58", "futures", @@ -8412,8 +8733,8 @@ dependencies = [ [[package]] name = "polkadot-node-network-protocol" -version = "0.9.36" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" +version = "0.9.37" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" dependencies = [ "async-trait", "derive_more", @@ -8435,8 +8756,8 @@ dependencies = [ [[package]] name = "polkadot-node-primitives" -version = "0.9.36" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" +version = "0.9.37" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" dependencies = [ "bounded-vec", "futures", @@ -8457,8 +8778,8 @@ dependencies = [ [[package]] name = "polkadot-node-subsystem" -version = "0.9.36" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" +version = "0.9.37" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" dependencies = [ "polkadot-node-jaeger", "polkadot-node-subsystem-types", @@ -8467,8 +8788,8 @@ dependencies = [ [[package]] name = "polkadot-node-subsystem-types" -version = "0.9.36" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" +version = "0.9.37" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" dependencies = [ "async-trait", "derive_more", @@ -8490,13 +8811,14 @@ dependencies = [ [[package]] name = "polkadot-node-subsystem-util" -version = "0.9.36" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" +version = "0.9.37" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" dependencies = [ "async-trait", "derive_more", "fatality", "futures", + "futures-channel", "itertools", "kvdb", "lru", @@ -8522,8 +8844,8 @@ dependencies = [ [[package]] name = "polkadot-overseer" -version = "0.9.36" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" +version = "0.9.37" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" dependencies = [ "async-trait", "futures", @@ -8545,8 +8867,8 @@ dependencies = [ [[package]] name = "polkadot-parachain" -version = "0.9.36" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" +version = "0.9.37" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" dependencies = [ "derive_more", "frame-support", @@ -8561,8 +8883,8 @@ dependencies = [ [[package]] name = "polkadot-performance-test" -version = "0.9.36" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" +version = "0.9.37" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" dependencies = [ "env_logger 0.9.3", "kusama-runtime", @@ -8576,8 +8898,8 @@ dependencies = [ [[package]] name = "polkadot-primitives" -version = "0.9.36" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" +version = "0.9.37" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" dependencies = [ "bitvec", "hex-literal", @@ -8602,8 +8924,8 @@ dependencies = [ [[package]] name = "polkadot-rpc" -version = "0.9.36" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" +version = "0.9.37" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" dependencies = [ "beefy-gadget", "beefy-gadget-rpc", @@ -8634,8 +8956,8 @@ dependencies = [ [[package]] name = "polkadot-runtime" -version = "0.9.36" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" +version = "0.9.37" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" dependencies = [ "bitvec", "frame-benchmarking", @@ -8723,8 +9045,8 @@ dependencies = [ [[package]] name = "polkadot-runtime-common" -version = "0.9.36" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" +version = "0.9.37" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" dependencies = [ "bitvec", "frame-benchmarking", @@ -8771,8 +9093,8 @@ dependencies = [ [[package]] name = "polkadot-runtime-constants" -version = "0.9.36" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" +version = "0.9.37" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" dependencies = [ "frame-support", "polkadot-primitives", @@ -8785,8 +9107,8 @@ dependencies = [ [[package]] name = "polkadot-runtime-metrics" -version = "0.9.36" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" +version = "0.9.37" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" dependencies = [ "bs58", "parity-scale-codec", @@ -8797,8 +9119,8 @@ dependencies = [ [[package]] name = "polkadot-runtime-parachains" -version = "0.9.36" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" +version = "0.9.37" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" dependencies = [ "bitflags", "bitvec", @@ -8840,8 +9162,8 @@ dependencies = [ [[package]] name = "polkadot-service" -version = "0.9.36" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" +version = "0.9.37" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" dependencies = [ "async-trait", "beefy-gadget", @@ -8948,8 +9270,8 @@ dependencies = [ [[package]] name = "polkadot-statement-distribution" -version = "0.9.36" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" +version = "0.9.37" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" dependencies = [ "arrayvec 0.5.2", "fatality", @@ -8969,8 +9291,8 @@ dependencies = [ [[package]] name = "polkadot-statement-table" -version = "0.9.36" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" +version = "0.9.37" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" dependencies = [ "parity-scale-codec", "polkadot-primitives", @@ -9002,6 +9324,17 @@ dependencies = [ "universal-hash", ] +[[package]] +name = "polyval" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eebcc4aa140b9abd2bc40d9c3f7ccec842679cd79045ac3a7ac698c1a064b7cd" +dependencies = [ + "cpuid-bool", + "opaque-debug 0.3.0", + "universal-hash", +] + [[package]] name = "polyval" version = "0.5.3" @@ -9023,7 +9356,7 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "precompile-utils" version = "0.1.0" -source = "git+https://github.com/darwinia-network/moonbeam?branch=polkadot-v0.9.36#f5c98d5612bdb7b6311005f41fc873400d5e1481" +source = "git+https://github.com/darwinia-network/moonbeam?branch=polkadot-v0.9.37#3e272b5e0fad227e09880cd5a7c1c709a69f0a92" dependencies = [ "affix", "derive_more", @@ -9053,7 +9386,7 @@ dependencies = [ [[package]] name = "precompile-utils-macro" version = "0.1.0" -source = "git+https://github.com/darwinia-network/moonbeam?branch=polkadot-v0.9.36#f5c98d5612bdb7b6311005f41fc873400d5e1481" +source = "git+https://github.com/darwinia-network/moonbeam?branch=polkadot-v0.9.37#3e272b5e0fad227e09880cd5a7c1c709a69f0a92" dependencies = [ "case", "num_enum", @@ -9269,9 +9602,9 @@ dependencies = [ [[package]] name = "prost-codec" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "011ae9ff8359df7915f97302d591cdd9e0e27fbd5a4ddc5bd13b71079bb20987" +checksum = "0dc34979ff898b6e141106178981ce2596c387ea6e62533facfc61a37fc879c0" dependencies = [ "asynchronous-codec", "bytes", @@ -9329,6 +9662,24 @@ dependencies = [ "pin-project-lite 0.1.12", ] +[[package]] +name = "quinn-proto" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72ef4ced82a24bb281af338b9e8f94429b6eca01b4e66d899f40031f074e74c9" +dependencies = [ + "bytes", + "rand 0.8.5", + "ring", + "rustc-hash", + "rustls 0.20.8", + "slab", + "thiserror", + "tinyvec", + "tracing", + "webpki 0.22.0", +] + [[package]] name = "quote" version = "1.0.23" @@ -9355,7 +9706,6 @@ dependencies = [ "rand_chacha 0.2.2", "rand_core 0.5.1", "rand_hc", - "rand_pcg 0.2.1", ] [[package]] @@ -9426,15 +9776,6 @@ dependencies = [ "rand_core 0.5.1", ] -[[package]] -name = "rand_pcg" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429" -dependencies = [ - "rand_core 0.5.1", -] - [[package]] name = "rand_pcg" version = "0.3.1" @@ -9472,6 +9813,31 @@ dependencies = [ "num_cpus", ] +[[package]] +name = "rcgen" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6413f3de1edee53342e6138e75b56d32e7bc6e332b3bd62d497b1929d4cfbcdd" +dependencies = [ + "pem", + "ring", + "time 0.3.17", + "x509-parser 0.13.2", + "yasna", +] + +[[package]] +name = "rcgen" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffbe84efe2f38dea12e9bfc1f65377fdf03e53a18cb3b995faedf7934c7e785b" +dependencies = [ + "pem", + "ring", + "time 0.3.17", + "yasna", +] + [[package]] name = "redox_syscall" version = "0.2.16" @@ -9651,8 +10017,8 @@ dependencies = [ [[package]] name = "rococo-runtime" -version = "0.9.36" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" +version = "0.9.37" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" dependencies = [ "beefy-merkle-tree", "frame-benchmarking", @@ -9661,6 +10027,7 @@ dependencies = [ "frame-system", "frame-system-benchmarking", "frame-system-rpc-runtime-api", + "frame-try-runtime", "hex-literal", "log", "pallet-authority-discovery", @@ -9736,8 +10103,8 @@ dependencies = [ [[package]] name = "rococo-runtime-constants" -version = "0.9.36" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" +version = "0.9.37" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" dependencies = [ "frame-support", "polkadot-primitives", @@ -9759,19 +10126,30 @@ dependencies = [ "winapi", ] +[[package]] +name = "rtcp" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1919efd6d4a6a85d13388f9487549bb8e359f17198cc03ffd72f79b553873691" +dependencies = [ + "bytes", + "thiserror", + "webrtc-util", +] + [[package]] name = "rtnetlink" version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "322c53fd76a18698f1c27381d58091de3a043d356aa5bd0d510608b565f469a0" dependencies = [ - "async-global-executor", "futures", "log", "netlink-packet-route", "netlink-proto", "nix", "thiserror", + "tokio", ] [[package]] @@ -9784,6 +10162,20 @@ dependencies = [ "winapi", ] +[[package]] +name = "rtp" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2a095411ff00eed7b12e4c6a118ba984d113e1079582570d56a5ee723f11f80" +dependencies = [ + "async-trait", + "bytes", + "rand 0.8.5", + "serde", + "thiserror", + "webrtc-util", +] + [[package]] name = "rustc-demangle" version = "0.1.21" @@ -9811,6 +10203,15 @@ dependencies = [ "semver 1.0.16", ] +[[package]] +name = "rusticata-macros" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "faf0c4a6ece9950b9abdb62b1cfcf2a68b3b67a10ba445b3bb85be2a293d0632" +dependencies = [ + "nom", +] + [[package]] name = "rustix" version = "0.35.13" @@ -9839,6 +10240,19 @@ dependencies = [ "windows-sys 0.42.0", ] +[[package]] +name = "rustls" +version = "0.19.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35edb675feee39aec9c99fa5ff985081995a06d594114ae14cbe797ad7b7a6d7" +dependencies = [ + "base64 0.13.1", + "log", + "ring", + "sct 0.6.1", + "webpki 0.21.4", +] + [[package]] name = "rustls" version = "0.20.8" @@ -9847,8 +10261,8 @@ checksum = "fff78fc74d175294f4e83b28343315ffcfb114b156f0185e9741cb5570f50e2f" dependencies = [ "log", "ring", - "sct", - "webpki", + "sct 0.7.0", + "webpki 0.22.0", ] [[package]] @@ -9907,7 +10321,7 @@ dependencies = [ [[package]] name = "sc-allocator" version = "4.1.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "log", "sp-core", @@ -9918,7 +10332,7 @@ dependencies = [ [[package]] name = "sc-authority-discovery" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "async-trait", "futures", @@ -9929,7 +10343,7 @@ dependencies = [ "parity-scale-codec", "prost", "prost-build", - "rand 0.7.3", + "rand 0.8.5", "sc-client-api", "sc-network-common", "sp-api", @@ -9945,7 +10359,7 @@ dependencies = [ [[package]] name = "sc-basic-authorship" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "futures", "futures-timer", @@ -9968,7 +10382,7 @@ dependencies = [ [[package]] name = "sc-block-builder" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "parity-scale-codec", "sc-client-api", @@ -9984,11 +10398,9 @@ dependencies = [ [[package]] name = "sc-chain-spec" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ - "impl-trait-for-tuples", "memmap2", - "parity-scale-codec", "sc-chain-spec-derive", "sc-network-common", "sc-telemetry", @@ -10001,7 +10413,7 @@ dependencies = [ [[package]] name = "sc-chain-spec-derive" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -10012,7 +10424,7 @@ dependencies = [ [[package]] name = "sc-cli" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "array-bytes 4.2.0", "chrono", @@ -10023,7 +10435,7 @@ dependencies = [ "log", "names", "parity-scale-codec", - "rand 0.7.3", + "rand 0.8.5", "regex", "rpassword", "sc-client-api", @@ -10052,11 +10464,10 @@ dependencies = [ [[package]] name = "sc-client-api" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "fnv", "futures", - "hash-db", "log", "parity-scale-codec", "parking_lot 0.12.1", @@ -10073,14 +10484,13 @@ dependencies = [ "sp-runtime", "sp-state-machine", "sp-storage", - "sp-trie", "substrate-prometheus-endpoint", ] [[package]] name = "sc-client-db" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "hash-db", "kvdb", @@ -10105,7 +10515,7 @@ dependencies = [ [[package]] name = "sc-consensus" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "async-trait", "futures", @@ -10130,7 +10540,7 @@ dependencies = [ [[package]] name = "sc-consensus-aura" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "async-trait", "futures", @@ -10159,7 +10569,7 @@ dependencies = [ [[package]] name = "sc-consensus-babe" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "async-trait", "fork-tree", @@ -10178,7 +10588,6 @@ dependencies = [ "sc-keystore", "sc-telemetry", "schnorrkel", - "serde", "sp-api", "sp-application-crypto", "sp-block-builder", @@ -10189,10 +10598,8 @@ dependencies = [ "sp-consensus-vrf", "sp-core", "sp-inherents", - "sp-io", "sp-keystore", "sp-runtime", - "sp-version", "substrate-prometheus-endpoint", "thiserror", ] @@ -10200,7 +10607,7 @@ dependencies = [ [[package]] name = "sc-consensus-babe-rpc" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "futures", "jsonrpsee", @@ -10222,7 +10629,7 @@ dependencies = [ [[package]] name = "sc-consensus-epochs" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "fork-tree", "parity-scale-codec", @@ -10235,7 +10642,7 @@ dependencies = [ [[package]] name = "sc-consensus-slots" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "async-trait", "futures", @@ -10253,13 +10660,12 @@ dependencies = [ "sp-inherents", "sp-runtime", "sp-state-machine", - "thiserror", ] [[package]] name = "sc-executor" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "lru", "parity-scale-codec", @@ -10283,7 +10689,7 @@ dependencies = [ [[package]] name = "sc-executor-common" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "sc-allocator", "sp-maybe-compressed-blob", @@ -10296,7 +10702,7 @@ dependencies = [ [[package]] name = "sc-executor-wasmi" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "log", "sc-allocator", @@ -10309,7 +10715,7 @@ dependencies = [ [[package]] name = "sc-executor-wasmtime" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "cfg-if", "libc", @@ -10326,7 +10732,7 @@ dependencies = [ [[package]] name = "sc-finality-grandpa" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "ahash", "array-bytes 4.2.0", @@ -10344,7 +10750,6 @@ dependencies = [ "sc-chain-spec", "sc-client-api", "sc-consensus", - "sc-keystore", "sc-network", "sc-network-common", "sc-network-gossip", @@ -10367,7 +10772,7 @@ dependencies = [ [[package]] name = "sc-finality-grandpa-rpc" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "finality-grandpa", "futures", @@ -10378,7 +10783,6 @@ dependencies = [ "sc-finality-grandpa", "sc-rpc", "serde", - "serde_json", "sp-blockchain", "sp-core", "sp-runtime", @@ -10388,7 +10792,7 @@ dependencies = [ [[package]] name = "sc-informant" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "ansi_term", "futures", @@ -10396,7 +10800,6 @@ dependencies = [ "log", "sc-client-api", "sc-network-common", - "sc-transaction-pool-api", "sp-blockchain", "sp-runtime", ] @@ -10404,7 +10807,7 @@ dependencies = [ [[package]] name = "sc-keystore" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "array-bytes 4.2.0", "async-trait", @@ -10419,30 +10822,25 @@ dependencies = [ [[package]] name = "sc-network" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "array-bytes 4.2.0", "async-trait", "asynchronous-codec", - "bitflags", + "backtrace", "bytes", - "cid", "either", "fnv", - "fork-tree", "futures", "futures-timer", "ip_network", "libp2p", - "linked-hash-map", - "linked_hash_set", "log", "lru", "parity-scale-codec", "parking_lot 0.12.1", "pin-project", - "prost", - "rand 0.7.3", + "rand 0.8.5", "sc-block-builder", "sc-client-api", "sc-consensus", @@ -10466,7 +10864,7 @@ dependencies = [ [[package]] name = "sc-network-bitswap" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "cid", "futures", @@ -10480,13 +10878,12 @@ dependencies = [ "sp-runtime", "thiserror", "unsigned-varint", - "void", ] [[package]] name = "sc-network-common" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "async-trait", "bitflags", @@ -10512,7 +10909,7 @@ dependencies = [ [[package]] name = "sc-network-gossip" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "ahash", "futures", @@ -10530,7 +10927,7 @@ dependencies = [ [[package]] name = "sc-network-light" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "array-bytes 4.2.0", "futures", @@ -10551,7 +10948,7 @@ dependencies = [ [[package]] name = "sc-network-sync" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "array-bytes 4.2.0", "async-trait", @@ -10583,17 +10980,17 @@ dependencies = [ [[package]] name = "sc-network-transactions" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "array-bytes 4.2.0", "futures", - "hex", "libp2p", "log", "parity-scale-codec", "pin-project", "sc-network-common", "sc-peerset", + "sc-utils", "sp-consensus", "sp-runtime", "substrate-prometheus-endpoint", @@ -10602,7 +10999,7 @@ dependencies = [ [[package]] name = "sc-offchain" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "array-bytes 4.2.0", "bytes", @@ -10616,7 +11013,7 @@ dependencies = [ "once_cell", "parity-scale-codec", "parking_lot 0.12.1", - "rand 0.7.3", + "rand 0.8.5", "sc-client-api", "sc-network-common", "sc-peerset", @@ -10632,7 +11029,7 @@ dependencies = [ [[package]] name = "sc-peerset" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "futures", "libp2p", @@ -10645,7 +11042,7 @@ dependencies = [ [[package]] name = "sc-proposer-metrics" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "log", "substrate-prometheus-endpoint", @@ -10654,10 +11051,9 @@ dependencies = [ [[package]] name = "sc-rpc" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "futures", - "hash-db", "jsonrpsee", "log", "parity-scale-codec", @@ -10684,13 +11080,10 @@ dependencies = [ [[package]] name = "sc-rpc-api" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ - "futures", "jsonrpsee", - "log", "parity-scale-codec", - "parking_lot 0.12.1", "sc-chain-spec", "sc-transaction-pool-api", "scale-info", @@ -10699,7 +11092,6 @@ dependencies = [ "sp-core", "sp-rpc", "sp-runtime", - "sp-tracing", "sp-version", "thiserror", ] @@ -10707,9 +11099,8 @@ dependencies = [ [[package]] name = "sc-rpc-server" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ - "futures", "http", "jsonrpsee", "log", @@ -10723,39 +11114,45 @@ dependencies = [ [[package]] name = "sc-rpc-spec-v2" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ + "array-bytes 4.2.0", "futures", + "futures-util", "hex", "jsonrpsee", + "log", "parity-scale-codec", + "parking_lot 0.12.1", "sc-chain-spec", + "sc-client-api", "sc-transaction-pool-api", "serde", "sp-api", "sp-blockchain", "sp-core", "sp-runtime", + "sp-version", "thiserror", + "tokio-stream", ] [[package]] name = "sc-service" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "async-trait", "directories", "exit-future", "futures", "futures-timer", - "hash-db", "jsonrpsee", "log", "parity-scale-codec", "parking_lot 0.12.1", "pin-project", - "rand 0.7.3", + "rand 0.8.5", "sc-block-builder", "sc-chain-spec", "sc-client-api", @@ -10783,19 +11180,15 @@ dependencies = [ "serde", "serde_json", "sp-api", - "sp-application-crypto", - "sp-block-builder", "sp-blockchain", "sp-consensus", "sp-core", "sp-externalities", - "sp-inherents", "sp-keystore", "sp-runtime", "sp-session", "sp-state-machine", "sp-storage", - "sp-tracing", "sp-transaction-pool", "sp-transaction-storage-proof", "sp-trie", @@ -10812,19 +11205,18 @@ dependencies = [ [[package]] name = "sc-state-db" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "log", "parity-scale-codec", "parking_lot 0.12.1", - "sc-client-api", "sp-core", ] [[package]] name = "sc-sync-state-rpc" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "jsonrpsee", "parity-scale-codec", @@ -10843,13 +11235,13 @@ dependencies = [ [[package]] name = "sc-sysinfo" version = "6.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "futures", "libc", "log", - "rand 0.7.3", - "rand_pcg 0.2.1", + "rand 0.8.5", + "rand_pcg", "regex", "sc-telemetry", "serde", @@ -10862,7 +11254,7 @@ dependencies = [ [[package]] name = "sc-telemetry" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "chrono", "futures", @@ -10870,7 +11262,8 @@ dependencies = [ "log", "parking_lot 0.12.1", "pin-project", - "rand 0.7.3", + "rand 0.8.5", + "sc-utils", "serde", "serde_json", "thiserror", @@ -10880,7 +11273,7 @@ dependencies = [ [[package]] name = "sc-tracing" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "ansi_term", "atty", @@ -10911,7 +11304,7 @@ dependencies = [ [[package]] name = "sc-tracing-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -10922,7 +11315,7 @@ dependencies = [ [[package]] name = "sc-transaction-pool" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "async-trait", "futures", @@ -10948,7 +11341,7 @@ dependencies = [ [[package]] name = "sc-transaction-pool-api" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "async-trait", "futures", @@ -10962,8 +11355,9 @@ dependencies = [ [[package]] name = "sc-utils" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ + "backtrace", "futures", "futures-timer", "lazy_static", @@ -11037,6 +11431,16 @@ version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ddccb15bcce173023b3fedd9436f882a0739b8dfb45e4f6b6002bee5929f61b2" +[[package]] +name = "sct" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b362b83898e0e69f38515b82ee15aa80636befe47c3b6d3d89a911e78fc228ce" +dependencies = [ + "ring", + "untrusted", +] + [[package]] name = "sct" version = "0.7.0" @@ -11047,6 +11451,18 @@ dependencies = [ "untrusted", ] +[[package]] +name = "sdp" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d22a5ef407871893fd72b4562ee15e4742269b173959db4b8df6f538c414e13" +dependencies = [ + "rand 0.8.5", + "substring", + "thiserror", + "url", +] + [[package]] name = "sec1" version = "0.3.0" @@ -11166,15 +11582,6 @@ dependencies = [ "serde", ] -[[package]] -name = "serde_nanos" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e44969a61f5d316be20a42ff97816efb3b407a924d06824c3d8a49fa8450de0e" -dependencies = [ - "serde", -] - [[package]] name = "sha-1" version = "0.9.8" @@ -11261,16 +11668,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3" -[[package]] -name = "signal-hook" -version = "0.3.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a253b5e89e2698464fc26b545c9edceb338e18a89effeeecfea192c3025be29d" -dependencies = [ - "libc", - "signal-hook-registry", -] - [[package]] name = "signal-hook-registry" version = "1.4.0" @@ -11339,8 +11736,8 @@ checksum = "03b634d87b960ab1a38c4fe143b508576f075e7c978bfad18217645ebfdfa2ec" [[package]] name = "slot-range-helper" -version = "0.9.36" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" +version = "0.9.37" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" dependencies = [ "enumn", "parity-scale-codec", @@ -11376,7 +11773,7 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "774d05a3edae07ce6d68ea6984f3c05e9bba8927e3dd591e3b479e5b03213d0d" dependencies = [ - "aes-gcm", + "aes-gcm 0.9.4", "blake2", "chacha20poly1305", "curve25519-dalek 4.0.0-pre.5", @@ -11417,7 +11814,7 @@ dependencies = [ [[package]] name = "sp-api" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "hash-db", "log", @@ -11435,7 +11832,7 @@ dependencies = [ [[package]] name = "sp-api-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "blake2", "proc-macro-crate", @@ -11447,7 +11844,7 @@ dependencies = [ [[package]] name = "sp-application-crypto" version = "7.0.0" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "parity-scale-codec", "scale-info", @@ -11460,14 +11857,13 @@ dependencies = [ [[package]] name = "sp-arithmetic" version = "6.0.0" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "integer-sqrt", "num-traits", "parity-scale-codec", "scale-info", "serde", - "sp-debug-derive", "sp-std", "static_assertions", ] @@ -11475,7 +11871,7 @@ dependencies = [ [[package]] name = "sp-authority-discovery" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "parity-scale-codec", "scale-info", @@ -11488,7 +11884,7 @@ dependencies = [ [[package]] name = "sp-authorship" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "async-trait", "parity-scale-codec", @@ -11500,7 +11896,7 @@ dependencies = [ [[package]] name = "sp-beefy" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "parity-scale-codec", "scale-info", @@ -11517,7 +11913,7 @@ dependencies = [ [[package]] name = "sp-block-builder" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "parity-scale-codec", "sp-api", @@ -11529,7 +11925,7 @@ dependencies = [ [[package]] name = "sp-blockchain" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "futures", "log", @@ -11547,11 +11943,10 @@ dependencies = [ [[package]] name = "sp-consensus" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "async-trait", "futures", - "futures-timer", "log", "parity-scale-codec", "sp-core", @@ -11566,7 +11961,7 @@ dependencies = [ [[package]] name = "sp-consensus-aura" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "async-trait", "parity-scale-codec", @@ -11584,7 +11979,7 @@ dependencies = [ [[package]] name = "sp-consensus-babe" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "async-trait", "merlin", @@ -11607,13 +12002,11 @@ dependencies = [ [[package]] name = "sp-consensus-slots" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "parity-scale-codec", "scale-info", "serde", - "sp-arithmetic", - "sp-runtime", "sp-std", "sp-timestamp", ] @@ -11621,7 +12014,7 @@ dependencies = [ [[package]] name = "sp-consensus-vrf" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "parity-scale-codec", "scale-info", @@ -11634,13 +12027,12 @@ dependencies = [ [[package]] name = "sp-core" version = "7.0.0" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "array-bytes 4.2.0", "base58", "bitflags", "blake2", - "byteorder", "dyn-clonable", "ed25519-zebra", "futures", @@ -11651,11 +12043,10 @@ dependencies = [ "libsecp256k1", "log", "merlin", - "num-traits", "parity-scale-codec", "parking_lot 0.12.1", "primitive-types 0.12.1", - "rand 0.7.3", + "rand 0.8.5", "regex", "scale-info", "schnorrkel", @@ -11672,14 +12063,13 @@ dependencies = [ "substrate-bip39", "thiserror", "tiny-bip39", - "wasmi", "zeroize", ] [[package]] name = "sp-core-hashing" version = "5.0.0" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "blake2", "byteorder", @@ -11693,7 +12083,7 @@ dependencies = [ [[package]] name = "sp-core-hashing-proc-macro" version = "5.0.0" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "proc-macro2", "quote", @@ -11704,7 +12094,7 @@ dependencies = [ [[package]] name = "sp-database" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "kvdb", "parking_lot 0.12.1", @@ -11713,7 +12103,7 @@ dependencies = [ [[package]] name = "sp-debug-derive" version = "5.0.0" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "proc-macro2", "quote", @@ -11723,7 +12113,7 @@ dependencies = [ [[package]] name = "sp-externalities" version = "0.13.0" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "environmental", "parity-scale-codec", @@ -11734,7 +12124,7 @@ dependencies = [ [[package]] name = "sp-finality-grandpa" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "finality-grandpa", "log", @@ -11752,7 +12142,7 @@ dependencies = [ [[package]] name = "sp-inherents" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "async-trait", "impl-trait-for-tuples", @@ -11766,16 +12156,15 @@ dependencies = [ [[package]] name = "sp-io" version = "7.0.0" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "bytes", + "ed25519", "ed25519-dalek", "futures", - "hash-db", "libsecp256k1", "log", "parity-scale-codec", - "parking_lot 0.12.1", "secp256k1", "sp-core", "sp-externalities", @@ -11785,7 +12174,6 @@ dependencies = [ "sp-std", "sp-tracing", "sp-trie", - "sp-wasm-interface", "tracing", "tracing-core", ] @@ -11793,7 +12181,7 @@ dependencies = [ [[package]] name = "sp-keyring" version = "7.0.0" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "lazy_static", "sp-core", @@ -11804,7 +12192,7 @@ dependencies = [ [[package]] name = "sp-keystore" version = "0.13.0" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "async-trait", "futures", @@ -11821,7 +12209,7 @@ dependencies = [ [[package]] name = "sp-maybe-compressed-blob" version = "4.1.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "thiserror", "zstd", @@ -11830,7 +12218,7 @@ dependencies = [ [[package]] name = "sp-mmr-primitives" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "ckb-merkle-mountain-range", "log", @@ -11848,7 +12236,7 @@ dependencies = [ [[package]] name = "sp-npos-elections" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "parity-scale-codec", "scale-info", @@ -11862,7 +12250,7 @@ dependencies = [ [[package]] name = "sp-offchain" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "sp-api", "sp-core", @@ -11872,7 +12260,7 @@ dependencies = [ [[package]] name = "sp-panic-handler" version = "5.0.0" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "backtrace", "lazy_static", @@ -11882,7 +12270,7 @@ dependencies = [ [[package]] name = "sp-rpc" version = "6.0.0" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "rustc-hash", "serde", @@ -11892,7 +12280,7 @@ dependencies = [ [[package]] name = "sp-runtime" version = "7.0.0" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "either", "hash256-std-hasher", @@ -11900,7 +12288,7 @@ dependencies = [ "log", "parity-scale-codec", "paste", - "rand 0.7.3", + "rand 0.8.5", "scale-info", "serde", "sp-application-crypto", @@ -11914,7 +12302,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface" version = "7.0.0" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "bytes", "impl-trait-for-tuples", @@ -11932,7 +12320,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" version = "6.0.0" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "Inflector", "proc-macro-crate", @@ -11944,7 +12332,7 @@ dependencies = [ [[package]] name = "sp-session" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "parity-scale-codec", "scale-info", @@ -11958,7 +12346,7 @@ dependencies = [ [[package]] name = "sp-staking" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "parity-scale-codec", "scale-info", @@ -11970,14 +12358,13 @@ dependencies = [ [[package]] name = "sp-state-machine" version = "0.13.0" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "hash-db", "log", - "num-traits", "parity-scale-codec", "parking_lot 0.12.1", - "rand 0.7.3", + "rand 0.8.5", "smallvec", "sp-core", "sp-externalities", @@ -11986,18 +12373,17 @@ dependencies = [ "sp-trie", "thiserror", "tracing", - "trie-root", ] [[package]] name = "sp-std" version = "5.0.0" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" [[package]] name = "sp-storage" version = "7.0.0" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "impl-serde 0.4.0", "parity-scale-codec", @@ -12010,13 +12396,12 @@ dependencies = [ [[package]] name = "sp-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "async-trait", "futures-timer", "log", "parity-scale-codec", - "sp-api", "sp-inherents", "sp-runtime", "sp-std", @@ -12026,7 +12411,7 @@ dependencies = [ [[package]] name = "sp-tracing" version = "6.0.0" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "parity-scale-codec", "sp-std", @@ -12038,7 +12423,7 @@ dependencies = [ [[package]] name = "sp-transaction-pool" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "sp-api", "sp-runtime", @@ -12047,7 +12432,7 @@ dependencies = [ [[package]] name = "sp-transaction-storage-proof" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "async-trait", "log", @@ -12063,7 +12448,7 @@ dependencies = [ [[package]] name = "sp-trie" version = "7.0.0" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "ahash", "hash-db", @@ -12086,7 +12471,7 @@ dependencies = [ [[package]] name = "sp-version" version = "5.0.0" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "impl-serde 0.4.0", "parity-scale-codec", @@ -12103,7 +12488,7 @@ dependencies = [ [[package]] name = "sp-version-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "parity-scale-codec", "proc-macro2", @@ -12114,7 +12499,7 @@ dependencies = [ [[package]] name = "sp-wasm-interface" version = "7.0.0" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "impl-trait-for-tuples", "log", @@ -12127,9 +12512,8 @@ dependencies = [ [[package]] name = "sp-weights" version = "4.0.0" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ - "impl-trait-for-tuples", "parity-scale-codec", "scale-info", "serde", @@ -12277,6 +12661,25 @@ dependencies = [ "syn", ] +[[package]] +name = "stun" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7e94b1ec00bad60e6410e058b52f1c66de3dc5fe4d62d09b3e52bb7d3b73e25" +dependencies = [ + "base64 0.13.1", + "crc", + "lazy_static", + "md-5", + "rand 0.8.5", + "ring", + "subtle", + "thiserror", + "tokio", + "url", + "webrtc-util", +] + [[package]] name = "substrate-bip39" version = "0.4.4" @@ -12306,7 +12709,7 @@ dependencies = [ [[package]] name = "substrate-build-script-utils" version = "3.0.0" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "platforms 2.0.0", ] @@ -12325,17 +12728,15 @@ dependencies = [ [[package]] name = "substrate-frame-rpc-system" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "frame-system-rpc-runtime-api", "futures", "jsonrpsee", "log", "parity-scale-codec", - "sc-client-api", "sc-rpc-api", "sc-transaction-pool-api", - "serde_json", "sp-api", "sp-block-builder", "sp-blockchain", @@ -12346,9 +12747,8 @@ dependencies = [ [[package]] name = "substrate-prometheus-endpoint" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ - "futures-util", "hyper", "log", "prometheus", @@ -12359,7 +12759,7 @@ dependencies = [ [[package]] name = "substrate-rpc-client" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "async-trait", "jsonrpsee", @@ -12372,7 +12772,7 @@ dependencies = [ [[package]] name = "substrate-state-trie-migration-rpc" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "jsonrpsee", "log", @@ -12382,10 +12782,8 @@ dependencies = [ "scale-info", "serde", "sp-core", - "sp-io", "sp-runtime", "sp-state-machine", - "sp-std", "sp-trie", "trie-db", ] @@ -12393,7 +12791,7 @@ dependencies = [ [[package]] name = "substrate-wasm-builder" version = "5.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "ansi_term", "build-helper", @@ -12407,6 +12805,15 @@ dependencies = [ "wasm-opt", ] +[[package]] +name = "substring" +version = "1.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42ee6433ecef213b2e72f587ef64a2f5943e7cd16fbd82dbe8bc07486c534c86" +dependencies = [ + "autocfg", +] + [[package]] name = "subtle" version = "2.4.1" @@ -12588,19 +12995,46 @@ dependencies = [ "winapi", ] +[[package]] +name = "time" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a561bf4617eebd33bca6434b988f39ed798e527f51a1e797d0ee4f61c0a38376" +dependencies = [ + "itoa", + "serde", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e153e1f1acaef8acc537e68b44906d2db6436e2b35ac2c6b42640fff91f00fd" + +[[package]] +name = "time-macros" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d967f99f534ca7e495c575c62638eebc2898a8c84c119b89e250477bc4ba16b2" +dependencies = [ + "time-core", +] + [[package]] name = "tiny-bip39" -version = "0.8.2" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffc59cb9dfc85bb312c3a78fd6aa8a8582e310b0fa885d5bb877f6dcc601839d" +checksum = "62cc94d358b5a1e84a5cb9109f559aa3c4d634d2b1b4de3d0fa4adc7c78e2861" dependencies = [ "anyhow", - "hmac 0.8.1", + "hmac 0.12.1", "once_cell", - "pbkdf2 0.4.0", - "rand 0.7.3", + "pbkdf2 0.11.0", + "rand 0.8.5", "rustc-hash", - "sha2 0.9.9", + "sha2 0.10.6", "thiserror", "unicode-normalization", "wasm-bindgen", @@ -12616,6 +13050,16 @@ dependencies = [ "crunchy", ] +[[package]] +name = "tinytemplate" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be4d6b5f19ff7664e8c98d03e2139cb510db9b0a60b55f8e8709b689d939b6bc" +dependencies = [ + "serde", + "serde_json", +] + [[package]] name = "tinyvec" version = "1.6.0" @@ -12668,9 +13112,9 @@ version = "0.23.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c43ee83903113e03984cb9e5cebe6c04a5116269e900e3ddba8f068a62adda59" dependencies = [ - "rustls", + "rustls 0.20.8", "tokio", - "webpki", + "webpki 0.22.0", ] [[package]] @@ -12682,6 +13126,7 @@ dependencies = [ "futures-core", "pin-project-lite 0.2.9", "tokio", + "tokio-util", ] [[package]] @@ -12812,8 +13257,8 @@ dependencies = [ [[package]] name = "tracing-gum" -version = "0.9.36" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" +version = "0.9.37" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" dependencies = [ "polkadot-node-jaeger", "polkadot-primitives", @@ -12823,8 +13268,8 @@ dependencies = [ [[package]] name = "tracing-gum-proc-macro" -version = "0.9.36" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" +version = "0.9.37" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" dependencies = [ "expander 0.0.6", "proc-macro-crate", @@ -12927,6 +13372,7 @@ dependencies = [ "lazy_static", "rand 0.8.5", "smallvec", + "socket2", "thiserror", "tinyvec", "tokio", @@ -12963,7 +13409,7 @@ checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" [[package]] name = "try-runtime-cli" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.36#d6d80979da7b176bede2974f91259fbf80710003" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" dependencies = [ "clap", "frame-remote-externalities", @@ -12971,11 +13417,11 @@ dependencies = [ "hex", "log", "parity-scale-codec", - "sc-chain-spec", "sc-cli", "sc-executor", "sc-service", "serde", + "serde_json", "sp-api", "sp-core", "sp-debug-derive", @@ -12997,6 +13443,25 @@ version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f4f195fd851901624eee5a58c4bb2b4f06399148fcd0ed336e6f1cb60a9881df" +[[package]] +name = "turn" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4712ee30d123ec7ae26d1e1b218395a16c87cdbaf4b3925d170d684af62ea5e8" +dependencies = [ + "async-trait", + "base64 0.13.1", + "futures", + "log", + "md-5", + "rand 0.8.5", + "ring", + "stun", + "thiserror", + "tokio", + "webrtc-util", +] + [[package]] name = "twox-hash" version = "1.6.3" @@ -13121,20 +13586,19 @@ dependencies = [ ] [[package]] -name = "valuable" -version = "0.1.0" +name = "uuid" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" +checksum = "1674845326ee10d37ca60470760d4288a6f80f304007d92e5c53bab78c9cfd79" +dependencies = [ + "getrandom 0.2.8", +] [[package]] -name = "value-bag" -version = "1.0.0-alpha.9" +name = "valuable" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2209b78d1249f7e6f3293657c9779fe31ced465df091bbd433a1cf88e916ec55" -dependencies = [ - "ctor", - "version_check", -] +checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" [[package]] name = "vcpkg" @@ -13154,6 +13618,15 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" +[[package]] +name = "waitgroup" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1f50000a783467e6c0200f9d10642f4bc424e39efc1b770203e88b488f79292" +dependencies = [ + "atomic-waker", +] + [[package]] name = "waker-fn" version = "1.1.0" @@ -13552,6 +14025,16 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "webpki" +version = "0.21.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8e38c0608262c46d4a56202ebabdeb094cef7e560ca7a226c6bf055188aa4ea" +dependencies = [ + "ring", + "untrusted", +] + [[package]] name = "webpki" version = "0.22.0" @@ -13568,7 +14051,219 @@ version = "0.22.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6c71e40d7d2c34a5106301fb632274ca37242cd0c9d3e64dbece371a40a2d87" dependencies = [ - "webpki", + "webpki 0.22.0", +] + +[[package]] +name = "webrtc" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d3bc9049bdb2cea52f5fd4f6f728184225bdb867ed0dc2410eab6df5bdd67bb" +dependencies = [ + "arc-swap", + "async-trait", + "bytes", + "hex", + "interceptor", + "lazy_static", + "log", + "rand 0.8.5", + "rcgen 0.9.3", + "regex", + "ring", + "rtcp", + "rtp", + "rustls 0.19.1", + "sdp", + "serde", + "serde_json", + "sha2 0.10.6", + "stun", + "thiserror", + "time 0.3.17", + "tokio", + "turn", + "url", + "waitgroup", + "webrtc-data", + "webrtc-dtls", + "webrtc-ice", + "webrtc-mdns", + "webrtc-media", + "webrtc-sctp", + "webrtc-srtp", + "webrtc-util", +] + +[[package]] +name = "webrtc-data" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ef36a4d12baa6e842582fe9ec16a57184ba35e1a09308307b67d43ec8883100" +dependencies = [ + "bytes", + "derive_builder", + "log", + "thiserror", + "tokio", + "webrtc-sctp", + "webrtc-util", +] + +[[package]] +name = "webrtc-dtls" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7021987ae0a2ed6c8cd33f68e98e49bb6e74ffe9543310267b48a1bbe3900e5f" +dependencies = [ + "aes 0.6.0", + "aes-gcm 0.8.0", + "async-trait", + "bincode", + "block-modes", + "byteorder", + "ccm", + "curve25519-dalek 3.2.0", + "der-parser 8.1.0", + "elliptic-curve", + "hkdf", + "hmac 0.10.1", + "log", + "oid-registry 0.6.1", + "p256", + "p384", + "rand 0.8.5", + "rand_core 0.6.4", + "rcgen 0.9.3", + "ring", + "rustls 0.19.1", + "sec1", + "serde", + "sha-1", + "sha2 0.9.9", + "signature", + "subtle", + "thiserror", + "tokio", + "webpki 0.21.4", + "webrtc-util", + "x25519-dalek 2.0.0-pre.1", + "x509-parser 0.13.2", +] + +[[package]] +name = "webrtc-ice" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "494483fbb2f5492620871fdc78b084aed8807377f6e3fe88b2e49f0a9c9c41d7" +dependencies = [ + "arc-swap", + "async-trait", + "crc", + "log", + "rand 0.8.5", + "serde", + "serde_json", + "stun", + "thiserror", + "tokio", + "turn", + "url", + "uuid", + "waitgroup", + "webrtc-mdns", + "webrtc-util", +] + +[[package]] +name = "webrtc-mdns" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f08dfd7a6e3987e255c4dbe710dde5d94d0f0574f8a21afa95d171376c143106" +dependencies = [ + "log", + "socket2", + "thiserror", + "tokio", + "webrtc-util", +] + +[[package]] +name = "webrtc-media" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee2a3c157a040324e5049bcbd644ffc9079e6738fa2cfab2bcff64e5cc4c00d7" +dependencies = [ + "byteorder", + "bytes", + "derive_builder", + "displaydoc", + "rand 0.8.5", + "rtp", + "thiserror", + "webrtc-util", +] + +[[package]] +name = "webrtc-sctp" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d47adcd9427eb3ede33d5a7f3424038f63c965491beafcc20bc650a2f6679c0" +dependencies = [ + "arc-swap", + "async-trait", + "bytes", + "crc", + "log", + "rand 0.8.5", + "thiserror", + "tokio", + "webrtc-util", +] + +[[package]] +name = "webrtc-srtp" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6183edc4c1c6c0175f8812eefdce84dfa0aea9c3ece71c2bf6ddd3c964de3da5" +dependencies = [ + "aead 0.4.3", + "aes 0.7.5", + "aes-gcm 0.9.4", + "async-trait", + "byteorder", + "bytes", + "ctr 0.8.0", + "hmac 0.11.0", + "log", + "rtcp", + "rtp", + "sha-1", + "subtle", + "thiserror", + "tokio", + "webrtc-util", +] + +[[package]] +name = "webrtc-util" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93f1db1727772c05cf7a2cfece52c3aca8045ca1e176cd517d323489aa3c6d87" +dependencies = [ + "async-trait", + "bitflags", + "bytes", + "cc", + "ipnet", + "lazy_static", + "libc", + "log", + "nix", + "rand 0.8.5", + "thiserror", + "tokio", + "winapi", ] [[package]] @@ -13582,8 +14277,8 @@ dependencies = [ [[package]] name = "westend-runtime" -version = "0.9.36" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" +version = "0.9.37" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" dependencies = [ "bitvec", "frame-benchmarking", @@ -13672,8 +14367,8 @@ dependencies = [ [[package]] name = "westend-runtime-constants" -version = "0.9.36" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" +version = "0.9.37" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" dependencies = [ "frame-support", "polkadot-primitives", @@ -13904,10 +14599,58 @@ dependencies = [ "zeroize", ] +[[package]] +name = "x25519-dalek" +version = "2.0.0-pre.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5da623d8af10a62342bcbbb230e33e58a63255a58012f8653c578e54bab48df" +dependencies = [ + "curve25519-dalek 3.2.0", + "rand_core 0.6.4", + "zeroize", +] + +[[package]] +name = "x509-parser" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fb9bace5b5589ffead1afb76e43e34cff39cd0f3ce7e170ae0c29e53b88eb1c" +dependencies = [ + "asn1-rs 0.3.1", + "base64 0.13.1", + "data-encoding", + "der-parser 7.0.0", + "lazy_static", + "nom", + "oid-registry 0.4.0", + "ring", + "rusticata-macros", + "thiserror", + "time 0.3.17", +] + +[[package]] +name = "x509-parser" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0ecbeb7b67ce215e40e3cc7f2ff902f94a223acf44995934763467e7b1febc8" +dependencies = [ + "asn1-rs 0.5.1", + "base64 0.13.1", + "data-encoding", + "der-parser 8.1.0", + "lazy_static", + "nom", + "oid-registry 0.6.1", + "rusticata-macros", + "thiserror", + "time 0.3.17", +] + [[package]] name = "xcm" -version = "0.9.36" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" +version = "0.9.37" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" dependencies = [ "derivative", "impl-trait-for-tuples", @@ -13920,8 +14663,8 @@ dependencies = [ [[package]] name = "xcm-builder" -version = "0.9.36" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" +version = "0.9.37" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" dependencies = [ "frame-support", "frame-system", @@ -13940,8 +14683,8 @@ dependencies = [ [[package]] name = "xcm-executor" -version = "0.9.36" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" +version = "0.9.37" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" dependencies = [ "frame-benchmarking", "frame-support", @@ -13959,7 +14702,7 @@ dependencies = [ [[package]] name = "xcm-primitives" version = "0.1.0" -source = "git+https://github.com/darwinia-network/moonbeam?branch=polkadot-v0.9.36#f5c98d5612bdb7b6311005f41fc873400d5e1481" +source = "git+https://github.com/darwinia-network/moonbeam?branch=polkadot-v0.9.37#3e272b5e0fad227e09880cd5a7c1c709a69f0a92" dependencies = [ "ethereum", "ethereum-types 0.14.1", @@ -13982,8 +14725,8 @@ dependencies = [ [[package]] name = "xcm-procedural" -version = "0.9.36" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.36#dc25abc712e42b9b51d87ad1168e453a42b5f0bc" +version = "0.9.37" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" dependencies = [ "Inflector", "proc-macro2", @@ -14005,6 +14748,15 @@ dependencies = [ "static_assertions", ] +[[package]] +name = "yasna" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aed2e7a52e3744ab4d0c05c20aa065258e84c49fd4226f5191b2ed29712710b4" +dependencies = [ + "time 0.3.17", +] + [[package]] name = "zeroize" version = "1.5.7" diff --git a/Cargo.toml b/Cargo.toml index cce2c62f5..3fd30fd62 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,24 +28,24 @@ members = [ static_assertions = { version = "1.1" } # cumulus - cumulus-client-cli = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.36" } - cumulus-client-collator = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.36" } - cumulus-client-consensus-aura = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.36" } - cumulus-client-consensus-common = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.36" } - cumulus-client-network = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.36" } - cumulus-client-service = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.36" } - cumulus-pallet-aura-ext = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } - cumulus-pallet-dmp-queue = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } - cumulus-pallet-parachain-system = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } - cumulus-pallet-session-benchmarking = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } - cumulus-pallet-xcm = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } - cumulus-pallet-xcmp-queue = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } - cumulus-primitives-core = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } - cumulus-primitives-parachain-inherent = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.36" } - cumulus-primitives-timestamp = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } - cumulus-primitives-utility = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } - cumulus-relay-chain-interface = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.36" } - parachain-info = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.36" } + cumulus-client-cli = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.37" } + cumulus-client-collator = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.37" } + cumulus-client-consensus-aura = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.37" } + cumulus-client-consensus-common = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.37" } + cumulus-client-network = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.37" } + cumulus-client-service = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.37" } + cumulus-pallet-aura-ext = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.37" } + cumulus-pallet-dmp-queue = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.37" } + cumulus-pallet-parachain-system = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.37" } + cumulus-pallet-session-benchmarking = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.37" } + cumulus-pallet-xcm = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.37" } + cumulus-pallet-xcmp-queue = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.37" } + cumulus-primitives-core = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.37" } + cumulus-primitives-parachain-inherent = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.37" } + cumulus-primitives-timestamp = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.37" } + cumulus-primitives-utility = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.37" } + cumulus-relay-chain-interface = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.37" } + parachain-info = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.37" } # darwinia crab-runtime = { path = "runtime/crab" } @@ -69,293 +69,293 @@ members = [ pangoro-runtime = { path = "runtime/pangoro" } # darwinia-messages-substrate - bp-darwinia-core = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } - bp-message-dispatch = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } - bp-messages = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } - bp-polkadot-core = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } - bp-runtime = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } - bridge-runtime-common = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } - pallet-bridge-dispatch = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } - pallet-bridge-grandpa = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } - pallet-bridge-messages = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } - pallet-bridge-parachains = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } - pallet-fee-market = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.36" } + bp-darwinia-core = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.37" } + bp-message-dispatch = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.37" } + bp-messages = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.37" } + bp-polkadot-core = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.37" } + bp-runtime = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.37" } + bridge-runtime-common = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.37" } + pallet-bridge-dispatch = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.37" } + pallet-bridge-grandpa = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.37" } + pallet-bridge-messages = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.37" } + pallet-bridge-parachains = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.37" } + pallet-fee-market = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.37" } # frontier - fc-cli = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } - fc-consensus = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } - fc-db = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } - fc-mapping-sync = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } - fc-rpc = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } - fc-rpc-core = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } - fp-ethereum = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } - fp-evm = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } - fp-rpc = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } - fp-self-contained = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } - fp-storage = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } - pallet-ethereum = { default-features = false, features = ["forbid-evm-reentrancy"], git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } - pallet-evm = { default-features = false, features = ["forbid-evm-reentrancy"], git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } - pallet-evm-precompile-blake2 = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } - pallet-evm-precompile-bn128 = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } - pallet-evm-precompile-dispatch = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } - pallet-evm-precompile-modexp = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } - pallet-evm-precompile-simple = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.36" } + fc-cli = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.37" } + fc-consensus = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.37" } + fc-db = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.37" } + fc-mapping-sync = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.37" } + fc-rpc = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.37" } + fc-rpc-core = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.37" } + fp-ethereum = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.37" } + fp-evm = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.37" } + fp-rpc = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.37" } + fp-self-contained = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.37" } + fp-storage = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.37" } + pallet-ethereum = { default-features = false, features = ["forbid-evm-reentrancy"], git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.37" } + pallet-evm = { default-features = false, features = ["forbid-evm-reentrancy"], git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.37" } + pallet-evm-precompile-blake2 = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.37" } + pallet-evm-precompile-bn128 = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.37" } + pallet-evm-precompile-dispatch = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.37" } + pallet-evm-precompile-modexp = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.37" } + pallet-evm-precompile-simple = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.37" } # moonbeam - account = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.36" } - precompile-utils = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.36" } - xcm-primitives = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.36" } + account = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.37" } + precompile-utils = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.37" } + xcm-primitives = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.37" } # polkadot - pallet-xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36" } - polkadot-cli = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36" } - polkadot-parachain = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36" } - polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36" } - polkadot-runtime-common = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36" } - polkadot-service = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36" } - xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36" } - xcm-builder = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36" } - xcm-executor = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.36" } + pallet-xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.37" } + polkadot-cli = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.37" } + polkadot-parachain = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.37" } + polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.37" } + polkadot-runtime-common = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.37" } + polkadot-service = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.37" } + xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.37" } + xcm-builder = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.37" } + xcm-executor = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.37" } # substrate - frame-benchmarking = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } - frame-benchmarking-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } - frame-executive = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } - frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } - frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } - frame-system-benchmarking = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } - frame-system-rpc-runtime-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } - frame-try-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } - pallet-assets = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } - pallet-aura = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } - pallet-authorship = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } - pallet-balances = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } - pallet-collective = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } - pallet-democracy = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } - pallet-elections-phragmen = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } - pallet-identity = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } - pallet-membership = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } - pallet-multisig = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } - pallet-preimage = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } - pallet-proxy = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } - pallet-scheduler = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } - pallet-session = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } - pallet-sudo = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } - pallet-timestamp = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } - pallet-tips = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } - pallet-transaction-payment = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } - pallet-transaction-payment-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } - pallet-transaction-payment-rpc-runtime-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } - pallet-treasury = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } - pallet-utility = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } - pallet-vesting = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } - sc-basic-authorship = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } - sc-chain-spec = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } - sc-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } - sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } - sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } - sc-consensus-aura = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } - sc-executor = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } - sc-keystore = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } - sc-network = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } - sc-network-common = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } - sc-offchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } - sc-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } - sc-rpc-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } - sc-service = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } - sc-sysinfo = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } - sc-telemetry = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } - sc-tracing = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } - sc-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } - sc-transaction-pool-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } - sp-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } - sp-arithmetic = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } - sp-block-builder = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } - sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } - sp-consensus = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } - sp-consensus-aura = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } - sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } - sp-inherents = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } - sp-io = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } - sp-keyring = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } - sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } - sp-offchain = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } - sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } - sp-session = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } - sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } - sp-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } - sp-transaction-pool = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } - sp-version = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } - substrate-build-script-utils = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } - substrate-frame-rpc-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } - substrate-prometheus-endpoint = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } - substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } - try-runtime-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" } + frame-benchmarking = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } + frame-benchmarking-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } + frame-executive = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } + frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } + frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } + frame-system-benchmarking = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } + frame-system-rpc-runtime-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } + frame-try-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } + pallet-assets = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } + pallet-aura = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } + pallet-authorship = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } + pallet-balances = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } + pallet-collective = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } + pallet-democracy = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } + pallet-elections-phragmen = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } + pallet-identity = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } + pallet-membership = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } + pallet-multisig = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } + pallet-preimage = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } + pallet-proxy = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } + pallet-scheduler = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } + pallet-session = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } + pallet-sudo = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } + pallet-timestamp = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } + pallet-tips = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } + pallet-transaction-payment = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } + pallet-transaction-payment-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } + pallet-transaction-payment-rpc-runtime-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } + pallet-treasury = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } + pallet-utility = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } + pallet-vesting = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } + sc-basic-authorship = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } + sc-chain-spec = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } + sc-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } + sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } + sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } + sc-consensus-aura = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } + sc-executor = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } + sc-keystore = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } + sc-network = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } + sc-network-common = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } + sc-offchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } + sc-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } + sc-rpc-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } + sc-service = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } + sc-sysinfo = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } + sc-telemetry = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } + sc-tracing = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } + sc-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } + sc-transaction-pool-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } + sp-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } + sp-arithmetic = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } + sp-block-builder = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } + sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } + sp-consensus = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } + sp-consensus-aura = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } + sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } + sp-inherents = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } + sp-io = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } + sp-keyring = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } + sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } + sp-offchain = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } + sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } + sp-session = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } + sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } + sp-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } + sp-transaction-pool = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } + sp-version = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } + substrate-build-script-utils = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } + substrate-frame-rpc-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } + substrate-prometheus-endpoint = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } + substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } + try-runtime-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } [patch."https://github.com/paritytech/substrate"] -beefy-gadget = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -beefy-gadget-rpc = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -beefy-merkle-tree = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -frame-benchmarking = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -frame-benchmarking-cli = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -frame-election-provider-solution-type = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -frame-election-provider-support = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -frame-executive = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -frame-support = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -frame-support-procedural = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -frame-support-procedural-tools = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -frame-support-procedural-tools-derive = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -frame-system = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -frame-system-benchmarking = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -frame-system-rpc-runtime-api = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -frame-try-runtime = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -mmr-gadget = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -mmr-rpc = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -pallet-assets = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -pallet-aura = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -pallet-authority-discovery = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -pallet-authorship = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -pallet-babe = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -pallet-bags-list = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -pallet-balances = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -pallet-beefy = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -pallet-beefy-mmr = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -pallet-bounties = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -pallet-child-bounties = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -pallet-collective = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -pallet-conviction-voting = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -pallet-democracy = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -pallet-election-provider-multi-phase = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -pallet-election-provider-support-benchmarking = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -pallet-elections-phragmen = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -pallet-fast-unstake = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -pallet-grandpa = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -pallet-identity = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -pallet-im-online = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -pallet-indices = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -pallet-membership = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -pallet-mmr = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -pallet-multisig = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -pallet-nis = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -pallet-nomination-pools = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -pallet-nomination-pools-benchmarking = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -pallet-nomination-pools-runtime-api = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -pallet-offences = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -pallet-offences-benchmarking = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -pallet-preimage = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -pallet-proxy = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -pallet-ranked-collective = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -pallet-recovery = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -pallet-referenda = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -pallet-scheduler = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -pallet-session = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -pallet-session-benchmarking = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -pallet-society = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -pallet-staking = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -pallet-staking-reward-curve = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -pallet-staking-reward-fn = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -pallet-state-trie-migration = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -pallet-sudo = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -pallet-timestamp = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -pallet-tips = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -pallet-transaction-payment = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -pallet-transaction-payment-rpc = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -pallet-transaction-payment-rpc-runtime-api = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -pallet-treasury = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -pallet-utility = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -pallet-vesting = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -pallet-whitelist = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -sc-allocator = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -sc-authority-discovery = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -sc-basic-authorship = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -sc-block-builder = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -sc-chain-spec = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -sc-chain-spec-derive = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -sc-cli = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -sc-client-api = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -sc-client-db = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -sc-consensus = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -sc-consensus-aura = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -sc-consensus-babe = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -sc-consensus-babe-rpc = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -sc-consensus-epochs = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -sc-consensus-slots = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -sc-executor = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -sc-executor-common = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -sc-executor-wasmi = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -sc-executor-wasmtime = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -sc-finality-grandpa = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -sc-finality-grandpa-rpc = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -sc-informant = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -sc-keystore = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -sc-network = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -sc-network-common = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -sc-network-gossip = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -sc-offchain = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -sc-peerset = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -sc-proposer-metrics = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -sc-rpc = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -sc-rpc-api = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -sc-rpc-server = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -sc-service = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -sc-state-db = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -sc-sync-state-rpc = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -sc-sysinfo = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -sc-telemetry = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -sc-tracing = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -sc-tracing-proc-macro = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -sc-transaction-pool = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -sc-transaction-pool-api = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -sc-utils = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -sp-api = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -sp-api-proc-macro = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -sp-application-crypto = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -sp-arithmetic = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -sp-authority-discovery = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -sp-beefy = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -sp-block-builder = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -sp-blockchain = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -sp-consensus = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -sp-consensus-aura = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -sp-consensus-babe = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -sp-consensus-slots = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -sp-consensus-vrf = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -sp-core = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -sp-database = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -sp-debug-derive = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -sp-externalities = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -sp-finality-grandpa = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -sp-inherents = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -sp-io = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -sp-keyring = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -sp-keystore = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -sp-maybe-compressed-blob = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -sp-mmr-primitives = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -sp-npos-elections = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -sp-offchain = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -sp-panic-handler = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -sp-rpc = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -sp-runtime = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -sp-runtime-interface = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -sp-runtime-interface-proc-macro = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -sp-session = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -sp-staking = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -sp-state-machine = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -sp-std = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -sp-storage = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -sp-timestamp = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -sp-tracing = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -sp-transaction-pool = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -sp-transaction-storage-proof = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -sp-trie = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -sp-version = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -sp-version-proc-macro = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -sp-wasm-interface = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -sp-weights = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -substrate-build-script-utils = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -substrate-frame-rpc-system = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -substrate-prometheus-endpoint = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -substrate-rpc-client = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -substrate-state-trie-migration-rpc = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -substrate-wasm-builder = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } -try-runtime-cli = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.36" } +beefy-gadget = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +beefy-gadget-rpc = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +beefy-merkle-tree = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +frame-benchmarking = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +frame-benchmarking-cli = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +frame-election-provider-solution-type = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +frame-election-provider-support = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +frame-executive = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +frame-support = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +frame-support-procedural = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +frame-support-procedural-tools = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +frame-support-procedural-tools-derive = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +frame-system = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +frame-system-benchmarking = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +frame-system-rpc-runtime-api = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +frame-try-runtime = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +mmr-gadget = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +mmr-rpc = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +pallet-assets = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +pallet-aura = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +pallet-authority-discovery = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +pallet-authorship = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +pallet-babe = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +pallet-bags-list = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +pallet-balances = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +pallet-beefy = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +pallet-beefy-mmr = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +pallet-bounties = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +pallet-child-bounties = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +pallet-collective = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +pallet-conviction-voting = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +pallet-democracy = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +pallet-election-provider-multi-phase = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +pallet-election-provider-support-benchmarking = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +pallet-elections-phragmen = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +pallet-fast-unstake = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +pallet-grandpa = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +pallet-identity = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +pallet-im-online = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +pallet-indices = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +pallet-membership = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +pallet-mmr = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +pallet-multisig = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +pallet-nis = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +pallet-nomination-pools = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +pallet-nomination-pools-benchmarking = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +pallet-nomination-pools-runtime-api = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +pallet-offences = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +pallet-offences-benchmarking = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +pallet-preimage = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +pallet-proxy = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +pallet-ranked-collective = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +pallet-recovery = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +pallet-referenda = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +pallet-scheduler = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +pallet-session = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +pallet-session-benchmarking = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +pallet-society = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +pallet-staking = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +pallet-staking-reward-curve = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +pallet-staking-reward-fn = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +pallet-state-trie-migration = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +pallet-sudo = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +pallet-timestamp = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +pallet-tips = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +pallet-transaction-payment = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +pallet-transaction-payment-rpc = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +pallet-transaction-payment-rpc-runtime-api = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +pallet-treasury = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +pallet-utility = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +pallet-vesting = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +pallet-whitelist = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +sc-allocator = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +sc-authority-discovery = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +sc-basic-authorship = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +sc-block-builder = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +sc-chain-spec = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +sc-chain-spec-derive = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +sc-cli = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +sc-client-api = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +sc-client-db = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +sc-consensus = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +sc-consensus-aura = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +sc-consensus-babe = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +sc-consensus-babe-rpc = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +sc-consensus-epochs = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +sc-consensus-slots = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +sc-executor = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +sc-executor-common = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +sc-executor-wasmi = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +sc-executor-wasmtime = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +sc-finality-grandpa = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +sc-finality-grandpa-rpc = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +sc-informant = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +sc-keystore = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +sc-network = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +sc-network-common = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +sc-network-gossip = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +sc-offchain = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +sc-peerset = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +sc-proposer-metrics = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +sc-rpc = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +sc-rpc-api = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +sc-rpc-server = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +sc-service = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +sc-state-db = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +sc-sync-state-rpc = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +sc-sysinfo = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +sc-telemetry = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +sc-tracing = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +sc-tracing-proc-macro = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +sc-transaction-pool = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +sc-transaction-pool-api = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +sc-utils = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +sp-api = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +sp-api-proc-macro = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +sp-application-crypto = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +sp-arithmetic = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +sp-authority-discovery = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +sp-beefy = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +sp-block-builder = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +sp-blockchain = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +sp-consensus = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +sp-consensus-aura = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +sp-consensus-babe = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +sp-consensus-slots = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +sp-consensus-vrf = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +sp-core = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +sp-database = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +sp-debug-derive = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +sp-externalities = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +sp-finality-grandpa = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +sp-inherents = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +sp-io = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +sp-keyring = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +sp-keystore = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +sp-maybe-compressed-blob = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +sp-mmr-primitives = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +sp-npos-elections = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +sp-offchain = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +sp-panic-handler = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +sp-rpc = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +sp-runtime = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +sp-runtime-interface = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +sp-runtime-interface-proc-macro = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +sp-session = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +sp-staking = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +sp-state-machine = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +sp-std = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +sp-storage = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +sp-timestamp = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +sp-tracing = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +sp-transaction-pool = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +sp-transaction-storage-proof = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +sp-trie = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +sp-version = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +sp-version-proc-macro = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +sp-wasm-interface = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +sp-weights = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +substrate-build-script-utils = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +substrate-frame-rpc-system = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +substrate-prometheus-endpoint = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +substrate-rpc-client = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +substrate-state-trie-migration-rpc = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +substrate-wasm-builder = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } +try-runtime-cli = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } diff --git a/node/Cargo.toml b/node/Cargo.toml index 79e405702..472e6df3e 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -43,7 +43,7 @@ fc-cli = { workspace = true } fc-consensus = { workspace = true } fc-db = { workspace = true } fc-mapping-sync = { workspace = true } -fc-rpc = { features = ["rpc_binary_search_estimate"], workspace = true } +fc-rpc = { features = ["rpc-binary-search-estimate"], workspace = true } fc-rpc-core = { workspace = true } fp-evm = { workspace = true } fp-rpc = { workspace = true } diff --git a/node/src/command.rs b/node/src/command.rs index bab287d18..41000855f 100644 --- a/node/src/command.rs +++ b/node/src/command.rs @@ -614,24 +614,28 @@ pub fn run() -> Result<()> { let task_manager = TaskManager::new(runner.config().tokio_handle.clone(), *registry) .map_err(|e| format!("Error: {:?}", e))?; + #[cfg(feature = "crab-native")] if chain_spec.is_crab() { return runner.async_run(|_| { Ok((cmd.run::>(), task_manager)) }); } + #[cfg(feature = "darwinia-native")] if chain_spec.is_darwinia() { return runner.async_run(|_| { Ok((cmd.run::>(), task_manager)) }); } + #[cfg(feature = "pangolin-native")] if chain_spec.is_pangolin() { return runner.async_run(|_| { Ok((cmd.run::>(), task_manager)) }); } + #[cfg(feature = "pangoro-native")] if chain_spec.is_pangoro() { return runner.async_run(|_| { Ok((cmd.run::>(), task_manager)) diff --git a/pallet/account-migration/tests/mock.rs b/pallet/account-migration/tests/mock.rs index afcab1f14..91c737fdd 100644 --- a/pallet/account-migration/tests/mock.rs +++ b/pallet/account-migration/tests/mock.rs @@ -111,6 +111,7 @@ impl pallet_assets::Config for Runtime { type AssetId = AssetId; type AssetIdParameter = codec::Compact; type Balance = Balance; + type CallbackHandle = (); type CreateOrigin = frame_support::traits::AsEnsureOriginWithArg>; type Currency = Balances; diff --git a/pallet/deposit/tests/mock.rs b/pallet/deposit/tests/mock.rs index a28aea9c9..c00eca4e8 100644 --- a/pallet/deposit/tests/mock.rs +++ b/pallet/deposit/tests/mock.rs @@ -75,6 +75,7 @@ impl pallet_assets::Config for Runtime { type AssetId = AssetId; type AssetIdParameter = codec::Compact; type Balance = Balance; + type CallbackHandle = (); type CreateOrigin = frame_support::traits::AsEnsureOriginWithArg< frame_system::EnsureSignedBy, u32>, >; diff --git a/pallet/message-gadget/src/lib.rs b/pallet/message-gadget/src/lib.rs index e36ca4b40..9d4e2a21c 100644 --- a/pallet/message-gadget/src/lib.rs +++ b/pallet/message-gadget/src/lib.rs @@ -27,7 +27,7 @@ use frame_support::{log, pallet_prelude::*, traits::Get}; use frame_system::pallet_prelude::*; use sp_core::{H160, H256}; use sp_io::hashing; -use sp_std::vec; +use sp_std::prelude::*; #[frame_support::pallet] pub mod pallet { @@ -88,7 +88,7 @@ where None, None, None, - vec![], + Vec::new(), false, false, ::config(), diff --git a/pallet/message-gadget/tests/tests.rs b/pallet/message-gadget/tests/tests.rs index 800626b49..9eecd581a 100644 --- a/pallet/message-gadget/tests/tests.rs +++ b/pallet/message-gadget/tests/tests.rs @@ -76,6 +76,7 @@ impl pallet_evm::Config for Runtime { type FindAuthor = (); type GasWeightMapping = pallet_evm::FixedGasWeightMapping; type OnChargeTransaction = (); + type OnCreate = (); type PrecompilesType = (); type PrecompilesValue = (); type Runner = pallet_evm::runner::stack::Runner; diff --git a/pallet/message-transact/src/mock.rs b/pallet/message-transact/src/mock.rs index c6a9344b7..dd59e762a 100644 --- a/pallet/message-transact/src/mock.rs +++ b/pallet/message-transact/src/mock.rs @@ -125,6 +125,7 @@ impl pallet_evm::Config for TestRuntime { type FindAuthor = (); type GasWeightMapping = pallet_evm::FixedGasWeightMapping; type OnChargeTransaction = (); + type OnCreate = (); type PrecompilesType = (); type PrecompilesValue = (); type Runner = pallet_evm::runner::stack::Runner; diff --git a/pallet/staking/tests/mock.rs b/pallet/staking/tests/mock.rs index 91422e9fc..b7b0bae2c 100644 --- a/pallet/staking/tests/mock.rs +++ b/pallet/staking/tests/mock.rs @@ -77,6 +77,7 @@ impl pallet_assets::Config for Runtime { type AssetId = AssetId; type AssetIdParameter = codec::Compact; type Balance = Balance; + type CallbackHandle = (); type CreateOrigin = frame_support::traits::AsEnsureOriginWithArg< frame_system::EnsureSignedBy, u32>, >; diff --git a/precompile/assets/src/mock.rs b/precompile/assets/src/mock.rs index 41eba8fbb..775b00755 100644 --- a/precompile/assets/src/mock.rs +++ b/precompile/assets/src/mock.rs @@ -162,6 +162,7 @@ impl pallet_evm::Config for TestRuntime { type FindAuthor = (); type GasWeightMapping = pallet_evm::FixedGasWeightMapping; type OnChargeTransaction = (); + type OnCreate = (); type PrecompilesType = TestPrecompiles; type PrecompilesValue = PrecompilesValue; type Runner = pallet_evm::runner::stack::Runner; @@ -177,6 +178,7 @@ impl pallet_assets::Config for TestRuntime { type AssetId = AssetId; type AssetIdParameter = codec::Compact; type Balance = Balance; + type CallbackHandle = (); type CreateOrigin = frame_support::traits::AsEnsureOriginWithArg< frame_system::EnsureSignedBy, AccountId>, >; diff --git a/precompile/bls12-381/src/lib.rs b/precompile/bls12-381/src/lib.rs index 7016a9153..fbfa4b1e7 100644 --- a/precompile/bls12-381/src/lib.rs +++ b/precompile/bls12-381/src/lib.rs @@ -25,7 +25,7 @@ use milagro_bls::{AggregatePublicKey, AggregateSignature, PublicKey, Signature}; // moonbeam use precompile_utils::prelude::*; // substrate -use sp_std::vec::Vec; +use sp_std::prelude::*; pub(crate) const VERIFY_ESTIMATED_COST: u64 = 100_000; pub struct BLS12381(PhantomData); diff --git a/precompile/deposit/src/mock.rs b/precompile/deposit/src/mock.rs index 860170ffc..ee62615a5 100644 --- a/precompile/deposit/src/mock.rs +++ b/precompile/deposit/src/mock.rs @@ -164,6 +164,7 @@ impl pallet_evm::Config for TestRuntime { type FindAuthor = (); type GasWeightMapping = pallet_evm::FixedGasWeightMapping; type OnChargeTransaction = (); + type OnCreate = (); type PrecompilesType = TestPrecompiles; type PrecompilesValue = PrecompilesValue; type Runner = pallet_evm::runner::stack::Runner; diff --git a/precompile/staking/src/lib.rs b/precompile/staking/src/lib.rs index d5fef1e31..8724462e1 100644 --- a/precompile/staking/src/lib.rs +++ b/precompile/staking/src/lib.rs @@ -36,7 +36,7 @@ use frame_support::{ }; use sp_core::{H160, U256}; use sp_runtime::Perbill; -use sp_std::vec::Vec; +use sp_std::prelude::*; pub struct Staking(PhantomData); diff --git a/precompile/staking/src/mock.rs b/precompile/staking/src/mock.rs index 2ee0d9026..8062b4a3c 100644 --- a/precompile/staking/src/mock.rs +++ b/precompile/staking/src/mock.rs @@ -168,6 +168,7 @@ impl pallet_evm::Config for TestRuntime { type FindAuthor = (); type GasWeightMapping = pallet_evm::FixedGasWeightMapping; type OnChargeTransaction = (); + type OnCreate = (); type PrecompilesType = TestPrecompiles; type PrecompilesValue = PrecompilesValue; type Runner = pallet_evm::runner::stack::Runner; diff --git a/precompile/state-storage/src/mock.rs b/precompile/state-storage/src/mock.rs index a16bd2ed5..1e8a3cbdf 100644 --- a/precompile/state-storage/src/mock.rs +++ b/precompile/state-storage/src/mock.rs @@ -149,6 +149,7 @@ impl pallet_evm::Config for TestRuntime { type FindAuthor = (); type GasWeightMapping = pallet_evm::FixedGasWeightMapping; type OnChargeTransaction = (); + type OnCreate = (); type PrecompilesType = TestPrecompiles; type PrecompilesValue = PrecompilesValue; type Runner = pallet_evm::runner::stack::Runner; diff --git a/runtime/common/Cargo.toml b/runtime/common/Cargo.toml index 65a879853..b6b5238ef 100644 --- a/runtime/common/Cargo.toml +++ b/runtime/common/Cargo.toml @@ -28,6 +28,7 @@ xcm-executor = { workspace = true } # substrate frame-support = { workspace = true } frame-system = { workspace = true } +pallet-assets = { workspace = true } pallet-balances = { workspace = true } pallet-collective = { workspace = true } pallet-treasury = { workspace = true } @@ -58,6 +59,7 @@ std = [ # substrate "frame-support/std", "frame-system/std", + "pallet-assets/std", "pallet-balances/std", "pallet-collective/std", "pallet-treasury/std", @@ -67,3 +69,7 @@ std = [ ] test = [] + +runtime-benchmarks = [ + "pallet-assets/runtime-benchmarks" +] diff --git a/runtime/common/src/lib.rs b/runtime/common/src/lib.rs index 3952e1960..4f1c1c52a 100644 --- a/runtime/common/src/lib.rs +++ b/runtime/common/src/lib.rs @@ -204,3 +204,13 @@ macro_rules! impl_self_contained_call { } }; } + +/// Helper for pallet-assets benchmarking. +#[cfg(feature = "runtime-benchmarks")] +pub struct AssetsBenchmarkHelper; +#[cfg(feature = "runtime-benchmarks")] +impl pallet_assets::BenchmarkHelper> for AssetsBenchmarkHelper { + fn create_asset_id_parameter(id: u32) -> codec::Compact { + u64::from(id).into() + } +} diff --git a/runtime/crab/Cargo.toml b/runtime/crab/Cargo.toml index 9ff8066f5..4c70f0e37 100644 --- a/runtime/crab/Cargo.toml +++ b/runtime/crab/Cargo.toml @@ -257,6 +257,9 @@ runtime-benchmarks = [ # cumulus optional "cumulus-pallet-session-benchmarking/runtime-benchmarks", + # darwinia + "darwinia-common-runtime/runtime-benchmarks", + # darwinia-messages-substrate "bridge-runtime-common/runtime-benchmarks", "pallet-bridge-grandpa/runtime-benchmarks", diff --git a/runtime/crab/src/lib.rs b/runtime/crab/src/lib.rs index 93193bdd9..bb1691008 100644 --- a/runtime/crab/src/lib.rs +++ b/runtime/crab/src/lib.rs @@ -172,7 +172,6 @@ frame_benchmarking::define_benchmarks! { [pallet_balances, Balances] [pallet_session, SessionBench::] [pallet_timestamp, Timestamp] - [pallet_collator_selection, CollatorSelection] [cumulus_pallet_xcmp_queue, XcmpQueue] } @@ -547,7 +546,7 @@ sp_api::impl_runtime_apis! { #[cfg(feature = "try-runtime")] impl frame_try_runtime::TryRuntime for Runtime { - fn on_runtime_upgrade(checks: bool) -> (Weight, frame_support::weights::Weight) { + fn on_runtime_upgrade(checks: frame_try_runtime::UpgradeCheckSelect) -> (frame_support::weights::Weight, frame_support::weights::Weight) { // substrate use frame_support::log; @@ -563,7 +562,7 @@ sp_api::impl_runtime_apis! { state_root_check: bool, signature_check: bool, select: frame_try_runtime::TryStateSelect, - ) -> Weight { + ) -> frame_support::weights::Weight { // NOTE: intentional unwrap: we don't want to propagate the error backwards, and want to // have a backtrace here. Executive::try_execute_block(block, state_root_check, signature_check, select).unwrap() diff --git a/runtime/crab/src/pallets/assets.rs b/runtime/crab/src/pallets/assets.rs index 73f6c29f8..d1a47f55f 100644 --- a/runtime/crab/src/pallets/assets.rs +++ b/runtime/crab/src/pallets/assets.rs @@ -36,7 +36,8 @@ impl pallet_assets::Config for Runtime { type AssetIdParameter = codec::Compact; type Balance = Balance; #[cfg(feature = "runtime-benchmarks")] - type BenchmarkHelper = (); + type BenchmarkHelper = AssetsBenchmarkHelper; + type CallbackHandle = (); type CreateOrigin = frame_support::traits::AsEnsureOriginWithArg< frame_system::EnsureSignedBy, AccountId>, >; diff --git a/runtime/crab/src/pallets/evm.rs b/runtime/crab/src/pallets/evm.rs index cbdb9578a..9718f62e8 100644 --- a/runtime/crab/src/pallets/evm.rs +++ b/runtime/crab/src/pallets/evm.rs @@ -181,6 +181,7 @@ impl pallet_evm::Config for Runtime { type FindAuthor = FindAuthorTruncated; type GasWeightMapping = pallet_evm::FixedGasWeightMapping; type OnChargeTransaction = (); + type OnCreate = (); type PrecompilesType = CrabPrecompiles; type PrecompilesValue = PrecompilesValue; type Runner = pallet_evm::runner::stack::Runner; diff --git a/runtime/crab/src/pallets/proxy.rs b/runtime/crab/src/pallets/proxy.rs index 866900465..1354085a5 100644 --- a/runtime/crab/src/pallets/proxy.rs +++ b/runtime/crab/src/pallets/proxy.rs @@ -78,7 +78,9 @@ impl frame_support::traits::InstanceFilter for ProxyType { ProxyType::Staking => { matches!( c, - RuntimeCall::Session(..) | RuntimeCall::Deposit(..) | RuntimeCall::DarwiniaStaking(..) + RuntimeCall::Session(..) + | RuntimeCall::Deposit(..) + | RuntimeCall::DarwiniaStaking(..) ) }, ProxyType::IdentityJudgement => diff --git a/runtime/darwinia/Cargo.toml b/runtime/darwinia/Cargo.toml index e766d0a7e..40c7ee032 100644 --- a/runtime/darwinia/Cargo.toml +++ b/runtime/darwinia/Cargo.toml @@ -258,6 +258,9 @@ runtime-benchmarks = [ # cumulus optional "cumulus-pallet-session-benchmarking/runtime-benchmarks", + # darwinia + "darwinia-common-runtime/runtime-benchmarks", + # darwinia-messages-substrate "bridge-runtime-common/runtime-benchmarks", "pallet-bridge-grandpa/runtime-benchmarks", diff --git a/runtime/darwinia/src/lib.rs b/runtime/darwinia/src/lib.rs index 761def089..ba7674422 100644 --- a/runtime/darwinia/src/lib.rs +++ b/runtime/darwinia/src/lib.rs @@ -172,7 +172,6 @@ frame_benchmarking::define_benchmarks! { [pallet_balances, Balances] [pallet_session, SessionBench::] [pallet_timestamp, Timestamp] - [pallet_collator_selection, CollatorSelection] [cumulus_pallet_xcmp_queue, XcmpQueue] } @@ -548,7 +547,7 @@ sp_api::impl_runtime_apis! { #[cfg(feature = "try-runtime")] impl frame_try_runtime::TryRuntime for Runtime { - fn on_runtime_upgrade(checks: bool) -> (Weight, frame_support::weights::Weight) { + fn on_runtime_upgrade(checks: frame_try_runtime::UpgradeCheckSelect) -> (frame_support::weights::Weight, frame_support::weights::Weight) { // substrate use frame_support::log; @@ -564,7 +563,7 @@ sp_api::impl_runtime_apis! { state_root_check: bool, signature_check: bool, select: frame_try_runtime::TryStateSelect, - ) -> Weight { + ) -> frame_support::weights::Weight { // NOTE: intentional unwrap: we don't want to propagate the error backwards, and want to // have a backtrace here. Executive::try_execute_block(block, state_root_check, signature_check, select).unwrap() diff --git a/runtime/darwinia/src/pallets/assets.rs b/runtime/darwinia/src/pallets/assets.rs index ebd52e789..a2cd311b7 100644 --- a/runtime/darwinia/src/pallets/assets.rs +++ b/runtime/darwinia/src/pallets/assets.rs @@ -36,7 +36,8 @@ impl pallet_assets::Config for Runtime { type AssetIdParameter = codec::Compact; type Balance = Balance; #[cfg(feature = "runtime-benchmarks")] - type BenchmarkHelper = (); + type BenchmarkHelper = AssetsBenchmarkHelper; + type CallbackHandle = (); type CreateOrigin = frame_support::traits::AsEnsureOriginWithArg< frame_system::EnsureSignedBy, AccountId>, >; diff --git a/runtime/darwinia/src/pallets/evm.rs b/runtime/darwinia/src/pallets/evm.rs index 4a6d3f967..397516018 100644 --- a/runtime/darwinia/src/pallets/evm.rs +++ b/runtime/darwinia/src/pallets/evm.rs @@ -181,6 +181,7 @@ impl pallet_evm::Config for Runtime { type FindAuthor = FindAuthorTruncated; type GasWeightMapping = pallet_evm::FixedGasWeightMapping; type OnChargeTransaction = (); + type OnCreate = (); type PrecompilesType = DarwiniaPrecompiles; type PrecompilesValue = PrecompilesValue; type Runner = pallet_evm::runner::stack::Runner; diff --git a/runtime/darwinia/src/pallets/proxy.rs b/runtime/darwinia/src/pallets/proxy.rs index ccacf162b..c571d5f14 100644 --- a/runtime/darwinia/src/pallets/proxy.rs +++ b/runtime/darwinia/src/pallets/proxy.rs @@ -78,7 +78,9 @@ impl frame_support::traits::InstanceFilter for ProxyType { ProxyType::Staking => { matches!( c, - RuntimeCall::Session(..) | RuntimeCall::Deposit(..) | RuntimeCall::DarwiniaStaking(..) + RuntimeCall::Session(..) + | RuntimeCall::Deposit(..) + | RuntimeCall::DarwiniaStaking(..) ) }, ProxyType::IdentityJudgement => diff --git a/runtime/pangolin/Cargo.toml b/runtime/pangolin/Cargo.toml index c0983e38b..b48121080 100644 --- a/runtime/pangolin/Cargo.toml +++ b/runtime/pangolin/Cargo.toml @@ -256,6 +256,9 @@ runtime-benchmarks = [ # cumulus optional "cumulus-pallet-session-benchmarking/runtime-benchmarks", + # darwinia + "darwinia-common-runtime/runtime-benchmarks", + # darwinia-messages-substrate "bridge-runtime-common/runtime-benchmarks", "pallet-bridge-grandpa/runtime-benchmarks", diff --git a/runtime/pangolin/src/lib.rs b/runtime/pangolin/src/lib.rs index 5b5f8e1c8..73c1c9885 100644 --- a/runtime/pangolin/src/lib.rs +++ b/runtime/pangolin/src/lib.rs @@ -163,7 +163,6 @@ frame_benchmarking::define_benchmarks! { [pallet_balances, Balances] [pallet_session, SessionBench::] [pallet_timestamp, Timestamp] - [pallet_collator_selection, CollatorSelection] [cumulus_pallet_xcmp_queue, XcmpQueue] } @@ -529,7 +528,7 @@ sp_api::impl_runtime_apis! { #[cfg(feature = "try-runtime")] impl frame_try_runtime::TryRuntime for Runtime { - fn on_runtime_upgrade(checks: bool) -> (Weight, frame_support::weights::Weight) { + fn on_runtime_upgrade(checks: frame_try_runtime::UpgradeCheckSelect) -> (frame_support::weights::Weight, frame_support::weights::Weight) { // substrate use frame_support::log; @@ -545,7 +544,7 @@ sp_api::impl_runtime_apis! { state_root_check: bool, signature_check: bool, select: frame_try_runtime::TryStateSelect, - ) -> Weight { + ) -> frame_support::weights::Weight { // NOTE: intentional unwrap: we don't want to propagate the error backwards, and want to // have a backtrace here. Executive::try_execute_block(block, state_root_check, signature_check, select).unwrap() diff --git a/runtime/pangolin/src/migration.rs b/runtime/pangolin/src/migration.rs index f725e52b7..d4e49525f 100644 --- a/runtime/pangolin/src/migration.rs +++ b/runtime/pangolin/src/migration.rs @@ -1,12 +1,13 @@ // darwinia #[allow(unused_imports)] use crate::*; +// substrate pub struct CustomOnRuntimeUpgrade; impl frame_support::traits::OnRuntimeUpgrade for CustomOnRuntimeUpgrade { #[cfg(feature = "try-runtime")] - fn pre_upgrade() -> Result<(), &'static str> { - Ok(()) + fn pre_upgrade() -> Result, &'static str> { + Ok(Vec::new()) } #[cfg(feature = "try-runtime")] diff --git a/runtime/pangolin/src/pallets/assets.rs b/runtime/pangolin/src/pallets/assets.rs index 1dc4dd543..dfe936635 100644 --- a/runtime/pangolin/src/pallets/assets.rs +++ b/runtime/pangolin/src/pallets/assets.rs @@ -36,7 +36,8 @@ impl pallet_assets::Config for Runtime { type AssetIdParameter = codec::Compact; type Balance = Balance; #[cfg(feature = "runtime-benchmarks")] - type BenchmarkHelper = (); + type BenchmarkHelper = AssetsBenchmarkHelper; + type CallbackHandle = (); type CreateOrigin = frame_support::traits::AsEnsureOriginWithArg< frame_system::EnsureSignedBy, AccountId>, >; diff --git a/runtime/pangolin/src/pallets/evm.rs b/runtime/pangolin/src/pallets/evm.rs index 138e263bb..1880c402f 100644 --- a/runtime/pangolin/src/pallets/evm.rs +++ b/runtime/pangolin/src/pallets/evm.rs @@ -181,6 +181,7 @@ impl pallet_evm::Config for Runtime { type FindAuthor = FindAuthorTruncated; type GasWeightMapping = pallet_evm::FixedGasWeightMapping; type OnChargeTransaction = (); + type OnCreate = (); type PrecompilesType = PangolinPrecompiles; type PrecompilesValue = PrecompilesValue; type Runner = pallet_evm::runner::stack::Runner; diff --git a/runtime/pangolin/src/pallets/proxy.rs b/runtime/pangolin/src/pallets/proxy.rs index 9da74c43d..dae6ddf4c 100644 --- a/runtime/pangolin/src/pallets/proxy.rs +++ b/runtime/pangolin/src/pallets/proxy.rs @@ -77,7 +77,9 @@ impl frame_support::traits::InstanceFilter for ProxyType { ProxyType::Staking => { matches!( c, - RuntimeCall::Session(..) | RuntimeCall::Deposit(..) | RuntimeCall::DarwiniaStaking(..) + RuntimeCall::Session(..) + | RuntimeCall::Deposit(..) + | RuntimeCall::DarwiniaStaking(..) ) }, ProxyType::IdentityJudgement => diff --git a/runtime/pangoro/Cargo.toml b/runtime/pangoro/Cargo.toml index d474ca305..8a18bf2e7 100644 --- a/runtime/pangoro/Cargo.toml +++ b/runtime/pangoro/Cargo.toml @@ -256,6 +256,9 @@ runtime-benchmarks = [ # cumulus optional "cumulus-pallet-session-benchmarking/runtime-benchmarks", + # darwinia + "darwinia-common-runtime/runtime-benchmarks", + # darwinia-messages-substrate "bridge-runtime-common/runtime-benchmarks", "pallet-bridge-grandpa/runtime-benchmarks", diff --git a/runtime/pangoro/src/lib.rs b/runtime/pangoro/src/lib.rs index e0169758d..1b1559f68 100644 --- a/runtime/pangoro/src/lib.rs +++ b/runtime/pangoro/src/lib.rs @@ -163,7 +163,6 @@ frame_benchmarking::define_benchmarks! { [pallet_balances, Balances] [pallet_session, SessionBench::] [pallet_timestamp, Timestamp] - [pallet_collator_selection, CollatorSelection] [cumulus_pallet_xcmp_queue, XcmpQueue] } @@ -529,7 +528,7 @@ sp_api::impl_runtime_apis! { #[cfg(feature = "try-runtime")] impl frame_try_runtime::TryRuntime for Runtime { - fn on_runtime_upgrade(checks: bool) -> (Weight, frame_support::weights::Weight) { + fn on_runtime_upgrade(checks: frame_try_runtime::UpgradeCheckSelect) -> (frame_support::weights::Weight, frame_support::weights::Weight) { // substrate use frame_support::log; @@ -545,7 +544,7 @@ sp_api::impl_runtime_apis! { state_root_check: bool, signature_check: bool, select: frame_try_runtime::TryStateSelect, - ) -> Weight { + ) -> frame_support::weights::Weight { // NOTE: intentional unwrap: we don't want to propagate the error backwards, and want to // have a backtrace here. Executive::try_execute_block(block, state_root_check, signature_check, select).unwrap() diff --git a/runtime/pangoro/src/migration.rs b/runtime/pangoro/src/migration.rs index f453df013..4650e4bba 100644 --- a/runtime/pangoro/src/migration.rs +++ b/runtime/pangoro/src/migration.rs @@ -23,8 +23,8 @@ use crate::*; pub struct CustomOnRuntimeUpgrade; impl frame_support::traits::OnRuntimeUpgrade for CustomOnRuntimeUpgrade { #[cfg(feature = "try-runtime")] - fn pre_upgrade() -> Result<(), &'static str> { - Ok(()) + fn pre_upgrade() -> Result, &'static str> { + Ok(Vec::new()) } #[cfg(feature = "try-runtime")] diff --git a/runtime/pangoro/src/pallets/assets.rs b/runtime/pangoro/src/pallets/assets.rs index 9dc10c67c..f52fb39b1 100644 --- a/runtime/pangoro/src/pallets/assets.rs +++ b/runtime/pangoro/src/pallets/assets.rs @@ -36,7 +36,8 @@ impl pallet_assets::Config for Runtime { type AssetIdParameter = codec::Compact; type Balance = Balance; #[cfg(feature = "runtime-benchmarks")] - type BenchmarkHelper = (); + type BenchmarkHelper = AssetsBenchmarkHelper; + type CallbackHandle = (); type CreateOrigin = frame_support::traits::AsEnsureOriginWithArg< frame_system::EnsureSignedBy, AccountId>, >; diff --git a/runtime/pangoro/src/pallets/evm.rs b/runtime/pangoro/src/pallets/evm.rs index 8c8c68452..1559df6db 100644 --- a/runtime/pangoro/src/pallets/evm.rs +++ b/runtime/pangoro/src/pallets/evm.rs @@ -181,6 +181,7 @@ impl pallet_evm::Config for Runtime { type FindAuthor = FindAuthorTruncated; type GasWeightMapping = pallet_evm::FixedGasWeightMapping; type OnChargeTransaction = (); + type OnCreate = (); type PrecompilesType = PangoroPrecompiles; type PrecompilesValue = PrecompilesValue; type Runner = pallet_evm::runner::stack::Runner; diff --git a/runtime/pangoro/src/pallets/proxy.rs b/runtime/pangoro/src/pallets/proxy.rs index 9da74c43d..dae6ddf4c 100644 --- a/runtime/pangoro/src/pallets/proxy.rs +++ b/runtime/pangoro/src/pallets/proxy.rs @@ -77,7 +77,9 @@ impl frame_support::traits::InstanceFilter for ProxyType { ProxyType::Staking => { matches!( c, - RuntimeCall::Session(..) | RuntimeCall::Deposit(..) | RuntimeCall::DarwiniaStaking(..) + RuntimeCall::Session(..) + | RuntimeCall::Deposit(..) + | RuntimeCall::DarwiniaStaking(..) ) }, ProxyType::IdentityJudgement => From 59e08eec9b67c785c4c9d2c07995eefd9b806424 Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Wed, 15 Feb 2023 18:24:33 +0800 Subject: [PATCH 145/189] Pangolin2 `6005` runtime upgrade (#283) * Update Pangolin CI * Bump runtime version --- .github/workflows/checks.yml | 2 +- runtime/pangolin/src/lib.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index b0f64fd44..d05703ba9 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -100,7 +100,7 @@ jobs: [ { chain: darwinia-dev, compare-with: "https://rpc.polkadot.io" }, { chain: crab-dev, compare-with: "https://rpc.polkadot.io" }, - { chain: pangolin-dev, compare-with: "https://rpc.polkadot.io" }, + { chain: pangolin-dev, compare-with: "https://pangolin-rpc.darwinia.netowrk" }, ] needs: [basic-checks] runs-on: ubuntu-latest diff --git a/runtime/pangolin/src/lib.rs b/runtime/pangolin/src/lib.rs index 73c1c9885..d03cc8ff2 100644 --- a/runtime/pangolin/src/lib.rs +++ b/runtime/pangolin/src/lib.rs @@ -81,7 +81,7 @@ pub const VERSION: sp_version::RuntimeVersion = sp_version::RuntimeVersion { spec_name: sp_runtime::create_runtime_str!("Pangolin2"), impl_name: sp_runtime::create_runtime_str!("DarwiniaOfficialRust"), authoring_version: 0, - spec_version: 6_0_0_2, + spec_version: 6_0_0_5, impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 0, From a3403ceffa9995fa4e33708f29feb5179f00ac47 Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Thu, 16 Feb 2023 10:57:19 +0800 Subject: [PATCH 146/189] Set payout fraction to 40% (#284) * Set payout fraction to 40% * Format Signed-off-by: Xavier Lau --------- Signed-off-by: Xavier Lau --- pallet/staking/tests/mock.rs | 2 +- pallet/staking/tests/tests.rs | 24 ++++++++++++------------ precompile/staking/src/mock.rs | 2 +- runtime/crab/src/pallets/staking.rs | 2 +- runtime/darwinia/src/pallets/staking.rs | 2 +- runtime/pangolin/src/pallets/staking.rs | 2 +- runtime/pangoro/src/pallets/staking.rs | 2 +- 7 files changed, 18 insertions(+), 18 deletions(-) diff --git a/pallet/staking/tests/mock.rs b/pallet/staking/tests/mock.rs index b7b0bae2c..e1574aa3d 100644 --- a/pallet/staking/tests/mock.rs +++ b/pallet/staking/tests/mock.rs @@ -223,7 +223,7 @@ impl darwinia_staking::Stake for KtonStaking { } } frame_support::parameter_types! { - pub const PayoutFraction: sp_runtime::Perbill = sp_runtime::Perbill::from_percent(20); + pub const PayoutFraction: sp_runtime::Perbill = sp_runtime::Perbill::from_percent(40); } impl darwinia_staking::Config for Runtime { type Deposit = Deposit; diff --git a/pallet/staking/tests/tests.rs b/pallet/staking/tests/tests.rs index 048eb10d0..209282298 100644 --- a/pallet/staking/tests/tests.rs +++ b/pallet/staking/tests/tests.rs @@ -543,16 +543,16 @@ fn payout_should_work() { let session_duration = Duration::new(6 * 60 * 60, 0).as_millis(); Staking::payout(session_duration, Staking::elapsed_time()); let rewards = [ - 683_059_435_062_369_982_561_u128, - 1_275_044_256_196_592_252_422, - 1_775_954_509_850_707_836_449, - 2_185_790_171_434_577_367_478, - 2_504_551_227_287_012_308_196, - 2_049_178_272_400_257_458_130, - 1_457_193_451_266_035_188_269, - 956_283_197_611_919_604_242, - 546_447_536_028_050_073_213, - 227_686_480_175_615_132_495, + 1_366_118_870_124_739_965_121_u128, + 2_550_088_512_393_184_504_844, + 3_551_909_019_701_415_672_898, + 4_371_580_342_869_154_734_956, + 5_009_102_454_574_024_616_391, + 4_098_356_544_800_514_916_261, + 2_914_386_902_532_070_376_538, + 1_912_566_395_223_839_208_483, + 1_092_895_072_056_100_146_426, + 455_372_960_351_230_264_991, ]; (1..=10) .zip(rewards.iter()) @@ -566,8 +566,8 @@ fn payout_should_work() { ) .unwrap(), rewards.iter().sum::(), - // Error rate 0.02 RING - 2 * UNIT / 100 + // Error rate 0.1 RING. + UNIT / 10 ); }); } diff --git a/precompile/staking/src/mock.rs b/precompile/staking/src/mock.rs index 8062b4a3c..b7ef3374e 100644 --- a/precompile/staking/src/mock.rs +++ b/precompile/staking/src/mock.rs @@ -178,7 +178,7 @@ impl pallet_evm::Config for TestRuntime { } frame_support::parameter_types! { - pub const PayoutFraction: sp_runtime::Perbill = sp_runtime::Perbill::from_percent(20); + pub const PayoutFraction: sp_runtime::Perbill = sp_runtime::Perbill::from_percent(40); } pub enum RingStaking {} diff --git a/runtime/crab/src/pallets/staking.rs b/runtime/crab/src/pallets/staking.rs index 2abda17e3..f7fc924b5 100644 --- a/runtime/crab/src/pallets/staking.rs +++ b/runtime/crab/src/pallets/staking.rs @@ -69,7 +69,7 @@ impl darwinia_staking::Stake for KtonStaking { } frame_support::parameter_types! { - pub const PayoutFraction: sp_runtime::Perbill = sp_runtime::Perbill::from_percent(20); + pub const PayoutFraction: sp_runtime::Perbill = sp_runtime::Perbill::from_percent(40); } impl darwinia_staking::Config for Runtime { diff --git a/runtime/darwinia/src/pallets/staking.rs b/runtime/darwinia/src/pallets/staking.rs index 7d3aa2d50..4ade2ee4a 100644 --- a/runtime/darwinia/src/pallets/staking.rs +++ b/runtime/darwinia/src/pallets/staking.rs @@ -69,7 +69,7 @@ impl darwinia_staking::Stake for KtonStaking { } frame_support::parameter_types! { - pub const PayoutFraction: sp_runtime::Perbill = sp_runtime::Perbill::from_percent(20); + pub const PayoutFraction: sp_runtime::Perbill = sp_runtime::Perbill::from_percent(40); } impl darwinia_staking::Config for Runtime { diff --git a/runtime/pangolin/src/pallets/staking.rs b/runtime/pangolin/src/pallets/staking.rs index 0c76fe413..9760508e9 100644 --- a/runtime/pangolin/src/pallets/staking.rs +++ b/runtime/pangolin/src/pallets/staking.rs @@ -69,7 +69,7 @@ impl darwinia_staking::Stake for KtonStaking { } frame_support::parameter_types! { - pub const PayoutFraction: sp_runtime::Perbill = sp_runtime::Perbill::from_percent(20); + pub const PayoutFraction: sp_runtime::Perbill = sp_runtime::Perbill::from_percent(40); } impl darwinia_staking::Config for Runtime { diff --git a/runtime/pangoro/src/pallets/staking.rs b/runtime/pangoro/src/pallets/staking.rs index 50e17ac96..a3ead0738 100644 --- a/runtime/pangoro/src/pallets/staking.rs +++ b/runtime/pangoro/src/pallets/staking.rs @@ -69,7 +69,7 @@ impl darwinia_staking::Stake for KtonStaking { } frame_support::parameter_types! { - pub const PayoutFraction: sp_runtime::Perbill = sp_runtime::Perbill::from_percent(20); + pub const PayoutFraction: sp_runtime::Perbill = sp_runtime::Perbill::from_percent(40); } impl darwinia_staking::Config for Runtime { From 62c77fd9f10e3efe0d528fb3ad37098b07e6a721 Mon Sep 17 00:00:00 2001 From: bear Date: Thu, 16 Feb 2023 11:42:48 +0800 Subject: [PATCH 147/189] Add evm estimate gas tests (#282) * Add estimate gas tests * Fix CI --- .github/workflows/checks.yml | 1 + tests/ethereum/test-gas.ts | 33 ++++++++++++++++++++++++++++++++- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index d05703ba9..e1e31e960 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -15,6 +15,7 @@ on: - main paths: - "**.rs" + - "**.ts" - "**.toml" - "**lock" - "**.json" diff --git a/tests/ethereum/test-gas.ts b/tests/ethereum/test-gas.ts index df00fab41..d5ce48818 100644 --- a/tests/ethereum/test-gas.ts +++ b/tests/ethereum/test-gas.ts @@ -2,7 +2,14 @@ import Web3 from "web3"; import { describe } from "mocha"; import { step } from "mocha-steps"; import { expect } from "chai"; -import { HOST_HTTP_URL, FAITH, FAITH_P, EXTRINSIC_GAS_LIMIT, customRequest } from "../config"; +import { + HOST_HTTP_URL, + FAITH, + FAITH_P, + EXTRINSIC_GAS_LIMIT, + customRequest, + DEFAULT_GAS, +} from "../config"; import { incrementerInfo } from "./contracts/contracts_info"; import { AbiItem } from "web3-utils"; @@ -12,6 +19,30 @@ describe("Test transaction gas limit", () => { const inc = new web3.eth.Contract(incrementerInfo.abi as AbiItem[]); const data = inc.deploy({ data: incrementerInfo.bytecode, arguments: [5] }); + it("Test contract create estimate gas", async () => { + expect( + await web3.eth.estimateGas({ + from: FAITH, + data: data.encodeABI(), + }) + ).to.equal(144926); + }).timeout(60000); + + it("Test contract call estimate gas", async () => { + let tx = await web3.eth.accounts.signTransaction( + { + from: FAITH, + data: data.encodeABI(), + gas: DEFAULT_GAS, + }, + FAITH_P + ); + let receipt = await web3.eth.sendSignedTransaction(tx.rawTransaction); + inc.options.address = receipt.contractAddress; + + expect(await inc.methods.increment(3).estimateGas()).to.equal(28340); + }).timeout(60000); + it("Test transaction gas limit < `EXTRINSIC_GAS_LIMIT`", async () => { let tx = await web3.eth.accounts.signTransaction( { From 19f643c84f66bdbc7fc9a3c019c4b79b32d86532 Mon Sep 17 00:00:00 2001 From: bear Date: Fri, 17 Feb 2023 12:12:46 +0800 Subject: [PATCH 148/189] Fix ethereum block author (#286) * Fix ethereum block author * Move some structs to the common folder * Fix CI test * Clean --- Cargo.lock | 3 ++ runtime/common/Cargo.toml | 12 +++++++- runtime/common/src/lib.rs | 27 ++++++++++++++++++ runtime/crab/src/pallets/evm.rs | 42 +-------------------------- runtime/darwinia/src/pallets/evm.rs | 41 +-------------------------- runtime/pangolin/src/pallets/evm.rs | 42 +-------------------------- runtime/pangoro/src/pallets/evm.rs | 44 +---------------------------- tests/config.ts | 1 + tests/ethereum/test-constants.ts | 9 ++---- 9 files changed, 49 insertions(+), 172 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 361af4c6b..15f7014b7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2386,15 +2386,18 @@ version = "6.0.0" dependencies = [ "account", "bp-darwinia-core", + "darwinia-precompile-assets", "dc-primitives", "frame-support", "frame-system", "pallet-assets", "pallet-balances", "pallet-collective", + "pallet-evm", "pallet-treasury", "parity-scale-codec", "smallvec", + "sp-core", "sp-io", "sp-runtime", "sp-std", diff --git a/runtime/common/Cargo.toml b/runtime/common/Cargo.toml index b6b5238ef..41842922c 100644 --- a/runtime/common/Cargo.toml +++ b/runtime/common/Cargo.toml @@ -12,11 +12,15 @@ codec = { package = "parity-scale-codec", workspace = true } smallvec = { version = "1.10" } # darwinia -dc-primitives = { workspace = true } +darwinia-precompile-assets = { workspace = true } +dc-primitives = { workspace = true } # darwinia-messages-substrate bp-darwinia-core = { workspace = true } +# frontier +pallet-evm = { workspace = true } + # moonbeam account = { workspace = true } @@ -32,6 +36,7 @@ pallet-assets = { workspace = true } pallet-balances = { workspace = true } pallet-collective = { workspace = true } pallet-treasury = { workspace = true } +sp-core = { workspace = true } sp-io = { workspace = true } sp-runtime = { workspace = true } sp-std = { workspace = true } @@ -43,11 +48,15 @@ std = [ "codec/std", # darwinia + "darwinia-precompile-assets/std", "dc-primitives/std", # darwinia-messages-substrate "bp-darwinia-core/std", + # frontier + "pallet-evm/std", + # moonbeam "account/std", @@ -63,6 +72,7 @@ std = [ "pallet-balances/std", "pallet-collective/std", "pallet-treasury/std", + "sp-core/std", "sp-io/std", "sp-runtime/std", "sp-std/std", diff --git a/runtime/common/src/lib.rs b/runtime/common/src/lib.rs index 4f1c1c52a..ec3a5cf67 100644 --- a/runtime/common/src/lib.rs +++ b/runtime/common/src/lib.rs @@ -205,6 +205,33 @@ macro_rules! impl_self_contained_call { }; } +pub struct DarwiniaFindAuthor(sp_std::marker::PhantomData); +impl frame_support::traits::FindAuthor for DarwiniaFindAuthor +where + Inner: frame_support::traits::FindAuthor, +{ + fn find_author<'a, I>(digests: I) -> Option + where + I: 'a + IntoIterator, + { + Inner::find_author(digests).map(Into::into) + } +} + +pub struct FixedGasPrice; +impl pallet_evm::FeeCalculator for FixedGasPrice { + fn min_gas_price() -> (sp_core::U256, frame_support::weights::Weight) { + (sp_core::U256::from(GWEI), frame_support::weights::Weight::zero()) + } +} + +pub struct AssetIdConverter; +impl darwinia_precompile_assets::AccountToAssetId for AssetIdConverter { + fn account_to_asset_id(account_id: AccountId) -> AssetId { + let addr: sp_core::H160 = account_id.into(); + addr.to_low_u64_be() + } +} /// Helper for pallet-assets benchmarking. #[cfg(feature = "runtime-benchmarks")] pub struct AssetsBenchmarkHelper; diff --git a/runtime/crab/src/pallets/evm.rs b/runtime/crab/src/pallets/evm.rs index 9718f62e8..a370d5f07 100644 --- a/runtime/crab/src/pallets/evm.rs +++ b/runtime/crab/src/pallets/evm.rs @@ -29,38 +29,6 @@ frame_support::parameter_types! { pub WeightPerGas: frame_support::weights::Weight = frame_support::weights::Weight::from_ref_time(WEIGHT_PER_GAS); } -pub struct FindAuthorTruncated(sp_std::marker::PhantomData); -impl> frame_support::traits::FindAuthor - for FindAuthorTruncated -{ - fn find_author<'a, I>(digests: I) -> Option - where - I: 'a + IntoIterator, - { - // substrate - use sp_core::crypto::ByteArray; - - F::find_author(digests).and_then(|i| { - Aura::authorities().get(i as usize).and_then(|id| { - let raw = id.to_raw_vec(); - - if raw.len() >= 24 { - Some(sp_core::H160::from_slice(&raw[4..24])) - } else { - None - } - }) - }) - } -} - -pub struct FixedGasPrice; -impl pallet_evm::FeeCalculator for FixedGasPrice { - fn min_gas_price() -> (sp_core::U256, frame_support::weights::Weight) { - (sp_core::U256::from(GWEI), frame_support::weights::Weight::zero()) - } -} - // TODO: Integrate to the upstream repo pub struct FromH160; impl pallet_evm::AddressMapping for FromH160 @@ -72,14 +40,6 @@ where } } -pub struct AssetIdConverter; -impl darwinia_precompile_assets::AccountToAssetId for AssetIdConverter { - fn account_to_asset_id(account_id: AccountId) -> AssetId { - let addr: sp_core::H160 = account_id.into(); - addr.to_low_u64_be() - } -} - pub struct CrabPrecompiles(sp_std::marker::PhantomData); impl CrabPrecompiles where @@ -178,7 +138,7 @@ impl pallet_evm::Config for Runtime { type ChainId = ConstU64<44>; type Currency = Balances; type FeeCalculator = FixedGasPrice; - type FindAuthor = FindAuthorTruncated; + type FindAuthor = DarwiniaFindAuthor>; type GasWeightMapping = pallet_evm::FixedGasWeightMapping; type OnChargeTransaction = (); type OnCreate = (); diff --git a/runtime/darwinia/src/pallets/evm.rs b/runtime/darwinia/src/pallets/evm.rs index 397516018..22f149cda 100644 --- a/runtime/darwinia/src/pallets/evm.rs +++ b/runtime/darwinia/src/pallets/evm.rs @@ -29,38 +29,6 @@ frame_support::parameter_types! { pub WeightPerGas: frame_support::weights::Weight = frame_support::weights::Weight::from_ref_time(WEIGHT_PER_GAS); } -pub struct FindAuthorTruncated(sp_std::marker::PhantomData); -impl> frame_support::traits::FindAuthor - for FindAuthorTruncated -{ - fn find_author<'a, I>(digests: I) -> Option - where - I: 'a + IntoIterator, - { - // substrate - use sp_core::crypto::ByteArray; - - F::find_author(digests).and_then(|i| { - Aura::authorities().get(i as usize).and_then(|id| { - let raw = id.to_raw_vec(); - - if raw.len() >= 24 { - Some(sp_core::H160::from_slice(&raw[4..24])) - } else { - None - } - }) - }) - } -} - -pub struct FixedGasPrice; -impl pallet_evm::FeeCalculator for FixedGasPrice { - fn min_gas_price() -> (sp_core::U256, frame_support::weights::Weight) { - (sp_core::U256::from(GWEI), frame_support::weights::Weight::zero()) - } -} - // TODO: Integrate to the upstream repo pub struct FromH160; impl pallet_evm::AddressMapping for FromH160 @@ -72,13 +40,6 @@ where } } -pub struct AssetIdConverter; -impl darwinia_precompile_assets::AccountToAssetId for AssetIdConverter { - fn account_to_asset_id(account_id: AccountId) -> AssetId { - let addr: sp_core::H160 = account_id.into(); - addr.to_low_u64_be() - } -} pub struct DarwiniaPrecompiles(sp_std::marker::PhantomData); impl DarwiniaPrecompiles @@ -178,7 +139,7 @@ impl pallet_evm::Config for Runtime { type ChainId = ConstU64<46>; type Currency = Balances; type FeeCalculator = FixedGasPrice; - type FindAuthor = FindAuthorTruncated; + type FindAuthor = DarwiniaFindAuthor>; type GasWeightMapping = pallet_evm::FixedGasWeightMapping; type OnChargeTransaction = (); type OnCreate = (); diff --git a/runtime/pangolin/src/pallets/evm.rs b/runtime/pangolin/src/pallets/evm.rs index 1880c402f..0aedc8b85 100644 --- a/runtime/pangolin/src/pallets/evm.rs +++ b/runtime/pangolin/src/pallets/evm.rs @@ -29,38 +29,6 @@ frame_support::parameter_types! { pub WeightPerGas: frame_support::weights::Weight = frame_support::weights::Weight::from_ref_time(WEIGHT_PER_GAS); } -pub struct FindAuthorTruncated(sp_std::marker::PhantomData); -impl> frame_support::traits::FindAuthor - for FindAuthorTruncated -{ - fn find_author<'a, I>(digests: I) -> Option - where - I: 'a + IntoIterator, - { - // substrate - use sp_core::crypto::ByteArray; - - F::find_author(digests).and_then(|i| { - Aura::authorities().get(i as usize).and_then(|id| { - let raw = id.to_raw_vec(); - - if raw.len() >= 24 { - Some(sp_core::H160::from_slice(&raw[4..24])) - } else { - None - } - }) - }) - } -} - -pub struct FixedGasPrice; -impl pallet_evm::FeeCalculator for FixedGasPrice { - fn min_gas_price() -> (sp_core::U256, frame_support::weights::Weight) { - (sp_core::U256::from(GWEI), frame_support::weights::Weight::zero()) - } -} - // TODO: Integrate to the upstream repo pub struct FromH160; impl pallet_evm::AddressMapping for FromH160 @@ -72,14 +40,6 @@ where } } -pub struct AssetIdConverter; -impl darwinia_precompile_assets::AccountToAssetId for AssetIdConverter { - fn account_to_asset_id(account_id: AccountId) -> AssetId { - let addr: sp_core::H160 = account_id.into(); - addr.to_low_u64_be() - } -} - pub struct PangolinPrecompiles(sp_std::marker::PhantomData); impl PangolinPrecompiles where @@ -178,7 +138,7 @@ impl pallet_evm::Config for Runtime { type ChainId = ConstU64<43>; type Currency = Balances; type FeeCalculator = FixedGasPrice; - type FindAuthor = FindAuthorTruncated; + type FindAuthor = DarwiniaFindAuthor>; type GasWeightMapping = pallet_evm::FixedGasWeightMapping; type OnChargeTransaction = (); type OnCreate = (); diff --git a/runtime/pangoro/src/pallets/evm.rs b/runtime/pangoro/src/pallets/evm.rs index 1559df6db..14429eea1 100644 --- a/runtime/pangoro/src/pallets/evm.rs +++ b/runtime/pangoro/src/pallets/evm.rs @@ -28,39 +28,6 @@ frame_support::parameter_types! { pub PrecompilesValue: PangoroPrecompiles = PangoroPrecompiles::<_>::new(); pub WeightPerGas: frame_support::weights::Weight = frame_support::weights::Weight::from_ref_time(WEIGHT_PER_GAS); } - -pub struct FindAuthorTruncated(sp_std::marker::PhantomData); -impl> frame_support::traits::FindAuthor - for FindAuthorTruncated -{ - fn find_author<'a, I>(digests: I) -> Option - where - I: 'a + IntoIterator, - { - // substrate - use sp_core::crypto::ByteArray; - - F::find_author(digests).and_then(|i| { - Aura::authorities().get(i as usize).and_then(|id| { - let raw = id.to_raw_vec(); - - if raw.len() >= 24 { - Some(sp_core::H160::from_slice(&raw[4..24])) - } else { - None - } - }) - }) - } -} - -pub struct FixedGasPrice; -impl pallet_evm::FeeCalculator for FixedGasPrice { - fn min_gas_price() -> (sp_core::U256, frame_support::weights::Weight) { - (sp_core::U256::from(GWEI), frame_support::weights::Weight::zero()) - } -} - // TODO: Integrate to the upstream repo pub struct FromH160; impl pallet_evm::AddressMapping for FromH160 @@ -71,15 +38,6 @@ where address.into() } } - -pub struct AssetIdConverter; -impl darwinia_precompile_assets::AccountToAssetId for AssetIdConverter { - fn account_to_asset_id(account_id: AccountId) -> AssetId { - let addr: sp_core::H160 = account_id.into(); - addr.to_low_u64_be() - } -} - pub struct PangoroPrecompiles(sp_std::marker::PhantomData); impl PangoroPrecompiles where @@ -178,7 +136,7 @@ impl pallet_evm::Config for Runtime { type ChainId = ConstU64<45>; type Currency = Balances; type FeeCalculator = FixedGasPrice; - type FindAuthor = FindAuthorTruncated; + type FindAuthor = DarwiniaFindAuthor>; type GasWeightMapping = pallet_evm::FixedGasWeightMapping; type OnChargeTransaction = (); type OnCreate = (); diff --git a/tests/config.ts b/tests/config.ts index 0028b31fb..52e56213b 100644 --- a/tests/config.ts +++ b/tests/config.ts @@ -11,6 +11,7 @@ export const DEFAULT_GAS = 4000000; export const EXTRINSIC_GAS_LIMIT = 9059375; // Accounts builtin +export const ALITH = "0xf24ff3a9cf04c71dbc94d0b566f7a27b94566cac"; export const FAITH = "0xC0F0f4ab324C46e55D02D0033343B4Be8A55532d"; export const FAITH_P = "0xb9d2ea9a615f3165812e8d44de0d24da9bbd164b65c4f0573e1ce2c8dbd9c8df"; diff --git a/tests/ethereum/test-constants.ts b/tests/ethereum/test-constants.ts index 20dd9e522..998eb3a3f 100644 --- a/tests/ethereum/test-constants.ts +++ b/tests/ethereum/test-constants.ts @@ -1,7 +1,7 @@ import Web3 from "web3"; import { describe } from "mocha"; import { expect } from "chai"; -import { HOST_HTTP_URL, CHAIN_ID } from "../config"; +import { HOST_HTTP_URL, CHAIN_ID, ALITH } from "../config"; const web3 = new Web3(HOST_HTTP_URL); describe("Test constants RPC", () => { @@ -13,10 +13,7 @@ describe("Test constants RPC", () => { expect(await web3.eth.getChainId()).to.equal(CHAIN_ID); }); - // TODO: FIX ME - it.skip("block author should be 0x0000000000000000000000000000000000000000", async () => { - // This address `0x1234567890` is hardcoded into the runtime find_author - // as we are running manual sealing consensus. - expect(await web3.eth.getCoinbase()).to.equal("0x0000000000000000000000000000000000000000"); + it("block author should be ALITH", async () => { + expect(await web3.eth.getCoinbase()).to.equal(ALITH); }); }); From 8f2c12a88b737ac19c546062ea5bc2a5a08622d8 Mon Sep 17 00:00:00 2001 From: Guantong Date: Mon, 20 Feb 2023 10:07:35 +0800 Subject: [PATCH 149/189] Pangolin2 <> Pangoro2 bridge (#285) * Copy darwinia bm => pangoro bm Copy crab bm => pangolin bm * Add pangolin&pangoro bridge-messages * Add bridge related pallets for pangolin&pangoro * Add bridge palles to runtime for pangolin & pangoro * Fix compile * Missing changes * Correct bridge-dispatch * Format * Update genesis --- node/src/chain_spec/pangolin.rs | 12 ++ node/src/chain_spec/pangoro.rs | 12 ++ runtime/common/src/lib.rs | 1 + runtime/pangolin/src/bridges_message/mod.rs | 20 ++ .../pangolin/src/bridges_message/pangoro.rs | 182 ++++++++++++++++++ runtime/pangolin/src/lib.rs | 21 ++ .../pangolin/src/pallets/bridge_dispatch.rs | 109 +++++++++++ .../pangolin/src/pallets/bridge_grandpa.rs | 33 ++++ .../pangolin/src/pallets/bridge_messages.rs | 68 +++++++ .../pangolin/src/pallets/bridge_parachains.rs | 36 ++++ runtime/pangolin/src/pallets/fee_market.rs | 74 +++++++ runtime/pangolin/src/pallets/mod.rs | 16 ++ runtime/pangoro/src/bridges_message/mod.rs | 20 ++ .../pangoro/src/bridges_message/pangolin.rs | 182 ++++++++++++++++++ runtime/pangoro/src/lib.rs | 21 ++ .../pangoro/src/pallets/bridge_dispatch.rs | 109 +++++++++++ runtime/pangoro/src/pallets/bridge_grandpa.rs | 33 ++++ .../pangoro/src/pallets/bridge_messages.rs | 68 +++++++ .../pangoro/src/pallets/bridge_parachains.rs | 36 ++++ runtime/pangoro/src/pallets/fee_market.rs | 73 +++++++ runtime/pangoro/src/pallets/mod.rs | 16 ++ 21 files changed, 1142 insertions(+) create mode 100644 runtime/pangolin/src/bridges_message/mod.rs create mode 100644 runtime/pangolin/src/bridges_message/pangoro.rs create mode 100644 runtime/pangolin/src/pallets/bridge_dispatch.rs create mode 100644 runtime/pangolin/src/pallets/bridge_grandpa.rs create mode 100644 runtime/pangolin/src/pallets/bridge_messages.rs create mode 100644 runtime/pangolin/src/pallets/bridge_parachains.rs create mode 100644 runtime/pangolin/src/pallets/fee_market.rs create mode 100644 runtime/pangoro/src/bridges_message/mod.rs create mode 100644 runtime/pangoro/src/bridges_message/pangolin.rs create mode 100644 runtime/pangoro/src/pallets/bridge_dispatch.rs create mode 100644 runtime/pangoro/src/pallets/bridge_grandpa.rs create mode 100644 runtime/pangoro/src/pallets/bridge_messages.rs create mode 100644 runtime/pangoro/src/pallets/bridge_parachains.rs create mode 100644 runtime/pangoro/src/pallets/fee_market.rs diff --git a/node/src/chain_spec/pangolin.rs b/node/src/chain_spec/pangolin.rs index 404d6bf31..a59c34232 100644 --- a/node/src/chain_spec/pangolin.rs +++ b/node/src/chain_spec/pangolin.rs @@ -241,6 +241,12 @@ pub fn genesis_config() -> ChainSpec { ) }, }, + + // S2S stuff. + bridge_moonbase_grandpa: Default::default(), + bridge_moonbase_parachain: Default::default(), + bridge_pangoro_messages: Default::default(), + pangoro_fee_market: Default::default(), } }, Vec::new(), @@ -358,5 +364,11 @@ fn testnet_genesis( ) }, }, + + // S2S stuff. + bridge_moonbase_grandpa: Default::default(), + bridge_moonbase_parachain: Default::default(), + bridge_pangoro_messages: Default::default(), + pangoro_fee_market: Default::default(), } } diff --git a/node/src/chain_spec/pangoro.rs b/node/src/chain_spec/pangoro.rs index 02e034cb6..482b78956 100644 --- a/node/src/chain_spec/pangoro.rs +++ b/node/src/chain_spec/pangoro.rs @@ -241,6 +241,12 @@ pub fn genesis_config() -> ChainSpec { ) }, }, + + // S2S stuff. + bridge_rococo_grandpa: Default::default(), + bridge_rococo_parachain: Default::default(), + bridge_pangolin_messages: Default::default(), + pangolin_fee_market: Default::default(), } }, Vec::new(), @@ -358,5 +364,11 @@ fn testnet_genesis( ) }, }, + + // S2S stuff. + bridge_rococo_grandpa: Default::default(), + bridge_rococo_parachain: Default::default(), + bridge_pangolin_messages: Default::default(), + pangolin_fee_market: Default::default(), } } diff --git a/runtime/common/src/lib.rs b/runtime/common/src/lib.rs index ec3a5cf67..7ba4ef52b 100644 --- a/runtime/common/src/lib.rs +++ b/runtime/common/src/lib.rs @@ -26,6 +26,7 @@ pub mod xcm_configs; pub use bp_darwinia_core as bp_crab; pub use bp_darwinia_core as bp_darwinia; pub use bp_darwinia_core as bp_pangolin; +pub use bp_darwinia_core as bp_pangoro; #[cfg(feature = "test")] pub mod test; diff --git a/runtime/pangolin/src/bridges_message/mod.rs b/runtime/pangolin/src/bridges_message/mod.rs new file mode 100644 index 000000000..65ea8ae43 --- /dev/null +++ b/runtime/pangolin/src/bridges_message/mod.rs @@ -0,0 +1,20 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +pub mod pangoro; +pub use pangoro as bm_pangoro; diff --git a/runtime/pangolin/src/bridges_message/pangoro.rs b/runtime/pangolin/src/bridges_message/pangoro.rs new file mode 100644 index 000000000..bb96b0a42 --- /dev/null +++ b/runtime/pangolin/src/bridges_message/pangoro.rs @@ -0,0 +1,182 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// crates.io +use codec::{Decode, Encode}; +use scale_info::TypeInfo; +// paritytech +use frame_support::{weights::Weight, RuntimeDebug}; +use sp_runtime::{FixedPointNumber, FixedU128}; +// darwinia +use crate::*; +use bp_messages::{source_chain::*, target_chain::*, *}; +use bp_polkadot_core::parachains::ParaId; +use bp_runtime::*; +use bridge_runtime_common::{ + lanes::*, + messages::{source::*, target::*, *}, +}; +use darwinia_common_runtime::*; + +/// Message delivery proof for Pangolin -> Pangoro messages. +pub type ToPangoroMessagesDeliveryProof = FromBridgedChainMessagesDeliveryProof; +/// Message proof for Pangoro -> Pangolin messages. +pub type FromPangoroMessagesProof = FromBridgedChainMessagesProof; + +/// Message payload for Pangolin -> Pangoro messages. +pub type ToPangoroMessagePayload = FromThisChainMessagePayload; +/// Message payload for Pangoro -> Pangolin messages. +pub type FromPangoroMessagePayload = FromBridgedChainMessagePayload; + +/// Message verifier for Pangolin -> Pangoro messages. +pub type ToPangoroMessageVerifier = + FromThisChainMessageVerifier; + +/// Encoded Pangoro Call as it comes from Pangoro. +pub type FromPangoroEncodedCall = FromBridgedChainEncodedMessageCall; + +/// Call-dispatch based message dispatch for Pangoro -> Pangolin messages. +pub type FromPangoroMessageDispatch = FromBridgedChainMessageDispatch< + WithPangoroMessageBridge, + Runtime, + Balances, + WithPangoroDispatch, +>; + +pub const INITIAL_PANGORO_TO_PANGOLIN_CONVERSION_RATE: FixedU128 = + FixedU128::from_inner(FixedU128::DIV); + +frame_support::parameter_types! { + /// Pangolin to Pangoro conversion rate. Initially we treate both tokens as equal. + pub storage PangoroToPangolinConversionRate: FixedU128 = INITIAL_PANGORO_TO_PANGOLIN_CONVERSION_RATE; +} + +#[derive(Clone, PartialEq, Eq, Encode, Decode, RuntimeDebug, TypeInfo)] +pub enum PangolinToPangoroParameter { + /// The conversion formula we use is: `PangoroTokens = PangolinTokens * + /// conversion_rate`. + PangoroToPangolinConversionRate(FixedU128), +} +impl Parameter for PangolinToPangoroParameter { + fn save(&self) { + match *self { + PangolinToPangoroParameter::PangoroToPangolinConversionRate(ref conversion_rate) => + PangoroToPangolinConversionRate::set(conversion_rate), + } + } +} + +pub type ToPangoroMaximalOutboundPayloadSize = + bridge_runtime_common::messages::source::FromThisChainMaximalOutboundPayloadSize< + WithPangoroMessageBridge, + >; + +/// Pangoro <-> Pangolin message bridge. +#[derive(Clone, Copy, RuntimeDebug)] +pub struct WithPangoroMessageBridge; +impl MessageBridge for WithPangoroMessageBridge { + type BridgedChain = Pangoro; + type ThisChain = Pangolin; + + const BRIDGED_CHAIN_ID: bp_runtime::ChainId = PANGORO_CHAIN_ID; + const BRIDGED_MESSAGES_PALLET_NAME: &'static str = + bridge_runtime_common::pallets::WITH_PANGOLIN_MESSAGES_PALLET_NAME; + const RELAYER_FEE_PERCENT: u32 = 10; + const THIS_CHAIN_ID: bp_runtime::ChainId = PANGOLIN_CHAIN_ID; +} + +#[derive(Clone, Copy, RuntimeDebug)] +pub struct Pangolin; +impl ChainWithMessages for Pangolin { + type AccountId = bp_pangolin::AccountId; + type Balance = bp_pangolin::Balance; + type Hash = bp_pangolin::Hash; + type Signature = bp_pangolin::Signature; + type Signer = bp_pangolin::AccountPublic; +} +impl ThisChainWithMessages for Pangolin { + type RuntimeCall = RuntimeCall; + type RuntimeOrigin = RuntimeOrigin; + + fn is_message_accepted(_send_origin: &Self::RuntimeOrigin, lane: &LaneId) -> bool { + *lane == PANGORO_PANGOLIN_LANE + } + + fn maximal_pending_messages_at_outbound_lane() -> MessageNonce { + MessageNonce::MAX + } +} + +#[derive(Clone, Copy, RuntimeDebug)] +pub struct Pangoro; +impl ChainWithMessages for Pangoro { + type AccountId = bp_pangoro::AccountId; + type Balance = bp_pangoro::Balance; + type Hash = bp_pangoro::Hash; + type Signature = bp_pangoro::Signature; + type Signer = bp_pangoro::AccountPublic; +} +impl BridgedChainWithMessages for Pangoro { + fn maximal_extrinsic_size() -> u32 { + bp_pangoro::DarwiniaLike::max_extrinsic_size() + } + + fn verify_dispatch_weight(_message_payload: &[u8], payload_weight: &Weight) -> bool { + let upper_limit = target::maximal_incoming_message_dispatch_weight( + bp_pangoro::DarwiniaLike::max_extrinsic_weight(), + ); + payload_weight.all_lte(upper_limit) + } +} +impl TargetHeaderChain::AccountId> + for Pangoro +{ + type Error = &'static str; + type MessagesDeliveryProof = ToPangoroMessagesDeliveryProof; + + fn verify_message(payload: &ToPangoroMessagePayload) -> Result<(), Self::Error> { + source::verify_chain_message::(payload) + } + + fn verify_messages_delivery_proof( + proof: Self::MessagesDeliveryProof, + ) -> Result<(LaneId, InboundLaneData), Self::Error> { + source::verify_messages_delivery_proof_from_parachain::< + WithPangoroMessageBridge, + bp_pangoro::Header, + Runtime, + WithMoonbaseParachainsInstance, + >(ParaId(2105), proof) + } +} +impl SourceHeaderChain<::Balance> for Pangoro { + type Error = &'static str; + type MessagesProof = FromPangoroMessagesProof; + + fn verify_messages_proof( + proof: Self::MessagesProof, + messages_count: u32, + ) -> Result::Balance>>, Self::Error> { + target::verify_messages_proof_from_parachain::< + WithPangoroMessageBridge, + bp_pangoro::Header, + Runtime, + WithMoonbaseParachainsInstance, + >(ParaId(2105), proof, messages_count) + } +} diff --git a/runtime/pangolin/src/lib.rs b/runtime/pangolin/src/lib.rs index d03cc8ff2..9a59921c6 100644 --- a/runtime/pangolin/src/lib.rs +++ b/runtime/pangolin/src/lib.rs @@ -27,6 +27,9 @@ include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); mod pallets; pub use pallets::*; +mod bridges_message; +pub use bridges_message::*; + mod migration; mod weights; @@ -52,6 +55,7 @@ pub type SignedExtra = ( frame_system::CheckNonce, frame_system::CheckWeight, pallet_transaction_payment::ChargeTransactionPayment, + BridgeRejectObsoleteHeadersAndMessages, ); /// Unchecked extrinsic type as expected by this runtime. @@ -154,6 +158,13 @@ frame_support::construct_runtime! { Ethereum: pallet_ethereum = 36, Evm: pallet_evm = 37, MessageTransact: darwinia_message_transact = 38, + + // Pangolin <> Pangoro + BridgeMoonbaseGrandpa: pallet_bridge_grandpa:: = 39, + BridgeMoonbaseParachain: pallet_bridge_parachains:: = 40, + BridgePangoroMessages: pallet_bridge_messages:: = 41, + BridgePangoroDispatch: pallet_bridge_dispatch:: = 42, + PangoroFeeMarket: pallet_fee_market:: = 43 } } @@ -168,6 +179,16 @@ frame_benchmarking::define_benchmarks! { impl_self_contained_call!(); +bridge_runtime_common::generate_bridge_reject_obsolete_headers_and_messages! { + RuntimeCall, AccountId, + // Grandpa + BridgeMoonbaseGrandpa, + // Messages + BridgePangoroMessages, + // Parachain + BridgeMoonbaseParachain +} + sp_api::impl_runtime_apis! { impl sp_consensus_aura::AuraApi for Runtime { fn slot_duration() -> sp_consensus_aura::SlotDuration { diff --git a/runtime/pangolin/src/pallets/bridge_dispatch.rs b/runtime/pangolin/src/pallets/bridge_dispatch.rs new file mode 100644 index 000000000..367da5504 --- /dev/null +++ b/runtime/pangolin/src/pallets/bridge_dispatch.rs @@ -0,0 +1,109 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +pub use pallet_bridge_dispatch::Instance1 as WithPangoroDispatch; + +// darwinia +use crate::*; + +pub struct CallValidator; +impl bp_message_dispatch::CallValidate for CallValidator { + fn check_receiving_before_dispatch( + relayer_account: &AccountId, + call: &RuntimeCall, + ) -> Result<(), &'static str> { + match call { + RuntimeCall::MessageTransact(darwinia_message_transact::Call::message_transact { + transaction: tx, + }) => { + let total_payment = + darwinia_message_transact::total_payment::((&**tx).into()); + let relayer = + pallet_evm::Pallet::::account_basic(&sp_core::H160(relayer_account.0)) + .0; + + frame_support::ensure!(relayer.balance >= total_payment, "Insufficient balance"); + Ok(()) + }, + _ => Ok(()), + } + } + + fn call_validate( + relayer_account: &AccountId, + origin: &RuntimeOrigin, + call: &RuntimeCall, + ) -> Result<(), sp_runtime::transaction_validity::TransactionValidityError> { + match call { + RuntimeCall::MessageTransact(darwinia_message_transact::Call::message_transact { + transaction: tx, + }) => match origin.caller { + OriginCaller::MessageTransact( + darwinia_message_transact::LcmpEthOrigin::MessageTransact(id), + ) => { + let total_payment = + darwinia_message_transact::total_payment::((&**tx).into()); + pallet_balances::Pallet::::transfer( + frame_system::RawOrigin::Signed(*relayer_account).into(), + id.into(), + total_payment.as_u128(), + ) + .map_err(|_| { + sp_runtime::transaction_validity::TransactionValidityError::Invalid( + sp_runtime::transaction_validity::InvalidTransaction::Payment, + ) + })?; + + Ok(()) + }, + _ => Err(sp_runtime::transaction_validity::TransactionValidityError::Invalid( + sp_runtime::transaction_validity::InvalidTransaction::BadSigner, + )), + }, + _ => Ok(()), + } + } +} + +pub struct IntoDispatchOrigin; +impl bp_message_dispatch::IntoDispatchOrigin + for IntoDispatchOrigin +{ + fn into_dispatch_origin(id: &AccountId, call: &RuntimeCall) -> RuntimeOrigin { + match call { + RuntimeCall::MessageTransact(darwinia_message_transact::Call::message_transact { + .. + }) => darwinia_message_transact::LcmpEthOrigin::MessageTransact(sp_core::H160(id.0)) + .into(), + _ => frame_system::RawOrigin::Signed(*id).into(), + } + } +} + +impl pallet_bridge_dispatch::Config for Runtime { + type AccountIdConverter = bp_pangolin::AccountIdConverter; + type BridgeMessageId = (bp_messages::LaneId, bp_messages::MessageNonce); + type CallValidator = CallValidator; + type EncodedCall = bm_pangoro::FromPangoroEncodedCall; + type IntoDispatchOrigin = IntoDispatchOrigin; + type RuntimeCall = RuntimeCall; + type RuntimeEvent = RuntimeEvent; + type SourceChainAccountId = bp_pangoro::AccountId; + type TargetChainAccountPublic = bp_pangolin::AccountPublic; + type TargetChainSignature = bp_pangolin::Signature; +} diff --git a/runtime/pangolin/src/pallets/bridge_grandpa.rs b/runtime/pangolin/src/pallets/bridge_grandpa.rs new file mode 100644 index 000000000..368bf79ba --- /dev/null +++ b/runtime/pangolin/src/pallets/bridge_grandpa.rs @@ -0,0 +1,33 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +pub use pallet_bridge_grandpa::Instance1 as WithMoonbaseGrandpa; + +// pangoro +use crate::*; + +pub type MoonbaseHeadersToKeep = ConstU32<500>; + +impl pallet_bridge_grandpa::Config for Runtime { + type BridgedChain = bp_pangoro::DarwiniaLike; + type HeadersToKeep = MoonbaseHeadersToKeep; + type MaxBridgedAuthorities = ConstU32<100_000>; + type MaxBridgedHeaderSize = ConstU32<65536>; + type MaxRequests = ConstU32<50>; + type WeightInfo = (); +} diff --git a/runtime/pangolin/src/pallets/bridge_messages.rs b/runtime/pangolin/src/pallets/bridge_messages.rs new file mode 100644 index 000000000..40139c904 --- /dev/null +++ b/runtime/pangolin/src/pallets/bridge_messages.rs @@ -0,0 +1,68 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +use pallet_bridge_messages::Instance1 as WithPangoroMessages; + +// darwinia +use crate::*; + +impl bp_messages::source_chain::SenderOrigin for RuntimeOrigin { + fn linked_account(&self) -> Option { + match self.caller { + OriginCaller::system(frame_system::RawOrigin::Signed(ref submitter)) => + Some(*submitter), + _ => None, + } + } +} + +frame_support::parameter_types! { + pub const BridgedChainId: bp_runtime::ChainId = bp_runtime::PANGORO_CHAIN_ID; + pub const MaxUnconfirmedMessagesAtInboundLane: bp_messages::MessageNonce = + bp_pangoro::MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX; + pub const MaxUnrewardedRelayerEntriesAtInboundLane: bp_messages::MessageNonce = + bp_pangoro::MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX; + pub RootAccountForPayments: Option = None; +} + +impl pallet_bridge_messages::Config for Runtime { + type AccountIdConverter = bp_pangolin::AccountIdConverter; + type BridgedChainId = BridgedChainId; + type InboundMessageFee = bp_pangoro::Balance; + type InboundPayload = bm_pangoro::FromPangoroMessagePayload; + type InboundRelayer = bp_pangoro::AccountId; + type LaneMessageVerifier = bm_pangoro::ToPangoroMessageVerifier; + type MaxMessagesToPruneAtOnce = ConstU64<8>; + type MaxUnconfirmedMessagesAtInboundLane = MaxUnconfirmedMessagesAtInboundLane; + type MaxUnrewardedRelayerEntriesAtInboundLane = MaxUnrewardedRelayerEntriesAtInboundLane; + type MaximalOutboundPayloadSize = bm_pangoro::ToPangoroMaximalOutboundPayloadSize; + type MessageDeliveryAndDispatchPayment = + pallet_fee_market::s2s::FeeMarketPayment; + type MessageDispatch = bm_pangoro::FromPangoroMessageDispatch; + type OnDeliveryConfirmed = + pallet_fee_market::s2s::FeeMarketMessageConfirmedHandler; + type OnMessageAccepted = + pallet_fee_market::s2s::FeeMarketMessageAcceptedHandler; + type OutboundMessageFee = bp_pangolin::Balance; + type OutboundPayload = bm_pangoro::ToPangoroMessagePayload; + type Parameter = bm_pangoro::PangolinToPangoroParameter; + type RuntimeEvent = RuntimeEvent; + type SourceHeaderChain = bm_pangoro::Pangoro; + type TargetHeaderChain = bm_pangoro::Pangoro; + type WeightInfo = (); +} diff --git a/runtime/pangolin/src/pallets/bridge_parachains.rs b/runtime/pangolin/src/pallets/bridge_parachains.rs new file mode 100644 index 000000000..cd723c4f9 --- /dev/null +++ b/runtime/pangolin/src/pallets/bridge_parachains.rs @@ -0,0 +1,36 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +pub use pallet_bridge_parachains::Instance1 as WithMoonbaseParachainsInstance; + +// darwinia +use crate::*; + +frame_support::parameter_types! { + pub const ParasPalletName: &'static str = bp_polkadot_core::parachains::PARAS_PALLET_NAME; +} + +impl pallet_bridge_parachains::Config for Runtime { + type BridgesGrandpaPalletInstance = WithMoonbaseGrandpa; + type HeadsToKeep = MoonbaseHeadersToKeep; + type MaxParaHeadSize = ConstU32<1024>; + type ParasPalletName = ParasPalletName; + type RuntimeEvent = RuntimeEvent; + type TrackedParachains = frame_support::traits::Everything; + type WeightInfo = (); +} diff --git a/runtime/pangolin/src/pallets/fee_market.rs b/runtime/pangolin/src/pallets/fee_market.rs new file mode 100644 index 000000000..93e5b2686 --- /dev/null +++ b/runtime/pangolin/src/pallets/fee_market.rs @@ -0,0 +1,74 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +pub use pallet_fee_market::Instance1 as WithPangoroFeeMarket; + +// darwinia +use crate::*; + +pub struct FeeMarketSlasher; + +impl, I: 'static> pallet_fee_market::Slasher + for FeeMarketSlasher +{ + fn calc_amount( + locked_collateral: pallet_fee_market::BalanceOf, + timeout: T::BlockNumber, + ) -> pallet_fee_market::BalanceOf { + // substrate + use sp_runtime::traits::UniqueSaturatedInto; + + let slash_each_block = 2 * UNIT; + let slash_value = + sp_runtime::traits::UniqueSaturatedInto::::unique_saturated_into(timeout) + .saturating_mul( + sp_runtime::traits::UniqueSaturatedInto::::unique_saturated_into( + slash_each_block, + ), + ) + .unique_saturated_into(); + + core::cmp::min(locked_collateral, slash_value) + } +} + +frame_support::parameter_types! { + pub const TreasuryPalletId: frame_support::PalletId = frame_support::PalletId(*b"da/trsry"); + pub const FeeMarketLockId: frame_support::traits::LockIdentifier = *b"da/feecr"; + + pub const DutyRelayersRewardRatio: sp_runtime::Permill = sp_runtime::Permill::from_percent(60); + pub const MessageRelayersRewardRatio: sp_runtime::Permill = sp_runtime::Permill::from_percent(80); + pub const ConfirmRelayersRewardRatio: sp_runtime::Permill = sp_runtime::Permill::from_percent(20); + pub const AssignedRelayerSlashRatio: sp_runtime::Permill = sp_runtime::Permill::from_percent(20); +} + +impl pallet_fee_market::Config for Runtime { + type AssignedRelayerSlashRatio = AssignedRelayerSlashRatio; + type CollateralPerOrder = ConstU128<{ 50 * UNIT }>; + type ConfirmRelayersRewardRatio = ConfirmRelayersRewardRatio; + type Currency = Balances; + type DutyRelayersRewardRatio = DutyRelayersRewardRatio; + type LockId = FeeMarketLockId; + type MessageRelayersRewardRatio = MessageRelayersRewardRatio; + type MinimumRelayFee = ConstU128<{ 15 * UNIT }>; + type RuntimeEvent = RuntimeEvent; + type Slasher = FeeMarketSlasher; + type Slot = ConstU32<600>; + type TreasuryPalletId = TreasuryPalletId; + type WeightInfo = (); +} diff --git a/runtime/pangolin/src/pallets/mod.rs b/runtime/pangolin/src/pallets/mod.rs index c07ec8c74..2ac24d6da 100644 --- a/runtime/pangolin/src/pallets/mod.rs +++ b/runtime/pangolin/src/pallets/mod.rs @@ -109,3 +109,19 @@ mod evm; pub use evm::*; mod message_transact; + +// S2S stuff. +mod bridge_dispatch; +pub use bridge_dispatch::*; + +mod bridge_grandpa; +pub use bridge_grandpa::*; + +mod bridge_messages; +pub use bridge_messages::*; + +mod bridge_parachains; +pub use bridge_parachains::*; + +mod fee_market; +pub use fee_market::*; diff --git a/runtime/pangoro/src/bridges_message/mod.rs b/runtime/pangoro/src/bridges_message/mod.rs new file mode 100644 index 000000000..4ff85dab9 --- /dev/null +++ b/runtime/pangoro/src/bridges_message/mod.rs @@ -0,0 +1,20 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +pub mod pangolin; +pub use pangolin as bm_pangolin; diff --git a/runtime/pangoro/src/bridges_message/pangolin.rs b/runtime/pangoro/src/bridges_message/pangolin.rs new file mode 100644 index 000000000..12f5cf2e4 --- /dev/null +++ b/runtime/pangoro/src/bridges_message/pangolin.rs @@ -0,0 +1,182 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// crates.io +use codec::{Decode, Encode}; +use scale_info::TypeInfo; +// paritytech +use frame_support::{weights::Weight, RuntimeDebug}; +use sp_runtime::{FixedPointNumber, FixedU128}; +// darwinia +use crate::*; +use bp_messages::{source_chain::*, target_chain::*, *}; +use bp_polkadot_core::parachains::ParaId; +use bp_runtime::*; +use bridge_runtime_common::{ + lanes::*, + messages::{source::*, target::*, *}, +}; +use darwinia_common_runtime::*; + +/// Message delivery proof for Pangoro -> Pangolin messages. +pub type ToPangolinMessagesDeliveryProof = FromBridgedChainMessagesDeliveryProof; +/// Message proof for Pangolin -> Pangoro messages. +pub type FromPangolinMessagesProof = FromBridgedChainMessagesProof; + +/// Message payload for Pangoro -> Pangolin messages. +pub type ToPangolinMessagePayload = FromThisChainMessagePayload; +/// Message payload for Pangolin -> Pangoro messages. +pub type FromPangolinMessagePayload = FromBridgedChainMessagePayload; + +/// Message verifier for Pangoro -> Pangolin messages. +pub type ToPangolinMessageVerifier = + FromThisChainMessageVerifier; + +/// Encoded Pangolin Call as it comes from Pangolin. +pub type FromPangolinEncodedCall = FromBridgedChainEncodedMessageCall; + +/// Call-dispatch based message dispatch for Pangolin -> Pangoro messages. +pub type FromPangolinMessageDispatch = FromBridgedChainMessageDispatch< + WithPangolinMessageBridge, + Runtime, + Balances, + WithPangolinDispatch, +>; + +pub const INITIAL_PANGOLIN_TO_PANGORO_CONVERSION_RATE: FixedU128 = + FixedU128::from_inner(FixedU128::DIV); + +frame_support::parameter_types! { + /// Pangoro to Pangolin conversion rate. Initially we treate both tokens as equal. + pub storage PangolinToPangoroConversionRate: FixedU128 = INITIAL_PANGOLIN_TO_PANGORO_CONVERSION_RATE; +} + +#[derive(Clone, PartialEq, Eq, Encode, Decode, RuntimeDebug, TypeInfo)] +pub enum PangoroToPangolinParameter { + /// The conversion formula we use is: `PangolinTokens = PangoroTokens * + /// conversion_rate`. + PangolinToPangoroConversionRate(FixedU128), +} +impl Parameter for PangoroToPangolinParameter { + fn save(&self) { + match *self { + PangoroToPangolinParameter::PangolinToPangoroConversionRate(ref conversion_rate) => + PangolinToPangoroConversionRate::set(conversion_rate), + } + } +} + +pub type ToPangolinMaximalOutboundPayloadSize = + bridge_runtime_common::messages::source::FromThisChainMaximalOutboundPayloadSize< + WithPangolinMessageBridge, + >; + +/// Pangolin <-> Pangoro message bridge. +#[derive(Clone, Copy, RuntimeDebug)] +pub struct WithPangolinMessageBridge; +impl MessageBridge for WithPangolinMessageBridge { + type BridgedChain = Pangolin; + type ThisChain = Pangoro; + + const BRIDGED_CHAIN_ID: bp_runtime::ChainId = PANGOLIN_CHAIN_ID; + const BRIDGED_MESSAGES_PALLET_NAME: &'static str = + bridge_runtime_common::pallets::WITH_PANGORO_MESSAGES_PALLET_NAME; + const RELAYER_FEE_PERCENT: u32 = 10; + const THIS_CHAIN_ID: bp_runtime::ChainId = PANGORO_CHAIN_ID; +} + +#[derive(Clone, Copy, RuntimeDebug)] +pub struct Pangoro; +impl ChainWithMessages for Pangoro { + type AccountId = bp_pangoro::AccountId; + type Balance = bp_pangoro::Balance; + type Hash = bp_pangoro::Hash; + type Signature = bp_pangoro::Signature; + type Signer = bp_pangoro::AccountPublic; +} +impl ThisChainWithMessages for Pangoro { + type RuntimeCall = RuntimeCall; + type RuntimeOrigin = RuntimeOrigin; + + fn is_message_accepted(_send_origin: &Self::RuntimeOrigin, lane: &LaneId) -> bool { + *lane == PANGORO_PANGOLIN_LANE + } + + fn maximal_pending_messages_at_outbound_lane() -> MessageNonce { + MessageNonce::MAX + } +} + +#[derive(Clone, Copy, RuntimeDebug)] +pub struct Pangolin; +impl ChainWithMessages for Pangolin { + type AccountId = bp_pangolin::AccountId; + type Balance = bp_pangolin::Balance; + type Hash = bp_pangolin::Hash; + type Signature = bp_pangolin::Signature; + type Signer = bp_pangolin::AccountPublic; +} +impl BridgedChainWithMessages for Pangolin { + fn maximal_extrinsic_size() -> u32 { + bp_pangolin::DarwiniaLike::max_extrinsic_size() + } + + fn verify_dispatch_weight(_message_payload: &[u8], payload_weight: &Weight) -> bool { + let upper_limit = target::maximal_incoming_message_dispatch_weight( + bp_pangolin::DarwiniaLike::max_extrinsic_weight(), + ); + payload_weight.all_lte(upper_limit) + } +} +impl TargetHeaderChain::AccountId> + for Pangolin +{ + type Error = &'static str; + type MessagesDeliveryProof = ToPangolinMessagesDeliveryProof; + + fn verify_message(payload: &ToPangolinMessagePayload) -> Result<(), Self::Error> { + source::verify_chain_message::(payload) + } + + fn verify_messages_delivery_proof( + proof: Self::MessagesDeliveryProof, + ) -> Result<(LaneId, InboundLaneData), Self::Error> { + source::verify_messages_delivery_proof_from_parachain::< + WithPangolinMessageBridge, + bp_pangolin::Header, + Runtime, + WithRococoParachainsInstance, + >(ParaId(2105), proof) + } +} +impl SourceHeaderChain<::Balance> for Pangolin { + type Error = &'static str; + type MessagesProof = FromPangolinMessagesProof; + + fn verify_messages_proof( + proof: Self::MessagesProof, + messages_count: u32, + ) -> Result::Balance>>, Self::Error> { + target::verify_messages_proof_from_parachain::< + WithPangolinMessageBridge, + bp_pangolin::Header, + Runtime, + WithRococoParachainsInstance, + >(ParaId(2105), proof, messages_count) + } +} diff --git a/runtime/pangoro/src/lib.rs b/runtime/pangoro/src/lib.rs index 1b1559f68..b8615abba 100644 --- a/runtime/pangoro/src/lib.rs +++ b/runtime/pangoro/src/lib.rs @@ -27,6 +27,9 @@ include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); mod pallets; pub use pallets::*; +mod bridges_message; +pub use bridges_message::*; + mod migration; mod weights; @@ -52,6 +55,7 @@ pub type SignedExtra = ( frame_system::CheckNonce, frame_system::CheckWeight, pallet_transaction_payment::ChargeTransactionPayment, + BridgeRejectObsoleteHeadersAndMessages, ); /// Unchecked extrinsic type as expected by this runtime. @@ -154,6 +158,13 @@ frame_support::construct_runtime! { Ethereum: pallet_ethereum = 36, Evm: pallet_evm = 37, MessageTransact: darwinia_message_transact = 38, + + // Pangoro <> Pangolin + BridgeRococoGrandpa: pallet_bridge_grandpa:: = 39, + BridgeRococoParachain: pallet_bridge_parachains:: = 40, + BridgePangolinMessages: pallet_bridge_messages:: = 41, + BridgePangolinDispatch: pallet_bridge_dispatch:: = 42, + PangolinFeeMarket: pallet_fee_market:: = 43 } } @@ -168,6 +179,16 @@ frame_benchmarking::define_benchmarks! { impl_self_contained_call!(); +bridge_runtime_common::generate_bridge_reject_obsolete_headers_and_messages! { + RuntimeCall, AccountId, + // Grandpa + BridgeRococoGrandpa, + // Messages + BridgePangolinMessages, + // Parachain + BridgeRococoParachain +} + sp_api::impl_runtime_apis! { impl sp_consensus_aura::AuraApi for Runtime { fn slot_duration() -> sp_consensus_aura::SlotDuration { diff --git a/runtime/pangoro/src/pallets/bridge_dispatch.rs b/runtime/pangoro/src/pallets/bridge_dispatch.rs new file mode 100644 index 000000000..8b990a1cc --- /dev/null +++ b/runtime/pangoro/src/pallets/bridge_dispatch.rs @@ -0,0 +1,109 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +pub use pallet_bridge_dispatch::Instance1 as WithPangolinDispatch; + +// darwinia +use crate::*; + +pub struct CallValidator; +impl bp_message_dispatch::CallValidate for CallValidator { + fn check_receiving_before_dispatch( + relayer_account: &AccountId, + call: &RuntimeCall, + ) -> Result<(), &'static str> { + match call { + RuntimeCall::MessageTransact(darwinia_message_transact::Call::message_transact { + transaction: tx, + }) => { + let total_payment = + darwinia_message_transact::total_payment::((&**tx).into()); + let relayer = + pallet_evm::Pallet::::account_basic(&sp_core::H160(relayer_account.0)) + .0; + + frame_support::ensure!(relayer.balance >= total_payment, "Insufficient balance"); + Ok(()) + }, + _ => Ok(()), + } + } + + fn call_validate( + relayer_account: &AccountId, + origin: &RuntimeOrigin, + call: &RuntimeCall, + ) -> Result<(), sp_runtime::transaction_validity::TransactionValidityError> { + match call { + RuntimeCall::MessageTransact(darwinia_message_transact::Call::message_transact { + transaction: tx, + }) => match origin.caller { + OriginCaller::MessageTransact( + darwinia_message_transact::LcmpEthOrigin::MessageTransact(id), + ) => { + let total_payment = + darwinia_message_transact::total_payment::((&**tx).into()); + pallet_balances::Pallet::::transfer( + frame_system::RawOrigin::Signed(*relayer_account).into(), + id.into(), + total_payment.as_u128(), + ) + .map_err(|_| { + sp_runtime::transaction_validity::TransactionValidityError::Invalid( + sp_runtime::transaction_validity::InvalidTransaction::Payment, + ) + })?; + + Ok(()) + }, + _ => Err(sp_runtime::transaction_validity::TransactionValidityError::Invalid( + sp_runtime::transaction_validity::InvalidTransaction::BadSigner, + )), + }, + _ => Ok(()), + } + } +} + +pub struct IntoDispatchOrigin; +impl bp_message_dispatch::IntoDispatchOrigin + for IntoDispatchOrigin +{ + fn into_dispatch_origin(id: &AccountId, call: &RuntimeCall) -> RuntimeOrigin { + match call { + RuntimeCall::MessageTransact(darwinia_message_transact::Call::message_transact { + .. + }) => darwinia_message_transact::LcmpEthOrigin::MessageTransact(sp_core::H160(id.0)) + .into(), + _ => frame_system::RawOrigin::Signed(*id).into(), + } + } +} + +impl pallet_bridge_dispatch::Config for Runtime { + type AccountIdConverter = bp_pangoro::AccountIdConverter; + type BridgeMessageId = (bp_messages::LaneId, bp_messages::MessageNonce); + type CallValidator = CallValidator; + type EncodedCall = bm_pangolin::FromPangolinEncodedCall; + type IntoDispatchOrigin = IntoDispatchOrigin; + type RuntimeCall = RuntimeCall; + type RuntimeEvent = RuntimeEvent; + type SourceChainAccountId = bp_pangolin::AccountId; + type TargetChainAccountPublic = bp_pangoro::AccountPublic; + type TargetChainSignature = bp_pangoro::Signature; +} diff --git a/runtime/pangoro/src/pallets/bridge_grandpa.rs b/runtime/pangoro/src/pallets/bridge_grandpa.rs new file mode 100644 index 000000000..635aa7efb --- /dev/null +++ b/runtime/pangoro/src/pallets/bridge_grandpa.rs @@ -0,0 +1,33 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +pub use pallet_bridge_grandpa::Instance1 as WithRococoGrandpa; + +// darwinia +use crate::*; + +pub type RococoHeadersToKeep = ConstU32<500>; + +impl pallet_bridge_grandpa::Config for Runtime { + type BridgedChain = bp_pangolin::DarwiniaLike; + type HeadersToKeep = RococoHeadersToKeep; + type MaxBridgedAuthorities = ConstU32<100_000>; + type MaxBridgedHeaderSize = ConstU32<65536>; + type MaxRequests = ConstU32<50>; + type WeightInfo = (); +} diff --git a/runtime/pangoro/src/pallets/bridge_messages.rs b/runtime/pangoro/src/pallets/bridge_messages.rs new file mode 100644 index 000000000..0a664dabf --- /dev/null +++ b/runtime/pangoro/src/pallets/bridge_messages.rs @@ -0,0 +1,68 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +use pallet_bridge_messages::Instance1 as WithPangolinMessages; + +// darwinia +use crate::*; + +impl bp_messages::source_chain::SenderOrigin for RuntimeOrigin { + fn linked_account(&self) -> Option { + match self.caller { + OriginCaller::system(frame_system::RawOrigin::Signed(ref submitter)) => + Some(*submitter), + _ => None, + } + } +} + +frame_support::parameter_types! { + pub const BridgedChainId: bp_runtime::ChainId = bp_runtime::PANGOLIN_CHAIN_ID; + pub const MaxUnconfirmedMessagesAtInboundLane: bp_messages::MessageNonce = + bp_pangoro::MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX; + pub const MaxUnrewardedRelayerEntriesAtInboundLane: bp_messages::MessageNonce = + bp_pangoro::MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX; + pub RootAccountForPayments: Option = None; +} + +impl pallet_bridge_messages::Config for Runtime { + type AccountIdConverter = bp_pangoro::AccountIdConverter; + type BridgedChainId = BridgedChainId; + type InboundMessageFee = bp_pangolin::Balance; + type InboundPayload = bm_pangolin::FromPangolinMessagePayload; + type InboundRelayer = bp_pangolin::AccountId; + type LaneMessageVerifier = bm_pangolin::ToPangolinMessageVerifier; + type MaxMessagesToPruneAtOnce = ConstU64<8>; + type MaxUnconfirmedMessagesAtInboundLane = MaxUnconfirmedMessagesAtInboundLane; + type MaxUnrewardedRelayerEntriesAtInboundLane = MaxUnrewardedRelayerEntriesAtInboundLane; + type MaximalOutboundPayloadSize = bm_pangolin::ToPangolinMaximalOutboundPayloadSize; + type MessageDeliveryAndDispatchPayment = + pallet_fee_market::s2s::FeeMarketPayment; + type MessageDispatch = bm_pangolin::FromPangolinMessageDispatch; + type OnDeliveryConfirmed = + pallet_fee_market::s2s::FeeMarketMessageConfirmedHandler; + type OnMessageAccepted = + pallet_fee_market::s2s::FeeMarketMessageAcceptedHandler; + type OutboundMessageFee = bp_pangoro::Balance; + type OutboundPayload = bm_pangolin::ToPangolinMessagePayload; + type Parameter = bm_pangolin::PangoroToPangolinParameter; + type RuntimeEvent = RuntimeEvent; + type SourceHeaderChain = bm_pangolin::Pangolin; + type TargetHeaderChain = bm_pangolin::Pangolin; + type WeightInfo = (); +} diff --git a/runtime/pangoro/src/pallets/bridge_parachains.rs b/runtime/pangoro/src/pallets/bridge_parachains.rs new file mode 100644 index 000000000..191d8ad97 --- /dev/null +++ b/runtime/pangoro/src/pallets/bridge_parachains.rs @@ -0,0 +1,36 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +pub use pallet_bridge_parachains::Instance1 as WithRococoParachainsInstance; + +// darwinia +use crate::*; + +frame_support::parameter_types! { + pub const ParasPalletName: &'static str = bp_polkadot_core::parachains::PARAS_PALLET_NAME; +} + +impl pallet_bridge_parachains::Config for Runtime { + type BridgesGrandpaPalletInstance = WithRococoGrandpa; + type HeadsToKeep = RococoHeadersToKeep; + type MaxParaHeadSize = ConstU32<1024>; + type ParasPalletName = ParasPalletName; + type RuntimeEvent = RuntimeEvent; + type TrackedParachains = frame_support::traits::Everything; + type WeightInfo = (); +} diff --git a/runtime/pangoro/src/pallets/fee_market.rs b/runtime/pangoro/src/pallets/fee_market.rs new file mode 100644 index 000000000..c9a1ba34b --- /dev/null +++ b/runtime/pangoro/src/pallets/fee_market.rs @@ -0,0 +1,73 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +pub use pallet_fee_market::Instance1 as WithPangolinFeeMarket; + +// darwinia +use crate::*; + +pub struct FeeMarketSlasher; +impl, I: 'static> pallet_fee_market::Slasher + for FeeMarketSlasher +{ + fn calc_amount( + locked_collateral: pallet_fee_market::BalanceOf, + timeout: T::BlockNumber, + ) -> pallet_fee_market::BalanceOf { + // substrate + use sp_runtime::traits::UniqueSaturatedInto; + + let slash_each_block = 2 * UNIT; + let slash_value = + sp_runtime::traits::UniqueSaturatedInto::::unique_saturated_into(timeout) + .saturating_mul( + sp_runtime::traits::UniqueSaturatedInto::::unique_saturated_into( + slash_each_block, + ), + ) + .unique_saturated_into(); + + core::cmp::min(locked_collateral, slash_value) + } +} + +frame_support::parameter_types! { + pub const TreasuryPalletId: frame_support::PalletId = frame_support::PalletId(*b"da/trsry"); + pub const FeeMarketLockId: frame_support::traits::LockIdentifier = *b"da/feecr"; + + pub const DutyRelayersRewardRatio: sp_runtime::Permill = sp_runtime::Permill::from_percent(60); + pub const MessageRelayersRewardRatio: sp_runtime::Permill = sp_runtime::Permill::from_percent(80); + pub const ConfirmRelayersRewardRatio: sp_runtime::Permill = sp_runtime::Permill::from_percent(20); + pub const AssignedRelayerSlashRatio: sp_runtime::Permill = sp_runtime::Permill::from_percent(20); +} + +impl pallet_fee_market::Config for Runtime { + type AssignedRelayerSlashRatio = AssignedRelayerSlashRatio; + type CollateralPerOrder = ConstU128<{ 50 * UNIT }>; + type ConfirmRelayersRewardRatio = ConfirmRelayersRewardRatio; + type Currency = Balances; + type DutyRelayersRewardRatio = DutyRelayersRewardRatio; + type LockId = FeeMarketLockId; + type MessageRelayersRewardRatio = MessageRelayersRewardRatio; + type MinimumRelayFee = ConstU128<{ 15 * UNIT }>; + type RuntimeEvent = RuntimeEvent; + type Slasher = FeeMarketSlasher; + type Slot = ConstU32<600>; + type TreasuryPalletId = TreasuryPalletId; + type WeightInfo = (); +} diff --git a/runtime/pangoro/src/pallets/mod.rs b/runtime/pangoro/src/pallets/mod.rs index c07ec8c74..2ac24d6da 100644 --- a/runtime/pangoro/src/pallets/mod.rs +++ b/runtime/pangoro/src/pallets/mod.rs @@ -109,3 +109,19 @@ mod evm; pub use evm::*; mod message_transact; + +// S2S stuff. +mod bridge_dispatch; +pub use bridge_dispatch::*; + +mod bridge_grandpa; +pub use bridge_grandpa::*; + +mod bridge_messages; +pub use bridge_messages::*; + +mod bridge_parachains; +pub use bridge_parachains::*; + +mod fee_market; +pub use fee_market::*; From 6117f683eb2b0abb53233c28ae2cb8d2bb9e72b6 Mon Sep 17 00:00:00 2001 From: bear Date: Mon, 20 Feb 2023 20:45:12 +0800 Subject: [PATCH 150/189] Update nonce test (#288) --- tests/ethereum/test-nonce.ts | 53 ++++++++++++++++++++++++++++-------- 1 file changed, 42 insertions(+), 11 deletions(-) diff --git a/tests/ethereum/test-nonce.ts b/tests/ethereum/test-nonce.ts index c51496990..64e68f3bc 100644 --- a/tests/ethereum/test-nonce.ts +++ b/tests/ethereum/test-nonce.ts @@ -2,30 +2,61 @@ import Web3 from "web3"; import { describe } from "mocha"; import { step } from "mocha-steps"; import { expect } from "chai"; -import { HOST_HTTP_URL, FAITH, FAITH_P } from "../config"; +import { HOST_HTTP_URL, FAITH, FAITH_P, DEFAULT_GAS, customRequest } from "../config"; +import { incrementerInfo } from "./contracts/contracts_info"; +import { AbiItem } from "web3-utils"; const web3 = new Web3(HOST_HTTP_URL); -describe("Test balances", () => { +describe("Test nonce", () => { + web3.eth.accounts.wallet.add(FAITH_P); + const inc = new web3.eth.Contract(incrementerInfo.abi as AbiItem[]); + inc.options.from = FAITH; + inc.options.gas = DEFAULT_GAS; + let init_nonce; step("Get the init nonce", async function () { init_nonce = await web3.eth.getTransactionCount(FAITH); }); - step("Make a transaction", async function () { + step("Increase nonce by 1 after transact create", async () => { + let data = inc.deploy({ data: incrementerInfo.bytecode, arguments: [5] }); let tx = await web3.eth.accounts.signTransaction( { from: FAITH, - to: "0x1111111111111111111111111111111111111111", - value: 0x200, - gasPrice: "0x3B9ACA00", // 1000000000, - gas: "0x100000", + data: data.encodeABI(), + gas: DEFAULT_GAS, }, FAITH_P ); - await web3.eth.sendSignedTransaction(tx.rawTransaction); - }).timeout(60000); + let receipt = await web3.eth.sendSignedTransaction(tx.rawTransaction); + + expect(receipt.transactionHash).to.not.be.null; + inc.options.address = receipt.contractAddress; - step("Nonce should be updated after transaction", async function () { expect(await web3.eth.getTransactionCount(FAITH)).to.be.equal(init_nonce + 1); - }); + }).timeout(60000); + + step("Increase nonce by 1 after contract call", async function () { + let receipt = await inc.methods.reset().send(); + expect(receipt.transactionHash).to.not.be.null; + + expect(await web3.eth.getTransactionCount(FAITH)).to.be.equal(init_nonce + 2); + }).timeout(60000); + + step("Rpc call doesn't update nonce", async function () { + expect(await inc.methods.number().call()).to.be.equal("0"); + expect(await web3.eth.getTransactionCount(FAITH)).to.be.equal(init_nonce + 2); + }).timeout(60000); + + step("Increase nonce by 1 after the transaction failed", async function () { + await inc.methods + .increment("0x1234") + .send() + .catch((err) => + expect(err.message).to.equal( + `Returned error: VM Exception while processing transaction: revert.` + ) + ); + expect(await web3.eth.getTransactionCount(FAITH)).to.be.equal(init_nonce + 3); + }).timeout(60000); }); From 85157b7dd7551e78097824a07b17c33f1d1a8a0c Mon Sep 17 00:00:00 2001 From: Guantong Date: Mon, 20 Feb 2023 20:45:50 +0800 Subject: [PATCH 151/189] Remove assertions in HRMP&DMP (#290) * Patch cumulus * Bump darwinia/cumulus --- Cargo.lock | 48 ++++++++++++++++++++++++------------------------ Cargo.toml | 20 ++++++++++++++++++++ 2 files changed, 44 insertions(+), 24 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 15f7014b7..48d61e64f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1679,7 +1679,7 @@ dependencies = [ [[package]] name = "cumulus-client-cli" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.37#09418fc04c2608b123f36ca80f16df3d2096753b" +source = "git+https://github.com/darwinia-network/cumulus?branch=remove-assertion-v0.9.37#3ea837814e9734c9831f652896a232807e88bed8" dependencies = [ "clap", "parity-scale-codec", @@ -1694,7 +1694,7 @@ dependencies = [ [[package]] name = "cumulus-client-collator" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.37#09418fc04c2608b123f36ca80f16df3d2096753b" +source = "git+https://github.com/darwinia-network/cumulus?branch=remove-assertion-v0.9.37#3ea837814e9734c9831f652896a232807e88bed8" dependencies = [ "cumulus-client-consensus-common", "cumulus-client-network", @@ -1717,7 +1717,7 @@ dependencies = [ [[package]] name = "cumulus-client-consensus-aura" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.37#09418fc04c2608b123f36ca80f16df3d2096753b" +source = "git+https://github.com/darwinia-network/cumulus?branch=remove-assertion-v0.9.37#3ea837814e9734c9831f652896a232807e88bed8" dependencies = [ "async-trait", "cumulus-client-consensus-common", @@ -1746,7 +1746,7 @@ dependencies = [ [[package]] name = "cumulus-client-consensus-common" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.37#09418fc04c2608b123f36ca80f16df3d2096753b" +source = "git+https://github.com/darwinia-network/cumulus?branch=remove-assertion-v0.9.37#3ea837814e9734c9831f652896a232807e88bed8" dependencies = [ "async-trait", "cumulus-client-pov-recovery", @@ -1769,7 +1769,7 @@ dependencies = [ [[package]] name = "cumulus-client-network" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.37#09418fc04c2608b123f36ca80f16df3d2096753b" +source = "git+https://github.com/darwinia-network/cumulus?branch=remove-assertion-v0.9.37#3ea837814e9734c9831f652896a232807e88bed8" dependencies = [ "async-trait", "cumulus-relay-chain-interface", @@ -1792,7 +1792,7 @@ dependencies = [ [[package]] name = "cumulus-client-pov-recovery" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.37#09418fc04c2608b123f36ca80f16df3d2096753b" +source = "git+https://github.com/darwinia-network/cumulus?branch=remove-assertion-v0.9.37#3ea837814e9734c9831f652896a232807e88bed8" dependencies = [ "cumulus-primitives-core", "cumulus-relay-chain-interface", @@ -1815,7 +1815,7 @@ dependencies = [ [[package]] name = "cumulus-client-service" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.37#09418fc04c2608b123f36ca80f16df3d2096753b" +source = "git+https://github.com/darwinia-network/cumulus?branch=remove-assertion-v0.9.37#3ea837814e9734c9831f652896a232807e88bed8" dependencies = [ "cumulus-client-cli", "cumulus-client-collator", @@ -1843,7 +1843,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-aura-ext" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.37#09418fc04c2608b123f36ca80f16df3d2096753b" +source = "git+https://github.com/darwinia-network/cumulus?branch=remove-assertion-v0.9.37#3ea837814e9734c9831f652896a232807e88bed8" dependencies = [ "frame-support", "frame-system", @@ -1859,7 +1859,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-dmp-queue" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.37#09418fc04c2608b123f36ca80f16df3d2096753b" +source = "git+https://github.com/darwinia-network/cumulus?branch=remove-assertion-v0.9.37#3ea837814e9734c9831f652896a232807e88bed8" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -1876,7 +1876,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-parachain-system" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.37#09418fc04c2608b123f36ca80f16df3d2096753b" +source = "git+https://github.com/darwinia-network/cumulus?branch=remove-assertion-v0.9.37#3ea837814e9734c9831f652896a232807e88bed8" dependencies = [ "bytes", "cumulus-pallet-parachain-system-proc-macro", @@ -1904,7 +1904,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-parachain-system-proc-macro" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.37#09418fc04c2608b123f36ca80f16df3d2096753b" +source = "git+https://github.com/darwinia-network/cumulus?branch=remove-assertion-v0.9.37#3ea837814e9734c9831f652896a232807e88bed8" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -1915,7 +1915,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-session-benchmarking" version = "3.0.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.37#09418fc04c2608b123f36ca80f16df3d2096753b" +source = "git+https://github.com/darwinia-network/cumulus?branch=remove-assertion-v0.9.37#3ea837814e9734c9831f652896a232807e88bed8" dependencies = [ "frame-benchmarking", "frame-support", @@ -1929,7 +1929,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-xcm" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.37#09418fc04c2608b123f36ca80f16df3d2096753b" +source = "git+https://github.com/darwinia-network/cumulus?branch=remove-assertion-v0.9.37#3ea837814e9734c9831f652896a232807e88bed8" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -1945,7 +1945,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-xcmp-queue" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.37#09418fc04c2608b123f36ca80f16df3d2096753b" +source = "git+https://github.com/darwinia-network/cumulus?branch=remove-assertion-v0.9.37#3ea837814e9734c9831f652896a232807e88bed8" dependencies = [ "cumulus-primitives-core", "frame-benchmarking", @@ -1964,7 +1964,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-core" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.37#09418fc04c2608b123f36ca80f16df3d2096753b" +source = "git+https://github.com/darwinia-network/cumulus?branch=remove-assertion-v0.9.37#3ea837814e9734c9831f652896a232807e88bed8" dependencies = [ "parity-scale-codec", "polkadot-core-primitives", @@ -1979,7 +1979,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-parachain-inherent" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.37#09418fc04c2608b123f36ca80f16df3d2096753b" +source = "git+https://github.com/darwinia-network/cumulus?branch=remove-assertion-v0.9.37#3ea837814e9734c9831f652896a232807e88bed8" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -2002,7 +2002,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-timestamp" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.37#09418fc04c2608b123f36ca80f16df3d2096753b" +source = "git+https://github.com/darwinia-network/cumulus?branch=remove-assertion-v0.9.37#3ea837814e9734c9831f652896a232807e88bed8" dependencies = [ "cumulus-primitives-core", "futures", @@ -2015,7 +2015,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-utility" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.37#09418fc04c2608b123f36ca80f16df3d2096753b" +source = "git+https://github.com/darwinia-network/cumulus?branch=remove-assertion-v0.9.37#3ea837814e9734c9831f652896a232807e88bed8" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -2031,7 +2031,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-inprocess-interface" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.37#09418fc04c2608b123f36ca80f16df3d2096753b" +source = "git+https://github.com/darwinia-network/cumulus?branch=remove-assertion-v0.9.37#3ea837814e9734c9831f652896a232807e88bed8" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -2056,7 +2056,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-interface" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.37#09418fc04c2608b123f36ca80f16df3d2096753b" +source = "git+https://github.com/darwinia-network/cumulus?branch=remove-assertion-v0.9.37#3ea837814e9734c9831f652896a232807e88bed8" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -2076,7 +2076,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-minimal-node" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.37#09418fc04c2608b123f36ca80f16df3d2096753b" +source = "git+https://github.com/darwinia-network/cumulus?branch=remove-assertion-v0.9.37#3ea837814e9734c9831f652896a232807e88bed8" dependencies = [ "array-bytes 6.0.0", "async-trait", @@ -2116,7 +2116,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-rpc-interface" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.37#09418fc04c2608b123f36ca80f16df3d2096753b" +source = "git+https://github.com/darwinia-network/cumulus?branch=remove-assertion-v0.9.37#3ea837814e9734c9831f652896a232807e88bed8" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -2145,7 +2145,7 @@ dependencies = [ [[package]] name = "cumulus-test-relay-sproof-builder" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.37#09418fc04c2608b123f36ca80f16df3d2096753b" +source = "git+https://github.com/darwinia-network/cumulus?branch=remove-assertion-v0.9.37#3ea837814e9734c9831f652896a232807e88bed8" dependencies = [ "cumulus-primitives-core", "parity-scale-codec", @@ -7872,7 +7872,7 @@ dependencies = [ [[package]] name = "parachain-info" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.37#09418fc04c2608b123f36ca80f16df3d2096753b" +source = "git+https://github.com/darwinia-network/cumulus?branch=remove-assertion-v0.9.37#3ea837814e9734c9831f652896a232807e88bed8" dependencies = [ "cumulus-primitives-core", "frame-support", diff --git a/Cargo.toml b/Cargo.toml index 3fd30fd62..a7110c059 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -359,3 +359,23 @@ substrate-rpc-client = { git = "https://github.com/darw substrate-state-trie-migration-rpc = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } substrate-wasm-builder = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } try-runtime-cli = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } + +[patch."https://github.com/paritytech/cumulus"] +cumulus-client-cli = { git = "https://github.com/darwinia-network/cumulus", branch = "remove-assertion-v0.9.37" } +cumulus-client-collator = { git = "https://github.com/darwinia-network/cumulus", branch = "remove-assertion-v0.9.37" } +cumulus-client-consensus-aura = { git = "https://github.com/darwinia-network/cumulus", branch = "remove-assertion-v0.9.37" } +cumulus-client-consensus-common = { git = "https://github.com/darwinia-network/cumulus", branch = "remove-assertion-v0.9.37" } +cumulus-client-network = { git = "https://github.com/darwinia-network/cumulus", branch = "remove-assertion-v0.9.37" } +cumulus-client-service = { git = "https://github.com/darwinia-network/cumulus", branch = "remove-assertion-v0.9.37" } +cumulus-pallet-aura-ext = { git = "https://github.com/darwinia-network/cumulus", branch = "remove-assertion-v0.9.37" } +cumulus-pallet-dmp-queue = { git = "https://github.com/darwinia-network/cumulus", branch = "remove-assertion-v0.9.37" } +cumulus-pallet-parachain-system = { git = "https://github.com/darwinia-network/cumulus", branch = "remove-assertion-v0.9.37" } +cumulus-pallet-session-benchmarking = { git = "https://github.com/darwinia-network/cumulus", branch = "remove-assertion-v0.9.37" } +cumulus-pallet-xcm = { git = "https://github.com/darwinia-network/cumulus", branch = "remove-assertion-v0.9.37" } +cumulus-pallet-xcmp-queue = { git = "https://github.com/darwinia-network/cumulus", branch = "remove-assertion-v0.9.37" } +cumulus-primitives-core = { git = "https://github.com/darwinia-network/cumulus", branch = "remove-assertion-v0.9.37" } +cumulus-primitives-parachain-inherent = { git = "https://github.com/darwinia-network/cumulus", branch = "remove-assertion-v0.9.37" } +cumulus-primitives-timestamp = { git = "https://github.com/darwinia-network/cumulus", branch = "remove-assertion-v0.9.37" } +cumulus-primitives-utility = { git = "https://github.com/darwinia-network/cumulus", branch = "remove-assertion-v0.9.37" } +cumulus-relay-chain-interface = { git = "https://github.com/darwinia-network/cumulus", branch = "remove-assertion-v0.9.37" } +parachain-info = { git = "https://github.com/darwinia-network/cumulus", branch = "remove-assertion-v0.9.37" } From c46aa63ca28da62552159ac40e1e113de5462ca3 Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Mon, 20 Feb 2023 20:46:04 +0800 Subject: [PATCH 152/189] Preparation of Pangoro2 (#291) * Correct command * Some fixes --- node/src/command.rs | 2 +- tool/state-processor/src/configuration.rs | 15 +++++++++++++++ tool/state-processor/src/main.rs | 4 ++-- tool/state-processor/src/parachain_system/mod.rs | 7 ++++++- tool/state-processor/src/system/mod.rs | 2 -- 5 files changed, 24 insertions(+), 6 deletions(-) diff --git a/node/src/command.rs b/node/src/command.rs index 41000855f..ef676a400 100644 --- a/node/src/command.rs +++ b/node/src/command.rs @@ -783,7 +783,7 @@ pub fn run() -> Result<()> { } #[cfg(feature = "pangoro-native")] - if chain_spec.is_darwinia() { + if chain_spec.is_pangoro() { return service::start_parachain_node::( config, polkadot_config, diff --git a/tool/state-processor/src/configuration.rs b/tool/state-processor/src/configuration.rs index 99e94eda6..d2756b64a 100644 --- a/tool/state-processor/src/configuration.rs +++ b/tool/state-processor/src/configuration.rs @@ -84,3 +84,18 @@ impl Configurable for Pangolin { 66 * 100 * MICROUNIT } } + +pub struct Pangoro; +impl Configurable for Pangoro { + const NAME: &'static str = "pangoro"; + const PARACHAIN_BACKING: &'static str = + "0x64766d3a000000000000008c585f9791ee5b4b23fe82888ce576dbb69607ebe9"; + + fn basic_deposit() -> Balance { + 100 * UNIT + 258 * 100 * MICROUNIT + } + + fn field_deposit() -> Balance { + 66 * 100 * MICROUNIT + } +} diff --git a/tool/state-processor/src/main.rs b/tool/state-processor/src/main.rs index 41a6ed389..862d064a2 100644 --- a/tool/state-processor/src/main.rs +++ b/tool/state-processor/src/main.rs @@ -34,8 +34,8 @@ fn main() -> Result<()> { // >::new()?.process().save()?; // >::new()?.test().process().save()?; // >::new()?.process().save()?; - // >::new()?.test().process().save()?; - >::new()?.process().save()?; + >::new()?.test().process().save()?; + // >::new()?.process().save()?; // >::new()?.test().process().save()?; // >::new()?.process().save()?; // >::new()?.test().process().save()?; diff --git a/tool/state-processor/src/parachain_system/mod.rs b/tool/state-processor/src/parachain_system/mod.rs index df090dd85..034a7c69d 100644 --- a/tool/state-processor/src/parachain_system/mod.rs +++ b/tool/state-processor/src/parachain_system/mod.rs @@ -3,6 +3,10 @@ use crate::*; impl Processor { pub fn process_parachain_system(&mut self) -> &mut Self { + if self.test { + return self; + } + // Storage items. // https://github.com/darwinia-network/darwinia-2.0/issues/275#issuecomment-1427725708 // https://github.com/paritytech/cumulus/blob/09418fc04c2608b123f36ca80f16df3d2096753b/pallets/parachain-system/src/lib.rs#L582-L595 @@ -16,7 +20,8 @@ impl Processor { log::info!( "take para `ParachainSystem::LastDmqMqcHead` and `ParachainSystem::LastHrmpMqcHeads`" ); - self.solo_state + + self.para_state .take_raw_value(last_dmq_mqc_head_key, &mut last_dmq_mqc_head) .take_raw_value(last_hrmp_mqc_heads_key, &mut last_hrmp_mqc_heads); diff --git a/tool/state-processor/src/system/mod.rs b/tool/state-processor/src/system/mod.rs index 009277671..5f277093c 100644 --- a/tool/state-processor/src/system/mod.rs +++ b/tool/state-processor/src/system/mod.rs @@ -219,8 +219,6 @@ where }); log::info!("set `Assets::Asset`"); - log::info!("kton_total_issuance({kton_total_issuance})"); - log::info!("kton_total_issuance_storage({kton_total_issuance_storage})"); self.shell_state.insert_value( b"Assets", b"Asset", From f24def2b9c98dcd5c9a6f90ba67c93b21995ab49 Mon Sep 17 00:00:00 2001 From: bear Date: Wed, 22 Feb 2023 11:39:55 +0800 Subject: [PATCH 153/189] Update evm module runtime name (#293) * Fix evm runtime name * Format toml * Add migration * Fix state processor * Use latest polkadot-v0.9.37 commit * Fix tests --- Cargo.lock | 407 ++++++++++--------- Cargo.toml | 346 ++++++++-------- node/src/chain_spec/crab.rs | 4 +- node/src/chain_spec/darwinia.rs | 4 +- node/src/chain_spec/pangolin.rs | 4 +- node/src/chain_spec/pangoro.rs | 4 +- pallet/message-gadget/tests/tests.rs | 2 +- pallet/message-transact/src/lib.rs | 6 +- pallet/message-transact/src/tests/eip1559.rs | 2 +- pallet/message-transact/src/tests/eip2930.rs | 2 +- pallet/message-transact/src/tests/legacy.rs | 2 +- precompile/state-storage/src/lib.rs | 2 +- precompile/state-storage/src/mock.rs | 2 +- runtime/crab/src/lib.rs | 8 +- runtime/darwinia/src/lib.rs | 8 +- runtime/darwinia/src/pallets/evm.rs | 1 - runtime/pangolin/src/lib.rs | 8 +- runtime/pangolin/src/migration.rs | 3 +- runtime/pangoro/src/lib.rs | 8 +- tests/ethereum/test-contract.ts | 2 +- tool/state-processor/src/evm/README.md | 2 +- tool/state-processor/src/evm/mod.rs | 22 +- tool/state-processor/src/tests.rs | 6 +- tool/state-processor/src/util.rs | 4 - 24 files changed, 440 insertions(+), 419 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 48d61e64f..b8c69f089 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -167,6 +167,18 @@ dependencies = [ "version_check", ] +[[package]] +name = "ahash" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" +dependencies = [ + "cfg-if", + "getrandom 0.2.8", + "once_cell", + "version_check", +] + [[package]] name = "aho-corasick" version = "0.7.20" @@ -496,7 +508,7 @@ dependencies = [ [[package]] name = "beefy-gadget" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "array-bytes 4.2.0", "async-trait", @@ -530,7 +542,7 @@ dependencies = [ [[package]] name = "beefy-gadget-rpc" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "beefy-gadget", "futures", @@ -549,7 +561,7 @@ dependencies = [ [[package]] name = "beefy-merkle-tree" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "sp-api", "sp-beefy", @@ -3048,7 +3060,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7c24f403d068ad0b359e577a77f92392118be3f3c927538f2bb544a5ecd828c6" dependencies = [ "curve25519-dalek 3.2.0", - "hashbrown", + "hashbrown 0.12.3", "hex", "rand_core 0.6.4", "sha2 0.9.9", @@ -3677,7 +3689,7 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "fork-tree" version = "3.0.0" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "parity-scale-codec", ] @@ -3776,9 +3788,10 @@ checksum = "6c2141d6d6c8512188a7891b4b01590a45f6dac67afb4f255c4124dbb86d4eaa" [[package]] name = "frame-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "frame-support", + "frame-support-procedural", "frame-system", "linregress", "log", @@ -3794,12 +3807,13 @@ dependencies = [ "sp-runtime-interface", "sp-std", "sp-storage", + "static_assertions", ] [[package]] name = "frame-benchmarking-cli" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "Inflector", "array-bytes 4.2.0", @@ -3846,7 +3860,7 @@ dependencies = [ [[package]] name = "frame-election-provider-solution-type" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -3857,7 +3871,7 @@ dependencies = [ [[package]] name = "frame-election-provider-support" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "frame-election-provider-solution-type", "frame-support", @@ -3874,7 +3888,7 @@ dependencies = [ [[package]] name = "frame-executive" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "frame-support", "frame-system", @@ -3903,7 +3917,7 @@ dependencies = [ [[package]] name = "frame-remote-externalities" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "futures", "log", @@ -3919,7 +3933,7 @@ dependencies = [ [[package]] name = "frame-support" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "bitflags", "frame-metadata", @@ -3945,14 +3959,13 @@ dependencies = [ "sp-std", "sp-tracing", "sp-weights", - "static_assertions", "tt-call", ] [[package]] name = "frame-support-procedural" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "Inflector", "cfg-expr", @@ -3967,7 +3980,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "frame-support-procedural-tools-derive", "proc-macro-crate", @@ -3979,7 +3992,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools-derive" version = "3.0.0" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "proc-macro2", "quote", @@ -3989,7 +4002,7 @@ dependencies = [ [[package]] name = "frame-system" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "frame-support", "log", @@ -4007,7 +4020,7 @@ dependencies = [ [[package]] name = "frame-system-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "frame-benchmarking", "frame-support", @@ -4022,7 +4035,7 @@ dependencies = [ [[package]] name = "frame-system-rpc-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "parity-scale-codec", "sp-api", @@ -4031,7 +4044,7 @@ dependencies = [ [[package]] name = "frame-try-runtime" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "frame-support", "parity-scale-codec", @@ -4371,9 +4384,15 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" dependencies = [ - "ahash", + "ahash 0.7.6", ] +[[package]] +name = "hashbrown" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" + [[package]] name = "heck" version = "0.4.0" @@ -4708,7 +4727,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399" dependencies = [ "autocfg", - "hashbrown", + "hashbrown 0.12.3", "serde", ] @@ -5723,7 +5742,7 @@ version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6e8aaa3f231bb4bd57b84b2d5dc3ae7f350265df8aa96492e0bc394a1571909" dependencies = [ - "hashbrown", + "hashbrown 0.12.3", ] [[package]] @@ -5852,7 +5871,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e0c7cba9ce19ac7ffd2053ac9f49843bbd3f4318feedfd74e85c19d5fb0ba66" dependencies = [ "hash-db", - "hashbrown", + "hashbrown 0.12.3", ] [[package]] @@ -5924,7 +5943,7 @@ dependencies = [ [[package]] name = "mmr-gadget" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "futures", "log", @@ -5943,7 +5962,7 @@ dependencies = [ [[package]] name = "mmr-rpc" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "anyhow", "jsonrpsee", @@ -6347,7 +6366,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "21158b2c33aa6d4561f1c0a6ea283ca92bc54802a93b263e910746d679a7eb53" dependencies = [ "crc32fast", - "hashbrown", + "hashbrown 0.12.3", "indexmap", "memchr", ] @@ -6515,7 +6534,7 @@ dependencies = [ [[package]] name = "pallet-assets" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "frame-benchmarking", "frame-support", @@ -6530,7 +6549,7 @@ dependencies = [ [[package]] name = "pallet-aura" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "frame-support", "frame-system", @@ -6546,7 +6565,7 @@ dependencies = [ [[package]] name = "pallet-authority-discovery" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "frame-support", "frame-system", @@ -6562,7 +6581,7 @@ dependencies = [ [[package]] name = "pallet-authorship" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "frame-support", "frame-system", @@ -6577,7 +6596,7 @@ dependencies = [ [[package]] name = "pallet-babe" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "frame-benchmarking", "frame-support", @@ -6601,7 +6620,7 @@ dependencies = [ [[package]] name = "pallet-bags-list" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -6621,7 +6640,7 @@ dependencies = [ [[package]] name = "pallet-balances" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "frame-benchmarking", "frame-support", @@ -6636,7 +6655,7 @@ dependencies = [ [[package]] name = "pallet-beefy" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "frame-support", "frame-system", @@ -6652,7 +6671,7 @@ dependencies = [ [[package]] name = "pallet-beefy-mmr" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "array-bytes 4.2.0", "beefy-merkle-tree", @@ -6675,7 +6694,7 @@ dependencies = [ [[package]] name = "pallet-bounties" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "frame-benchmarking", "frame-support", @@ -6773,7 +6792,7 @@ dependencies = [ [[package]] name = "pallet-child-bounties" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "frame-benchmarking", "frame-support", @@ -6792,7 +6811,7 @@ dependencies = [ [[package]] name = "pallet-collective" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "frame-benchmarking", "frame-support", @@ -6809,7 +6828,7 @@ dependencies = [ [[package]] name = "pallet-conviction-voting" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "assert_matches", "frame-benchmarking", @@ -6826,7 +6845,7 @@ dependencies = [ [[package]] name = "pallet-democracy" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "frame-benchmarking", "frame-support", @@ -6844,7 +6863,7 @@ dependencies = [ [[package]] name = "pallet-election-provider-multi-phase" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -6867,7 +6886,7 @@ dependencies = [ [[package]] name = "pallet-election-provider-support-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -6880,7 +6899,7 @@ dependencies = [ [[package]] name = "pallet-elections-phragmen" version = "5.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "frame-benchmarking", "frame-support", @@ -6995,7 +7014,7 @@ dependencies = [ [[package]] name = "pallet-fast-unstake" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -7032,7 +7051,7 @@ dependencies = [ [[package]] name = "pallet-grandpa" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "frame-benchmarking", "frame-support", @@ -7055,7 +7074,7 @@ dependencies = [ [[package]] name = "pallet-identity" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "enumflags2", "frame-benchmarking", @@ -7071,7 +7090,7 @@ dependencies = [ [[package]] name = "pallet-im-online" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "frame-benchmarking", "frame-support", @@ -7091,7 +7110,7 @@ dependencies = [ [[package]] name = "pallet-indices" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "frame-benchmarking", "frame-support", @@ -7108,7 +7127,7 @@ dependencies = [ [[package]] name = "pallet-membership" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "frame-benchmarking", "frame-support", @@ -7125,7 +7144,7 @@ dependencies = [ [[package]] name = "pallet-mmr" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "frame-benchmarking", "frame-support", @@ -7142,7 +7161,7 @@ dependencies = [ [[package]] name = "pallet-multisig" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "frame-benchmarking", "frame-support", @@ -7158,7 +7177,7 @@ dependencies = [ [[package]] name = "pallet-nis" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "frame-benchmarking", "frame-support", @@ -7174,7 +7193,7 @@ dependencies = [ [[package]] name = "pallet-nomination-pools" version = "1.0.0" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "frame-support", "frame-system", @@ -7191,7 +7210,7 @@ dependencies = [ [[package]] name = "pallet-nomination-pools-benchmarking" version = "1.0.0" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -7211,7 +7230,7 @@ dependencies = [ [[package]] name = "pallet-nomination-pools-runtime-api" version = "1.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "parity-scale-codec", "sp-api", @@ -7221,7 +7240,7 @@ dependencies = [ [[package]] name = "pallet-offences" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "frame-support", "frame-system", @@ -7238,7 +7257,7 @@ dependencies = [ [[package]] name = "pallet-offences-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -7261,7 +7280,7 @@ dependencies = [ [[package]] name = "pallet-preimage" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "frame-benchmarking", "frame-support", @@ -7278,7 +7297,7 @@ dependencies = [ [[package]] name = "pallet-proxy" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "frame-benchmarking", "frame-support", @@ -7293,7 +7312,7 @@ dependencies = [ [[package]] name = "pallet-ranked-collective" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "frame-benchmarking", "frame-support", @@ -7311,7 +7330,7 @@ dependencies = [ [[package]] name = "pallet-recovery" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "frame-benchmarking", "frame-support", @@ -7326,7 +7345,7 @@ dependencies = [ [[package]] name = "pallet-referenda" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "assert_matches", "frame-benchmarking", @@ -7345,7 +7364,7 @@ dependencies = [ [[package]] name = "pallet-scheduler" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "frame-benchmarking", "frame-support", @@ -7362,7 +7381,7 @@ dependencies = [ [[package]] name = "pallet-session" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "frame-support", "frame-system", @@ -7383,7 +7402,7 @@ dependencies = [ [[package]] name = "pallet-session-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "frame-benchmarking", "frame-support", @@ -7399,7 +7418,7 @@ dependencies = [ [[package]] name = "pallet-society" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "frame-support", "frame-system", @@ -7413,7 +7432,7 @@ dependencies = [ [[package]] name = "pallet-staking" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -7436,7 +7455,7 @@ dependencies = [ [[package]] name = "pallet-staking-reward-curve" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -7447,7 +7466,7 @@ dependencies = [ [[package]] name = "pallet-staking-reward-fn" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "log", "sp-arithmetic", @@ -7456,7 +7475,7 @@ dependencies = [ [[package]] name = "pallet-state-trie-migration" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "frame-benchmarking", "frame-support", @@ -7473,7 +7492,7 @@ dependencies = [ [[package]] name = "pallet-sudo" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "frame-support", "frame-system", @@ -7487,7 +7506,7 @@ dependencies = [ [[package]] name = "pallet-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "frame-benchmarking", "frame-support", @@ -7505,7 +7524,7 @@ dependencies = [ [[package]] name = "pallet-tips" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "frame-benchmarking", "frame-support", @@ -7524,7 +7543,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "frame-support", "frame-system", @@ -7540,7 +7559,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "jsonrpsee", "pallet-transaction-payment-rpc-runtime-api", @@ -7556,7 +7575,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "pallet-transaction-payment", "parity-scale-codec", @@ -7568,7 +7587,7 @@ dependencies = [ [[package]] name = "pallet-treasury" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "frame-benchmarking", "frame-support", @@ -7585,7 +7604,7 @@ dependencies = [ [[package]] name = "pallet-utility" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "frame-benchmarking", "frame-support", @@ -7601,7 +7620,7 @@ dependencies = [ [[package]] name = "pallet-vesting" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "frame-benchmarking", "frame-support", @@ -7616,7 +7635,7 @@ dependencies = [ [[package]] name = "pallet-whitelist" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "frame-benchmarking", "frame-support", @@ -10324,7 +10343,7 @@ dependencies = [ [[package]] name = "sc-allocator" version = "4.1.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "log", "sp-core", @@ -10335,7 +10354,7 @@ dependencies = [ [[package]] name = "sc-authority-discovery" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "async-trait", "futures", @@ -10362,7 +10381,7 @@ dependencies = [ [[package]] name = "sc-basic-authorship" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "futures", "futures-timer", @@ -10385,7 +10404,7 @@ dependencies = [ [[package]] name = "sc-block-builder" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "parity-scale-codec", "sc-client-api", @@ -10401,7 +10420,7 @@ dependencies = [ [[package]] name = "sc-chain-spec" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "memmap2", "sc-chain-spec-derive", @@ -10416,7 +10435,7 @@ dependencies = [ [[package]] name = "sc-chain-spec-derive" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -10427,7 +10446,7 @@ dependencies = [ [[package]] name = "sc-cli" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "array-bytes 4.2.0", "chrono", @@ -10467,7 +10486,7 @@ dependencies = [ [[package]] name = "sc-client-api" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "fnv", "futures", @@ -10493,7 +10512,7 @@ dependencies = [ [[package]] name = "sc-client-db" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "hash-db", "kvdb", @@ -10506,6 +10525,7 @@ dependencies = [ "parking_lot 0.12.1", "sc-client-api", "sc-state-db", + "schnellru", "sp-arithmetic", "sp-blockchain", "sp-core", @@ -10518,7 +10538,7 @@ dependencies = [ [[package]] name = "sc-consensus" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "async-trait", "futures", @@ -10543,7 +10563,7 @@ dependencies = [ [[package]] name = "sc-consensus-aura" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "async-trait", "futures", @@ -10572,7 +10592,7 @@ dependencies = [ [[package]] name = "sc-consensus-babe" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "async-trait", "fork-tree", @@ -10610,7 +10630,7 @@ dependencies = [ [[package]] name = "sc-consensus-babe-rpc" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "futures", "jsonrpsee", @@ -10632,7 +10652,7 @@ dependencies = [ [[package]] name = "sc-consensus-epochs" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "fork-tree", "parity-scale-codec", @@ -10645,7 +10665,7 @@ dependencies = [ [[package]] name = "sc-consensus-slots" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "async-trait", "futures", @@ -10668,7 +10688,7 @@ dependencies = [ [[package]] name = "sc-executor" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "lru", "parity-scale-codec", @@ -10692,7 +10712,7 @@ dependencies = [ [[package]] name = "sc-executor-common" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "sc-allocator", "sp-maybe-compressed-blob", @@ -10705,7 +10725,7 @@ dependencies = [ [[package]] name = "sc-executor-wasmi" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "log", "sc-allocator", @@ -10718,7 +10738,7 @@ dependencies = [ [[package]] name = "sc-executor-wasmtime" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "cfg-if", "libc", @@ -10735,9 +10755,9 @@ dependencies = [ [[package]] name = "sc-finality-grandpa" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ - "ahash", + "ahash 0.7.6", "array-bytes 4.2.0", "async-trait", "dyn-clone", @@ -10775,7 +10795,7 @@ dependencies = [ [[package]] name = "sc-finality-grandpa-rpc" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "finality-grandpa", "futures", @@ -10795,7 +10815,7 @@ dependencies = [ [[package]] name = "sc-informant" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "ansi_term", "futures", @@ -10810,7 +10830,7 @@ dependencies = [ [[package]] name = "sc-keystore" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "array-bytes 4.2.0", "async-trait", @@ -10825,7 +10845,7 @@ dependencies = [ [[package]] name = "sc-network" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "array-bytes 4.2.0", "async-trait", @@ -10867,7 +10887,7 @@ dependencies = [ [[package]] name = "sc-network-bitswap" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "cid", "futures", @@ -10886,7 +10906,7 @@ dependencies = [ [[package]] name = "sc-network-common" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "async-trait", "bitflags", @@ -10912,9 +10932,9 @@ dependencies = [ [[package]] name = "sc-network-gossip" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ - "ahash", + "ahash 0.7.6", "futures", "futures-timer", "libp2p", @@ -10930,7 +10950,7 @@ dependencies = [ [[package]] name = "sc-network-light" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "array-bytes 4.2.0", "futures", @@ -10951,7 +10971,7 @@ dependencies = [ [[package]] name = "sc-network-sync" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "array-bytes 4.2.0", "async-trait", @@ -10983,7 +11003,7 @@ dependencies = [ [[package]] name = "sc-network-transactions" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "array-bytes 4.2.0", "futures", @@ -11002,7 +11022,7 @@ dependencies = [ [[package]] name = "sc-offchain" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "array-bytes 4.2.0", "bytes", @@ -11032,7 +11052,7 @@ dependencies = [ [[package]] name = "sc-peerset" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "futures", "libp2p", @@ -11045,7 +11065,7 @@ dependencies = [ [[package]] name = "sc-proposer-metrics" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "log", "substrate-prometheus-endpoint", @@ -11054,7 +11074,7 @@ dependencies = [ [[package]] name = "sc-rpc" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "futures", "jsonrpsee", @@ -11083,7 +11103,7 @@ dependencies = [ [[package]] name = "sc-rpc-api" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "jsonrpsee", "parity-scale-codec", @@ -11102,7 +11122,7 @@ dependencies = [ [[package]] name = "sc-rpc-server" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "http", "jsonrpsee", @@ -11117,7 +11137,7 @@ dependencies = [ [[package]] name = "sc-rpc-spec-v2" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "array-bytes 4.2.0", "futures", @@ -11143,7 +11163,7 @@ dependencies = [ [[package]] name = "sc-service" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "async-trait", "directories", @@ -11208,7 +11228,7 @@ dependencies = [ [[package]] name = "sc-state-db" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "log", "parity-scale-codec", @@ -11219,7 +11239,7 @@ dependencies = [ [[package]] name = "sc-sync-state-rpc" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "jsonrpsee", "parity-scale-codec", @@ -11238,7 +11258,7 @@ dependencies = [ [[package]] name = "sc-sysinfo" version = "6.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "futures", "libc", @@ -11257,7 +11277,7 @@ dependencies = [ [[package]] name = "sc-telemetry" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "chrono", "futures", @@ -11276,7 +11296,7 @@ dependencies = [ [[package]] name = "sc-tracing" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "ansi_term", "atty", @@ -11307,7 +11327,7 @@ dependencies = [ [[package]] name = "sc-tracing-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -11318,7 +11338,7 @@ dependencies = [ [[package]] name = "sc-transaction-pool" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "async-trait", "futures", @@ -11344,7 +11364,7 @@ dependencies = [ [[package]] name = "sc-transaction-pool-api" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "async-trait", "futures", @@ -11358,7 +11378,7 @@ dependencies = [ [[package]] name = "sc-utils" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "backtrace", "futures", @@ -11404,6 +11424,17 @@ dependencies = [ "windows-sys 0.42.0", ] +[[package]] +name = "schnellru" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "772575a524feeb803e5b0fcbc6dd9f367e579488197c94c6e4023aad2305774d" +dependencies = [ + "ahash 0.8.3", + "cfg-if", + "hashbrown 0.13.2", +] + [[package]] name = "schnorrkel" version = "0.9.1" @@ -11817,7 +11848,7 @@ dependencies = [ [[package]] name = "sp-api" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "hash-db", "log", @@ -11835,7 +11866,7 @@ dependencies = [ [[package]] name = "sp-api-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "blake2", "proc-macro-crate", @@ -11847,7 +11878,7 @@ dependencies = [ [[package]] name = "sp-application-crypto" version = "7.0.0" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "parity-scale-codec", "scale-info", @@ -11860,7 +11891,7 @@ dependencies = [ [[package]] name = "sp-arithmetic" version = "6.0.0" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "integer-sqrt", "num-traits", @@ -11874,7 +11905,7 @@ dependencies = [ [[package]] name = "sp-authority-discovery" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "parity-scale-codec", "scale-info", @@ -11887,7 +11918,7 @@ dependencies = [ [[package]] name = "sp-authorship" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "async-trait", "parity-scale-codec", @@ -11899,7 +11930,7 @@ dependencies = [ [[package]] name = "sp-beefy" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "parity-scale-codec", "scale-info", @@ -11916,7 +11947,7 @@ dependencies = [ [[package]] name = "sp-block-builder" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "parity-scale-codec", "sp-api", @@ -11928,7 +11959,7 @@ dependencies = [ [[package]] name = "sp-blockchain" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "futures", "log", @@ -11946,7 +11977,7 @@ dependencies = [ [[package]] name = "sp-consensus" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "async-trait", "futures", @@ -11964,7 +11995,7 @@ dependencies = [ [[package]] name = "sp-consensus-aura" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "async-trait", "parity-scale-codec", @@ -11982,7 +12013,7 @@ dependencies = [ [[package]] name = "sp-consensus-babe" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "async-trait", "merlin", @@ -12005,7 +12036,7 @@ dependencies = [ [[package]] name = "sp-consensus-slots" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "parity-scale-codec", "scale-info", @@ -12017,7 +12048,7 @@ dependencies = [ [[package]] name = "sp-consensus-vrf" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "parity-scale-codec", "scale-info", @@ -12030,7 +12061,7 @@ dependencies = [ [[package]] name = "sp-core" version = "7.0.0" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "array-bytes 4.2.0", "base58", @@ -12072,7 +12103,7 @@ dependencies = [ [[package]] name = "sp-core-hashing" version = "5.0.0" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "blake2", "byteorder", @@ -12086,7 +12117,7 @@ dependencies = [ [[package]] name = "sp-core-hashing-proc-macro" version = "5.0.0" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "proc-macro2", "quote", @@ -12097,7 +12128,7 @@ dependencies = [ [[package]] name = "sp-database" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "kvdb", "parking_lot 0.12.1", @@ -12106,7 +12137,7 @@ dependencies = [ [[package]] name = "sp-debug-derive" version = "5.0.0" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "proc-macro2", "quote", @@ -12116,7 +12147,7 @@ dependencies = [ [[package]] name = "sp-externalities" version = "0.13.0" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "environmental", "parity-scale-codec", @@ -12127,7 +12158,7 @@ dependencies = [ [[package]] name = "sp-finality-grandpa" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "finality-grandpa", "log", @@ -12145,7 +12176,7 @@ dependencies = [ [[package]] name = "sp-inherents" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "async-trait", "impl-trait-for-tuples", @@ -12159,7 +12190,7 @@ dependencies = [ [[package]] name = "sp-io" version = "7.0.0" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "bytes", "ed25519", @@ -12184,7 +12215,7 @@ dependencies = [ [[package]] name = "sp-keyring" version = "7.0.0" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "lazy_static", "sp-core", @@ -12195,7 +12226,7 @@ dependencies = [ [[package]] name = "sp-keystore" version = "0.13.0" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "async-trait", "futures", @@ -12212,7 +12243,7 @@ dependencies = [ [[package]] name = "sp-maybe-compressed-blob" version = "4.1.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "thiserror", "zstd", @@ -12221,7 +12252,7 @@ dependencies = [ [[package]] name = "sp-mmr-primitives" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "ckb-merkle-mountain-range", "log", @@ -12239,7 +12270,7 @@ dependencies = [ [[package]] name = "sp-npos-elections" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "parity-scale-codec", "scale-info", @@ -12253,7 +12284,7 @@ dependencies = [ [[package]] name = "sp-offchain" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "sp-api", "sp-core", @@ -12263,7 +12294,7 @@ dependencies = [ [[package]] name = "sp-panic-handler" version = "5.0.0" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "backtrace", "lazy_static", @@ -12273,7 +12304,7 @@ dependencies = [ [[package]] name = "sp-rpc" version = "6.0.0" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "rustc-hash", "serde", @@ -12283,7 +12314,7 @@ dependencies = [ [[package]] name = "sp-runtime" version = "7.0.0" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "either", "hash256-std-hasher", @@ -12305,7 +12336,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface" version = "7.0.0" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "bytes", "impl-trait-for-tuples", @@ -12323,7 +12354,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" version = "6.0.0" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "Inflector", "proc-macro-crate", @@ -12335,7 +12366,7 @@ dependencies = [ [[package]] name = "sp-session" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "parity-scale-codec", "scale-info", @@ -12349,7 +12380,7 @@ dependencies = [ [[package]] name = "sp-staking" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "parity-scale-codec", "scale-info", @@ -12361,7 +12392,7 @@ dependencies = [ [[package]] name = "sp-state-machine" version = "0.13.0" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "hash-db", "log", @@ -12381,12 +12412,12 @@ dependencies = [ [[package]] name = "sp-std" version = "5.0.0" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" [[package]] name = "sp-storage" version = "7.0.0" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "impl-serde 0.4.0", "parity-scale-codec", @@ -12399,7 +12430,7 @@ dependencies = [ [[package]] name = "sp-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "async-trait", "futures-timer", @@ -12414,7 +12445,7 @@ dependencies = [ [[package]] name = "sp-tracing" version = "6.0.0" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "parity-scale-codec", "sp-std", @@ -12426,7 +12457,7 @@ dependencies = [ [[package]] name = "sp-transaction-pool" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "sp-api", "sp-runtime", @@ -12435,7 +12466,7 @@ dependencies = [ [[package]] name = "sp-transaction-storage-proof" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "async-trait", "log", @@ -12451,11 +12482,11 @@ dependencies = [ [[package]] name = "sp-trie" version = "7.0.0" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ - "ahash", + "ahash 0.7.6", "hash-db", - "hashbrown", + "hashbrown 0.12.3", "lazy_static", "lru", "memory-db", @@ -12474,7 +12505,7 @@ dependencies = [ [[package]] name = "sp-version" version = "5.0.0" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "impl-serde 0.4.0", "parity-scale-codec", @@ -12491,7 +12522,7 @@ dependencies = [ [[package]] name = "sp-version-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "parity-scale-codec", "proc-macro2", @@ -12502,7 +12533,7 @@ dependencies = [ [[package]] name = "sp-wasm-interface" version = "7.0.0" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "impl-trait-for-tuples", "log", @@ -12515,7 +12546,7 @@ dependencies = [ [[package]] name = "sp-weights" version = "4.0.0" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "parity-scale-codec", "scale-info", @@ -12712,7 +12743,7 @@ dependencies = [ [[package]] name = "substrate-build-script-utils" version = "3.0.0" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "platforms 2.0.0", ] @@ -12731,7 +12762,7 @@ dependencies = [ [[package]] name = "substrate-frame-rpc-system" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "frame-system-rpc-runtime-api", "futures", @@ -12750,7 +12781,7 @@ dependencies = [ [[package]] name = "substrate-prometheus-endpoint" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "hyper", "log", @@ -12762,7 +12793,7 @@ dependencies = [ [[package]] name = "substrate-rpc-client" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "async-trait", "jsonrpsee", @@ -12775,7 +12806,7 @@ dependencies = [ [[package]] name = "substrate-state-trie-migration-rpc" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "jsonrpsee", "log", @@ -12794,7 +12825,7 @@ dependencies = [ [[package]] name = "substrate-wasm-builder" version = "5.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "ansi_term", "build-helper", @@ -13332,7 +13363,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "004e1e8f92535694b4cb1444dc5a8073ecf0815e3357f729638b9f8fc4062908" dependencies = [ "hash-db", - "hashbrown", + "hashbrown 0.12.3", "log", "rustc-hex", "smallvec", @@ -13412,7 +13443,7 @@ checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" [[package]] name = "try-runtime-cli" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f2d4cff53a283a14c5b8241e07519f6144cafe1" +source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" dependencies = [ "clap", "frame-remote-externalities", diff --git a/Cargo.toml b/Cargo.toml index a7110c059..39c146b15 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,187 +10,187 @@ members = [ "runtime/*", ] - [workspace.package] - authors = ["Darwinia Network "] - edition = "2021" - homepage = "https://darwinia.network" - license = "GPL-3.0" - repository = "https://github.com/darwinia-network/darwinia" - version = "6.0.0" +[workspace.package] +authors = ["Darwinia Network "] +edition = "2021" +homepage = "https://darwinia.network" +license = "GPL-3.0" +repository = "https://github.com/darwinia-network/darwinia" +version = "6.0.0" - [workspace.dependencies] - # crates.io - array-bytes = { version = "6.0" } - codec = { package = "parity-scale-codec", version = "3.3", default-features = false, features = ["derive"] } - libsecp256k1 = { version = "0.7" } - scale-info = { version = "2.3", default-features = false, features = ["derive"] } - sha3 = { version = "0.9" } - static_assertions = { version = "1.1" } +[workspace.dependencies] +# crates.io +array-bytes = { version = "6.0" } +codec = { package = "parity-scale-codec", version = "3.3", default-features = false, features = ["derive"] } +libsecp256k1 = { version = "0.7" } +scale-info = { version = "2.3", default-features = false, features = ["derive"] } +sha3 = { version = "0.9" } +static_assertions = { version = "1.1" } - # cumulus - cumulus-client-cli = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.37" } - cumulus-client-collator = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.37" } - cumulus-client-consensus-aura = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.37" } - cumulus-client-consensus-common = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.37" } - cumulus-client-network = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.37" } - cumulus-client-service = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.37" } - cumulus-pallet-aura-ext = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.37" } - cumulus-pallet-dmp-queue = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.37" } - cumulus-pallet-parachain-system = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.37" } - cumulus-pallet-session-benchmarking = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.37" } - cumulus-pallet-xcm = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.37" } - cumulus-pallet-xcmp-queue = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.37" } - cumulus-primitives-core = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.37" } - cumulus-primitives-parachain-inherent = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.37" } - cumulus-primitives-timestamp = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.37" } - cumulus-primitives-utility = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.37" } - cumulus-relay-chain-interface = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.37" } - parachain-info = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.37" } +# cumulus +cumulus-client-cli = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.37" } +cumulus-client-collator = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.37" } +cumulus-client-consensus-aura = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.37" } +cumulus-client-consensus-common = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.37" } +cumulus-client-network = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.37" } +cumulus-client-service = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.37" } +cumulus-pallet-aura-ext = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.37" } +cumulus-pallet-dmp-queue = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.37" } +cumulus-pallet-parachain-system = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.37" } +cumulus-pallet-session-benchmarking = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.37" } +cumulus-pallet-xcm = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.37" } +cumulus-pallet-xcmp-queue = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.37" } +cumulus-primitives-core = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.37" } +cumulus-primitives-parachain-inherent = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.37" } +cumulus-primitives-timestamp = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.37" } +cumulus-primitives-utility = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.37" } +cumulus-relay-chain-interface = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.37" } +parachain-info = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.37" } - # darwinia - crab-runtime = { path = "runtime/crab" } - darwinia-account-migration = { default-features = false, path = "pallet/account-migration" } - darwinia-common-runtime = { default-features = false, path = "runtime/common" } - darwinia-deposit = { default-features = false, path = "pallet/deposit" } - darwinia-ecdsa-authority = { default-features = false, path = "pallet/ecdsa-authority" } - darwinia-message-gadget = { default-features = false, path = "pallet/message-gadget" } - darwinia-message-transact = { default-features = false, path = "pallet/message-transact" } - darwinia-precompile-assets = { default-features = false, path = "precompile/assets" } - darwinia-precompile-bls12-381 = { default-features = false, path = "precompile/bls12-381" } - darwinia-precompile-deposit = { default-features = false, path = "precompile/deposit" } - darwinia-precompile-staking = { default-features = false, path = "precompile/staking" } - darwinia-precompile-state-storage = { default-features = false, path = "precompile/state-storage" } - darwinia-runtime = { path = "runtime/darwinia" } - darwinia-staking = { default-features = false, path = "pallet/staking" } - dc-inflation = { default-features = false, path = "core/inflation" } - dc-primitives = { default-features = false, path = "core/primitives" } - dc-types = { path = "core/types" } - pangolin-runtime = { path = "runtime/pangolin" } - pangoro-runtime = { path = "runtime/pangoro" } +# darwinia +crab-runtime = { path = "runtime/crab" } +darwinia-account-migration = { default-features = false, path = "pallet/account-migration" } +darwinia-common-runtime = { default-features = false, path = "runtime/common" } +darwinia-deposit = { default-features = false, path = "pallet/deposit" } +darwinia-ecdsa-authority = { default-features = false, path = "pallet/ecdsa-authority" } +darwinia-message-gadget = { default-features = false, path = "pallet/message-gadget" } +darwinia-message-transact = { default-features = false, path = "pallet/message-transact" } +darwinia-precompile-assets = { default-features = false, path = "precompile/assets" } +darwinia-precompile-bls12-381 = { default-features = false, path = "precompile/bls12-381" } +darwinia-precompile-deposit = { default-features = false, path = "precompile/deposit" } +darwinia-precompile-staking = { default-features = false, path = "precompile/staking" } +darwinia-precompile-state-storage = { default-features = false, path = "precompile/state-storage" } +darwinia-runtime = { path = "runtime/darwinia" } +darwinia-staking = { default-features = false, path = "pallet/staking" } +dc-inflation = { default-features = false, path = "core/inflation" } +dc-primitives = { default-features = false, path = "core/primitives" } +dc-types = { path = "core/types" } +pangolin-runtime = { path = "runtime/pangolin" } +pangoro-runtime = { path = "runtime/pangoro" } - # darwinia-messages-substrate - bp-darwinia-core = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.37" } - bp-message-dispatch = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.37" } - bp-messages = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.37" } - bp-polkadot-core = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.37" } - bp-runtime = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.37" } - bridge-runtime-common = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.37" } - pallet-bridge-dispatch = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.37" } - pallet-bridge-grandpa = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.37" } - pallet-bridge-messages = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.37" } - pallet-bridge-parachains = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.37" } - pallet-fee-market = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.37" } +# darwinia-messages-substrate +bp-darwinia-core = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.37" } +bp-message-dispatch = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.37" } +bp-messages = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.37" } +bp-polkadot-core = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.37" } +bp-runtime = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.37" } +bridge-runtime-common = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.37" } +pallet-bridge-dispatch = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.37" } +pallet-bridge-grandpa = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.37" } +pallet-bridge-messages = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.37" } +pallet-bridge-parachains = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.37" } +pallet-fee-market = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.37" } - # frontier - fc-cli = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.37" } - fc-consensus = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.37" } - fc-db = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.37" } - fc-mapping-sync = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.37" } - fc-rpc = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.37" } - fc-rpc-core = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.37" } - fp-ethereum = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.37" } - fp-evm = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.37" } - fp-rpc = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.37" } - fp-self-contained = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.37" } - fp-storage = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.37" } - pallet-ethereum = { default-features = false, features = ["forbid-evm-reentrancy"], git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.37" } - pallet-evm = { default-features = false, features = ["forbid-evm-reentrancy"], git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.37" } - pallet-evm-precompile-blake2 = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.37" } - pallet-evm-precompile-bn128 = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.37" } - pallet-evm-precompile-dispatch = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.37" } - pallet-evm-precompile-modexp = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.37" } - pallet-evm-precompile-simple = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.37" } +# frontier +fc-cli = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.37" } +fc-consensus = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.37" } +fc-db = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.37" } +fc-mapping-sync = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.37" } +fc-rpc = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.37" } +fc-rpc-core = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.37" } +fp-ethereum = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.37" } +fp-evm = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.37" } +fp-rpc = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.37" } +fp-self-contained = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.37" } +fp-storage = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.37" } +pallet-ethereum = { default-features = false, features = ["forbid-evm-reentrancy"], git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.37" } +pallet-evm = { default-features = false, features = ["forbid-evm-reentrancy"], git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.37" } +pallet-evm-precompile-blake2 = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.37" } +pallet-evm-precompile-bn128 = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.37" } +pallet-evm-precompile-dispatch = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.37" } +pallet-evm-precompile-modexp = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.37" } +pallet-evm-precompile-simple = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.37" } - # moonbeam - account = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.37" } - precompile-utils = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.37" } - xcm-primitives = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.37" } +# moonbeam +account = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.37" } +precompile-utils = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.37" } +xcm-primitives = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.37" } - # polkadot - pallet-xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.37" } - polkadot-cli = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.37" } - polkadot-parachain = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.37" } - polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.37" } - polkadot-runtime-common = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.37" } - polkadot-service = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.37" } - xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.37" } - xcm-builder = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.37" } - xcm-executor = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.37" } +# polkadot +pallet-xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.37" } +polkadot-cli = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.37" } +polkadot-parachain = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.37" } +polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.37" } +polkadot-runtime-common = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.37" } +polkadot-service = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.37" } +xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.37" } +xcm-builder = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.37" } +xcm-executor = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.37" } - # substrate - frame-benchmarking = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } - frame-benchmarking-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } - frame-executive = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } - frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } - frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } - frame-system-benchmarking = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } - frame-system-rpc-runtime-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } - frame-try-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } - pallet-assets = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } - pallet-aura = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } - pallet-authorship = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } - pallet-balances = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } - pallet-collective = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } - pallet-democracy = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } - pallet-elections-phragmen = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } - pallet-identity = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } - pallet-membership = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } - pallet-multisig = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } - pallet-preimage = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } - pallet-proxy = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } - pallet-scheduler = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } - pallet-session = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } - pallet-sudo = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } - pallet-timestamp = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } - pallet-tips = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } - pallet-transaction-payment = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } - pallet-transaction-payment-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } - pallet-transaction-payment-rpc-runtime-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } - pallet-treasury = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } - pallet-utility = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } - pallet-vesting = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } - sc-basic-authorship = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } - sc-chain-spec = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } - sc-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } - sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } - sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } - sc-consensus-aura = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } - sc-executor = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } - sc-keystore = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } - sc-network = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } - sc-network-common = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } - sc-offchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } - sc-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } - sc-rpc-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } - sc-service = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } - sc-sysinfo = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } - sc-telemetry = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } - sc-tracing = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } - sc-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } - sc-transaction-pool-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } - sp-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } - sp-arithmetic = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } - sp-block-builder = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } - sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } - sp-consensus = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } - sp-consensus-aura = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } - sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } - sp-inherents = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } - sp-io = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } - sp-keyring = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } - sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } - sp-offchain = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } - sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } - sp-session = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } - sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } - sp-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } - sp-transaction-pool = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } - sp-version = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } - substrate-build-script-utils = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } - substrate-frame-rpc-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } - substrate-prometheus-endpoint = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } - substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } - try-runtime-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } +# substrate +frame-benchmarking = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } +frame-benchmarking-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } +frame-executive = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } +frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } +frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } +frame-system-benchmarking = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } +frame-system-rpc-runtime-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } +frame-try-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } +pallet-assets = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } +pallet-aura = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } +pallet-authorship = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } +pallet-balances = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } +pallet-collective = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } +pallet-democracy = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } +pallet-elections-phragmen = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } +pallet-identity = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } +pallet-membership = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } +pallet-multisig = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } +pallet-preimage = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } +pallet-proxy = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } +pallet-scheduler = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } +pallet-session = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } +pallet-sudo = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } +pallet-timestamp = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } +pallet-tips = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } +pallet-transaction-payment = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } +pallet-transaction-payment-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } +pallet-transaction-payment-rpc-runtime-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } +pallet-treasury = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } +pallet-utility = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } +pallet-vesting = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } +sc-basic-authorship = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } +sc-chain-spec = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } +sc-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } +sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } +sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } +sc-consensus-aura = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } +sc-executor = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } +sc-keystore = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } +sc-network = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } +sc-network-common = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } +sc-offchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } +sc-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } +sc-rpc-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } +sc-service = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } +sc-sysinfo = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } +sc-telemetry = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } +sc-tracing = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } +sc-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } +sc-transaction-pool-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } +sp-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } +sp-arithmetic = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } +sp-block-builder = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } +sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } +sp-consensus = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } +sp-consensus-aura = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } +sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } +sp-inherents = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } +sp-io = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } +sp-keyring = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } +sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } +sp-offchain = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } +sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } +sp-session = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } +sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } +sp-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } +sp-transaction-pool = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } +sp-version = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } +substrate-build-script-utils = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } +substrate-frame-rpc-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } +substrate-prometheus-endpoint = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } +substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } +try-runtime-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } [patch."https://github.com/paritytech/substrate"] beefy-gadget = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } diff --git a/node/src/chain_spec/crab.rs b/node/src/chain_spec/crab.rs index a9b1c997e..baca091f5 100644 --- a/node/src/chain_spec/crab.rs +++ b/node/src/chain_spec/crab.rs @@ -199,7 +199,7 @@ pub fn genesis_config() -> ChainSpec { // EVM stuff. ethereum: Default::default(), - evm: EvmConfig { + evm: EVMConfig { accounts: { BTreeMap::from_iter( CrabPrecompiles::::used_addresses().iter().map(|p| { @@ -308,7 +308,7 @@ fn testnet_genesis( // EVM stuff. ethereum: Default::default(), - evm: EvmConfig { + evm: EVMConfig { accounts: { BTreeMap::from_iter( CrabPrecompiles::::used_addresses() diff --git a/node/src/chain_spec/darwinia.rs b/node/src/chain_spec/darwinia.rs index 781efc6a9..5441967dc 100644 --- a/node/src/chain_spec/darwinia.rs +++ b/node/src/chain_spec/darwinia.rs @@ -199,7 +199,7 @@ pub fn genesis_config() -> ChainSpec { // EVM stuff. ethereum: Default::default(), - evm: EvmConfig { + evm: EVMConfig { accounts: { BTreeMap::from_iter( DarwiniaPrecompiles::::used_addresses().iter().map(|p| { @@ -308,7 +308,7 @@ fn testnet_genesis( // EVM stuff. ethereum: Default::default(), - evm: EvmConfig { + evm: EVMConfig { accounts: { BTreeMap::from_iter( DarwiniaPrecompiles::::used_addresses() diff --git a/node/src/chain_spec/pangolin.rs b/node/src/chain_spec/pangolin.rs index a59c34232..ae54ff451 100644 --- a/node/src/chain_spec/pangolin.rs +++ b/node/src/chain_spec/pangolin.rs @@ -224,7 +224,7 @@ pub fn genesis_config() -> ChainSpec { // EVM stuff. ethereum: Default::default(), - evm: EvmConfig { + evm: EVMConfig { accounts: { BTreeMap::from_iter( PangolinPrecompiles::::used_addresses().iter().map(|p| { @@ -333,7 +333,7 @@ fn testnet_genesis( // EVM stuff. ethereum: Default::default(), - evm: EvmConfig { + evm: EVMConfig { accounts: { BTreeMap::from_iter( PangolinPrecompiles::::used_addresses() diff --git a/node/src/chain_spec/pangoro.rs b/node/src/chain_spec/pangoro.rs index 482b78956..a5220be1e 100644 --- a/node/src/chain_spec/pangoro.rs +++ b/node/src/chain_spec/pangoro.rs @@ -224,7 +224,7 @@ pub fn genesis_config() -> ChainSpec { // EVM stuff. ethereum: Default::default(), - evm: EvmConfig { + evm: EVMConfig { accounts: { BTreeMap::from_iter( PangoroPrecompiles::::used_addresses().iter().map(|p| { @@ -333,7 +333,7 @@ fn testnet_genesis( // EVM stuff. ethereum: Default::default(), - evm: EvmConfig { + evm: EVMConfig { accounts: { BTreeMap::from_iter( PangoroPrecompiles::::used_addresses() diff --git a/pallet/message-gadget/tests/tests.rs b/pallet/message-gadget/tests/tests.rs index 9eecd581a..fdb2b25b8 100644 --- a/pallet/message-gadget/tests/tests.rs +++ b/pallet/message-gadget/tests/tests.rs @@ -96,7 +96,7 @@ frame_support::construct_runtime! { System: frame_system, Timestamp: pallet_timestamp, Balances: pallet_balances, - Evm: pallet_evm, + EVM: pallet_evm, MessageGadget: darwinia_message_gadget, } } diff --git a/pallet/message-transact/src/lib.rs b/pallet/message-transact/src/lib.rs index b5098809a..b5463f6bf 100644 --- a/pallet/message-transact/src/lib.rs +++ b/pallet/message-transact/src/lib.rs @@ -96,7 +96,7 @@ pub mod pallet { #[pallet::error] pub enum Error { - /// Evm validation errors. + /// EVM validation errors. MessageTransactError(EvmTxErrorWrapper), } @@ -192,9 +192,9 @@ impl From for EvmTxErrorWrapper { } } -/// Calculates the fee for a relayer to submit an LCMP Evm transaction. +/// Calculates the fee for a relayer to submit an LCMP EVM transaction. /// -/// The gas_price of an LCMP Evm transaction is always the min_gas_price(), which is a fixed value. +/// The gas_price of an LCMP EVM transaction is always the min_gas_price(), which is a fixed value. /// Therefore, only the gas_limit and value of the transaction should be considered in the /// calculation of the fee, and the gas_price of the transaction itself can be ignored. pub fn total_payment(tx_data: TransactionData) -> U256 { diff --git a/pallet/message-transact/src/tests/eip1559.rs b/pallet/message-transact/src/tests/eip1559.rs index ce3de2d0e..a10833831 100644 --- a/pallet/message-transact/src/tests/eip1559.rs +++ b/pallet/message-transact/src/tests/eip1559.rs @@ -114,7 +114,7 @@ fn test_dispatch_eip1559_transaction_weight_mismatch() { pallet_bridge_dispatch::Event::MessageWeightMismatch( SOURCE_CHAIN_ID, mock_message_id, - Weight::from_ref_time(1249901046000), + Weight::from_ref_time(1249900180000), Weight::from_ref_time(1000000000000), ), )); diff --git a/pallet/message-transact/src/tests/eip2930.rs b/pallet/message-transact/src/tests/eip2930.rs index a599a615f..40e35ea84 100644 --- a/pallet/message-transact/src/tests/eip2930.rs +++ b/pallet/message-transact/src/tests/eip2930.rs @@ -112,7 +112,7 @@ fn test_dispatch_eip2930_transaction_weight_mismatch() { pallet_bridge_dispatch::Event::MessageWeightMismatch( SOURCE_CHAIN_ID, mock_message_id, - Weight::from_ref_time(1249901046000), + Weight::from_ref_time(1249900180000), Weight::from_ref_time(1000000000000), ), )); diff --git a/pallet/message-transact/src/tests/legacy.rs b/pallet/message-transact/src/tests/legacy.rs index c3488b380..1507c4806 100644 --- a/pallet/message-transact/src/tests/legacy.rs +++ b/pallet/message-transact/src/tests/legacy.rs @@ -109,7 +109,7 @@ fn test_dispatch_legacy_transaction_weight_mismatch() { pallet_bridge_dispatch::Event::MessageWeightMismatch( SOURCE_CHAIN_ID, mock_message_id, - Weight::from_ref_time(1249901046000), + Weight::from_ref_time(1249900180000), Weight::from_ref_time(1000000000000), ), )); diff --git a/precompile/state-storage/src/lib.rs b/precompile/state-storage/src/lib.rs index 26051e2c3..3db70dbe3 100644 --- a/precompile/state-storage/src/lib.rs +++ b/precompile/state-storage/src/lib.rs @@ -66,6 +66,6 @@ where pub struct StateStorageFilter; impl StorageFilterT for StateStorageFilter { fn allow(prefix: &[u8]) -> bool { - prefix != Twox128::hash(b"Evm") + prefix != Twox128::hash(b"EVM") } } diff --git a/precompile/state-storage/src/mock.rs b/precompile/state-storage/src/mock.rs index 1e8a3cbdf..277320afb 100644 --- a/precompile/state-storage/src/mock.rs +++ b/precompile/state-storage/src/mock.rs @@ -167,7 +167,7 @@ frame_support::construct_runtime! { System: frame_system, Timestamp: pallet_timestamp, Balances: pallet_balances, - Evm: pallet_evm, + EVM: pallet_evm, } } diff --git a/runtime/crab/src/lib.rs b/runtime/crab/src/lib.rs index bb1691008..5bc0a095d 100644 --- a/runtime/crab/src/lib.rs +++ b/runtime/crab/src/lib.rs @@ -154,7 +154,7 @@ frame_support::construct_runtime! { // EVM stuff. Ethereum: pallet_ethereum = 36, - Evm: pallet_evm = 37, + EVM: pallet_evm = 37, MessageTransact: darwinia_message_transact = 38, // Crab <> Darwinia @@ -317,7 +317,7 @@ sp_api::impl_runtime_apis! { } fn account_basic(address: sp_core::H160) -> pallet_evm::Account { - let (account, _) = Evm::account_basic(&address); + let (account, _) = EVM::account_basic(&address); account } @@ -332,7 +332,7 @@ sp_api::impl_runtime_apis! { } fn account_code_at(address: sp_core::H160) -> Vec { - Evm::account_codes(address) + EVM::account_codes(address) } fn author() -> sp_core::H160 { @@ -344,7 +344,7 @@ sp_api::impl_runtime_apis! { index.to_big_endian(&mut tmp); - Evm::account_storages(address, sp_core::H256::from_slice(&tmp[..])) + EVM::account_storages(address, sp_core::H256::from_slice(&tmp[..])) } fn call( diff --git a/runtime/darwinia/src/lib.rs b/runtime/darwinia/src/lib.rs index ba7674422..b74dd69c8 100644 --- a/runtime/darwinia/src/lib.rs +++ b/runtime/darwinia/src/lib.rs @@ -154,7 +154,7 @@ frame_support::construct_runtime! { // EVM stuff. Ethereum: pallet_ethereum = 36, - Evm: pallet_evm = 37, + EVM: pallet_evm = 37, MessageTransact: darwinia_message_transact = 38, // Darwinia <> Crab @@ -317,7 +317,7 @@ sp_api::impl_runtime_apis! { } fn account_basic(address: sp_core::H160) -> pallet_evm::Account { - let (account, _) = Evm::account_basic(&address); + let (account, _) = EVM::account_basic(&address); account } @@ -332,7 +332,7 @@ sp_api::impl_runtime_apis! { } fn account_code_at(address: sp_core::H160) -> Vec { - Evm::account_codes(address) + EVM::account_codes(address) } fn author() -> sp_core::H160 { @@ -344,7 +344,7 @@ sp_api::impl_runtime_apis! { index.to_big_endian(&mut tmp); - Evm::account_storages(address, sp_core::H256::from_slice(&tmp[..])) + EVM::account_storages(address, sp_core::H256::from_slice(&tmp[..])) } fn call( diff --git a/runtime/darwinia/src/pallets/evm.rs b/runtime/darwinia/src/pallets/evm.rs index 22f149cda..4fa2feb2a 100644 --- a/runtime/darwinia/src/pallets/evm.rs +++ b/runtime/darwinia/src/pallets/evm.rs @@ -40,7 +40,6 @@ where } } - pub struct DarwiniaPrecompiles(sp_std::marker::PhantomData); impl DarwiniaPrecompiles where diff --git a/runtime/pangolin/src/lib.rs b/runtime/pangolin/src/lib.rs index 9a59921c6..80cd802a8 100644 --- a/runtime/pangolin/src/lib.rs +++ b/runtime/pangolin/src/lib.rs @@ -156,7 +156,7 @@ frame_support::construct_runtime! { // EVM stuff. Ethereum: pallet_ethereum = 36, - Evm: pallet_evm = 37, + EVM: pallet_evm = 37, MessageTransact: darwinia_message_transact = 38, // Pangolin <> Pangoro @@ -319,7 +319,7 @@ sp_api::impl_runtime_apis! { } fn account_basic(address: sp_core::H160) -> pallet_evm::Account { - let (account, _) = Evm::account_basic(&address); + let (account, _) = EVM::account_basic(&address); account } @@ -334,7 +334,7 @@ sp_api::impl_runtime_apis! { } fn account_code_at(address: sp_core::H160) -> Vec { - Evm::account_codes(address) + EVM::account_codes(address) } fn author() -> sp_core::H160 { @@ -346,7 +346,7 @@ sp_api::impl_runtime_apis! { index.to_big_endian(&mut tmp); - Evm::account_storages(address, sp_core::H256::from_slice(&tmp[..])) + EVM::account_storages(address, sp_core::H256::from_slice(&tmp[..])) } fn call( diff --git a/runtime/pangolin/src/migration.rs b/runtime/pangolin/src/migration.rs index d4e49525f..f113d3153 100644 --- a/runtime/pangolin/src/migration.rs +++ b/runtime/pangolin/src/migration.rs @@ -21,8 +21,7 @@ impl frame_support::traits::OnRuntimeUpgrade for CustomOnRuntimeUpgrade { } fn migrate() -> frame_support::weights::Weight { - as frame_support::traits::OnRuntimeUpgrade>::on_runtime_upgrade(); - frame_support::migration::move_pallet(b"Staking", b"DarwiniaStaking"); + frame_support::migration::move_pallet(b"Evm", b"EVM"); // frame_support::weights::Weight::zero() RuntimeBlockWeights::get().max_block diff --git a/runtime/pangoro/src/lib.rs b/runtime/pangoro/src/lib.rs index b8615abba..9e6a96bf8 100644 --- a/runtime/pangoro/src/lib.rs +++ b/runtime/pangoro/src/lib.rs @@ -156,7 +156,7 @@ frame_support::construct_runtime! { // EVM stuff. Ethereum: pallet_ethereum = 36, - Evm: pallet_evm = 37, + EVM: pallet_evm = 37, MessageTransact: darwinia_message_transact = 38, // Pangoro <> Pangolin @@ -319,7 +319,7 @@ sp_api::impl_runtime_apis! { } fn account_basic(address: sp_core::H160) -> pallet_evm::Account { - let (account, _) = Evm::account_basic(&address); + let (account, _) = EVM::account_basic(&address); account } @@ -334,7 +334,7 @@ sp_api::impl_runtime_apis! { } fn account_code_at(address: sp_core::H160) -> Vec { - Evm::account_codes(address) + EVM::account_codes(address) } fn author() -> sp_core::H160 { @@ -346,7 +346,7 @@ sp_api::impl_runtime_apis! { index.to_big_endian(&mut tmp); - Evm::account_storages(address, sp_core::H256::from_slice(&tmp[..])) + EVM::account_storages(address, sp_core::H256::from_slice(&tmp[..])) } fn call( diff --git a/tests/ethereum/test-contract.ts b/tests/ethereum/test-contract.ts index d44d9dd01..57b08b5d6 100644 --- a/tests/ethereum/test-contract.ts +++ b/tests/ethereum/test-contract.ts @@ -31,7 +31,7 @@ describe("Test contract", () => { }).timeout(60000); step("Get contract code", async function () { - expect(await web3.eth.getCode(inc.options.address), incrementerInfo.bytecode); + expect(await web3.eth.getCode(inc.options.address)).not.to.be.null; }); step("Get default number", async function () { diff --git a/tool/state-processor/src/evm/README.md b/tool/state-processor/src/evm/README.md index c36e05ca7..9f734ce3b 100644 --- a/tool/state-processor/src/evm/README.md +++ b/tool/state-processor/src/evm/README.md @@ -1,4 +1,4 @@ ### Process steps - set `PALLET_ETHEREUM_SCHEMA` - take solo `EVM::AccountCodes` and `EVM::AccountStorages` -- set `Evm::AccountCodes` and `Evm::AccountStorages` +- set `EVM::AccountCodes` and `EVM::AccountStorages` diff --git a/tool/state-processor/src/evm/mod.rs b/tool/state-processor/src/evm/mod.rs index c222179aa..e35098e80 100644 --- a/tool/state-processor/src/evm/mod.rs +++ b/tool/state-processor/src/evm/mod.rs @@ -17,22 +17,18 @@ impl Processor { // Storage items. // https://github.dev/darwinia-network/frontier/blob/darwinia-v0.12.5/frame/evm/src/lib.rs#L407 - let mut account_codes = Map::default(); - let mut account_storages = Map::default(); + let mut codes = Map::default(); + let mut storages = Map::default(); log::info!("take `EVM::AccountCodes` and `EVM::AccountStorages`"); self.solo_state - .take_raw_map(&item_key(b"EVM", b"AccountCodes"), &mut account_codes, |key, from| { - replace_first_match(key, from, &item_key(b"Evm", b"AccountCodes")) - }) - .take_raw_map( - &item_key(b"EVM", b"AccountStorages"), - &mut account_storages, - |key, from| replace_first_match(key, from, &item_key(b"Evm", b"AccountStorages")), - ); - - log::info!("set `Evm::AccountCodes` and `Evm::AccountStorages`"); - self.shell_state.insert_raw_key_map(account_codes).insert_raw_key_map(account_storages); + .take_raw_map(&item_key(b"EVM", b"AccountCodes"), &mut codes, |k, _| k.to_owned()) + .take_raw_map(&item_key(b"EVM", b"AccountStorages"), &mut storages, |k, _| { + k.to_owned() + }); + + log::info!("set `EVM::AccountCodes` and `EVM::AccountStorages`"); + self.shell_state.insert_raw_key_map(codes).insert_raw_key_map(storages); self } diff --git a/tool/state-processor/src/tests.rs b/tool/state-processor/src/tests.rs index eb2df3b54..e5bc25b98 100644 --- a/tool/state-processor/src/tests.rs +++ b/tool/state-processor/src/tests.rs @@ -74,7 +74,7 @@ impl Tester { get_last_64_key, ) .take_map(b"AccountMigration", b"Accounts", &mut migration_accounts, get_last_64_key) - .take_map(b"Evm", b"AccountCodes", &mut shell_evm_codes, get_last_40); + .take_map(b"EVM", b"AccountCodes", &mut shell_evm_codes, get_last_40); Self { solo_accounts, @@ -621,7 +621,7 @@ fn evm_contract_account_storage() { let migrated_storage_item_len = tester.shell_state.map.iter().fold(0u32, |sum, (k, _)| { if k.starts_with(&full_key( - b"Evm", + b"EVM", b"AccountStorages", &blake2_128_concat_to_string(addr.encode()), )) { @@ -634,7 +634,7 @@ fn evm_contract_account_storage() { let mut migrated_storage_value = H256::zero(); tester.shell_state.get_value( - b"Evm", + b"EVM", b"AccountStorages", &format!( "{}{}", diff --git a/tool/state-processor/src/util.rs b/tool/state-processor/src/util.rs index d469aeb6a..891d467cc 100644 --- a/tool/state-processor/src/util.rs +++ b/tool/state-processor/src/util.rs @@ -57,10 +57,6 @@ pub fn get_last_64(key: &str) -> String { format!("0x{}", &key[key.len() - 64..]) } -pub fn replace_first_match(key: &str, from: &str, to: &str) -> String { - key.replacen(from, to, 1) -} - pub fn blake2_128_concat_to_string(data: D) -> String where D: AsRef<[u8]>, From 61327431660a7af164d23bd07e1dad4634815bd3 Mon Sep 17 00:00:00 2001 From: Guantong Date: Wed, 22 Feb 2023 15:42:42 +0800 Subject: [PATCH 154/189] Bench upstream pallets (#292) * Fix balances benchmark * Add bridge related bench * Benchmark with steps 50 repeat 20 * Update weights for bridge pallets * Pangolin bench pallets * Bench s2 r1 for all runtimes * Update weights for all runtime --- runtime/crab/src/lib.rs | 21 +- runtime/crab/src/pallets/assets.rs | 2 +- runtime/crab/src/pallets/balances.rs | 12 +- runtime/crab/src/pallets/bridge_grandpa.rs | 2 +- runtime/crab/src/pallets/collective.rs | 4 +- runtime/crab/src/pallets/democracy.rs | 2 +- .../crab/src/pallets/elections_phragmen.rs | 2 +- runtime/crab/src/pallets/fee_market.rs | 2 +- runtime/crab/src/pallets/identity.rs | 2 +- runtime/crab/src/pallets/membership.rs | 2 +- runtime/crab/src/pallets/multisig.rs | 2 +- runtime/crab/src/pallets/preimage.rs | 2 +- runtime/crab/src/pallets/proxy.rs | 2 +- runtime/crab/src/pallets/scheduler.rs | 2 +- runtime/crab/src/pallets/tips.rs | 2 +- runtime/crab/src/pallets/treasury.rs | 2 +- runtime/crab/src/pallets/utility.rs | 2 +- runtime/crab/src/pallets/vesting.rs | 2 +- .../src/weights/cumulus_pallet_xcmp_queue.rs | 32 +- runtime/crab/src/weights/frame_system.rs | 52 ++-- runtime/crab/src/weights/mod.rs | 17 ++ runtime/crab/src/weights/pallet_assets.rs | 276 ++++++++++++++++++ runtime/crab/src/weights/pallet_balances.rs | 67 +++-- .../crab/src/weights/pallet_bridge_grandpa.rs | 76 +++++ .../src/weights/pallet_collective_council.rs | 230 +++++++++++++++ .../pallet_collective_technical_committee.rs | 232 +++++++++++++++ runtime/crab/src/weights/pallet_democracy.rs | 252 ++++++++++++++++ .../src/weights/pallet_elections_phragmen.rs | 202 +++++++++++++ runtime/crab/src/weights/pallet_fee_market.rs | 139 +++++++++ runtime/crab/src/weights/pallet_identity.rs | 242 +++++++++++++++ runtime/crab/src/weights/pallet_membership.rs | 136 +++++++++ runtime/crab/src/weights/pallet_multisig.rs | 128 ++++++++ runtime/crab/src/weights/pallet_preimage.rs | 152 ++++++++++ runtime/crab/src/weights/pallet_proxy.rs | 163 +++++++++++ runtime/crab/src/weights/pallet_scheduler.rs | 140 +++++++++ runtime/crab/src/weights/pallet_session.rs | 32 +- runtime/crab/src/weights/pallet_timestamp.rs | 29 +- runtime/crab/src/weights/pallet_tips.rs | 120 ++++++++ runtime/crab/src/weights/pallet_treasury.rs | 107 +++++++ runtime/crab/src/weights/pallet_utility.rs | 82 ++++++ runtime/crab/src/weights/pallet_vesting.rs | 169 +++++++++++ runtime/darwinia/src/lib.rs | 21 +- runtime/darwinia/src/pallets/assets.rs | 2 +- runtime/darwinia/src/pallets/balances.rs | 12 +- .../darwinia/src/pallets/bridge_grandpa.rs | 2 +- runtime/darwinia/src/pallets/collective.rs | 4 +- runtime/darwinia/src/pallets/democracy.rs | 2 +- .../src/pallets/elections_phragmen.rs | 2 +- runtime/darwinia/src/pallets/fee_market.rs | 2 +- runtime/darwinia/src/pallets/identity.rs | 2 +- runtime/darwinia/src/pallets/membership.rs | 2 +- runtime/darwinia/src/pallets/multisig.rs | 2 +- runtime/darwinia/src/pallets/preimage.rs | 2 +- runtime/darwinia/src/pallets/proxy.rs | 2 +- runtime/darwinia/src/pallets/scheduler.rs | 2 +- runtime/darwinia/src/pallets/tips.rs | 2 +- runtime/darwinia/src/pallets/treasury.rs | 2 +- runtime/darwinia/src/pallets/utility.rs | 2 +- runtime/darwinia/src/pallets/vesting.rs | 2 +- .../src/weights/cumulus_pallet_xcmp_queue.rs | 32 +- runtime/darwinia/src/weights/frame_system.rs | 52 ++-- runtime/darwinia/src/weights/mod.rs | 17 ++ runtime/darwinia/src/weights/pallet_assets.rs | 276 ++++++++++++++++++ .../darwinia/src/weights/pallet_balances.rs | 67 +++-- .../src/weights/pallet_bridge_grandpa.rs | 76 +++++ .../src/weights/pallet_collective_council.rs | 232 +++++++++++++++ .../pallet_collective_technical_committee.rs | 236 +++++++++++++++ .../darwinia/src/weights/pallet_democracy.rs | 252 ++++++++++++++++ .../src/weights/pallet_elections_phragmen.rs | 200 +++++++++++++ .../darwinia/src/weights/pallet_fee_market.rs | 139 +++++++++ .../darwinia/src/weights/pallet_identity.rs | 238 +++++++++++++++ .../darwinia/src/weights/pallet_membership.rs | 136 +++++++++ .../darwinia/src/weights/pallet_multisig.rs | 128 ++++++++ .../darwinia/src/weights/pallet_preimage.rs | 152 ++++++++++ runtime/darwinia/src/weights/pallet_proxy.rs | 157 ++++++++++ .../darwinia/src/weights/pallet_scheduler.rs | 140 +++++++++ .../darwinia/src/weights/pallet_session.rs | 32 +- .../darwinia/src/weights/pallet_timestamp.rs | 29 +- runtime/darwinia/src/weights/pallet_tips.rs | 120 ++++++++ .../darwinia/src/weights/pallet_treasury.rs | 107 +++++++ .../darwinia/src/weights/pallet_utility.rs | 82 ++++++ .../darwinia/src/weights/pallet_vesting.rs | 165 +++++++++++ runtime/pangolin/src/lib.rs | 21 +- runtime/pangolin/src/pallets/assets.rs | 2 +- runtime/pangolin/src/pallets/balances.rs | 12 +- .../pangolin/src/pallets/bridge_grandpa.rs | 2 +- runtime/pangolin/src/pallets/collective.rs | 4 +- runtime/pangolin/src/pallets/democracy.rs | 2 +- .../src/pallets/elections_phragmen.rs | 2 +- runtime/pangolin/src/pallets/fee_market.rs | 2 +- runtime/pangolin/src/pallets/identity.rs | 2 +- runtime/pangolin/src/pallets/membership.rs | 2 +- runtime/pangolin/src/pallets/multisig.rs | 2 +- runtime/pangolin/src/pallets/preimage.rs | 2 +- runtime/pangolin/src/pallets/proxy.rs | 2 +- runtime/pangolin/src/pallets/scheduler.rs | 2 +- runtime/pangolin/src/pallets/tips.rs | 2 +- runtime/pangolin/src/pallets/treasury.rs | 2 +- runtime/pangolin/src/pallets/utility.rs | 2 +- runtime/pangolin/src/pallets/vesting.rs | 2 +- .../src/weights/cumulus_pallet_xcmp_queue.rs | 32 +- runtime/pangolin/src/weights/frame_system.rs | 52 ++-- runtime/pangolin/src/weights/mod.rs | 17 ++ runtime/pangolin/src/weights/pallet_assets.rs | 276 ++++++++++++++++++ .../pangolin/src/weights/pallet_balances.rs | 67 +++-- .../src/weights/pallet_bridge_grandpa.rs | 76 +++++ .../src/weights/pallet_collective_council.rs | 232 +++++++++++++++ .../pallet_collective_technical_committee.rs | 232 +++++++++++++++ .../pangolin/src/weights/pallet_democracy.rs | 252 ++++++++++++++++ .../src/weights/pallet_elections_phragmen.rs | 202 +++++++++++++ .../pangolin/src/weights/pallet_fee_market.rs | 139 +++++++++ .../pangolin/src/weights/pallet_identity.rs | 240 +++++++++++++++ .../pangolin/src/weights/pallet_membership.rs | 136 +++++++++ .../pangolin/src/weights/pallet_multisig.rs | 130 +++++++++ .../pangolin/src/weights/pallet_preimage.rs | 152 ++++++++++ runtime/pangolin/src/weights/pallet_proxy.rs | 161 ++++++++++ .../pangolin/src/weights/pallet_scheduler.rs | 140 +++++++++ .../pangolin/src/weights/pallet_session.rs | 32 +- .../pangolin/src/weights/pallet_timestamp.rs | 29 +- runtime/pangolin/src/weights/pallet_tips.rs | 120 ++++++++ .../pangolin/src/weights/pallet_treasury.rs | 107 +++++++ .../pangolin/src/weights/pallet_utility.rs | 82 ++++++ .../pangolin/src/weights/pallet_vesting.rs | 169 +++++++++++ runtime/pangoro/src/lib.rs | 21 +- runtime/pangoro/src/pallets/assets.rs | 2 +- runtime/pangoro/src/pallets/balances.rs | 12 +- runtime/pangoro/src/pallets/bridge_grandpa.rs | 2 +- runtime/pangoro/src/pallets/collective.rs | 4 +- runtime/pangoro/src/pallets/democracy.rs | 2 +- .../pangoro/src/pallets/elections_phragmen.rs | 2 +- runtime/pangoro/src/pallets/fee_market.rs | 2 +- runtime/pangoro/src/pallets/identity.rs | 2 +- runtime/pangoro/src/pallets/membership.rs | 2 +- runtime/pangoro/src/pallets/multisig.rs | 2 +- runtime/pangoro/src/pallets/preimage.rs | 2 +- runtime/pangoro/src/pallets/proxy.rs | 2 +- runtime/pangoro/src/pallets/scheduler.rs | 2 +- runtime/pangoro/src/pallets/tips.rs | 2 +- runtime/pangoro/src/pallets/treasury.rs | 2 +- runtime/pangoro/src/pallets/utility.rs | 2 +- runtime/pangoro/src/pallets/vesting.rs | 2 +- .../src/weights/cumulus_pallet_xcmp_queue.rs | 32 +- runtime/pangoro/src/weights/frame_system.rs | 52 ++-- runtime/pangoro/src/weights/mod.rs | 17 ++ runtime/pangoro/src/weights/pallet_assets.rs | 272 +++++++++++++++++ .../pangoro/src/weights/pallet_balances.rs | 67 +++-- .../src/weights/pallet_bridge_grandpa.rs | 76 +++++ .../src/weights/pallet_collective_council.rs | 234 +++++++++++++++ .../pallet_collective_technical_committee.rs | 232 +++++++++++++++ .../pangoro/src/weights/pallet_democracy.rs | 252 ++++++++++++++++ .../src/weights/pallet_elections_phragmen.rs | 200 +++++++++++++ .../pangoro/src/weights/pallet_fee_market.rs | 139 +++++++++ .../pangoro/src/weights/pallet_identity.rs | 240 +++++++++++++++ .../pangoro/src/weights/pallet_membership.rs | 136 +++++++++ .../pangoro/src/weights/pallet_multisig.rs | 130 +++++++++ .../pangoro/src/weights/pallet_preimage.rs | 152 ++++++++++ runtime/pangoro/src/weights/pallet_proxy.rs | 157 ++++++++++ .../pangoro/src/weights/pallet_scheduler.rs | 140 +++++++++ runtime/pangoro/src/weights/pallet_session.rs | 32 +- .../pangoro/src/weights/pallet_timestamp.rs | 29 +- runtime/pangoro/src/weights/pallet_tips.rs | 120 ++++++++ .../pangoro/src/weights/pallet_treasury.rs | 107 +++++++ runtime/pangoro/src/weights/pallet_utility.rs | 82 ++++++ runtime/pangoro/src/weights/pallet_vesting.rs | 161 ++++++++++ 164 files changed, 12122 insertions(+), 420 deletions(-) create mode 100644 runtime/crab/src/weights/pallet_assets.rs create mode 100644 runtime/crab/src/weights/pallet_bridge_grandpa.rs create mode 100644 runtime/crab/src/weights/pallet_collective_council.rs create mode 100644 runtime/crab/src/weights/pallet_collective_technical_committee.rs create mode 100644 runtime/crab/src/weights/pallet_democracy.rs create mode 100644 runtime/crab/src/weights/pallet_elections_phragmen.rs create mode 100644 runtime/crab/src/weights/pallet_fee_market.rs create mode 100644 runtime/crab/src/weights/pallet_identity.rs create mode 100644 runtime/crab/src/weights/pallet_membership.rs create mode 100644 runtime/crab/src/weights/pallet_multisig.rs create mode 100644 runtime/crab/src/weights/pallet_preimage.rs create mode 100644 runtime/crab/src/weights/pallet_proxy.rs create mode 100644 runtime/crab/src/weights/pallet_scheduler.rs create mode 100644 runtime/crab/src/weights/pallet_tips.rs create mode 100644 runtime/crab/src/weights/pallet_treasury.rs create mode 100644 runtime/crab/src/weights/pallet_utility.rs create mode 100644 runtime/crab/src/weights/pallet_vesting.rs create mode 100644 runtime/darwinia/src/weights/pallet_assets.rs create mode 100644 runtime/darwinia/src/weights/pallet_bridge_grandpa.rs create mode 100644 runtime/darwinia/src/weights/pallet_collective_council.rs create mode 100644 runtime/darwinia/src/weights/pallet_collective_technical_committee.rs create mode 100644 runtime/darwinia/src/weights/pallet_democracy.rs create mode 100644 runtime/darwinia/src/weights/pallet_elections_phragmen.rs create mode 100644 runtime/darwinia/src/weights/pallet_fee_market.rs create mode 100644 runtime/darwinia/src/weights/pallet_identity.rs create mode 100644 runtime/darwinia/src/weights/pallet_membership.rs create mode 100644 runtime/darwinia/src/weights/pallet_multisig.rs create mode 100644 runtime/darwinia/src/weights/pallet_preimage.rs create mode 100644 runtime/darwinia/src/weights/pallet_proxy.rs create mode 100644 runtime/darwinia/src/weights/pallet_scheduler.rs create mode 100644 runtime/darwinia/src/weights/pallet_tips.rs create mode 100644 runtime/darwinia/src/weights/pallet_treasury.rs create mode 100644 runtime/darwinia/src/weights/pallet_utility.rs create mode 100644 runtime/darwinia/src/weights/pallet_vesting.rs create mode 100644 runtime/pangolin/src/weights/pallet_assets.rs create mode 100644 runtime/pangolin/src/weights/pallet_bridge_grandpa.rs create mode 100644 runtime/pangolin/src/weights/pallet_collective_council.rs create mode 100644 runtime/pangolin/src/weights/pallet_collective_technical_committee.rs create mode 100644 runtime/pangolin/src/weights/pallet_democracy.rs create mode 100644 runtime/pangolin/src/weights/pallet_elections_phragmen.rs create mode 100644 runtime/pangolin/src/weights/pallet_fee_market.rs create mode 100644 runtime/pangolin/src/weights/pallet_identity.rs create mode 100644 runtime/pangolin/src/weights/pallet_membership.rs create mode 100644 runtime/pangolin/src/weights/pallet_multisig.rs create mode 100644 runtime/pangolin/src/weights/pallet_preimage.rs create mode 100644 runtime/pangolin/src/weights/pallet_proxy.rs create mode 100644 runtime/pangolin/src/weights/pallet_scheduler.rs create mode 100644 runtime/pangolin/src/weights/pallet_tips.rs create mode 100644 runtime/pangolin/src/weights/pallet_treasury.rs create mode 100644 runtime/pangolin/src/weights/pallet_utility.rs create mode 100644 runtime/pangolin/src/weights/pallet_vesting.rs create mode 100644 runtime/pangoro/src/weights/pallet_assets.rs create mode 100644 runtime/pangoro/src/weights/pallet_bridge_grandpa.rs create mode 100644 runtime/pangoro/src/weights/pallet_collective_council.rs create mode 100644 runtime/pangoro/src/weights/pallet_collective_technical_committee.rs create mode 100644 runtime/pangoro/src/weights/pallet_democracy.rs create mode 100644 runtime/pangoro/src/weights/pallet_elections_phragmen.rs create mode 100644 runtime/pangoro/src/weights/pallet_fee_market.rs create mode 100644 runtime/pangoro/src/weights/pallet_identity.rs create mode 100644 runtime/pangoro/src/weights/pallet_membership.rs create mode 100644 runtime/pangoro/src/weights/pallet_multisig.rs create mode 100644 runtime/pangoro/src/weights/pallet_preimage.rs create mode 100644 runtime/pangoro/src/weights/pallet_proxy.rs create mode 100644 runtime/pangoro/src/weights/pallet_scheduler.rs create mode 100644 runtime/pangoro/src/weights/pallet_tips.rs create mode 100644 runtime/pangoro/src/weights/pallet_treasury.rs create mode 100644 runtime/pangoro/src/weights/pallet_utility.rs create mode 100644 runtime/pangoro/src/weights/pallet_vesting.rs diff --git a/runtime/crab/src/lib.rs b/runtime/crab/src/lib.rs index 5bc0a095d..b9d26a2e8 100644 --- a/runtime/crab/src/lib.rs +++ b/runtime/crab/src/lib.rs @@ -168,11 +168,30 @@ frame_support::construct_runtime! { #[cfg(feature = "runtime-benchmarks")] frame_benchmarking::define_benchmarks! { + // Substrate + [cumulus_pallet_xcmp_queue, XcmpQueue] [frame_system, SystemBench::] + [pallet_assets, Assets] [pallet_balances, Balances] + [pallet_collective, Council] + [pallet_collective, TechnicalCommittee] + [pallet_democracy, Democracy] + [pallet_elections_phragmen, PhragmenElection] + [pallet_identity, Identity] + [pallet_membership, TechnicalMembership] + [pallet_multisig, Multisig] + [pallet_preimage, Preimage] + [pallet_proxy, Proxy] + [pallet_scheduler, Scheduler] + [pallet_tips, Tips] + [pallet_treasury, Treasury] + [pallet_utility, Utility] + [pallet_vesting, Vesting] [pallet_session, SessionBench::] [pallet_timestamp, Timestamp] - [cumulus_pallet_xcmp_queue, XcmpQueue] + // Bridge + [pallet_bridge_grandpa, BridgePolkadotGrandpa] + [pallet_fee_market, DarwiniaFeeMarket] } impl_self_contained_call!(); diff --git a/runtime/crab/src/pallets/assets.rs b/runtime/crab/src/pallets/assets.rs index d1a47f55f..2bd2db829 100644 --- a/runtime/crab/src/pallets/assets.rs +++ b/runtime/crab/src/pallets/assets.rs @@ -50,5 +50,5 @@ impl pallet_assets::Config for Runtime { type RemoveItemsLimit = ConstU32<1000>; type RuntimeEvent = RuntimeEvent; type StringLimit = ConstU32<50>; - type WeightInfo = (); + type WeightInfo = weights::pallet_assets::WeightInfo; } diff --git a/runtime/crab/src/pallets/balances.rs b/runtime/crab/src/pallets/balances.rs index 94a42eac2..1680c05c1 100644 --- a/runtime/crab/src/pallets/balances.rs +++ b/runtime/crab/src/pallets/balances.rs @@ -19,11 +19,21 @@ // darwinia use crate::*; +// https://github.com/paritytech/substrate/blob/polkadot-v0.9.37/frame/balances/src/benchmarking.rs#L39 +#[cfg(feature = "runtime-benchmarks")] +frame_support::parameter_types! { + pub const ExistentialDeposit:Balance = 1; +} +#[cfg(not(feature = "runtime-benchmarks"))] +frame_support::parameter_types! { + pub const ExistentialDeposit:Balance = 0; +} + impl pallet_balances::Config for Runtime { type AccountStore = System; type Balance = Balance; type DustRemoval = (); - type ExistentialDeposit = ConstU128<0>; + type ExistentialDeposit = ExistentialDeposit; type MaxLocks = ConstU32<50>; type MaxReserves = ConstU32<50>; type ReserveIdentifier = [u8; 8]; diff --git a/runtime/crab/src/pallets/bridge_grandpa.rs b/runtime/crab/src/pallets/bridge_grandpa.rs index 617528b92..914950cf0 100644 --- a/runtime/crab/src/pallets/bridge_grandpa.rs +++ b/runtime/crab/src/pallets/bridge_grandpa.rs @@ -29,5 +29,5 @@ impl pallet_bridge_grandpa::Config for Runtime { type MaxBridgedAuthorities = ConstU32<100_000>; type MaxBridgedHeaderSize = ConstU32<65536>; type MaxRequests = ConstU32<50>; - type WeightInfo = (); + type WeightInfo = weights::pallet_bridge_grandpa::WeightInfo; } diff --git a/runtime/crab/src/pallets/collective.rs b/runtime/crab/src/pallets/collective.rs index 7dfbc2623..5168b8bf0 100644 --- a/runtime/crab/src/pallets/collective.rs +++ b/runtime/crab/src/pallets/collective.rs @@ -36,7 +36,7 @@ impl pallet_collective::Config for Runtime { type Proposal = RuntimeCall; type RuntimeEvent = RuntimeEvent; type RuntimeOrigin = RuntimeOrigin; - type WeightInfo = (); + type WeightInfo = weights::pallet_collective_council::WeightInfo; } impl pallet_collective::Config for Runtime { type DefaultVote = pallet_collective::PrimeDefaultVote; @@ -46,5 +46,5 @@ impl pallet_collective::Config for Runtime { type Proposal = RuntimeCall; type RuntimeEvent = RuntimeEvent; type RuntimeOrigin = RuntimeOrigin; - type WeightInfo = (); + type WeightInfo = weights::pallet_collective_technical_committee::WeightInfo; } diff --git a/runtime/crab/src/pallets/democracy.rs b/runtime/crab/src/pallets/democracy.rs index e28b4f392..a4c809347 100644 --- a/runtime/crab/src/pallets/democracy.rs +++ b/runtime/crab/src/pallets/democracy.rs @@ -60,5 +60,5 @@ impl pallet_democracy::Config for Runtime { type VetoOrigin = pallet_collective::EnsureMember; type VoteLockingPeriod = ConstU32; type VotingPeriod = ConstU32<{ 28 * DAYS }>; - type WeightInfo = (); + type WeightInfo = weights::pallet_democracy::WeightInfo; } diff --git a/runtime/crab/src/pallets/elections_phragmen.rs b/runtime/crab/src/pallets/elections_phragmen.rs index 133b89054..220df24cb 100644 --- a/runtime/crab/src/pallets/elections_phragmen.rs +++ b/runtime/crab/src/pallets/elections_phragmen.rs @@ -45,5 +45,5 @@ impl pallet_elections_phragmen::Config for Runtime { type VotingBondBase = ConstU128<{ darwinia_deposit(1, 64) }>; // Additional data per vote is 32 bytes (account id). type VotingBondFactor = ConstU128<{ darwinia_deposit(0, 32) }>; - type WeightInfo = (); + type WeightInfo = weights::pallet_elections_phragmen::WeightInfo; } diff --git a/runtime/crab/src/pallets/fee_market.rs b/runtime/crab/src/pallets/fee_market.rs index db790349b..c69815555 100644 --- a/runtime/crab/src/pallets/fee_market.rs +++ b/runtime/crab/src/pallets/fee_market.rs @@ -70,5 +70,5 @@ impl pallet_fee_market::Config for Runtime { type Slasher = FeeMarketSlasher; type Slot = ConstU32<600>; type TreasuryPalletId = TreasuryPalletId; - type WeightInfo = (); + type WeightInfo = weights::pallet_fee_market::WeightInfo; } diff --git a/runtime/crab/src/pallets/identity.rs b/runtime/crab/src/pallets/identity.rs index b12f0b3a9..1fcedcd89 100644 --- a/runtime/crab/src/pallets/identity.rs +++ b/runtime/crab/src/pallets/identity.rs @@ -35,5 +35,5 @@ impl pallet_identity::Config for Runtime { type Slashed = Treasury; // 53 bytes on-chain. type SubAccountDeposit = ConstU128<{ darwinia_deposit(1, 53) }>; - type WeightInfo = (); + type WeightInfo = weights::pallet_identity::WeightInfo; } diff --git a/runtime/crab/src/pallets/membership.rs b/runtime/crab/src/pallets/membership.rs index 3064d4b5e..a73d74e79 100644 --- a/runtime/crab/src/pallets/membership.rs +++ b/runtime/crab/src/pallets/membership.rs @@ -29,5 +29,5 @@ impl pallet_membership::Config for Runtime { type ResetOrigin = RootOrMoreThanHalf; type RuntimeEvent = RuntimeEvent; type SwapOrigin = RootOrMoreThanHalf; - type WeightInfo = (); + type WeightInfo = weights::pallet_membership::WeightInfo; } diff --git a/runtime/crab/src/pallets/multisig.rs b/runtime/crab/src/pallets/multisig.rs index c47262b26..d2e226434 100644 --- a/runtime/crab/src/pallets/multisig.rs +++ b/runtime/crab/src/pallets/multisig.rs @@ -28,5 +28,5 @@ impl pallet_multisig::Config for Runtime { type MaxSignatories = ConstU32<100>; type RuntimeCall = RuntimeCall; type RuntimeEvent = RuntimeEvent; - type WeightInfo = (); + type WeightInfo = weights::pallet_multisig::WeightInfo; } diff --git a/runtime/crab/src/pallets/preimage.rs b/runtime/crab/src/pallets/preimage.rs index d049ef1c0..08ef47e38 100644 --- a/runtime/crab/src/pallets/preimage.rs +++ b/runtime/crab/src/pallets/preimage.rs @@ -25,5 +25,5 @@ impl pallet_preimage::Config for Runtime { type Currency = Balances; type ManagerOrigin = frame_system::EnsureRoot; type RuntimeEvent = RuntimeEvent; - type WeightInfo = (); + type WeightInfo = weights::pallet_preimage::WeightInfo; } diff --git a/runtime/crab/src/pallets/proxy.rs b/runtime/crab/src/pallets/proxy.rs index 1354085a5..3b0f76578 100644 --- a/runtime/crab/src/pallets/proxy.rs +++ b/runtime/crab/src/pallets/proxy.rs @@ -129,5 +129,5 @@ impl pallet_proxy::Config for Runtime { type ProxyType = ProxyType; type RuntimeCall = RuntimeCall; type RuntimeEvent = RuntimeEvent; - type WeightInfo = (); + type WeightInfo = weights::pallet_proxy::WeightInfo; } diff --git a/runtime/crab/src/pallets/scheduler.rs b/runtime/crab/src/pallets/scheduler.rs index 2f0197405..868dfd6d6 100644 --- a/runtime/crab/src/pallets/scheduler.rs +++ b/runtime/crab/src/pallets/scheduler.rs @@ -59,5 +59,5 @@ impl pallet_scheduler::Config for Runtime { type RuntimeEvent = RuntimeEvent; type RuntimeOrigin = RuntimeOrigin; type ScheduleOrigin = Root; - type WeightInfo = (); + type WeightInfo = weights::pallet_scheduler::WeightInfo; } diff --git a/runtime/crab/src/pallets/tips.rs b/runtime/crab/src/pallets/tips.rs index 6500a1b3a..e5e1ff68a 100644 --- a/runtime/crab/src/pallets/tips.rs +++ b/runtime/crab/src/pallets/tips.rs @@ -31,5 +31,5 @@ impl pallet_tips::Config for Runtime { type TipFindersFee = TipFindersFee; type TipReportDepositBase = ConstU128<{ 100 * UNIT }>; type Tippers = PhragmenElection; - type WeightInfo = (); + type WeightInfo = weights::pallet_tips::WeightInfo; } diff --git a/runtime/crab/src/pallets/treasury.rs b/runtime/crab/src/pallets/treasury.rs index 3febca02f..b2e8b4708 100644 --- a/runtime/crab/src/pallets/treasury.rs +++ b/runtime/crab/src/pallets/treasury.rs @@ -43,5 +43,5 @@ impl pallet_treasury::Config for Runtime { type SpendFunds = (); type SpendOrigin = frame_support::traits::NeverEnsureOrigin; type SpendPeriod = ConstU32<{ 24 * DAYS }>; - type WeightInfo = (); + type WeightInfo = weights::pallet_treasury::WeightInfo; } diff --git a/runtime/crab/src/pallets/utility.rs b/runtime/crab/src/pallets/utility.rs index 2c0f49ddf..c89d70642 100644 --- a/runtime/crab/src/pallets/utility.rs +++ b/runtime/crab/src/pallets/utility.rs @@ -23,5 +23,5 @@ impl pallet_utility::Config for Runtime { type PalletsOrigin = OriginCaller; type RuntimeCall = RuntimeCall; type RuntimeEvent = RuntimeEvent; - type WeightInfo = (); + type WeightInfo = weights::pallet_utility::WeightInfo; } diff --git a/runtime/crab/src/pallets/vesting.rs b/runtime/crab/src/pallets/vesting.rs index 1c0b0b6e6..f13db8ccc 100644 --- a/runtime/crab/src/pallets/vesting.rs +++ b/runtime/crab/src/pallets/vesting.rs @@ -32,7 +32,7 @@ impl pallet_vesting::Config for Runtime { type MinVestedTransfer = ConstU128; type RuntimeEvent = RuntimeEvent; type UnvestedFundsAllowedWithdrawReasons = UnvestedFundsAllowedWithdrawReasons; - type WeightInfo = (); + type WeightInfo = weights::pallet_vesting::WeightInfo; // `VestingInfo` encode length is 36bytes. 28 schedules gets encoded as 1009 bytes, which is the // highest number of schedules that encodes less than 2^10. diff --git a/runtime/crab/src/weights/cumulus_pallet_xcmp_queue.rs b/runtime/crab/src/weights/cumulus_pallet_xcmp_queue.rs index 3271b31e4..6e6b5ddff 100644 --- a/runtime/crab/src/weights/cumulus_pallet_xcmp_queue.rs +++ b/runtime/crab/src/weights/cumulus_pallet_xcmp_queue.rs @@ -19,12 +19,12 @@ //! Autogenerated weights for `cumulus_pallet_xcmp_queue` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2022-11-09, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! HOSTNAME: `inv.cafe`, CPU: `AMD Ryzen 9 5950X 16-Core Processor` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("local"), DB CACHE: 1024 +//! DATE: 2023-02-22, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("crab-local"), DB CACHE: 1024 // Executed Command: -// target/release/darwinia +// ./target/release/darwinia // benchmark // pallet // --header @@ -33,14 +33,18 @@ // wasm // --heap-pages // 4096 +// --steps +// 2 +// --repeat +// 1 // --chain -// local +// crab-local // --output -// runtime/src/weights +// runtime/crab/src/weights/ // --extrinsic // * // --pallet -// cumulus-pallet-xcmp-queue +// * #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -54,14 +58,16 @@ pub struct WeightInfo(PhantomData); impl cumulus_pallet_xcmp_queue::WeightInfo for WeightInfo { // Storage: XcmpQueue QueueConfig (r:1 w:1) fn set_config_with_u32() -> Weight { - Weight::from_ref_time(13_340_000 as u64) - .saturating_add(T::DbWeight::get().reads(1 as u64)) - .saturating_add(T::DbWeight::get().writes(1 as u64)) + // Minimum execution time: 26_238 nanoseconds. + Weight::from_ref_time(26_238_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) } // Storage: XcmpQueue QueueConfig (r:1 w:1) fn set_config_with_weight() -> Weight { - Weight::from_ref_time(12_610_000 as u64) - .saturating_add(T::DbWeight::get().reads(1 as u64)) - .saturating_add(T::DbWeight::get().writes(1 as u64)) + // Minimum execution time: 23_922 nanoseconds. + Weight::from_ref_time(23_922_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) } } diff --git a/runtime/crab/src/weights/frame_system.rs b/runtime/crab/src/weights/frame_system.rs index 2361f7517..035d067b3 100644 --- a/runtime/crab/src/weights/frame_system.rs +++ b/runtime/crab/src/weights/frame_system.rs @@ -19,12 +19,12 @@ //! Autogenerated weights for `frame_system` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2022-11-09, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! HOSTNAME: `inv.cafe`, CPU: `AMD Ryzen 9 5950X 16-Core Processor` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("local"), DB CACHE: 1024 +//! DATE: 2023-02-22, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("crab-local"), DB CACHE: 1024 // Executed Command: -// target/release/darwinia +// ./target/release/darwinia // benchmark // pallet // --header @@ -33,14 +33,18 @@ // wasm // --heap-pages // 4096 +// --steps +// 2 +// --repeat +// 1 // --chain -// local +// crab-local // --output -// runtime/src/weights +// runtime/crab/src/weights/ // --extrinsic // * // --pallet -// frame-system +// * #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -54,35 +58,41 @@ pub struct WeightInfo(PhantomData); impl frame_system::WeightInfo for WeightInfo { /// The range of component `b` is `[0, 3932160]`. fn remark(_b: u32, ) -> Weight { - Weight::from_ref_time(1_074_555_000 as u64) + // Minimum execution time: 16_591 nanoseconds. + Weight::from_ref_time(886_493_000) } /// The range of component `b` is `[0, 3932160]`. fn remark_with_event(_b: u32, ) -> Weight { - Weight::from_ref_time(4_724_488_000 as u64) + // Minimum execution time: 32_289 nanoseconds. + Weight::from_ref_time(4_680_492_000) } // Storage: System Digest (r:1 w:1) // Storage: unknown [0x3a686561707061676573] (r:0 w:1) fn set_heap_pages() -> Weight { - Weight::from_ref_time(14_110_000 as u64) - .saturating_add(T::DbWeight::get().reads(1 as u64)) - .saturating_add(T::DbWeight::get().writes(2 as u64)) + // Minimum execution time: 30_011 nanoseconds. + Weight::from_ref_time(30_011_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(2)) } // Storage: Skipped Metadata (r:0 w:0) - /// The range of component `i` is `[1, 1000]`. + /// The range of component `i` is `[0, 1000]`. fn set_storage(_i: u32, ) -> Weight { - Weight::from_ref_time(655_299_000 as u64) - .saturating_add(T::DbWeight::get().writes(1000 as u64)) + // Minimum execution time: 95_093 nanoseconds. + Weight::from_ref_time(572_291_000) + .saturating_add(T::DbWeight::get().writes(1000)) } // Storage: Skipped Metadata (r:0 w:0) - /// The range of component `i` is `[1, 1000]`. + /// The range of component `i` is `[0, 1000]`. fn kill_storage(_i: u32, ) -> Weight { - Weight::from_ref_time(555_697_000 as u64) - .saturating_add(T::DbWeight::get().writes(1000 as u64)) + // Minimum execution time: 18_319 nanoseconds. + Weight::from_ref_time(407_086_000) + .saturating_add(T::DbWeight::get().writes(1000)) } // Storage: Skipped Metadata (r:0 w:0) - /// The range of component `p` is `[1, 1000]`. + /// The range of component `p` is `[0, 1000]`. fn kill_prefix(_p: u32, ) -> Weight { - Weight::from_ref_time(1_089_395_000 as u64) - .saturating_add(T::DbWeight::get().writes(1000 as u64)) + // Minimum execution time: 31_200 nanoseconds. + Weight::from_ref_time(772_322_000) + .saturating_add(T::DbWeight::get().writes(1000)) } } diff --git a/runtime/crab/src/weights/mod.rs b/runtime/crab/src/weights/mod.rs index caf9386da..4580cd631 100644 --- a/runtime/crab/src/weights/mod.rs +++ b/runtime/crab/src/weights/mod.rs @@ -34,6 +34,23 @@ pub use rocksdb_weights::constants::RocksDbWeight; pub mod cumulus_pallet_xcmp_queue; pub mod frame_system; +pub mod pallet_assets; pub mod pallet_balances; +pub mod pallet_bridge_grandpa; +pub mod pallet_collective_council; +pub mod pallet_collective_technical_committee; +pub mod pallet_democracy; +pub mod pallet_elections_phragmen; +pub mod pallet_fee_market; +pub mod pallet_identity; +pub mod pallet_membership; +pub mod pallet_multisig; +pub mod pallet_preimage; +pub mod pallet_proxy; +pub mod pallet_scheduler; pub mod pallet_session; pub mod pallet_timestamp; +pub mod pallet_tips; +pub mod pallet_treasury; +pub mod pallet_utility; +pub mod pallet_vesting; diff --git a/runtime/crab/src/weights/pallet_assets.rs b/runtime/crab/src/weights/pallet_assets.rs new file mode 100644 index 000000000..eb1debcbc --- /dev/null +++ b/runtime/crab/src/weights/pallet_assets.rs @@ -0,0 +1,276 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `pallet_assets` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-02-22, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("crab-local"), DB CACHE: 1024 + +// Executed Command: +// ./target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --steps +// 2 +// --repeat +// 1 +// --chain +// crab-local +// --output +// runtime/crab/src/weights/ +// --extrinsic +// * +// --pallet +// * + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_assets`. +pub struct WeightInfo(PhantomData); +impl pallet_assets::WeightInfo for WeightInfo { + // Storage: Assets Asset (r:1 w:1) + fn create() -> Weight { + // Minimum execution time: 23_393 nanoseconds. + Weight::from_ref_time(23_393_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Assets Asset (r:1 w:1) + fn force_create() -> Weight { + // Minimum execution time: 38_361 nanoseconds. + Weight::from_ref_time(38_361_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Assets Asset (r:1 w:1) + fn start_destroy() -> Weight { + // Minimum execution time: 53_286 nanoseconds. + Weight::from_ref_time(53_286_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Assets Asset (r:1 w:1) + // Storage: Assets Account (r:1 w:0) + // Storage: System Account (r:1000 w:1000) + /// The range of component `c` is `[0, 1000]`. + fn destroy_accounts(_c: u32, ) -> Weight { + // Minimum execution time: 28_953 nanoseconds. + Weight::from_ref_time(11_140_037_000) + .saturating_add(T::DbWeight::get().reads(2002)) + .saturating_add(T::DbWeight::get().writes(2001)) + } + // Storage: Assets Asset (r:1 w:1) + // Storage: Assets Approvals (r:1 w:0) + /// The range of component `a` is `[0, 1000]`. + fn destroy_approvals(_a: u32, ) -> Weight { + // Minimum execution time: 25_818 nanoseconds. + Weight::from_ref_time(5_856_860_000) + .saturating_add(T::DbWeight::get().reads(1002)) + .saturating_add(T::DbWeight::get().writes(1001)) + } + // Storage: Assets Asset (r:1 w:1) + // Storage: Assets Metadata (r:1 w:0) + fn finish_destroy() -> Weight { + // Minimum execution time: 108_431 nanoseconds. + Weight::from_ref_time(108_431_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Assets Asset (r:1 w:1) + // Storage: Assets Account (r:1 w:1) + fn mint() -> Weight { + // Minimum execution time: 47_200 nanoseconds. + Weight::from_ref_time(47_200_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Assets Asset (r:1 w:1) + // Storage: Assets Account (r:1 w:1) + fn burn() -> Weight { + // Minimum execution time: 42_744 nanoseconds. + Weight::from_ref_time(42_744_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Assets Asset (r:1 w:1) + // Storage: Assets Account (r:2 w:2) + // Storage: System Account (r:1 w:1) + fn transfer() -> Weight { + // Minimum execution time: 52_584 nanoseconds. + Weight::from_ref_time(52_584_000) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(4)) + } + // Storage: Assets Asset (r:1 w:1) + // Storage: Assets Account (r:2 w:2) + // Storage: System Account (r:1 w:1) + fn transfer_keep_alive() -> Weight { + // Minimum execution time: 45_738 nanoseconds. + Weight::from_ref_time(45_738_000) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(4)) + } + // Storage: Assets Asset (r:1 w:1) + // Storage: Assets Account (r:2 w:2) + // Storage: System Account (r:1 w:1) + fn force_transfer() -> Weight { + // Minimum execution time: 54_208 nanoseconds. + Weight::from_ref_time(54_208_000) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(4)) + } + // Storage: Assets Asset (r:1 w:0) + // Storage: Assets Account (r:1 w:1) + fn freeze() -> Weight { + // Minimum execution time: 24_619 nanoseconds. + Weight::from_ref_time(24_619_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Assets Asset (r:1 w:0) + // Storage: Assets Account (r:1 w:1) + fn thaw() -> Weight { + // Minimum execution time: 24_948 nanoseconds. + Weight::from_ref_time(24_948_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Assets Asset (r:1 w:1) + fn freeze_asset() -> Weight { + // Minimum execution time: 21_495 nanoseconds. + Weight::from_ref_time(21_495_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Assets Asset (r:1 w:1) + fn thaw_asset() -> Weight { + // Minimum execution time: 23_834 nanoseconds. + Weight::from_ref_time(23_834_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Assets Asset (r:1 w:1) + // Storage: Assets Metadata (r:1 w:0) + fn transfer_ownership() -> Weight { + // Minimum execution time: 24_822 nanoseconds. + Weight::from_ref_time(24_822_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Assets Asset (r:1 w:1) + fn set_team() -> Weight { + // Minimum execution time: 22_826 nanoseconds. + Weight::from_ref_time(22_826_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Assets Asset (r:1 w:0) + // Storage: Assets Metadata (r:1 w:1) + /// The range of component `n` is `[0, 50]`. + /// The range of component `s` is `[0, 50]`. + fn set_metadata(_n: u32, _s: u32, ) -> Weight { + // Minimum execution time: 22_897 nanoseconds. + Weight::from_ref_time(30_287_500) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Assets Asset (r:1 w:0) + // Storage: Assets Metadata (r:1 w:1) + fn clear_metadata() -> Weight { + // Minimum execution time: 25_979 nanoseconds. + Weight::from_ref_time(25_979_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Assets Asset (r:1 w:0) + // Storage: Assets Metadata (r:1 w:1) + /// The range of component `n` is `[0, 50]`. + /// The range of component `s` is `[0, 50]`. + fn force_set_metadata(n: u32, s: u32, ) -> Weight { + // Minimum execution time: 24_245 nanoseconds. + Weight::from_ref_time(21_384_000) + // Standard Error: 283_571 + .saturating_add(Weight::from_ref_time(57_220).saturating_mul(n.into())) + // Standard Error: 283_571 + .saturating_add(Weight::from_ref_time(179_140).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Assets Asset (r:1 w:0) + // Storage: Assets Metadata (r:1 w:1) + fn force_clear_metadata() -> Weight { + // Minimum execution time: 22_005 nanoseconds. + Weight::from_ref_time(22_005_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Assets Asset (r:1 w:1) + fn force_asset_status() -> Weight { + // Minimum execution time: 32_983 nanoseconds. + Weight::from_ref_time(32_983_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Assets Asset (r:1 w:1) + // Storage: Assets Approvals (r:1 w:1) + fn approve_transfer() -> Weight { + // Minimum execution time: 25_652 nanoseconds. + Weight::from_ref_time(25_652_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Assets Asset (r:1 w:1) + // Storage: Assets Approvals (r:1 w:1) + // Storage: Assets Account (r:2 w:2) + // Storage: System Account (r:1 w:1) + fn transfer_approved() -> Weight { + // Minimum execution time: 65_233 nanoseconds. + Weight::from_ref_time(65_233_000) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(5)) + } + // Storage: Assets Asset (r:1 w:1) + // Storage: Assets Approvals (r:1 w:1) + fn cancel_approval() -> Weight { + // Minimum execution time: 25_381 nanoseconds. + Weight::from_ref_time(25_381_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Assets Asset (r:1 w:1) + // Storage: Assets Approvals (r:1 w:1) + fn force_cancel_approval() -> Weight { + // Minimum execution time: 26_033 nanoseconds. + Weight::from_ref_time(26_033_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } +} diff --git a/runtime/crab/src/weights/pallet_balances.rs b/runtime/crab/src/weights/pallet_balances.rs index f7acd35fb..d67c8a285 100644 --- a/runtime/crab/src/weights/pallet_balances.rs +++ b/runtime/crab/src/weights/pallet_balances.rs @@ -19,12 +19,12 @@ //! Autogenerated weights for `pallet_balances` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2022-11-09, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! HOSTNAME: `inv.cafe`, CPU: `AMD Ryzen 9 5950X 16-Core Processor` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("local"), DB CACHE: 1024 +//! DATE: 2023-02-22, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("crab-local"), DB CACHE: 1024 // Executed Command: -// target/release/darwinia +// ./target/release/darwinia // benchmark // pallet // --header @@ -33,14 +33,18 @@ // wasm // --heap-pages // 4096 +// --steps +// 2 +// --repeat +// 1 // --chain -// local +// crab-local // --output -// runtime/src/weights +// runtime/crab/src/weights/ // --extrinsic // * // --pallet -// pallet-balances +// * #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -54,44 +58,51 @@ pub struct WeightInfo(PhantomData); impl pallet_balances::WeightInfo for WeightInfo { // Storage: System Account (r:1 w:1) fn transfer() -> Weight { - Weight::from_ref_time(57_141_000 as u64) - .saturating_add(T::DbWeight::get().reads(1 as u64)) - .saturating_add(T::DbWeight::get().writes(1 as u64)) + // Minimum execution time: 49_510 nanoseconds. + Weight::from_ref_time(49_510_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) } // Storage: System Account (r:1 w:1) fn transfer_keep_alive() -> Weight { - Weight::from_ref_time(43_271_000 as u64) - .saturating_add(T::DbWeight::get().reads(1 as u64)) - .saturating_add(T::DbWeight::get().writes(1 as u64)) + // Minimum execution time: 52_653 nanoseconds. + Weight::from_ref_time(52_653_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) } // Storage: System Account (r:1 w:1) fn set_balance_creating() -> Weight { - Weight::from_ref_time(29_941_000 as u64) - .saturating_add(T::DbWeight::get().reads(1 as u64)) - .saturating_add(T::DbWeight::get().writes(1 as u64)) + // Minimum execution time: 43_584 nanoseconds. + Weight::from_ref_time(43_584_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) } // Storage: System Account (r:1 w:1) fn set_balance_killing() -> Weight { - Weight::from_ref_time(34_490_000 as u64) - .saturating_add(T::DbWeight::get().reads(1 as u64)) - .saturating_add(T::DbWeight::get().writes(1 as u64)) + // Minimum execution time: 44_897 nanoseconds. + Weight::from_ref_time(44_897_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) } // Storage: System Account (r:2 w:2) fn force_transfer() -> Weight { - Weight::from_ref_time(54_911_000 as u64) - .saturating_add(T::DbWeight::get().reads(2 as u64)) - .saturating_add(T::DbWeight::get().writes(2 as u64)) + // Minimum execution time: 56_196 nanoseconds. + Weight::from_ref_time(56_196_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) } // Storage: System Account (r:1 w:1) fn transfer_all() -> Weight { - Weight::from_ref_time(49_671_000 as u64) - .saturating_add(T::DbWeight::get().reads(1 as u64)) - .saturating_add(T::DbWeight::get().writes(1 as u64)) + // Minimum execution time: 58_411 nanoseconds. + Weight::from_ref_time(58_411_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) } // Storage: System Account (r:1 w:1) fn force_unreserve() -> Weight { - Weight::from_ref_time(26_120_000 as u64) - .saturating_add(T::DbWeight::get().reads(1 as u64)) - .saturating_add(T::DbWeight::get().writes(1 as u64)) + // Minimum execution time: 33_417 nanoseconds. + Weight::from_ref_time(33_417_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) } } diff --git a/runtime/crab/src/weights/pallet_bridge_grandpa.rs b/runtime/crab/src/weights/pallet_bridge_grandpa.rs new file mode 100644 index 000000000..1209471be --- /dev/null +++ b/runtime/crab/src/weights/pallet_bridge_grandpa.rs @@ -0,0 +1,76 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `pallet_bridge_grandpa` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-02-22, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("crab-local"), DB CACHE: 1024 + +// Executed Command: +// ./target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --steps +// 2 +// --repeat +// 1 +// --chain +// crab-local +// --output +// runtime/crab/src/weights/ +// --extrinsic +// * +// --pallet +// * + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_bridge_grandpa`. +pub struct WeightInfo(PhantomData); +impl pallet_bridge_grandpa::WeightInfo for WeightInfo { + // Storage: BridgePolkadotGrandpa PalletOperatingMode (r:1 w:0) + // Storage: BridgePolkadotGrandpa RequestCount (r:1 w:1) + // Storage: BridgePolkadotGrandpa BestFinalized (r:1 w:1) + // Storage: BridgePolkadotGrandpa ImportedHeaders (r:1 w:2) + // Storage: BridgePolkadotGrandpa CurrentAuthoritySet (r:1 w:0) + // Storage: BridgePolkadotGrandpa ImportedHashesPointer (r:1 w:1) + // Storage: BridgePolkadotGrandpa ImportedHashes (r:1 w:1) + /// The range of component `p` is `[51, 102]`. + /// The range of component `v` is `[50, 100]`. + fn submit_finality_proof(p: u32, _v: u32, ) -> Weight { + // Minimum execution time: 1_896_381 nanoseconds. + Weight::from_ref_time(1_896_381_000) + // Standard Error: 7_800_474 + .saturating_add(Weight::from_ref_time(21_485_513).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(7)) + .saturating_add(T::DbWeight::get().writes(6)) + } +} diff --git a/runtime/crab/src/weights/pallet_collective_council.rs b/runtime/crab/src/weights/pallet_collective_council.rs new file mode 100644 index 000000000..19fad1629 --- /dev/null +++ b/runtime/crab/src/weights/pallet_collective_council.rs @@ -0,0 +1,230 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `pallet_collective` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-02-22, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("crab-local"), DB CACHE: 1024 + +// Executed Command: +// ./target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --steps +// 2 +// --repeat +// 1 +// --chain +// crab-local +// --output +// runtime/crab/src/weights/ +// --extrinsic +// * +// --pallet +// * + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_collective`. +pub struct WeightInfo(PhantomData); +impl pallet_collective::WeightInfo for WeightInfo { + // Storage: Council Members (r:1 w:1) + // Storage: Council Proposals (r:1 w:0) + // Storage: Council Prime (r:0 w:1) + // Storage: Council Voting (r:100 w:100) + /// The range of component `m` is `[0, 100]`. + /// The range of component `n` is `[0, 100]`. + /// The range of component `p` is `[0, 100]`. + /// The range of component `m` is `[0, 100]`. + /// The range of component `n` is `[0, 100]`. + /// The range of component `p` is `[0, 100]`. + fn set_members(m: u32, _n: u32, p: u32, ) -> Weight { + // Minimum execution time: 16_433 nanoseconds. + Weight::from_ref_time(16_433_000) + // Standard Error: 891_191 + .saturating_add(Weight::from_ref_time(3_599_117).saturating_mul(m.into())) + // Standard Error: 891_191 + .saturating_add(Weight::from_ref_time(3_563_387).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(m.into()))) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(p.into()))) + .saturating_add(T::DbWeight::get().writes(2)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(m.into()))) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(p.into()))) + } + // Storage: Council Members (r:1 w:0) + /// The range of component `b` is `[2, 1024]`. + /// The range of component `m` is `[1, 100]`. + /// The range of component `b` is `[2, 1024]`. + /// The range of component `m` is `[1, 100]`. + fn execute(_b: u32, m: u32, ) -> Weight { + // Minimum execution time: 24_667 nanoseconds. + Weight::from_ref_time(29_129_622) + // Standard Error: 43_932 + .saturating_add(Weight::from_ref_time(5_454).saturating_mul(m.into())) + .saturating_add(T::DbWeight::get().reads(1)) + } + // Storage: Council Members (r:1 w:0) + // Storage: Council ProposalOf (r:1 w:0) + /// The range of component `b` is `[2, 1024]`. + /// The range of component `m` is `[1, 100]`. + /// The range of component `b` is `[2, 1024]`. + /// The range of component `m` is `[1, 100]`. + fn propose_execute(_b: u32, _m: u32, ) -> Weight { + // Minimum execution time: 29_572 nanoseconds. + Weight::from_ref_time(34_989_251) + .saturating_add(T::DbWeight::get().reads(2)) + } + // Storage: Council Members (r:1 w:0) + // Storage: Council ProposalOf (r:1 w:1) + // Storage: Council Proposals (r:1 w:1) + // Storage: Council ProposalCount (r:1 w:1) + // Storage: Council Voting (r:0 w:1) + /// The range of component `b` is `[2, 1024]`. + /// The range of component `m` is `[2, 100]`. + /// The range of component `p` is `[1, 100]`. + /// The range of component `b` is `[2, 1024]`. + /// The range of component `m` is `[2, 100]`. + /// The range of component `p` is `[1, 100]`. + fn propose_proposed(b: u32, m: u32, p: u32, ) -> Weight { + // Minimum execution time: 32_670 nanoseconds. + Weight::from_ref_time(25_318_865) + // Standard Error: 6_284 + .saturating_add(Weight::from_ref_time(2_659).saturating_mul(b.into())) + // Standard Error: 65_542 + .saturating_add(Weight::from_ref_time(56_288).saturating_mul(m.into())) + // Standard Error: 64_880 + .saturating_add(Weight::from_ref_time(255_739).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(4)) + } + // Storage: Council Members (r:1 w:0) + // Storage: Council Voting (r:1 w:1) + /// The range of component `m` is `[5, 100]`. + /// The range of component `m` is `[5, 100]`. + fn vote(m: u32, ) -> Weight { + // Minimum execution time: 31_910 nanoseconds. + Weight::from_ref_time(36_742_315) + // Standard Error: 65_099 + .saturating_add(Weight::from_ref_time(10_336).saturating_mul(m.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Council Voting (r:1 w:1) + // Storage: Council Members (r:1 w:0) + // Storage: Council Proposals (r:1 w:1) + // Storage: Council ProposalOf (r:0 w:1) + /// The range of component `m` is `[4, 100]`. + /// The range of component `p` is `[1, 100]`. + /// The range of component `m` is `[4, 100]`. + /// The range of component `p` is `[1, 100]`. + fn close_early_disapproved(_m: u32, p: u32, ) -> Weight { + // Minimum execution time: 29_963 nanoseconds. + Weight::from_ref_time(35_131_529) + // Standard Error: 43_803 + .saturating_add(Weight::from_ref_time(138_116).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: Council Voting (r:1 w:1) + // Storage: Council Members (r:1 w:0) + // Storage: Council ProposalOf (r:1 w:1) + // Storage: Council Proposals (r:1 w:1) + /// The range of component `b` is `[2, 1024]`. + /// The range of component `m` is `[4, 100]`. + /// The range of component `p` is `[1, 100]`. + /// The range of component `b` is `[2, 1024]`. + /// The range of component `m` is `[4, 100]`. + /// The range of component `p` is `[1, 100]`. + fn close_early_approved(_b: u32, m: u32, p: u32, ) -> Weight { + // Minimum execution time: 41_671 nanoseconds. + Weight::from_ref_time(46_362_214) + // Standard Error: 32_493 + .saturating_add(Weight::from_ref_time(14_218).saturating_mul(m.into())) + // Standard Error: 31_508 + .saturating_add(Weight::from_ref_time(253_545).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: Council Voting (r:1 w:1) + // Storage: Council Members (r:1 w:0) + // Storage: Council Prime (r:1 w:0) + // Storage: Council Proposals (r:1 w:1) + // Storage: Council ProposalOf (r:0 w:1) + /// The range of component `m` is `[4, 100]`. + /// The range of component `p` is `[1, 100]`. + /// The range of component `m` is `[4, 100]`. + /// The range of component `p` is `[1, 100]`. + fn close_disapproved(m: u32, p: u32, ) -> Weight { + // Minimum execution time: 32_840 nanoseconds. + Weight::from_ref_time(29_659_715) + // Standard Error: 19_019 + .saturating_add(Weight::from_ref_time(47_182).saturating_mul(m.into())) + // Standard Error: 18_442 + .saturating_add(Weight::from_ref_time(221_055).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: Council Voting (r:1 w:1) + // Storage: Council Members (r:1 w:0) + // Storage: Council Prime (r:1 w:0) + // Storage: Council ProposalOf (r:1 w:1) + // Storage: Council Proposals (r:1 w:1) + /// The range of component `b` is `[2, 1024]`. + /// The range of component `m` is `[4, 100]`. + /// The range of component `p` is `[1, 100]`. + /// The range of component `b` is `[2, 1024]`. + /// The range of component `m` is `[4, 100]`. + /// The range of component `p` is `[1, 100]`. + fn close_approved(_b: u32, m: u32, p: u32, ) -> Weight { + // Minimum execution time: 47_632 nanoseconds. + Weight::from_ref_time(71_486_822) + // Standard Error: 163_509 + .saturating_add(Weight::from_ref_time(10_947).saturating_mul(m.into())) + // Standard Error: 158_554 + .saturating_add(Weight::from_ref_time(234_414).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: Council Proposals (r:1 w:1) + // Storage: Council Voting (r:0 w:1) + // Storage: Council ProposalOf (r:0 w:1) + /// The range of component `p` is `[1, 100]`. + /// The range of component `p` is `[1, 100]`. + fn disapprove_proposal(p: u32, ) -> Weight { + // Minimum execution time: 20_613 nanoseconds. + Weight::from_ref_time(21_543_267) + // Standard Error: 17_208 + .saturating_add(Weight::from_ref_time(200_232).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(3)) + } +} diff --git a/runtime/crab/src/weights/pallet_collective_technical_committee.rs b/runtime/crab/src/weights/pallet_collective_technical_committee.rs new file mode 100644 index 000000000..316e3716d --- /dev/null +++ b/runtime/crab/src/weights/pallet_collective_technical_committee.rs @@ -0,0 +1,232 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `pallet_collective` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-02-22, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("crab-local"), DB CACHE: 1024 + +// Executed Command: +// ./target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --steps +// 2 +// --repeat +// 1 +// --chain +// crab-local +// --output +// runtime/crab/src/weights/ +// --extrinsic +// * +// --pallet +// * + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_collective`. +pub struct WeightInfo(PhantomData); +impl pallet_collective::WeightInfo for WeightInfo { + // Storage: TechnicalCommittee Members (r:1 w:1) + // Storage: TechnicalCommittee Proposals (r:1 w:0) + // Storage: TechnicalCommittee Prime (r:0 w:1) + // Storage: TechnicalCommittee Voting (r:100 w:100) + /// The range of component `m` is `[0, 100]`. + /// The range of component `n` is `[0, 100]`. + /// The range of component `p` is `[0, 100]`. + /// The range of component `m` is `[0, 100]`. + /// The range of component `n` is `[0, 100]`. + /// The range of component `p` is `[0, 100]`. + fn set_members(m: u32, _n: u32, p: u32, ) -> Weight { + // Minimum execution time: 13_463 nanoseconds. + Weight::from_ref_time(13_463_000) + // Standard Error: 895_060 + .saturating_add(Weight::from_ref_time(4_307_995).saturating_mul(m.into())) + // Standard Error: 895_060 + .saturating_add(Weight::from_ref_time(4_273_975).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(m.into()))) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(p.into()))) + .saturating_add(T::DbWeight::get().writes(2)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(m.into()))) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(p.into()))) + } + // Storage: TechnicalCommittee Members (r:1 w:0) + /// The range of component `b` is `[2, 1024]`. + /// The range of component `m` is `[1, 100]`. + /// The range of component `b` is `[2, 1024]`. + /// The range of component `m` is `[1, 100]`. + fn execute(_b: u32, m: u32, ) -> Weight { + // Minimum execution time: 18_470 nanoseconds. + Weight::from_ref_time(19_245_456) + // Standard Error: 9_898 + .saturating_add(Weight::from_ref_time(15_368).saturating_mul(m.into())) + .saturating_add(T::DbWeight::get().reads(1)) + } + // Storage: TechnicalCommittee Members (r:1 w:0) + // Storage: TechnicalCommittee ProposalOf (r:1 w:0) + /// The range of component `b` is `[2, 1024]`. + /// The range of component `m` is `[1, 100]`. + /// The range of component `b` is `[2, 1024]`. + /// The range of component `m` is `[1, 100]`. + fn propose_execute(b: u32, _m: u32, ) -> Weight { + // Minimum execution time: 21_278 nanoseconds. + Weight::from_ref_time(22_250_858) + // Standard Error: 2_161 + .saturating_add(Weight::from_ref_time(1_654).saturating_mul(b.into())) + .saturating_add(T::DbWeight::get().reads(2)) + } + // Storage: TechnicalCommittee Members (r:1 w:0) + // Storage: TechnicalCommittee ProposalOf (r:1 w:1) + // Storage: TechnicalCommittee Proposals (r:1 w:1) + // Storage: TechnicalCommittee ProposalCount (r:1 w:1) + // Storage: TechnicalCommittee Voting (r:0 w:1) + /// The range of component `b` is `[2, 1024]`. + /// The range of component `m` is `[2, 100]`. + /// The range of component `p` is `[1, 100]`. + /// The range of component `b` is `[2, 1024]`. + /// The range of component `m` is `[2, 100]`. + /// The range of component `p` is `[1, 100]`. + fn propose_proposed(_b: u32, m: u32, p: u32, ) -> Weight { + // Minimum execution time: 26_624 nanoseconds. + Weight::from_ref_time(32_505_921) + // Standard Error: 50_356 + .saturating_add(Weight::from_ref_time(46_724).saturating_mul(m.into())) + // Standard Error: 49_848 + .saturating_add(Weight::from_ref_time(138_267).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(4)) + } + // Storage: TechnicalCommittee Members (r:1 w:0) + // Storage: TechnicalCommittee Voting (r:1 w:1) + /// The range of component `m` is `[5, 100]`. + /// The range of component `m` is `[5, 100]`. + fn vote(_m: u32, ) -> Weight { + // Minimum execution time: 32_143 nanoseconds. + Weight::from_ref_time(38_586_052) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: TechnicalCommittee Voting (r:1 w:1) + // Storage: TechnicalCommittee Members (r:1 w:0) + // Storage: TechnicalCommittee Proposals (r:1 w:1) + // Storage: TechnicalCommittee ProposalOf (r:0 w:1) + /// The range of component `m` is `[4, 100]`. + /// The range of component `p` is `[1, 100]`. + /// The range of component `m` is `[4, 100]`. + /// The range of component `p` is `[1, 100]`. + fn close_early_disapproved(m: u32, p: u32, ) -> Weight { + // Minimum execution time: 27_661 nanoseconds. + Weight::from_ref_time(26_414_753) + // Standard Error: 6_439 + .saturating_add(Weight::from_ref_time(14_572).saturating_mul(m.into())) + // Standard Error: 6_244 + .saturating_add(Weight::from_ref_time(203_454).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: TechnicalCommittee Voting (r:1 w:1) + // Storage: TechnicalCommittee Members (r:1 w:0) + // Storage: TechnicalCommittee ProposalOf (r:1 w:1) + // Storage: TechnicalCommittee Proposals (r:1 w:1) + /// The range of component `b` is `[2, 1024]`. + /// The range of component `m` is `[4, 100]`. + /// The range of component `p` is `[1, 100]`. + /// The range of component `b` is `[2, 1024]`. + /// The range of component `m` is `[4, 100]`. + /// The range of component `p` is `[1, 100]`. + fn close_early_approved(b: u32, _m: u32, p: u32, ) -> Weight { + // Minimum execution time: 41_390 nanoseconds. + Weight::from_ref_time(40_470_154) + // Standard Error: 4_809 + .saturating_add(Weight::from_ref_time(1_781).saturating_mul(b.into())) + // Standard Error: 49_650 + .saturating_add(Weight::from_ref_time(225_335).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: TechnicalCommittee Voting (r:1 w:1) + // Storage: TechnicalCommittee Members (r:1 w:0) + // Storage: TechnicalCommittee Prime (r:1 w:0) + // Storage: TechnicalCommittee Proposals (r:1 w:1) + // Storage: TechnicalCommittee ProposalOf (r:0 w:1) + /// The range of component `m` is `[4, 100]`. + /// The range of component `p` is `[1, 100]`. + /// The range of component `m` is `[4, 100]`. + /// The range of component `p` is `[1, 100]`. + fn close_disapproved(m: u32, p: u32, ) -> Weight { + // Minimum execution time: 31_571 nanoseconds. + Weight::from_ref_time(31_010_232) + // Standard Error: 4_721 + .saturating_add(Weight::from_ref_time(5_286).saturating_mul(m.into())) + // Standard Error: 4_578 + .saturating_add(Weight::from_ref_time(178_121).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: TechnicalCommittee Voting (r:1 w:1) + // Storage: TechnicalCommittee Members (r:1 w:0) + // Storage: TechnicalCommittee Prime (r:1 w:0) + // Storage: TechnicalCommittee ProposalOf (r:1 w:1) + // Storage: TechnicalCommittee Proposals (r:1 w:1) + /// The range of component `b` is `[2, 1024]`. + /// The range of component `m` is `[4, 100]`. + /// The range of component `p` is `[1, 100]`. + /// The range of component `b` is `[2, 1024]`. + /// The range of component `m` is `[4, 100]`. + /// The range of component `p` is `[1, 100]`. + fn close_approved(b: u32, m: u32, p: u32, ) -> Weight { + // Minimum execution time: 40_552 nanoseconds. + Weight::from_ref_time(33_111_820) + // Standard Error: 2_568 + .saturating_add(Weight::from_ref_time(3_905).saturating_mul(b.into())) + // Standard Error: 27_340 + .saturating_add(Weight::from_ref_time(34_500).saturating_mul(m.into())) + // Standard Error: 26_512 + .saturating_add(Weight::from_ref_time(261_368).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: TechnicalCommittee Proposals (r:1 w:1) + // Storage: TechnicalCommittee Voting (r:0 w:1) + // Storage: TechnicalCommittee ProposalOf (r:0 w:1) + /// The range of component `p` is `[1, 100]`. + /// The range of component `p` is `[1, 100]`. + fn disapprove_proposal(p: u32, ) -> Weight { + // Minimum execution time: 18_178 nanoseconds. + Weight::from_ref_time(18_225_823) + // Standard Error: 5_019 + .saturating_add(Weight::from_ref_time(189_676).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(3)) + } +} diff --git a/runtime/crab/src/weights/pallet_democracy.rs b/runtime/crab/src/weights/pallet_democracy.rs new file mode 100644 index 000000000..334221ad7 --- /dev/null +++ b/runtime/crab/src/weights/pallet_democracy.rs @@ -0,0 +1,252 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `pallet_democracy` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-02-22, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("crab-local"), DB CACHE: 1024 + +// Executed Command: +// ./target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --steps +// 2 +// --repeat +// 1 +// --chain +// crab-local +// --output +// runtime/crab/src/weights/ +// --extrinsic +// * +// --pallet +// * + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_democracy`. +pub struct WeightInfo(PhantomData); +impl pallet_democracy::WeightInfo for WeightInfo { + // Storage: Democracy PublicPropCount (r:1 w:1) + // Storage: Democracy PublicProps (r:1 w:1) + // Storage: Democracy Blacklist (r:1 w:0) + // Storage: Democracy DepositOf (r:0 w:1) + fn propose() -> Weight { + // Minimum execution time: 64_864 nanoseconds. + Weight::from_ref_time(64_864_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: Democracy DepositOf (r:1 w:1) + fn second() -> Weight { + // Minimum execution time: 40_838 nanoseconds. + Weight::from_ref_time(40_838_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Democracy ReferendumInfoOf (r:1 w:1) + // Storage: Democracy VotingOf (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + fn vote_new() -> Weight { + // Minimum execution time: 58_975 nanoseconds. + Weight::from_ref_time(58_975_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: Democracy ReferendumInfoOf (r:1 w:1) + // Storage: Democracy VotingOf (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + fn vote_existing() -> Weight { + // Minimum execution time: 56_447 nanoseconds. + Weight::from_ref_time(56_447_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: Democracy ReferendumInfoOf (r:1 w:1) + // Storage: Democracy Cancellations (r:1 w:1) + fn emergency_cancel() -> Weight { + // Minimum execution time: 33_531 nanoseconds. + Weight::from_ref_time(33_531_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Democracy PublicProps (r:1 w:1) + // Storage: Democracy DepositOf (r:1 w:1) + // Storage: System Account (r:2 w:2) + // Storage: Democracy NextExternal (r:1 w:1) + // Storage: Democracy ReferendumInfoOf (r:1 w:1) + // Storage: Democracy Blacklist (r:0 w:1) + fn blacklist() -> Weight { + // Minimum execution time: 86_788 nanoseconds. + Weight::from_ref_time(86_788_000) + .saturating_add(T::DbWeight::get().reads(6)) + .saturating_add(T::DbWeight::get().writes(7)) + } + // Storage: Democracy NextExternal (r:1 w:1) + // Storage: Democracy Blacklist (r:1 w:0) + fn external_propose() -> Weight { + // Minimum execution time: 30_673 nanoseconds. + Weight::from_ref_time(30_673_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Democracy NextExternal (r:0 w:1) + fn external_propose_majority() -> Weight { + // Minimum execution time: 15_285 nanoseconds. + Weight::from_ref_time(15_285_000) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Democracy NextExternal (r:0 w:1) + fn external_propose_default() -> Weight { + // Minimum execution time: 15_976 nanoseconds. + Weight::from_ref_time(15_976_000) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Democracy NextExternal (r:1 w:1) + // Storage: Democracy ReferendumCount (r:1 w:1) + // Storage: Democracy ReferendumInfoOf (r:0 w:1) + fn fast_track() -> Weight { + // Minimum execution time: 27_070 nanoseconds. + Weight::from_ref_time(27_070_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: Democracy NextExternal (r:1 w:1) + // Storage: Democracy Blacklist (r:1 w:1) + fn veto_external() -> Weight { + // Minimum execution time: 29_230 nanoseconds. + Weight::from_ref_time(29_230_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Democracy PublicProps (r:1 w:1) + // Storage: Democracy DepositOf (r:1 w:1) + // Storage: System Account (r:2 w:2) + fn cancel_proposal() -> Weight { + // Minimum execution time: 117_916 nanoseconds. + Weight::from_ref_time(117_916_000) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(4)) + } + // Storage: Democracy ReferendumInfoOf (r:0 w:1) + fn cancel_referendum() -> Weight { + // Minimum execution time: 29_400 nanoseconds. + Weight::from_ref_time(29_400_000) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Democracy LowestUnbaked (r:1 w:1) + // Storage: Democracy ReferendumCount (r:1 w:0) + // Storage: Democracy ReferendumInfoOf (r:99 w:0) + /// The range of component `r` is `[0, 99]`. + fn on_initialize_base(_r: u32, ) -> Weight { + // Minimum execution time: 14_917 nanoseconds. + Weight::from_ref_time(205_580_000) + .saturating_add(T::DbWeight::get().reads(101)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Democracy LowestUnbaked (r:1 w:1) + // Storage: Democracy ReferendumCount (r:1 w:0) + // Storage: Democracy LastTabledWasExternal (r:1 w:0) + // Storage: Democracy NextExternal (r:1 w:0) + // Storage: Democracy PublicProps (r:1 w:0) + // Storage: Democracy ReferendumInfoOf (r:99 w:0) + /// The range of component `r` is `[0, 99]`. + fn on_initialize_base_with_launch_period(_r: u32, ) -> Weight { + // Minimum execution time: 18_467 nanoseconds. + Weight::from_ref_time(213_612_000) + .saturating_add(T::DbWeight::get().reads(104)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Democracy VotingOf (r:3 w:3) + // Storage: Balances Locks (r:1 w:1) + // Storage: Democracy ReferendumInfoOf (r:99 w:99) + /// The range of component `r` is `[0, 99]`. + fn delegate(_r: u32, ) -> Weight { + // Minimum execution time: 41_513 nanoseconds. + Weight::from_ref_time(364_769_000) + .saturating_add(T::DbWeight::get().reads(103)) + .saturating_add(T::DbWeight::get().writes(103)) + } + // Storage: Democracy VotingOf (r:2 w:2) + // Storage: Democracy ReferendumInfoOf (r:99 w:99) + /// The range of component `r` is `[0, 99]`. + fn undelegate(_r: u32, ) -> Weight { + // Minimum execution time: 27_216 nanoseconds. + Weight::from_ref_time(336_278_000) + .saturating_add(T::DbWeight::get().reads(101)) + .saturating_add(T::DbWeight::get().writes(101)) + } + // Storage: Democracy PublicProps (r:0 w:1) + fn clear_public_proposals() -> Weight { + // Minimum execution time: 23_174 nanoseconds. + Weight::from_ref_time(23_174_000) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Democracy VotingOf (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + // Storage: System Account (r:1 w:1) + /// The range of component `r` is `[0, 99]`. + fn unlock_remove(_r: u32, ) -> Weight { + // Minimum execution time: 45_806 nanoseconds. + Weight::from_ref_time(59_735_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: Democracy VotingOf (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + // Storage: System Account (r:1 w:1) + /// The range of component `r` is `[0, 99]`. + fn unlock_set(_r: u32, ) -> Weight { + // Minimum execution time: 30_887 nanoseconds. + Weight::from_ref_time(109_374_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: Democracy ReferendumInfoOf (r:1 w:1) + // Storage: Democracy VotingOf (r:1 w:1) + /// The range of component `r` is `[1, 100]`. + fn remove_vote(_r: u32, ) -> Weight { + // Minimum execution time: 17_015 nanoseconds. + Weight::from_ref_time(29_347_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Democracy ReferendumInfoOf (r:1 w:1) + // Storage: Democracy VotingOf (r:1 w:1) + /// The range of component `r` is `[1, 100]`. + fn remove_other_vote(_r: u32, ) -> Weight { + // Minimum execution time: 17_773 nanoseconds. + Weight::from_ref_time(29_946_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } +} diff --git a/runtime/crab/src/weights/pallet_elections_phragmen.rs b/runtime/crab/src/weights/pallet_elections_phragmen.rs new file mode 100644 index 000000000..7e70b4fc6 --- /dev/null +++ b/runtime/crab/src/weights/pallet_elections_phragmen.rs @@ -0,0 +1,202 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `pallet_elections_phragmen` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-02-22, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("crab-local"), DB CACHE: 1024 + +// Executed Command: +// ./target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --steps +// 2 +// --repeat +// 1 +// --chain +// crab-local +// --output +// runtime/crab/src/weights/ +// --extrinsic +// * +// --pallet +// * + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_elections_phragmen`. +pub struct WeightInfo(PhantomData); +impl pallet_elections_phragmen::WeightInfo for WeightInfo { + // Storage: PhragmenElection Candidates (r:1 w:0) + // Storage: PhragmenElection Members (r:1 w:0) + // Storage: PhragmenElection RunnersUp (r:1 w:0) + // Storage: PhragmenElection Voting (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + /// The range of component `v` is `[1, 16]`. + fn vote_equal(_v: u32, ) -> Weight { + // Minimum execution time: 36_676 nanoseconds. + Weight::from_ref_time(45_403_000) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: PhragmenElection Candidates (r:1 w:0) + // Storage: PhragmenElection Members (r:1 w:0) + // Storage: PhragmenElection RunnersUp (r:1 w:0) + // Storage: PhragmenElection Voting (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + /// The range of component `v` is `[2, 16]`. + fn vote_more(_v: u32, ) -> Weight { + // Minimum execution time: 48_553 nanoseconds. + Weight::from_ref_time(63_818_000) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: PhragmenElection Candidates (r:1 w:0) + // Storage: PhragmenElection Members (r:1 w:0) + // Storage: PhragmenElection RunnersUp (r:1 w:0) + // Storage: PhragmenElection Voting (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + /// The range of component `v` is `[2, 16]`. + fn vote_less(_v: u32, ) -> Weight { + // Minimum execution time: 43_963 nanoseconds. + Weight::from_ref_time(45_070_000) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: PhragmenElection Voting (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + fn remove_voter() -> Weight { + // Minimum execution time: 39_538 nanoseconds. + Weight::from_ref_time(39_538_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: PhragmenElection Candidates (r:1 w:1) + // Storage: PhragmenElection Members (r:1 w:0) + // Storage: PhragmenElection RunnersUp (r:1 w:0) + /// The range of component `c` is `[1, 30]`. + fn submit_candidacy(_c: u32, ) -> Weight { + // Minimum execution time: 38_181 nanoseconds. + Weight::from_ref_time(41_014_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: PhragmenElection Candidates (r:1 w:1) + /// The range of component `c` is `[1, 30]`. + fn renounce_candidacy_candidate(_c: u32, ) -> Weight { + // Minimum execution time: 33_937 nanoseconds. + Weight::from_ref_time(36_578_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: PhragmenElection Members (r:1 w:1) + // Storage: PhragmenElection RunnersUp (r:1 w:1) + // Storage: Council Prime (r:1 w:1) + // Storage: Council Proposals (r:1 w:0) + // Storage: Council Members (r:0 w:1) + fn renounce_candidacy_members() -> Weight { + // Minimum execution time: 47_323 nanoseconds. + Weight::from_ref_time(47_323_000) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(4)) + } + // Storage: PhragmenElection RunnersUp (r:1 w:1) + fn renounce_candidacy_runners_up() -> Weight { + // Minimum execution time: 50_241 nanoseconds. + Weight::from_ref_time(50_241_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Benchmark Override (r:0 w:0) + fn remove_member_without_replacement() -> Weight { + // Minimum execution time: 500_000_000 nanoseconds. + Weight::from_ref_time(500_000_000_000) + } + // Storage: PhragmenElection Members (r:1 w:1) + // Storage: System Account (r:2 w:2) + // Storage: PhragmenElection RunnersUp (r:1 w:1) + // Storage: Council Prime (r:1 w:1) + // Storage: Council Proposals (r:1 w:0) + // Storage: Council Members (r:0 w:1) + fn remove_member_with_replacement() -> Weight { + // Minimum execution time: 61_447 nanoseconds. + Weight::from_ref_time(61_447_000) + .saturating_add(T::DbWeight::get().reads(6)) + .saturating_add(T::DbWeight::get().writes(6)) + } + // Storage: PhragmenElection Voting (r:151 w:150) + // Storage: PhragmenElection Members (r:1 w:0) + // Storage: PhragmenElection RunnersUp (r:1 w:0) + // Storage: PhragmenElection Candidates (r:1 w:0) + // Storage: Balances Locks (r:150 w:150) + // Storage: System Account (r:150 w:150) + /// The range of component `v` is `[150, 300]`. + /// The range of component `d` is `[0, 150]`. + fn clean_defunct_voters(v: u32, d: u32, ) -> Weight { + // Minimum execution time: 7_160_781 nanoseconds. + Weight::from_ref_time(147_092_000) + // Standard Error: 1_168_014 + .saturating_add(Weight::from_ref_time(46_354_906).saturating_mul(v.into())) + // Standard Error: 1_168_014 + .saturating_add(Weight::from_ref_time(403_019).saturating_mul(d.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().reads((3_u64).saturating_mul(v.into()))) + .saturating_add(T::DbWeight::get().writes((3_u64).saturating_mul(v.into()))) + } + // Storage: PhragmenElection Candidates (r:1 w:1) + // Storage: PhragmenElection Members (r:1 w:1) + // Storage: PhragmenElection RunnersUp (r:1 w:1) + // Storage: PhragmenElection Voting (r:301 w:0) + // Storage: Council Proposals (r:1 w:0) + // Storage: PhragmenElection ElectionRounds (r:1 w:1) + // Storage: Council Members (r:0 w:1) + // Storage: Council Prime (r:0 w:1) + // Storage: System Account (r:17 w:17) + /// The range of component `c` is `[1, 30]`. + /// The range of component `v` is `[1, 300]`. + /// The range of component `e` is `[300, 4800]`. + fn election_phragmen(c: u32, v: u32, e: u32, ) -> Weight { + // Minimum execution time: 558_465 nanoseconds. + Weight::from_ref_time(558_465_000) + // Standard Error: 66_492_463 + .saturating_add(Weight::from_ref_time(38_685_669).saturating_mul(c.into())) + // Standard Error: 6_554_834 + .saturating_add(Weight::from_ref_time(7_657_600).saturating_mul(v.into())) + // Standard Error: 420_985 + .saturating_add(Weight::from_ref_time(143_850).saturating_mul(e.into())) + .saturating_add(T::DbWeight::get().reads(35)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(c.into()))) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(v.into()))) + .saturating_add(T::DbWeight::get().writes(5)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(c.into()))) + } +} diff --git a/runtime/crab/src/weights/pallet_fee_market.rs b/runtime/crab/src/weights/pallet_fee_market.rs new file mode 100644 index 000000000..20ebd48ef --- /dev/null +++ b/runtime/crab/src/weights/pallet_fee_market.rs @@ -0,0 +1,139 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `pallet_fee_market` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-02-22, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("crab-local"), DB CACHE: 1024 + +// Executed Command: +// ./target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --steps +// 2 +// --repeat +// 1 +// --chain +// crab-local +// --output +// runtime/crab/src/weights/ +// --extrinsic +// * +// --pallet +// * + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_fee_market`. +pub struct WeightInfo(PhantomData); +impl pallet_fee_market::WeightInfo for WeightInfo { + // Storage: DarwiniaFeeMarket Relayers (r:1 w:1) + // Storage: System Account (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + // Storage: DarwiniaFeeMarket RelayersMap (r:10 w:1) + // Storage: DarwiniaFeeMarket Orders (r:1 w:0) + // Storage: DarwiniaFeeMarket AssignedRelayersNumber (r:1 w:0) + // Storage: DarwiniaFeeMarket AssignedRelayers (r:0 w:1) + fn enroll_and_lock_collateral() -> Weight { + // Minimum execution time: 101_642 nanoseconds. + Weight::from_ref_time(101_642_000) + .saturating_add(T::DbWeight::get().reads(15)) + .saturating_add(T::DbWeight::get().writes(5)) + } + // Storage: DarwiniaFeeMarket Relayers (r:1 w:0) + // Storage: System Account (r:1 w:1) + // Storage: DarwiniaFeeMarket RelayersMap (r:10 w:1) + // Storage: Balances Locks (r:1 w:1) + // Storage: DarwiniaFeeMarket Orders (r:1 w:0) + // Storage: DarwiniaFeeMarket AssignedRelayersNumber (r:1 w:0) + // Storage: DarwiniaFeeMarket AssignedRelayers (r:0 w:1) + fn increase_locked_collateral() -> Weight { + // Minimum execution time: 99_179 nanoseconds. + Weight::from_ref_time(99_179_000) + .saturating_add(T::DbWeight::get().reads(15)) + .saturating_add(T::DbWeight::get().writes(4)) + } + // Storage: DarwiniaFeeMarket Relayers (r:1 w:0) + // Storage: System Account (r:1 w:1) + // Storage: DarwiniaFeeMarket RelayersMap (r:10 w:1) + // Storage: DarwiniaFeeMarket Orders (r:1 w:0) + // Storage: Balances Locks (r:1 w:1) + // Storage: DarwiniaFeeMarket AssignedRelayersNumber (r:1 w:0) + // Storage: DarwiniaFeeMarket AssignedRelayers (r:0 w:1) + fn decrease_locked_collateral() -> Weight { + // Minimum execution time: 111_459 nanoseconds. + Weight::from_ref_time(111_459_000) + .saturating_add(T::DbWeight::get().reads(15)) + .saturating_add(T::DbWeight::get().writes(4)) + } + // Storage: DarwiniaFeeMarket Relayers (r:1 w:0) + // Storage: DarwiniaFeeMarket RelayersMap (r:10 w:1) + // Storage: DarwiniaFeeMarket Orders (r:1 w:0) + // Storage: DarwiniaFeeMarket AssignedRelayersNumber (r:1 w:0) + // Storage: DarwiniaFeeMarket AssignedRelayers (r:0 w:1) + fn update_relay_fee() -> Weight { + // Minimum execution time: 95_315 nanoseconds. + Weight::from_ref_time(95_315_000) + .saturating_add(T::DbWeight::get().reads(13)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: DarwiniaFeeMarket Relayers (r:1 w:1) + // Storage: DarwiniaFeeMarket Orders (r:1 w:0) + // Storage: Balances Locks (r:1 w:1) + // Storage: System Account (r:1 w:1) + // Storage: DarwiniaFeeMarket AssignedRelayers (r:1 w:1) + // Storage: DarwiniaFeeMarket RelayersMap (r:9 w:1) + // Storage: DarwiniaFeeMarket AssignedRelayersNumber (r:1 w:0) + fn cancel_enrollment() -> Weight { + // Minimum execution time: 163_042 nanoseconds. + Weight::from_ref_time(163_042_000) + .saturating_add(T::DbWeight::get().reads(15)) + .saturating_add(T::DbWeight::get().writes(5)) + } + // Storage: DarwiniaFeeMarket CollateralSlashProtect (r:0 w:1) + fn set_slash_protect() -> Weight { + // Minimum execution time: 31_462 nanoseconds. + Weight::from_ref_time(31_462_000) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: DarwiniaFeeMarket Relayers (r:1 w:0) + // Storage: DarwiniaFeeMarket RelayersMap (r:10 w:0) + // Storage: DarwiniaFeeMarket Orders (r:1 w:0) + // Storage: DarwiniaFeeMarket AssignedRelayers (r:0 w:1) + // Storage: DarwiniaFeeMarket AssignedRelayersNumber (r:0 w:1) + fn set_assigned_relayers_number() -> Weight { + // Minimum execution time: 77_980 nanoseconds. + Weight::from_ref_time(77_980_000) + .saturating_add(T::DbWeight::get().reads(12)) + .saturating_add(T::DbWeight::get().writes(2)) + } +} diff --git a/runtime/crab/src/weights/pallet_identity.rs b/runtime/crab/src/weights/pallet_identity.rs new file mode 100644 index 000000000..8768562c2 --- /dev/null +++ b/runtime/crab/src/weights/pallet_identity.rs @@ -0,0 +1,242 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `pallet_identity` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-02-22, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("crab-local"), DB CACHE: 1024 + +// Executed Command: +// ./target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --steps +// 2 +// --repeat +// 1 +// --chain +// crab-local +// --output +// runtime/crab/src/weights/ +// --extrinsic +// * +// --pallet +// * + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_identity`. +pub struct WeightInfo(PhantomData); +impl pallet_identity::WeightInfo for WeightInfo { + // Storage: Identity Registrars (r:1 w:1) + /// The range of component `r` is `[1, 19]`. + fn add_registrar(_r: u32, ) -> Weight { + // Minimum execution time: 18_880 nanoseconds. + Weight::from_ref_time(21_680_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Identity IdentityOf (r:1 w:1) + /// The range of component `r` is `[1, 20]`. + /// The range of component `x` is `[0, 100]`. + fn set_identity(r: u32, x: u32, ) -> Weight { + // Minimum execution time: 37_686 nanoseconds. + Weight::from_ref_time(28_856_526) + // Standard Error: 572_214 + .saturating_add(Weight::from_ref_time(441_473).saturating_mul(r.into())) + // Standard Error: 108_720 + .saturating_add(Weight::from_ref_time(448_790).saturating_mul(x.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Identity IdentityOf (r:1 w:0) + // Storage: Identity SubsOf (r:1 w:1) + // Storage: Identity SuperOf (r:100 w:100) + /// The range of component `s` is `[0, 100]`. + fn set_subs_new(_s: u32, ) -> Weight { + // Minimum execution time: 13_371 nanoseconds. + Weight::from_ref_time(260_668_000) + .saturating_add(T::DbWeight::get().reads(102)) + .saturating_add(T::DbWeight::get().writes(101)) + } + // Storage: Identity IdentityOf (r:1 w:0) + // Storage: Identity SubsOf (r:1 w:1) + // Storage: Identity SuperOf (r:0 w:100) + /// The range of component `p` is `[0, 100]`. + fn set_subs_old(_p: u32, ) -> Weight { + // Minimum execution time: 11_503 nanoseconds. + Weight::from_ref_time(130_022_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(101)) + } + // Storage: Identity SubsOf (r:1 w:1) + // Storage: Identity IdentityOf (r:1 w:1) + // Storage: Identity SuperOf (r:0 w:100) + /// The range of component `r` is `[1, 20]`. + /// The range of component `s` is `[0, 100]`. + /// The range of component `x` is `[0, 100]`. + fn clear_identity(r: u32, s: u32, x: u32, ) -> Weight { + // Minimum execution time: 65_603 nanoseconds. + Weight::from_ref_time(11_389_421) + // Standard Error: 1_335_921 + .saturating_add(Weight::from_ref_time(588_245).saturating_mul(r.into())) + // Standard Error: 253_825 + .saturating_add(Weight::from_ref_time(1_111_116).saturating_mul(s.into())) + // Standard Error: 253_825 + .saturating_add(Weight::from_ref_time(424_486).saturating_mul(x.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(s.into()))) + } + // Storage: Identity Registrars (r:1 w:0) + // Storage: Identity IdentityOf (r:1 w:1) + /// The range of component `r` is `[1, 20]`. + /// The range of component `x` is `[0, 100]`. + fn request_judgement(r: u32, x: u32, ) -> Weight { + // Minimum execution time: 46_813 nanoseconds. + Weight::from_ref_time(42_952_473) + // Standard Error: 195_311 + .saturating_add(Weight::from_ref_time(193_026).saturating_mul(r.into())) + // Standard Error: 37_109 + .saturating_add(Weight::from_ref_time(298_055).saturating_mul(x.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Identity IdentityOf (r:1 w:1) + /// The range of component `r` is `[1, 20]`. + /// The range of component `x` is `[0, 100]`. + fn cancel_request(r: u32, x: u32, ) -> Weight { + // Minimum execution time: 36_421 nanoseconds. + Weight::from_ref_time(31_728_894) + // Standard Error: 300_055 + .saturating_add(Weight::from_ref_time(234_605).saturating_mul(r.into())) + // Standard Error: 57_010 + .saturating_add(Weight::from_ref_time(372_845).saturating_mul(x.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Identity Registrars (r:1 w:1) + /// The range of component `r` is `[1, 19]`. + fn set_fee(_r: u32, ) -> Weight { + // Minimum execution time: 12_703 nanoseconds. + Weight::from_ref_time(32_380_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Identity Registrars (r:1 w:1) + /// The range of component `r` is `[1, 19]`. + fn set_account_id(_r: u32, ) -> Weight { + // Minimum execution time: 10_861 nanoseconds. + Weight::from_ref_time(14_800_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Identity Registrars (r:1 w:1) + /// The range of component `r` is `[1, 19]`. + fn set_fields(_r: u32, ) -> Weight { + // Minimum execution time: 10_811 nanoseconds. + Weight::from_ref_time(13_370_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Identity Registrars (r:1 w:0) + // Storage: Identity IdentityOf (r:1 w:1) + /// The range of component `r` is `[1, 19]`. + /// The range of component `x` is `[0, 100]`. + fn provide_judgement(r: u32, x: u32, ) -> Weight { + // Minimum execution time: 29_910 nanoseconds. + Weight::from_ref_time(18_877_861) + // Standard Error: 926_983 + .saturating_add(Weight::from_ref_time(580_638).saturating_mul(r.into())) + // Standard Error: 166_857 + .saturating_add(Weight::from_ref_time(645_595).saturating_mul(x.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Identity SubsOf (r:1 w:1) + // Storage: Identity IdentityOf (r:1 w:1) + // Storage: System Account (r:2 w:2) + // Storage: Identity SuperOf (r:0 w:100) + /// The range of component `r` is `[1, 20]`. + /// The range of component `s` is `[0, 100]`. + /// The range of component `x` is `[0, 100]`. + fn kill_identity(r: u32, s: u32, x: u32, ) -> Weight { + // Minimum execution time: 79_050 nanoseconds. + Weight::from_ref_time(37_040_947) + // Standard Error: 862_865 + .saturating_add(Weight::from_ref_time(721_385).saturating_mul(r.into())) + // Standard Error: 163_944 + .saturating_add(Weight::from_ref_time(1_041_853).saturating_mul(s.into())) + // Standard Error: 163_944 + .saturating_add(Weight::from_ref_time(275_813).saturating_mul(x.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(3)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(s.into()))) + } + // Storage: Identity IdentityOf (r:1 w:0) + // Storage: Identity SuperOf (r:1 w:1) + // Storage: Identity SubsOf (r:1 w:1) + /// The range of component `s` is `[0, 99]`. + fn add_sub(_s: u32, ) -> Weight { + // Minimum execution time: 36_328 nanoseconds. + Weight::from_ref_time(44_944_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Identity IdentityOf (r:1 w:0) + // Storage: Identity SuperOf (r:1 w:1) + /// The range of component `s` is `[1, 100]`. + fn rename_sub(_s: u32, ) -> Weight { + // Minimum execution time: 15_554 nanoseconds. + Weight::from_ref_time(25_462_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Identity IdentityOf (r:1 w:0) + // Storage: Identity SuperOf (r:1 w:1) + // Storage: Identity SubsOf (r:1 w:1) + /// The range of component `s` is `[1, 100]`. + fn remove_sub(_s: u32, ) -> Weight { + // Minimum execution time: 39_883 nanoseconds. + Weight::from_ref_time(52_427_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Identity SuperOf (r:1 w:1) + // Storage: Identity SubsOf (r:1 w:1) + /// The range of component `s` is `[0, 99]`. + fn quit_sub(_s: u32, ) -> Weight { + // Minimum execution time: 27_590 nanoseconds. + Weight::from_ref_time(33_619_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } +} diff --git a/runtime/crab/src/weights/pallet_membership.rs b/runtime/crab/src/weights/pallet_membership.rs new file mode 100644 index 000000000..2aa6948fa --- /dev/null +++ b/runtime/crab/src/weights/pallet_membership.rs @@ -0,0 +1,136 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `pallet_membership` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-02-22, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("crab-local"), DB CACHE: 1024 + +// Executed Command: +// ./target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --steps +// 2 +// --repeat +// 1 +// --chain +// crab-local +// --output +// runtime/crab/src/weights/ +// --extrinsic +// * +// --pallet +// * + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_membership`. +pub struct WeightInfo(PhantomData); +impl pallet_membership::WeightInfo for WeightInfo { + // Storage: TechnicalMembership Members (r:1 w:1) + // Storage: TechnicalCommittee Proposals (r:1 w:0) + // Storage: TechnicalCommittee Members (r:0 w:1) + // Storage: TechnicalCommittee Prime (r:0 w:1) + /// The range of component `m` is `[1, 99]`. + fn add_member(_m: u32, ) -> Weight { + // Minimum execution time: 22_060 nanoseconds. + Weight::from_ref_time(25_559_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: TechnicalMembership Members (r:1 w:1) + // Storage: TechnicalCommittee Proposals (r:1 w:0) + // Storage: TechnicalMembership Prime (r:1 w:0) + // Storage: TechnicalCommittee Members (r:0 w:1) + // Storage: TechnicalCommittee Prime (r:0 w:1) + /// The range of component `m` is `[2, 100]`. + fn remove_member(_m: u32, ) -> Weight { + // Minimum execution time: 25_838 nanoseconds. + Weight::from_ref_time(68_517_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: TechnicalMembership Members (r:1 w:1) + // Storage: TechnicalCommittee Proposals (r:1 w:0) + // Storage: TechnicalMembership Prime (r:1 w:0) + // Storage: TechnicalCommittee Members (r:0 w:1) + // Storage: TechnicalCommittee Prime (r:0 w:1) + /// The range of component `m` is `[2, 100]`. + fn swap_member(_m: u32, ) -> Weight { + // Minimum execution time: 24_936 nanoseconds. + Weight::from_ref_time(26_462_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: TechnicalMembership Members (r:1 w:1) + // Storage: TechnicalCommittee Proposals (r:1 w:0) + // Storage: TechnicalMembership Prime (r:1 w:0) + // Storage: TechnicalCommittee Members (r:0 w:1) + // Storage: TechnicalCommittee Prime (r:0 w:1) + /// The range of component `m` is `[1, 100]`. + fn reset_member(_m: u32, ) -> Weight { + // Minimum execution time: 25_721 nanoseconds. + Weight::from_ref_time(36_913_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: TechnicalMembership Members (r:1 w:1) + // Storage: TechnicalCommittee Proposals (r:1 w:0) + // Storage: TechnicalMembership Prime (r:1 w:1) + // Storage: TechnicalCommittee Members (r:0 w:1) + // Storage: TechnicalCommittee Prime (r:0 w:1) + /// The range of component `m` is `[1, 100]`. + fn change_key(_m: u32, ) -> Weight { + // Minimum execution time: 25_687 nanoseconds. + Weight::from_ref_time(30_817_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(4)) + } + // Storage: TechnicalMembership Members (r:1 w:0) + // Storage: TechnicalMembership Prime (r:0 w:1) + // Storage: TechnicalCommittee Prime (r:0 w:1) + /// The range of component `m` is `[1, 100]`. + fn set_prime(_m: u32, ) -> Weight { + // Minimum execution time: 10_611 nanoseconds. + Weight::from_ref_time(11_740_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: TechnicalMembership Prime (r:0 w:1) + // Storage: TechnicalCommittee Prime (r:0 w:1) + /// The range of component `m` is `[1, 100]`. + fn clear_prime(_m: u32, ) -> Weight { + // Minimum execution time: 12_539 nanoseconds. + Weight::from_ref_time(12_647_000) + .saturating_add(T::DbWeight::get().writes(2)) + } +} diff --git a/runtime/crab/src/weights/pallet_multisig.rs b/runtime/crab/src/weights/pallet_multisig.rs new file mode 100644 index 000000000..150af6e74 --- /dev/null +++ b/runtime/crab/src/weights/pallet_multisig.rs @@ -0,0 +1,128 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `pallet_multisig` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-02-22, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("crab-local"), DB CACHE: 1024 + +// Executed Command: +// ./target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --steps +// 2 +// --repeat +// 1 +// --chain +// crab-local +// --output +// runtime/crab/src/weights/ +// --extrinsic +// * +// --pallet +// * + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_multisig`. +pub struct WeightInfo(PhantomData); +impl pallet_multisig::WeightInfo for WeightInfo { + /// The range of component `z` is `[0, 10000]`. + fn as_multi_threshold_1(_z: u32, ) -> Weight { + // Minimum execution time: 30_147 nanoseconds. + Weight::from_ref_time(40_302_000) + } + // Storage: Multisig Multisigs (r:1 w:1) + // Storage: unknown [0x3a65787472696e7369635f696e646578] (r:1 w:0) + /// The range of component `s` is `[2, 100]`. + /// The range of component `z` is `[0, 10000]`. + fn as_multi_create(_s: u32, z: u32, ) -> Weight { + // Minimum execution time: 67_837 nanoseconds. + Weight::from_ref_time(80_600_775) + // Standard Error: 105 + .saturating_add(Weight::from_ref_time(966).saturating_mul(z.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Multisig Multisigs (r:1 w:1) + /// The range of component `s` is `[3, 100]`. + /// The range of component `z` is `[0, 10000]`. + fn as_multi_approve(s: u32, z: u32, ) -> Weight { + // Minimum execution time: 35_866 nanoseconds. + Weight::from_ref_time(28_035_587) + // Standard Error: 20_918 + .saturating_add(Weight::from_ref_time(78_304).saturating_mul(s.into())) + // Standard Error: 202 + .saturating_add(Weight::from_ref_time(994).saturating_mul(z.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Multisig Multisigs (r:1 w:1) + // Storage: System Account (r:1 w:1) + /// The range of component `s` is `[2, 100]`. + /// The range of component `z` is `[0, 10000]`. + fn as_multi_complete(s: u32, z: u32, ) -> Weight { + // Minimum execution time: 49_688 nanoseconds. + Weight::from_ref_time(45_614_020) + // Standard Error: 7_272 + .saturating_add(Weight::from_ref_time(40_739).saturating_mul(s.into())) + // Standard Error: 71 + .saturating_add(Weight::from_ref_time(1_237).saturating_mul(z.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Multisig Multisigs (r:1 w:1) + // Storage: unknown [0x3a65787472696e7369635f696e646578] (r:1 w:0) + /// The range of component `s` is `[2, 100]`. + fn approve_as_multi_create(_s: u32, ) -> Weight { + // Minimum execution time: 50_716 nanoseconds. + Weight::from_ref_time(73_678_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Multisig Multisigs (r:1 w:1) + /// The range of component `s` is `[2, 100]`. + fn approve_as_multi_approve(_s: u32, ) -> Weight { + // Minimum execution time: 26_779 nanoseconds. + Weight::from_ref_time(36_380_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Multisig Multisigs (r:1 w:1) + /// The range of component `s` is `[2, 100]`. + fn cancel_as_multi(_s: u32, ) -> Weight { + // Minimum execution time: 36_523 nanoseconds. + Weight::from_ref_time(52_074_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } +} diff --git a/runtime/crab/src/weights/pallet_preimage.rs b/runtime/crab/src/weights/pallet_preimage.rs new file mode 100644 index 000000000..28e53be4b --- /dev/null +++ b/runtime/crab/src/weights/pallet_preimage.rs @@ -0,0 +1,152 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `pallet_preimage` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-02-22, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("crab-local"), DB CACHE: 1024 + +// Executed Command: +// ./target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --steps +// 2 +// --repeat +// 1 +// --chain +// crab-local +// --output +// runtime/crab/src/weights/ +// --extrinsic +// * +// --pallet +// * + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_preimage`. +pub struct WeightInfo(PhantomData); +impl pallet_preimage::WeightInfo for WeightInfo { + // Storage: Preimage StatusFor (r:1 w:1) + // Storage: Preimage PreimageFor (r:0 w:1) + /// The range of component `s` is `[0, 4194304]`. + fn note_preimage(_s: u32, ) -> Weight { + // Minimum execution time: 49_134 nanoseconds. + Weight::from_ref_time(7_252_949_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Preimage StatusFor (r:1 w:1) + // Storage: Preimage PreimageFor (r:0 w:1) + /// The range of component `s` is `[0, 4194304]`. + fn note_requested_preimage(_s: u32, ) -> Weight { + // Minimum execution time: 28_454 nanoseconds. + Weight::from_ref_time(6_804_905_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Preimage StatusFor (r:1 w:1) + // Storage: Preimage PreimageFor (r:0 w:1) + /// The range of component `s` is `[0, 4194304]`. + fn note_no_deposit_preimage(_s: u32, ) -> Weight { + // Minimum execution time: 27_614 nanoseconds. + Weight::from_ref_time(7_446_913_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Preimage StatusFor (r:1 w:1) + // Storage: Preimage PreimageFor (r:0 w:1) + fn unnote_preimage() -> Weight { + // Minimum execution time: 213_115 nanoseconds. + Weight::from_ref_time(213_115_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Preimage StatusFor (r:1 w:1) + // Storage: Preimage PreimageFor (r:0 w:1) + fn unnote_no_deposit_preimage() -> Weight { + // Minimum execution time: 204_210 nanoseconds. + Weight::from_ref_time(204_210_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Preimage StatusFor (r:1 w:1) + fn request_preimage() -> Weight { + // Minimum execution time: 188_423 nanoseconds. + Weight::from_ref_time(188_423_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Preimage StatusFor (r:1 w:1) + fn request_no_deposit_preimage() -> Weight { + // Minimum execution time: 237_881 nanoseconds. + Weight::from_ref_time(237_881_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Preimage StatusFor (r:1 w:1) + fn request_unnoted_preimage() -> Weight { + // Minimum execution time: 51_719 nanoseconds. + Weight::from_ref_time(51_719_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Preimage StatusFor (r:1 w:1) + fn request_requested_preimage() -> Weight { + // Minimum execution time: 12_562 nanoseconds. + Weight::from_ref_time(12_562_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Preimage StatusFor (r:1 w:1) + // Storage: Preimage PreimageFor (r:0 w:1) + fn unrequest_preimage() -> Weight { + // Minimum execution time: 252_116 nanoseconds. + Weight::from_ref_time(252_116_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Preimage StatusFor (r:1 w:1) + fn unrequest_unnoted_preimage() -> Weight { + // Minimum execution time: 11_494 nanoseconds. + Weight::from_ref_time(11_494_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Preimage StatusFor (r:1 w:1) + fn unrequest_multi_referenced_preimage() -> Weight { + // Minimum execution time: 10_416 nanoseconds. + Weight::from_ref_time(10_416_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } +} diff --git a/runtime/crab/src/weights/pallet_proxy.rs b/runtime/crab/src/weights/pallet_proxy.rs new file mode 100644 index 000000000..498baf27b --- /dev/null +++ b/runtime/crab/src/weights/pallet_proxy.rs @@ -0,0 +1,163 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `pallet_proxy` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-02-22, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("crab-local"), DB CACHE: 1024 + +// Executed Command: +// ./target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --steps +// 2 +// --repeat +// 1 +// --chain +// crab-local +// --output +// runtime/crab/src/weights/ +// --extrinsic +// * +// --pallet +// * + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_proxy`. +pub struct WeightInfo(PhantomData); +impl pallet_proxy::WeightInfo for WeightInfo { + // Storage: Proxy Proxies (r:1 w:0) + /// The range of component `p` is `[1, 31]`. + fn proxy(_p: u32, ) -> Weight { + // Minimum execution time: 24_188 nanoseconds. + Weight::from_ref_time(27_425_000) + .saturating_add(T::DbWeight::get().reads(1)) + } + // Storage: Proxy Proxies (r:1 w:0) + // Storage: Proxy Announcements (r:1 w:1) + // Storage: System Account (r:1 w:1) + /// The range of component `a` is `[0, 31]`. + /// The range of component `p` is `[1, 31]`. + fn proxy_announced(a: u32, p: u32, ) -> Weight { + // Minimum execution time: 43_621 nanoseconds. + Weight::from_ref_time(34_410_900) + // Standard Error: 147_615 + .saturating_add(Weight::from_ref_time(380_129).saturating_mul(a.into())) + // Standard Error: 152_535 + .saturating_add(Weight::from_ref_time(297_100).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Proxy Announcements (r:1 w:1) + // Storage: System Account (r:1 w:1) + /// The range of component `a` is `[0, 31]`. + /// The range of component `p` is `[1, 31]`. + fn remove_announcement(a: u32, p: u32, ) -> Weight { + // Minimum execution time: 29_849 nanoseconds. + Weight::from_ref_time(25_482_650) + // Standard Error: 84_451 + .saturating_add(Weight::from_ref_time(201_790).saturating_mul(a.into())) + // Standard Error: 87_266 + .saturating_add(Weight::from_ref_time(140_850).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Proxy Announcements (r:1 w:1) + // Storage: System Account (r:1 w:1) + /// The range of component `a` is `[0, 31]`. + /// The range of component `p` is `[1, 31]`. + fn reject_announcement(a: u32, p: u32, ) -> Weight { + // Minimum execution time: 27_830 nanoseconds. + Weight::from_ref_time(19_998_366) + // Standard Error: 426_363 + .saturating_add(Weight::from_ref_time(384_838).saturating_mul(a.into())) + // Standard Error: 440_575 + .saturating_add(Weight::from_ref_time(252_633).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Proxy Proxies (r:1 w:0) + // Storage: Proxy Announcements (r:1 w:1) + // Storage: System Account (r:1 w:1) + /// The range of component `a` is `[0, 31]`. + /// The range of component `p` is `[1, 31]`. + fn announce(a: u32, _p: u32, ) -> Weight { + // Minimum execution time: 36_804 nanoseconds. + Weight::from_ref_time(37_108_316) + // Standard Error: 57_911 + .saturating_add(Weight::from_ref_time(133_822).saturating_mul(a.into())) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Proxy Proxies (r:1 w:1) + /// The range of component `p` is `[1, 31]`. + fn add_proxy(_p: u32, ) -> Weight { + // Minimum execution time: 33_316 nanoseconds. + Weight::from_ref_time(36_321_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Proxy Proxies (r:1 w:1) + /// The range of component `p` is `[1, 31]`. + fn remove_proxy(_p: u32, ) -> Weight { + // Minimum execution time: 32_520 nanoseconds. + Weight::from_ref_time(39_533_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Proxy Proxies (r:1 w:1) + /// The range of component `p` is `[1, 31]`. + fn remove_proxies(_p: u32, ) -> Weight { + // Minimum execution time: 27_670 nanoseconds. + Weight::from_ref_time(27_801_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: unknown [0x3a65787472696e7369635f696e646578] (r:1 w:0) + // Storage: Proxy Proxies (r:1 w:1) + /// The range of component `p` is `[1, 31]`. + fn create_pure(_p: u32, ) -> Weight { + // Minimum execution time: 40_567 nanoseconds. + Weight::from_ref_time(41_098_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Proxy Proxies (r:1 w:1) + /// The range of component `p` is `[0, 30]`. + fn kill_pure(_p: u32, ) -> Weight { + // Minimum execution time: 27_634 nanoseconds. + Weight::from_ref_time(29_201_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } +} diff --git a/runtime/crab/src/weights/pallet_scheduler.rs b/runtime/crab/src/weights/pallet_scheduler.rs new file mode 100644 index 000000000..08ba99649 --- /dev/null +++ b/runtime/crab/src/weights/pallet_scheduler.rs @@ -0,0 +1,140 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `pallet_scheduler` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-02-22, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("crab-local"), DB CACHE: 1024 + +// Executed Command: +// ./target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --steps +// 2 +// --repeat +// 1 +// --chain +// crab-local +// --output +// runtime/crab/src/weights/ +// --extrinsic +// * +// --pallet +// * + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_scheduler`. +pub struct WeightInfo(PhantomData); +impl pallet_scheduler::WeightInfo for WeightInfo { + // Storage: Scheduler IncompleteSince (r:1 w:1) + fn service_agendas_base() -> Weight { + // Minimum execution time: 7_732 nanoseconds. + Weight::from_ref_time(7_732_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Scheduler Agenda (r:1 w:1) + /// The range of component `s` is `[0, 50]`. + fn service_agenda_base(_s: u32, ) -> Weight { + // Minimum execution time: 12_382 nanoseconds. + Weight::from_ref_time(31_777_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + fn service_task_base() -> Weight { + // Minimum execution time: 20_530 nanoseconds. + Weight::from_ref_time(20_530_000) + } + // Storage: Preimage PreimageFor (r:1 w:1) + // Storage: Preimage StatusFor (r:1 w:1) + /// The range of component `s` is `[128, 4194304]`. + fn service_task_fetched(_s: u32, ) -> Weight { + // Minimum execution time: 28_988 nanoseconds. + Weight::from_ref_time(4_254_444_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Scheduler Lookup (r:0 w:1) + fn service_task_named() -> Weight { + // Minimum execution time: 22_951 nanoseconds. + Weight::from_ref_time(22_951_000) + .saturating_add(T::DbWeight::get().writes(1)) + } + fn service_task_periodic() -> Weight { + // Minimum execution time: 18_354 nanoseconds. + Weight::from_ref_time(18_354_000) + } + fn execute_dispatch_signed() -> Weight { + // Minimum execution time: 85_706 nanoseconds. + Weight::from_ref_time(85_706_000) + } + fn execute_dispatch_unsigned() -> Weight { + // Minimum execution time: 17_813 nanoseconds. + Weight::from_ref_time(17_813_000) + } + // Storage: Scheduler Agenda (r:1 w:1) + /// The range of component `s` is `[0, 49]`. + fn schedule(_s: u32, ) -> Weight { + // Minimum execution time: 36_307 nanoseconds. + Weight::from_ref_time(62_179_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Scheduler Agenda (r:1 w:1) + // Storage: Scheduler Lookup (r:0 w:1) + /// The range of component `s` is `[1, 50]`. + fn cancel(_s: u32, ) -> Weight { + // Minimum execution time: 34_672 nanoseconds. + Weight::from_ref_time(68_980_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Scheduler Lookup (r:1 w:1) + // Storage: Scheduler Agenda (r:1 w:1) + /// The range of component `s` is `[0, 49]`. + fn schedule_named(_s: u32, ) -> Weight { + // Minimum execution time: 39_748 nanoseconds. + Weight::from_ref_time(68_172_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Scheduler Lookup (r:1 w:1) + // Storage: Scheduler Agenda (r:1 w:1) + /// The range of component `s` is `[1, 50]`. + fn cancel_named(_s: u32, ) -> Weight { + // Minimum execution time: 56_030 nanoseconds. + Weight::from_ref_time(82_262_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } +} diff --git a/runtime/crab/src/weights/pallet_session.rs b/runtime/crab/src/weights/pallet_session.rs index 25b1d6d3e..4c490597f 100644 --- a/runtime/crab/src/weights/pallet_session.rs +++ b/runtime/crab/src/weights/pallet_session.rs @@ -19,12 +19,12 @@ //! Autogenerated weights for `pallet_session` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2022-11-09, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! HOSTNAME: `inv.cafe`, CPU: `AMD Ryzen 9 5950X 16-Core Processor` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("local"), DB CACHE: 1024 +//! DATE: 2023-02-22, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("crab-local"), DB CACHE: 1024 // Executed Command: -// target/release/darwinia +// ./target/release/darwinia // benchmark // pallet // --header @@ -33,14 +33,18 @@ // wasm // --heap-pages // 4096 +// --steps +// 2 +// --repeat +// 1 // --chain -// local +// crab-local // --output -// runtime/src/weights +// runtime/crab/src/weights/ // --extrinsic // * // --pallet -// pallet-session +// * #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -55,15 +59,17 @@ impl pallet_session::WeightInfo for WeightInfo { // Storage: Session NextKeys (r:1 w:1) // Storage: Session KeyOwner (r:1 w:1) fn set_keys() -> Weight { - Weight::from_ref_time(30_781_000 as u64) - .saturating_add(T::DbWeight::get().reads(2 as u64)) - .saturating_add(T::DbWeight::get().writes(2 as u64)) + // Minimum execution time: 39_636 nanoseconds. + Weight::from_ref_time(39_636_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) } // Storage: Session NextKeys (r:1 w:1) // Storage: Session KeyOwner (r:0 w:1) fn purge_keys() -> Weight { - Weight::from_ref_time(22_911_000 as u64) - .saturating_add(T::DbWeight::get().reads(1 as u64)) - .saturating_add(T::DbWeight::get().writes(2 as u64)) + // Minimum execution time: 19_450 nanoseconds. + Weight::from_ref_time(19_450_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(2)) } } diff --git a/runtime/crab/src/weights/pallet_timestamp.rs b/runtime/crab/src/weights/pallet_timestamp.rs index 7f420bd5a..c64988564 100644 --- a/runtime/crab/src/weights/pallet_timestamp.rs +++ b/runtime/crab/src/weights/pallet_timestamp.rs @@ -19,12 +19,12 @@ //! Autogenerated weights for `pallet_timestamp` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2022-11-09, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! HOSTNAME: `inv.cafe`, CPU: `AMD Ryzen 9 5950X 16-Core Processor` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("local"), DB CACHE: 1024 +//! DATE: 2023-02-22, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("crab-local"), DB CACHE: 1024 // Executed Command: -// target/release/darwinia +// ./target/release/darwinia // benchmark // pallet // --header @@ -33,14 +33,18 @@ // wasm // --heap-pages // 4096 +// --steps +// 2 +// --repeat +// 1 // --chain -// local +// crab-local // --output -// runtime/src/weights +// runtime/crab/src/weights/ // --extrinsic // * // --pallet -// pallet-timestamp +// * #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -53,12 +57,15 @@ use sp_std::marker::PhantomData; pub struct WeightInfo(PhantomData); impl pallet_timestamp::WeightInfo for WeightInfo { // Storage: Timestamp Now (r:1 w:1) + // Storage: Aura CurrentSlot (r:1 w:0) fn set() -> Weight { - Weight::from_ref_time(13_230_000 as u64) - .saturating_add(T::DbWeight::get().reads(1 as u64)) - .saturating_add(T::DbWeight::get().writes(1 as u64)) + // Minimum execution time: 26_616 nanoseconds. + Weight::from_ref_time(26_616_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) } fn on_finalize() -> Weight { - Weight::from_ref_time(5_710_000 as u64) + // Minimum execution time: 6_441 nanoseconds. + Weight::from_ref_time(6_441_000) } } diff --git a/runtime/crab/src/weights/pallet_tips.rs b/runtime/crab/src/weights/pallet_tips.rs new file mode 100644 index 000000000..5302f9830 --- /dev/null +++ b/runtime/crab/src/weights/pallet_tips.rs @@ -0,0 +1,120 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `pallet_tips` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-02-22, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("crab-local"), DB CACHE: 1024 + +// Executed Command: +// ./target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --steps +// 2 +// --repeat +// 1 +// --chain +// crab-local +// --output +// runtime/crab/src/weights/ +// --extrinsic +// * +// --pallet +// * + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_tips`. +pub struct WeightInfo(PhantomData); +impl pallet_tips::WeightInfo for WeightInfo { + // Storage: Tips Reasons (r:1 w:1) + // Storage: Tips Tips (r:1 w:1) + /// The range of component `r` is `[0, 16384]`. + fn report_awesome(_r: u32, ) -> Weight { + // Minimum execution time: 46_212 nanoseconds. + Weight::from_ref_time(65_344_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Tips Tips (r:1 w:1) + // Storage: Tips Reasons (r:0 w:1) + fn retract_tip() -> Weight { + // Minimum execution time: 32_320 nanoseconds. + Weight::from_ref_time(32_320_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: PhragmenElection Members (r:1 w:0) + // Storage: Tips Reasons (r:1 w:1) + // Storage: Tips Tips (r:0 w:1) + /// The range of component `r` is `[0, 16384]`. + /// The range of component `t` is `[1, 7]`. + fn tip_new(r: u32, t: u32, ) -> Weight { + // Minimum execution time: 40_832 nanoseconds. + Weight::from_ref_time(40_386_333) + // Standard Error: 138 + .saturating_add(Weight::from_ref_time(1_174).saturating_mul(r.into())) + // Standard Error: 379_319 + .saturating_add(Weight::from_ref_time(63_666).saturating_mul(t.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: PhragmenElection Members (r:1 w:0) + // Storage: Tips Tips (r:1 w:1) + /// The range of component `t` is `[1, 7]`. + fn tip(_t: u32, ) -> Weight { + // Minimum execution time: 17_675 nanoseconds. + Weight::from_ref_time(18_030_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Tips Tips (r:1 w:1) + // Storage: PhragmenElection Members (r:1 w:0) + // Storage: System Account (r:2 w:2) + // Storage: Tips Reasons (r:0 w:1) + /// The range of component `t` is `[1, 7]`. + fn close_tip(_t: u32, ) -> Weight { + // Minimum execution time: 51_170 nanoseconds. + Weight::from_ref_time(55_043_000) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(4)) + } + // Storage: Tips Tips (r:1 w:1) + // Storage: Tips Reasons (r:0 w:1) + /// The range of component `t` is `[1, 7]`. + fn slash_tip(_t: u32, ) -> Weight { + // Minimum execution time: 21_870 nanoseconds. + Weight::from_ref_time(26_138_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(2)) + } +} diff --git a/runtime/crab/src/weights/pallet_treasury.rs b/runtime/crab/src/weights/pallet_treasury.rs new file mode 100644 index 000000000..2d05e0299 --- /dev/null +++ b/runtime/crab/src/weights/pallet_treasury.rs @@ -0,0 +1,107 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `pallet_treasury` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-02-22, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("crab-local"), DB CACHE: 1024 + +// Executed Command: +// ./target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --steps +// 2 +// --repeat +// 1 +// --chain +// crab-local +// --output +// runtime/crab/src/weights/ +// --extrinsic +// * +// --pallet +// * + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_treasury`. +pub struct WeightInfo(PhantomData); +impl pallet_treasury::WeightInfo for WeightInfo { + fn spend() -> Weight { + // Minimum execution time: 678 nanoseconds. + Weight::from_ref_time(678_000) + } + // Storage: Treasury ProposalCount (r:1 w:1) + // Storage: Treasury Proposals (r:0 w:1) + fn propose_spend() -> Weight { + // Minimum execution time: 47_467 nanoseconds. + Weight::from_ref_time(47_467_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Treasury Proposals (r:1 w:1) + // Storage: System Account (r:2 w:2) + fn reject_proposal() -> Weight { + // Minimum execution time: 51_903 nanoseconds. + Weight::from_ref_time(51_903_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: Treasury Proposals (r:1 w:0) + // Storage: Treasury Approvals (r:1 w:1) + /// The range of component `p` is `[0, 99]`. + fn approve_proposal(_p: u32, ) -> Weight { + // Minimum execution time: 14_792 nanoseconds. + Weight::from_ref_time(24_007_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Treasury Approvals (r:1 w:1) + fn remove_approval() -> Weight { + // Minimum execution time: 11_257 nanoseconds. + Weight::from_ref_time(11_257_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: System Account (r:1 w:1) + // Storage: Treasury Deactivated (r:1 w:1) + // Storage: Balances InactiveIssuance (r:1 w:1) + // Storage: Treasury Approvals (r:1 w:1) + // Storage: Treasury Proposals (r:100 w:0) + /// The range of component `p` is `[0, 100]`. + fn on_initialize_proposals(_p: u32, ) -> Weight { + // Minimum execution time: 47_023 nanoseconds. + Weight::from_ref_time(284_512_000) + .saturating_add(T::DbWeight::get().reads(104)) + .saturating_add(T::DbWeight::get().writes(4)) + } +} diff --git a/runtime/crab/src/weights/pallet_utility.rs b/runtime/crab/src/weights/pallet_utility.rs new file mode 100644 index 000000000..01ea30fe5 --- /dev/null +++ b/runtime/crab/src/weights/pallet_utility.rs @@ -0,0 +1,82 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `pallet_utility` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-02-22, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("crab-local"), DB CACHE: 1024 + +// Executed Command: +// ./target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --steps +// 2 +// --repeat +// 1 +// --chain +// crab-local +// --output +// runtime/crab/src/weights/ +// --extrinsic +// * +// --pallet +// * + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_utility`. +pub struct WeightInfo(PhantomData); +impl pallet_utility::WeightInfo for WeightInfo { + /// The range of component `c` is `[0, 1000]`. + fn batch(_c: u32, ) -> Weight { + // Minimum execution time: 38_797 nanoseconds. + Weight::from_ref_time(3_794_342_000) + } + fn as_derivative() -> Weight { + // Minimum execution time: 22_134 nanoseconds. + Weight::from_ref_time(22_134_000) + } + /// The range of component `c` is `[0, 1000]`. + fn batch_all(_c: u32, ) -> Weight { + // Minimum execution time: 30_681 nanoseconds. + Weight::from_ref_time(3_916_476_000) + } + fn dispatch_as() -> Weight { + // Minimum execution time: 29_357 nanoseconds. + Weight::from_ref_time(29_357_000) + } + /// The range of component `c` is `[0, 1000]`. + fn force_batch(_c: u32, ) -> Weight { + // Minimum execution time: 30_220 nanoseconds. + Weight::from_ref_time(5_327_665_000) + } +} diff --git a/runtime/crab/src/weights/pallet_vesting.rs b/runtime/crab/src/weights/pallet_vesting.rs new file mode 100644 index 000000000..dd72b117b --- /dev/null +++ b/runtime/crab/src/weights/pallet_vesting.rs @@ -0,0 +1,169 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `pallet_vesting` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-02-22, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("crab-local"), DB CACHE: 1024 + +// Executed Command: +// ./target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --steps +// 2 +// --repeat +// 1 +// --chain +// crab-local +// --output +// runtime/crab/src/weights/ +// --extrinsic +// * +// --pallet +// * + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_vesting`. +pub struct WeightInfo(PhantomData); +impl pallet_vesting::WeightInfo for WeightInfo { + // Storage: Vesting Vesting (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + /// The range of component `l` is `[0, 49]`. + /// The range of component `s` is `[1, 28]`. + fn vest_locked(l: u32, s: u32, ) -> Weight { + // Minimum execution time: 52_335 nanoseconds. + Weight::from_ref_time(48_023_037) + // Standard Error: 150_688 + .saturating_add(Weight::from_ref_time(84_122).saturating_mul(l.into())) + // Standard Error: 273_471 + .saturating_add(Weight::from_ref_time(189_962).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Vesting Vesting (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + /// The range of component `l` is `[0, 49]`. + /// The range of component `s` is `[1, 28]`. + fn vest_unlocked(_l: u32, s: u32, ) -> Weight { + // Minimum execution time: 54_240 nanoseconds. + Weight::from_ref_time(64_985_703) + // Standard Error: 154_890 + .saturating_add(Weight::from_ref_time(192_796).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Vesting Vesting (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + // Storage: System Account (r:1 w:1) + /// The range of component `l` is `[0, 49]`. + /// The range of component `s` is `[1, 28]`. + fn vest_other_locked(l: u32, s: u32, ) -> Weight { + // Minimum execution time: 50_367 nanoseconds. + Weight::from_ref_time(46_947_296) + // Standard Error: 44_061 + .saturating_add(Weight::from_ref_time(64_785).saturating_mul(l.into())) + // Standard Error: 79_963 + .saturating_add(Weight::from_ref_time(245_203).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: Vesting Vesting (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + // Storage: System Account (r:1 w:1) + /// The range of component `l` is `[0, 49]`. + /// The range of component `s` is `[1, 28]`. + fn vest_other_unlocked(l: u32, s: u32, ) -> Weight { + // Minimum execution time: 50_375 nanoseconds. + Weight::from_ref_time(49_036_925) + // Standard Error: 11_770 + .saturating_add(Weight::from_ref_time(24_367).saturating_mul(l.into())) + // Standard Error: 21_361 + .saturating_add(Weight::from_ref_time(144_074).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: Vesting Vesting (r:1 w:1) + // Storage: System Account (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + /// The range of component `l` is `[0, 49]`. + /// The range of component `s` is `[0, 27]`. + fn vested_transfer(_l: u32, _s: u32, ) -> Weight { + // Minimum execution time: 67_566 nanoseconds. + Weight::from_ref_time(94_931_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: Vesting Vesting (r:1 w:1) + // Storage: System Account (r:2 w:2) + // Storage: Balances Locks (r:1 w:1) + /// The range of component `l` is `[0, 49]`. + /// The range of component `s` is `[0, 27]`. + fn force_vested_transfer(l: u32, _s: u32, ) -> Weight { + // Minimum execution time: 65_683 nanoseconds. + Weight::from_ref_time(72_016_500) + // Standard Error: 54_488 + .saturating_add(Weight::from_ref_time(27_214).saturating_mul(l.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(4)) + } + // Storage: Vesting Vesting (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + // Storage: System Account (r:1 w:1) + /// The range of component `l` is `[0, 49]`. + /// The range of component `s` is `[2, 28]`. + fn not_unlocking_merge_schedules(l: u32, s: u32, ) -> Weight { + // Minimum execution time: 53_683 nanoseconds. + Weight::from_ref_time(53_558_230) + // Standard Error: 98_550 + .saturating_add(Weight::from_ref_time(29_224).saturating_mul(l.into())) + // Standard Error: 185_729 + .saturating_add(Weight::from_ref_time(52_884).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: Vesting Vesting (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + // Storage: System Account (r:1 w:1) + /// The range of component `l` is `[0, 49]`. + /// The range of component `s` is `[2, 28]`. + fn unlocking_merge_schedules(l: u32, s: u32, ) -> Weight { + // Minimum execution time: 50_102 nanoseconds. + Weight::from_ref_time(49_516_692) + // Standard Error: 27_836 + .saturating_add(Weight::from_ref_time(91_704).saturating_mul(l.into())) + // Standard Error: 52_461 + .saturating_add(Weight::from_ref_time(20_903).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } +} diff --git a/runtime/darwinia/src/lib.rs b/runtime/darwinia/src/lib.rs index b74dd69c8..1a87b6c85 100644 --- a/runtime/darwinia/src/lib.rs +++ b/runtime/darwinia/src/lib.rs @@ -168,11 +168,30 @@ frame_support::construct_runtime! { #[cfg(feature = "runtime-benchmarks")] frame_benchmarking::define_benchmarks! { + // Substrate + [cumulus_pallet_xcmp_queue, XcmpQueue] [frame_system, SystemBench::] + [pallet_assets, Assets] [pallet_balances, Balances] + [pallet_collective, Council] + [pallet_collective, TechnicalCommittee] + [pallet_democracy, Democracy] + [pallet_elections_phragmen, PhragmenElection] + [pallet_identity, Identity] + [pallet_membership, TechnicalMembership] + [pallet_multisig, Multisig] + [pallet_preimage, Preimage] + [pallet_proxy, Proxy] + [pallet_scheduler, Scheduler] + [pallet_tips, Tips] + [pallet_treasury, Treasury] + [pallet_utility, Utility] + [pallet_vesting, Vesting] [pallet_session, SessionBench::] [pallet_timestamp, Timestamp] - [cumulus_pallet_xcmp_queue, XcmpQueue] + // Bridge + [pallet_bridge_grandpa, BridgeKusamaGrandpa] + [pallet_fee_market, CrabFeeMarket] } impl_self_contained_call!(); diff --git a/runtime/darwinia/src/pallets/assets.rs b/runtime/darwinia/src/pallets/assets.rs index a2cd311b7..b70433ccc 100644 --- a/runtime/darwinia/src/pallets/assets.rs +++ b/runtime/darwinia/src/pallets/assets.rs @@ -50,5 +50,5 @@ impl pallet_assets::Config for Runtime { type RemoveItemsLimit = ConstU32<1000>; type RuntimeEvent = RuntimeEvent; type StringLimit = ConstU32<50>; - type WeightInfo = (); + type WeightInfo = weights::pallet_assets::WeightInfo; } diff --git a/runtime/darwinia/src/pallets/balances.rs b/runtime/darwinia/src/pallets/balances.rs index 94a42eac2..1680c05c1 100644 --- a/runtime/darwinia/src/pallets/balances.rs +++ b/runtime/darwinia/src/pallets/balances.rs @@ -19,11 +19,21 @@ // darwinia use crate::*; +// https://github.com/paritytech/substrate/blob/polkadot-v0.9.37/frame/balances/src/benchmarking.rs#L39 +#[cfg(feature = "runtime-benchmarks")] +frame_support::parameter_types! { + pub const ExistentialDeposit:Balance = 1; +} +#[cfg(not(feature = "runtime-benchmarks"))] +frame_support::parameter_types! { + pub const ExistentialDeposit:Balance = 0; +} + impl pallet_balances::Config for Runtime { type AccountStore = System; type Balance = Balance; type DustRemoval = (); - type ExistentialDeposit = ConstU128<0>; + type ExistentialDeposit = ExistentialDeposit; type MaxLocks = ConstU32<50>; type MaxReserves = ConstU32<50>; type ReserveIdentifier = [u8; 8]; diff --git a/runtime/darwinia/src/pallets/bridge_grandpa.rs b/runtime/darwinia/src/pallets/bridge_grandpa.rs index 3068ce427..7a999e80a 100644 --- a/runtime/darwinia/src/pallets/bridge_grandpa.rs +++ b/runtime/darwinia/src/pallets/bridge_grandpa.rs @@ -29,5 +29,5 @@ impl pallet_bridge_grandpa::Config for Runtime { type MaxBridgedAuthorities = ConstU32<100_000>; type MaxBridgedHeaderSize = ConstU32<65536>; type MaxRequests = ConstU32<50>; - type WeightInfo = (); + type WeightInfo = weights::pallet_bridge_grandpa::WeightInfo; } diff --git a/runtime/darwinia/src/pallets/collective.rs b/runtime/darwinia/src/pallets/collective.rs index 7dfbc2623..5168b8bf0 100644 --- a/runtime/darwinia/src/pallets/collective.rs +++ b/runtime/darwinia/src/pallets/collective.rs @@ -36,7 +36,7 @@ impl pallet_collective::Config for Runtime { type Proposal = RuntimeCall; type RuntimeEvent = RuntimeEvent; type RuntimeOrigin = RuntimeOrigin; - type WeightInfo = (); + type WeightInfo = weights::pallet_collective_council::WeightInfo; } impl pallet_collective::Config for Runtime { type DefaultVote = pallet_collective::PrimeDefaultVote; @@ -46,5 +46,5 @@ impl pallet_collective::Config for Runtime { type Proposal = RuntimeCall; type RuntimeEvent = RuntimeEvent; type RuntimeOrigin = RuntimeOrigin; - type WeightInfo = (); + type WeightInfo = weights::pallet_collective_technical_committee::WeightInfo; } diff --git a/runtime/darwinia/src/pallets/democracy.rs b/runtime/darwinia/src/pallets/democracy.rs index e28b4f392..a4c809347 100644 --- a/runtime/darwinia/src/pallets/democracy.rs +++ b/runtime/darwinia/src/pallets/democracy.rs @@ -60,5 +60,5 @@ impl pallet_democracy::Config for Runtime { type VetoOrigin = pallet_collective::EnsureMember; type VoteLockingPeriod = ConstU32; type VotingPeriod = ConstU32<{ 28 * DAYS }>; - type WeightInfo = (); + type WeightInfo = weights::pallet_democracy::WeightInfo; } diff --git a/runtime/darwinia/src/pallets/elections_phragmen.rs b/runtime/darwinia/src/pallets/elections_phragmen.rs index 133b89054..220df24cb 100644 --- a/runtime/darwinia/src/pallets/elections_phragmen.rs +++ b/runtime/darwinia/src/pallets/elections_phragmen.rs @@ -45,5 +45,5 @@ impl pallet_elections_phragmen::Config for Runtime { type VotingBondBase = ConstU128<{ darwinia_deposit(1, 64) }>; // Additional data per vote is 32 bytes (account id). type VotingBondFactor = ConstU128<{ darwinia_deposit(0, 32) }>; - type WeightInfo = (); + type WeightInfo = weights::pallet_elections_phragmen::WeightInfo; } diff --git a/runtime/darwinia/src/pallets/fee_market.rs b/runtime/darwinia/src/pallets/fee_market.rs index d6c60ccb7..eb716d87d 100644 --- a/runtime/darwinia/src/pallets/fee_market.rs +++ b/runtime/darwinia/src/pallets/fee_market.rs @@ -69,5 +69,5 @@ impl pallet_fee_market::Config for Runtime { type Slasher = FeeMarketSlasher; type Slot = ConstU32<600>; type TreasuryPalletId = TreasuryPalletId; - type WeightInfo = (); + type WeightInfo = weights::pallet_fee_market::WeightInfo; } diff --git a/runtime/darwinia/src/pallets/identity.rs b/runtime/darwinia/src/pallets/identity.rs index b12f0b3a9..1fcedcd89 100644 --- a/runtime/darwinia/src/pallets/identity.rs +++ b/runtime/darwinia/src/pallets/identity.rs @@ -35,5 +35,5 @@ impl pallet_identity::Config for Runtime { type Slashed = Treasury; // 53 bytes on-chain. type SubAccountDeposit = ConstU128<{ darwinia_deposit(1, 53) }>; - type WeightInfo = (); + type WeightInfo = weights::pallet_identity::WeightInfo; } diff --git a/runtime/darwinia/src/pallets/membership.rs b/runtime/darwinia/src/pallets/membership.rs index 3064d4b5e..a73d74e79 100644 --- a/runtime/darwinia/src/pallets/membership.rs +++ b/runtime/darwinia/src/pallets/membership.rs @@ -29,5 +29,5 @@ impl pallet_membership::Config for Runtime { type ResetOrigin = RootOrMoreThanHalf; type RuntimeEvent = RuntimeEvent; type SwapOrigin = RootOrMoreThanHalf; - type WeightInfo = (); + type WeightInfo = weights::pallet_membership::WeightInfo; } diff --git a/runtime/darwinia/src/pallets/multisig.rs b/runtime/darwinia/src/pallets/multisig.rs index c47262b26..d2e226434 100644 --- a/runtime/darwinia/src/pallets/multisig.rs +++ b/runtime/darwinia/src/pallets/multisig.rs @@ -28,5 +28,5 @@ impl pallet_multisig::Config for Runtime { type MaxSignatories = ConstU32<100>; type RuntimeCall = RuntimeCall; type RuntimeEvent = RuntimeEvent; - type WeightInfo = (); + type WeightInfo = weights::pallet_multisig::WeightInfo; } diff --git a/runtime/darwinia/src/pallets/preimage.rs b/runtime/darwinia/src/pallets/preimage.rs index d049ef1c0..08ef47e38 100644 --- a/runtime/darwinia/src/pallets/preimage.rs +++ b/runtime/darwinia/src/pallets/preimage.rs @@ -25,5 +25,5 @@ impl pallet_preimage::Config for Runtime { type Currency = Balances; type ManagerOrigin = frame_system::EnsureRoot; type RuntimeEvent = RuntimeEvent; - type WeightInfo = (); + type WeightInfo = weights::pallet_preimage::WeightInfo; } diff --git a/runtime/darwinia/src/pallets/proxy.rs b/runtime/darwinia/src/pallets/proxy.rs index c571d5f14..39e8cb5c7 100644 --- a/runtime/darwinia/src/pallets/proxy.rs +++ b/runtime/darwinia/src/pallets/proxy.rs @@ -129,5 +129,5 @@ impl pallet_proxy::Config for Runtime { type ProxyType = ProxyType; type RuntimeCall = RuntimeCall; type RuntimeEvent = RuntimeEvent; - type WeightInfo = (); + type WeightInfo = weights::pallet_proxy::WeightInfo; } diff --git a/runtime/darwinia/src/pallets/scheduler.rs b/runtime/darwinia/src/pallets/scheduler.rs index 2f0197405..868dfd6d6 100644 --- a/runtime/darwinia/src/pallets/scheduler.rs +++ b/runtime/darwinia/src/pallets/scheduler.rs @@ -59,5 +59,5 @@ impl pallet_scheduler::Config for Runtime { type RuntimeEvent = RuntimeEvent; type RuntimeOrigin = RuntimeOrigin; type ScheduleOrigin = Root; - type WeightInfo = (); + type WeightInfo = weights::pallet_scheduler::WeightInfo; } diff --git a/runtime/darwinia/src/pallets/tips.rs b/runtime/darwinia/src/pallets/tips.rs index 6500a1b3a..e5e1ff68a 100644 --- a/runtime/darwinia/src/pallets/tips.rs +++ b/runtime/darwinia/src/pallets/tips.rs @@ -31,5 +31,5 @@ impl pallet_tips::Config for Runtime { type TipFindersFee = TipFindersFee; type TipReportDepositBase = ConstU128<{ 100 * UNIT }>; type Tippers = PhragmenElection; - type WeightInfo = (); + type WeightInfo = weights::pallet_tips::WeightInfo; } diff --git a/runtime/darwinia/src/pallets/treasury.rs b/runtime/darwinia/src/pallets/treasury.rs index 3febca02f..b2e8b4708 100644 --- a/runtime/darwinia/src/pallets/treasury.rs +++ b/runtime/darwinia/src/pallets/treasury.rs @@ -43,5 +43,5 @@ impl pallet_treasury::Config for Runtime { type SpendFunds = (); type SpendOrigin = frame_support::traits::NeverEnsureOrigin; type SpendPeriod = ConstU32<{ 24 * DAYS }>; - type WeightInfo = (); + type WeightInfo = weights::pallet_treasury::WeightInfo; } diff --git a/runtime/darwinia/src/pallets/utility.rs b/runtime/darwinia/src/pallets/utility.rs index 2c0f49ddf..c89d70642 100644 --- a/runtime/darwinia/src/pallets/utility.rs +++ b/runtime/darwinia/src/pallets/utility.rs @@ -23,5 +23,5 @@ impl pallet_utility::Config for Runtime { type PalletsOrigin = OriginCaller; type RuntimeCall = RuntimeCall; type RuntimeEvent = RuntimeEvent; - type WeightInfo = (); + type WeightInfo = weights::pallet_utility::WeightInfo; } diff --git a/runtime/darwinia/src/pallets/vesting.rs b/runtime/darwinia/src/pallets/vesting.rs index 1c0b0b6e6..f13db8ccc 100644 --- a/runtime/darwinia/src/pallets/vesting.rs +++ b/runtime/darwinia/src/pallets/vesting.rs @@ -32,7 +32,7 @@ impl pallet_vesting::Config for Runtime { type MinVestedTransfer = ConstU128; type RuntimeEvent = RuntimeEvent; type UnvestedFundsAllowedWithdrawReasons = UnvestedFundsAllowedWithdrawReasons; - type WeightInfo = (); + type WeightInfo = weights::pallet_vesting::WeightInfo; // `VestingInfo` encode length is 36bytes. 28 schedules gets encoded as 1009 bytes, which is the // highest number of schedules that encodes less than 2^10. diff --git a/runtime/darwinia/src/weights/cumulus_pallet_xcmp_queue.rs b/runtime/darwinia/src/weights/cumulus_pallet_xcmp_queue.rs index 3271b31e4..186b95f6b 100644 --- a/runtime/darwinia/src/weights/cumulus_pallet_xcmp_queue.rs +++ b/runtime/darwinia/src/weights/cumulus_pallet_xcmp_queue.rs @@ -19,12 +19,12 @@ //! Autogenerated weights for `cumulus_pallet_xcmp_queue` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2022-11-09, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! HOSTNAME: `inv.cafe`, CPU: `AMD Ryzen 9 5950X 16-Core Processor` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("local"), DB CACHE: 1024 +//! DATE: 2023-02-22, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("darwinia-local"), DB CACHE: 1024 // Executed Command: -// target/release/darwinia +// ./target/release/darwinia // benchmark // pallet // --header @@ -33,14 +33,18 @@ // wasm // --heap-pages // 4096 +// --steps +// 2 +// --repeat +// 1 // --chain -// local +// darwinia-local // --output -// runtime/src/weights +// runtime/darwinia/src/weights/ // --extrinsic // * // --pallet -// cumulus-pallet-xcmp-queue +// * #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -54,14 +58,16 @@ pub struct WeightInfo(PhantomData); impl cumulus_pallet_xcmp_queue::WeightInfo for WeightInfo { // Storage: XcmpQueue QueueConfig (r:1 w:1) fn set_config_with_u32() -> Weight { - Weight::from_ref_time(13_340_000 as u64) - .saturating_add(T::DbWeight::get().reads(1 as u64)) - .saturating_add(T::DbWeight::get().writes(1 as u64)) + // Minimum execution time: 22_659 nanoseconds. + Weight::from_ref_time(22_659_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) } // Storage: XcmpQueue QueueConfig (r:1 w:1) fn set_config_with_weight() -> Weight { - Weight::from_ref_time(12_610_000 as u64) - .saturating_add(T::DbWeight::get().reads(1 as u64)) - .saturating_add(T::DbWeight::get().writes(1 as u64)) + // Minimum execution time: 24_181 nanoseconds. + Weight::from_ref_time(24_181_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) } } diff --git a/runtime/darwinia/src/weights/frame_system.rs b/runtime/darwinia/src/weights/frame_system.rs index 2361f7517..52794cc00 100644 --- a/runtime/darwinia/src/weights/frame_system.rs +++ b/runtime/darwinia/src/weights/frame_system.rs @@ -19,12 +19,12 @@ //! Autogenerated weights for `frame_system` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2022-11-09, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! HOSTNAME: `inv.cafe`, CPU: `AMD Ryzen 9 5950X 16-Core Processor` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("local"), DB CACHE: 1024 +//! DATE: 2023-02-22, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("darwinia-local"), DB CACHE: 1024 // Executed Command: -// target/release/darwinia +// ./target/release/darwinia // benchmark // pallet // --header @@ -33,14 +33,18 @@ // wasm // --heap-pages // 4096 +// --steps +// 2 +// --repeat +// 1 // --chain -// local +// darwinia-local // --output -// runtime/src/weights +// runtime/darwinia/src/weights/ // --extrinsic // * // --pallet -// frame-system +// * #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -54,35 +58,41 @@ pub struct WeightInfo(PhantomData); impl frame_system::WeightInfo for WeightInfo { /// The range of component `b` is `[0, 3932160]`. fn remark(_b: u32, ) -> Weight { - Weight::from_ref_time(1_074_555_000 as u64) + // Minimum execution time: 16_731 nanoseconds. + Weight::from_ref_time(904_761_000) } /// The range of component `b` is `[0, 3932160]`. fn remark_with_event(_b: u32, ) -> Weight { - Weight::from_ref_time(4_724_488_000 as u64) + // Minimum execution time: 31_589 nanoseconds. + Weight::from_ref_time(4_648_833_000) } // Storage: System Digest (r:1 w:1) // Storage: unknown [0x3a686561707061676573] (r:0 w:1) fn set_heap_pages() -> Weight { - Weight::from_ref_time(14_110_000 as u64) - .saturating_add(T::DbWeight::get().reads(1 as u64)) - .saturating_add(T::DbWeight::get().writes(2 as u64)) + // Minimum execution time: 33_982 nanoseconds. + Weight::from_ref_time(33_982_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(2)) } // Storage: Skipped Metadata (r:0 w:0) - /// The range of component `i` is `[1, 1000]`. + /// The range of component `i` is `[0, 1000]`. fn set_storage(_i: u32, ) -> Weight { - Weight::from_ref_time(655_299_000 as u64) - .saturating_add(T::DbWeight::get().writes(1000 as u64)) + // Minimum execution time: 15_374 nanoseconds. + Weight::from_ref_time(555_371_000) + .saturating_add(T::DbWeight::get().writes(1000)) } // Storage: Skipped Metadata (r:0 w:0) - /// The range of component `i` is `[1, 1000]`. + /// The range of component `i` is `[0, 1000]`. fn kill_storage(_i: u32, ) -> Weight { - Weight::from_ref_time(555_697_000 as u64) - .saturating_add(T::DbWeight::get().writes(1000 as u64)) + // Minimum execution time: 16_973 nanoseconds. + Weight::from_ref_time(398_754_000) + .saturating_add(T::DbWeight::get().writes(1000)) } // Storage: Skipped Metadata (r:0 w:0) - /// The range of component `p` is `[1, 1000]`. + /// The range of component `p` is `[0, 1000]`. fn kill_prefix(_p: u32, ) -> Weight { - Weight::from_ref_time(1_089_395_000 as u64) - .saturating_add(T::DbWeight::get().writes(1000 as u64)) + // Minimum execution time: 19_452 nanoseconds. + Weight::from_ref_time(933_972_000) + .saturating_add(T::DbWeight::get().writes(1000)) } } diff --git a/runtime/darwinia/src/weights/mod.rs b/runtime/darwinia/src/weights/mod.rs index caf9386da..4580cd631 100644 --- a/runtime/darwinia/src/weights/mod.rs +++ b/runtime/darwinia/src/weights/mod.rs @@ -34,6 +34,23 @@ pub use rocksdb_weights::constants::RocksDbWeight; pub mod cumulus_pallet_xcmp_queue; pub mod frame_system; +pub mod pallet_assets; pub mod pallet_balances; +pub mod pallet_bridge_grandpa; +pub mod pallet_collective_council; +pub mod pallet_collective_technical_committee; +pub mod pallet_democracy; +pub mod pallet_elections_phragmen; +pub mod pallet_fee_market; +pub mod pallet_identity; +pub mod pallet_membership; +pub mod pallet_multisig; +pub mod pallet_preimage; +pub mod pallet_proxy; +pub mod pallet_scheduler; pub mod pallet_session; pub mod pallet_timestamp; +pub mod pallet_tips; +pub mod pallet_treasury; +pub mod pallet_utility; +pub mod pallet_vesting; diff --git a/runtime/darwinia/src/weights/pallet_assets.rs b/runtime/darwinia/src/weights/pallet_assets.rs new file mode 100644 index 000000000..b7ce8c953 --- /dev/null +++ b/runtime/darwinia/src/weights/pallet_assets.rs @@ -0,0 +1,276 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `pallet_assets` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-02-22, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("darwinia-local"), DB CACHE: 1024 + +// Executed Command: +// ./target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --steps +// 2 +// --repeat +// 1 +// --chain +// darwinia-local +// --output +// runtime/darwinia/src/weights/ +// --extrinsic +// * +// --pallet +// * + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_assets`. +pub struct WeightInfo(PhantomData); +impl pallet_assets::WeightInfo for WeightInfo { + // Storage: Assets Asset (r:1 w:1) + fn create() -> Weight { + // Minimum execution time: 56_587 nanoseconds. + Weight::from_ref_time(56_587_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Assets Asset (r:1 w:1) + fn force_create() -> Weight { + // Minimum execution time: 39_230 nanoseconds. + Weight::from_ref_time(39_230_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Assets Asset (r:1 w:1) + fn start_destroy() -> Weight { + // Minimum execution time: 20_476 nanoseconds. + Weight::from_ref_time(20_476_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Assets Asset (r:1 w:1) + // Storage: Assets Account (r:1 w:0) + // Storage: System Account (r:1000 w:1000) + /// The range of component `c` is `[0, 1000]`. + fn destroy_accounts(_c: u32, ) -> Weight { + // Minimum execution time: 26_262 nanoseconds. + Weight::from_ref_time(11_602_815_000) + .saturating_add(T::DbWeight::get().reads(2002)) + .saturating_add(T::DbWeight::get().writes(2001)) + } + // Storage: Assets Asset (r:1 w:1) + // Storage: Assets Approvals (r:1 w:0) + /// The range of component `a` is `[0, 1000]`. + fn destroy_approvals(_a: u32, ) -> Weight { + // Minimum execution time: 30_306 nanoseconds. + Weight::from_ref_time(5_836_012_000) + .saturating_add(T::DbWeight::get().reads(1002)) + .saturating_add(T::DbWeight::get().writes(1001)) + } + // Storage: Assets Asset (r:1 w:1) + // Storage: Assets Metadata (r:1 w:0) + fn finish_destroy() -> Weight { + // Minimum execution time: 29_489 nanoseconds. + Weight::from_ref_time(29_489_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Assets Asset (r:1 w:1) + // Storage: Assets Account (r:1 w:1) + fn mint() -> Weight { + // Minimum execution time: 39_295 nanoseconds. + Weight::from_ref_time(39_295_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Assets Asset (r:1 w:1) + // Storage: Assets Account (r:1 w:1) + fn burn() -> Weight { + // Minimum execution time: 69_414 nanoseconds. + Weight::from_ref_time(69_414_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Assets Asset (r:1 w:1) + // Storage: Assets Account (r:2 w:2) + // Storage: System Account (r:1 w:1) + fn transfer() -> Weight { + // Minimum execution time: 60_168 nanoseconds. + Weight::from_ref_time(60_168_000) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(4)) + } + // Storage: Assets Asset (r:1 w:1) + // Storage: Assets Account (r:2 w:2) + // Storage: System Account (r:1 w:1) + fn transfer_keep_alive() -> Weight { + // Minimum execution time: 50_406 nanoseconds. + Weight::from_ref_time(50_406_000) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(4)) + } + // Storage: Assets Asset (r:1 w:1) + // Storage: Assets Account (r:2 w:2) + // Storage: System Account (r:1 w:1) + fn force_transfer() -> Weight { + // Minimum execution time: 59_553 nanoseconds. + Weight::from_ref_time(59_553_000) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(4)) + } + // Storage: Assets Asset (r:1 w:0) + // Storage: Assets Account (r:1 w:1) + fn freeze() -> Weight { + // Minimum execution time: 31_452 nanoseconds. + Weight::from_ref_time(31_452_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Assets Asset (r:1 w:0) + // Storage: Assets Account (r:1 w:1) + fn thaw() -> Weight { + // Minimum execution time: 24_513 nanoseconds. + Weight::from_ref_time(24_513_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Assets Asset (r:1 w:1) + fn freeze_asset() -> Weight { + // Minimum execution time: 21_323 nanoseconds. + Weight::from_ref_time(21_323_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Assets Asset (r:1 w:1) + fn thaw_asset() -> Weight { + // Minimum execution time: 21_348 nanoseconds. + Weight::from_ref_time(21_348_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Assets Asset (r:1 w:1) + // Storage: Assets Metadata (r:1 w:0) + fn transfer_ownership() -> Weight { + // Minimum execution time: 25_390 nanoseconds. + Weight::from_ref_time(25_390_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Assets Asset (r:1 w:1) + fn set_team() -> Weight { + // Minimum execution time: 24_293 nanoseconds. + Weight::from_ref_time(24_293_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Assets Asset (r:1 w:0) + // Storage: Assets Metadata (r:1 w:1) + /// The range of component `n` is `[0, 50]`. + /// The range of component `s` is `[0, 50]`. + fn set_metadata(_n: u32, _s: u32, ) -> Weight { + // Minimum execution time: 22_987 nanoseconds. + Weight::from_ref_time(25_843_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Assets Asset (r:1 w:0) + // Storage: Assets Metadata (r:1 w:1) + fn clear_metadata() -> Weight { + // Minimum execution time: 25_350 nanoseconds. + Weight::from_ref_time(25_350_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Assets Asset (r:1 w:0) + // Storage: Assets Metadata (r:1 w:1) + /// The range of component `n` is `[0, 50]`. + /// The range of component `s` is `[0, 50]`. + fn force_set_metadata(n: u32, s: u32, ) -> Weight { + // Minimum execution time: 24_650 nanoseconds. + Weight::from_ref_time(24_650_000) + // Standard Error: 1_463_906 + .saturating_add(Weight::from_ref_time(763_932).saturating_mul(n.into())) + // Standard Error: 1_463_906 + .saturating_add(Weight::from_ref_time(701_872).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Assets Asset (r:1 w:0) + // Storage: Assets Metadata (r:1 w:1) + fn force_clear_metadata() -> Weight { + // Minimum execution time: 24_363 nanoseconds. + Weight::from_ref_time(24_363_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Assets Asset (r:1 w:1) + fn force_asset_status() -> Weight { + // Minimum execution time: 22_583 nanoseconds. + Weight::from_ref_time(22_583_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Assets Asset (r:1 w:1) + // Storage: Assets Approvals (r:1 w:1) + fn approve_transfer() -> Weight { + // Minimum execution time: 28_080 nanoseconds. + Weight::from_ref_time(28_080_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Assets Asset (r:1 w:1) + // Storage: Assets Approvals (r:1 w:1) + // Storage: Assets Account (r:2 w:2) + // Storage: System Account (r:1 w:1) + fn transfer_approved() -> Weight { + // Minimum execution time: 59_322 nanoseconds. + Weight::from_ref_time(59_322_000) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(5)) + } + // Storage: Assets Asset (r:1 w:1) + // Storage: Assets Approvals (r:1 w:1) + fn cancel_approval() -> Weight { + // Minimum execution time: 26_915 nanoseconds. + Weight::from_ref_time(26_915_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Assets Asset (r:1 w:1) + // Storage: Assets Approvals (r:1 w:1) + fn force_cancel_approval() -> Weight { + // Minimum execution time: 27_182 nanoseconds. + Weight::from_ref_time(27_182_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } +} diff --git a/runtime/darwinia/src/weights/pallet_balances.rs b/runtime/darwinia/src/weights/pallet_balances.rs index f7acd35fb..b1f203619 100644 --- a/runtime/darwinia/src/weights/pallet_balances.rs +++ b/runtime/darwinia/src/weights/pallet_balances.rs @@ -19,12 +19,12 @@ //! Autogenerated weights for `pallet_balances` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2022-11-09, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! HOSTNAME: `inv.cafe`, CPU: `AMD Ryzen 9 5950X 16-Core Processor` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("local"), DB CACHE: 1024 +//! DATE: 2023-02-22, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("darwinia-local"), DB CACHE: 1024 // Executed Command: -// target/release/darwinia +// ./target/release/darwinia // benchmark // pallet // --header @@ -33,14 +33,18 @@ // wasm // --heap-pages // 4096 +// --steps +// 2 +// --repeat +// 1 // --chain -// local +// darwinia-local // --output -// runtime/src/weights +// runtime/darwinia/src/weights/ // --extrinsic // * // --pallet -// pallet-balances +// * #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -54,44 +58,51 @@ pub struct WeightInfo(PhantomData); impl pallet_balances::WeightInfo for WeightInfo { // Storage: System Account (r:1 w:1) fn transfer() -> Weight { - Weight::from_ref_time(57_141_000 as u64) - .saturating_add(T::DbWeight::get().reads(1 as u64)) - .saturating_add(T::DbWeight::get().writes(1 as u64)) + // Minimum execution time: 58_592 nanoseconds. + Weight::from_ref_time(58_592_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) } // Storage: System Account (r:1 w:1) fn transfer_keep_alive() -> Weight { - Weight::from_ref_time(43_271_000 as u64) - .saturating_add(T::DbWeight::get().reads(1 as u64)) - .saturating_add(T::DbWeight::get().writes(1 as u64)) + // Minimum execution time: 50_872 nanoseconds. + Weight::from_ref_time(50_872_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) } // Storage: System Account (r:1 w:1) fn set_balance_creating() -> Weight { - Weight::from_ref_time(29_941_000 as u64) - .saturating_add(T::DbWeight::get().reads(1 as u64)) - .saturating_add(T::DbWeight::get().writes(1 as u64)) + // Minimum execution time: 37_178 nanoseconds. + Weight::from_ref_time(37_178_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) } // Storage: System Account (r:1 w:1) fn set_balance_killing() -> Weight { - Weight::from_ref_time(34_490_000 as u64) - .saturating_add(T::DbWeight::get().reads(1 as u64)) - .saturating_add(T::DbWeight::get().writes(1 as u64)) + // Minimum execution time: 43_815 nanoseconds. + Weight::from_ref_time(43_815_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) } // Storage: System Account (r:2 w:2) fn force_transfer() -> Weight { - Weight::from_ref_time(54_911_000 as u64) - .saturating_add(T::DbWeight::get().reads(2 as u64)) - .saturating_add(T::DbWeight::get().writes(2 as u64)) + // Minimum execution time: 57_823 nanoseconds. + Weight::from_ref_time(57_823_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) } // Storage: System Account (r:1 w:1) fn transfer_all() -> Weight { - Weight::from_ref_time(49_671_000 as u64) - .saturating_add(T::DbWeight::get().reads(1 as u64)) - .saturating_add(T::DbWeight::get().writes(1 as u64)) + // Minimum execution time: 54_857 nanoseconds. + Weight::from_ref_time(54_857_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) } // Storage: System Account (r:1 w:1) fn force_unreserve() -> Weight { - Weight::from_ref_time(26_120_000 as u64) - .saturating_add(T::DbWeight::get().reads(1 as u64)) - .saturating_add(T::DbWeight::get().writes(1 as u64)) + // Minimum execution time: 33_862 nanoseconds. + Weight::from_ref_time(33_862_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) } } diff --git a/runtime/darwinia/src/weights/pallet_bridge_grandpa.rs b/runtime/darwinia/src/weights/pallet_bridge_grandpa.rs new file mode 100644 index 000000000..35a479e0d --- /dev/null +++ b/runtime/darwinia/src/weights/pallet_bridge_grandpa.rs @@ -0,0 +1,76 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `pallet_bridge_grandpa` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-02-22, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("darwinia-local"), DB CACHE: 1024 + +// Executed Command: +// ./target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --steps +// 2 +// --repeat +// 1 +// --chain +// darwinia-local +// --output +// runtime/darwinia/src/weights/ +// --extrinsic +// * +// --pallet +// * + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_bridge_grandpa`. +pub struct WeightInfo(PhantomData); +impl pallet_bridge_grandpa::WeightInfo for WeightInfo { + // Storage: BridgeKusamaGrandpa PalletOperatingMode (r:1 w:0) + // Storage: BridgeKusamaGrandpa RequestCount (r:1 w:1) + // Storage: BridgeKusamaGrandpa BestFinalized (r:1 w:1) + // Storage: BridgeKusamaGrandpa ImportedHeaders (r:1 w:2) + // Storage: BridgeKusamaGrandpa CurrentAuthoritySet (r:1 w:0) + // Storage: BridgeKusamaGrandpa ImportedHashesPointer (r:1 w:1) + // Storage: BridgeKusamaGrandpa ImportedHashes (r:1 w:1) + /// The range of component `p` is `[51, 102]`. + /// The range of component `v` is `[50, 100]`. + fn submit_finality_proof(p: u32, _v: u32, ) -> Weight { + // Minimum execution time: 1_827_347 nanoseconds. + Weight::from_ref_time(1_827_347_000) + // Standard Error: 5_261_126 + .saturating_add(Weight::from_ref_time(22_294_934).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(7)) + .saturating_add(T::DbWeight::get().writes(6)) + } +} diff --git a/runtime/darwinia/src/weights/pallet_collective_council.rs b/runtime/darwinia/src/weights/pallet_collective_council.rs new file mode 100644 index 000000000..e39986c68 --- /dev/null +++ b/runtime/darwinia/src/weights/pallet_collective_council.rs @@ -0,0 +1,232 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `pallet_collective` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-02-22, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("darwinia-local"), DB CACHE: 1024 + +// Executed Command: +// ./target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --steps +// 2 +// --repeat +// 1 +// --chain +// darwinia-local +// --output +// runtime/darwinia/src/weights/ +// --extrinsic +// * +// --pallet +// * + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_collective`. +pub struct WeightInfo(PhantomData); +impl pallet_collective::WeightInfo for WeightInfo { + // Storage: Council Members (r:1 w:1) + // Storage: Council Proposals (r:1 w:0) + // Storage: Council Prime (r:0 w:1) + // Storage: Council Voting (r:100 w:100) + /// The range of component `m` is `[0, 100]`. + /// The range of component `n` is `[0, 100]`. + /// The range of component `p` is `[0, 100]`. + /// The range of component `m` is `[0, 100]`. + /// The range of component `n` is `[0, 100]`. + /// The range of component `p` is `[0, 100]`. + fn set_members(m: u32, _n: u32, p: u32, ) -> Weight { + // Minimum execution time: 16_549 nanoseconds. + Weight::from_ref_time(16_549_000) + // Standard Error: 980_232 + .saturating_add(Weight::from_ref_time(4_170_184).saturating_mul(m.into())) + // Standard Error: 980_232 + .saturating_add(Weight::from_ref_time(4_126_919).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(m.into()))) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(p.into()))) + .saturating_add(T::DbWeight::get().writes(2)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(m.into()))) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(p.into()))) + } + // Storage: Council Members (r:1 w:0) + /// The range of component `b` is `[2, 1024]`. + /// The range of component `m` is `[1, 100]`. + /// The range of component `b` is `[2, 1024]`. + /// The range of component `m` is `[1, 100]`. + fn execute(b: u32, m: u32, ) -> Weight { + // Minimum execution time: 24_638 nanoseconds. + Weight::from_ref_time(24_055_596) + // Standard Error: 2_125 + .saturating_add(Weight::from_ref_time(1_111).saturating_mul(b.into())) + // Standard Error: 21_937 + .saturating_add(Weight::from_ref_time(43_181).saturating_mul(m.into())) + .saturating_add(T::DbWeight::get().reads(1)) + } + // Storage: Council Members (r:1 w:0) + // Storage: Council ProposalOf (r:1 w:0) + /// The range of component `b` is `[2, 1024]`. + /// The range of component `m` is `[1, 100]`. + /// The range of component `b` is `[2, 1024]`. + /// The range of component `m` is `[1, 100]`. + fn propose_execute(_b: u32, _m: u32, ) -> Weight { + // Minimum execution time: 29_700 nanoseconds. + Weight::from_ref_time(38_601_495) + .saturating_add(T::DbWeight::get().reads(2)) + } + // Storage: Council Members (r:1 w:0) + // Storage: Council ProposalOf (r:1 w:1) + // Storage: Council Proposals (r:1 w:1) + // Storage: Council ProposalCount (r:1 w:1) + // Storage: Council Voting (r:0 w:1) + /// The range of component `b` is `[2, 1024]`. + /// The range of component `m` is `[2, 100]`. + /// The range of component `p` is `[1, 100]`. + /// The range of component `b` is `[2, 1024]`. + /// The range of component `m` is `[2, 100]`. + /// The range of component `p` is `[1, 100]`. + fn propose_proposed(b: u32, m: u32, p: u32, ) -> Weight { + // Minimum execution time: 34_650 nanoseconds. + Weight::from_ref_time(29_829_867) + // Standard Error: 1_265 + .saturating_add(Weight::from_ref_time(5_682).saturating_mul(b.into())) + // Standard Error: 13_196 + .saturating_add(Weight::from_ref_time(2_573).saturating_mul(m.into())) + // Standard Error: 13_063 + .saturating_add(Weight::from_ref_time(162_118).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(4)) + } + // Storage: Council Members (r:1 w:0) + // Storage: Council Voting (r:1 w:1) + /// The range of component `m` is `[5, 100]`. + /// The range of component `m` is `[5, 100]`. + fn vote(m: u32, ) -> Weight { + // Minimum execution time: 31_527 nanoseconds. + Weight::from_ref_time(33_560_605) + // Standard Error: 38_057 + .saturating_add(Weight::from_ref_time(38_078).saturating_mul(m.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Council Voting (r:1 w:1) + // Storage: Council Members (r:1 w:0) + // Storage: Council Proposals (r:1 w:1) + // Storage: Council ProposalOf (r:0 w:1) + /// The range of component `m` is `[4, 100]`. + /// The range of component `p` is `[1, 100]`. + /// The range of component `m` is `[4, 100]`. + /// The range of component `p` is `[1, 100]`. + fn close_early_disapproved(_m: u32, p: u32, ) -> Weight { + // Minimum execution time: 31_814 nanoseconds. + Weight::from_ref_time(37_323_856) + // Standard Error: 55_392 + .saturating_add(Weight::from_ref_time(189_747).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: Council Voting (r:1 w:1) + // Storage: Council Members (r:1 w:0) + // Storage: Council ProposalOf (r:1 w:1) + // Storage: Council Proposals (r:1 w:1) + /// The range of component `b` is `[2, 1024]`. + /// The range of component `m` is `[4, 100]`. + /// The range of component `p` is `[1, 100]`. + /// The range of component `b` is `[2, 1024]`. + /// The range of component `m` is `[4, 100]`. + /// The range of component `p` is `[1, 100]`. + fn close_early_approved(b: u32, _m: u32, p: u32, ) -> Weight { + // Minimum execution time: 44_945 nanoseconds. + Weight::from_ref_time(59_214_323) + // Standard Error: 7_193 + .saturating_add(Weight::from_ref_time(184).saturating_mul(b.into())) + // Standard Error: 74_261 + .saturating_add(Weight::from_ref_time(206_535).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: Council Voting (r:1 w:1) + // Storage: Council Members (r:1 w:0) + // Storage: Council Prime (r:1 w:0) + // Storage: Council Proposals (r:1 w:1) + // Storage: Council ProposalOf (r:0 w:1) + /// The range of component `m` is `[4, 100]`. + /// The range of component `p` is `[1, 100]`. + /// The range of component `m` is `[4, 100]`. + /// The range of component `p` is `[1, 100]`. + fn close_disapproved(_m: u32, p: u32, ) -> Weight { + // Minimum execution time: 37_727 nanoseconds. + Weight::from_ref_time(41_637_474) + // Standard Error: 58_377 + .saturating_add(Weight::from_ref_time(154_525).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: Council Voting (r:1 w:1) + // Storage: Council Members (r:1 w:0) + // Storage: Council Prime (r:1 w:0) + // Storage: Council ProposalOf (r:1 w:1) + // Storage: Council Proposals (r:1 w:1) + /// The range of component `b` is `[2, 1024]`. + /// The range of component `m` is `[4, 100]`. + /// The range of component `p` is `[1, 100]`. + /// The range of component `b` is `[2, 1024]`. + /// The range of component `m` is `[4, 100]`. + /// The range of component `p` is `[1, 100]`. + fn close_approved(b: u32, m: u32, p: u32, ) -> Weight { + // Minimum execution time: 49_764 nanoseconds. + Weight::from_ref_time(46_719_875) + // Standard Error: 1_863 + .saturating_add(Weight::from_ref_time(3_169).saturating_mul(b.into())) + // Standard Error: 19_834 + .saturating_add(Weight::from_ref_time(15_388).saturating_mul(m.into())) + // Standard Error: 19_233 + .saturating_add(Weight::from_ref_time(167_734).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: Council Proposals (r:1 w:1) + // Storage: Council Voting (r:0 w:1) + // Storage: Council ProposalOf (r:0 w:1) + /// The range of component `p` is `[1, 100]`. + /// The range of component `p` is `[1, 100]`. + fn disapprove_proposal(p: u32, ) -> Weight { + // Minimum execution time: 20_155 nanoseconds. + Weight::from_ref_time(21_485_984) + // Standard Error: 65_029 + .saturating_add(Weight::from_ref_time(354_015).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(3)) + } +} diff --git a/runtime/darwinia/src/weights/pallet_collective_technical_committee.rs b/runtime/darwinia/src/weights/pallet_collective_technical_committee.rs new file mode 100644 index 000000000..b78196712 --- /dev/null +++ b/runtime/darwinia/src/weights/pallet_collective_technical_committee.rs @@ -0,0 +1,236 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `pallet_collective` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-02-22, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("darwinia-local"), DB CACHE: 1024 + +// Executed Command: +// ./target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --steps +// 2 +// --repeat +// 1 +// --chain +// darwinia-local +// --output +// runtime/darwinia/src/weights/ +// --extrinsic +// * +// --pallet +// * + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_collective`. +pub struct WeightInfo(PhantomData); +impl pallet_collective::WeightInfo for WeightInfo { + // Storage: TechnicalCommittee Members (r:1 w:1) + // Storage: TechnicalCommittee Proposals (r:1 w:0) + // Storage: TechnicalCommittee Prime (r:0 w:1) + // Storage: TechnicalCommittee Voting (r:100 w:100) + /// The range of component `m` is `[0, 100]`. + /// The range of component `n` is `[0, 100]`. + /// The range of component `p` is `[0, 100]`. + /// The range of component `m` is `[0, 100]`. + /// The range of component `n` is `[0, 100]`. + /// The range of component `p` is `[0, 100]`. + fn set_members(m: u32, _n: u32, p: u32, ) -> Weight { + // Minimum execution time: 14_668 nanoseconds. + Weight::from_ref_time(14_668_000) + // Standard Error: 917_728 + .saturating_add(Weight::from_ref_time(4_113_671).saturating_mul(m.into())) + // Standard Error: 917_728 + .saturating_add(Weight::from_ref_time(4_057_451).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(m.into()))) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(p.into()))) + .saturating_add(T::DbWeight::get().writes(2)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(m.into()))) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(p.into()))) + } + // Storage: TechnicalCommittee Members (r:1 w:0) + /// The range of component `b` is `[2, 1024]`. + /// The range of component `m` is `[1, 100]`. + /// The range of component `b` is `[2, 1024]`. + /// The range of component `m` is `[1, 100]`. + fn execute(_b: u32, _m: u32, ) -> Weight { + // Minimum execution time: 18_455 nanoseconds. + Weight::from_ref_time(21_728_250) + .saturating_add(T::DbWeight::get().reads(1)) + } + // Storage: TechnicalCommittee Members (r:1 w:0) + // Storage: TechnicalCommittee ProposalOf (r:1 w:0) + /// The range of component `b` is `[2, 1024]`. + /// The range of component `m` is `[1, 100]`. + /// The range of component `b` is `[2, 1024]`. + /// The range of component `m` is `[1, 100]`. + fn propose_execute(b: u32, m: u32, ) -> Weight { + // Minimum execution time: 20_871 nanoseconds. + Weight::from_ref_time(21_279_706) + // Standard Error: 1_159 + .saturating_add(Weight::from_ref_time(268).saturating_mul(b.into())) + // Standard Error: 11_968 + .saturating_add(Weight::from_ref_time(11_757).saturating_mul(m.into())) + .saturating_add(T::DbWeight::get().reads(2)) + } + // Storage: TechnicalCommittee Members (r:1 w:0) + // Storage: TechnicalCommittee ProposalOf (r:1 w:1) + // Storage: TechnicalCommittee Proposals (r:1 w:1) + // Storage: TechnicalCommittee ProposalCount (r:1 w:1) + // Storage: TechnicalCommittee Voting (r:0 w:1) + /// The range of component `b` is `[2, 1024]`. + /// The range of component `m` is `[2, 100]`. + /// The range of component `p` is `[1, 100]`. + /// The range of component `b` is `[2, 1024]`. + /// The range of component `m` is `[2, 100]`. + /// The range of component `p` is `[1, 100]`. + fn propose_proposed(b: u32, m: u32, p: u32, ) -> Weight { + // Minimum execution time: 27_335 nanoseconds. + Weight::from_ref_time(17_258_081) + // Standard Error: 1_899 + .saturating_add(Weight::from_ref_time(7_941).saturating_mul(b.into())) + // Standard Error: 19_812 + .saturating_add(Weight::from_ref_time(18_405).saturating_mul(m.into())) + // Standard Error: 19_612 + .saturating_add(Weight::from_ref_time(234_724).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(4)) + } + // Storage: TechnicalCommittee Members (r:1 w:0) + // Storage: TechnicalCommittee Voting (r:1 w:1) + /// The range of component `m` is `[5, 100]`. + /// The range of component `m` is `[5, 100]`. + fn vote(m: u32, ) -> Weight { + // Minimum execution time: 33_012 nanoseconds. + Weight::from_ref_time(34_374_394) + // Standard Error: 19_155 + .saturating_add(Weight::from_ref_time(28_321).saturating_mul(m.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: TechnicalCommittee Voting (r:1 w:1) + // Storage: TechnicalCommittee Members (r:1 w:0) + // Storage: TechnicalCommittee Proposals (r:1 w:1) + // Storage: TechnicalCommittee ProposalOf (r:0 w:1) + /// The range of component `m` is `[4, 100]`. + /// The range of component `p` is `[1, 100]`. + /// The range of component `m` is `[4, 100]`. + /// The range of component `p` is `[1, 100]`. + fn close_early_disapproved(m: u32, p: u32, ) -> Weight { + // Minimum execution time: 28_087 nanoseconds. + Weight::from_ref_time(19_825_023) + // Standard Error: 24_337 + .saturating_add(Weight::from_ref_time(83_765).saturating_mul(m.into())) + // Standard Error: 23_599 + .saturating_add(Weight::from_ref_time(272_914).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: TechnicalCommittee Voting (r:1 w:1) + // Storage: TechnicalCommittee Members (r:1 w:0) + // Storage: TechnicalCommittee ProposalOf (r:1 w:1) + // Storage: TechnicalCommittee Proposals (r:1 w:1) + /// The range of component `b` is `[2, 1024]`. + /// The range of component `m` is `[4, 100]`. + /// The range of component `p` is `[1, 100]`. + /// The range of component `b` is `[2, 1024]`. + /// The range of component `m` is `[4, 100]`. + /// The range of component `p` is `[1, 100]`. + fn close_early_approved(_b: u32, m: u32, p: u32, ) -> Weight { + // Minimum execution time: 39_426 nanoseconds. + Weight::from_ref_time(45_353_639) + // Standard Error: 86_006 + .saturating_add(Weight::from_ref_time(77_380).saturating_mul(m.into())) + // Standard Error: 83_400 + .saturating_add(Weight::from_ref_time(167_636).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: TechnicalCommittee Voting (r:1 w:1) + // Storage: TechnicalCommittee Members (r:1 w:0) + // Storage: TechnicalCommittee Prime (r:1 w:0) + // Storage: TechnicalCommittee Proposals (r:1 w:1) + // Storage: TechnicalCommittee ProposalOf (r:0 w:1) + /// The range of component `m` is `[4, 100]`. + /// The range of component `p` is `[1, 100]`. + /// The range of component `m` is `[4, 100]`. + /// The range of component `p` is `[1, 100]`. + fn close_disapproved(m: u32, p: u32, ) -> Weight { + // Minimum execution time: 30_203 nanoseconds. + Weight::from_ref_time(31_999_524) + // Standard Error: 45_091 + .saturating_add(Weight::from_ref_time(17_088).saturating_mul(m.into())) + // Standard Error: 43_724 + .saturating_add(Weight::from_ref_time(198_121).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: TechnicalCommittee Voting (r:1 w:1) + // Storage: TechnicalCommittee Members (r:1 w:0) + // Storage: TechnicalCommittee Prime (r:1 w:0) + // Storage: TechnicalCommittee ProposalOf (r:1 w:1) + // Storage: TechnicalCommittee Proposals (r:1 w:1) + /// The range of component `b` is `[2, 1024]`. + /// The range of component `m` is `[4, 100]`. + /// The range of component `p` is `[1, 100]`. + /// The range of component `b` is `[2, 1024]`. + /// The range of component `m` is `[4, 100]`. + /// The range of component `p` is `[1, 100]`. + fn close_approved(b: u32, m: u32, p: u32, ) -> Weight { + // Minimum execution time: 39_077 nanoseconds. + Weight::from_ref_time(38_010_520) + // Standard Error: 2_018 + .saturating_add(Weight::from_ref_time(2_006).saturating_mul(b.into())) + // Standard Error: 21_491 + .saturating_add(Weight::from_ref_time(9_927).saturating_mul(m.into())) + // Standard Error: 20_840 + .saturating_add(Weight::from_ref_time(213_257).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: TechnicalCommittee Proposals (r:1 w:1) + // Storage: TechnicalCommittee Voting (r:0 w:1) + // Storage: TechnicalCommittee ProposalOf (r:0 w:1) + /// The range of component `p` is `[1, 100]`. + /// The range of component `p` is `[1, 100]`. + fn disapprove_proposal(p: u32, ) -> Weight { + // Minimum execution time: 17_759 nanoseconds. + Weight::from_ref_time(18_497_348) + // Standard Error: 59_579 + .saturating_add(Weight::from_ref_time(264_651).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(3)) + } +} diff --git a/runtime/darwinia/src/weights/pallet_democracy.rs b/runtime/darwinia/src/weights/pallet_democracy.rs new file mode 100644 index 000000000..9ba1beab0 --- /dev/null +++ b/runtime/darwinia/src/weights/pallet_democracy.rs @@ -0,0 +1,252 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `pallet_democracy` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-02-22, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("darwinia-local"), DB CACHE: 1024 + +// Executed Command: +// ./target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --steps +// 2 +// --repeat +// 1 +// --chain +// darwinia-local +// --output +// runtime/darwinia/src/weights/ +// --extrinsic +// * +// --pallet +// * + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_democracy`. +pub struct WeightInfo(PhantomData); +impl pallet_democracy::WeightInfo for WeightInfo { + // Storage: Democracy PublicPropCount (r:1 w:1) + // Storage: Democracy PublicProps (r:1 w:1) + // Storage: Democracy Blacklist (r:1 w:0) + // Storage: Democracy DepositOf (r:0 w:1) + fn propose() -> Weight { + // Minimum execution time: 53_908 nanoseconds. + Weight::from_ref_time(53_908_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: Democracy DepositOf (r:1 w:1) + fn second() -> Weight { + // Minimum execution time: 43_317 nanoseconds. + Weight::from_ref_time(43_317_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Democracy ReferendumInfoOf (r:1 w:1) + // Storage: Democracy VotingOf (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + fn vote_new() -> Weight { + // Minimum execution time: 58_885 nanoseconds. + Weight::from_ref_time(58_885_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: Democracy ReferendumInfoOf (r:1 w:1) + // Storage: Democracy VotingOf (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + fn vote_existing() -> Weight { + // Minimum execution time: 55_337 nanoseconds. + Weight::from_ref_time(55_337_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: Democracy ReferendumInfoOf (r:1 w:1) + // Storage: Democracy Cancellations (r:1 w:1) + fn emergency_cancel() -> Weight { + // Minimum execution time: 31_305 nanoseconds. + Weight::from_ref_time(31_305_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Democracy PublicProps (r:1 w:1) + // Storage: Democracy DepositOf (r:1 w:1) + // Storage: System Account (r:2 w:2) + // Storage: Democracy NextExternal (r:1 w:1) + // Storage: Democracy ReferendumInfoOf (r:1 w:1) + // Storage: Democracy Blacklist (r:0 w:1) + fn blacklist() -> Weight { + // Minimum execution time: 107_680 nanoseconds. + Weight::from_ref_time(107_680_000) + .saturating_add(T::DbWeight::get().reads(6)) + .saturating_add(T::DbWeight::get().writes(7)) + } + // Storage: Democracy NextExternal (r:1 w:1) + // Storage: Democracy Blacklist (r:1 w:0) + fn external_propose() -> Weight { + // Minimum execution time: 30_203 nanoseconds. + Weight::from_ref_time(30_203_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Democracy NextExternal (r:0 w:1) + fn external_propose_majority() -> Weight { + // Minimum execution time: 15_812 nanoseconds. + Weight::from_ref_time(15_812_000) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Democracy NextExternal (r:0 w:1) + fn external_propose_default() -> Weight { + // Minimum execution time: 13_619 nanoseconds. + Weight::from_ref_time(13_619_000) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Democracy NextExternal (r:1 w:1) + // Storage: Democracy ReferendumCount (r:1 w:1) + // Storage: Democracy ReferendumInfoOf (r:0 w:1) + fn fast_track() -> Weight { + // Minimum execution time: 29_413 nanoseconds. + Weight::from_ref_time(29_413_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: Democracy NextExternal (r:1 w:1) + // Storage: Democracy Blacklist (r:1 w:1) + fn veto_external() -> Weight { + // Minimum execution time: 31_903 nanoseconds. + Weight::from_ref_time(31_903_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Democracy PublicProps (r:1 w:1) + // Storage: Democracy DepositOf (r:1 w:1) + // Storage: System Account (r:2 w:2) + fn cancel_proposal() -> Weight { + // Minimum execution time: 80_182 nanoseconds. + Weight::from_ref_time(80_182_000) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(4)) + } + // Storage: Democracy ReferendumInfoOf (r:0 w:1) + fn cancel_referendum() -> Weight { + // Minimum execution time: 30_560 nanoseconds. + Weight::from_ref_time(30_560_000) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Democracy LowestUnbaked (r:1 w:1) + // Storage: Democracy ReferendumCount (r:1 w:0) + // Storage: Democracy ReferendumInfoOf (r:99 w:0) + /// The range of component `r` is `[0, 99]`. + fn on_initialize_base(_r: u32, ) -> Weight { + // Minimum execution time: 16_422 nanoseconds. + Weight::from_ref_time(209_969_000) + .saturating_add(T::DbWeight::get().reads(101)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Democracy LowestUnbaked (r:1 w:1) + // Storage: Democracy ReferendumCount (r:1 w:0) + // Storage: Democracy LastTabledWasExternal (r:1 w:0) + // Storage: Democracy NextExternal (r:1 w:0) + // Storage: Democracy PublicProps (r:1 w:0) + // Storage: Democracy ReferendumInfoOf (r:99 w:0) + /// The range of component `r` is `[0, 99]`. + fn on_initialize_base_with_launch_period(_r: u32, ) -> Weight { + // Minimum execution time: 19_167 nanoseconds. + Weight::from_ref_time(209_035_000) + .saturating_add(T::DbWeight::get().reads(104)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Democracy VotingOf (r:3 w:3) + // Storage: Balances Locks (r:1 w:1) + // Storage: Democracy ReferendumInfoOf (r:99 w:99) + /// The range of component `r` is `[0, 99]`. + fn delegate(_r: u32, ) -> Weight { + // Minimum execution time: 49_679 nanoseconds. + Weight::from_ref_time(353_064_000) + .saturating_add(T::DbWeight::get().reads(103)) + .saturating_add(T::DbWeight::get().writes(103)) + } + // Storage: Democracy VotingOf (r:2 w:2) + // Storage: Democracy ReferendumInfoOf (r:99 w:99) + /// The range of component `r` is `[0, 99]`. + fn undelegate(_r: u32, ) -> Weight { + // Minimum execution time: 29_932 nanoseconds. + Weight::from_ref_time(338_576_000) + .saturating_add(T::DbWeight::get().reads(101)) + .saturating_add(T::DbWeight::get().writes(101)) + } + // Storage: Democracy PublicProps (r:0 w:1) + fn clear_public_proposals() -> Weight { + // Minimum execution time: 7_584 nanoseconds. + Weight::from_ref_time(7_584_000) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Democracy VotingOf (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + // Storage: System Account (r:1 w:1) + /// The range of component `r` is `[0, 99]`. + fn unlock_remove(_r: u32, ) -> Weight { + // Minimum execution time: 36_054 nanoseconds. + Weight::from_ref_time(46_108_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: Democracy VotingOf (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + // Storage: System Account (r:1 w:1) + /// The range of component `r` is `[0, 99]`. + fn unlock_set(_r: u32, ) -> Weight { + // Minimum execution time: 28_813 nanoseconds. + Weight::from_ref_time(41_612_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: Democracy ReferendumInfoOf (r:1 w:1) + // Storage: Democracy VotingOf (r:1 w:1) + /// The range of component `r` is `[1, 100]`. + fn remove_vote(_r: u32, ) -> Weight { + // Minimum execution time: 19_253 nanoseconds. + Weight::from_ref_time(31_925_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Democracy ReferendumInfoOf (r:1 w:1) + // Storage: Democracy VotingOf (r:1 w:1) + /// The range of component `r` is `[1, 100]`. + fn remove_other_vote(_r: u32, ) -> Weight { + // Minimum execution time: 16_424 nanoseconds. + Weight::from_ref_time(30_346_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } +} diff --git a/runtime/darwinia/src/weights/pallet_elections_phragmen.rs b/runtime/darwinia/src/weights/pallet_elections_phragmen.rs new file mode 100644 index 000000000..039088fc9 --- /dev/null +++ b/runtime/darwinia/src/weights/pallet_elections_phragmen.rs @@ -0,0 +1,200 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `pallet_elections_phragmen` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-02-22, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("darwinia-local"), DB CACHE: 1024 + +// Executed Command: +// ./target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --steps +// 2 +// --repeat +// 1 +// --chain +// darwinia-local +// --output +// runtime/darwinia/src/weights/ +// --extrinsic +// * +// --pallet +// * + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_elections_phragmen`. +pub struct WeightInfo(PhantomData); +impl pallet_elections_phragmen::WeightInfo for WeightInfo { + // Storage: PhragmenElection Candidates (r:1 w:0) + // Storage: PhragmenElection Members (r:1 w:0) + // Storage: PhragmenElection RunnersUp (r:1 w:0) + // Storage: PhragmenElection Voting (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + /// The range of component `v` is `[1, 16]`. + fn vote_equal(_v: u32, ) -> Weight { + // Minimum execution time: 32_387 nanoseconds. + Weight::from_ref_time(55_917_000) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: PhragmenElection Candidates (r:1 w:0) + // Storage: PhragmenElection Members (r:1 w:0) + // Storage: PhragmenElection RunnersUp (r:1 w:0) + // Storage: PhragmenElection Voting (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + /// The range of component `v` is `[2, 16]`. + fn vote_more(_v: u32, ) -> Weight { + // Minimum execution time: 44_475 nanoseconds. + Weight::from_ref_time(45_208_000) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: PhragmenElection Candidates (r:1 w:0) + // Storage: PhragmenElection Members (r:1 w:0) + // Storage: PhragmenElection RunnersUp (r:1 w:0) + // Storage: PhragmenElection Voting (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + /// The range of component `v` is `[2, 16]`. + fn vote_less(_v: u32, ) -> Weight { + // Minimum execution time: 47_593 nanoseconds. + Weight::from_ref_time(58_052_000) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: PhragmenElection Voting (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + fn remove_voter() -> Weight { + // Minimum execution time: 75_912 nanoseconds. + Weight::from_ref_time(75_912_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: PhragmenElection Candidates (r:1 w:1) + // Storage: PhragmenElection Members (r:1 w:0) + // Storage: PhragmenElection RunnersUp (r:1 w:0) + /// The range of component `c` is `[1, 30]`. + fn submit_candidacy(_c: u32, ) -> Weight { + // Minimum execution time: 38_577 nanoseconds. + Weight::from_ref_time(41_908_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: PhragmenElection Candidates (r:1 w:1) + /// The range of component `c` is `[1, 30]`. + fn renounce_candidacy_candidate(_c: u32, ) -> Weight { + // Minimum execution time: 35_398 nanoseconds. + Weight::from_ref_time(35_736_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: PhragmenElection Members (r:1 w:1) + // Storage: PhragmenElection RunnersUp (r:1 w:1) + // Storage: Council Prime (r:1 w:1) + // Storage: Council Proposals (r:1 w:0) + // Storage: Council Members (r:0 w:1) + fn renounce_candidacy_members() -> Weight { + // Minimum execution time: 45_908 nanoseconds. + Weight::from_ref_time(45_908_000) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(4)) + } + // Storage: PhragmenElection RunnersUp (r:1 w:1) + fn renounce_candidacy_runners_up() -> Weight { + // Minimum execution time: 36_005 nanoseconds. + Weight::from_ref_time(36_005_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Benchmark Override (r:0 w:0) + fn remove_member_without_replacement() -> Weight { + // Minimum execution time: 500_000_000 nanoseconds. + Weight::from_ref_time(500_000_000_000) + } + // Storage: PhragmenElection Members (r:1 w:1) + // Storage: System Account (r:2 w:2) + // Storage: PhragmenElection RunnersUp (r:1 w:1) + // Storage: Council Prime (r:1 w:1) + // Storage: Council Proposals (r:1 w:0) + // Storage: Council Members (r:0 w:1) + fn remove_member_with_replacement() -> Weight { + // Minimum execution time: 61_680 nanoseconds. + Weight::from_ref_time(61_680_000) + .saturating_add(T::DbWeight::get().reads(6)) + .saturating_add(T::DbWeight::get().writes(6)) + } + // Storage: PhragmenElection Voting (r:151 w:150) + // Storage: PhragmenElection Members (r:1 w:0) + // Storage: PhragmenElection RunnersUp (r:1 w:0) + // Storage: PhragmenElection Candidates (r:1 w:0) + // Storage: Balances Locks (r:150 w:150) + // Storage: System Account (r:150 w:150) + /// The range of component `v` is `[150, 300]`. + /// The range of component `d` is `[0, 150]`. + fn clean_defunct_voters(v: u32, _d: u32, ) -> Weight { + // Minimum execution time: 7_077_531 nanoseconds. + Weight::from_ref_time(432_061_000) + // Standard Error: 641_210 + .saturating_add(Weight::from_ref_time(45_007_843).saturating_mul(v.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().reads((3_u64).saturating_mul(v.into()))) + .saturating_add(T::DbWeight::get().writes((3_u64).saturating_mul(v.into()))) + } + // Storage: PhragmenElection Candidates (r:1 w:1) + // Storage: PhragmenElection Members (r:1 w:1) + // Storage: PhragmenElection RunnersUp (r:1 w:1) + // Storage: PhragmenElection Voting (r:301 w:0) + // Storage: Council Proposals (r:1 w:0) + // Storage: PhragmenElection ElectionRounds (r:1 w:1) + // Storage: Council Members (r:0 w:1) + // Storage: Council Prime (r:0 w:1) + // Storage: System Account (r:17 w:17) + /// The range of component `c` is `[1, 30]`. + /// The range of component `v` is `[1, 300]`. + /// The range of component `e` is `[300, 4800]`. + fn election_phragmen(c: u32, v: u32, e: u32, ) -> Weight { + // Minimum execution time: 539_405 nanoseconds. + Weight::from_ref_time(539_405_000) + // Standard Error: 64_891_943 + .saturating_add(Weight::from_ref_time(37_431_949).saturating_mul(c.into())) + // Standard Error: 6_397_054 + .saturating_add(Weight::from_ref_time(7_749_021).saturating_mul(v.into())) + // Standard Error: 410_852 + .saturating_add(Weight::from_ref_time(142_671).saturating_mul(e.into())) + .saturating_add(T::DbWeight::get().reads(35)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(c.into()))) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(v.into()))) + .saturating_add(T::DbWeight::get().writes(5)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(c.into()))) + } +} diff --git a/runtime/darwinia/src/weights/pallet_fee_market.rs b/runtime/darwinia/src/weights/pallet_fee_market.rs new file mode 100644 index 000000000..d67801cda --- /dev/null +++ b/runtime/darwinia/src/weights/pallet_fee_market.rs @@ -0,0 +1,139 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `pallet_fee_market` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-02-22, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("darwinia-local"), DB CACHE: 1024 + +// Executed Command: +// ./target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --steps +// 2 +// --repeat +// 1 +// --chain +// darwinia-local +// --output +// runtime/darwinia/src/weights/ +// --extrinsic +// * +// --pallet +// * + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_fee_market`. +pub struct WeightInfo(PhantomData); +impl pallet_fee_market::WeightInfo for WeightInfo { + // Storage: CrabFeeMarket Relayers (r:1 w:1) + // Storage: System Account (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + // Storage: CrabFeeMarket RelayersMap (r:10 w:1) + // Storage: CrabFeeMarket Orders (r:1 w:0) + // Storage: CrabFeeMarket AssignedRelayersNumber (r:1 w:0) + // Storage: CrabFeeMarket AssignedRelayers (r:0 w:1) + fn enroll_and_lock_collateral() -> Weight { + // Minimum execution time: 98_604 nanoseconds. + Weight::from_ref_time(98_604_000) + .saturating_add(T::DbWeight::get().reads(15)) + .saturating_add(T::DbWeight::get().writes(5)) + } + // Storage: CrabFeeMarket Relayers (r:1 w:0) + // Storage: System Account (r:1 w:1) + // Storage: CrabFeeMarket RelayersMap (r:10 w:1) + // Storage: Balances Locks (r:1 w:1) + // Storage: CrabFeeMarket Orders (r:1 w:0) + // Storage: CrabFeeMarket AssignedRelayersNumber (r:1 w:0) + // Storage: CrabFeeMarket AssignedRelayers (r:0 w:1) + fn increase_locked_collateral() -> Weight { + // Minimum execution time: 98_488 nanoseconds. + Weight::from_ref_time(98_488_000) + .saturating_add(T::DbWeight::get().reads(15)) + .saturating_add(T::DbWeight::get().writes(4)) + } + // Storage: CrabFeeMarket Relayers (r:1 w:0) + // Storage: System Account (r:1 w:1) + // Storage: CrabFeeMarket RelayersMap (r:10 w:1) + // Storage: CrabFeeMarket Orders (r:1 w:0) + // Storage: Balances Locks (r:1 w:1) + // Storage: CrabFeeMarket AssignedRelayersNumber (r:1 w:0) + // Storage: CrabFeeMarket AssignedRelayers (r:0 w:1) + fn decrease_locked_collateral() -> Weight { + // Minimum execution time: 103_486 nanoseconds. + Weight::from_ref_time(103_486_000) + .saturating_add(T::DbWeight::get().reads(15)) + .saturating_add(T::DbWeight::get().writes(4)) + } + // Storage: CrabFeeMarket Relayers (r:1 w:0) + // Storage: CrabFeeMarket RelayersMap (r:10 w:1) + // Storage: CrabFeeMarket Orders (r:1 w:0) + // Storage: CrabFeeMarket AssignedRelayersNumber (r:1 w:0) + // Storage: CrabFeeMarket AssignedRelayers (r:0 w:1) + fn update_relay_fee() -> Weight { + // Minimum execution time: 82_189 nanoseconds. + Weight::from_ref_time(82_189_000) + .saturating_add(T::DbWeight::get().reads(13)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: CrabFeeMarket Relayers (r:1 w:1) + // Storage: CrabFeeMarket Orders (r:1 w:0) + // Storage: Balances Locks (r:1 w:1) + // Storage: System Account (r:1 w:1) + // Storage: CrabFeeMarket AssignedRelayers (r:1 w:1) + // Storage: CrabFeeMarket RelayersMap (r:9 w:1) + // Storage: CrabFeeMarket AssignedRelayersNumber (r:1 w:0) + fn cancel_enrollment() -> Weight { + // Minimum execution time: 100_402 nanoseconds. + Weight::from_ref_time(100_402_000) + .saturating_add(T::DbWeight::get().reads(15)) + .saturating_add(T::DbWeight::get().writes(5)) + } + // Storage: CrabFeeMarket CollateralSlashProtect (r:0 w:1) + fn set_slash_protect() -> Weight { + // Minimum execution time: 30_534 nanoseconds. + Weight::from_ref_time(30_534_000) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: CrabFeeMarket Relayers (r:1 w:0) + // Storage: CrabFeeMarket RelayersMap (r:10 w:0) + // Storage: CrabFeeMarket Orders (r:1 w:0) + // Storage: CrabFeeMarket AssignedRelayers (r:0 w:1) + // Storage: CrabFeeMarket AssignedRelayersNumber (r:0 w:1) + fn set_assigned_relayers_number() -> Weight { + // Minimum execution time: 78_289 nanoseconds. + Weight::from_ref_time(78_289_000) + .saturating_add(T::DbWeight::get().reads(12)) + .saturating_add(T::DbWeight::get().writes(2)) + } +} diff --git a/runtime/darwinia/src/weights/pallet_identity.rs b/runtime/darwinia/src/weights/pallet_identity.rs new file mode 100644 index 000000000..8ade261ba --- /dev/null +++ b/runtime/darwinia/src/weights/pallet_identity.rs @@ -0,0 +1,238 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `pallet_identity` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-02-22, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("darwinia-local"), DB CACHE: 1024 + +// Executed Command: +// ./target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --steps +// 2 +// --repeat +// 1 +// --chain +// darwinia-local +// --output +// runtime/darwinia/src/weights/ +// --extrinsic +// * +// --pallet +// * + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_identity`. +pub struct WeightInfo(PhantomData); +impl pallet_identity::WeightInfo for WeightInfo { + // Storage: Identity Registrars (r:1 w:1) + /// The range of component `r` is `[1, 19]`. + fn add_registrar(_r: u32, ) -> Weight { + // Minimum execution time: 19_856 nanoseconds. + Weight::from_ref_time(26_600_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Identity IdentityOf (r:1 w:1) + /// The range of component `r` is `[1, 20]`. + /// The range of component `x` is `[0, 100]`. + fn set_identity(r: u32, x: u32, ) -> Weight { + // Minimum execution time: 47_774 nanoseconds. + Weight::from_ref_time(35_439_263) + // Standard Error: 131_088 + .saturating_add(Weight::from_ref_time(616_736).saturating_mul(r.into())) + // Standard Error: 24_906 + .saturating_add(Weight::from_ref_time(404_230).saturating_mul(x.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Identity IdentityOf (r:1 w:0) + // Storage: Identity SubsOf (r:1 w:1) + // Storage: Identity SuperOf (r:100 w:100) + /// The range of component `s` is `[0, 100]`. + fn set_subs_new(_s: u32, ) -> Weight { + // Minimum execution time: 12_921 nanoseconds. + Weight::from_ref_time(288_929_000) + .saturating_add(T::DbWeight::get().reads(102)) + .saturating_add(T::DbWeight::get().writes(101)) + } + // Storage: Identity IdentityOf (r:1 w:0) + // Storage: Identity SubsOf (r:1 w:1) + // Storage: Identity SuperOf (r:0 w:100) + /// The range of component `p` is `[0, 100]`. + fn set_subs_old(_p: u32, ) -> Weight { + // Minimum execution time: 11_683 nanoseconds. + Weight::from_ref_time(134_782_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(101)) + } + // Storage: Identity SubsOf (r:1 w:1) + // Storage: Identity IdentityOf (r:1 w:1) + // Storage: Identity SuperOf (r:0 w:100) + /// The range of component `r` is `[1, 20]`. + /// The range of component `s` is `[0, 100]`. + /// The range of component `x` is `[0, 100]`. + fn clear_identity(r: u32, s: u32, x: u32, ) -> Weight { + // Minimum execution time: 64_452 nanoseconds. + Weight::from_ref_time(36_380_315) + // Standard Error: 329_626 + .saturating_add(Weight::from_ref_time(400_684).saturating_mul(r.into())) + // Standard Error: 62_629 + .saturating_add(Weight::from_ref_time(946_630).saturating_mul(s.into())) + // Standard Error: 62_629 + .saturating_add(Weight::from_ref_time(200_580).saturating_mul(x.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(s.into()))) + } + // Storage: Identity Registrars (r:1 w:0) + // Storage: Identity IdentityOf (r:1 w:1) + /// The range of component `r` is `[1, 20]`. + /// The range of component `x` is `[0, 100]`. + fn request_judgement(r: u32, x: u32, ) -> Weight { + // Minimum execution time: 46_179 nanoseconds. + Weight::from_ref_time(44_543_210) + // Standard Error: 8_386 + .saturating_add(Weight::from_ref_time(81_789).saturating_mul(r.into())) + // Standard Error: 1_593 + .saturating_add(Weight::from_ref_time(290_800).saturating_mul(x.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Identity IdentityOf (r:1 w:1) + /// The range of component `r` is `[1, 20]`. + /// The range of component `x` is `[0, 100]`. + fn cancel_request(_r: u32, x: u32, ) -> Weight { + // Minimum execution time: 42_801 nanoseconds. + Weight::from_ref_time(65_826_263) + // Standard Error: 61_158 + .saturating_add(Weight::from_ref_time(329_190).saturating_mul(x.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Identity Registrars (r:1 w:1) + /// The range of component `r` is `[1, 19]`. + fn set_fee(_r: u32, ) -> Weight { + // Minimum execution time: 10_090 nanoseconds. + Weight::from_ref_time(13_903_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Identity Registrars (r:1 w:1) + /// The range of component `r` is `[1, 19]`. + fn set_account_id(_r: u32, ) -> Weight { + // Minimum execution time: 11_794 nanoseconds. + Weight::from_ref_time(12_456_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Identity Registrars (r:1 w:1) + /// The range of component `r` is `[1, 19]`. + fn set_fields(_r: u32, ) -> Weight { + // Minimum execution time: 10_215 nanoseconds. + Weight::from_ref_time(12_887_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Identity Registrars (r:1 w:0) + // Storage: Identity IdentityOf (r:1 w:1) + /// The range of component `r` is `[1, 19]`. + /// The range of component `x` is `[0, 100]`. + fn provide_judgement(_r: u32, x: u32, ) -> Weight { + // Minimum execution time: 27_453 nanoseconds. + Weight::from_ref_time(38_010_138) + // Standard Error: 24_049 + .saturating_add(Weight::from_ref_time(620_985).saturating_mul(x.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Identity SubsOf (r:1 w:1) + // Storage: Identity IdentityOf (r:1 w:1) + // Storage: System Account (r:2 w:2) + // Storage: Identity SuperOf (r:0 w:100) + /// The range of component `r` is `[1, 20]`. + /// The range of component `s` is `[0, 100]`. + /// The range of component `x` is `[0, 100]`. + fn kill_identity(r: u32, s: u32, x: u32, ) -> Weight { + // Minimum execution time: 74_776 nanoseconds. + Weight::from_ref_time(49_486_105) + // Standard Error: 262_618 + .saturating_add(Weight::from_ref_time(96_561).saturating_mul(r.into())) + // Standard Error: 49_897 + .saturating_add(Weight::from_ref_time(993_516).saturating_mul(s.into())) + // Standard Error: 49_897 + .saturating_add(Weight::from_ref_time(233_586).saturating_mul(x.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(3)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(s.into()))) + } + // Storage: Identity IdentityOf (r:1 w:0) + // Storage: Identity SuperOf (r:1 w:1) + // Storage: Identity SubsOf (r:1 w:1) + /// The range of component `s` is `[0, 99]`. + fn add_sub(_s: u32, ) -> Weight { + // Minimum execution time: 35_413 nanoseconds. + Weight::from_ref_time(45_828_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Identity IdentityOf (r:1 w:0) + // Storage: Identity SuperOf (r:1 w:1) + /// The range of component `s` is `[1, 100]`. + fn rename_sub(_s: u32, ) -> Weight { + // Minimum execution time: 14_774 nanoseconds. + Weight::from_ref_time(21_884_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Identity IdentityOf (r:1 w:0) + // Storage: Identity SuperOf (r:1 w:1) + // Storage: Identity SubsOf (r:1 w:1) + /// The range of component `s` is `[1, 100]`. + fn remove_sub(_s: u32, ) -> Weight { + // Minimum execution time: 38_793 nanoseconds. + Weight::from_ref_time(50_556_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Identity SuperOf (r:1 w:1) + // Storage: Identity SubsOf (r:1 w:1) + /// The range of component `s` is `[0, 99]`. + fn quit_sub(_s: u32, ) -> Weight { + // Minimum execution time: 26_789 nanoseconds. + Weight::from_ref_time(35_674_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } +} diff --git a/runtime/darwinia/src/weights/pallet_membership.rs b/runtime/darwinia/src/weights/pallet_membership.rs new file mode 100644 index 000000000..9d905e884 --- /dev/null +++ b/runtime/darwinia/src/weights/pallet_membership.rs @@ -0,0 +1,136 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `pallet_membership` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-02-22, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("darwinia-local"), DB CACHE: 1024 + +// Executed Command: +// ./target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --steps +// 2 +// --repeat +// 1 +// --chain +// darwinia-local +// --output +// runtime/darwinia/src/weights/ +// --extrinsic +// * +// --pallet +// * + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_membership`. +pub struct WeightInfo(PhantomData); +impl pallet_membership::WeightInfo for WeightInfo { + // Storage: TechnicalMembership Members (r:1 w:1) + // Storage: TechnicalCommittee Proposals (r:1 w:0) + // Storage: TechnicalCommittee Members (r:0 w:1) + // Storage: TechnicalCommittee Prime (r:0 w:1) + /// The range of component `m` is `[1, 99]`. + fn add_member(_m: u32, ) -> Weight { + // Minimum execution time: 22_770 nanoseconds. + Weight::from_ref_time(25_996_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: TechnicalMembership Members (r:1 w:1) + // Storage: TechnicalCommittee Proposals (r:1 w:0) + // Storage: TechnicalMembership Prime (r:1 w:0) + // Storage: TechnicalCommittee Members (r:0 w:1) + // Storage: TechnicalCommittee Prime (r:0 w:1) + /// The range of component `m` is `[2, 100]`. + fn remove_member(_m: u32, ) -> Weight { + // Minimum execution time: 23_888 nanoseconds. + Weight::from_ref_time(27_661_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: TechnicalMembership Members (r:1 w:1) + // Storage: TechnicalCommittee Proposals (r:1 w:0) + // Storage: TechnicalMembership Prime (r:1 w:0) + // Storage: TechnicalCommittee Members (r:0 w:1) + // Storage: TechnicalCommittee Prime (r:0 w:1) + /// The range of component `m` is `[2, 100]`. + fn swap_member(_m: u32, ) -> Weight { + // Minimum execution time: 26_532 nanoseconds. + Weight::from_ref_time(31_077_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: TechnicalMembership Members (r:1 w:1) + // Storage: TechnicalCommittee Proposals (r:1 w:0) + // Storage: TechnicalMembership Prime (r:1 w:0) + // Storage: TechnicalCommittee Members (r:0 w:1) + // Storage: TechnicalCommittee Prime (r:0 w:1) + /// The range of component `m` is `[1, 100]`. + fn reset_member(_m: u32, ) -> Weight { + // Minimum execution time: 24_395 nanoseconds. + Weight::from_ref_time(35_919_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: TechnicalMembership Members (r:1 w:1) + // Storage: TechnicalCommittee Proposals (r:1 w:0) + // Storage: TechnicalMembership Prime (r:1 w:1) + // Storage: TechnicalCommittee Members (r:0 w:1) + // Storage: TechnicalCommittee Prime (r:0 w:1) + /// The range of component `m` is `[1, 100]`. + fn change_key(_m: u32, ) -> Weight { + // Minimum execution time: 25_245 nanoseconds. + Weight::from_ref_time(33_801_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(4)) + } + // Storage: TechnicalMembership Members (r:1 w:0) + // Storage: TechnicalMembership Prime (r:0 w:1) + // Storage: TechnicalCommittee Prime (r:0 w:1) + /// The range of component `m` is `[1, 100]`. + fn set_prime(_m: u32, ) -> Weight { + // Minimum execution time: 9_124 nanoseconds. + Weight::from_ref_time(9_319_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: TechnicalMembership Prime (r:0 w:1) + // Storage: TechnicalCommittee Prime (r:0 w:1) + /// The range of component `m` is `[1, 100]`. + fn clear_prime(_m: u32, ) -> Weight { + // Minimum execution time: 5_281 nanoseconds. + Weight::from_ref_time(5_403_000) + .saturating_add(T::DbWeight::get().writes(2)) + } +} diff --git a/runtime/darwinia/src/weights/pallet_multisig.rs b/runtime/darwinia/src/weights/pallet_multisig.rs new file mode 100644 index 000000000..f8c783be0 --- /dev/null +++ b/runtime/darwinia/src/weights/pallet_multisig.rs @@ -0,0 +1,128 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `pallet_multisig` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-02-22, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("darwinia-local"), DB CACHE: 1024 + +// Executed Command: +// ./target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --steps +// 2 +// --repeat +// 1 +// --chain +// darwinia-local +// --output +// runtime/darwinia/src/weights/ +// --extrinsic +// * +// --pallet +// * + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_multisig`. +pub struct WeightInfo(PhantomData); +impl pallet_multisig::WeightInfo for WeightInfo { + /// The range of component `z` is `[0, 10000]`. + fn as_multi_threshold_1(_z: u32, ) -> Weight { + // Minimum execution time: 31_203 nanoseconds. + Weight::from_ref_time(34_003_000) + } + // Storage: Multisig Multisigs (r:1 w:1) + // Storage: unknown [0x3a65787472696e7369635f696e646578] (r:1 w:0) + /// The range of component `s` is `[2, 100]`. + /// The range of component `z` is `[0, 10000]`. + fn as_multi_create(_s: u32, z: u32, ) -> Weight { + // Minimum execution time: 62_662 nanoseconds. + Weight::from_ref_time(70_789_551) + // Standard Error: 205 + .saturating_add(Weight::from_ref_time(1_601).saturating_mul(z.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Multisig Multisigs (r:1 w:1) + /// The range of component `s` is `[3, 100]`. + /// The range of component `z` is `[0, 10000]`. + fn as_multi_approve(s: u32, z: u32, ) -> Weight { + // Minimum execution time: 33_547 nanoseconds. + Weight::from_ref_time(18_171_226) + // Standard Error: 44_310 + .saturating_add(Weight::from_ref_time(153_757).saturating_mul(s.into())) + // Standard Error: 429 + .saturating_add(Weight::from_ref_time(2_315).saturating_mul(z.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Multisig Multisigs (r:1 w:1) + // Storage: System Account (r:1 w:1) + /// The range of component `s` is `[2, 100]`. + /// The range of component `z` is `[0, 10000]`. + fn as_multi_complete(s: u32, z: u32, ) -> Weight { + // Minimum execution time: 50_131 nanoseconds. + Weight::from_ref_time(37_518_673) + // Standard Error: 40_862 + .saturating_add(Weight::from_ref_time(158_163).saturating_mul(s.into())) + // Standard Error: 400 + .saturating_add(Weight::from_ref_time(1_229).saturating_mul(z.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Multisig Multisigs (r:1 w:1) + // Storage: unknown [0x3a65787472696e7369635f696e646578] (r:1 w:0) + /// The range of component `s` is `[2, 100]`. + fn approve_as_multi_create(_s: u32, ) -> Weight { + // Minimum execution time: 54_869 nanoseconds. + Weight::from_ref_time(64_526_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Multisig Multisigs (r:1 w:1) + /// The range of component `s` is `[2, 100]`. + fn approve_as_multi_approve(_s: u32, ) -> Weight { + // Minimum execution time: 24_490 nanoseconds. + Weight::from_ref_time(37_222_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Multisig Multisigs (r:1 w:1) + /// The range of component `s` is `[2, 100]`. + fn cancel_as_multi(_s: u32, ) -> Weight { + // Minimum execution time: 39_999 nanoseconds. + Weight::from_ref_time(49_556_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } +} diff --git a/runtime/darwinia/src/weights/pallet_preimage.rs b/runtime/darwinia/src/weights/pallet_preimage.rs new file mode 100644 index 000000000..ef822dc9f --- /dev/null +++ b/runtime/darwinia/src/weights/pallet_preimage.rs @@ -0,0 +1,152 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `pallet_preimage` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-02-22, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("darwinia-local"), DB CACHE: 1024 + +// Executed Command: +// ./target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --steps +// 2 +// --repeat +// 1 +// --chain +// darwinia-local +// --output +// runtime/darwinia/src/weights/ +// --extrinsic +// * +// --pallet +// * + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_preimage`. +pub struct WeightInfo(PhantomData); +impl pallet_preimage::WeightInfo for WeightInfo { + // Storage: Preimage StatusFor (r:1 w:1) + // Storage: Preimage PreimageFor (r:0 w:1) + /// The range of component `s` is `[0, 4194304]`. + fn note_preimage(_s: u32, ) -> Weight { + // Minimum execution time: 44_211 nanoseconds. + Weight::from_ref_time(6_200_505_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Preimage StatusFor (r:1 w:1) + // Storage: Preimage PreimageFor (r:0 w:1) + /// The range of component `s` is `[0, 4194304]`. + fn note_requested_preimage(_s: u32, ) -> Weight { + // Minimum execution time: 36_005 nanoseconds. + Weight::from_ref_time(6_177_254_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Preimage StatusFor (r:1 w:1) + // Storage: Preimage PreimageFor (r:0 w:1) + /// The range of component `s` is `[0, 4194304]`. + fn note_no_deposit_preimage(_s: u32, ) -> Weight { + // Minimum execution time: 28_796 nanoseconds. + Weight::from_ref_time(6_511_190_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Preimage StatusFor (r:1 w:1) + // Storage: Preimage PreimageFor (r:0 w:1) + fn unnote_preimage() -> Weight { + // Minimum execution time: 222_296 nanoseconds. + Weight::from_ref_time(222_296_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Preimage StatusFor (r:1 w:1) + // Storage: Preimage PreimageFor (r:0 w:1) + fn unnote_no_deposit_preimage() -> Weight { + // Minimum execution time: 166_228 nanoseconds. + Weight::from_ref_time(166_228_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Preimage StatusFor (r:1 w:1) + fn request_preimage() -> Weight { + // Minimum execution time: 152_026 nanoseconds. + Weight::from_ref_time(152_026_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Preimage StatusFor (r:1 w:1) + fn request_no_deposit_preimage() -> Weight { + // Minimum execution time: 184_048 nanoseconds. + Weight::from_ref_time(184_048_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Preimage StatusFor (r:1 w:1) + fn request_unnoted_preimage() -> Weight { + // Minimum execution time: 44_110 nanoseconds. + Weight::from_ref_time(44_110_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Preimage StatusFor (r:1 w:1) + fn request_requested_preimage() -> Weight { + // Minimum execution time: 10_235 nanoseconds. + Weight::from_ref_time(10_235_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Preimage StatusFor (r:1 w:1) + // Storage: Preimage PreimageFor (r:0 w:1) + fn unrequest_preimage() -> Weight { + // Minimum execution time: 163_291 nanoseconds. + Weight::from_ref_time(163_291_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Preimage StatusFor (r:1 w:1) + fn unrequest_unnoted_preimage() -> Weight { + // Minimum execution time: 11_006 nanoseconds. + Weight::from_ref_time(11_006_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Preimage StatusFor (r:1 w:1) + fn unrequest_multi_referenced_preimage() -> Weight { + // Minimum execution time: 10_645 nanoseconds. + Weight::from_ref_time(10_645_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } +} diff --git a/runtime/darwinia/src/weights/pallet_proxy.rs b/runtime/darwinia/src/weights/pallet_proxy.rs new file mode 100644 index 000000000..55980561b --- /dev/null +++ b/runtime/darwinia/src/weights/pallet_proxy.rs @@ -0,0 +1,157 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `pallet_proxy` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-02-22, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("darwinia-local"), DB CACHE: 1024 + +// Executed Command: +// ./target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --steps +// 2 +// --repeat +// 1 +// --chain +// darwinia-local +// --output +// runtime/darwinia/src/weights/ +// --extrinsic +// * +// --pallet +// * + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_proxy`. +pub struct WeightInfo(PhantomData); +impl pallet_proxy::WeightInfo for WeightInfo { + // Storage: Proxy Proxies (r:1 w:0) + /// The range of component `p` is `[1, 31]`. + fn proxy(_p: u32, ) -> Weight { + // Minimum execution time: 26_218 nanoseconds. + Weight::from_ref_time(68_904_000) + .saturating_add(T::DbWeight::get().reads(1)) + } + // Storage: Proxy Proxies (r:1 w:0) + // Storage: Proxy Announcements (r:1 w:1) + // Storage: System Account (r:1 w:1) + /// The range of component `a` is `[0, 31]`. + /// The range of component `p` is `[1, 31]`. + fn proxy_announced(a: u32, _p: u32, ) -> Weight { + // Minimum execution time: 41_142 nanoseconds. + Weight::from_ref_time(44_389_250) + // Standard Error: 178_932 + .saturating_add(Weight::from_ref_time(254_661).saturating_mul(a.into())) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Proxy Announcements (r:1 w:1) + // Storage: System Account (r:1 w:1) + /// The range of component `a` is `[0, 31]`. + /// The range of component `p` is `[1, 31]`. + fn remove_announcement(_a: u32, _p: u32, ) -> Weight { + // Minimum execution time: 31_301 nanoseconds. + Weight::from_ref_time(39_173_966) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Proxy Announcements (r:1 w:1) + // Storage: System Account (r:1 w:1) + /// The range of component `a` is `[0, 31]`. + /// The range of component `p` is `[1, 31]`. + fn reject_announcement(a: u32, p: u32, ) -> Weight { + // Minimum execution time: 30_436 nanoseconds. + Weight::from_ref_time(32_865_650) + // Standard Error: 292_241 + .saturating_add(Weight::from_ref_time(89_500).saturating_mul(a.into())) + // Standard Error: 301_983 + .saturating_add(Weight::from_ref_time(850).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Proxy Proxies (r:1 w:0) + // Storage: Proxy Announcements (r:1 w:1) + // Storage: System Account (r:1 w:1) + /// The range of component `a` is `[0, 31]`. + /// The range of component `p` is `[1, 31]`. + fn announce(a: u32, _p: u32, ) -> Weight { + // Minimum execution time: 37_692 nanoseconds. + Weight::from_ref_time(39_049_800) + // Standard Error: 8_045 + .saturating_add(Weight::from_ref_time(111_129).saturating_mul(a.into())) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Proxy Proxies (r:1 w:1) + /// The range of component `p` is `[1, 31]`. + fn add_proxy(_p: u32, ) -> Weight { + // Minimum execution time: 31_193 nanoseconds. + Weight::from_ref_time(31_384_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Proxy Proxies (r:1 w:1) + /// The range of component `p` is `[1, 31]`. + fn remove_proxy(_p: u32, ) -> Weight { + // Minimum execution time: 32_743 nanoseconds. + Weight::from_ref_time(33_496_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Proxy Proxies (r:1 w:1) + /// The range of component `p` is `[1, 31]`. + fn remove_proxies(_p: u32, ) -> Weight { + // Minimum execution time: 28_269 nanoseconds. + Weight::from_ref_time(28_605_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: unknown [0x3a65787472696e7369635f696e646578] (r:1 w:0) + // Storage: Proxy Proxies (r:1 w:1) + /// The range of component `p` is `[1, 31]`. + fn create_pure(_p: u32, ) -> Weight { + // Minimum execution time: 38_828 nanoseconds. + Weight::from_ref_time(39_233_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Proxy Proxies (r:1 w:1) + /// The range of component `p` is `[0, 30]`. + fn kill_pure(_p: u32, ) -> Weight { + // Minimum execution time: 28_262 nanoseconds. + Weight::from_ref_time(32_774_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } +} diff --git a/runtime/darwinia/src/weights/pallet_scheduler.rs b/runtime/darwinia/src/weights/pallet_scheduler.rs new file mode 100644 index 000000000..a7dcb95ea --- /dev/null +++ b/runtime/darwinia/src/weights/pallet_scheduler.rs @@ -0,0 +1,140 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `pallet_scheduler` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-02-22, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("darwinia-local"), DB CACHE: 1024 + +// Executed Command: +// ./target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --steps +// 2 +// --repeat +// 1 +// --chain +// darwinia-local +// --output +// runtime/darwinia/src/weights/ +// --extrinsic +// * +// --pallet +// * + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_scheduler`. +pub struct WeightInfo(PhantomData); +impl pallet_scheduler::WeightInfo for WeightInfo { + // Storage: Scheduler IncompleteSince (r:1 w:1) + fn service_agendas_base() -> Weight { + // Minimum execution time: 13_716 nanoseconds. + Weight::from_ref_time(13_716_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Scheduler Agenda (r:1 w:1) + /// The range of component `s` is `[0, 50]`. + fn service_agenda_base(_s: u32, ) -> Weight { + // Minimum execution time: 13_429 nanoseconds. + Weight::from_ref_time(42_290_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + fn service_task_base() -> Weight { + // Minimum execution time: 22_162 nanoseconds. + Weight::from_ref_time(22_162_000) + } + // Storage: Preimage PreimageFor (r:1 w:1) + // Storage: Preimage StatusFor (r:1 w:1) + /// The range of component `s` is `[128, 4194304]`. + fn service_task_fetched(_s: u32, ) -> Weight { + // Minimum execution time: 36_837 nanoseconds. + Weight::from_ref_time(4_700_884_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Scheduler Lookup (r:0 w:1) + fn service_task_named() -> Weight { + // Minimum execution time: 36_616 nanoseconds. + Weight::from_ref_time(36_616_000) + .saturating_add(T::DbWeight::get().writes(1)) + } + fn service_task_periodic() -> Weight { + // Minimum execution time: 24_013 nanoseconds. + Weight::from_ref_time(24_013_000) + } + fn execute_dispatch_signed() -> Weight { + // Minimum execution time: 17_446 nanoseconds. + Weight::from_ref_time(17_446_000) + } + fn execute_dispatch_unsigned() -> Weight { + // Minimum execution time: 16_930 nanoseconds. + Weight::from_ref_time(16_930_000) + } + // Storage: Scheduler Agenda (r:1 w:1) + /// The range of component `s` is `[0, 49]`. + fn schedule(_s: u32, ) -> Weight { + // Minimum execution time: 36_519 nanoseconds. + Weight::from_ref_time(65_491_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Scheduler Agenda (r:1 w:1) + // Storage: Scheduler Lookup (r:0 w:1) + /// The range of component `s` is `[1, 50]`. + fn cancel(_s: u32, ) -> Weight { + // Minimum execution time: 36_919 nanoseconds. + Weight::from_ref_time(72_798_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Scheduler Lookup (r:1 w:1) + // Storage: Scheduler Agenda (r:1 w:1) + /// The range of component `s` is `[0, 49]`. + fn schedule_named(_s: u32, ) -> Weight { + // Minimum execution time: 41_604 nanoseconds. + Weight::from_ref_time(70_534_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Scheduler Lookup (r:1 w:1) + // Storage: Scheduler Agenda (r:1 w:1) + /// The range of component `s` is `[1, 50]`. + fn cancel_named(_s: u32, ) -> Weight { + // Minimum execution time: 38_784 nanoseconds. + Weight::from_ref_time(81_746_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } +} diff --git a/runtime/darwinia/src/weights/pallet_session.rs b/runtime/darwinia/src/weights/pallet_session.rs index 25b1d6d3e..5ae158237 100644 --- a/runtime/darwinia/src/weights/pallet_session.rs +++ b/runtime/darwinia/src/weights/pallet_session.rs @@ -19,12 +19,12 @@ //! Autogenerated weights for `pallet_session` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2022-11-09, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! HOSTNAME: `inv.cafe`, CPU: `AMD Ryzen 9 5950X 16-Core Processor` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("local"), DB CACHE: 1024 +//! DATE: 2023-02-22, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("darwinia-local"), DB CACHE: 1024 // Executed Command: -// target/release/darwinia +// ./target/release/darwinia // benchmark // pallet // --header @@ -33,14 +33,18 @@ // wasm // --heap-pages // 4096 +// --steps +// 2 +// --repeat +// 1 // --chain -// local +// darwinia-local // --output -// runtime/src/weights +// runtime/darwinia/src/weights/ // --extrinsic // * // --pallet -// pallet-session +// * #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -55,15 +59,17 @@ impl pallet_session::WeightInfo for WeightInfo { // Storage: Session NextKeys (r:1 w:1) // Storage: Session KeyOwner (r:1 w:1) fn set_keys() -> Weight { - Weight::from_ref_time(30_781_000 as u64) - .saturating_add(T::DbWeight::get().reads(2 as u64)) - .saturating_add(T::DbWeight::get().writes(2 as u64)) + // Minimum execution time: 36_087 nanoseconds. + Weight::from_ref_time(36_087_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) } // Storage: Session NextKeys (r:1 w:1) // Storage: Session KeyOwner (r:0 w:1) fn purge_keys() -> Weight { - Weight::from_ref_time(22_911_000 as u64) - .saturating_add(T::DbWeight::get().reads(1 as u64)) - .saturating_add(T::DbWeight::get().writes(2 as u64)) + // Minimum execution time: 21_031 nanoseconds. + Weight::from_ref_time(21_031_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(2)) } } diff --git a/runtime/darwinia/src/weights/pallet_timestamp.rs b/runtime/darwinia/src/weights/pallet_timestamp.rs index 7f420bd5a..369d83b5d 100644 --- a/runtime/darwinia/src/weights/pallet_timestamp.rs +++ b/runtime/darwinia/src/weights/pallet_timestamp.rs @@ -19,12 +19,12 @@ //! Autogenerated weights for `pallet_timestamp` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2022-11-09, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! HOSTNAME: `inv.cafe`, CPU: `AMD Ryzen 9 5950X 16-Core Processor` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("local"), DB CACHE: 1024 +//! DATE: 2023-02-22, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("darwinia-local"), DB CACHE: 1024 // Executed Command: -// target/release/darwinia +// ./target/release/darwinia // benchmark // pallet // --header @@ -33,14 +33,18 @@ // wasm // --heap-pages // 4096 +// --steps +// 2 +// --repeat +// 1 // --chain -// local +// darwinia-local // --output -// runtime/src/weights +// runtime/darwinia/src/weights/ // --extrinsic // * // --pallet -// pallet-timestamp +// * #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -53,12 +57,15 @@ use sp_std::marker::PhantomData; pub struct WeightInfo(PhantomData); impl pallet_timestamp::WeightInfo for WeightInfo { // Storage: Timestamp Now (r:1 w:1) + // Storage: Aura CurrentSlot (r:1 w:0) fn set() -> Weight { - Weight::from_ref_time(13_230_000 as u64) - .saturating_add(T::DbWeight::get().reads(1 as u64)) - .saturating_add(T::DbWeight::get().writes(1 as u64)) + // Minimum execution time: 25_536 nanoseconds. + Weight::from_ref_time(25_536_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) } fn on_finalize() -> Weight { - Weight::from_ref_time(5_710_000 as u64) + // Minimum execution time: 5_447 nanoseconds. + Weight::from_ref_time(5_447_000) } } diff --git a/runtime/darwinia/src/weights/pallet_tips.rs b/runtime/darwinia/src/weights/pallet_tips.rs new file mode 100644 index 000000000..c7b524215 --- /dev/null +++ b/runtime/darwinia/src/weights/pallet_tips.rs @@ -0,0 +1,120 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `pallet_tips` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-02-22, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("darwinia-local"), DB CACHE: 1024 + +// Executed Command: +// ./target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --steps +// 2 +// --repeat +// 1 +// --chain +// darwinia-local +// --output +// runtime/darwinia/src/weights/ +// --extrinsic +// * +// --pallet +// * + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_tips`. +pub struct WeightInfo(PhantomData); +impl pallet_tips::WeightInfo for WeightInfo { + // Storage: Tips Reasons (r:1 w:1) + // Storage: Tips Tips (r:1 w:1) + /// The range of component `r` is `[0, 16384]`. + fn report_awesome(_r: u32, ) -> Weight { + // Minimum execution time: 51_239 nanoseconds. + Weight::from_ref_time(79_155_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Tips Tips (r:1 w:1) + // Storage: Tips Reasons (r:0 w:1) + fn retract_tip() -> Weight { + // Minimum execution time: 33_296 nanoseconds. + Weight::from_ref_time(33_296_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: PhragmenElection Members (r:1 w:0) + // Storage: Tips Reasons (r:1 w:1) + // Storage: Tips Tips (r:0 w:1) + /// The range of component `r` is `[0, 16384]`. + /// The range of component `t` is `[1, 7]`. + fn tip_new(r: u32, t: u32, ) -> Weight { + // Minimum execution time: 39_205 nanoseconds. + Weight::from_ref_time(37_279_416) + // Standard Error: 427 + .saturating_add(Weight::from_ref_time(1_209).saturating_mul(r.into())) + // Standard Error: 1_167_257 + .saturating_add(Weight::from_ref_time(275_083).saturating_mul(t.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: PhragmenElection Members (r:1 w:0) + // Storage: Tips Tips (r:1 w:1) + /// The range of component `t` is `[1, 7]`. + fn tip(_t: u32, ) -> Weight { + // Minimum execution time: 19_075 nanoseconds. + Weight::from_ref_time(21_379_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Tips Tips (r:1 w:1) + // Storage: PhragmenElection Members (r:1 w:0) + // Storage: System Account (r:2 w:2) + // Storage: Tips Reasons (r:0 w:1) + /// The range of component `t` is `[1, 7]`. + fn close_tip(_t: u32, ) -> Weight { + // Minimum execution time: 57_555 nanoseconds. + Weight::from_ref_time(62_665_000) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(4)) + } + // Storage: Tips Tips (r:1 w:1) + // Storage: Tips Reasons (r:0 w:1) + /// The range of component `t` is `[1, 7]`. + fn slash_tip(_t: u32, ) -> Weight { + // Minimum execution time: 20_435 nanoseconds. + Weight::from_ref_time(24_086_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(2)) + } +} diff --git a/runtime/darwinia/src/weights/pallet_treasury.rs b/runtime/darwinia/src/weights/pallet_treasury.rs new file mode 100644 index 000000000..2629c005b --- /dev/null +++ b/runtime/darwinia/src/weights/pallet_treasury.rs @@ -0,0 +1,107 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `pallet_treasury` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-02-22, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("darwinia-local"), DB CACHE: 1024 + +// Executed Command: +// ./target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --steps +// 2 +// --repeat +// 1 +// --chain +// darwinia-local +// --output +// runtime/darwinia/src/weights/ +// --extrinsic +// * +// --pallet +// * + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_treasury`. +pub struct WeightInfo(PhantomData); +impl pallet_treasury::WeightInfo for WeightInfo { + fn spend() -> Weight { + // Minimum execution time: 591 nanoseconds. + Weight::from_ref_time(591_000) + } + // Storage: Treasury ProposalCount (r:1 w:1) + // Storage: Treasury Proposals (r:0 w:1) + fn propose_spend() -> Weight { + // Minimum execution time: 52_473 nanoseconds. + Weight::from_ref_time(52_473_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Treasury Proposals (r:1 w:1) + // Storage: System Account (r:2 w:2) + fn reject_proposal() -> Weight { + // Minimum execution time: 45_584 nanoseconds. + Weight::from_ref_time(45_584_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: Treasury Proposals (r:1 w:0) + // Storage: Treasury Approvals (r:1 w:1) + /// The range of component `p` is `[0, 99]`. + fn approve_proposal(_p: u32, ) -> Weight { + // Minimum execution time: 13_228 nanoseconds. + Weight::from_ref_time(20_495_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Treasury Approvals (r:1 w:1) + fn remove_approval() -> Weight { + // Minimum execution time: 9_446 nanoseconds. + Weight::from_ref_time(9_446_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: System Account (r:1 w:1) + // Storage: Treasury Deactivated (r:1 w:1) + // Storage: Balances InactiveIssuance (r:1 w:1) + // Storage: Treasury Approvals (r:1 w:1) + // Storage: Treasury Proposals (r:100 w:0) + /// The range of component `p` is `[0, 100]`. + fn on_initialize_proposals(_p: u32, ) -> Weight { + // Minimum execution time: 48_789 nanoseconds. + Weight::from_ref_time(227_996_000) + .saturating_add(T::DbWeight::get().reads(104)) + .saturating_add(T::DbWeight::get().writes(4)) + } +} diff --git a/runtime/darwinia/src/weights/pallet_utility.rs b/runtime/darwinia/src/weights/pallet_utility.rs new file mode 100644 index 000000000..6db2becba --- /dev/null +++ b/runtime/darwinia/src/weights/pallet_utility.rs @@ -0,0 +1,82 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `pallet_utility` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-02-22, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("darwinia-local"), DB CACHE: 1024 + +// Executed Command: +// ./target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --steps +// 2 +// --repeat +// 1 +// --chain +// darwinia-local +// --output +// runtime/darwinia/src/weights/ +// --extrinsic +// * +// --pallet +// * + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_utility`. +pub struct WeightInfo(PhantomData); +impl pallet_utility::WeightInfo for WeightInfo { + /// The range of component `c` is `[0, 1000]`. + fn batch(_c: u32, ) -> Weight { + // Minimum execution time: 28_658 nanoseconds. + Weight::from_ref_time(3_766_966_000) + } + fn as_derivative() -> Weight { + // Minimum execution time: 100_171 nanoseconds. + Weight::from_ref_time(100_171_000) + } + /// The range of component `c` is `[0, 1000]`. + fn batch_all(_c: u32, ) -> Weight { + // Minimum execution time: 52_018 nanoseconds. + Weight::from_ref_time(3_969_873_000) + } + fn dispatch_as() -> Weight { + // Minimum execution time: 29_293 nanoseconds. + Weight::from_ref_time(29_293_000) + } + /// The range of component `c` is `[0, 1000]`. + fn force_batch(_c: u32, ) -> Weight { + // Minimum execution time: 27_599 nanoseconds. + Weight::from_ref_time(3_818_911_000) + } +} diff --git a/runtime/darwinia/src/weights/pallet_vesting.rs b/runtime/darwinia/src/weights/pallet_vesting.rs new file mode 100644 index 000000000..28028260e --- /dev/null +++ b/runtime/darwinia/src/weights/pallet_vesting.rs @@ -0,0 +1,165 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `pallet_vesting` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-02-22, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("darwinia-local"), DB CACHE: 1024 + +// Executed Command: +// ./target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --steps +// 2 +// --repeat +// 1 +// --chain +// darwinia-local +// --output +// runtime/darwinia/src/weights/ +// --extrinsic +// * +// --pallet +// * + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_vesting`. +pub struct WeightInfo(PhantomData); +impl pallet_vesting::WeightInfo for WeightInfo { + // Storage: Vesting Vesting (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + /// The range of component `l` is `[0, 49]`. + /// The range of component `s` is `[1, 28]`. + fn vest_locked(l: u32, s: u32, ) -> Weight { + // Minimum execution time: 50_173 nanoseconds. + Weight::from_ref_time(34_852_962) + // Standard Error: 115_941 + .saturating_add(Weight::from_ref_time(300_816).saturating_mul(l.into())) + // Standard Error: 210_412 + .saturating_add(Weight::from_ref_time(580_037).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Vesting Vesting (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + /// The range of component `l` is `[0, 49]`. + /// The range of component `s` is `[1, 28]`. + fn vest_unlocked(l: u32, s: u32, ) -> Weight { + // Minimum execution time: 49_641 nanoseconds. + Weight::from_ref_time(48_964_333) + // Standard Error: 40_703 + .saturating_add(Weight::from_ref_time(78_030).saturating_mul(l.into())) + // Standard Error: 73_868 + .saturating_add(Weight::from_ref_time(24_166).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Vesting Vesting (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + // Storage: System Account (r:1 w:1) + /// The range of component `l` is `[0, 49]`. + /// The range of component `s` is `[1, 28]`. + fn vest_other_locked(l: u32, s: u32, ) -> Weight { + // Minimum execution time: 50_209 nanoseconds. + Weight::from_ref_time(47_462_518) + // Standard Error: 362_988 + .saturating_add(Weight::from_ref_time(112_204).saturating_mul(l.into())) + // Standard Error: 658_756 + .saturating_add(Weight::from_ref_time(268_481).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: Vesting Vesting (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + // Storage: System Account (r:1 w:1) + /// The range of component `l` is `[0, 49]`. + /// The range of component `s` is `[1, 28]`. + fn vest_other_unlocked(_l: u32, _s: u32, ) -> Weight { + // Minimum execution time: 49_684 nanoseconds. + Weight::from_ref_time(60_532_259) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: Vesting Vesting (r:1 w:1) + // Storage: System Account (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + /// The range of component `l` is `[0, 49]`. + /// The range of component `s` is `[0, 27]`. + fn vested_transfer(_l: u32, _s: u32, ) -> Weight { + // Minimum execution time: 72_805 nanoseconds. + Weight::from_ref_time(107_390_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: Vesting Vesting (r:1 w:1) + // Storage: System Account (r:2 w:2) + // Storage: Balances Locks (r:1 w:1) + /// The range of component `l` is `[0, 49]`. + /// The range of component `s` is `[0, 27]`. + fn force_vested_transfer(_l: u32, _s: u32, ) -> Weight { + // Minimum execution time: 73_673 nanoseconds. + Weight::from_ref_time(77_290_000) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(4)) + } + // Storage: Vesting Vesting (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + // Storage: System Account (r:1 w:1) + /// The range of component `l` is `[0, 49]`. + /// The range of component `s` is `[2, 28]`. + fn not_unlocking_merge_schedules(l: u32, s: u32, ) -> Weight { + // Minimum execution time: 52_307 nanoseconds. + Weight::from_ref_time(45_781_615) + // Standard Error: 237_237 + .saturating_add(Weight::from_ref_time(135_030).saturating_mul(l.into())) + // Standard Error: 447_102 + .saturating_add(Weight::from_ref_time(236_442).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: Vesting Vesting (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + // Storage: System Account (r:1 w:1) + /// The range of component `l` is `[0, 49]`. + /// The range of component `s` is `[2, 28]`. + fn unlocking_merge_schedules(l: u32, s: u32, ) -> Weight { + // Minimum execution time: 51_144 nanoseconds. + Weight::from_ref_time(51_304_769) + // Standard Error: 22_481 + .saturating_add(Weight::from_ref_time(8_775).saturating_mul(l.into())) + // Standard Error: 42_368 + .saturating_add(Weight::from_ref_time(1_615).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } +} diff --git a/runtime/pangolin/src/lib.rs b/runtime/pangolin/src/lib.rs index 80cd802a8..a69f0e0d2 100644 --- a/runtime/pangolin/src/lib.rs +++ b/runtime/pangolin/src/lib.rs @@ -170,11 +170,30 @@ frame_support::construct_runtime! { #[cfg(feature = "runtime-benchmarks")] frame_benchmarking::define_benchmarks! { + // Substrate + [cumulus_pallet_xcmp_queue, XcmpQueue] [frame_system, SystemBench::] + [pallet_assets, Assets] [pallet_balances, Balances] + [pallet_collective, Council] + [pallet_collective, TechnicalCommittee] + [pallet_democracy, Democracy] + [pallet_elections_phragmen, PhragmenElection] + [pallet_identity, Identity] + [pallet_membership, TechnicalMembership] + [pallet_multisig, Multisig] + [pallet_preimage, Preimage] + [pallet_proxy, Proxy] + [pallet_scheduler, Scheduler] + [pallet_tips, Tips] + [pallet_treasury, Treasury] + [pallet_utility, Utility] + [pallet_vesting, Vesting] [pallet_session, SessionBench::] [pallet_timestamp, Timestamp] - [cumulus_pallet_xcmp_queue, XcmpQueue] + // Bridge + [pallet_bridge_grandpa, BridgeMoonbaseGrandpa] + [pallet_fee_market, PangoroFeeMarket] } impl_self_contained_call!(); diff --git a/runtime/pangolin/src/pallets/assets.rs b/runtime/pangolin/src/pallets/assets.rs index dfe936635..e520f4ad7 100644 --- a/runtime/pangolin/src/pallets/assets.rs +++ b/runtime/pangolin/src/pallets/assets.rs @@ -50,5 +50,5 @@ impl pallet_assets::Config for Runtime { type RemoveItemsLimit = ConstU32<1000>; type RuntimeEvent = RuntimeEvent; type StringLimit = ConstU32<50>; - type WeightInfo = (); + type WeightInfo = weights::pallet_assets::WeightInfo; } diff --git a/runtime/pangolin/src/pallets/balances.rs b/runtime/pangolin/src/pallets/balances.rs index 94a42eac2..1680c05c1 100644 --- a/runtime/pangolin/src/pallets/balances.rs +++ b/runtime/pangolin/src/pallets/balances.rs @@ -19,11 +19,21 @@ // darwinia use crate::*; +// https://github.com/paritytech/substrate/blob/polkadot-v0.9.37/frame/balances/src/benchmarking.rs#L39 +#[cfg(feature = "runtime-benchmarks")] +frame_support::parameter_types! { + pub const ExistentialDeposit:Balance = 1; +} +#[cfg(not(feature = "runtime-benchmarks"))] +frame_support::parameter_types! { + pub const ExistentialDeposit:Balance = 0; +} + impl pallet_balances::Config for Runtime { type AccountStore = System; type Balance = Balance; type DustRemoval = (); - type ExistentialDeposit = ConstU128<0>; + type ExistentialDeposit = ExistentialDeposit; type MaxLocks = ConstU32<50>; type MaxReserves = ConstU32<50>; type ReserveIdentifier = [u8; 8]; diff --git a/runtime/pangolin/src/pallets/bridge_grandpa.rs b/runtime/pangolin/src/pallets/bridge_grandpa.rs index 368bf79ba..5fc180f37 100644 --- a/runtime/pangolin/src/pallets/bridge_grandpa.rs +++ b/runtime/pangolin/src/pallets/bridge_grandpa.rs @@ -29,5 +29,5 @@ impl pallet_bridge_grandpa::Config for Runtime { type MaxBridgedAuthorities = ConstU32<100_000>; type MaxBridgedHeaderSize = ConstU32<65536>; type MaxRequests = ConstU32<50>; - type WeightInfo = (); + type WeightInfo = weights::pallet_bridge_grandpa::WeightInfo; } diff --git a/runtime/pangolin/src/pallets/collective.rs b/runtime/pangolin/src/pallets/collective.rs index 7dfbc2623..5168b8bf0 100644 --- a/runtime/pangolin/src/pallets/collective.rs +++ b/runtime/pangolin/src/pallets/collective.rs @@ -36,7 +36,7 @@ impl pallet_collective::Config for Runtime { type Proposal = RuntimeCall; type RuntimeEvent = RuntimeEvent; type RuntimeOrigin = RuntimeOrigin; - type WeightInfo = (); + type WeightInfo = weights::pallet_collective_council::WeightInfo; } impl pallet_collective::Config for Runtime { type DefaultVote = pallet_collective::PrimeDefaultVote; @@ -46,5 +46,5 @@ impl pallet_collective::Config for Runtime { type Proposal = RuntimeCall; type RuntimeEvent = RuntimeEvent; type RuntimeOrigin = RuntimeOrigin; - type WeightInfo = (); + type WeightInfo = weights::pallet_collective_technical_committee::WeightInfo; } diff --git a/runtime/pangolin/src/pallets/democracy.rs b/runtime/pangolin/src/pallets/democracy.rs index e28b4f392..a4c809347 100644 --- a/runtime/pangolin/src/pallets/democracy.rs +++ b/runtime/pangolin/src/pallets/democracy.rs @@ -60,5 +60,5 @@ impl pallet_democracy::Config for Runtime { type VetoOrigin = pallet_collective::EnsureMember; type VoteLockingPeriod = ConstU32; type VotingPeriod = ConstU32<{ 28 * DAYS }>; - type WeightInfo = (); + type WeightInfo = weights::pallet_democracy::WeightInfo; } diff --git a/runtime/pangolin/src/pallets/elections_phragmen.rs b/runtime/pangolin/src/pallets/elections_phragmen.rs index 133b89054..220df24cb 100644 --- a/runtime/pangolin/src/pallets/elections_phragmen.rs +++ b/runtime/pangolin/src/pallets/elections_phragmen.rs @@ -45,5 +45,5 @@ impl pallet_elections_phragmen::Config for Runtime { type VotingBondBase = ConstU128<{ darwinia_deposit(1, 64) }>; // Additional data per vote is 32 bytes (account id). type VotingBondFactor = ConstU128<{ darwinia_deposit(0, 32) }>; - type WeightInfo = (); + type WeightInfo = weights::pallet_elections_phragmen::WeightInfo; } diff --git a/runtime/pangolin/src/pallets/fee_market.rs b/runtime/pangolin/src/pallets/fee_market.rs index 93e5b2686..c14ee5151 100644 --- a/runtime/pangolin/src/pallets/fee_market.rs +++ b/runtime/pangolin/src/pallets/fee_market.rs @@ -70,5 +70,5 @@ impl pallet_fee_market::Config for Runtime { type Slasher = FeeMarketSlasher; type Slot = ConstU32<600>; type TreasuryPalletId = TreasuryPalletId; - type WeightInfo = (); + type WeightInfo = weights::pallet_fee_market::WeightInfo; } diff --git a/runtime/pangolin/src/pallets/identity.rs b/runtime/pangolin/src/pallets/identity.rs index b12f0b3a9..1fcedcd89 100644 --- a/runtime/pangolin/src/pallets/identity.rs +++ b/runtime/pangolin/src/pallets/identity.rs @@ -35,5 +35,5 @@ impl pallet_identity::Config for Runtime { type Slashed = Treasury; // 53 bytes on-chain. type SubAccountDeposit = ConstU128<{ darwinia_deposit(1, 53) }>; - type WeightInfo = (); + type WeightInfo = weights::pallet_identity::WeightInfo; } diff --git a/runtime/pangolin/src/pallets/membership.rs b/runtime/pangolin/src/pallets/membership.rs index 3064d4b5e..a73d74e79 100644 --- a/runtime/pangolin/src/pallets/membership.rs +++ b/runtime/pangolin/src/pallets/membership.rs @@ -29,5 +29,5 @@ impl pallet_membership::Config for Runtime { type ResetOrigin = RootOrMoreThanHalf; type RuntimeEvent = RuntimeEvent; type SwapOrigin = RootOrMoreThanHalf; - type WeightInfo = (); + type WeightInfo = weights::pallet_membership::WeightInfo; } diff --git a/runtime/pangolin/src/pallets/multisig.rs b/runtime/pangolin/src/pallets/multisig.rs index c47262b26..d2e226434 100644 --- a/runtime/pangolin/src/pallets/multisig.rs +++ b/runtime/pangolin/src/pallets/multisig.rs @@ -28,5 +28,5 @@ impl pallet_multisig::Config for Runtime { type MaxSignatories = ConstU32<100>; type RuntimeCall = RuntimeCall; type RuntimeEvent = RuntimeEvent; - type WeightInfo = (); + type WeightInfo = weights::pallet_multisig::WeightInfo; } diff --git a/runtime/pangolin/src/pallets/preimage.rs b/runtime/pangolin/src/pallets/preimage.rs index d049ef1c0..08ef47e38 100644 --- a/runtime/pangolin/src/pallets/preimage.rs +++ b/runtime/pangolin/src/pallets/preimage.rs @@ -25,5 +25,5 @@ impl pallet_preimage::Config for Runtime { type Currency = Balances; type ManagerOrigin = frame_system::EnsureRoot; type RuntimeEvent = RuntimeEvent; - type WeightInfo = (); + type WeightInfo = weights::pallet_preimage::WeightInfo; } diff --git a/runtime/pangolin/src/pallets/proxy.rs b/runtime/pangolin/src/pallets/proxy.rs index dae6ddf4c..3917f7c48 100644 --- a/runtime/pangolin/src/pallets/proxy.rs +++ b/runtime/pangolin/src/pallets/proxy.rs @@ -118,5 +118,5 @@ impl pallet_proxy::Config for Runtime { type ProxyType = ProxyType; type RuntimeCall = RuntimeCall; type RuntimeEvent = RuntimeEvent; - type WeightInfo = (); + type WeightInfo = weights::pallet_proxy::WeightInfo; } diff --git a/runtime/pangolin/src/pallets/scheduler.rs b/runtime/pangolin/src/pallets/scheduler.rs index 2f0197405..868dfd6d6 100644 --- a/runtime/pangolin/src/pallets/scheduler.rs +++ b/runtime/pangolin/src/pallets/scheduler.rs @@ -59,5 +59,5 @@ impl pallet_scheduler::Config for Runtime { type RuntimeEvent = RuntimeEvent; type RuntimeOrigin = RuntimeOrigin; type ScheduleOrigin = Root; - type WeightInfo = (); + type WeightInfo = weights::pallet_scheduler::WeightInfo; } diff --git a/runtime/pangolin/src/pallets/tips.rs b/runtime/pangolin/src/pallets/tips.rs index 6500a1b3a..e5e1ff68a 100644 --- a/runtime/pangolin/src/pallets/tips.rs +++ b/runtime/pangolin/src/pallets/tips.rs @@ -31,5 +31,5 @@ impl pallet_tips::Config for Runtime { type TipFindersFee = TipFindersFee; type TipReportDepositBase = ConstU128<{ 100 * UNIT }>; type Tippers = PhragmenElection; - type WeightInfo = (); + type WeightInfo = weights::pallet_tips::WeightInfo; } diff --git a/runtime/pangolin/src/pallets/treasury.rs b/runtime/pangolin/src/pallets/treasury.rs index 3febca02f..b2e8b4708 100644 --- a/runtime/pangolin/src/pallets/treasury.rs +++ b/runtime/pangolin/src/pallets/treasury.rs @@ -43,5 +43,5 @@ impl pallet_treasury::Config for Runtime { type SpendFunds = (); type SpendOrigin = frame_support::traits::NeverEnsureOrigin; type SpendPeriod = ConstU32<{ 24 * DAYS }>; - type WeightInfo = (); + type WeightInfo = weights::pallet_treasury::WeightInfo; } diff --git a/runtime/pangolin/src/pallets/utility.rs b/runtime/pangolin/src/pallets/utility.rs index 2c0f49ddf..c89d70642 100644 --- a/runtime/pangolin/src/pallets/utility.rs +++ b/runtime/pangolin/src/pallets/utility.rs @@ -23,5 +23,5 @@ impl pallet_utility::Config for Runtime { type PalletsOrigin = OriginCaller; type RuntimeCall = RuntimeCall; type RuntimeEvent = RuntimeEvent; - type WeightInfo = (); + type WeightInfo = weights::pallet_utility::WeightInfo; } diff --git a/runtime/pangolin/src/pallets/vesting.rs b/runtime/pangolin/src/pallets/vesting.rs index 1c0b0b6e6..f13db8ccc 100644 --- a/runtime/pangolin/src/pallets/vesting.rs +++ b/runtime/pangolin/src/pallets/vesting.rs @@ -32,7 +32,7 @@ impl pallet_vesting::Config for Runtime { type MinVestedTransfer = ConstU128; type RuntimeEvent = RuntimeEvent; type UnvestedFundsAllowedWithdrawReasons = UnvestedFundsAllowedWithdrawReasons; - type WeightInfo = (); + type WeightInfo = weights::pallet_vesting::WeightInfo; // `VestingInfo` encode length is 36bytes. 28 schedules gets encoded as 1009 bytes, which is the // highest number of schedules that encodes less than 2^10. diff --git a/runtime/pangolin/src/weights/cumulus_pallet_xcmp_queue.rs b/runtime/pangolin/src/weights/cumulus_pallet_xcmp_queue.rs index 3271b31e4..e871177d0 100644 --- a/runtime/pangolin/src/weights/cumulus_pallet_xcmp_queue.rs +++ b/runtime/pangolin/src/weights/cumulus_pallet_xcmp_queue.rs @@ -19,12 +19,12 @@ //! Autogenerated weights for `cumulus_pallet_xcmp_queue` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2022-11-09, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! HOSTNAME: `inv.cafe`, CPU: `AMD Ryzen 9 5950X 16-Core Processor` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("local"), DB CACHE: 1024 +//! DATE: 2023-02-21, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("pangolin-local"), DB CACHE: 1024 // Executed Command: -// target/release/darwinia +// ./target/release/darwinia // benchmark // pallet // --header @@ -33,14 +33,18 @@ // wasm // --heap-pages // 4096 +// --steps +// 2 +// --repeat +// 1 // --chain -// local +// pangolin-local // --output -// runtime/src/weights +// runtime/pangolin/src/weights/ // --extrinsic // * // --pallet -// cumulus-pallet-xcmp-queue +// * #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -54,14 +58,16 @@ pub struct WeightInfo(PhantomData); impl cumulus_pallet_xcmp_queue::WeightInfo for WeightInfo { // Storage: XcmpQueue QueueConfig (r:1 w:1) fn set_config_with_u32() -> Weight { - Weight::from_ref_time(13_340_000 as u64) - .saturating_add(T::DbWeight::get().reads(1 as u64)) - .saturating_add(T::DbWeight::get().writes(1 as u64)) + // Minimum execution time: 12_758 nanoseconds. + Weight::from_ref_time(12_758_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) } // Storage: XcmpQueue QueueConfig (r:1 w:1) fn set_config_with_weight() -> Weight { - Weight::from_ref_time(12_610_000 as u64) - .saturating_add(T::DbWeight::get().reads(1 as u64)) - .saturating_add(T::DbWeight::get().writes(1 as u64)) + // Minimum execution time: 13_608 nanoseconds. + Weight::from_ref_time(13_608_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) } } diff --git a/runtime/pangolin/src/weights/frame_system.rs b/runtime/pangolin/src/weights/frame_system.rs index 2361f7517..32b95dd47 100644 --- a/runtime/pangolin/src/weights/frame_system.rs +++ b/runtime/pangolin/src/weights/frame_system.rs @@ -19,12 +19,12 @@ //! Autogenerated weights for `frame_system` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2022-11-09, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! HOSTNAME: `inv.cafe`, CPU: `AMD Ryzen 9 5950X 16-Core Processor` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("local"), DB CACHE: 1024 +//! DATE: 2023-02-21, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("pangolin-local"), DB CACHE: 1024 // Executed Command: -// target/release/darwinia +// ./target/release/darwinia // benchmark // pallet // --header @@ -33,14 +33,18 @@ // wasm // --heap-pages // 4096 +// --steps +// 2 +// --repeat +// 1 // --chain -// local +// pangolin-local // --output -// runtime/src/weights +// runtime/pangolin/src/weights/ // --extrinsic // * // --pallet -// frame-system +// * #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -54,35 +58,41 @@ pub struct WeightInfo(PhantomData); impl frame_system::WeightInfo for WeightInfo { /// The range of component `b` is `[0, 3932160]`. fn remark(_b: u32, ) -> Weight { - Weight::from_ref_time(1_074_555_000 as u64) + // Minimum execution time: 9_622 nanoseconds. + Weight::from_ref_time(869_013_000) } /// The range of component `b` is `[0, 3932160]`. fn remark_with_event(_b: u32, ) -> Weight { - Weight::from_ref_time(4_724_488_000 as u64) + // Minimum execution time: 21_954 nanoseconds. + Weight::from_ref_time(4_497_075_000) } // Storage: System Digest (r:1 w:1) // Storage: unknown [0x3a686561707061676573] (r:0 w:1) fn set_heap_pages() -> Weight { - Weight::from_ref_time(14_110_000 as u64) - .saturating_add(T::DbWeight::get().reads(1 as u64)) - .saturating_add(T::DbWeight::get().writes(2 as u64)) + // Minimum execution time: 15_275 nanoseconds. + Weight::from_ref_time(15_275_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(2)) } // Storage: Skipped Metadata (r:0 w:0) - /// The range of component `i` is `[1, 1000]`. + /// The range of component `i` is `[0, 1000]`. fn set_storage(_i: u32, ) -> Weight { - Weight::from_ref_time(655_299_000 as u64) - .saturating_add(T::DbWeight::get().writes(1000 as u64)) + // Minimum execution time: 18_359 nanoseconds. + Weight::from_ref_time(570_576_000) + .saturating_add(T::DbWeight::get().writes(1000)) } // Storage: Skipped Metadata (r:0 w:0) - /// The range of component `i` is `[1, 1000]`. + /// The range of component `i` is `[0, 1000]`. fn kill_storage(_i: u32, ) -> Weight { - Weight::from_ref_time(555_697_000 as u64) - .saturating_add(T::DbWeight::get().writes(1000 as u64)) + // Minimum execution time: 12_434 nanoseconds. + Weight::from_ref_time(398_074_000) + .saturating_add(T::DbWeight::get().writes(1000)) } // Storage: Skipped Metadata (r:0 w:0) - /// The range of component `p` is `[1, 1000]`. + /// The range of component `p` is `[0, 1000]`. fn kill_prefix(_p: u32, ) -> Weight { - Weight::from_ref_time(1_089_395_000 as u64) - .saturating_add(T::DbWeight::get().writes(1000 as u64)) + // Minimum execution time: 13_366 nanoseconds. + Weight::from_ref_time(774_849_000) + .saturating_add(T::DbWeight::get().writes(1000)) } } diff --git a/runtime/pangolin/src/weights/mod.rs b/runtime/pangolin/src/weights/mod.rs index caf9386da..4580cd631 100644 --- a/runtime/pangolin/src/weights/mod.rs +++ b/runtime/pangolin/src/weights/mod.rs @@ -34,6 +34,23 @@ pub use rocksdb_weights::constants::RocksDbWeight; pub mod cumulus_pallet_xcmp_queue; pub mod frame_system; +pub mod pallet_assets; pub mod pallet_balances; +pub mod pallet_bridge_grandpa; +pub mod pallet_collective_council; +pub mod pallet_collective_technical_committee; +pub mod pallet_democracy; +pub mod pallet_elections_phragmen; +pub mod pallet_fee_market; +pub mod pallet_identity; +pub mod pallet_membership; +pub mod pallet_multisig; +pub mod pallet_preimage; +pub mod pallet_proxy; +pub mod pallet_scheduler; pub mod pallet_session; pub mod pallet_timestamp; +pub mod pallet_tips; +pub mod pallet_treasury; +pub mod pallet_utility; +pub mod pallet_vesting; diff --git a/runtime/pangolin/src/weights/pallet_assets.rs b/runtime/pangolin/src/weights/pallet_assets.rs new file mode 100644 index 000000000..9e54d0403 --- /dev/null +++ b/runtime/pangolin/src/weights/pallet_assets.rs @@ -0,0 +1,276 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `pallet_assets` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-02-21, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("pangolin-local"), DB CACHE: 1024 + +// Executed Command: +// ./target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --steps +// 2 +// --repeat +// 1 +// --chain +// pangolin-local +// --output +// runtime/pangolin/src/weights/ +// --extrinsic +// * +// --pallet +// * + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_assets`. +pub struct WeightInfo(PhantomData); +impl pallet_assets::WeightInfo for WeightInfo { + // Storage: Assets Asset (r:1 w:1) + fn create() -> Weight { + // Minimum execution time: 33_960 nanoseconds. + Weight::from_ref_time(33_960_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Assets Asset (r:1 w:1) + fn force_create() -> Weight { + // Minimum execution time: 32_571 nanoseconds. + Weight::from_ref_time(32_571_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Assets Asset (r:1 w:1) + fn start_destroy() -> Weight { + // Minimum execution time: 28_716 nanoseconds. + Weight::from_ref_time(28_716_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Assets Asset (r:1 w:1) + // Storage: Assets Account (r:1 w:0) + // Storage: System Account (r:1000 w:1000) + /// The range of component `c` is `[0, 1000]`. + fn destroy_accounts(_c: u32, ) -> Weight { + // Minimum execution time: 38_542 nanoseconds. + Weight::from_ref_time(11_042_648_000) + .saturating_add(T::DbWeight::get().reads(2002)) + .saturating_add(T::DbWeight::get().writes(2001)) + } + // Storage: Assets Asset (r:1 w:1) + // Storage: Assets Approvals (r:1 w:0) + /// The range of component `a` is `[0, 1000]`. + fn destroy_approvals(_a: u32, ) -> Weight { + // Minimum execution time: 39_419 nanoseconds. + Weight::from_ref_time(5_611_916_000) + .saturating_add(T::DbWeight::get().reads(1002)) + .saturating_add(T::DbWeight::get().writes(1001)) + } + // Storage: Assets Asset (r:1 w:1) + // Storage: Assets Metadata (r:1 w:0) + fn finish_destroy() -> Weight { + // Minimum execution time: 31_245 nanoseconds. + Weight::from_ref_time(31_245_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Assets Asset (r:1 w:1) + // Storage: Assets Account (r:1 w:1) + fn mint() -> Weight { + // Minimum execution time: 42_380 nanoseconds. + Weight::from_ref_time(42_380_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Assets Asset (r:1 w:1) + // Storage: Assets Account (r:1 w:1) + fn burn() -> Weight { + // Minimum execution time: 243_248 nanoseconds. + Weight::from_ref_time(243_248_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Assets Asset (r:1 w:1) + // Storage: Assets Account (r:2 w:2) + // Storage: System Account (r:1 w:1) + fn transfer() -> Weight { + // Minimum execution time: 62_978 nanoseconds. + Weight::from_ref_time(62_978_000) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(4)) + } + // Storage: Assets Asset (r:1 w:1) + // Storage: Assets Account (r:2 w:2) + // Storage: System Account (r:1 w:1) + fn transfer_keep_alive() -> Weight { + // Minimum execution time: 98_351 nanoseconds. + Weight::from_ref_time(98_351_000) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(4)) + } + // Storage: Assets Asset (r:1 w:1) + // Storage: Assets Account (r:2 w:2) + // Storage: System Account (r:1 w:1) + fn force_transfer() -> Weight { + // Minimum execution time: 60_227 nanoseconds. + Weight::from_ref_time(60_227_000) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(4)) + } + // Storage: Assets Asset (r:1 w:0) + // Storage: Assets Account (r:1 w:1) + fn freeze() -> Weight { + // Minimum execution time: 36_243 nanoseconds. + Weight::from_ref_time(36_243_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Assets Asset (r:1 w:0) + // Storage: Assets Account (r:1 w:1) + fn thaw() -> Weight { + // Minimum execution time: 33_745 nanoseconds. + Weight::from_ref_time(33_745_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Assets Asset (r:1 w:1) + fn freeze_asset() -> Weight { + // Minimum execution time: 27_032 nanoseconds. + Weight::from_ref_time(27_032_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Assets Asset (r:1 w:1) + fn thaw_asset() -> Weight { + // Minimum execution time: 28_232 nanoseconds. + Weight::from_ref_time(28_232_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Assets Asset (r:1 w:1) + // Storage: Assets Metadata (r:1 w:0) + fn transfer_ownership() -> Weight { + // Minimum execution time: 31_213 nanoseconds. + Weight::from_ref_time(31_213_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Assets Asset (r:1 w:1) + fn set_team() -> Weight { + // Minimum execution time: 29_227 nanoseconds. + Weight::from_ref_time(29_227_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Assets Asset (r:1 w:0) + // Storage: Assets Metadata (r:1 w:1) + /// The range of component `n` is `[0, 50]`. + /// The range of component `s` is `[0, 50]`. + fn set_metadata(n: u32, s: u32, ) -> Weight { + // Minimum execution time: 31_095 nanoseconds. + Weight::from_ref_time(29_205_500) + // Standard Error: 15_432 + .saturating_add(Weight::from_ref_time(37_790).saturating_mul(n.into())) + // Standard Error: 15_432 + .saturating_add(Weight::from_ref_time(39_010).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Assets Asset (r:1 w:0) + // Storage: Assets Metadata (r:1 w:1) + fn clear_metadata() -> Weight { + // Minimum execution time: 35_371 nanoseconds. + Weight::from_ref_time(35_371_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Assets Asset (r:1 w:0) + // Storage: Assets Metadata (r:1 w:1) + /// The range of component `n` is `[0, 50]`. + /// The range of component `s` is `[0, 50]`. + fn force_set_metadata(_n: u32, _s: u32, ) -> Weight { + // Minimum execution time: 27_646 nanoseconds. + Weight::from_ref_time(38_891_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Assets Asset (r:1 w:0) + // Storage: Assets Metadata (r:1 w:1) + fn force_clear_metadata() -> Weight { + // Minimum execution time: 36_899 nanoseconds. + Weight::from_ref_time(36_899_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Assets Asset (r:1 w:1) + fn force_asset_status() -> Weight { + // Minimum execution time: 28_903 nanoseconds. + Weight::from_ref_time(28_903_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Assets Asset (r:1 w:1) + // Storage: Assets Approvals (r:1 w:1) + fn approve_transfer() -> Weight { + // Minimum execution time: 33_551 nanoseconds. + Weight::from_ref_time(33_551_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Assets Asset (r:1 w:1) + // Storage: Assets Approvals (r:1 w:1) + // Storage: Assets Account (r:2 w:2) + // Storage: System Account (r:1 w:1) + fn transfer_approved() -> Weight { + // Minimum execution time: 67_647 nanoseconds. + Weight::from_ref_time(67_647_000) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(5)) + } + // Storage: Assets Asset (r:1 w:1) + // Storage: Assets Approvals (r:1 w:1) + fn cancel_approval() -> Weight { + // Minimum execution time: 34_778 nanoseconds. + Weight::from_ref_time(34_778_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Assets Asset (r:1 w:1) + // Storage: Assets Approvals (r:1 w:1) + fn force_cancel_approval() -> Weight { + // Minimum execution time: 36_469 nanoseconds. + Weight::from_ref_time(36_469_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } +} diff --git a/runtime/pangolin/src/weights/pallet_balances.rs b/runtime/pangolin/src/weights/pallet_balances.rs index f7acd35fb..59cc160ea 100644 --- a/runtime/pangolin/src/weights/pallet_balances.rs +++ b/runtime/pangolin/src/weights/pallet_balances.rs @@ -19,12 +19,12 @@ //! Autogenerated weights for `pallet_balances` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2022-11-09, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! HOSTNAME: `inv.cafe`, CPU: `AMD Ryzen 9 5950X 16-Core Processor` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("local"), DB CACHE: 1024 +//! DATE: 2023-02-21, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("pangolin-local"), DB CACHE: 1024 // Executed Command: -// target/release/darwinia +// ./target/release/darwinia // benchmark // pallet // --header @@ -33,14 +33,18 @@ // wasm // --heap-pages // 4096 +// --steps +// 2 +// --repeat +// 1 // --chain -// local +// pangolin-local // --output -// runtime/src/weights +// runtime/pangolin/src/weights/ // --extrinsic // * // --pallet -// pallet-balances +// * #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -54,44 +58,51 @@ pub struct WeightInfo(PhantomData); impl pallet_balances::WeightInfo for WeightInfo { // Storage: System Account (r:1 w:1) fn transfer() -> Weight { - Weight::from_ref_time(57_141_000 as u64) - .saturating_add(T::DbWeight::get().reads(1 as u64)) - .saturating_add(T::DbWeight::get().writes(1 as u64)) + // Minimum execution time: 55_233 nanoseconds. + Weight::from_ref_time(55_233_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) } // Storage: System Account (r:1 w:1) fn transfer_keep_alive() -> Weight { - Weight::from_ref_time(43_271_000 as u64) - .saturating_add(T::DbWeight::get().reads(1 as u64)) - .saturating_add(T::DbWeight::get().writes(1 as u64)) + // Minimum execution time: 55_925 nanoseconds. + Weight::from_ref_time(55_925_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) } // Storage: System Account (r:1 w:1) fn set_balance_creating() -> Weight { - Weight::from_ref_time(29_941_000 as u64) - .saturating_add(T::DbWeight::get().reads(1 as u64)) - .saturating_add(T::DbWeight::get().writes(1 as u64)) + // Minimum execution time: 34_237 nanoseconds. + Weight::from_ref_time(34_237_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) } // Storage: System Account (r:1 w:1) fn set_balance_killing() -> Weight { - Weight::from_ref_time(34_490_000 as u64) - .saturating_add(T::DbWeight::get().reads(1 as u64)) - .saturating_add(T::DbWeight::get().writes(1 as u64)) + // Minimum execution time: 85_171 nanoseconds. + Weight::from_ref_time(85_171_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) } // Storage: System Account (r:2 w:2) fn force_transfer() -> Weight { - Weight::from_ref_time(54_911_000 as u64) - .saturating_add(T::DbWeight::get().reads(2 as u64)) - .saturating_add(T::DbWeight::get().writes(2 as u64)) + // Minimum execution time: 52_817 nanoseconds. + Weight::from_ref_time(52_817_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) } // Storage: System Account (r:1 w:1) fn transfer_all() -> Weight { - Weight::from_ref_time(49_671_000 as u64) - .saturating_add(T::DbWeight::get().reads(1 as u64)) - .saturating_add(T::DbWeight::get().writes(1 as u64)) + // Minimum execution time: 51_678 nanoseconds. + Weight::from_ref_time(51_678_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) } // Storage: System Account (r:1 w:1) fn force_unreserve() -> Weight { - Weight::from_ref_time(26_120_000 as u64) - .saturating_add(T::DbWeight::get().reads(1 as u64)) - .saturating_add(T::DbWeight::get().writes(1 as u64)) + // Minimum execution time: 37_429 nanoseconds. + Weight::from_ref_time(37_429_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) } } diff --git a/runtime/pangolin/src/weights/pallet_bridge_grandpa.rs b/runtime/pangolin/src/weights/pallet_bridge_grandpa.rs new file mode 100644 index 000000000..bab693e16 --- /dev/null +++ b/runtime/pangolin/src/weights/pallet_bridge_grandpa.rs @@ -0,0 +1,76 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `pallet_bridge_grandpa` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-02-21, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("pangolin-local"), DB CACHE: 1024 + +// Executed Command: +// ./target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --steps +// 2 +// --repeat +// 1 +// --chain +// pangolin-local +// --output +// runtime/pangolin/src/weights/ +// --extrinsic +// * +// --pallet +// * + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_bridge_grandpa`. +pub struct WeightInfo(PhantomData); +impl pallet_bridge_grandpa::WeightInfo for WeightInfo { + // Storage: BridgeMoonbaseGrandpa PalletOperatingMode (r:1 w:0) + // Storage: BridgeMoonbaseGrandpa RequestCount (r:1 w:1) + // Storage: BridgeMoonbaseGrandpa BestFinalized (r:1 w:1) + // Storage: BridgeMoonbaseGrandpa ImportedHeaders (r:1 w:2) + // Storage: BridgeMoonbaseGrandpa CurrentAuthoritySet (r:1 w:0) + // Storage: BridgeMoonbaseGrandpa ImportedHashesPointer (r:1 w:1) + // Storage: BridgeMoonbaseGrandpa ImportedHashes (r:1 w:1) + /// The range of component `p` is `[51, 102]`. + /// The range of component `v` is `[50, 100]`. + fn submit_finality_proof(p: u32, _v: u32, ) -> Weight { + // Minimum execution time: 1_848_880 nanoseconds. + Weight::from_ref_time(1_848_880_000) + // Standard Error: 5_778_241 + .saturating_add(Weight::from_ref_time(21_940_097).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(7)) + .saturating_add(T::DbWeight::get().writes(6)) + } +} diff --git a/runtime/pangolin/src/weights/pallet_collective_council.rs b/runtime/pangolin/src/weights/pallet_collective_council.rs new file mode 100644 index 000000000..8c314991c --- /dev/null +++ b/runtime/pangolin/src/weights/pallet_collective_council.rs @@ -0,0 +1,232 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `pallet_collective` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-02-21, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("pangolin-local"), DB CACHE: 1024 + +// Executed Command: +// ./target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --steps +// 2 +// --repeat +// 1 +// --chain +// pangolin-local +// --output +// runtime/pangolin/src/weights/ +// --extrinsic +// * +// --pallet +// * + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_collective`. +pub struct WeightInfo(PhantomData); +impl pallet_collective::WeightInfo for WeightInfo { + // Storage: Council Members (r:1 w:1) + // Storage: Council Proposals (r:1 w:0) + // Storage: Council Prime (r:0 w:1) + // Storage: Council Voting (r:100 w:100) + /// The range of component `m` is `[0, 100]`. + /// The range of component `n` is `[0, 100]`. + /// The range of component `p` is `[0, 100]`. + /// The range of component `m` is `[0, 100]`. + /// The range of component `n` is `[0, 100]`. + /// The range of component `p` is `[0, 100]`. + fn set_members(m: u32, _n: u32, p: u32, ) -> Weight { + // Minimum execution time: 16_632 nanoseconds. + Weight::from_ref_time(16_632_000) + // Standard Error: 908_592 + .saturating_add(Weight::from_ref_time(4_003_667).saturating_mul(m.into())) + // Standard Error: 908_592 + .saturating_add(Weight::from_ref_time(3_948_017).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(m.into()))) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(p.into()))) + .saturating_add(T::DbWeight::get().writes(2)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(m.into()))) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(p.into()))) + } + // Storage: Council Members (r:1 w:0) + /// The range of component `b` is `[2, 1024]`. + /// The range of component `m` is `[1, 100]`. + /// The range of component `b` is `[2, 1024]`. + /// The range of component `m` is `[1, 100]`. + fn execute(_b: u32, m: u32, ) -> Weight { + // Minimum execution time: 22_335 nanoseconds. + Weight::from_ref_time(24_050_644) + // Standard Error: 47_608 + .saturating_add(Weight::from_ref_time(44_954).saturating_mul(m.into())) + .saturating_add(T::DbWeight::get().reads(1)) + } + // Storage: Council Members (r:1 w:0) + // Storage: Council ProposalOf (r:1 w:0) + /// The range of component `b` is `[2, 1024]`. + /// The range of component `m` is `[1, 100]`. + /// The range of component `b` is `[2, 1024]`. + /// The range of component `m` is `[1, 100]`. + fn propose_execute(b: u32, m: u32, ) -> Weight { + // Minimum execution time: 28_868 nanoseconds. + Weight::from_ref_time(29_918_922) + // Standard Error: 1_412 + .saturating_add(Weight::from_ref_time(1_480).saturating_mul(b.into())) + // Standard Error: 14_582 + .saturating_add(Weight::from_ref_time(59_616).saturating_mul(m.into())) + .saturating_add(T::DbWeight::get().reads(2)) + } + // Storage: Council Members (r:1 w:0) + // Storage: Council ProposalOf (r:1 w:1) + // Storage: Council Proposals (r:1 w:1) + // Storage: Council ProposalCount (r:1 w:1) + // Storage: Council Voting (r:0 w:1) + /// The range of component `b` is `[2, 1024]`. + /// The range of component `m` is `[2, 100]`. + /// The range of component `p` is `[1, 100]`. + /// The range of component `b` is `[2, 1024]`. + /// The range of component `m` is `[2, 100]`. + /// The range of component `p` is `[1, 100]`. + fn propose_proposed(b: u32, _m: u32, p: u32, ) -> Weight { + // Minimum execution time: 34_577 nanoseconds. + Weight::from_ref_time(32_029_258) + // Standard Error: 1_331 + .saturating_add(Weight::from_ref_time(4_522).saturating_mul(b.into())) + // Standard Error: 13_740 + .saturating_add(Weight::from_ref_time(137_757).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(4)) + } + // Storage: Council Members (r:1 w:0) + // Storage: Council Voting (r:1 w:1) + /// The range of component `m` is `[5, 100]`. + /// The range of component `m` is `[5, 100]`. + fn vote(_m: u32, ) -> Weight { + // Minimum execution time: 34_628 nanoseconds. + Weight::from_ref_time(37_105_684) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Council Voting (r:1 w:1) + // Storage: Council Members (r:1 w:0) + // Storage: Council Proposals (r:1 w:1) + // Storage: Council ProposalOf (r:0 w:1) + /// The range of component `m` is `[4, 100]`. + /// The range of component `p` is `[1, 100]`. + /// The range of component `m` is `[4, 100]`. + /// The range of component `p` is `[1, 100]`. + fn close_early_disapproved(m: u32, p: u32, ) -> Weight { + // Minimum execution time: 29_974 nanoseconds. + Weight::from_ref_time(30_034_686) + // Standard Error: 15_326 + .saturating_add(Weight::from_ref_time(10_500).saturating_mul(m.into())) + // Standard Error: 14_861 + .saturating_add(Weight::from_ref_time(172_813).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: Council Voting (r:1 w:1) + // Storage: Council Members (r:1 w:0) + // Storage: Council ProposalOf (r:1 w:1) + // Storage: Council Proposals (r:1 w:1) + /// The range of component `b` is `[2, 1024]`. + /// The range of component `m` is `[4, 100]`. + /// The range of component `p` is `[1, 100]`. + /// The range of component `b` is `[2, 1024]`. + /// The range of component `m` is `[4, 100]`. + /// The range of component `p` is `[1, 100]`. + fn close_early_approved(b: u32, m: u32, p: u32, ) -> Weight { + // Minimum execution time: 40_497 nanoseconds. + Weight::from_ref_time(34_794_620) + // Standard Error: 1_928 + .saturating_add(Weight::from_ref_time(5_426).saturating_mul(b.into())) + // Standard Error: 20_531 + .saturating_add(Weight::from_ref_time(765).saturating_mul(m.into())) + // Standard Error: 19_909 + .saturating_add(Weight::from_ref_time(232_464).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: Council Voting (r:1 w:1) + // Storage: Council Members (r:1 w:0) + // Storage: Council Prime (r:1 w:0) + // Storage: Council Proposals (r:1 w:1) + // Storage: Council ProposalOf (r:0 w:1) + /// The range of component `m` is `[4, 100]`. + /// The range of component `p` is `[1, 100]`. + /// The range of component `m` is `[4, 100]`. + /// The range of component `p` is `[1, 100]`. + fn close_disapproved(m: u32, p: u32, ) -> Weight { + // Minimum execution time: 30_682 nanoseconds. + Weight::from_ref_time(27_960_737) + // Standard Error: 30_131 + .saturating_add(Weight::from_ref_time(32_875).saturating_mul(m.into())) + // Standard Error: 29_218 + .saturating_add(Weight::from_ref_time(213_262).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: Council Voting (r:1 w:1) + // Storage: Council Members (r:1 w:0) + // Storage: Council Prime (r:1 w:0) + // Storage: Council ProposalOf (r:1 w:1) + // Storage: Council Proposals (r:1 w:1) + /// The range of component `b` is `[2, 1024]`. + /// The range of component `m` is `[4, 100]`. + /// The range of component `p` is `[1, 100]`. + /// The range of component `b` is `[2, 1024]`. + /// The range of component `m` is `[4, 100]`. + /// The range of component `p` is `[1, 100]`. + fn close_approved(_b: u32, m: u32, p: u32, ) -> Weight { + // Minimum execution time: 41_569 nanoseconds. + Weight::from_ref_time(105_863_155) + // Standard Error: 336_443 + .saturating_add(Weight::from_ref_time(531).saturating_mul(m.into())) + // Standard Error: 326_248 + .saturating_add(Weight::from_ref_time(187_020).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: Council Proposals (r:1 w:1) + // Storage: Council Voting (r:0 w:1) + // Storage: Council ProposalOf (r:0 w:1) + /// The range of component `p` is `[1, 100]`. + /// The range of component `p` is `[1, 100]`. + fn disapprove_proposal(_p: u32, ) -> Weight { + // Minimum execution time: 23_900 nanoseconds. + Weight::from_ref_time(44_517_858) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(3)) + } +} diff --git a/runtime/pangolin/src/weights/pallet_collective_technical_committee.rs b/runtime/pangolin/src/weights/pallet_collective_technical_committee.rs new file mode 100644 index 000000000..d8f0d3f53 --- /dev/null +++ b/runtime/pangolin/src/weights/pallet_collective_technical_committee.rs @@ -0,0 +1,232 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `pallet_collective` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-02-21, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("pangolin-local"), DB CACHE: 1024 + +// Executed Command: +// ./target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --steps +// 2 +// --repeat +// 1 +// --chain +// pangolin-local +// --output +// runtime/pangolin/src/weights/ +// --extrinsic +// * +// --pallet +// * + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_collective`. +pub struct WeightInfo(PhantomData); +impl pallet_collective::WeightInfo for WeightInfo { + // Storage: TechnicalCommittee Members (r:1 w:1) + // Storage: TechnicalCommittee Proposals (r:1 w:0) + // Storage: TechnicalCommittee Prime (r:0 w:1) + // Storage: TechnicalCommittee Voting (r:100 w:100) + /// The range of component `m` is `[0, 100]`. + /// The range of component `n` is `[0, 100]`. + /// The range of component `p` is `[0, 100]`. + /// The range of component `m` is `[0, 100]`. + /// The range of component `n` is `[0, 100]`. + /// The range of component `p` is `[0, 100]`. + fn set_members(m: u32, _n: u32, p: u32, ) -> Weight { + // Minimum execution time: 13_661 nanoseconds. + Weight::from_ref_time(13_661_000) + // Standard Error: 882_763 + .saturating_add(Weight::from_ref_time(3_782_833).saturating_mul(m.into())) + // Standard Error: 882_763 + .saturating_add(Weight::from_ref_time(3_774_763).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(m.into()))) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(p.into()))) + .saturating_add(T::DbWeight::get().writes(2)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(m.into()))) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(p.into()))) + } + // Storage: TechnicalCommittee Members (r:1 w:0) + /// The range of component `b` is `[2, 1024]`. + /// The range of component `m` is `[1, 100]`. + /// The range of component `b` is `[2, 1024]`. + /// The range of component `m` is `[1, 100]`. + fn execute(b: u32, m: u32, ) -> Weight { + // Minimum execution time: 17_460 nanoseconds. + Weight::from_ref_time(17_578_297) + // Standard Error: 1_363 + .saturating_add(Weight::from_ref_time(727).saturating_mul(b.into())) + // Standard Error: 14_077 + .saturating_add(Weight::from_ref_time(14_247).saturating_mul(m.into())) + .saturating_add(T::DbWeight::get().reads(1)) + } + // Storage: TechnicalCommittee Members (r:1 w:0) + // Storage: TechnicalCommittee ProposalOf (r:1 w:0) + /// The range of component `b` is `[2, 1024]`. + /// The range of component `m` is `[1, 100]`. + /// The range of component `b` is `[2, 1024]`. + /// The range of component `m` is `[1, 100]`. + fn propose_execute(b: u32, m: u32, ) -> Weight { + // Minimum execution time: 20_063 nanoseconds. + Weight::from_ref_time(18_824_592) + // Standard Error: 2_141 + .saturating_add(Weight::from_ref_time(1_294).saturating_mul(b.into())) + // Standard Error: 22_104 + .saturating_add(Weight::from_ref_time(37_818).saturating_mul(m.into())) + .saturating_add(T::DbWeight::get().reads(2)) + } + // Storage: TechnicalCommittee Members (r:1 w:0) + // Storage: TechnicalCommittee ProposalOf (r:1 w:1) + // Storage: TechnicalCommittee Proposals (r:1 w:1) + // Storage: TechnicalCommittee ProposalCount (r:1 w:1) + // Storage: TechnicalCommittee Voting (r:0 w:1) + /// The range of component `b` is `[2, 1024]`. + /// The range of component `m` is `[2, 100]`. + /// The range of component `p` is `[1, 100]`. + /// The range of component `b` is `[2, 1024]`. + /// The range of component `m` is `[2, 100]`. + /// The range of component `p` is `[1, 100]`. + fn propose_proposed(b: u32, m: u32, p: u32, ) -> Weight { + // Minimum execution time: 27_071 nanoseconds. + Weight::from_ref_time(28_037_444) + // Standard Error: 2_494 + .saturating_add(Weight::from_ref_time(305).saturating_mul(b.into())) + // Standard Error: 26_016 + .saturating_add(Weight::from_ref_time(515).saturating_mul(m.into())) + // Standard Error: 25_753 + .saturating_add(Weight::from_ref_time(191_414).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(4)) + } + // Storage: TechnicalCommittee Members (r:1 w:0) + // Storage: TechnicalCommittee Voting (r:1 w:1) + /// The range of component `m` is `[5, 100]`. + /// The range of component `m` is `[5, 100]`. + fn vote(_m: u32, ) -> Weight { + // Minimum execution time: 31_345 nanoseconds. + Weight::from_ref_time(34_949_026) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: TechnicalCommittee Voting (r:1 w:1) + // Storage: TechnicalCommittee Members (r:1 w:0) + // Storage: TechnicalCommittee Proposals (r:1 w:1) + // Storage: TechnicalCommittee ProposalOf (r:0 w:1) + /// The range of component `m` is `[4, 100]`. + /// The range of component `p` is `[1, 100]`. + /// The range of component `m` is `[4, 100]`. + /// The range of component `p` is `[1, 100]`. + fn close_early_disapproved(_m: u32, p: u32, ) -> Weight { + // Minimum execution time: 28_094 nanoseconds. + Weight::from_ref_time(33_608_315) + // Standard Error: 28_193 + .saturating_add(Weight::from_ref_time(156_414).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: TechnicalCommittee Voting (r:1 w:1) + // Storage: TechnicalCommittee Members (r:1 w:0) + // Storage: TechnicalCommittee ProposalOf (r:1 w:1) + // Storage: TechnicalCommittee Proposals (r:1 w:1) + /// The range of component `b` is `[2, 1024]`. + /// The range of component `m` is `[4, 100]`. + /// The range of component `p` is `[1, 100]`. + /// The range of component `b` is `[2, 1024]`. + /// The range of component `m` is `[4, 100]`. + /// The range of component `p` is `[1, 100]`. + fn close_early_approved(b: u32, _m: u32, p: u32, ) -> Weight { + // Minimum execution time: 33_360 nanoseconds. + Weight::from_ref_time(36_807_766) + // Standard Error: 1_869 + .saturating_add(Weight::from_ref_time(612).saturating_mul(b.into())) + // Standard Error: 19_304 + .saturating_add(Weight::from_ref_time(257_123).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: TechnicalCommittee Voting (r:1 w:1) + // Storage: TechnicalCommittee Members (r:1 w:0) + // Storage: TechnicalCommittee Prime (r:1 w:0) + // Storage: TechnicalCommittee Proposals (r:1 w:1) + // Storage: TechnicalCommittee ProposalOf (r:0 w:1) + /// The range of component `m` is `[4, 100]`. + /// The range of component `p` is `[1, 100]`. + /// The range of component `m` is `[4, 100]`. + /// The range of component `p` is `[1, 100]`. + fn close_disapproved(_m: u32, p: u32, ) -> Weight { + // Minimum execution time: 26_527 nanoseconds. + Weight::from_ref_time(32_939_132) + // Standard Error: 46_457 + .saturating_add(Weight::from_ref_time(189_909).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: TechnicalCommittee Voting (r:1 w:1) + // Storage: TechnicalCommittee Members (r:1 w:0) + // Storage: TechnicalCommittee Prime (r:1 w:0) + // Storage: TechnicalCommittee ProposalOf (r:1 w:1) + // Storage: TechnicalCommittee Proposals (r:1 w:1) + /// The range of component `b` is `[2, 1024]`. + /// The range of component `m` is `[4, 100]`. + /// The range of component `p` is `[1, 100]`. + /// The range of component `b` is `[2, 1024]`. + /// The range of component `m` is `[4, 100]`. + /// The range of component `p` is `[1, 100]`. + fn close_approved(b: u32, _m: u32, p: u32, ) -> Weight { + // Minimum execution time: 35_895 nanoseconds. + Weight::from_ref_time(41_748_749) + // Standard Error: 3_666 + .saturating_add(Weight::from_ref_time(841).saturating_mul(b.into())) + // Standard Error: 37_846 + .saturating_add(Weight::from_ref_time(225_171).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: TechnicalCommittee Proposals (r:1 w:1) + // Storage: TechnicalCommittee Voting (r:0 w:1) + // Storage: TechnicalCommittee ProposalOf (r:0 w:1) + /// The range of component `p` is `[1, 100]`. + /// The range of component `p` is `[1, 100]`. + fn disapprove_proposal(p: u32, ) -> Weight { + // Minimum execution time: 17_795 nanoseconds. + Weight::from_ref_time(18_062_914) + // Standard Error: 4_812 + .saturating_add(Weight::from_ref_time(174_585).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(3)) + } +} diff --git a/runtime/pangolin/src/weights/pallet_democracy.rs b/runtime/pangolin/src/weights/pallet_democracy.rs new file mode 100644 index 000000000..0b6166262 --- /dev/null +++ b/runtime/pangolin/src/weights/pallet_democracy.rs @@ -0,0 +1,252 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `pallet_democracy` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-02-21, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("pangolin-local"), DB CACHE: 1024 + +// Executed Command: +// ./target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --steps +// 2 +// --repeat +// 1 +// --chain +// pangolin-local +// --output +// runtime/pangolin/src/weights/ +// --extrinsic +// * +// --pallet +// * + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_democracy`. +pub struct WeightInfo(PhantomData); +impl pallet_democracy::WeightInfo for WeightInfo { + // Storage: Democracy PublicPropCount (r:1 w:1) + // Storage: Democracy PublicProps (r:1 w:1) + // Storage: Democracy Blacklist (r:1 w:0) + // Storage: Democracy DepositOf (r:0 w:1) + fn propose() -> Weight { + // Minimum execution time: 47_035 nanoseconds. + Weight::from_ref_time(47_035_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: Democracy DepositOf (r:1 w:1) + fn second() -> Weight { + // Minimum execution time: 40_752 nanoseconds. + Weight::from_ref_time(40_752_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Democracy ReferendumInfoOf (r:1 w:1) + // Storage: Democracy VotingOf (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + fn vote_new() -> Weight { + // Minimum execution time: 51_076 nanoseconds. + Weight::from_ref_time(51_076_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: Democracy ReferendumInfoOf (r:1 w:1) + // Storage: Democracy VotingOf (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + fn vote_existing() -> Weight { + // Minimum execution time: 57_454 nanoseconds. + Weight::from_ref_time(57_454_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: Democracy ReferendumInfoOf (r:1 w:1) + // Storage: Democracy Cancellations (r:1 w:1) + fn emergency_cancel() -> Weight { + // Minimum execution time: 26_724 nanoseconds. + Weight::from_ref_time(26_724_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Democracy PublicProps (r:1 w:1) + // Storage: Democracy DepositOf (r:1 w:1) + // Storage: System Account (r:2 w:2) + // Storage: Democracy NextExternal (r:1 w:1) + // Storage: Democracy ReferendumInfoOf (r:1 w:1) + // Storage: Democracy Blacklist (r:0 w:1) + fn blacklist() -> Weight { + // Minimum execution time: 86_378 nanoseconds. + Weight::from_ref_time(86_378_000) + .saturating_add(T::DbWeight::get().reads(6)) + .saturating_add(T::DbWeight::get().writes(7)) + } + // Storage: Democracy NextExternal (r:1 w:1) + // Storage: Democracy Blacklist (r:1 w:0) + fn external_propose() -> Weight { + // Minimum execution time: 21_009 nanoseconds. + Weight::from_ref_time(21_009_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Democracy NextExternal (r:0 w:1) + fn external_propose_majority() -> Weight { + // Minimum execution time: 12_539 nanoseconds. + Weight::from_ref_time(12_539_000) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Democracy NextExternal (r:0 w:1) + fn external_propose_default() -> Weight { + // Minimum execution time: 12_255 nanoseconds. + Weight::from_ref_time(12_255_000) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Democracy NextExternal (r:1 w:1) + // Storage: Democracy ReferendumCount (r:1 w:1) + // Storage: Democracy ReferendumInfoOf (r:0 w:1) + fn fast_track() -> Weight { + // Minimum execution time: 42_312 nanoseconds. + Weight::from_ref_time(42_312_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: Democracy NextExternal (r:1 w:1) + // Storage: Democracy Blacklist (r:1 w:1) + fn veto_external() -> Weight { + // Minimum execution time: 39_895 nanoseconds. + Weight::from_ref_time(39_895_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Democracy PublicProps (r:1 w:1) + // Storage: Democracy DepositOf (r:1 w:1) + // Storage: System Account (r:2 w:2) + fn cancel_proposal() -> Weight { + // Minimum execution time: 75_303 nanoseconds. + Weight::from_ref_time(75_303_000) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(4)) + } + // Storage: Democracy ReferendumInfoOf (r:0 w:1) + fn cancel_referendum() -> Weight { + // Minimum execution time: 18_843 nanoseconds. + Weight::from_ref_time(18_843_000) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Democracy LowestUnbaked (r:1 w:1) + // Storage: Democracy ReferendumCount (r:1 w:0) + // Storage: Democracy ReferendumInfoOf (r:99 w:0) + /// The range of component `r` is `[0, 99]`. + fn on_initialize_base(_r: u32, ) -> Weight { + // Minimum execution time: 9_056 nanoseconds. + Weight::from_ref_time(218_025_000) + .saturating_add(T::DbWeight::get().reads(101)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Democracy LowestUnbaked (r:1 w:1) + // Storage: Democracy ReferendumCount (r:1 w:0) + // Storage: Democracy LastTabledWasExternal (r:1 w:0) + // Storage: Democracy NextExternal (r:1 w:0) + // Storage: Democracy PublicProps (r:1 w:0) + // Storage: Democracy ReferendumInfoOf (r:99 w:0) + /// The range of component `r` is `[0, 99]`. + fn on_initialize_base_with_launch_period(_r: u32, ) -> Weight { + // Minimum execution time: 10_834 nanoseconds. + Weight::from_ref_time(208_669_000) + .saturating_add(T::DbWeight::get().reads(104)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Democracy VotingOf (r:3 w:3) + // Storage: Balances Locks (r:1 w:1) + // Storage: Democracy ReferendumInfoOf (r:99 w:99) + /// The range of component `r` is `[0, 99]`. + fn delegate(_r: u32, ) -> Weight { + // Minimum execution time: 44_488 nanoseconds. + Weight::from_ref_time(375_998_000) + .saturating_add(T::DbWeight::get().reads(103)) + .saturating_add(T::DbWeight::get().writes(103)) + } + // Storage: Democracy VotingOf (r:2 w:2) + // Storage: Democracy ReferendumInfoOf (r:99 w:99) + /// The range of component `r` is `[0, 99]`. + fn undelegate(_r: u32, ) -> Weight { + // Minimum execution time: 29_807 nanoseconds. + Weight::from_ref_time(320_329_000) + .saturating_add(T::DbWeight::get().reads(101)) + .saturating_add(T::DbWeight::get().writes(101)) + } + // Storage: Democracy PublicProps (r:0 w:1) + fn clear_public_proposals() -> Weight { + // Minimum execution time: 7_770 nanoseconds. + Weight::from_ref_time(7_770_000) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Democracy VotingOf (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + // Storage: System Account (r:1 w:1) + /// The range of component `r` is `[0, 99]`. + fn unlock_remove(_r: u32, ) -> Weight { + // Minimum execution time: 29_314 nanoseconds. + Weight::from_ref_time(34_620_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: Democracy VotingOf (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + // Storage: System Account (r:1 w:1) + /// The range of component `r` is `[0, 99]`. + fn unlock_set(_r: u32, ) -> Weight { + // Minimum execution time: 27_895 nanoseconds. + Weight::from_ref_time(36_522_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: Democracy ReferendumInfoOf (r:1 w:1) + // Storage: Democracy VotingOf (r:1 w:1) + /// The range of component `r` is `[1, 100]`. + fn remove_vote(_r: u32, ) -> Weight { + // Minimum execution time: 23_319 nanoseconds. + Weight::from_ref_time(29_446_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Democracy ReferendumInfoOf (r:1 w:1) + // Storage: Democracy VotingOf (r:1 w:1) + /// The range of component `r` is `[1, 100]`. + fn remove_other_vote(_r: u32, ) -> Weight { + // Minimum execution time: 16_782 nanoseconds. + Weight::from_ref_time(30_664_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } +} diff --git a/runtime/pangolin/src/weights/pallet_elections_phragmen.rs b/runtime/pangolin/src/weights/pallet_elections_phragmen.rs new file mode 100644 index 000000000..5d93c2f56 --- /dev/null +++ b/runtime/pangolin/src/weights/pallet_elections_phragmen.rs @@ -0,0 +1,202 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `pallet_elections_phragmen` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-02-21, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("pangolin-local"), DB CACHE: 1024 + +// Executed Command: +// ./target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --steps +// 2 +// --repeat +// 1 +// --chain +// pangolin-local +// --output +// runtime/pangolin/src/weights/ +// --extrinsic +// * +// --pallet +// * + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_elections_phragmen`. +pub struct WeightInfo(PhantomData); +impl pallet_elections_phragmen::WeightInfo for WeightInfo { + // Storage: PhragmenElection Candidates (r:1 w:0) + // Storage: PhragmenElection Members (r:1 w:0) + // Storage: PhragmenElection RunnersUp (r:1 w:0) + // Storage: PhragmenElection Voting (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + /// The range of component `v` is `[1, 16]`. + fn vote_equal(_v: u32, ) -> Weight { + // Minimum execution time: 48_148 nanoseconds. + Weight::from_ref_time(51_815_000) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: PhragmenElection Candidates (r:1 w:0) + // Storage: PhragmenElection Members (r:1 w:0) + // Storage: PhragmenElection RunnersUp (r:1 w:0) + // Storage: PhragmenElection Voting (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + /// The range of component `v` is `[2, 16]`. + fn vote_more(_v: u32, ) -> Weight { + // Minimum execution time: 55_391 nanoseconds. + Weight::from_ref_time(58_799_000) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: PhragmenElection Candidates (r:1 w:0) + // Storage: PhragmenElection Members (r:1 w:0) + // Storage: PhragmenElection RunnersUp (r:1 w:0) + // Storage: PhragmenElection Voting (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + /// The range of component `v` is `[2, 16]`. + fn vote_less(_v: u32, ) -> Weight { + // Minimum execution time: 52_970 nanoseconds. + Weight::from_ref_time(56_003_000) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: PhragmenElection Voting (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + fn remove_voter() -> Weight { + // Minimum execution time: 59_730 nanoseconds. + Weight::from_ref_time(59_730_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: PhragmenElection Candidates (r:1 w:1) + // Storage: PhragmenElection Members (r:1 w:0) + // Storage: PhragmenElection RunnersUp (r:1 w:0) + /// The range of component `c` is `[1, 30]`. + fn submit_candidacy(_c: u32, ) -> Weight { + // Minimum execution time: 36_106 nanoseconds. + Weight::from_ref_time(50_997_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: PhragmenElection Candidates (r:1 w:1) + /// The range of component `c` is `[1, 30]`. + fn renounce_candidacy_candidate(_c: u32, ) -> Weight { + // Minimum execution time: 32_717 nanoseconds. + Weight::from_ref_time(37_611_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: PhragmenElection Members (r:1 w:1) + // Storage: PhragmenElection RunnersUp (r:1 w:1) + // Storage: Council Prime (r:1 w:1) + // Storage: Council Proposals (r:1 w:0) + // Storage: Council Members (r:0 w:1) + fn renounce_candidacy_members() -> Weight { + // Minimum execution time: 47_022 nanoseconds. + Weight::from_ref_time(47_022_000) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(4)) + } + // Storage: PhragmenElection RunnersUp (r:1 w:1) + fn renounce_candidacy_runners_up() -> Weight { + // Minimum execution time: 33_459 nanoseconds. + Weight::from_ref_time(33_459_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Benchmark Override (r:0 w:0) + fn remove_member_without_replacement() -> Weight { + // Minimum execution time: 500_000_000 nanoseconds. + Weight::from_ref_time(500_000_000_000) + } + // Storage: PhragmenElection Members (r:1 w:1) + // Storage: System Account (r:2 w:2) + // Storage: PhragmenElection RunnersUp (r:1 w:1) + // Storage: Council Prime (r:1 w:1) + // Storage: Council Proposals (r:1 w:0) + // Storage: Council Members (r:0 w:1) + fn remove_member_with_replacement() -> Weight { + // Minimum execution time: 57_856 nanoseconds. + Weight::from_ref_time(57_856_000) + .saturating_add(T::DbWeight::get().reads(6)) + .saturating_add(T::DbWeight::get().writes(6)) + } + // Storage: PhragmenElection Voting (r:151 w:150) + // Storage: PhragmenElection Members (r:1 w:0) + // Storage: PhragmenElection RunnersUp (r:1 w:0) + // Storage: PhragmenElection Candidates (r:1 w:0) + // Storage: Balances Locks (r:150 w:150) + // Storage: System Account (r:150 w:150) + /// The range of component `v` is `[150, 300]`. + /// The range of component `d` is `[0, 150]`. + fn clean_defunct_voters(v: u32, d: u32, ) -> Weight { + // Minimum execution time: 7_061_492 nanoseconds. + Weight::from_ref_time(405_137_000) + // Standard Error: 675_932 + .saturating_add(Weight::from_ref_time(43_469_089).saturating_mul(v.into())) + // Standard Error: 675_932 + .saturating_add(Weight::from_ref_time(906_609).saturating_mul(d.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().reads((3_u64).saturating_mul(v.into()))) + .saturating_add(T::DbWeight::get().writes((3_u64).saturating_mul(v.into()))) + } + // Storage: PhragmenElection Candidates (r:1 w:1) + // Storage: PhragmenElection Members (r:1 w:1) + // Storage: PhragmenElection RunnersUp (r:1 w:1) + // Storage: PhragmenElection Voting (r:301 w:0) + // Storage: Council Proposals (r:1 w:0) + // Storage: PhragmenElection ElectionRounds (r:1 w:1) + // Storage: Council Members (r:0 w:1) + // Storage: Council Prime (r:0 w:1) + // Storage: System Account (r:17 w:17) + /// The range of component `c` is `[1, 30]`. + /// The range of component `v` is `[1, 300]`. + /// The range of component `e` is `[300, 4800]`. + fn election_phragmen(c: u32, v: u32, e: u32, ) -> Weight { + // Minimum execution time: 532_432 nanoseconds. + Weight::from_ref_time(532_432_000) + // Standard Error: 67_019_452 + .saturating_add(Weight::from_ref_time(38_184_160).saturating_mul(c.into())) + // Standard Error: 6_606_785 + .saturating_add(Weight::from_ref_time(7_621_035).saturating_mul(v.into())) + // Standard Error: 424_322 + .saturating_add(Weight::from_ref_time(150_192).saturating_mul(e.into())) + .saturating_add(T::DbWeight::get().reads(35)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(c.into()))) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(v.into()))) + .saturating_add(T::DbWeight::get().writes(5)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(c.into()))) + } +} diff --git a/runtime/pangolin/src/weights/pallet_fee_market.rs b/runtime/pangolin/src/weights/pallet_fee_market.rs new file mode 100644 index 000000000..c93db6764 --- /dev/null +++ b/runtime/pangolin/src/weights/pallet_fee_market.rs @@ -0,0 +1,139 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `pallet_fee_market` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-02-21, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("pangolin-local"), DB CACHE: 1024 + +// Executed Command: +// ./target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --steps +// 2 +// --repeat +// 1 +// --chain +// pangolin-local +// --output +// runtime/pangolin/src/weights/ +// --extrinsic +// * +// --pallet +// * + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_fee_market`. +pub struct WeightInfo(PhantomData); +impl pallet_fee_market::WeightInfo for WeightInfo { + // Storage: PangoroFeeMarket Relayers (r:1 w:1) + // Storage: System Account (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + // Storage: PangoroFeeMarket RelayersMap (r:10 w:1) + // Storage: PangoroFeeMarket Orders (r:1 w:0) + // Storage: PangoroFeeMarket AssignedRelayersNumber (r:1 w:0) + // Storage: PangoroFeeMarket AssignedRelayers (r:0 w:1) + fn enroll_and_lock_collateral() -> Weight { + // Minimum execution time: 109_865 nanoseconds. + Weight::from_ref_time(109_865_000) + .saturating_add(T::DbWeight::get().reads(15)) + .saturating_add(T::DbWeight::get().writes(5)) + } + // Storage: PangoroFeeMarket Relayers (r:1 w:0) + // Storage: System Account (r:1 w:1) + // Storage: PangoroFeeMarket RelayersMap (r:10 w:1) + // Storage: Balances Locks (r:1 w:1) + // Storage: PangoroFeeMarket Orders (r:1 w:0) + // Storage: PangoroFeeMarket AssignedRelayersNumber (r:1 w:0) + // Storage: PangoroFeeMarket AssignedRelayers (r:0 w:1) + fn increase_locked_collateral() -> Weight { + // Minimum execution time: 124_647 nanoseconds. + Weight::from_ref_time(124_647_000) + .saturating_add(T::DbWeight::get().reads(15)) + .saturating_add(T::DbWeight::get().writes(4)) + } + // Storage: PangoroFeeMarket Relayers (r:1 w:0) + // Storage: System Account (r:1 w:1) + // Storage: PangoroFeeMarket RelayersMap (r:10 w:1) + // Storage: PangoroFeeMarket Orders (r:1 w:0) + // Storage: Balances Locks (r:1 w:1) + // Storage: PangoroFeeMarket AssignedRelayersNumber (r:1 w:0) + // Storage: PangoroFeeMarket AssignedRelayers (r:0 w:1) + fn decrease_locked_collateral() -> Weight { + // Minimum execution time: 123_810 nanoseconds. + Weight::from_ref_time(123_810_000) + .saturating_add(T::DbWeight::get().reads(15)) + .saturating_add(T::DbWeight::get().writes(4)) + } + // Storage: PangoroFeeMarket Relayers (r:1 w:0) + // Storage: PangoroFeeMarket RelayersMap (r:10 w:1) + // Storage: PangoroFeeMarket Orders (r:1 w:0) + // Storage: PangoroFeeMarket AssignedRelayersNumber (r:1 w:0) + // Storage: PangoroFeeMarket AssignedRelayers (r:0 w:1) + fn update_relay_fee() -> Weight { + // Minimum execution time: 94_641 nanoseconds. + Weight::from_ref_time(94_641_000) + .saturating_add(T::DbWeight::get().reads(13)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: PangoroFeeMarket Relayers (r:1 w:1) + // Storage: PangoroFeeMarket Orders (r:1 w:0) + // Storage: Balances Locks (r:1 w:1) + // Storage: System Account (r:1 w:1) + // Storage: PangoroFeeMarket AssignedRelayers (r:1 w:1) + // Storage: PangoroFeeMarket RelayersMap (r:9 w:1) + // Storage: PangoroFeeMarket AssignedRelayersNumber (r:1 w:0) + fn cancel_enrollment() -> Weight { + // Minimum execution time: 110_458 nanoseconds. + Weight::from_ref_time(110_458_000) + .saturating_add(T::DbWeight::get().reads(15)) + .saturating_add(T::DbWeight::get().writes(5)) + } + // Storage: PangoroFeeMarket CollateralSlashProtect (r:0 w:1) + fn set_slash_protect() -> Weight { + // Minimum execution time: 27_039 nanoseconds. + Weight::from_ref_time(27_039_000) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: PangoroFeeMarket Relayers (r:1 w:0) + // Storage: PangoroFeeMarket RelayersMap (r:10 w:0) + // Storage: PangoroFeeMarket Orders (r:1 w:0) + // Storage: PangoroFeeMarket AssignedRelayers (r:0 w:1) + // Storage: PangoroFeeMarket AssignedRelayersNumber (r:0 w:1) + fn set_assigned_relayers_number() -> Weight { + // Minimum execution time: 90_728 nanoseconds. + Weight::from_ref_time(90_728_000) + .saturating_add(T::DbWeight::get().reads(12)) + .saturating_add(T::DbWeight::get().writes(2)) + } +} diff --git a/runtime/pangolin/src/weights/pallet_identity.rs b/runtime/pangolin/src/weights/pallet_identity.rs new file mode 100644 index 000000000..cb4c6e10e --- /dev/null +++ b/runtime/pangolin/src/weights/pallet_identity.rs @@ -0,0 +1,240 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `pallet_identity` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-02-21, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("pangolin-local"), DB CACHE: 1024 + +// Executed Command: +// ./target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --steps +// 2 +// --repeat +// 1 +// --chain +// pangolin-local +// --output +// runtime/pangolin/src/weights/ +// --extrinsic +// * +// --pallet +// * + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_identity`. +pub struct WeightInfo(PhantomData); +impl pallet_identity::WeightInfo for WeightInfo { + // Storage: Identity Registrars (r:1 w:1) + /// The range of component `r` is `[1, 19]`. + fn add_registrar(_r: u32, ) -> Weight { + // Minimum execution time: 17_244 nanoseconds. + Weight::from_ref_time(21_349_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Identity IdentityOf (r:1 w:1) + /// The range of component `r` is `[1, 20]`. + /// The range of component `x` is `[0, 100]`. + fn set_identity(_r: u32, x: u32, ) -> Weight { + // Minimum execution time: 37_214 nanoseconds. + Weight::from_ref_time(44_716_631) + // Standard Error: 32_727 + .saturating_add(Weight::from_ref_time(364_345).saturating_mul(x.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Identity IdentityOf (r:1 w:0) + // Storage: Identity SubsOf (r:1 w:1) + // Storage: Identity SuperOf (r:100 w:100) + /// The range of component `s` is `[0, 100]`. + fn set_subs_new(_s: u32, ) -> Weight { + // Minimum execution time: 15_193 nanoseconds. + Weight::from_ref_time(269_849_000) + .saturating_add(T::DbWeight::get().reads(102)) + .saturating_add(T::DbWeight::get().writes(101)) + } + // Storage: Identity IdentityOf (r:1 w:0) + // Storage: Identity SubsOf (r:1 w:1) + // Storage: Identity SuperOf (r:0 w:100) + /// The range of component `p` is `[0, 100]`. + fn set_subs_old(_p: u32, ) -> Weight { + // Minimum execution time: 15_333 nanoseconds. + Weight::from_ref_time(128_932_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(101)) + } + // Storage: Identity SubsOf (r:1 w:1) + // Storage: Identity IdentityOf (r:1 w:1) + // Storage: Identity SuperOf (r:0 w:100) + /// The range of component `r` is `[1, 20]`. + /// The range of component `s` is `[0, 100]`. + /// The range of component `x` is `[0, 100]`. + fn clear_identity(r: u32, s: u32, x: u32, ) -> Weight { + // Minimum execution time: 53_139 nanoseconds. + Weight::from_ref_time(34_638_684) + // Standard Error: 1_191_269 + .saturating_add(Weight::from_ref_time(105_649).saturating_mul(r.into())) + // Standard Error: 226_341 + .saturating_add(Weight::from_ref_time(1_081_613).saturating_mul(s.into())) + // Standard Error: 226_341 + .saturating_add(Weight::from_ref_time(163_873).saturating_mul(x.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(s.into()))) + } + // Storage: Identity Registrars (r:1 w:0) + // Storage: Identity IdentityOf (r:1 w:1) + /// The range of component `r` is `[1, 20]`. + /// The range of component `x` is `[0, 100]`. + fn request_judgement(r: u32, x: u32, ) -> Weight { + // Minimum execution time: 36_771 nanoseconds. + Weight::from_ref_time(34_392_578) + // Standard Error: 40_065 + .saturating_add(Weight::from_ref_time(118_921).saturating_mul(r.into())) + // Standard Error: 7_612 + .saturating_add(Weight::from_ref_time(364_635).saturating_mul(x.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Identity IdentityOf (r:1 w:1) + /// The range of component `r` is `[1, 20]`. + /// The range of component `x` is `[0, 100]`. + fn cancel_request(r: u32, x: u32, ) -> Weight { + // Minimum execution time: 36_991 nanoseconds. + Weight::from_ref_time(32_892_052) + // Standard Error: 536_206 + .saturating_add(Weight::from_ref_time(204_947).saturating_mul(r.into())) + // Standard Error: 101_879 + .saturating_add(Weight::from_ref_time(367_020).saturating_mul(x.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Identity Registrars (r:1 w:1) + /// The range of component `r` is `[1, 19]`. + fn set_fee(_r: u32, ) -> Weight { + // Minimum execution time: 10_489 nanoseconds. + Weight::from_ref_time(12_110_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Identity Registrars (r:1 w:1) + /// The range of component `r` is `[1, 19]`. + fn set_account_id(_r: u32, ) -> Weight { + // Minimum execution time: 10_109 nanoseconds. + Weight::from_ref_time(12_655_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Identity Registrars (r:1 w:1) + /// The range of component `r` is `[1, 19]`. + fn set_fields(_r: u32, ) -> Weight { + // Minimum execution time: 9_879 nanoseconds. + Weight::from_ref_time(12_937_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Identity Registrars (r:1 w:0) + // Storage: Identity IdentityOf (r:1 w:1) + /// The range of component `r` is `[1, 19]`. + /// The range of component `x` is `[0, 100]`. + fn provide_judgement(r: u32, x: u32, ) -> Weight { + // Minimum execution time: 31_307 nanoseconds. + Weight::from_ref_time(28_926_722) + // Standard Error: 637_875 + .saturating_add(Weight::from_ref_time(125_277).saturating_mul(r.into())) + // Standard Error: 114_817 + .saturating_add(Weight::from_ref_time(590_910).saturating_mul(x.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Identity SubsOf (r:1 w:1) + // Storage: Identity IdentityOf (r:1 w:1) + // Storage: System Account (r:2 w:2) + // Storage: Identity SuperOf (r:0 w:100) + /// The range of component `r` is `[1, 20]`. + /// The range of component `s` is `[0, 100]`. + /// The range of component `x` is `[0, 100]`. + fn kill_identity(r: u32, s: u32, x: u32, ) -> Weight { + // Minimum execution time: 66_461 nanoseconds. + Weight::from_ref_time(37_626_947) + // Standard Error: 303_300 + .saturating_add(Weight::from_ref_time(66_385).saturating_mul(r.into())) + // Standard Error: 57_627 + .saturating_add(Weight::from_ref_time(1_027_823).saturating_mul(s.into())) + // Standard Error: 57_627 + .saturating_add(Weight::from_ref_time(275_063).saturating_mul(x.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(3)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(s.into()))) + } + // Storage: Identity IdentityOf (r:1 w:0) + // Storage: Identity SuperOf (r:1 w:1) + // Storage: Identity SubsOf (r:1 w:1) + /// The range of component `s` is `[0, 99]`. + fn add_sub(_s: u32, ) -> Weight { + // Minimum execution time: 40_637 nanoseconds. + Weight::from_ref_time(41_225_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Identity IdentityOf (r:1 w:0) + // Storage: Identity SuperOf (r:1 w:1) + /// The range of component `s` is `[1, 100]`. + fn rename_sub(_s: u32, ) -> Weight { + // Minimum execution time: 15_861 nanoseconds. + Weight::from_ref_time(22_252_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Identity IdentityOf (r:1 w:0) + // Storage: Identity SuperOf (r:1 w:1) + // Storage: Identity SubsOf (r:1 w:1) + /// The range of component `s` is `[1, 100]`. + fn remove_sub(_s: u32, ) -> Weight { + // Minimum execution time: 41_624 nanoseconds. + Weight::from_ref_time(46_038_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Identity SuperOf (r:1 w:1) + // Storage: Identity SubsOf (r:1 w:1) + /// The range of component `s` is `[0, 99]`. + fn quit_sub(_s: u32, ) -> Weight { + // Minimum execution time: 25_832 nanoseconds. + Weight::from_ref_time(34_866_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } +} diff --git a/runtime/pangolin/src/weights/pallet_membership.rs b/runtime/pangolin/src/weights/pallet_membership.rs new file mode 100644 index 000000000..7155a45bd --- /dev/null +++ b/runtime/pangolin/src/weights/pallet_membership.rs @@ -0,0 +1,136 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `pallet_membership` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-02-21, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("pangolin-local"), DB CACHE: 1024 + +// Executed Command: +// ./target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --steps +// 2 +// --repeat +// 1 +// --chain +// pangolin-local +// --output +// runtime/pangolin/src/weights/ +// --extrinsic +// * +// --pallet +// * + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_membership`. +pub struct WeightInfo(PhantomData); +impl pallet_membership::WeightInfo for WeightInfo { + // Storage: TechnicalMembership Members (r:1 w:1) + // Storage: TechnicalCommittee Proposals (r:1 w:0) + // Storage: TechnicalCommittee Members (r:0 w:1) + // Storage: TechnicalCommittee Prime (r:0 w:1) + /// The range of component `m` is `[1, 99]`. + fn add_member(_m: u32, ) -> Weight { + // Minimum execution time: 21_748 nanoseconds. + Weight::from_ref_time(24_390_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: TechnicalMembership Members (r:1 w:1) + // Storage: TechnicalCommittee Proposals (r:1 w:0) + // Storage: TechnicalMembership Prime (r:1 w:0) + // Storage: TechnicalCommittee Members (r:0 w:1) + // Storage: TechnicalCommittee Prime (r:0 w:1) + /// The range of component `m` is `[2, 100]`. + fn remove_member(_m: u32, ) -> Weight { + // Minimum execution time: 23_734 nanoseconds. + Weight::from_ref_time(26_506_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: TechnicalMembership Members (r:1 w:1) + // Storage: TechnicalCommittee Proposals (r:1 w:0) + // Storage: TechnicalMembership Prime (r:1 w:0) + // Storage: TechnicalCommittee Members (r:0 w:1) + // Storage: TechnicalCommittee Prime (r:0 w:1) + /// The range of component `m` is `[2, 100]`. + fn swap_member(_m: u32, ) -> Weight { + // Minimum execution time: 25_965 nanoseconds. + Weight::from_ref_time(52_917_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: TechnicalMembership Members (r:1 w:1) + // Storage: TechnicalCommittee Proposals (r:1 w:0) + // Storage: TechnicalMembership Prime (r:1 w:0) + // Storage: TechnicalCommittee Members (r:0 w:1) + // Storage: TechnicalCommittee Prime (r:0 w:1) + /// The range of component `m` is `[1, 100]`. + fn reset_member(_m: u32, ) -> Weight { + // Minimum execution time: 22_969 nanoseconds. + Weight::from_ref_time(34_983_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: TechnicalMembership Members (r:1 w:1) + // Storage: TechnicalCommittee Proposals (r:1 w:0) + // Storage: TechnicalMembership Prime (r:1 w:1) + // Storage: TechnicalCommittee Members (r:0 w:1) + // Storage: TechnicalCommittee Prime (r:0 w:1) + /// The range of component `m` is `[1, 100]`. + fn change_key(_m: u32, ) -> Weight { + // Minimum execution time: 27_883 nanoseconds. + Weight::from_ref_time(33_543_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(4)) + } + // Storage: TechnicalMembership Members (r:1 w:0) + // Storage: TechnicalMembership Prime (r:0 w:1) + // Storage: TechnicalCommittee Prime (r:0 w:1) + /// The range of component `m` is `[1, 100]`. + fn set_prime(_m: u32, ) -> Weight { + // Minimum execution time: 9_224 nanoseconds. + Weight::from_ref_time(10_124_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: TechnicalMembership Prime (r:0 w:1) + // Storage: TechnicalCommittee Prime (r:0 w:1) + /// The range of component `m` is `[1, 100]`. + fn clear_prime(_m: u32, ) -> Weight { + // Minimum execution time: 5_646 nanoseconds. + Weight::from_ref_time(6_593_000) + .saturating_add(T::DbWeight::get().writes(2)) + } +} diff --git a/runtime/pangolin/src/weights/pallet_multisig.rs b/runtime/pangolin/src/weights/pallet_multisig.rs new file mode 100644 index 000000000..c6c5131f8 --- /dev/null +++ b/runtime/pangolin/src/weights/pallet_multisig.rs @@ -0,0 +1,130 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `pallet_multisig` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-02-21, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("pangolin-local"), DB CACHE: 1024 + +// Executed Command: +// ./target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --steps +// 2 +// --repeat +// 1 +// --chain +// pangolin-local +// --output +// runtime/pangolin/src/weights/ +// --extrinsic +// * +// --pallet +// * + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_multisig`. +pub struct WeightInfo(PhantomData); +impl pallet_multisig::WeightInfo for WeightInfo { + /// The range of component `z` is `[0, 10000]`. + fn as_multi_threshold_1(_z: u32, ) -> Weight { + // Minimum execution time: 18_811 nanoseconds. + Weight::from_ref_time(25_726_000) + } + // Storage: Multisig Multisigs (r:1 w:1) + // Storage: unknown [0x3a65787472696e7369635f696e646578] (r:1 w:0) + /// The range of component `s` is `[2, 100]`. + /// The range of component `z` is `[0, 10000]`. + fn as_multi_create(s: u32, z: u32, ) -> Weight { + // Minimum execution time: 49_100 nanoseconds. + Weight::from_ref_time(35_786_224) + // Standard Error: 99_230 + .saturating_add(Weight::from_ref_time(133_137).saturating_mul(s.into())) + // Standard Error: 972 + .saturating_add(Weight::from_ref_time(1_960).saturating_mul(z.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Multisig Multisigs (r:1 w:1) + /// The range of component `s` is `[3, 100]`. + /// The range of component `z` is `[0, 10000]`. + fn as_multi_approve(s: u32, z: u32, ) -> Weight { + // Minimum execution time: 35_870 nanoseconds. + Weight::from_ref_time(34_647_319) + // Standard Error: 28_480 + .saturating_add(Weight::from_ref_time(12_226).saturating_mul(s.into())) + // Standard Error: 276 + .saturating_add(Weight::from_ref_time(928).saturating_mul(z.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Multisig Multisigs (r:1 w:1) + // Storage: System Account (r:1 w:1) + /// The range of component `s` is `[2, 100]`. + /// The range of component `z` is `[0, 10000]`. + fn as_multi_complete(s: u32, z: u32, ) -> Weight { + // Minimum execution time: 52_387 nanoseconds. + Weight::from_ref_time(51_591_591) + // Standard Error: 12_097 + .saturating_add(Weight::from_ref_time(7_954).saturating_mul(s.into())) + // Standard Error: 118 + .saturating_add(Weight::from_ref_time(1_039).saturating_mul(z.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Multisig Multisigs (r:1 w:1) + // Storage: unknown [0x3a65787472696e7369635f696e646578] (r:1 w:0) + /// The range of component `s` is `[2, 100]`. + fn approve_as_multi_create(_s: u32, ) -> Weight { + // Minimum execution time: 40_670 nanoseconds. + Weight::from_ref_time(53_977_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Multisig Multisigs (r:1 w:1) + /// The range of component `s` is `[2, 100]`. + fn approve_as_multi_approve(_s: u32, ) -> Weight { + // Minimum execution time: 24_643 nanoseconds. + Weight::from_ref_time(33_293_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Multisig Multisigs (r:1 w:1) + /// The range of component `s` is `[2, 100]`. + fn cancel_as_multi(_s: u32, ) -> Weight { + // Minimum execution time: 38_988 nanoseconds. + Weight::from_ref_time(43_679_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } +} diff --git a/runtime/pangolin/src/weights/pallet_preimage.rs b/runtime/pangolin/src/weights/pallet_preimage.rs new file mode 100644 index 000000000..2bd796193 --- /dev/null +++ b/runtime/pangolin/src/weights/pallet_preimage.rs @@ -0,0 +1,152 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `pallet_preimage` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-02-21, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("pangolin-local"), DB CACHE: 1024 + +// Executed Command: +// ./target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --steps +// 2 +// --repeat +// 1 +// --chain +// pangolin-local +// --output +// runtime/pangolin/src/weights/ +// --extrinsic +// * +// --pallet +// * + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_preimage`. +pub struct WeightInfo(PhantomData); +impl pallet_preimage::WeightInfo for WeightInfo { + // Storage: Preimage StatusFor (r:1 w:1) + // Storage: Preimage PreimageFor (r:0 w:1) + /// The range of component `s` is `[0, 4194304]`. + fn note_preimage(_s: u32, ) -> Weight { + // Minimum execution time: 40_707 nanoseconds. + Weight::from_ref_time(6_866_096_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Preimage StatusFor (r:1 w:1) + // Storage: Preimage PreimageFor (r:0 w:1) + /// The range of component `s` is `[0, 4194304]`. + fn note_requested_preimage(_s: u32, ) -> Weight { + // Minimum execution time: 33_720 nanoseconds. + Weight::from_ref_time(7_005_652_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Preimage StatusFor (r:1 w:1) + // Storage: Preimage PreimageFor (r:0 w:1) + /// The range of component `s` is `[0, 4194304]`. + fn note_no_deposit_preimage(_s: u32, ) -> Weight { + // Minimum execution time: 30_681 nanoseconds. + Weight::from_ref_time(6_763_085_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Preimage StatusFor (r:1 w:1) + // Storage: Preimage PreimageFor (r:0 w:1) + fn unnote_preimage() -> Weight { + // Minimum execution time: 230_248 nanoseconds. + Weight::from_ref_time(230_248_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Preimage StatusFor (r:1 w:1) + // Storage: Preimage PreimageFor (r:0 w:1) + fn unnote_no_deposit_preimage() -> Weight { + // Minimum execution time: 191_384 nanoseconds. + Weight::from_ref_time(191_384_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Preimage StatusFor (r:1 w:1) + fn request_preimage() -> Weight { + // Minimum execution time: 209_034 nanoseconds. + Weight::from_ref_time(209_034_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Preimage StatusFor (r:1 w:1) + fn request_no_deposit_preimage() -> Weight { + // Minimum execution time: 170_505 nanoseconds. + Weight::from_ref_time(170_505_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Preimage StatusFor (r:1 w:1) + fn request_unnoted_preimage() -> Weight { + // Minimum execution time: 33_188 nanoseconds. + Weight::from_ref_time(33_188_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Preimage StatusFor (r:1 w:1) + fn request_requested_preimage() -> Weight { + // Minimum execution time: 22_002 nanoseconds. + Weight::from_ref_time(22_002_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Preimage StatusFor (r:1 w:1) + // Storage: Preimage PreimageFor (r:0 w:1) + fn unrequest_preimage() -> Weight { + // Minimum execution time: 198_843 nanoseconds. + Weight::from_ref_time(198_843_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Preimage StatusFor (r:1 w:1) + fn unrequest_unnoted_preimage() -> Weight { + // Minimum execution time: 21_397 nanoseconds. + Weight::from_ref_time(21_397_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Preimage StatusFor (r:1 w:1) + fn unrequest_multi_referenced_preimage() -> Weight { + // Minimum execution time: 22_030 nanoseconds. + Weight::from_ref_time(22_030_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } +} diff --git a/runtime/pangolin/src/weights/pallet_proxy.rs b/runtime/pangolin/src/weights/pallet_proxy.rs new file mode 100644 index 000000000..e3d6e3735 --- /dev/null +++ b/runtime/pangolin/src/weights/pallet_proxy.rs @@ -0,0 +1,161 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `pallet_proxy` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-02-21, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("pangolin-local"), DB CACHE: 1024 + +// Executed Command: +// ./target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --steps +// 2 +// --repeat +// 1 +// --chain +// pangolin-local +// --output +// runtime/pangolin/src/weights/ +// --extrinsic +// * +// --pallet +// * + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_proxy`. +pub struct WeightInfo(PhantomData); +impl pallet_proxy::WeightInfo for WeightInfo { + // Storage: Proxy Proxies (r:1 w:0) + /// The range of component `p` is `[1, 31]`. + fn proxy(_p: u32, ) -> Weight { + // Minimum execution time: 34_968 nanoseconds. + Weight::from_ref_time(38_373_000) + .saturating_add(T::DbWeight::get().reads(1)) + } + // Storage: Proxy Proxies (r:1 w:0) + // Storage: Proxy Announcements (r:1 w:1) + // Storage: System Account (r:1 w:1) + /// The range of component `a` is `[0, 31]`. + /// The range of component `p` is `[1, 31]`. + fn proxy_announced(_a: u32, p: u32, ) -> Weight { + // Minimum execution time: 52_917 nanoseconds. + Weight::from_ref_time(55_552_783) + // Standard Error: 29_300 + .saturating_add(Weight::from_ref_time(38_716).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Proxy Announcements (r:1 w:1) + // Storage: System Account (r:1 w:1) + /// The range of component `a` is `[0, 31]`. + /// The range of component `p` is `[1, 31]`. + fn remove_announcement(a: u32, _p: u32, ) -> Weight { + // Minimum execution time: 38_678 nanoseconds. + Weight::from_ref_time(41_700_500) + // Standard Error: 81_406 + .saturating_add(Weight::from_ref_time(91_838).saturating_mul(a.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Proxy Announcements (r:1 w:1) + // Storage: System Account (r:1 w:1) + /// The range of component `a` is `[0, 31]`. + /// The range of component `p` is `[1, 31]`. + fn reject_announcement(a: u32, p: u32, ) -> Weight { + // Minimum execution time: 39_809 nanoseconds. + Weight::from_ref_time(29_165_150) + // Standard Error: 300_343 + .saturating_add(Weight::from_ref_time(344_080).saturating_mul(a.into())) + // Standard Error: 310_354 + .saturating_add(Weight::from_ref_time(343_350).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Proxy Proxies (r:1 w:0) + // Storage: Proxy Announcements (r:1 w:1) + // Storage: System Account (r:1 w:1) + /// The range of component `a` is `[0, 31]`. + /// The range of component `p` is `[1, 31]`. + fn announce(a: u32, p: u32, ) -> Weight { + // Minimum execution time: 45_548 nanoseconds. + Weight::from_ref_time(45_090_750) + // Standard Error: 133_786 + .saturating_add(Weight::from_ref_time(189_338).saturating_mul(a.into())) + // Standard Error: 138_246 + .saturating_add(Weight::from_ref_time(14_750).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Proxy Proxies (r:1 w:1) + /// The range of component `p` is `[1, 31]`. + fn add_proxy(_p: u32, ) -> Weight { + // Minimum execution time: 39_543 nanoseconds. + Weight::from_ref_time(48_058_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Proxy Proxies (r:1 w:1) + /// The range of component `p` is `[1, 31]`. + fn remove_proxy(_p: u32, ) -> Weight { + // Minimum execution time: 40_799 nanoseconds. + Weight::from_ref_time(46_795_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Proxy Proxies (r:1 w:1) + /// The range of component `p` is `[1, 31]`. + fn remove_proxies(_p: u32, ) -> Weight { + // Minimum execution time: 37_919 nanoseconds. + Weight::from_ref_time(38_639_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: unknown [0x3a65787472696e7369635f696e646578] (r:1 w:0) + // Storage: Proxy Proxies (r:1 w:1) + /// The range of component `p` is `[1, 31]`. + fn create_pure(_p: u32, ) -> Weight { + // Minimum execution time: 48_536 nanoseconds. + Weight::from_ref_time(48_721_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Proxy Proxies (r:1 w:1) + /// The range of component `p` is `[0, 30]`. + fn kill_pure(_p: u32, ) -> Weight { + // Minimum execution time: 38_173 nanoseconds. + Weight::from_ref_time(42_299_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } +} diff --git a/runtime/pangolin/src/weights/pallet_scheduler.rs b/runtime/pangolin/src/weights/pallet_scheduler.rs new file mode 100644 index 000000000..742d597ef --- /dev/null +++ b/runtime/pangolin/src/weights/pallet_scheduler.rs @@ -0,0 +1,140 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `pallet_scheduler` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-02-21, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("pangolin-local"), DB CACHE: 1024 + +// Executed Command: +// ./target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --steps +// 2 +// --repeat +// 1 +// --chain +// pangolin-local +// --output +// runtime/pangolin/src/weights/ +// --extrinsic +// * +// --pallet +// * + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_scheduler`. +pub struct WeightInfo(PhantomData); +impl pallet_scheduler::WeightInfo for WeightInfo { + // Storage: Scheduler IncompleteSince (r:1 w:1) + fn service_agendas_base() -> Weight { + // Minimum execution time: 13_005 nanoseconds. + Weight::from_ref_time(13_005_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Scheduler Agenda (r:1 w:1) + /// The range of component `s` is `[0, 50]`. + fn service_agenda_base(_s: u32, ) -> Weight { + // Minimum execution time: 14_485 nanoseconds. + Weight::from_ref_time(41_312_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + fn service_task_base() -> Weight { + // Minimum execution time: 20_886 nanoseconds. + Weight::from_ref_time(20_886_000) + } + // Storage: Preimage PreimageFor (r:1 w:1) + // Storage: Preimage StatusFor (r:1 w:1) + /// The range of component `s` is `[128, 4194304]`. + fn service_task_fetched(_s: u32, ) -> Weight { + // Minimum execution time: 33_793 nanoseconds. + Weight::from_ref_time(5_154_304_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Scheduler Lookup (r:0 w:1) + fn service_task_named() -> Weight { + // Minimum execution time: 33_616 nanoseconds. + Weight::from_ref_time(33_616_000) + .saturating_add(T::DbWeight::get().writes(1)) + } + fn service_task_periodic() -> Weight { + // Minimum execution time: 23_182 nanoseconds. + Weight::from_ref_time(23_182_000) + } + fn execute_dispatch_signed() -> Weight { + // Minimum execution time: 20_355 nanoseconds. + Weight::from_ref_time(20_355_000) + } + fn execute_dispatch_unsigned() -> Weight { + // Minimum execution time: 17_728 nanoseconds. + Weight::from_ref_time(17_728_000) + } + // Storage: Scheduler Agenda (r:1 w:1) + /// The range of component `s` is `[0, 49]`. + fn schedule(_s: u32, ) -> Weight { + // Minimum execution time: 35_715 nanoseconds. + Weight::from_ref_time(60_651_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Scheduler Agenda (r:1 w:1) + // Storage: Scheduler Lookup (r:0 w:1) + /// The range of component `s` is `[1, 50]`. + fn cancel(_s: u32, ) -> Weight { + // Minimum execution time: 34_232 nanoseconds. + Weight::from_ref_time(79_279_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Scheduler Lookup (r:1 w:1) + // Storage: Scheduler Agenda (r:1 w:1) + /// The range of component `s` is `[0, 49]`. + fn schedule_named(_s: u32, ) -> Weight { + // Minimum execution time: 40_592 nanoseconds. + Weight::from_ref_time(68_534_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Scheduler Lookup (r:1 w:1) + // Storage: Scheduler Agenda (r:1 w:1) + /// The range of component `s` is `[1, 50]`. + fn cancel_named(_s: u32, ) -> Weight { + // Minimum execution time: 37_859 nanoseconds. + Weight::from_ref_time(79_749_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } +} diff --git a/runtime/pangolin/src/weights/pallet_session.rs b/runtime/pangolin/src/weights/pallet_session.rs index 25b1d6d3e..848f57833 100644 --- a/runtime/pangolin/src/weights/pallet_session.rs +++ b/runtime/pangolin/src/weights/pallet_session.rs @@ -19,12 +19,12 @@ //! Autogenerated weights for `pallet_session` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2022-11-09, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! HOSTNAME: `inv.cafe`, CPU: `AMD Ryzen 9 5950X 16-Core Processor` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("local"), DB CACHE: 1024 +//! DATE: 2023-02-21, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("pangolin-local"), DB CACHE: 1024 // Executed Command: -// target/release/darwinia +// ./target/release/darwinia // benchmark // pallet // --header @@ -33,14 +33,18 @@ // wasm // --heap-pages // 4096 +// --steps +// 2 +// --repeat +// 1 // --chain -// local +// pangolin-local // --output -// runtime/src/weights +// runtime/pangolin/src/weights/ // --extrinsic // * // --pallet -// pallet-session +// * #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -55,15 +59,17 @@ impl pallet_session::WeightInfo for WeightInfo { // Storage: Session NextKeys (r:1 w:1) // Storage: Session KeyOwner (r:1 w:1) fn set_keys() -> Weight { - Weight::from_ref_time(30_781_000 as u64) - .saturating_add(T::DbWeight::get().reads(2 as u64)) - .saturating_add(T::DbWeight::get().writes(2 as u64)) + // Minimum execution time: 36_083 nanoseconds. + Weight::from_ref_time(36_083_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) } // Storage: Session NextKeys (r:1 w:1) // Storage: Session KeyOwner (r:0 w:1) fn purge_keys() -> Weight { - Weight::from_ref_time(22_911_000 as u64) - .saturating_add(T::DbWeight::get().reads(1 as u64)) - .saturating_add(T::DbWeight::get().writes(2 as u64)) + // Minimum execution time: 31_421 nanoseconds. + Weight::from_ref_time(31_421_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(2)) } } diff --git a/runtime/pangolin/src/weights/pallet_timestamp.rs b/runtime/pangolin/src/weights/pallet_timestamp.rs index 7f420bd5a..2396660db 100644 --- a/runtime/pangolin/src/weights/pallet_timestamp.rs +++ b/runtime/pangolin/src/weights/pallet_timestamp.rs @@ -19,12 +19,12 @@ //! Autogenerated weights for `pallet_timestamp` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2022-11-09, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! HOSTNAME: `inv.cafe`, CPU: `AMD Ryzen 9 5950X 16-Core Processor` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("local"), DB CACHE: 1024 +//! DATE: 2023-02-21, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("pangolin-local"), DB CACHE: 1024 // Executed Command: -// target/release/darwinia +// ./target/release/darwinia // benchmark // pallet // --header @@ -33,14 +33,18 @@ // wasm // --heap-pages // 4096 +// --steps +// 2 +// --repeat +// 1 // --chain -// local +// pangolin-local // --output -// runtime/src/weights +// runtime/pangolin/src/weights/ // --extrinsic // * // --pallet -// pallet-timestamp +// * #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -53,12 +57,15 @@ use sp_std::marker::PhantomData; pub struct WeightInfo(PhantomData); impl pallet_timestamp::WeightInfo for WeightInfo { // Storage: Timestamp Now (r:1 w:1) + // Storage: Aura CurrentSlot (r:1 w:0) fn set() -> Weight { - Weight::from_ref_time(13_230_000 as u64) - .saturating_add(T::DbWeight::get().reads(1 as u64)) - .saturating_add(T::DbWeight::get().writes(1 as u64)) + // Minimum execution time: 22_338 nanoseconds. + Weight::from_ref_time(22_338_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) } fn on_finalize() -> Weight { - Weight::from_ref_time(5_710_000 as u64) + // Minimum execution time: 12_282 nanoseconds. + Weight::from_ref_time(12_282_000) } } diff --git a/runtime/pangolin/src/weights/pallet_tips.rs b/runtime/pangolin/src/weights/pallet_tips.rs new file mode 100644 index 000000000..d2ad59c6d --- /dev/null +++ b/runtime/pangolin/src/weights/pallet_tips.rs @@ -0,0 +1,120 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `pallet_tips` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-02-21, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("pangolin-local"), DB CACHE: 1024 + +// Executed Command: +// ./target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --steps +// 2 +// --repeat +// 1 +// --chain +// pangolin-local +// --output +// runtime/pangolin/src/weights/ +// --extrinsic +// * +// --pallet +// * + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_tips`. +pub struct WeightInfo(PhantomData); +impl pallet_tips::WeightInfo for WeightInfo { + // Storage: Tips Reasons (r:1 w:1) + // Storage: Tips Tips (r:1 w:1) + /// The range of component `r` is `[0, 16384]`. + fn report_awesome(_r: u32, ) -> Weight { + // Minimum execution time: 43_991 nanoseconds. + Weight::from_ref_time(66_709_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Tips Tips (r:1 w:1) + // Storage: Tips Reasons (r:0 w:1) + fn retract_tip() -> Weight { + // Minimum execution time: 44_171 nanoseconds. + Weight::from_ref_time(44_171_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: PhragmenElection Members (r:1 w:0) + // Storage: Tips Reasons (r:1 w:1) + // Storage: Tips Tips (r:0 w:1) + /// The range of component `r` is `[0, 16384]`. + /// The range of component `t` is `[1, 7]`. + fn tip_new(r: u32, t: u32, ) -> Weight { + // Minimum execution time: 38_303 nanoseconds. + Weight::from_ref_time(29_403_083) + // Standard Error: 842 + .saturating_add(Weight::from_ref_time(1_665).saturating_mul(r.into())) + // Standard Error: 2_300_307 + .saturating_add(Weight::from_ref_time(1_271_416).saturating_mul(t.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: PhragmenElection Members (r:1 w:0) + // Storage: Tips Tips (r:1 w:1) + /// The range of component `t` is `[1, 7]`. + fn tip(_t: u32, ) -> Weight { + // Minimum execution time: 24_732 nanoseconds. + Weight::from_ref_time(30_117_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Tips Tips (r:1 w:1) + // Storage: PhragmenElection Members (r:1 w:0) + // Storage: System Account (r:2 w:2) + // Storage: Tips Reasons (r:0 w:1) + /// The range of component `t` is `[1, 7]`. + fn close_tip(_t: u32, ) -> Weight { + // Minimum execution time: 69_806 nanoseconds. + Weight::from_ref_time(100_838_000) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(4)) + } + // Storage: Tips Tips (r:1 w:1) + // Storage: Tips Reasons (r:0 w:1) + /// The range of component `t` is `[1, 7]`. + fn slash_tip(_t: u32, ) -> Weight { + // Minimum execution time: 30_313 nanoseconds. + Weight::from_ref_time(32_653_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(2)) + } +} diff --git a/runtime/pangolin/src/weights/pallet_treasury.rs b/runtime/pangolin/src/weights/pallet_treasury.rs new file mode 100644 index 000000000..8cdcae499 --- /dev/null +++ b/runtime/pangolin/src/weights/pallet_treasury.rs @@ -0,0 +1,107 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `pallet_treasury` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-02-21, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("pangolin-local"), DB CACHE: 1024 + +// Executed Command: +// ./target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --steps +// 2 +// --repeat +// 1 +// --chain +// pangolin-local +// --output +// runtime/pangolin/src/weights/ +// --extrinsic +// * +// --pallet +// * + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_treasury`. +pub struct WeightInfo(PhantomData); +impl pallet_treasury::WeightInfo for WeightInfo { + fn spend() -> Weight { + // Minimum execution time: 633 nanoseconds. + Weight::from_ref_time(633_000) + } + // Storage: Treasury ProposalCount (r:1 w:1) + // Storage: Treasury Proposals (r:0 w:1) + fn propose_spend() -> Weight { + // Minimum execution time: 30_652 nanoseconds. + Weight::from_ref_time(30_652_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Treasury Proposals (r:1 w:1) + // Storage: System Account (r:2 w:2) + fn reject_proposal() -> Weight { + // Minimum execution time: 44_193 nanoseconds. + Weight::from_ref_time(44_193_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: Treasury Proposals (r:1 w:0) + // Storage: Treasury Approvals (r:1 w:1) + /// The range of component `p` is `[0, 99]`. + fn approve_proposal(_p: u32, ) -> Weight { + // Minimum execution time: 14_774 nanoseconds. + Weight::from_ref_time(26_305_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Treasury Approvals (r:1 w:1) + fn remove_approval() -> Weight { + // Minimum execution time: 11_357 nanoseconds. + Weight::from_ref_time(11_357_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: System Account (r:1 w:1) + // Storage: Treasury Deactivated (r:1 w:1) + // Storage: Balances InactiveIssuance (r:1 w:1) + // Storage: Treasury Approvals (r:1 w:1) + // Storage: Treasury Proposals (r:100 w:0) + /// The range of component `p` is `[0, 100]`. + fn on_initialize_proposals(_p: u32, ) -> Weight { + // Minimum execution time: 103_127 nanoseconds. + Weight::from_ref_time(230_072_000) + .saturating_add(T::DbWeight::get().reads(104)) + .saturating_add(T::DbWeight::get().writes(4)) + } +} diff --git a/runtime/pangolin/src/weights/pallet_utility.rs b/runtime/pangolin/src/weights/pallet_utility.rs new file mode 100644 index 000000000..043dfb62a --- /dev/null +++ b/runtime/pangolin/src/weights/pallet_utility.rs @@ -0,0 +1,82 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `pallet_utility` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-02-21, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("pangolin-local"), DB CACHE: 1024 + +// Executed Command: +// ./target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --steps +// 2 +// --repeat +// 1 +// --chain +// pangolin-local +// --output +// runtime/pangolin/src/weights/ +// --extrinsic +// * +// --pallet +// * + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_utility`. +pub struct WeightInfo(PhantomData); +impl pallet_utility::WeightInfo for WeightInfo { + /// The range of component `c` is `[0, 1000]`. + fn batch(_c: u32, ) -> Weight { + // Minimum execution time: 22_413 nanoseconds. + Weight::from_ref_time(3_400_790_000) + } + fn as_derivative() -> Weight { + // Minimum execution time: 12_507 nanoseconds. + Weight::from_ref_time(12_507_000) + } + /// The range of component `c` is `[0, 1000]`. + fn batch_all(_c: u32, ) -> Weight { + // Minimum execution time: 20_842 nanoseconds. + Weight::from_ref_time(3_658_261_000) + } + fn dispatch_as() -> Weight { + // Minimum execution time: 24_168 nanoseconds. + Weight::from_ref_time(24_168_000) + } + /// The range of component `c` is `[0, 1000]`. + fn force_batch(_c: u32, ) -> Weight { + // Minimum execution time: 159_696 nanoseconds. + Weight::from_ref_time(3_445_451_000) + } +} diff --git a/runtime/pangolin/src/weights/pallet_vesting.rs b/runtime/pangolin/src/weights/pallet_vesting.rs new file mode 100644 index 000000000..6f5f1c317 --- /dev/null +++ b/runtime/pangolin/src/weights/pallet_vesting.rs @@ -0,0 +1,169 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `pallet_vesting` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-02-21, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("pangolin-local"), DB CACHE: 1024 + +// Executed Command: +// ./target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --steps +// 2 +// --repeat +// 1 +// --chain +// pangolin-local +// --output +// runtime/pangolin/src/weights/ +// --extrinsic +// * +// --pallet +// * + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_vesting`. +pub struct WeightInfo(PhantomData); +impl pallet_vesting::WeightInfo for WeightInfo { + // Storage: Vesting Vesting (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + /// The range of component `l` is `[0, 49]`. + /// The range of component `s` is `[1, 28]`. + fn vest_locked(l: u32, s: u32, ) -> Weight { + // Minimum execution time: 38_909 nanoseconds. + Weight::from_ref_time(35_806_851) + // Standard Error: 18_186 + .saturating_add(Weight::from_ref_time(56_969).saturating_mul(l.into())) + // Standard Error: 33_005 + .saturating_add(Weight::from_ref_time(310_648).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Vesting Vesting (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + /// The range of component `l` is `[0, 49]`. + /// The range of component `s` is `[1, 28]`. + fn vest_unlocked(l: u32, s: u32, ) -> Weight { + // Minimum execution time: 40_473 nanoseconds. + Weight::from_ref_time(37_972_333) + // Standard Error: 62_795 + .saturating_add(Weight::from_ref_time(48_928).saturating_mul(l.into())) + // Standard Error: 113_962 + .saturating_add(Weight::from_ref_time(103_166).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Vesting Vesting (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + // Storage: System Account (r:1 w:1) + /// The range of component `l` is `[0, 49]`. + /// The range of component `s` is `[1, 28]`. + fn vest_other_locked(l: u32, s: u32, ) -> Weight { + // Minimum execution time: 40_436 nanoseconds. + Weight::from_ref_time(31_256_666) + // Standard Error: 22_322 + .saturating_add(Weight::from_ref_time(189_275).saturating_mul(l.into())) + // Standard Error: 40_510 + .saturating_add(Weight::from_ref_time(327_833).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: Vesting Vesting (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + // Storage: System Account (r:1 w:1) + /// The range of component `l` is `[0, 49]`. + /// The range of component `s` is `[1, 28]`. + fn vest_other_unlocked(l: u32, s: u32, ) -> Weight { + // Minimum execution time: 38_762 nanoseconds. + Weight::from_ref_time(35_517_629) + // Standard Error: 9_349 + .saturating_add(Weight::from_ref_time(64_602).saturating_mul(l.into())) + // Standard Error: 16_967 + .saturating_add(Weight::from_ref_time(115_870).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: Vesting Vesting (r:1 w:1) + // Storage: System Account (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + /// The range of component `l` is `[0, 49]`. + /// The range of component `s` is `[0, 27]`. + fn vested_transfer(l: u32, _s: u32, ) -> Weight { + // Minimum execution time: 53_593 nanoseconds. + Weight::from_ref_time(62_251_500) + // Standard Error: 972 + .saturating_add(Weight::from_ref_time(7_785).saturating_mul(l.into())) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: Vesting Vesting (r:1 w:1) + // Storage: System Account (r:2 w:2) + // Storage: Balances Locks (r:1 w:1) + /// The range of component `l` is `[0, 49]`. + /// The range of component `s` is `[0, 27]`. + fn force_vested_transfer(l: u32, s: u32, ) -> Weight { + // Minimum execution time: 52_068 nanoseconds. + Weight::from_ref_time(51_584_500) + // Standard Error: 415_957 + .saturating_add(Weight::from_ref_time(223_928).saturating_mul(l.into())) + // Standard Error: 754_885 + .saturating_add(Weight::from_ref_time(47_351).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(4)) + } + // Storage: Vesting Vesting (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + // Storage: System Account (r:1 w:1) + /// The range of component `l` is `[0, 49]`. + /// The range of component `s` is `[2, 28]`. + fn not_unlocking_merge_schedules(_l: u32, s: u32, ) -> Weight { + // Minimum execution time: 38_902 nanoseconds. + Weight::from_ref_time(39_996_230) + // Standard Error: 97_161 + .saturating_add(Weight::from_ref_time(108_634).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: Vesting Vesting (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + // Storage: System Account (r:1 w:1) + /// The range of component `l` is `[0, 49]`. + /// The range of component `s` is `[2, 28]`. + fn unlocking_merge_schedules(_l: u32, _s: u32, ) -> Weight { + // Minimum execution time: 42_172 nanoseconds. + Weight::from_ref_time(55_341_307) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } +} diff --git a/runtime/pangoro/src/lib.rs b/runtime/pangoro/src/lib.rs index 9e6a96bf8..469dddea5 100644 --- a/runtime/pangoro/src/lib.rs +++ b/runtime/pangoro/src/lib.rs @@ -170,11 +170,30 @@ frame_support::construct_runtime! { #[cfg(feature = "runtime-benchmarks")] frame_benchmarking::define_benchmarks! { + // Substrate + [cumulus_pallet_xcmp_queue, XcmpQueue] [frame_system, SystemBench::] + [pallet_assets, Assets] [pallet_balances, Balances] + [pallet_collective, Council] + [pallet_collective, TechnicalCommittee] + [pallet_democracy, Democracy] + [pallet_elections_phragmen, PhragmenElection] + [pallet_identity, Identity] + [pallet_membership, TechnicalMembership] + [pallet_multisig, Multisig] + [pallet_preimage, Preimage] + [pallet_proxy, Proxy] + [pallet_scheduler, Scheduler] + [pallet_tips, Tips] + [pallet_treasury, Treasury] + [pallet_utility, Utility] + [pallet_vesting, Vesting] [pallet_session, SessionBench::] [pallet_timestamp, Timestamp] - [cumulus_pallet_xcmp_queue, XcmpQueue] + // Bridge + [pallet_bridge_grandpa, BridgeRococoGrandpa] + [pallet_fee_market, PangolinFeeMarket] } impl_self_contained_call!(); diff --git a/runtime/pangoro/src/pallets/assets.rs b/runtime/pangoro/src/pallets/assets.rs index f52fb39b1..a79c80648 100644 --- a/runtime/pangoro/src/pallets/assets.rs +++ b/runtime/pangoro/src/pallets/assets.rs @@ -50,5 +50,5 @@ impl pallet_assets::Config for Runtime { type RemoveItemsLimit = ConstU32<1000>; type RuntimeEvent = RuntimeEvent; type StringLimit = ConstU32<50>; - type WeightInfo = (); + type WeightInfo = weights::pallet_assets::WeightInfo; } diff --git a/runtime/pangoro/src/pallets/balances.rs b/runtime/pangoro/src/pallets/balances.rs index 94a42eac2..1680c05c1 100644 --- a/runtime/pangoro/src/pallets/balances.rs +++ b/runtime/pangoro/src/pallets/balances.rs @@ -19,11 +19,21 @@ // darwinia use crate::*; +// https://github.com/paritytech/substrate/blob/polkadot-v0.9.37/frame/balances/src/benchmarking.rs#L39 +#[cfg(feature = "runtime-benchmarks")] +frame_support::parameter_types! { + pub const ExistentialDeposit:Balance = 1; +} +#[cfg(not(feature = "runtime-benchmarks"))] +frame_support::parameter_types! { + pub const ExistentialDeposit:Balance = 0; +} + impl pallet_balances::Config for Runtime { type AccountStore = System; type Balance = Balance; type DustRemoval = (); - type ExistentialDeposit = ConstU128<0>; + type ExistentialDeposit = ExistentialDeposit; type MaxLocks = ConstU32<50>; type MaxReserves = ConstU32<50>; type ReserveIdentifier = [u8; 8]; diff --git a/runtime/pangoro/src/pallets/bridge_grandpa.rs b/runtime/pangoro/src/pallets/bridge_grandpa.rs index 635aa7efb..3ea74127d 100644 --- a/runtime/pangoro/src/pallets/bridge_grandpa.rs +++ b/runtime/pangoro/src/pallets/bridge_grandpa.rs @@ -29,5 +29,5 @@ impl pallet_bridge_grandpa::Config for Runtime { type MaxBridgedAuthorities = ConstU32<100_000>; type MaxBridgedHeaderSize = ConstU32<65536>; type MaxRequests = ConstU32<50>; - type WeightInfo = (); + type WeightInfo = weights::pallet_bridge_grandpa::WeightInfo; } diff --git a/runtime/pangoro/src/pallets/collective.rs b/runtime/pangoro/src/pallets/collective.rs index 7dfbc2623..5168b8bf0 100644 --- a/runtime/pangoro/src/pallets/collective.rs +++ b/runtime/pangoro/src/pallets/collective.rs @@ -36,7 +36,7 @@ impl pallet_collective::Config for Runtime { type Proposal = RuntimeCall; type RuntimeEvent = RuntimeEvent; type RuntimeOrigin = RuntimeOrigin; - type WeightInfo = (); + type WeightInfo = weights::pallet_collective_council::WeightInfo; } impl pallet_collective::Config for Runtime { type DefaultVote = pallet_collective::PrimeDefaultVote; @@ -46,5 +46,5 @@ impl pallet_collective::Config for Runtime { type Proposal = RuntimeCall; type RuntimeEvent = RuntimeEvent; type RuntimeOrigin = RuntimeOrigin; - type WeightInfo = (); + type WeightInfo = weights::pallet_collective_technical_committee::WeightInfo; } diff --git a/runtime/pangoro/src/pallets/democracy.rs b/runtime/pangoro/src/pallets/democracy.rs index e28b4f392..a4c809347 100644 --- a/runtime/pangoro/src/pallets/democracy.rs +++ b/runtime/pangoro/src/pallets/democracy.rs @@ -60,5 +60,5 @@ impl pallet_democracy::Config for Runtime { type VetoOrigin = pallet_collective::EnsureMember; type VoteLockingPeriod = ConstU32; type VotingPeriod = ConstU32<{ 28 * DAYS }>; - type WeightInfo = (); + type WeightInfo = weights::pallet_democracy::WeightInfo; } diff --git a/runtime/pangoro/src/pallets/elections_phragmen.rs b/runtime/pangoro/src/pallets/elections_phragmen.rs index 133b89054..220df24cb 100644 --- a/runtime/pangoro/src/pallets/elections_phragmen.rs +++ b/runtime/pangoro/src/pallets/elections_phragmen.rs @@ -45,5 +45,5 @@ impl pallet_elections_phragmen::Config for Runtime { type VotingBondBase = ConstU128<{ darwinia_deposit(1, 64) }>; // Additional data per vote is 32 bytes (account id). type VotingBondFactor = ConstU128<{ darwinia_deposit(0, 32) }>; - type WeightInfo = (); + type WeightInfo = weights::pallet_elections_phragmen::WeightInfo; } diff --git a/runtime/pangoro/src/pallets/fee_market.rs b/runtime/pangoro/src/pallets/fee_market.rs index c9a1ba34b..ffadaff69 100644 --- a/runtime/pangoro/src/pallets/fee_market.rs +++ b/runtime/pangoro/src/pallets/fee_market.rs @@ -69,5 +69,5 @@ impl pallet_fee_market::Config for Runtime { type Slasher = FeeMarketSlasher; type Slot = ConstU32<600>; type TreasuryPalletId = TreasuryPalletId; - type WeightInfo = (); + type WeightInfo = weights::pallet_fee_market::WeightInfo; } diff --git a/runtime/pangoro/src/pallets/identity.rs b/runtime/pangoro/src/pallets/identity.rs index b12f0b3a9..1fcedcd89 100644 --- a/runtime/pangoro/src/pallets/identity.rs +++ b/runtime/pangoro/src/pallets/identity.rs @@ -35,5 +35,5 @@ impl pallet_identity::Config for Runtime { type Slashed = Treasury; // 53 bytes on-chain. type SubAccountDeposit = ConstU128<{ darwinia_deposit(1, 53) }>; - type WeightInfo = (); + type WeightInfo = weights::pallet_identity::WeightInfo; } diff --git a/runtime/pangoro/src/pallets/membership.rs b/runtime/pangoro/src/pallets/membership.rs index 3064d4b5e..a73d74e79 100644 --- a/runtime/pangoro/src/pallets/membership.rs +++ b/runtime/pangoro/src/pallets/membership.rs @@ -29,5 +29,5 @@ impl pallet_membership::Config for Runtime { type ResetOrigin = RootOrMoreThanHalf; type RuntimeEvent = RuntimeEvent; type SwapOrigin = RootOrMoreThanHalf; - type WeightInfo = (); + type WeightInfo = weights::pallet_membership::WeightInfo; } diff --git a/runtime/pangoro/src/pallets/multisig.rs b/runtime/pangoro/src/pallets/multisig.rs index c47262b26..d2e226434 100644 --- a/runtime/pangoro/src/pallets/multisig.rs +++ b/runtime/pangoro/src/pallets/multisig.rs @@ -28,5 +28,5 @@ impl pallet_multisig::Config for Runtime { type MaxSignatories = ConstU32<100>; type RuntimeCall = RuntimeCall; type RuntimeEvent = RuntimeEvent; - type WeightInfo = (); + type WeightInfo = weights::pallet_multisig::WeightInfo; } diff --git a/runtime/pangoro/src/pallets/preimage.rs b/runtime/pangoro/src/pallets/preimage.rs index d049ef1c0..08ef47e38 100644 --- a/runtime/pangoro/src/pallets/preimage.rs +++ b/runtime/pangoro/src/pallets/preimage.rs @@ -25,5 +25,5 @@ impl pallet_preimage::Config for Runtime { type Currency = Balances; type ManagerOrigin = frame_system::EnsureRoot; type RuntimeEvent = RuntimeEvent; - type WeightInfo = (); + type WeightInfo = weights::pallet_preimage::WeightInfo; } diff --git a/runtime/pangoro/src/pallets/proxy.rs b/runtime/pangoro/src/pallets/proxy.rs index dae6ddf4c..3917f7c48 100644 --- a/runtime/pangoro/src/pallets/proxy.rs +++ b/runtime/pangoro/src/pallets/proxy.rs @@ -118,5 +118,5 @@ impl pallet_proxy::Config for Runtime { type ProxyType = ProxyType; type RuntimeCall = RuntimeCall; type RuntimeEvent = RuntimeEvent; - type WeightInfo = (); + type WeightInfo = weights::pallet_proxy::WeightInfo; } diff --git a/runtime/pangoro/src/pallets/scheduler.rs b/runtime/pangoro/src/pallets/scheduler.rs index 2f0197405..868dfd6d6 100644 --- a/runtime/pangoro/src/pallets/scheduler.rs +++ b/runtime/pangoro/src/pallets/scheduler.rs @@ -59,5 +59,5 @@ impl pallet_scheduler::Config for Runtime { type RuntimeEvent = RuntimeEvent; type RuntimeOrigin = RuntimeOrigin; type ScheduleOrigin = Root; - type WeightInfo = (); + type WeightInfo = weights::pallet_scheduler::WeightInfo; } diff --git a/runtime/pangoro/src/pallets/tips.rs b/runtime/pangoro/src/pallets/tips.rs index 6500a1b3a..e5e1ff68a 100644 --- a/runtime/pangoro/src/pallets/tips.rs +++ b/runtime/pangoro/src/pallets/tips.rs @@ -31,5 +31,5 @@ impl pallet_tips::Config for Runtime { type TipFindersFee = TipFindersFee; type TipReportDepositBase = ConstU128<{ 100 * UNIT }>; type Tippers = PhragmenElection; - type WeightInfo = (); + type WeightInfo = weights::pallet_tips::WeightInfo; } diff --git a/runtime/pangoro/src/pallets/treasury.rs b/runtime/pangoro/src/pallets/treasury.rs index 3febca02f..b2e8b4708 100644 --- a/runtime/pangoro/src/pallets/treasury.rs +++ b/runtime/pangoro/src/pallets/treasury.rs @@ -43,5 +43,5 @@ impl pallet_treasury::Config for Runtime { type SpendFunds = (); type SpendOrigin = frame_support::traits::NeverEnsureOrigin; type SpendPeriod = ConstU32<{ 24 * DAYS }>; - type WeightInfo = (); + type WeightInfo = weights::pallet_treasury::WeightInfo; } diff --git a/runtime/pangoro/src/pallets/utility.rs b/runtime/pangoro/src/pallets/utility.rs index 2c0f49ddf..c89d70642 100644 --- a/runtime/pangoro/src/pallets/utility.rs +++ b/runtime/pangoro/src/pallets/utility.rs @@ -23,5 +23,5 @@ impl pallet_utility::Config for Runtime { type PalletsOrigin = OriginCaller; type RuntimeCall = RuntimeCall; type RuntimeEvent = RuntimeEvent; - type WeightInfo = (); + type WeightInfo = weights::pallet_utility::WeightInfo; } diff --git a/runtime/pangoro/src/pallets/vesting.rs b/runtime/pangoro/src/pallets/vesting.rs index 1c0b0b6e6..f13db8ccc 100644 --- a/runtime/pangoro/src/pallets/vesting.rs +++ b/runtime/pangoro/src/pallets/vesting.rs @@ -32,7 +32,7 @@ impl pallet_vesting::Config for Runtime { type MinVestedTransfer = ConstU128; type RuntimeEvent = RuntimeEvent; type UnvestedFundsAllowedWithdrawReasons = UnvestedFundsAllowedWithdrawReasons; - type WeightInfo = (); + type WeightInfo = weights::pallet_vesting::WeightInfo; // `VestingInfo` encode length is 36bytes. 28 schedules gets encoded as 1009 bytes, which is the // highest number of schedules that encodes less than 2^10. diff --git a/runtime/pangoro/src/weights/cumulus_pallet_xcmp_queue.rs b/runtime/pangoro/src/weights/cumulus_pallet_xcmp_queue.rs index 3271b31e4..b7a0f7a07 100644 --- a/runtime/pangoro/src/weights/cumulus_pallet_xcmp_queue.rs +++ b/runtime/pangoro/src/weights/cumulus_pallet_xcmp_queue.rs @@ -19,12 +19,12 @@ //! Autogenerated weights for `cumulus_pallet_xcmp_queue` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2022-11-09, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! HOSTNAME: `inv.cafe`, CPU: `AMD Ryzen 9 5950X 16-Core Processor` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("local"), DB CACHE: 1024 +//! DATE: 2023-02-22, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("pangoro-local"), DB CACHE: 1024 // Executed Command: -// target/release/darwinia +// ./target/release/darwinia // benchmark // pallet // --header @@ -33,14 +33,18 @@ // wasm // --heap-pages // 4096 +// --steps +// 2 +// --repeat +// 1 // --chain -// local +// pangoro-local // --output -// runtime/src/weights +// runtime/pangoro/src/weights/ // --extrinsic // * // --pallet -// cumulus-pallet-xcmp-queue +// * #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -54,14 +58,16 @@ pub struct WeightInfo(PhantomData); impl cumulus_pallet_xcmp_queue::WeightInfo for WeightInfo { // Storage: XcmpQueue QueueConfig (r:1 w:1) fn set_config_with_u32() -> Weight { - Weight::from_ref_time(13_340_000 as u64) - .saturating_add(T::DbWeight::get().reads(1 as u64)) - .saturating_add(T::DbWeight::get().writes(1 as u64)) + // Minimum execution time: 18_662 nanoseconds. + Weight::from_ref_time(18_662_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) } // Storage: XcmpQueue QueueConfig (r:1 w:1) fn set_config_with_weight() -> Weight { - Weight::from_ref_time(12_610_000 as u64) - .saturating_add(T::DbWeight::get().reads(1 as u64)) - .saturating_add(T::DbWeight::get().writes(1 as u64)) + // Minimum execution time: 17_101 nanoseconds. + Weight::from_ref_time(17_101_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) } } diff --git a/runtime/pangoro/src/weights/frame_system.rs b/runtime/pangoro/src/weights/frame_system.rs index 2361f7517..6d8c25427 100644 --- a/runtime/pangoro/src/weights/frame_system.rs +++ b/runtime/pangoro/src/weights/frame_system.rs @@ -19,12 +19,12 @@ //! Autogenerated weights for `frame_system` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2022-11-09, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! HOSTNAME: `inv.cafe`, CPU: `AMD Ryzen 9 5950X 16-Core Processor` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("local"), DB CACHE: 1024 +//! DATE: 2023-02-22, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("pangoro-local"), DB CACHE: 1024 // Executed Command: -// target/release/darwinia +// ./target/release/darwinia // benchmark // pallet // --header @@ -33,14 +33,18 @@ // wasm // --heap-pages // 4096 +// --steps +// 2 +// --repeat +// 1 // --chain -// local +// pangoro-local // --output -// runtime/src/weights +// runtime/pangoro/src/weights/ // --extrinsic // * // --pallet -// frame-system +// * #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -54,35 +58,41 @@ pub struct WeightInfo(PhantomData); impl frame_system::WeightInfo for WeightInfo { /// The range of component `b` is `[0, 3932160]`. fn remark(_b: u32, ) -> Weight { - Weight::from_ref_time(1_074_555_000 as u64) + // Minimum execution time: 21_369 nanoseconds. + Weight::from_ref_time(910_391_000) } /// The range of component `b` is `[0, 3932160]`. fn remark_with_event(_b: u32, ) -> Weight { - Weight::from_ref_time(4_724_488_000 as u64) + // Minimum execution time: 25_477 nanoseconds. + Weight::from_ref_time(4_613_787_000) } // Storage: System Digest (r:1 w:1) // Storage: unknown [0x3a686561707061676573] (r:0 w:1) fn set_heap_pages() -> Weight { - Weight::from_ref_time(14_110_000 as u64) - .saturating_add(T::DbWeight::get().reads(1 as u64)) - .saturating_add(T::DbWeight::get().writes(2 as u64)) + // Minimum execution time: 15_737 nanoseconds. + Weight::from_ref_time(15_737_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(2)) } // Storage: Skipped Metadata (r:0 w:0) - /// The range of component `i` is `[1, 1000]`. + /// The range of component `i` is `[0, 1000]`. fn set_storage(_i: u32, ) -> Weight { - Weight::from_ref_time(655_299_000 as u64) - .saturating_add(T::DbWeight::get().writes(1000 as u64)) + // Minimum execution time: 16_295 nanoseconds. + Weight::from_ref_time(555_614_000) + .saturating_add(T::DbWeight::get().writes(1000)) } // Storage: Skipped Metadata (r:0 w:0) - /// The range of component `i` is `[1, 1000]`. + /// The range of component `i` is `[0, 1000]`. fn kill_storage(_i: u32, ) -> Weight { - Weight::from_ref_time(555_697_000 as u64) - .saturating_add(T::DbWeight::get().writes(1000 as u64)) + // Minimum execution time: 19_816 nanoseconds. + Weight::from_ref_time(467_332_000) + .saturating_add(T::DbWeight::get().writes(1000)) } // Storage: Skipped Metadata (r:0 w:0) - /// The range of component `p` is `[1, 1000]`. + /// The range of component `p` is `[0, 1000]`. fn kill_prefix(_p: u32, ) -> Weight { - Weight::from_ref_time(1_089_395_000 as u64) - .saturating_add(T::DbWeight::get().writes(1000 as u64)) + // Minimum execution time: 14_907 nanoseconds. + Weight::from_ref_time(822_938_000) + .saturating_add(T::DbWeight::get().writes(1000)) } } diff --git a/runtime/pangoro/src/weights/mod.rs b/runtime/pangoro/src/weights/mod.rs index caf9386da..4580cd631 100644 --- a/runtime/pangoro/src/weights/mod.rs +++ b/runtime/pangoro/src/weights/mod.rs @@ -34,6 +34,23 @@ pub use rocksdb_weights::constants::RocksDbWeight; pub mod cumulus_pallet_xcmp_queue; pub mod frame_system; +pub mod pallet_assets; pub mod pallet_balances; +pub mod pallet_bridge_grandpa; +pub mod pallet_collective_council; +pub mod pallet_collective_technical_committee; +pub mod pallet_democracy; +pub mod pallet_elections_phragmen; +pub mod pallet_fee_market; +pub mod pallet_identity; +pub mod pallet_membership; +pub mod pallet_multisig; +pub mod pallet_preimage; +pub mod pallet_proxy; +pub mod pallet_scheduler; pub mod pallet_session; pub mod pallet_timestamp; +pub mod pallet_tips; +pub mod pallet_treasury; +pub mod pallet_utility; +pub mod pallet_vesting; diff --git a/runtime/pangoro/src/weights/pallet_assets.rs b/runtime/pangoro/src/weights/pallet_assets.rs new file mode 100644 index 000000000..185ea6b91 --- /dev/null +++ b/runtime/pangoro/src/weights/pallet_assets.rs @@ -0,0 +1,272 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `pallet_assets` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-02-22, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("pangoro-local"), DB CACHE: 1024 + +// Executed Command: +// ./target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --steps +// 2 +// --repeat +// 1 +// --chain +// pangoro-local +// --output +// runtime/pangoro/src/weights/ +// --extrinsic +// * +// --pallet +// * + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_assets`. +pub struct WeightInfo(PhantomData); +impl pallet_assets::WeightInfo for WeightInfo { + // Storage: Assets Asset (r:1 w:1) + fn create() -> Weight { + // Minimum execution time: 37_890 nanoseconds. + Weight::from_ref_time(37_890_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Assets Asset (r:1 w:1) + fn force_create() -> Weight { + // Minimum execution time: 59_843 nanoseconds. + Weight::from_ref_time(59_843_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Assets Asset (r:1 w:1) + fn start_destroy() -> Weight { + // Minimum execution time: 39_671 nanoseconds. + Weight::from_ref_time(39_671_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Assets Asset (r:1 w:1) + // Storage: Assets Account (r:1 w:0) + // Storage: System Account (r:1000 w:1000) + /// The range of component `c` is `[0, 1000]`. + fn destroy_accounts(_c: u32, ) -> Weight { + // Minimum execution time: 37_647 nanoseconds. + Weight::from_ref_time(11_733_130_000) + .saturating_add(T::DbWeight::get().reads(2002)) + .saturating_add(T::DbWeight::get().writes(2001)) + } + // Storage: Assets Asset (r:1 w:1) + // Storage: Assets Approvals (r:1 w:0) + /// The range of component `a` is `[0, 1000]`. + fn destroy_approvals(_a: u32, ) -> Weight { + // Minimum execution time: 44_666 nanoseconds. + Weight::from_ref_time(5_539_689_000) + .saturating_add(T::DbWeight::get().reads(1002)) + .saturating_add(T::DbWeight::get().writes(1001)) + } + // Storage: Assets Asset (r:1 w:1) + // Storage: Assets Metadata (r:1 w:0) + fn finish_destroy() -> Weight { + // Minimum execution time: 34_322 nanoseconds. + Weight::from_ref_time(34_322_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Assets Asset (r:1 w:1) + // Storage: Assets Account (r:1 w:1) + fn mint() -> Weight { + // Minimum execution time: 58_686 nanoseconds. + Weight::from_ref_time(58_686_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Assets Asset (r:1 w:1) + // Storage: Assets Account (r:1 w:1) + fn burn() -> Weight { + // Minimum execution time: 60_483 nanoseconds. + Weight::from_ref_time(60_483_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Assets Asset (r:1 w:1) + // Storage: Assets Account (r:2 w:2) + // Storage: System Account (r:1 w:1) + fn transfer() -> Weight { + // Minimum execution time: 65_845 nanoseconds. + Weight::from_ref_time(65_845_000) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(4)) + } + // Storage: Assets Asset (r:1 w:1) + // Storage: Assets Account (r:2 w:2) + // Storage: System Account (r:1 w:1) + fn transfer_keep_alive() -> Weight { + // Minimum execution time: 57_240 nanoseconds. + Weight::from_ref_time(57_240_000) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(4)) + } + // Storage: Assets Asset (r:1 w:1) + // Storage: Assets Account (r:2 w:2) + // Storage: System Account (r:1 w:1) + fn force_transfer() -> Weight { + // Minimum execution time: 64_819 nanoseconds. + Weight::from_ref_time(64_819_000) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(4)) + } + // Storage: Assets Asset (r:1 w:0) + // Storage: Assets Account (r:1 w:1) + fn freeze() -> Weight { + // Minimum execution time: 33_249 nanoseconds. + Weight::from_ref_time(33_249_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Assets Asset (r:1 w:0) + // Storage: Assets Account (r:1 w:1) + fn thaw() -> Weight { + // Minimum execution time: 36_025 nanoseconds. + Weight::from_ref_time(36_025_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Assets Asset (r:1 w:1) + fn freeze_asset() -> Weight { + // Minimum execution time: 30_183 nanoseconds. + Weight::from_ref_time(30_183_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Assets Asset (r:1 w:1) + fn thaw_asset() -> Weight { + // Minimum execution time: 31_457 nanoseconds. + Weight::from_ref_time(31_457_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Assets Asset (r:1 w:1) + // Storage: Assets Metadata (r:1 w:0) + fn transfer_ownership() -> Weight { + // Minimum execution time: 36_073 nanoseconds. + Weight::from_ref_time(36_073_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Assets Asset (r:1 w:1) + fn set_team() -> Weight { + // Minimum execution time: 33_782 nanoseconds. + Weight::from_ref_time(33_782_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Assets Asset (r:1 w:0) + // Storage: Assets Metadata (r:1 w:1) + /// The range of component `n` is `[0, 50]`. + /// The range of component `s` is `[0, 50]`. + fn set_metadata(_n: u32, _s: u32, ) -> Weight { + // Minimum execution time: 39_430 nanoseconds. + Weight::from_ref_time(46_594_500) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Assets Asset (r:1 w:0) + // Storage: Assets Metadata (r:1 w:1) + fn clear_metadata() -> Weight { + // Minimum execution time: 39_889 nanoseconds. + Weight::from_ref_time(39_889_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Assets Asset (r:1 w:0) + // Storage: Assets Metadata (r:1 w:1) + /// The range of component `n` is `[0, 50]`. + /// The range of component `s` is `[0, 50]`. + fn force_set_metadata(_n: u32, _s: u32, ) -> Weight { + // Minimum execution time: 34_516 nanoseconds. + Weight::from_ref_time(45_132_500) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Assets Asset (r:1 w:0) + // Storage: Assets Metadata (r:1 w:1) + fn force_clear_metadata() -> Weight { + // Minimum execution time: 55_976 nanoseconds. + Weight::from_ref_time(55_976_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Assets Asset (r:1 w:1) + fn force_asset_status() -> Weight { + // Minimum execution time: 56_761 nanoseconds. + Weight::from_ref_time(56_761_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Assets Asset (r:1 w:1) + // Storage: Assets Approvals (r:1 w:1) + fn approve_transfer() -> Weight { + // Minimum execution time: 39_871 nanoseconds. + Weight::from_ref_time(39_871_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Assets Asset (r:1 w:1) + // Storage: Assets Approvals (r:1 w:1) + // Storage: Assets Account (r:2 w:2) + // Storage: System Account (r:1 w:1) + fn transfer_approved() -> Weight { + // Minimum execution time: 69_769 nanoseconds. + Weight::from_ref_time(69_769_000) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(5)) + } + // Storage: Assets Asset (r:1 w:1) + // Storage: Assets Approvals (r:1 w:1) + fn cancel_approval() -> Weight { + // Minimum execution time: 37_910 nanoseconds. + Weight::from_ref_time(37_910_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Assets Asset (r:1 w:1) + // Storage: Assets Approvals (r:1 w:1) + fn force_cancel_approval() -> Weight { + // Minimum execution time: 47_591 nanoseconds. + Weight::from_ref_time(47_591_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } +} diff --git a/runtime/pangoro/src/weights/pallet_balances.rs b/runtime/pangoro/src/weights/pallet_balances.rs index f7acd35fb..301929605 100644 --- a/runtime/pangoro/src/weights/pallet_balances.rs +++ b/runtime/pangoro/src/weights/pallet_balances.rs @@ -19,12 +19,12 @@ //! Autogenerated weights for `pallet_balances` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2022-11-09, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! HOSTNAME: `inv.cafe`, CPU: `AMD Ryzen 9 5950X 16-Core Processor` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("local"), DB CACHE: 1024 +//! DATE: 2023-02-22, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("pangoro-local"), DB CACHE: 1024 // Executed Command: -// target/release/darwinia +// ./target/release/darwinia // benchmark // pallet // --header @@ -33,14 +33,18 @@ // wasm // --heap-pages // 4096 +// --steps +// 2 +// --repeat +// 1 // --chain -// local +// pangoro-local // --output -// runtime/src/weights +// runtime/pangoro/src/weights/ // --extrinsic // * // --pallet -// pallet-balances +// * #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -54,44 +58,51 @@ pub struct WeightInfo(PhantomData); impl pallet_balances::WeightInfo for WeightInfo { // Storage: System Account (r:1 w:1) fn transfer() -> Weight { - Weight::from_ref_time(57_141_000 as u64) - .saturating_add(T::DbWeight::get().reads(1 as u64)) - .saturating_add(T::DbWeight::get().writes(1 as u64)) + // Minimum execution time: 112_550 nanoseconds. + Weight::from_ref_time(112_550_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) } // Storage: System Account (r:1 w:1) fn transfer_keep_alive() -> Weight { - Weight::from_ref_time(43_271_000 as u64) - .saturating_add(T::DbWeight::get().reads(1 as u64)) - .saturating_add(T::DbWeight::get().writes(1 as u64)) + // Minimum execution time: 52_686 nanoseconds. + Weight::from_ref_time(52_686_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) } // Storage: System Account (r:1 w:1) fn set_balance_creating() -> Weight { - Weight::from_ref_time(29_941_000 as u64) - .saturating_add(T::DbWeight::get().reads(1 as u64)) - .saturating_add(T::DbWeight::get().writes(1 as u64)) + // Minimum execution time: 49_997 nanoseconds. + Weight::from_ref_time(49_997_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) } // Storage: System Account (r:1 w:1) fn set_balance_killing() -> Weight { - Weight::from_ref_time(34_490_000 as u64) - .saturating_add(T::DbWeight::get().reads(1 as u64)) - .saturating_add(T::DbWeight::get().writes(1 as u64)) + // Minimum execution time: 48_290 nanoseconds. + Weight::from_ref_time(48_290_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) } // Storage: System Account (r:2 w:2) fn force_transfer() -> Weight { - Weight::from_ref_time(54_911_000 as u64) - .saturating_add(T::DbWeight::get().reads(2 as u64)) - .saturating_add(T::DbWeight::get().writes(2 as u64)) + // Minimum execution time: 61_577 nanoseconds. + Weight::from_ref_time(61_577_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) } // Storage: System Account (r:1 w:1) fn transfer_all() -> Weight { - Weight::from_ref_time(49_671_000 as u64) - .saturating_add(T::DbWeight::get().reads(1 as u64)) - .saturating_add(T::DbWeight::get().writes(1 as u64)) + // Minimum execution time: 61_086 nanoseconds. + Weight::from_ref_time(61_086_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) } // Storage: System Account (r:1 w:1) fn force_unreserve() -> Weight { - Weight::from_ref_time(26_120_000 as u64) - .saturating_add(T::DbWeight::get().reads(1 as u64)) - .saturating_add(T::DbWeight::get().writes(1 as u64)) + // Minimum execution time: 36_072 nanoseconds. + Weight::from_ref_time(36_072_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) } } diff --git a/runtime/pangoro/src/weights/pallet_bridge_grandpa.rs b/runtime/pangoro/src/weights/pallet_bridge_grandpa.rs new file mode 100644 index 000000000..4dfd5f905 --- /dev/null +++ b/runtime/pangoro/src/weights/pallet_bridge_grandpa.rs @@ -0,0 +1,76 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `pallet_bridge_grandpa` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-02-22, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("pangoro-local"), DB CACHE: 1024 + +// Executed Command: +// ./target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --steps +// 2 +// --repeat +// 1 +// --chain +// pangoro-local +// --output +// runtime/pangoro/src/weights/ +// --extrinsic +// * +// --pallet +// * + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_bridge_grandpa`. +pub struct WeightInfo(PhantomData); +impl pallet_bridge_grandpa::WeightInfo for WeightInfo { + // Storage: BridgeRococoGrandpa PalletOperatingMode (r:1 w:0) + // Storage: BridgeRococoGrandpa RequestCount (r:1 w:1) + // Storage: BridgeRococoGrandpa BestFinalized (r:1 w:1) + // Storage: BridgeRococoGrandpa ImportedHeaders (r:1 w:2) + // Storage: BridgeRococoGrandpa CurrentAuthoritySet (r:1 w:0) + // Storage: BridgeRococoGrandpa ImportedHashesPointer (r:1 w:1) + // Storage: BridgeRococoGrandpa ImportedHashes (r:1 w:1) + /// The range of component `p` is `[51, 102]`. + /// The range of component `v` is `[50, 100]`. + fn submit_finality_proof(p: u32, _v: u32, ) -> Weight { + // Minimum execution time: 1_945_391 nanoseconds. + Weight::from_ref_time(438_211_999) + // Standard Error: 400_341 + .saturating_add(Weight::from_ref_time(29_984_882).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(7)) + .saturating_add(T::DbWeight::get().writes(6)) + } +} diff --git a/runtime/pangoro/src/weights/pallet_collective_council.rs b/runtime/pangoro/src/weights/pallet_collective_council.rs new file mode 100644 index 000000000..790479e87 --- /dev/null +++ b/runtime/pangoro/src/weights/pallet_collective_council.rs @@ -0,0 +1,234 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `pallet_collective` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-02-22, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("pangoro-local"), DB CACHE: 1024 + +// Executed Command: +// ./target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --steps +// 2 +// --repeat +// 1 +// --chain +// pangoro-local +// --output +// runtime/pangoro/src/weights/ +// --extrinsic +// * +// --pallet +// * + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_collective`. +pub struct WeightInfo(PhantomData); +impl pallet_collective::WeightInfo for WeightInfo { + // Storage: Council Members (r:1 w:1) + // Storage: Council Proposals (r:1 w:0) + // Storage: Council Prime (r:0 w:1) + // Storage: Council Voting (r:100 w:100) + /// The range of component `m` is `[0, 100]`. + /// The range of component `n` is `[0, 100]`. + /// The range of component `p` is `[0, 100]`. + /// The range of component `m` is `[0, 100]`. + /// The range of component `n` is `[0, 100]`. + /// The range of component `p` is `[0, 100]`. + fn set_members(m: u32, _n: u32, p: u32, ) -> Weight { + // Minimum execution time: 15_847 nanoseconds. + Weight::from_ref_time(15_847_000) + // Standard Error: 881_721 + .saturating_add(Weight::from_ref_time(3_897_468).saturating_mul(m.into())) + // Standard Error: 881_721 + .saturating_add(Weight::from_ref_time(3_873_043).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(m.into()))) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(p.into()))) + .saturating_add(T::DbWeight::get().writes(2)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(m.into()))) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(p.into()))) + } + // Storage: Council Members (r:1 w:0) + /// The range of component `b` is `[2, 1024]`. + /// The range of component `m` is `[1, 100]`. + /// The range of component `b` is `[2, 1024]`. + /// The range of component `m` is `[1, 100]`. + fn execute(b: u32, m: u32, ) -> Weight { + // Minimum execution time: 25_156 nanoseconds. + Weight::from_ref_time(25_844_311) + // Standard Error: 1_485 + .saturating_add(Weight::from_ref_time(1_579).saturating_mul(b.into())) + // Standard Error: 15_334 + .saturating_add(Weight::from_ref_time(3_030).saturating_mul(m.into())) + .saturating_add(T::DbWeight::get().reads(1)) + } + // Storage: Council Members (r:1 w:0) + // Storage: Council ProposalOf (r:1 w:0) + /// The range of component `b` is `[2, 1024]`. + /// The range of component `m` is `[1, 100]`. + /// The range of component `b` is `[2, 1024]`. + /// The range of component `m` is `[1, 100]`. + fn propose_execute(b: u32, _m: u32, ) -> Weight { + // Minimum execution time: 27_671 nanoseconds. + Weight::from_ref_time(29_135_151) + // Standard Error: 1_873 + .saturating_add(Weight::from_ref_time(1_260).saturating_mul(b.into())) + .saturating_add(T::DbWeight::get().reads(2)) + } + // Storage: Council Members (r:1 w:0) + // Storage: Council ProposalOf (r:1 w:1) + // Storage: Council Proposals (r:1 w:1) + // Storage: Council ProposalCount (r:1 w:1) + // Storage: Council Voting (r:0 w:1) + /// The range of component `b` is `[2, 1024]`. + /// The range of component `m` is `[2, 100]`. + /// The range of component `p` is `[1, 100]`. + /// The range of component `b` is `[2, 1024]`. + /// The range of component `m` is `[2, 100]`. + /// The range of component `p` is `[1, 100]`. + fn propose_proposed(b: u32, _m: u32, p: u32, ) -> Weight { + // Minimum execution time: 32_960 nanoseconds. + Weight::from_ref_time(32_662_050) + // Standard Error: 2_210 + .saturating_add(Weight::from_ref_time(7_678).saturating_mul(b.into())) + // Standard Error: 22_817 + .saturating_add(Weight::from_ref_time(209_260).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(4)) + } + // Storage: Council Members (r:1 w:0) + // Storage: Council Voting (r:1 w:1) + /// The range of component `m` is `[5, 100]`. + /// The range of component `m` is `[5, 100]`. + fn vote(m: u32, ) -> Weight { + // Minimum execution time: 28_784 nanoseconds. + Weight::from_ref_time(31_836_210) + // Standard Error: 39_916 + .saturating_add(Weight::from_ref_time(65_257).saturating_mul(m.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Council Voting (r:1 w:1) + // Storage: Council Members (r:1 w:0) + // Storage: Council Proposals (r:1 w:1) + // Storage: Council ProposalOf (r:0 w:1) + /// The range of component `m` is `[4, 100]`. + /// The range of component `p` is `[1, 100]`. + /// The range of component `m` is `[4, 100]`. + /// The range of component `p` is `[1, 100]`. + fn close_early_disapproved(m: u32, p: u32, ) -> Weight { + // Minimum execution time: 29_543 nanoseconds. + Weight::from_ref_time(29_539_631) + // Standard Error: 36_612 + .saturating_add(Weight::from_ref_time(15_744).saturating_mul(m.into())) + // Standard Error: 35_502 + .saturating_add(Weight::from_ref_time(189_388).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: Council Voting (r:1 w:1) + // Storage: Council Members (r:1 w:0) + // Storage: Council ProposalOf (r:1 w:1) + // Storage: Council Proposals (r:1 w:1) + /// The range of component `b` is `[2, 1024]`. + /// The range of component `m` is `[4, 100]`. + /// The range of component `p` is `[1, 100]`. + /// The range of component `b` is `[2, 1024]`. + /// The range of component `m` is `[4, 100]`. + /// The range of component `p` is `[1, 100]`. + fn close_early_approved(b: u32, m: u32, p: u32, ) -> Weight { + // Minimum execution time: 44_061 nanoseconds. + Weight::from_ref_time(41_619_898) + // Standard Error: 4_334 + .saturating_add(Weight::from_ref_time(6_873).saturating_mul(b.into())) + // Standard Error: 46_141 + .saturating_add(Weight::from_ref_time(12_289).saturating_mul(m.into())) + // Standard Error: 44_743 + .saturating_add(Weight::from_ref_time(200_199).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: Council Voting (r:1 w:1) + // Storage: Council Members (r:1 w:0) + // Storage: Council Prime (r:1 w:0) + // Storage: Council Proposals (r:1 w:1) + // Storage: Council ProposalOf (r:0 w:1) + /// The range of component `m` is `[4, 100]`. + /// The range of component `p` is `[1, 100]`. + /// The range of component `m` is `[4, 100]`. + /// The range of component `p` is `[1, 100]`. + fn close_disapproved(_m: u32, p: u32, ) -> Weight { + // Minimum execution time: 35_223 nanoseconds. + Weight::from_ref_time(36_204_673) + // Standard Error: 28_916 + .saturating_add(Weight::from_ref_time(180_888).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: Council Voting (r:1 w:1) + // Storage: Council Members (r:1 w:0) + // Storage: Council Prime (r:1 w:0) + // Storage: Council ProposalOf (r:1 w:1) + // Storage: Council Proposals (r:1 w:1) + /// The range of component `b` is `[2, 1024]`. + /// The range of component `m` is `[4, 100]`. + /// The range of component `p` is `[1, 100]`. + /// The range of component `b` is `[2, 1024]`. + /// The range of component `m` is `[4, 100]`. + /// The range of component `p` is `[1, 100]`. + fn close_approved(b: u32, _m: u32, p: u32, ) -> Weight { + // Minimum execution time: 44_272 nanoseconds. + Weight::from_ref_time(46_929_498) + // Standard Error: 3_098 + .saturating_add(Weight::from_ref_time(595).saturating_mul(b.into())) + // Standard Error: 31_987 + .saturating_add(Weight::from_ref_time(237_987).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: Council Proposals (r:1 w:1) + // Storage: Council Voting (r:0 w:1) + // Storage: Council ProposalOf (r:0 w:1) + /// The range of component `p` is `[1, 100]`. + /// The range of component `p` is `[1, 100]`. + fn disapprove_proposal(p: u32, ) -> Weight { + // Minimum execution time: 21_641 nanoseconds. + Weight::from_ref_time(41_393_590) + // Standard Error: 332_513 + .saturating_add(Weight::from_ref_time(242_409).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(3)) + } +} diff --git a/runtime/pangoro/src/weights/pallet_collective_technical_committee.rs b/runtime/pangoro/src/weights/pallet_collective_technical_committee.rs new file mode 100644 index 000000000..e97deccc4 --- /dev/null +++ b/runtime/pangoro/src/weights/pallet_collective_technical_committee.rs @@ -0,0 +1,232 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `pallet_collective` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-02-22, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("pangoro-local"), DB CACHE: 1024 + +// Executed Command: +// ./target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --steps +// 2 +// --repeat +// 1 +// --chain +// pangoro-local +// --output +// runtime/pangoro/src/weights/ +// --extrinsic +// * +// --pallet +// * + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_collective`. +pub struct WeightInfo(PhantomData); +impl pallet_collective::WeightInfo for WeightInfo { + // Storage: TechnicalCommittee Members (r:1 w:1) + // Storage: TechnicalCommittee Proposals (r:1 w:0) + // Storage: TechnicalCommittee Prime (r:0 w:1) + // Storage: TechnicalCommittee Voting (r:100 w:100) + /// The range of component `m` is `[0, 100]`. + /// The range of component `n` is `[0, 100]`. + /// The range of component `p` is `[0, 100]`. + /// The range of component `m` is `[0, 100]`. + /// The range of component `n` is `[0, 100]`. + /// The range of component `p` is `[0, 100]`. + fn set_members(m: u32, _n: u32, p: u32, ) -> Weight { + // Minimum execution time: 13_270 nanoseconds. + Weight::from_ref_time(13_270_000) + // Standard Error: 886_139 + .saturating_add(Weight::from_ref_time(3_921_725).saturating_mul(m.into())) + // Standard Error: 886_139 + .saturating_add(Weight::from_ref_time(3_872_435).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(m.into()))) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(p.into()))) + .saturating_add(T::DbWeight::get().writes(2)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(m.into()))) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(p.into()))) + } + // Storage: TechnicalCommittee Members (r:1 w:0) + /// The range of component `b` is `[2, 1024]`. + /// The range of component `m` is `[1, 100]`. + /// The range of component `b` is `[2, 1024]`. + /// The range of component `m` is `[1, 100]`. + fn execute(_b: u32, _m: u32, ) -> Weight { + // Minimum execution time: 17_927 nanoseconds. + Weight::from_ref_time(24_095_929) + .saturating_add(T::DbWeight::get().reads(1)) + } + // Storage: TechnicalCommittee Members (r:1 w:0) + // Storage: TechnicalCommittee ProposalOf (r:1 w:0) + /// The range of component `b` is `[2, 1024]`. + /// The range of component `m` is `[1, 100]`. + /// The range of component `b` is `[2, 1024]`. + /// The range of component `m` is `[1, 100]`. + fn propose_execute(b: u32, m: u32, ) -> Weight { + // Minimum execution time: 20_607 nanoseconds. + Weight::from_ref_time(20_359_408) + // Standard Error: 516 + .saturating_add(Weight::from_ref_time(371).saturating_mul(b.into())) + // Standard Error: 5_336 + .saturating_add(Weight::from_ref_time(11_348).saturating_mul(m.into())) + .saturating_add(T::DbWeight::get().reads(2)) + } + // Storage: TechnicalCommittee Members (r:1 w:0) + // Storage: TechnicalCommittee ProposalOf (r:1 w:1) + // Storage: TechnicalCommittee Proposals (r:1 w:1) + // Storage: TechnicalCommittee ProposalCount (r:1 w:1) + // Storage: TechnicalCommittee Voting (r:0 w:1) + /// The range of component `b` is `[2, 1024]`. + /// The range of component `m` is `[2, 100]`. + /// The range of component `p` is `[1, 100]`. + /// The range of component `b` is `[2, 1024]`. + /// The range of component `m` is `[2, 100]`. + /// The range of component `p` is `[1, 100]`. + fn propose_proposed(b: u32, m: u32, p: u32, ) -> Weight { + // Minimum execution time: 26_643 nanoseconds. + Weight::from_ref_time(20_298_039) + // Standard Error: 3_296 + .saturating_add(Weight::from_ref_time(2_911).saturating_mul(b.into())) + // Standard Error: 34_374 + .saturating_add(Weight::from_ref_time(31_451).saturating_mul(m.into())) + // Standard Error: 34_027 + .saturating_add(Weight::from_ref_time(238_734).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(4)) + } + // Storage: TechnicalCommittee Members (r:1 w:0) + // Storage: TechnicalCommittee Voting (r:1 w:1) + /// The range of component `m` is `[5, 100]`. + /// The range of component `m` is `[5, 100]`. + fn vote(m: u32, ) -> Weight { + // Minimum execution time: 30_416 nanoseconds. + Weight::from_ref_time(30_239_868) + // Standard Error: 13_990 + .saturating_add(Weight::from_ref_time(89_126).saturating_mul(m.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: TechnicalCommittee Voting (r:1 w:1) + // Storage: TechnicalCommittee Members (r:1 w:0) + // Storage: TechnicalCommittee Proposals (r:1 w:1) + // Storage: TechnicalCommittee ProposalOf (r:0 w:1) + /// The range of component `m` is `[4, 100]`. + /// The range of component `p` is `[1, 100]`. + /// The range of component `m` is `[4, 100]`. + /// The range of component `p` is `[1, 100]`. + fn close_early_disapproved(m: u32, p: u32, ) -> Weight { + // Minimum execution time: 28_527 nanoseconds. + Weight::from_ref_time(27_759_126) + // Standard Error: 19_869 + .saturating_add(Weight::from_ref_time(13_786).saturating_mul(m.into())) + // Standard Error: 19_267 + .saturating_add(Weight::from_ref_time(206_227).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: TechnicalCommittee Voting (r:1 w:1) + // Storage: TechnicalCommittee Members (r:1 w:0) + // Storage: TechnicalCommittee ProposalOf (r:1 w:1) + // Storage: TechnicalCommittee Proposals (r:1 w:1) + /// The range of component `b` is `[2, 1024]`. + /// The range of component `m` is `[4, 100]`. + /// The range of component `p` is `[1, 100]`. + /// The range of component `b` is `[2, 1024]`. + /// The range of component `m` is `[4, 100]`. + /// The range of component `p` is `[1, 100]`. + fn close_early_approved(b: u32, _m: u32, p: u32, ) -> Weight { + // Minimum execution time: 38_552 nanoseconds. + Weight::from_ref_time(32_137_421) + // Standard Error: 4_052 + .saturating_add(Weight::from_ref_time(8_741).saturating_mul(b.into())) + // Standard Error: 41_832 + .saturating_add(Weight::from_ref_time(273_563).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: TechnicalCommittee Voting (r:1 w:1) + // Storage: TechnicalCommittee Members (r:1 w:0) + // Storage: TechnicalCommittee Prime (r:1 w:0) + // Storage: TechnicalCommittee Proposals (r:1 w:1) + // Storage: TechnicalCommittee ProposalOf (r:0 w:1) + /// The range of component `m` is `[4, 100]`. + /// The range of component `p` is `[1, 100]`. + /// The range of component `m` is `[4, 100]`. + /// The range of component `p` is `[1, 100]`. + fn close_disapproved(m: u32, p: u32, ) -> Weight { + // Minimum execution time: 31_467 nanoseconds. + Weight::from_ref_time(29_935_335) + // Standard Error: 7_901 + .saturating_add(Weight::from_ref_time(15_401).saturating_mul(m.into())) + // Standard Error: 7_662 + .saturating_add(Weight::from_ref_time(182_560).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: TechnicalCommittee Voting (r:1 w:1) + // Storage: TechnicalCommittee Members (r:1 w:0) + // Storage: TechnicalCommittee Prime (r:1 w:0) + // Storage: TechnicalCommittee ProposalOf (r:1 w:1) + // Storage: TechnicalCommittee Proposals (r:1 w:1) + /// The range of component `b` is `[2, 1024]`. + /// The range of component `m` is `[4, 100]`. + /// The range of component `p` is `[1, 100]`. + /// The range of component `b` is `[2, 1024]`. + /// The range of component `m` is `[4, 100]`. + /// The range of component `p` is `[1, 100]`. + fn close_approved(_b: u32, _m: u32, p: u32, ) -> Weight { + // Minimum execution time: 40_291 nanoseconds. + Weight::from_ref_time(49_116_982) + // Standard Error: 28_943 + .saturating_add(Weight::from_ref_time(202_618).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: TechnicalCommittee Proposals (r:1 w:1) + // Storage: TechnicalCommittee Voting (r:0 w:1) + // Storage: TechnicalCommittee ProposalOf (r:0 w:1) + /// The range of component `p` is `[1, 100]`. + /// The range of component `p` is `[1, 100]`. + fn disapprove_proposal(p: u32, ) -> Weight { + // Minimum execution time: 18_335 nanoseconds. + Weight::from_ref_time(18_311_929) + // Standard Error: 16_259 + .saturating_add(Weight::from_ref_time(180_070).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(3)) + } +} diff --git a/runtime/pangoro/src/weights/pallet_democracy.rs b/runtime/pangoro/src/weights/pallet_democracy.rs new file mode 100644 index 000000000..a9d7ebd65 --- /dev/null +++ b/runtime/pangoro/src/weights/pallet_democracy.rs @@ -0,0 +1,252 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `pallet_democracy` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-02-22, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("pangoro-local"), DB CACHE: 1024 + +// Executed Command: +// ./target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --steps +// 2 +// --repeat +// 1 +// --chain +// pangoro-local +// --output +// runtime/pangoro/src/weights/ +// --extrinsic +// * +// --pallet +// * + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_democracy`. +pub struct WeightInfo(PhantomData); +impl pallet_democracy::WeightInfo for WeightInfo { + // Storage: Democracy PublicPropCount (r:1 w:1) + // Storage: Democracy PublicProps (r:1 w:1) + // Storage: Democracy Blacklist (r:1 w:0) + // Storage: Democracy DepositOf (r:0 w:1) + fn propose() -> Weight { + // Minimum execution time: 54_483 nanoseconds. + Weight::from_ref_time(54_483_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: Democracy DepositOf (r:1 w:1) + fn second() -> Weight { + // Minimum execution time: 41_487 nanoseconds. + Weight::from_ref_time(41_487_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Democracy ReferendumInfoOf (r:1 w:1) + // Storage: Democracy VotingOf (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + fn vote_new() -> Weight { + // Minimum execution time: 52_315 nanoseconds. + Weight::from_ref_time(52_315_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: Democracy ReferendumInfoOf (r:1 w:1) + // Storage: Democracy VotingOf (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + fn vote_existing() -> Weight { + // Minimum execution time: 82_639 nanoseconds. + Weight::from_ref_time(82_639_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: Democracy ReferendumInfoOf (r:1 w:1) + // Storage: Democracy Cancellations (r:1 w:1) + fn emergency_cancel() -> Weight { + // Minimum execution time: 44_503 nanoseconds. + Weight::from_ref_time(44_503_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Democracy PublicProps (r:1 w:1) + // Storage: Democracy DepositOf (r:1 w:1) + // Storage: System Account (r:2 w:2) + // Storage: Democracy NextExternal (r:1 w:1) + // Storage: Democracy ReferendumInfoOf (r:1 w:1) + // Storage: Democracy Blacklist (r:0 w:1) + fn blacklist() -> Weight { + // Minimum execution time: 84_259 nanoseconds. + Weight::from_ref_time(84_259_000) + .saturating_add(T::DbWeight::get().reads(6)) + .saturating_add(T::DbWeight::get().writes(7)) + } + // Storage: Democracy NextExternal (r:1 w:1) + // Storage: Democracy Blacklist (r:1 w:0) + fn external_propose() -> Weight { + // Minimum execution time: 24_458 nanoseconds. + Weight::from_ref_time(24_458_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Democracy NextExternal (r:0 w:1) + fn external_propose_majority() -> Weight { + // Minimum execution time: 15_455 nanoseconds. + Weight::from_ref_time(15_455_000) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Democracy NextExternal (r:0 w:1) + fn external_propose_default() -> Weight { + // Minimum execution time: 11_555 nanoseconds. + Weight::from_ref_time(11_555_000) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Democracy NextExternal (r:1 w:1) + // Storage: Democracy ReferendumCount (r:1 w:1) + // Storage: Democracy ReferendumInfoOf (r:0 w:1) + fn fast_track() -> Weight { + // Minimum execution time: 28_492 nanoseconds. + Weight::from_ref_time(28_492_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: Democracy NextExternal (r:1 w:1) + // Storage: Democracy Blacklist (r:1 w:1) + fn veto_external() -> Weight { + // Minimum execution time: 30_614 nanoseconds. + Weight::from_ref_time(30_614_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Democracy PublicProps (r:1 w:1) + // Storage: Democracy DepositOf (r:1 w:1) + // Storage: System Account (r:2 w:2) + fn cancel_proposal() -> Weight { + // Minimum execution time: 87_806 nanoseconds. + Weight::from_ref_time(87_806_000) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(4)) + } + // Storage: Democracy ReferendumInfoOf (r:0 w:1) + fn cancel_referendum() -> Weight { + // Minimum execution time: 19_511 nanoseconds. + Weight::from_ref_time(19_511_000) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Democracy LowestUnbaked (r:1 w:1) + // Storage: Democracy ReferendumCount (r:1 w:0) + // Storage: Democracy ReferendumInfoOf (r:99 w:0) + /// The range of component `r` is `[0, 99]`. + fn on_initialize_base(_r: u32, ) -> Weight { + // Minimum execution time: 8_386 nanoseconds. + Weight::from_ref_time(227_595_000) + .saturating_add(T::DbWeight::get().reads(101)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Democracy LowestUnbaked (r:1 w:1) + // Storage: Democracy ReferendumCount (r:1 w:0) + // Storage: Democracy LastTabledWasExternal (r:1 w:0) + // Storage: Democracy NextExternal (r:1 w:0) + // Storage: Democracy PublicProps (r:1 w:0) + // Storage: Democracy ReferendumInfoOf (r:99 w:0) + /// The range of component `r` is `[0, 99]`. + fn on_initialize_base_with_launch_period(_r: u32, ) -> Weight { + // Minimum execution time: 25_890 nanoseconds. + Weight::from_ref_time(210_385_000) + .saturating_add(T::DbWeight::get().reads(104)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Democracy VotingOf (r:3 w:3) + // Storage: Balances Locks (r:1 w:1) + // Storage: Democracy ReferendumInfoOf (r:99 w:99) + /// The range of component `r` is `[0, 99]`. + fn delegate(_r: u32, ) -> Weight { + // Minimum execution time: 43_169 nanoseconds. + Weight::from_ref_time(331_157_000) + .saturating_add(T::DbWeight::get().reads(103)) + .saturating_add(T::DbWeight::get().writes(103)) + } + // Storage: Democracy VotingOf (r:2 w:2) + // Storage: Democracy ReferendumInfoOf (r:99 w:99) + /// The range of component `r` is `[0, 99]`. + fn undelegate(_r: u32, ) -> Weight { + // Minimum execution time: 37_379 nanoseconds. + Weight::from_ref_time(311_380_000) + .saturating_add(T::DbWeight::get().reads(101)) + .saturating_add(T::DbWeight::get().writes(101)) + } + // Storage: Democracy PublicProps (r:0 w:1) + fn clear_public_proposals() -> Weight { + // Minimum execution time: 6_243 nanoseconds. + Weight::from_ref_time(6_243_000) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Democracy VotingOf (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + // Storage: System Account (r:1 w:1) + /// The range of component `r` is `[0, 99]`. + fn unlock_remove(_r: u32, ) -> Weight { + // Minimum execution time: 32_521 nanoseconds. + Weight::from_ref_time(35_746_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: Democracy VotingOf (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + // Storage: System Account (r:1 w:1) + /// The range of component `r` is `[0, 99]`. + fn unlock_set(_r: u32, ) -> Weight { + // Minimum execution time: 29_260 nanoseconds. + Weight::from_ref_time(40_749_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: Democracy ReferendumInfoOf (r:1 w:1) + // Storage: Democracy VotingOf (r:1 w:1) + /// The range of component `r` is `[1, 100]`. + fn remove_vote(_r: u32, ) -> Weight { + // Minimum execution time: 16_633 nanoseconds. + Weight::from_ref_time(27_147_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Democracy ReferendumInfoOf (r:1 w:1) + // Storage: Democracy VotingOf (r:1 w:1) + /// The range of component `r` is `[1, 100]`. + fn remove_other_vote(_r: u32, ) -> Weight { + // Minimum execution time: 28_761 nanoseconds. + Weight::from_ref_time(30_901_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } +} diff --git a/runtime/pangoro/src/weights/pallet_elections_phragmen.rs b/runtime/pangoro/src/weights/pallet_elections_phragmen.rs new file mode 100644 index 000000000..a7863a290 --- /dev/null +++ b/runtime/pangoro/src/weights/pallet_elections_phragmen.rs @@ -0,0 +1,200 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `pallet_elections_phragmen` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-02-22, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("pangoro-local"), DB CACHE: 1024 + +// Executed Command: +// ./target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --steps +// 2 +// --repeat +// 1 +// --chain +// pangoro-local +// --output +// runtime/pangoro/src/weights/ +// --extrinsic +// * +// --pallet +// * + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_elections_phragmen`. +pub struct WeightInfo(PhantomData); +impl pallet_elections_phragmen::WeightInfo for WeightInfo { + // Storage: PhragmenElection Candidates (r:1 w:0) + // Storage: PhragmenElection Members (r:1 w:0) + // Storage: PhragmenElection RunnersUp (r:1 w:0) + // Storage: PhragmenElection Voting (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + /// The range of component `v` is `[1, 16]`. + fn vote_equal(_v: u32, ) -> Weight { + // Minimum execution time: 42_766 nanoseconds. + Weight::from_ref_time(54_315_000) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: PhragmenElection Candidates (r:1 w:0) + // Storage: PhragmenElection Members (r:1 w:0) + // Storage: PhragmenElection RunnersUp (r:1 w:0) + // Storage: PhragmenElection Voting (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + /// The range of component `v` is `[2, 16]`. + fn vote_more(_v: u32, ) -> Weight { + // Minimum execution time: 55_225 nanoseconds. + Weight::from_ref_time(61_297_000) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: PhragmenElection Candidates (r:1 w:0) + // Storage: PhragmenElection Members (r:1 w:0) + // Storage: PhragmenElection RunnersUp (r:1 w:0) + // Storage: PhragmenElection Voting (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + /// The range of component `v` is `[2, 16]`. + fn vote_less(_v: u32, ) -> Weight { + // Minimum execution time: 56_719 nanoseconds. + Weight::from_ref_time(58_549_000) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: PhragmenElection Voting (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + fn remove_voter() -> Weight { + // Minimum execution time: 56_565 nanoseconds. + Weight::from_ref_time(56_565_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: PhragmenElection Candidates (r:1 w:1) + // Storage: PhragmenElection Members (r:1 w:0) + // Storage: PhragmenElection RunnersUp (r:1 w:0) + /// The range of component `c` is `[1, 30]`. + fn submit_candidacy(_c: u32, ) -> Weight { + // Minimum execution time: 35_966 nanoseconds. + Weight::from_ref_time(41_537_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: PhragmenElection Candidates (r:1 w:1) + /// The range of component `c` is `[1, 30]`. + fn renounce_candidacy_candidate(_c: u32, ) -> Weight { + // Minimum execution time: 33_754 nanoseconds. + Weight::from_ref_time(37_906_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: PhragmenElection Members (r:1 w:1) + // Storage: PhragmenElection RunnersUp (r:1 w:1) + // Storage: Council Prime (r:1 w:1) + // Storage: Council Proposals (r:1 w:0) + // Storage: Council Members (r:0 w:1) + fn renounce_candidacy_members() -> Weight { + // Minimum execution time: 45_168 nanoseconds. + Weight::from_ref_time(45_168_000) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(4)) + } + // Storage: PhragmenElection RunnersUp (r:1 w:1) + fn renounce_candidacy_runners_up() -> Weight { + // Minimum execution time: 34_561 nanoseconds. + Weight::from_ref_time(34_561_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Benchmark Override (r:0 w:0) + fn remove_member_without_replacement() -> Weight { + // Minimum execution time: 500_000_000 nanoseconds. + Weight::from_ref_time(500_000_000_000) + } + // Storage: PhragmenElection Members (r:1 w:1) + // Storage: System Account (r:2 w:2) + // Storage: PhragmenElection RunnersUp (r:1 w:1) + // Storage: Council Prime (r:1 w:1) + // Storage: Council Proposals (r:1 w:0) + // Storage: Council Members (r:0 w:1) + fn remove_member_with_replacement() -> Weight { + // Minimum execution time: 62_482 nanoseconds. + Weight::from_ref_time(62_482_000) + .saturating_add(T::DbWeight::get().reads(6)) + .saturating_add(T::DbWeight::get().writes(6)) + } + // Storage: PhragmenElection Voting (r:151 w:150) + // Storage: PhragmenElection Members (r:1 w:0) + // Storage: PhragmenElection RunnersUp (r:1 w:0) + // Storage: PhragmenElection Candidates (r:1 w:0) + // Storage: Balances Locks (r:150 w:150) + // Storage: System Account (r:150 w:150) + /// The range of component `v` is `[150, 300]`. + /// The range of component `d` is `[0, 150]`. + fn clean_defunct_voters(v: u32, _d: u32, ) -> Weight { + // Minimum execution time: 6_963_107 nanoseconds. + Weight::from_ref_time(6_963_107_000) + // Standard Error: 5_787_119 + .saturating_add(Weight::from_ref_time(27_170_063).saturating_mul(v.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().reads((3_u64).saturating_mul(v.into()))) + .saturating_add(T::DbWeight::get().writes((3_u64).saturating_mul(v.into()))) + } + // Storage: PhragmenElection Candidates (r:1 w:1) + // Storage: PhragmenElection Members (r:1 w:1) + // Storage: PhragmenElection RunnersUp (r:1 w:1) + // Storage: PhragmenElection Voting (r:301 w:0) + // Storage: Council Proposals (r:1 w:0) + // Storage: PhragmenElection ElectionRounds (r:1 w:1) + // Storage: Council Members (r:0 w:1) + // Storage: Council Prime (r:0 w:1) + // Storage: System Account (r:17 w:17) + /// The range of component `c` is `[1, 30]`. + /// The range of component `v` is `[1, 300]`. + /// The range of component `e` is `[300, 4800]`. + fn election_phragmen(c: u32, v: u32, e: u32, ) -> Weight { + // Minimum execution time: 552_726 nanoseconds. + Weight::from_ref_time(552_726_000) + // Standard Error: 72_431_641 + .saturating_add(Weight::from_ref_time(41_119_328).saturating_mul(c.into())) + // Standard Error: 7_140_319 + .saturating_add(Weight::from_ref_time(7_743_747).saturating_mul(v.into())) + // Standard Error: 458_588 + .saturating_add(Weight::from_ref_time(162_823).saturating_mul(e.into())) + .saturating_add(T::DbWeight::get().reads(35)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(c.into()))) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(v.into()))) + .saturating_add(T::DbWeight::get().writes(5)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(c.into()))) + } +} diff --git a/runtime/pangoro/src/weights/pallet_fee_market.rs b/runtime/pangoro/src/weights/pallet_fee_market.rs new file mode 100644 index 000000000..938cbc15c --- /dev/null +++ b/runtime/pangoro/src/weights/pallet_fee_market.rs @@ -0,0 +1,139 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `pallet_fee_market` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-02-22, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("pangoro-local"), DB CACHE: 1024 + +// Executed Command: +// ./target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --steps +// 2 +// --repeat +// 1 +// --chain +// pangoro-local +// --output +// runtime/pangoro/src/weights/ +// --extrinsic +// * +// --pallet +// * + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_fee_market`. +pub struct WeightInfo(PhantomData); +impl pallet_fee_market::WeightInfo for WeightInfo { + // Storage: PangolinFeeMarket Relayers (r:1 w:1) + // Storage: System Account (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + // Storage: PangolinFeeMarket RelayersMap (r:10 w:1) + // Storage: PangolinFeeMarket Orders (r:1 w:0) + // Storage: PangolinFeeMarket AssignedRelayersNumber (r:1 w:0) + // Storage: PangolinFeeMarket AssignedRelayers (r:0 w:1) + fn enroll_and_lock_collateral() -> Weight { + // Minimum execution time: 123_887 nanoseconds. + Weight::from_ref_time(123_887_000) + .saturating_add(T::DbWeight::get().reads(15)) + .saturating_add(T::DbWeight::get().writes(5)) + } + // Storage: PangolinFeeMarket Relayers (r:1 w:0) + // Storage: System Account (r:1 w:1) + // Storage: PangolinFeeMarket RelayersMap (r:10 w:1) + // Storage: Balances Locks (r:1 w:1) + // Storage: PangolinFeeMarket Orders (r:1 w:0) + // Storage: PangolinFeeMarket AssignedRelayersNumber (r:1 w:0) + // Storage: PangolinFeeMarket AssignedRelayers (r:0 w:1) + fn increase_locked_collateral() -> Weight { + // Minimum execution time: 120_368 nanoseconds. + Weight::from_ref_time(120_368_000) + .saturating_add(T::DbWeight::get().reads(15)) + .saturating_add(T::DbWeight::get().writes(4)) + } + // Storage: PangolinFeeMarket Relayers (r:1 w:0) + // Storage: System Account (r:1 w:1) + // Storage: PangolinFeeMarket RelayersMap (r:10 w:1) + // Storage: PangolinFeeMarket Orders (r:1 w:0) + // Storage: Balances Locks (r:1 w:1) + // Storage: PangolinFeeMarket AssignedRelayersNumber (r:1 w:0) + // Storage: PangolinFeeMarket AssignedRelayers (r:0 w:1) + fn decrease_locked_collateral() -> Weight { + // Minimum execution time: 129_816 nanoseconds. + Weight::from_ref_time(129_816_000) + .saturating_add(T::DbWeight::get().reads(15)) + .saturating_add(T::DbWeight::get().writes(4)) + } + // Storage: PangolinFeeMarket Relayers (r:1 w:0) + // Storage: PangolinFeeMarket RelayersMap (r:10 w:1) + // Storage: PangolinFeeMarket Orders (r:1 w:0) + // Storage: PangolinFeeMarket AssignedRelayersNumber (r:1 w:0) + // Storage: PangolinFeeMarket AssignedRelayers (r:0 w:1) + fn update_relay_fee() -> Weight { + // Minimum execution time: 115_966 nanoseconds. + Weight::from_ref_time(115_966_000) + .saturating_add(T::DbWeight::get().reads(13)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: PangolinFeeMarket Relayers (r:1 w:1) + // Storage: PangolinFeeMarket Orders (r:1 w:0) + // Storage: Balances Locks (r:1 w:1) + // Storage: System Account (r:1 w:1) + // Storage: PangolinFeeMarket AssignedRelayers (r:1 w:1) + // Storage: PangolinFeeMarket RelayersMap (r:9 w:1) + // Storage: PangolinFeeMarket AssignedRelayersNumber (r:1 w:0) + fn cancel_enrollment() -> Weight { + // Minimum execution time: 117_451 nanoseconds. + Weight::from_ref_time(117_451_000) + .saturating_add(T::DbWeight::get().reads(15)) + .saturating_add(T::DbWeight::get().writes(5)) + } + // Storage: PangolinFeeMarket CollateralSlashProtect (r:0 w:1) + fn set_slash_protect() -> Weight { + // Minimum execution time: 33_110 nanoseconds. + Weight::from_ref_time(33_110_000) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: PangolinFeeMarket Relayers (r:1 w:0) + // Storage: PangolinFeeMarket RelayersMap (r:10 w:0) + // Storage: PangolinFeeMarket Orders (r:1 w:0) + // Storage: PangolinFeeMarket AssignedRelayers (r:0 w:1) + // Storage: PangolinFeeMarket AssignedRelayersNumber (r:0 w:1) + fn set_assigned_relayers_number() -> Weight { + // Minimum execution time: 100_320 nanoseconds. + Weight::from_ref_time(100_320_000) + .saturating_add(T::DbWeight::get().reads(12)) + .saturating_add(T::DbWeight::get().writes(2)) + } +} diff --git a/runtime/pangoro/src/weights/pallet_identity.rs b/runtime/pangoro/src/weights/pallet_identity.rs new file mode 100644 index 000000000..30a0cb6b4 --- /dev/null +++ b/runtime/pangoro/src/weights/pallet_identity.rs @@ -0,0 +1,240 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `pallet_identity` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-02-22, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("pangoro-local"), DB CACHE: 1024 + +// Executed Command: +// ./target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --steps +// 2 +// --repeat +// 1 +// --chain +// pangoro-local +// --output +// runtime/pangoro/src/weights/ +// --extrinsic +// * +// --pallet +// * + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_identity`. +pub struct WeightInfo(PhantomData); +impl pallet_identity::WeightInfo for WeightInfo { + // Storage: Identity Registrars (r:1 w:1) + /// The range of component `r` is `[1, 19]`. + fn add_registrar(_r: u32, ) -> Weight { + // Minimum execution time: 18_746 nanoseconds. + Weight::from_ref_time(24_268_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Identity IdentityOf (r:1 w:1) + /// The range of component `r` is `[1, 20]`. + /// The range of component `x` is `[0, 100]`. + fn set_identity(r: u32, x: u32, ) -> Weight { + // Minimum execution time: 40_151 nanoseconds. + Weight::from_ref_time(38_624_684) + // Standard Error: 231_547 + .saturating_add(Weight::from_ref_time(76_315).saturating_mul(r.into())) + // Standard Error: 43_994 + .saturating_add(Weight::from_ref_time(451_480).saturating_mul(x.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Identity IdentityOf (r:1 w:0) + // Storage: Identity SubsOf (r:1 w:1) + // Storage: Identity SuperOf (r:100 w:100) + /// The range of component `s` is `[0, 100]`. + fn set_subs_new(_s: u32, ) -> Weight { + // Minimum execution time: 12_485 nanoseconds. + Weight::from_ref_time(259_615_000) + .saturating_add(T::DbWeight::get().reads(102)) + .saturating_add(T::DbWeight::get().writes(101)) + } + // Storage: Identity IdentityOf (r:1 w:0) + // Storage: Identity SubsOf (r:1 w:1) + // Storage: Identity SuperOf (r:0 w:100) + /// The range of component `p` is `[0, 100]`. + fn set_subs_old(_p: u32, ) -> Weight { + // Minimum execution time: 10_853 nanoseconds. + Weight::from_ref_time(130_999_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(101)) + } + // Storage: Identity SubsOf (r:1 w:1) + // Storage: Identity IdentityOf (r:1 w:1) + // Storage: Identity SuperOf (r:0 w:100) + /// The range of component `r` is `[1, 20]`. + /// The range of component `s` is `[0, 100]`. + /// The range of component `x` is `[0, 100]`. + fn clear_identity(r: u32, s: u32, x: u32, ) -> Weight { + // Minimum execution time: 64_949 nanoseconds. + Weight::from_ref_time(37_376_105) + // Standard Error: 163_795 + .saturating_add(Weight::from_ref_time(310_561).saturating_mul(r.into())) + // Standard Error: 31_121 + .saturating_add(Weight::from_ref_time(917_296).saturating_mul(s.into())) + // Standard Error: 31_121 + .saturating_add(Weight::from_ref_time(213_616).saturating_mul(x.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(s.into()))) + } + // Storage: Identity Registrars (r:1 w:0) + // Storage: Identity IdentityOf (r:1 w:1) + /// The range of component `r` is `[1, 20]`. + /// The range of component `x` is `[0, 100]`. + fn request_judgement(r: u32, x: u32, ) -> Weight { + // Minimum execution time: 45_232 nanoseconds. + Weight::from_ref_time(32_324_631) + // Standard Error: 56_884 + .saturating_add(Weight::from_ref_time(645_368).saturating_mul(r.into())) + // Standard Error: 10_807 + .saturating_add(Weight::from_ref_time(396_420).saturating_mul(x.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Identity IdentityOf (r:1 w:1) + /// The range of component `r` is `[1, 20]`. + /// The range of component `x` is `[0, 100]`. + fn cancel_request(r: u32, x: u32, ) -> Weight { + // Minimum execution time: 41_115 nanoseconds. + Weight::from_ref_time(33_187_105) + // Standard Error: 546_553 + .saturating_add(Weight::from_ref_time(396_394).saturating_mul(r.into())) + // Standard Error: 103_845 + .saturating_add(Weight::from_ref_time(334_435).saturating_mul(x.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Identity Registrars (r:1 w:1) + /// The range of component `r` is `[1, 19]`. + fn set_fee(_r: u32, ) -> Weight { + // Minimum execution time: 10_201 nanoseconds. + Weight::from_ref_time(14_976_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Identity Registrars (r:1 w:1) + /// The range of component `r` is `[1, 19]`. + fn set_account_id(_r: u32, ) -> Weight { + // Minimum execution time: 9_851 nanoseconds. + Weight::from_ref_time(11_989_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Identity Registrars (r:1 w:1) + /// The range of component `r` is `[1, 19]`. + fn set_fields(_r: u32, ) -> Weight { + // Minimum execution time: 11_213 nanoseconds. + Weight::from_ref_time(17_728_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Identity Registrars (r:1 w:0) + // Storage: Identity IdentityOf (r:1 w:1) + /// The range of component `r` is `[1, 19]`. + /// The range of component `x` is `[0, 100]`. + fn provide_judgement(_r: u32, x: u32, ) -> Weight { + // Minimum execution time: 33_874 nanoseconds. + Weight::from_ref_time(59_082_250) + // Standard Error: 37_438 + .saturating_add(Weight::from_ref_time(531_135).saturating_mul(x.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Identity SubsOf (r:1 w:1) + // Storage: Identity IdentityOf (r:1 w:1) + // Storage: System Account (r:2 w:2) + // Storage: Identity SuperOf (r:0 w:100) + /// The range of component `r` is `[1, 20]`. + /// The range of component `s` is `[0, 100]`. + /// The range of component `x` is `[0, 100]`. + fn kill_identity(r: u32, s: u32, x: u32, ) -> Weight { + // Minimum execution time: 70_394 nanoseconds. + Weight::from_ref_time(22_268_368) + // Standard Error: 891_357 + .saturating_add(Weight::from_ref_time(1_003_298).saturating_mul(r.into())) + // Standard Error: 169_357 + .saturating_add(Weight::from_ref_time(1_116_616).saturating_mul(s.into())) + // Standard Error: 169_357 + .saturating_add(Weight::from_ref_time(280_596).saturating_mul(x.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(3)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(s.into()))) + } + // Storage: Identity IdentityOf (r:1 w:0) + // Storage: Identity SuperOf (r:1 w:1) + // Storage: Identity SubsOf (r:1 w:1) + /// The range of component `s` is `[0, 99]`. + fn add_sub(_s: u32, ) -> Weight { + // Minimum execution time: 34_948 nanoseconds. + Weight::from_ref_time(46_924_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Identity IdentityOf (r:1 w:0) + // Storage: Identity SuperOf (r:1 w:1) + /// The range of component `s` is `[1, 100]`. + fn rename_sub(_s: u32, ) -> Weight { + // Minimum execution time: 16_918 nanoseconds. + Weight::from_ref_time(21_878_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Identity IdentityOf (r:1 w:0) + // Storage: Identity SuperOf (r:1 w:1) + // Storage: Identity SubsOf (r:1 w:1) + /// The range of component `s` is `[1, 100]`. + fn remove_sub(_s: u32, ) -> Weight { + // Minimum execution time: 38_109 nanoseconds. + Weight::from_ref_time(48_741_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Identity SuperOf (r:1 w:1) + // Storage: Identity SubsOf (r:1 w:1) + /// The range of component `s` is `[0, 99]`. + fn quit_sub(_s: u32, ) -> Weight { + // Minimum execution time: 25_504 nanoseconds. + Weight::from_ref_time(32_119_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } +} diff --git a/runtime/pangoro/src/weights/pallet_membership.rs b/runtime/pangoro/src/weights/pallet_membership.rs new file mode 100644 index 000000000..001a2919a --- /dev/null +++ b/runtime/pangoro/src/weights/pallet_membership.rs @@ -0,0 +1,136 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `pallet_membership` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-02-22, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("pangoro-local"), DB CACHE: 1024 + +// Executed Command: +// ./target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --steps +// 2 +// --repeat +// 1 +// --chain +// pangoro-local +// --output +// runtime/pangoro/src/weights/ +// --extrinsic +// * +// --pallet +// * + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_membership`. +pub struct WeightInfo(PhantomData); +impl pallet_membership::WeightInfo for WeightInfo { + // Storage: TechnicalMembership Members (r:1 w:1) + // Storage: TechnicalCommittee Proposals (r:1 w:0) + // Storage: TechnicalCommittee Members (r:0 w:1) + // Storage: TechnicalCommittee Prime (r:0 w:1) + /// The range of component `m` is `[1, 99]`. + fn add_member(_m: u32, ) -> Weight { + // Minimum execution time: 24_544 nanoseconds. + Weight::from_ref_time(25_887_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: TechnicalMembership Members (r:1 w:1) + // Storage: TechnicalCommittee Proposals (r:1 w:0) + // Storage: TechnicalMembership Prime (r:1 w:0) + // Storage: TechnicalCommittee Members (r:0 w:1) + // Storage: TechnicalCommittee Prime (r:0 w:1) + /// The range of component `m` is `[2, 100]`. + fn remove_member(_m: u32, ) -> Weight { + // Minimum execution time: 23_146 nanoseconds. + Weight::from_ref_time(28_246_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: TechnicalMembership Members (r:1 w:1) + // Storage: TechnicalCommittee Proposals (r:1 w:0) + // Storage: TechnicalMembership Prime (r:1 w:0) + // Storage: TechnicalCommittee Members (r:0 w:1) + // Storage: TechnicalCommittee Prime (r:0 w:1) + /// The range of component `m` is `[2, 100]`. + fn swap_member(_m: u32, ) -> Weight { + // Minimum execution time: 24_003 nanoseconds. + Weight::from_ref_time(27_418_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: TechnicalMembership Members (r:1 w:1) + // Storage: TechnicalCommittee Proposals (r:1 w:0) + // Storage: TechnicalMembership Prime (r:1 w:0) + // Storage: TechnicalCommittee Members (r:0 w:1) + // Storage: TechnicalCommittee Prime (r:0 w:1) + /// The range of component `m` is `[1, 100]`. + fn reset_member(_m: u32, ) -> Weight { + // Minimum execution time: 23_665 nanoseconds. + Weight::from_ref_time(38_544_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: TechnicalMembership Members (r:1 w:1) + // Storage: TechnicalCommittee Proposals (r:1 w:0) + // Storage: TechnicalMembership Prime (r:1 w:1) + // Storage: TechnicalCommittee Members (r:0 w:1) + // Storage: TechnicalCommittee Prime (r:0 w:1) + /// The range of component `m` is `[1, 100]`. + fn change_key(_m: u32, ) -> Weight { + // Minimum execution time: 26_324 nanoseconds. + Weight::from_ref_time(31_526_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(4)) + } + // Storage: TechnicalMembership Members (r:1 w:0) + // Storage: TechnicalMembership Prime (r:0 w:1) + // Storage: TechnicalCommittee Prime (r:0 w:1) + /// The range of component `m` is `[1, 100]`. + fn set_prime(_m: u32, ) -> Weight { + // Minimum execution time: 9_440 nanoseconds. + Weight::from_ref_time(26_602_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: TechnicalMembership Prime (r:0 w:1) + // Storage: TechnicalCommittee Prime (r:0 w:1) + /// The range of component `m` is `[1, 100]`. + fn clear_prime(_m: u32, ) -> Weight { + // Minimum execution time: 6_503 nanoseconds. + Weight::from_ref_time(16_749_000) + .saturating_add(T::DbWeight::get().writes(2)) + } +} diff --git a/runtime/pangoro/src/weights/pallet_multisig.rs b/runtime/pangoro/src/weights/pallet_multisig.rs new file mode 100644 index 000000000..f67aa2e9c --- /dev/null +++ b/runtime/pangoro/src/weights/pallet_multisig.rs @@ -0,0 +1,130 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `pallet_multisig` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-02-22, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("pangoro-local"), DB CACHE: 1024 + +// Executed Command: +// ./target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --steps +// 2 +// --repeat +// 1 +// --chain +// pangoro-local +// --output +// runtime/pangoro/src/weights/ +// --extrinsic +// * +// --pallet +// * + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_multisig`. +pub struct WeightInfo(PhantomData); +impl pallet_multisig::WeightInfo for WeightInfo { + /// The range of component `z` is `[0, 10000]`. + fn as_multi_threshold_1(_z: u32, ) -> Weight { + // Minimum execution time: 20_241 nanoseconds. + Weight::from_ref_time(24_721_000) + } + // Storage: Multisig Multisigs (r:1 w:1) + // Storage: unknown [0x3a65787472696e7369635f696e646578] (r:1 w:0) + /// The range of component `s` is `[2, 100]`. + /// The range of component `z` is `[0, 10000]`. + fn as_multi_create(s: u32, z: u32, ) -> Weight { + // Minimum execution time: 51_971 nanoseconds. + Weight::from_ref_time(35_974_061) + // Standard Error: 108_359 + .saturating_add(Weight::from_ref_time(159_969).saturating_mul(s.into())) + // Standard Error: 1_061 + .saturating_add(Weight::from_ref_time(1_995).saturating_mul(z.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Multisig Multisigs (r:1 w:1) + /// The range of component `s` is `[3, 100]`. + /// The range of component `z` is `[0, 10000]`. + fn as_multi_approve(s: u32, z: u32, ) -> Weight { + // Minimum execution time: 38_583 nanoseconds. + Weight::from_ref_time(29_986_690) + // Standard Error: 26_445 + .saturating_add(Weight::from_ref_time(106_103).saturating_mul(s.into())) + // Standard Error: 256 + .saturating_add(Weight::from_ref_time(827).saturating_mul(z.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Multisig Multisigs (r:1 w:1) + // Storage: System Account (r:1 w:1) + /// The range of component `s` is `[2, 100]`. + /// The range of component `z` is `[0, 10000]`. + fn as_multi_complete(s: u32, z: u32, ) -> Weight { + // Minimum execution time: 52_702 nanoseconds. + Weight::from_ref_time(48_998_428) + // Standard Error: 27_986 + .saturating_add(Weight::from_ref_time(37_035).saturating_mul(s.into())) + // Standard Error: 274 + .saturating_add(Weight::from_ref_time(691).saturating_mul(z.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Multisig Multisigs (r:1 w:1) + // Storage: unknown [0x3a65787472696e7369635f696e646578] (r:1 w:0) + /// The range of component `s` is `[2, 100]`. + fn approve_as_multi_create(_s: u32, ) -> Weight { + // Minimum execution time: 42_941 nanoseconds. + Weight::from_ref_time(55_953_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Multisig Multisigs (r:1 w:1) + /// The range of component `s` is `[2, 100]`. + fn approve_as_multi_approve(_s: u32, ) -> Weight { + // Minimum execution time: 24_880 nanoseconds. + Weight::from_ref_time(31_857_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Multisig Multisigs (r:1 w:1) + /// The range of component `s` is `[2, 100]`. + fn cancel_as_multi(_s: u32, ) -> Weight { + // Minimum execution time: 40_588 nanoseconds. + Weight::from_ref_time(41_468_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } +} diff --git a/runtime/pangoro/src/weights/pallet_preimage.rs b/runtime/pangoro/src/weights/pallet_preimage.rs new file mode 100644 index 000000000..0ab0e0631 --- /dev/null +++ b/runtime/pangoro/src/weights/pallet_preimage.rs @@ -0,0 +1,152 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `pallet_preimage` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-02-22, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("pangoro-local"), DB CACHE: 1024 + +// Executed Command: +// ./target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --steps +// 2 +// --repeat +// 1 +// --chain +// pangoro-local +// --output +// runtime/pangoro/src/weights/ +// --extrinsic +// * +// --pallet +// * + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_preimage`. +pub struct WeightInfo(PhantomData); +impl pallet_preimage::WeightInfo for WeightInfo { + // Storage: Preimage StatusFor (r:1 w:1) + // Storage: Preimage PreimageFor (r:0 w:1) + /// The range of component `s` is `[0, 4194304]`. + fn note_preimage(_s: u32, ) -> Weight { + // Minimum execution time: 46_059 nanoseconds. + Weight::from_ref_time(6_042_193_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Preimage StatusFor (r:1 w:1) + // Storage: Preimage PreimageFor (r:0 w:1) + /// The range of component `s` is `[0, 4194304]`. + fn note_requested_preimage(_s: u32, ) -> Weight { + // Minimum execution time: 36_952 nanoseconds. + Weight::from_ref_time(5_823_056_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Preimage StatusFor (r:1 w:1) + // Storage: Preimage PreimageFor (r:0 w:1) + /// The range of component `s` is `[0, 4194304]`. + fn note_no_deposit_preimage(_s: u32, ) -> Weight { + // Minimum execution time: 34_733 nanoseconds. + Weight::from_ref_time(5_941_767_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Preimage StatusFor (r:1 w:1) + // Storage: Preimage PreimageFor (r:0 w:1) + fn unnote_preimage() -> Weight { + // Minimum execution time: 351_292 nanoseconds. + Weight::from_ref_time(351_292_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Preimage StatusFor (r:1 w:1) + // Storage: Preimage PreimageFor (r:0 w:1) + fn unnote_no_deposit_preimage() -> Weight { + // Minimum execution time: 201_459 nanoseconds. + Weight::from_ref_time(201_459_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Preimage StatusFor (r:1 w:1) + fn request_preimage() -> Weight { + // Minimum execution time: 163_553 nanoseconds. + Weight::from_ref_time(163_553_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Preimage StatusFor (r:1 w:1) + fn request_no_deposit_preimage() -> Weight { + // Minimum execution time: 178_782 nanoseconds. + Weight::from_ref_time(178_782_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Preimage StatusFor (r:1 w:1) + fn request_unnoted_preimage() -> Weight { + // Minimum execution time: 48_394 nanoseconds. + Weight::from_ref_time(48_394_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Preimage StatusFor (r:1 w:1) + fn request_requested_preimage() -> Weight { + // Minimum execution time: 28_385 nanoseconds. + Weight::from_ref_time(28_385_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Preimage StatusFor (r:1 w:1) + // Storage: Preimage PreimageFor (r:0 w:1) + fn unrequest_preimage() -> Weight { + // Minimum execution time: 214_353 nanoseconds. + Weight::from_ref_time(214_353_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Preimage StatusFor (r:1 w:1) + fn unrequest_unnoted_preimage() -> Weight { + // Minimum execution time: 29_567 nanoseconds. + Weight::from_ref_time(29_567_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Preimage StatusFor (r:1 w:1) + fn unrequest_multi_referenced_preimage() -> Weight { + // Minimum execution time: 25_200 nanoseconds. + Weight::from_ref_time(25_200_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } +} diff --git a/runtime/pangoro/src/weights/pallet_proxy.rs b/runtime/pangoro/src/weights/pallet_proxy.rs new file mode 100644 index 000000000..cbee22228 --- /dev/null +++ b/runtime/pangoro/src/weights/pallet_proxy.rs @@ -0,0 +1,157 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `pallet_proxy` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-02-22, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("pangoro-local"), DB CACHE: 1024 + +// Executed Command: +// ./target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --steps +// 2 +// --repeat +// 1 +// --chain +// pangoro-local +// --output +// runtime/pangoro/src/weights/ +// --extrinsic +// * +// --pallet +// * + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_proxy`. +pub struct WeightInfo(PhantomData); +impl pallet_proxy::WeightInfo for WeightInfo { + // Storage: Proxy Proxies (r:1 w:0) + /// The range of component `p` is `[1, 31]`. + fn proxy(_p: u32, ) -> Weight { + // Minimum execution time: 38_484 nanoseconds. + Weight::from_ref_time(39_446_000) + .saturating_add(T::DbWeight::get().reads(1)) + } + // Storage: Proxy Proxies (r:1 w:0) + // Storage: Proxy Announcements (r:1 w:1) + // Storage: System Account (r:1 w:1) + /// The range of component `a` is `[0, 31]`. + /// The range of component `p` is `[1, 31]`. + fn proxy_announced(_a: u32, p: u32, ) -> Weight { + // Minimum execution time: 56_296 nanoseconds. + Weight::from_ref_time(60_565_033) + // Standard Error: 238_965 + .saturating_add(Weight::from_ref_time(231_966).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Proxy Announcements (r:1 w:1) + // Storage: System Account (r:1 w:1) + /// The range of component `a` is `[0, 31]`. + /// The range of component `p` is `[1, 31]`. + fn remove_announcement(a: u32, _p: u32, ) -> Weight { + // Minimum execution time: 37_859 nanoseconds. + Weight::from_ref_time(46_053_333) + // Standard Error: 196_895 + .saturating_add(Weight::from_ref_time(335_645).saturating_mul(a.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Proxy Announcements (r:1 w:1) + // Storage: System Account (r:1 w:1) + /// The range of component `a` is `[0, 31]`. + /// The range of component `p` is `[1, 31]`. + fn reject_announcement(a: u32, p: u32, ) -> Weight { + // Minimum execution time: 39_266 nanoseconds. + Weight::from_ref_time(38_147_933) + // Standard Error: 155_046 + .saturating_add(Weight::from_ref_time(204_612).saturating_mul(a.into())) + // Standard Error: 160_214 + .saturating_add(Weight::from_ref_time(36_066).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Proxy Proxies (r:1 w:0) + // Storage: Proxy Announcements (r:1 w:1) + // Storage: System Account (r:1 w:1) + /// The range of component `a` is `[0, 31]`. + /// The range of component `p` is `[1, 31]`. + fn announce(_a: u32, _p: u32, ) -> Weight { + // Minimum execution time: 54_160 nanoseconds. + Weight::from_ref_time(56_137_433) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Proxy Proxies (r:1 w:1) + /// The range of component `p` is `[1, 31]`. + fn add_proxy(_p: u32, ) -> Weight { + // Minimum execution time: 41_987 nanoseconds. + Weight::from_ref_time(49_705_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Proxy Proxies (r:1 w:1) + /// The range of component `p` is `[1, 31]`. + fn remove_proxy(_p: u32, ) -> Weight { + // Minimum execution time: 38_358 nanoseconds. + Weight::from_ref_time(79_591_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Proxy Proxies (r:1 w:1) + /// The range of component `p` is `[1, 31]`. + fn remove_proxies(_p: u32, ) -> Weight { + // Minimum execution time: 37_663 nanoseconds. + Weight::from_ref_time(39_280_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: unknown [0x3a65787472696e7369635f696e646578] (r:1 w:0) + // Storage: Proxy Proxies (r:1 w:1) + /// The range of component `p` is `[1, 31]`. + fn create_pure(_p: u32, ) -> Weight { + // Minimum execution time: 46_212 nanoseconds. + Weight::from_ref_time(48_010_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Proxy Proxies (r:1 w:1) + /// The range of component `p` is `[0, 30]`. + fn kill_pure(_p: u32, ) -> Weight { + // Minimum execution time: 41_054 nanoseconds. + Weight::from_ref_time(47_315_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } +} diff --git a/runtime/pangoro/src/weights/pallet_scheduler.rs b/runtime/pangoro/src/weights/pallet_scheduler.rs new file mode 100644 index 000000000..f55340342 --- /dev/null +++ b/runtime/pangoro/src/weights/pallet_scheduler.rs @@ -0,0 +1,140 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `pallet_scheduler` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-02-22, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("pangoro-local"), DB CACHE: 1024 + +// Executed Command: +// ./target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --steps +// 2 +// --repeat +// 1 +// --chain +// pangoro-local +// --output +// runtime/pangoro/src/weights/ +// --extrinsic +// * +// --pallet +// * + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_scheduler`. +pub struct WeightInfo(PhantomData); +impl pallet_scheduler::WeightInfo for WeightInfo { + // Storage: Scheduler IncompleteSince (r:1 w:1) + fn service_agendas_base() -> Weight { + // Minimum execution time: 14_274 nanoseconds. + Weight::from_ref_time(14_274_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Scheduler Agenda (r:1 w:1) + /// The range of component `s` is `[0, 50]`. + fn service_agenda_base(_s: u32, ) -> Weight { + // Minimum execution time: 12_926 nanoseconds. + Weight::from_ref_time(41_711_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + fn service_task_base() -> Weight { + // Minimum execution time: 23_943 nanoseconds. + Weight::from_ref_time(23_943_000) + } + // Storage: Preimage PreimageFor (r:1 w:1) + // Storage: Preimage StatusFor (r:1 w:1) + /// The range of component `s` is `[128, 4194304]`. + fn service_task_fetched(_s: u32, ) -> Weight { + // Minimum execution time: 41_084 nanoseconds. + Weight::from_ref_time(5_578_042_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Scheduler Lookup (r:0 w:1) + fn service_task_named() -> Weight { + // Minimum execution time: 31_583 nanoseconds. + Weight::from_ref_time(31_583_000) + .saturating_add(T::DbWeight::get().writes(1)) + } + fn service_task_periodic() -> Weight { + // Minimum execution time: 23_030 nanoseconds. + Weight::from_ref_time(23_030_000) + } + fn execute_dispatch_signed() -> Weight { + // Minimum execution time: 17_151 nanoseconds. + Weight::from_ref_time(17_151_000) + } + fn execute_dispatch_unsigned() -> Weight { + // Minimum execution time: 17_591 nanoseconds. + Weight::from_ref_time(17_591_000) + } + // Storage: Scheduler Agenda (r:1 w:1) + /// The range of component `s` is `[0, 49]`. + fn schedule(_s: u32, ) -> Weight { + // Minimum execution time: 38_870 nanoseconds. + Weight::from_ref_time(79_181_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Scheduler Agenda (r:1 w:1) + // Storage: Scheduler Lookup (r:0 w:1) + /// The range of component `s` is `[1, 50]`. + fn cancel(_s: u32, ) -> Weight { + // Minimum execution time: 38_291 nanoseconds. + Weight::from_ref_time(91_986_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Scheduler Lookup (r:1 w:1) + // Storage: Scheduler Agenda (r:1 w:1) + /// The range of component `s` is `[0, 49]`. + fn schedule_named(_s: u32, ) -> Weight { + // Minimum execution time: 43_614 nanoseconds. + Weight::from_ref_time(72_807_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Scheduler Lookup (r:1 w:1) + // Storage: Scheduler Agenda (r:1 w:1) + /// The range of component `s` is `[1, 50]`. + fn cancel_named(_s: u32, ) -> Weight { + // Minimum execution time: 42_952 nanoseconds. + Weight::from_ref_time(83_057_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } +} diff --git a/runtime/pangoro/src/weights/pallet_session.rs b/runtime/pangoro/src/weights/pallet_session.rs index 25b1d6d3e..5dbe3f05f 100644 --- a/runtime/pangoro/src/weights/pallet_session.rs +++ b/runtime/pangoro/src/weights/pallet_session.rs @@ -19,12 +19,12 @@ //! Autogenerated weights for `pallet_session` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2022-11-09, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! HOSTNAME: `inv.cafe`, CPU: `AMD Ryzen 9 5950X 16-Core Processor` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("local"), DB CACHE: 1024 +//! DATE: 2023-02-22, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("pangoro-local"), DB CACHE: 1024 // Executed Command: -// target/release/darwinia +// ./target/release/darwinia // benchmark // pallet // --header @@ -33,14 +33,18 @@ // wasm // --heap-pages // 4096 +// --steps +// 2 +// --repeat +// 1 // --chain -// local +// pangoro-local // --output -// runtime/src/weights +// runtime/pangoro/src/weights/ // --extrinsic // * // --pallet -// pallet-session +// * #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -55,15 +59,17 @@ impl pallet_session::WeightInfo for WeightInfo { // Storage: Session NextKeys (r:1 w:1) // Storage: Session KeyOwner (r:1 w:1) fn set_keys() -> Weight { - Weight::from_ref_time(30_781_000 as u64) - .saturating_add(T::DbWeight::get().reads(2 as u64)) - .saturating_add(T::DbWeight::get().writes(2 as u64)) + // Minimum execution time: 47_205 nanoseconds. + Weight::from_ref_time(47_205_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) } // Storage: Session NextKeys (r:1 w:1) // Storage: Session KeyOwner (r:0 w:1) fn purge_keys() -> Weight { - Weight::from_ref_time(22_911_000 as u64) - .saturating_add(T::DbWeight::get().reads(1 as u64)) - .saturating_add(T::DbWeight::get().writes(2 as u64)) + // Minimum execution time: 31_060 nanoseconds. + Weight::from_ref_time(31_060_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(2)) } } diff --git a/runtime/pangoro/src/weights/pallet_timestamp.rs b/runtime/pangoro/src/weights/pallet_timestamp.rs index 7f420bd5a..c6066591a 100644 --- a/runtime/pangoro/src/weights/pallet_timestamp.rs +++ b/runtime/pangoro/src/weights/pallet_timestamp.rs @@ -19,12 +19,12 @@ //! Autogenerated weights for `pallet_timestamp` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2022-11-09, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! HOSTNAME: `inv.cafe`, CPU: `AMD Ryzen 9 5950X 16-Core Processor` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("local"), DB CACHE: 1024 +//! DATE: 2023-02-22, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("pangoro-local"), DB CACHE: 1024 // Executed Command: -// target/release/darwinia +// ./target/release/darwinia // benchmark // pallet // --header @@ -33,14 +33,18 @@ // wasm // --heap-pages // 4096 +// --steps +// 2 +// --repeat +// 1 // --chain -// local +// pangoro-local // --output -// runtime/src/weights +// runtime/pangoro/src/weights/ // --extrinsic // * // --pallet -// pallet-timestamp +// * #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -53,12 +57,15 @@ use sp_std::marker::PhantomData; pub struct WeightInfo(PhantomData); impl pallet_timestamp::WeightInfo for WeightInfo { // Storage: Timestamp Now (r:1 w:1) + // Storage: Aura CurrentSlot (r:1 w:0) fn set() -> Weight { - Weight::from_ref_time(13_230_000 as u64) - .saturating_add(T::DbWeight::get().reads(1 as u64)) - .saturating_add(T::DbWeight::get().writes(1 as u64)) + // Minimum execution time: 26_019 nanoseconds. + Weight::from_ref_time(26_019_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) } fn on_finalize() -> Weight { - Weight::from_ref_time(5_710_000 as u64) + // Minimum execution time: 12_430 nanoseconds. + Weight::from_ref_time(12_430_000) } } diff --git a/runtime/pangoro/src/weights/pallet_tips.rs b/runtime/pangoro/src/weights/pallet_tips.rs new file mode 100644 index 000000000..e53172c85 --- /dev/null +++ b/runtime/pangoro/src/weights/pallet_tips.rs @@ -0,0 +1,120 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `pallet_tips` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-02-22, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("pangoro-local"), DB CACHE: 1024 + +// Executed Command: +// ./target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --steps +// 2 +// --repeat +// 1 +// --chain +// pangoro-local +// --output +// runtime/pangoro/src/weights/ +// --extrinsic +// * +// --pallet +// * + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_tips`. +pub struct WeightInfo(PhantomData); +impl pallet_tips::WeightInfo for WeightInfo { + // Storage: Tips Reasons (r:1 w:1) + // Storage: Tips Tips (r:1 w:1) + /// The range of component `r` is `[0, 16384]`. + fn report_awesome(_r: u32, ) -> Weight { + // Minimum execution time: 46_857 nanoseconds. + Weight::from_ref_time(70_025_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Tips Tips (r:1 w:1) + // Storage: Tips Reasons (r:0 w:1) + fn retract_tip() -> Weight { + // Minimum execution time: 55_255 nanoseconds. + Weight::from_ref_time(55_255_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: PhragmenElection Members (r:1 w:0) + // Storage: Tips Reasons (r:1 w:1) + // Storage: Tips Tips (r:0 w:1) + /// The range of component `r` is `[0, 16384]`. + /// The range of component `t` is `[1, 7]`. + fn tip_new(r: u32, t: u32, ) -> Weight { + // Minimum execution time: 40_286 nanoseconds. + Weight::from_ref_time(39_133_916) + // Standard Error: 173 + .saturating_add(Weight::from_ref_time(1_052).saturating_mul(r.into())) + // Standard Error: 474_437 + .saturating_add(Weight::from_ref_time(164_583).saturating_mul(t.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: PhragmenElection Members (r:1 w:0) + // Storage: Tips Tips (r:1 w:1) + /// The range of component `t` is `[1, 7]`. + fn tip(_t: u32, ) -> Weight { + // Minimum execution time: 25_656 nanoseconds. + Weight::from_ref_time(27_637_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Tips Tips (r:1 w:1) + // Storage: PhragmenElection Members (r:1 w:0) + // Storage: System Account (r:2 w:2) + // Storage: Tips Reasons (r:0 w:1) + /// The range of component `t` is `[1, 7]`. + fn close_tip(_t: u32, ) -> Weight { + // Minimum execution time: 59_909 nanoseconds. + Weight::from_ref_time(73_823_000) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(4)) + } + // Storage: Tips Tips (r:1 w:1) + // Storage: Tips Reasons (r:0 w:1) + /// The range of component `t` is `[1, 7]`. + fn slash_tip(_t: u32, ) -> Weight { + // Minimum execution time: 30_181 nanoseconds. + Weight::from_ref_time(32_038_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(2)) + } +} diff --git a/runtime/pangoro/src/weights/pallet_treasury.rs b/runtime/pangoro/src/weights/pallet_treasury.rs new file mode 100644 index 000000000..708518b58 --- /dev/null +++ b/runtime/pangoro/src/weights/pallet_treasury.rs @@ -0,0 +1,107 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `pallet_treasury` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-02-22, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("pangoro-local"), DB CACHE: 1024 + +// Executed Command: +// ./target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --steps +// 2 +// --repeat +// 1 +// --chain +// pangoro-local +// --output +// runtime/pangoro/src/weights/ +// --extrinsic +// * +// --pallet +// * + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_treasury`. +pub struct WeightInfo(PhantomData); +impl pallet_treasury::WeightInfo for WeightInfo { + fn spend() -> Weight { + // Minimum execution time: 4_390 nanoseconds. + Weight::from_ref_time(4_390_000) + } + // Storage: Treasury ProposalCount (r:1 w:1) + // Storage: Treasury Proposals (r:0 w:1) + fn propose_spend() -> Weight { + // Minimum execution time: 42_256 nanoseconds. + Weight::from_ref_time(42_256_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Treasury Proposals (r:1 w:1) + // Storage: System Account (r:2 w:2) + fn reject_proposal() -> Weight { + // Minimum execution time: 58_063 nanoseconds. + Weight::from_ref_time(58_063_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: Treasury Proposals (r:1 w:0) + // Storage: Treasury Approvals (r:1 w:1) + /// The range of component `p` is `[0, 99]`. + fn approve_proposal(_p: u32, ) -> Weight { + // Minimum execution time: 26_830 nanoseconds. + Weight::from_ref_time(42_323_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Treasury Approvals (r:1 w:1) + fn remove_approval() -> Weight { + // Minimum execution time: 19_005 nanoseconds. + Weight::from_ref_time(19_005_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: System Account (r:1 w:1) + // Storage: Treasury Deactivated (r:1 w:1) + // Storage: Balances InactiveIssuance (r:1 w:1) + // Storage: Treasury Approvals (r:1 w:1) + // Storage: Treasury Proposals (r:100 w:0) + /// The range of component `p` is `[0, 100]`. + fn on_initialize_proposals(_p: u32, ) -> Weight { + // Minimum execution time: 243_043 nanoseconds. + Weight::from_ref_time(306_404_000) + .saturating_add(T::DbWeight::get().reads(104)) + .saturating_add(T::DbWeight::get().writes(4)) + } +} diff --git a/runtime/pangoro/src/weights/pallet_utility.rs b/runtime/pangoro/src/weights/pallet_utility.rs new file mode 100644 index 000000000..c2a09a2e4 --- /dev/null +++ b/runtime/pangoro/src/weights/pallet_utility.rs @@ -0,0 +1,82 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `pallet_utility` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-02-22, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("pangoro-local"), DB CACHE: 1024 + +// Executed Command: +// ./target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --steps +// 2 +// --repeat +// 1 +// --chain +// pangoro-local +// --output +// runtime/pangoro/src/weights/ +// --extrinsic +// * +// --pallet +// * + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_utility`. +pub struct WeightInfo(PhantomData); +impl pallet_utility::WeightInfo for WeightInfo { + /// The range of component `c` is `[0, 1000]`. + fn batch(_c: u32, ) -> Weight { + // Minimum execution time: 31_701 nanoseconds. + Weight::from_ref_time(3_805_606_000) + } + fn as_derivative() -> Weight { + // Minimum execution time: 17_610 nanoseconds. + Weight::from_ref_time(17_610_000) + } + /// The range of component `c` is `[0, 1000]`. + fn batch_all(_c: u32, ) -> Weight { + // Minimum execution time: 23_413 nanoseconds. + Weight::from_ref_time(4_005_491_000) + } + fn dispatch_as() -> Weight { + // Minimum execution time: 25_153 nanoseconds. + Weight::from_ref_time(25_153_000) + } + /// The range of component `c` is `[0, 1000]`. + fn force_batch(_c: u32, ) -> Weight { + // Minimum execution time: 21_204 nanoseconds. + Weight::from_ref_time(5_469_697_000) + } +} diff --git a/runtime/pangoro/src/weights/pallet_vesting.rs b/runtime/pangoro/src/weights/pallet_vesting.rs new file mode 100644 index 000000000..1ee783bbd --- /dev/null +++ b/runtime/pangoro/src/weights/pallet_vesting.rs @@ -0,0 +1,161 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `pallet_vesting` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-02-22, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("pangoro-local"), DB CACHE: 1024 + +// Executed Command: +// ./target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --steps +// 2 +// --repeat +// 1 +// --chain +// pangoro-local +// --output +// runtime/pangoro/src/weights/ +// --extrinsic +// * +// --pallet +// * + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_vesting`. +pub struct WeightInfo(PhantomData); +impl pallet_vesting::WeightInfo for WeightInfo { + // Storage: Vesting Vesting (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + /// The range of component `l` is `[0, 49]`. + /// The range of component `s` is `[1, 28]`. + fn vest_locked(l: u32, _s: u32, ) -> Weight { + // Minimum execution time: 41_185 nanoseconds. + Weight::from_ref_time(41_516_851) + // Standard Error: 49_133 + .saturating_add(Weight::from_ref_time(29_979).saturating_mul(l.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Vesting Vesting (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + /// The range of component `l` is `[0, 49]`. + /// The range of component `s` is `[1, 28]`. + fn vest_unlocked(_l: u32, s: u32, ) -> Weight { + // Minimum execution time: 40_879 nanoseconds. + Weight::from_ref_time(52_804_666) + // Standard Error: 21_394 + .saturating_add(Weight::from_ref_time(79_833).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Vesting Vesting (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + // Storage: System Account (r:1 w:1) + /// The range of component `l` is `[0, 49]`. + /// The range of component `s` is `[1, 28]`. + fn vest_other_locked(_l: u32, s: u32, ) -> Weight { + // Minimum execution time: 41_050 nanoseconds. + Weight::from_ref_time(44_562_185) + // Standard Error: 23_927 + .saturating_add(Weight::from_ref_time(58_814).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: Vesting Vesting (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + // Storage: System Account (r:1 w:1) + /// The range of component `l` is `[0, 49]`. + /// The range of component `s` is `[1, 28]`. + fn vest_other_unlocked(_l: u32, s: u32, ) -> Weight { + // Minimum execution time: 39_969 nanoseconds. + Weight::from_ref_time(40_893_185) + // Standard Error: 64_214 + .saturating_add(Weight::from_ref_time(71_814).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: Vesting Vesting (r:1 w:1) + // Storage: System Account (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + /// The range of component `l` is `[0, 49]`. + /// The range of component `s` is `[0, 27]`. + fn vested_transfer(l: u32, _s: u32, ) -> Weight { + // Minimum execution time: 52_346 nanoseconds. + Weight::from_ref_time(56_674_500) + // Standard Error: 158_588 + .saturating_add(Weight::from_ref_time(150_989).saturating_mul(l.into())) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: Vesting Vesting (r:1 w:1) + // Storage: System Account (r:2 w:2) + // Storage: Balances Locks (r:1 w:1) + /// The range of component `l` is `[0, 49]`. + /// The range of component `s` is `[0, 27]`. + fn force_vested_transfer(_l: u32, s: u32, ) -> Weight { + // Minimum execution time: 60_716 nanoseconds. + Weight::from_ref_time(61_574_000) + // Standard Error: 116_239 + .saturating_add(Weight::from_ref_time(98_444).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(4)) + } + // Storage: Vesting Vesting (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + // Storage: System Account (r:1 w:1) + /// The range of component `l` is `[0, 49]`. + /// The range of component `s` is `[2, 28]`. + fn not_unlocking_merge_schedules(l: u32, _s: u32, ) -> Weight { + // Minimum execution time: 42_657 nanoseconds. + Weight::from_ref_time(45_116_153) + // Standard Error: 127_553 + .saturating_add(Weight::from_ref_time(47_071).saturating_mul(l.into())) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: Vesting Vesting (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + // Storage: System Account (r:1 w:1) + /// The range of component `l` is `[0, 49]`. + /// The range of component `s` is `[2, 28]`. + fn unlocking_merge_schedules(l: u32, _s: u32, ) -> Weight { + // Minimum execution time: 39_674 nanoseconds. + Weight::from_ref_time(41_725_000) + // Standard Error: 27_836 + .saturating_add(Weight::from_ref_time(58_438).saturating_mul(l.into())) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } +} From f81ccd376ea9770e68bedec2ffa80a8e0d91cdcc Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Wed, 22 Feb 2023 21:12:44 +0800 Subject: [PATCH 155/189] Add benchmarking items and bench darwinia-deposit (#294) * Add benchmarking items and bench darwinia-deposit * Format * Doc * Fix and update CI * Re-cache * Opt * Opt * Correct URI --------- Signed-off-by: Xavier Lau --- .github/shrink-cache.sh | 6 + .github/workflows/checks.yml | 13 +- .github/workflows/staging.yml | 2 +- .maintain/pallet-weight-template.hbs | 123 +++++++ Cargo.lock | 331 ++++++++++-------- pallet/account-migration/Cargo.toml | 5 +- pallet/account-migration/tests/mock.rs | 14 +- pallet/deposit/Cargo.toml | 34 +- pallet/deposit/src/benchmarking.rs | 119 +++++++ pallet/deposit/src/lib.rs | 33 +- pallet/deposit/{tests => src}/mock.rs | 11 +- pallet/deposit/{tests => src}/tests.rs | 11 +- pallet/deposit/src/weights.rs | 178 +++++++++- pallet/staking/tests/mock.rs | 6 +- precompile/deposit/src/mock.rs | 6 +- precompile/staking/src/mock.rs | 6 +- runtime/crab/Cargo.toml | 1 + runtime/crab/src/lib.rs | 10 +- .../crab/src/{pallets/mod.rs => pallets.rs} | 0 runtime/crab/src/pallets/deposit.rs | 2 +- runtime/crab/src/pallets/timestamp.rs | 3 + .../crab/src/{weights/mod.rs => weights.rs} | 1 + runtime/crab/src/weights/darwinia_deposit.rs | 107 ++++++ runtime/darwinia/Cargo.toml | 1 + runtime/darwinia/src/lib.rs | 10 +- .../src/{pallets/mod.rs => pallets.rs} | 0 runtime/darwinia/src/pallets/deposit.rs | 2 +- runtime/darwinia/src/pallets/timestamp.rs | 3 + .../src/{weights/mod.rs => weights.rs} | 1 + .../darwinia/src/weights/darwinia_deposit.rs | 107 ++++++ runtime/pangolin/Cargo.toml | 2 +- runtime/pangolin/src/lib.rs | 10 +- .../src/{pallets/mod.rs => pallets.rs} | 0 runtime/pangolin/src/pallets/deposit.rs | 2 +- runtime/pangolin/src/pallets/timestamp.rs | 3 + .../src/{weights/mod.rs => weights.rs} | 1 + .../pangolin/src/weights/darwinia_deposit.rs | 107 ++++++ runtime/pangoro/Cargo.toml | 1 + runtime/pangoro/src/lib.rs | 10 +- .../src/{pallets/mod.rs => pallets.rs} | 0 runtime/pangoro/src/pallets/deposit.rs | 2 +- runtime/pangoro/src/pallets/timestamp.rs | 3 + .../src/{weights/mod.rs => weights.rs} | 1 + .../pangoro/src/weights/darwinia_deposit.rs | 107 ++++++ 44 files changed, 1173 insertions(+), 222 deletions(-) create mode 100644 .maintain/pallet-weight-template.hbs create mode 100644 pallet/deposit/src/benchmarking.rs rename pallet/deposit/{tests => src}/mock.rs (96%) rename pallet/deposit/{tests => src}/tests.rs (98%) rename runtime/crab/src/{pallets/mod.rs => pallets.rs} (100%) rename runtime/crab/src/{weights/mod.rs => weights.rs} (98%) create mode 100644 runtime/crab/src/weights/darwinia_deposit.rs rename runtime/darwinia/src/{pallets/mod.rs => pallets.rs} (100%) rename runtime/darwinia/src/{weights/mod.rs => weights.rs} (98%) create mode 100644 runtime/darwinia/src/weights/darwinia_deposit.rs rename runtime/pangolin/src/{pallets/mod.rs => pallets.rs} (100%) rename runtime/pangolin/src/{weights/mod.rs => weights.rs} (98%) create mode 100644 runtime/pangolin/src/weights/darwinia_deposit.rs rename runtime/pangoro/src/{pallets/mod.rs => pallets.rs} (100%) rename runtime/pangoro/src/{weights/mod.rs => weights.rs} (98%) create mode 100644 runtime/pangoro/src/weights/darwinia_deposit.rs diff --git a/.github/shrink-cache.sh b/.github/shrink-cache.sh index 900207ad3..59858459a 100755 --- a/.github/shrink-cache.sh +++ b/.github/shrink-cache.sh @@ -1,9 +1,15 @@ #!/bin/sh cargo clean --release -p darwinia 2> /dev/null || true +cargo clean --release -p crab-runtime 2> /dev/null || true cargo clean --release -p darwinia-runtime 2> /dev/null || true +cargo clean --release -p pangolin-runtime 2> /dev/null || true +cargo clean --release -p pangoro-runtime 2> /dev/null || true rm -rf target/release/wbuild 2> /dev/null || true cargo clean -p darwinia 2> /dev/null || true +cargo clean -p crab-runtime 2> /dev/null || true cargo clean -p darwinia-runtime 2> /dev/null || true +cargo clean -p pangolin-runtime 2> /dev/null || true +cargo clean -p pangoro-runtime 2> /dev/null || true rm -rf target/debug/wbuild 2> /dev/null || true diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index e1e31e960..021438e9b 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -22,7 +22,7 @@ on: - "**.yml" env: - GITHUB_CACHE_VERSION: 0 + GITHUB_CACHE_VERSION: 1 RUST_BACKTRACE: full RUSTC_WRAPPER: sccache @@ -66,7 +66,11 @@ jobs: key: sccache-${{ matrix.action }}-${{ env.GITHUB_CACHE_VERSION }}-${{ hashFiles('**/Cargo.lock') }} restore-keys: sccache-${{ matrix.action }}-${{ env.GITHUB_CACHE_VERSION }}- - name: Action ${{ matrix.action }} - run: cargo ${{ matrix.action }} --release --locked --features all-natives + if: matrix.action != 'test' + run: cargo ${{ matrix.action }} --release --locked -p darwinia --all-features + - name: Action ${{ matrix.action }} + if: matrix.action == 'test' + run: SKIP_WASM_BUILD=1 cargo ${{ matrix.action }} --release --locked --features all-natives - name: Change path if: matrix.action != 'test' run: mv target/release/darwinia . @@ -101,7 +105,10 @@ jobs: [ { chain: darwinia-dev, compare-with: "https://rpc.polkadot.io" }, { chain: crab-dev, compare-with: "https://rpc.polkadot.io" }, - { chain: pangolin-dev, compare-with: "https://pangolin-rpc.darwinia.netowrk" }, + { + chain: pangolin-dev, + compare-with: "https://pangolin-rpc.darwinia.network", + }, ] needs: [basic-checks] runs-on: ubuntu-latest diff --git a/.github/workflows/staging.yml b/.github/workflows/staging.yml index 7c3e9cd29..4543b1b46 100644 --- a/.github/workflows/staging.yml +++ b/.github/workflows/staging.yml @@ -32,7 +32,7 @@ jobs: toolchain: nightly - name: Build - run: cargo build --release --locked --features all-natives + run: cargo build --release --locked -p darwinia --features all-natives - name: Collect shared run: | diff --git a/.maintain/pallet-weight-template.hbs b/.maintain/pallet-weight-template.hbs new file mode 100644 index 000000000..a0a51891f --- /dev/null +++ b/.maintain/pallet-weight-template.hbs @@ -0,0 +1,123 @@ +{{header}} +//! Autogenerated weights for {{pallet}} +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION {{version}} +//! DATE: {{date}}, STEPS: `{{cmd.steps}}`, REPEAT: `{{cmd.repeat}}`, LOW RANGE: `{{cmd.lowest_range_values}}`, HIGH RANGE: `{{cmd.highest_range_values}}` +//! WORST CASE MAP SIZE: `{{cmd.worst_case_map_values}}` +//! HOSTNAME: `{{hostname}}`, CPU: `{{cpuname}}` +//! EXECUTION: {{cmd.execution}}, WASM-EXECUTION: {{cmd.wasm_execution}}, CHAIN: {{cmd.chain}}, DB CACHE: {{cmd.db_cache}} + +// Executed Command: +{{#each args as |arg|}} +// {{arg}} +{{/each}} + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(missing_docs)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use sp_std::marker::PhantomData; + +/// Weight functions needed for {{pallet}}. +pub trait WeightInfo { + {{#each benchmarks as |benchmark|}} + fn {{benchmark.name~}} + ( + {{~#each benchmark.components as |c| ~}} + {{c.name}}: u32, {{/each~}} + ) -> Weight; + {{/each}} +} + +/// Weights for {{pallet}} using the Substrate node and recommended hardware. +pub struct SubstrateWeight(PhantomData); +{{#if (eq pallet "frame_system")}} +impl WeightInfo for SubstrateWeight { +{{else}} +impl WeightInfo for SubstrateWeight { +{{/if}} + {{#each benchmarks as |benchmark|}} + {{#each benchmark.comments as |comment|}} + /// {{comment}} + {{/each}} + {{#each benchmark.component_ranges as |range|}} + /// The range of component `{{range.name}}` is `[{{range.min}}, {{range.max}}]`. + {{/each}} + fn {{benchmark.name~}} + ( + {{~#each benchmark.components as |c| ~}} + {{~#if (not c.is_used)}}_{{/if}}{{c.name}}: u32, {{/each~}} + ) -> Weight { + // Proof Size summary in bytes: + // Measured: `{{benchmark.base_recorded_proof_size}}{{#each benchmark.component_recorded_proof_size as |cp|}} + {{cp.name}} * ({{cp.slope}} ±{{underscore cp.error}}){{/each}}` + // Estimated: `{{benchmark.base_calculated_proof_size}}{{#each benchmark.component_calculated_proof_size as |cp|}} + {{cp.name}} * ({{cp.slope}} ±{{underscore cp.error}}){{/each}}` + // Minimum execution time: {{underscore benchmark.min_execution_time}} nanoseconds. + Weight::from_ref_time({{underscore benchmark.base_weight}}) + .saturating_add(Weight::from_proof_size({{benchmark.base_calculated_proof_size}})) + {{#each benchmark.component_weight as |cw|}} + // Standard Error: {{underscore cw.error}} + .saturating_add(Weight::from_ref_time({{underscore cw.slope}}).saturating_mul({{cw.name}}.into())) + {{/each}} + {{#if (ne benchmark.base_reads "0")}} + .saturating_add(T::DbWeight::get().reads({{benchmark.base_reads}}_u64)) + {{/if}} + {{#each benchmark.component_reads as |cr|}} + .saturating_add(T::DbWeight::get().reads(({{cr.slope}}_u64).saturating_mul({{cr.name}}.into()))) + {{/each}} + {{#if (ne benchmark.base_writes "0")}} + .saturating_add(T::DbWeight::get().writes({{benchmark.base_writes}}_u64)) + {{/if}} + {{#each benchmark.component_writes as |cw|}} + .saturating_add(T::DbWeight::get().writes(({{cw.slope}}_u64).saturating_mul({{cw.name}}.into()))) + {{/each}} + {{#each benchmark.component_calculated_proof_size as |cp|}} + .saturating_add(Weight::from_proof_size({{cp.slope}}).saturating_mul({{cp.name}}.into())) + {{/each}} + } + {{/each}} +} + +// For backwards compatibility and tests +impl WeightInfo for () { + {{#each benchmarks as |benchmark|}} + {{#each benchmark.comments as |comment|}} + /// {{comment}} + {{/each}} + {{#each benchmark.component_ranges as |range|}} + /// The range of component `{{range.name}}` is `[{{range.min}}, {{range.max}}]`. + {{/each}} + fn {{benchmark.name~}} + ( + {{~#each benchmark.components as |c| ~}} + {{~#if (not c.is_used)}}_{{/if}}{{c.name}}: u32, {{/each~}} + ) -> Weight { + // Proof Size summary in bytes: + // Measured: `{{benchmark.base_recorded_proof_size}}{{#each benchmark.component_recorded_proof_size as |cp|}} + {{cp.name}} * ({{cp.slope}} ±{{underscore cp.error}}){{/each}}` + // Estimated: `{{benchmark.base_calculated_proof_size}}{{#each benchmark.component_calculated_proof_size as |cp|}} + {{cp.name}} * ({{cp.slope}} ±{{underscore cp.error}}){{/each}}` + // Minimum execution time: {{underscore benchmark.min_execution_time}} nanoseconds. + Weight::from_ref_time({{underscore benchmark.base_weight}}) + .saturating_add(Weight::from_proof_size({{benchmark.base_calculated_proof_size}})) + {{#each benchmark.component_weight as |cw|}} + // Standard Error: {{underscore cw.error}} + .saturating_add(Weight::from_ref_time({{underscore cw.slope}}).saturating_mul({{cw.name}}.into())) + {{/each}} + {{#if (ne benchmark.base_reads "0")}} + .saturating_add(RocksDbWeight::get().reads({{benchmark.base_reads}}_u64)) + {{/if}} + {{#each benchmark.component_reads as |cr|}} + .saturating_add(RocksDbWeight::get().reads(({{cr.slope}}_u64).saturating_mul({{cr.name}}.into()))) + {{/each}} + {{#if (ne benchmark.base_writes "0")}} + .saturating_add(RocksDbWeight::get().writes({{benchmark.base_writes}}_u64)) + {{/if}} + {{#each benchmark.component_writes as |cw|}} + .saturating_add(RocksDbWeight::get().writes(({{cw.slope}}_u64).saturating_mul({{cw.name}}.into()))) + {{/each}} + {{#each benchmark.component_calculated_proof_size as |cp|}} + .saturating_add(Weight::from_proof_size({{cp.slope}}).saturating_mul({{cp.name}}.into())) + {{/each}} + } + {{/each}} +} diff --git a/Cargo.lock b/Cargo.lock index b8c69f089..4fec3ca1a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -48,7 +48,7 @@ version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a76fd60b23679b7d19bd066031410fb7e458ccc5e958eb5c325888ce4baedc97" dependencies = [ - "gimli 0.27.1", + "gimli 0.27.2", ] [[package]] @@ -219,9 +219,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.68" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2cb2f989d18dd141ab8ae82f64d1a8cdd37e0840f73a406896cf5e99502fab61" +checksum = "224afbd727c3d6e4b90103ece64b8d1b67fbb1973b1046c2281eed3f3803f800" [[package]] name = "approx" @@ -290,7 +290,7 @@ dependencies = [ "num-traits", "rusticata-macros", "thiserror", - "time 0.3.17", + "time 0.3.19", ] [[package]] @@ -306,7 +306,7 @@ dependencies = [ "num-traits", "rusticata-macros", "thiserror", - "time 0.3.17", + "time 0.3.19", ] [[package]] @@ -579,9 +579,9 @@ dependencies = [ [[package]] name = "bindgen" -version = "0.60.1" +version = "0.64.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "062dddbc1ba4aca46de6338e2bf87771414c335f7b2f2036e8f3e9befebf88e6" +checksum = "c4243e6031260db77ede97ad86c27e501d646a27ab57b59a574f725d98ab1fb4" dependencies = [ "bitflags", "cexpr", @@ -594,6 +594,7 @@ dependencies = [ "regex", "rustc-hash", "shlex", + "syn", ] [[package]] @@ -635,24 +636,24 @@ dependencies = [ [[package]] name = "blake2b_simd" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72936ee4afc7f8f736d1c38383b56480b5497b4617b4a77bdbf1d2ababc76127" +checksum = "3c2f0dc9a68c6317d884f97cc36cf5a3d20ba14ce404227df55e1af708ab04bc" dependencies = [ "arrayref", "arrayvec 0.7.2", - "constant_time_eq 0.1.5", + "constant_time_eq 0.2.4", ] [[package]] name = "blake2s_simd" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db539cc2b5f6003621f1cd9ef92d7ded8ea5232c7de0f9faa2de251cd98730d4" +checksum = "6637f448b9e61dfadbdcbae9a885fadee1f3eaffb1f8d3c1965d3ade8bdfd44f" dependencies = [ "arrayref", "arrayvec 0.7.2", - "constant_time_eq 0.1.5", + "constant_time_eq 0.2.4", ] [[package]] @@ -918,9 +919,9 @@ dependencies = [ [[package]] name = "bstr" -version = "1.1.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b45ea9b00a7b3f2988e9a65ad3917e62123c38dba709b666506207be96d1790b" +checksum = "5ffdb39cb703212f3c11973452c2861b972f757b021158f3516ba10f2fa8b2c1" dependencies = [ "memchr", "serde", @@ -961,9 +962,9 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "bytes" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfb24e866b15a1af2a1b663f10c6b6b8f397a84aadb828f12e5b289ec23a3a3c" +checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" [[package]] name = "bzip2-sys" @@ -978,9 +979,9 @@ dependencies = [ [[package]] name = "camino" -version = "1.1.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c77df041dc383319cc661b428b6961a005db4d6808d5e12536931b1ca9556055" +checksum = "6031a462f977dd38968b6f23378356512feeace69cef817e1a4475108093cec3" dependencies = [ "serde", ] @@ -1145,9 +1146,9 @@ dependencies = [ [[package]] name = "clang-sys" -version = "1.4.0" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa2e27ae6ab525c3d369ded447057bca5438d86dc3a68f6faafb8269ba82ebf3" +checksum = "77ed9a53e5d4d9c573ae844bfac6872b159cb1d1585a83b29e7a64b7eef7332a" dependencies = [ "glob", "libc", @@ -1156,9 +1157,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.1.4" +version = "4.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f13b9c79b5d1dd500d20ef541215a6423c75829ef43117e1b4d17fd8af0b5d76" +checksum = "ec0b0588d44d4d63a87dbd75c136c166bbfd9a86a31cb89e09906521c7d3f5e3" dependencies = [ "bitflags", "clap_derive", @@ -2195,9 +2196,9 @@ dependencies = [ [[package]] name = "curve25519-dalek" -version = "4.0.0-pre.5" +version = "4.0.0-rc.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67bc65846be335cb20f4e52d49a437b773a2c1fdb42b19fc84e79e6f6771536f" +checksum = "8da00a7a9a4eb92a0a0f8e75660926d48f0d0f3c537e455c457bcdaa1e16b1ac" dependencies = [ "cfg-if", "fiat-crypto", @@ -2209,9 +2210,9 @@ dependencies = [ [[package]] name = "cxx" -version = "1.0.88" +version = "1.0.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "322296e2f2e5af4270b54df9e85a02ff037e271af20ba3e7fe1575515dc840b8" +checksum = "86d3488e7665a7a483b57e25bdd90d0aeb2bc7608c8d0346acf2ad3f1caf1d62" dependencies = [ "cc", "cxxbridge-flags", @@ -2221,9 +2222,9 @@ dependencies = [ [[package]] name = "cxx-build" -version = "1.0.88" +version = "1.0.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "017a1385b05d631e7875b1f151c9f012d37b53491e2a87f65bff5c262b2111d8" +checksum = "48fcaf066a053a41a81dfb14d57d99738b767febb8b735c3016e469fac5da690" dependencies = [ "cc", "codespan-reporting", @@ -2236,15 +2237,15 @@ dependencies = [ [[package]] name = "cxxbridge-flags" -version = "1.0.88" +version = "1.0.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c26bbb078acf09bc1ecda02d4223f03bdd28bd4874edcb0379138efc499ce971" +checksum = "a2ef98b8b717a829ca5603af80e1f9e2e48013ab227b68ef37872ef84ee479bf" [[package]] name = "cxxbridge-macro" -version = "1.0.88" +version = "1.0.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "357f40d1f06a24b60ae1fe122542c1fb05d28d32acb2aed064e84bc2ad1e252e" +checksum = "086c685979a698443656e5cf7856c95c642295a38599f12fb1ff76fb28d19892" dependencies = [ "proc-macro2", "quote", @@ -2381,6 +2382,7 @@ dependencies = [ "pallet-assets", "pallet-balances", "pallet-identity", + "pallet-timestamp", "pallet-vesting", "parity-scale-codec", "scale-info", @@ -2425,6 +2427,7 @@ dependencies = [ "darwinia-staking", "dc-inflation", "dc-types", + "frame-benchmarking", "frame-support", "frame-system", "pallet-assets", @@ -3407,9 +3410,9 @@ checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" [[package]] name = "fastrand" -version = "1.8.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7a407cfaa3385c4ae6b23e84623d48c2798d06e3e6a1878f7f59f17b3f86499" +checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be" dependencies = [ "instant", ] @@ -3604,14 +3607,14 @@ dependencies = [ [[package]] name = "filetime" -version = "0.2.19" +version = "0.2.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e884668cd0c7480504233e951174ddc3b382f7c2666e3b7310b5c4e7b0c37f9" +checksum = "8a3de6e8d11b22ff9edc6d916f890800597d60f8b2da1caf2955c274638d6412" dependencies = [ "cfg-if", "libc", "redox_syscall", - "windows-sys 0.42.0", + "windows-sys 0.45.0", ] [[package]] @@ -4069,12 +4072,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "fs_extra" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2022715d62ab30faffd124d40b76f4134a550a87792276512b18d63272333394" - [[package]] name = "funty" version = "2.0.0" @@ -4296,9 +4293,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.27.1" +version = "0.27.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "221996f774192f0f718773def8201c4ae31f02616a54ccfc2d358bb0e5cefdec" +checksum = "ad0a93d233ebf96623465aad4046a8d3aa4da22d4f4beba5388838c8a434bbb4" [[package]] name = "glob" @@ -4313,7 +4310,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "029d74589adefde59de1a0c4f4732695c32805624aec7b68d91503d4dba79afc" dependencies = [ "aho-corasick", - "bstr 1.1.0", + "bstr 1.3.0", "fnv", "log", "regex", @@ -4395,9 +4392,9 @@ checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" [[package]] name = "heck" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] name = "hermit-abi" @@ -4417,6 +4414,12 @@ dependencies = [ "libc", ] +[[package]] +name = "hermit-abi" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286" + [[package]] name = "hex" version = "0.4.3" @@ -4501,9 +4504,9 @@ dependencies = [ [[package]] name = "http" -version = "0.2.8" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75f43d41e26995c17e71ee126451dd3941010b0514a81a9d11f3b341debc2399" +checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" dependencies = [ "bytes", "fnv", @@ -4556,9 +4559,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "hyper" -version = "0.14.23" +version = "0.14.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "034711faac9d2166cb1baf1a2fb0b60b1f277f8492fd72176c17f3515e1abd3c" +checksum = "5e011372fa0b68db8350aa7a248930ecc7839bf46d8485577d69f117a75f164c" dependencies = [ "bytes", "futures-channel", @@ -4782,12 +4785,12 @@ checksum = "59ce5ef949d49ee85593fc4d3f3f95ad61657076395cbbce23e2121fc5542074" [[package]] name = "io-lifetimes" -version = "1.0.4" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7d6c6f8c91b4b9ed43484ad1a938e393caf35960fce7f82a040497207bd8e9e" +checksum = "1abeb7a0dd0f8181267ff8adc397075586500b81b28a73e8a0208b00fc170fb3" dependencies = [ "libc", - "windows-sys 0.42.0", + "windows-sys 0.45.0", ] [[package]] @@ -4816,14 +4819,14 @@ checksum = "30e22bd8629359895450b59ea7a776c850561b96a3b1d31321c1949d9e6c9146" [[package]] name = "is-terminal" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28dfb6c8100ccc63462345b67d1bbc3679177c75ee4bf59bf29c8b1d110b8189" +checksum = "22e18b0a45d56fe973d6db23972bf5bc46f988a4a2385deac9cc29572f09daef" dependencies = [ - "hermit-abi 0.2.6", - "io-lifetimes 1.0.4", - "rustix 0.36.7", - "windows-sys 0.42.0", + "hermit-abi 0.3.1", + "io-lifetimes 1.0.5", + "rustix 0.36.8", + "windows-sys 0.45.0", ] [[package]] @@ -4852,9 +4855,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.60" +version = "0.3.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49409df3e3bf0856b916e2ceaca09ee28e6871cf7d9ce97a692cacfdb2a25a47" +checksum = "445dde2150c55e483f3d8416706b97ec8e8237c307e5b7b4b8dd15e6af2a0730" dependencies = [ "wasm-bindgen", ] @@ -5599,9 +5602,9 @@ dependencies = [ [[package]] name = "librocksdb-sys" -version = "0.8.0+7.4.4" +version = "0.8.3+7.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "611804e4666a25136fcc5f8cf425ab4d26c7f74ea245ffe92ea23b85b6420b5d" +checksum = "557b255ff04123fcc176162f56ed0c9cd42d8f357cf55b3fabeb60f7413741b3" dependencies = [ "bindgen", "bzip2-sys", @@ -5834,14 +5837,14 @@ version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b20a59d985586e4a5aef64564ac77299f8586d8be6cf9106a5a40207e8908efb" dependencies = [ - "rustix 0.36.7", + "rustix 0.36.8", ] [[package]] name = "memmap2" -version = "0.5.8" +version = "0.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b182332558b18d807c4ce1ca8ca983b34c3ee32765e47b3f0f69b90355cc1dc" +checksum = "2af2c65375e552a67fe3829ca63e8a7c27a378a62824594f43b2851d682b5ec2" dependencies = [ "libc", ] @@ -5930,14 +5933,14 @@ dependencies = [ [[package]] name = "mio" -version = "0.8.5" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5d732bc30207a6423068df043e3d02e0735b155ad7ce1a6f76fe2baa5b158de" +checksum = "5b9d9a46eff5b4ff64b45a9e316a6d1e0bc719ef429cbec4dc630684212bfdf9" dependencies = [ "libc", "log", "wasi 0.11.0+wasi-snapshot-preview1", - "windows-sys 0.42.0", + "windows-sys 0.45.0", ] [[package]] @@ -6340,18 +6343,18 @@ dependencies = [ [[package]] name = "num_enum" -version = "0.5.9" +version = "0.5.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d829733185c1ca374f17e52b762f24f535ec625d2cc1f070e34c8a9068f341b" +checksum = "3e0072973714303aa6e3631c7e8e777970cf4bdd25dc4932e41031027b8bcc4e" dependencies = [ "num_enum_derive", ] [[package]] name = "num_enum_derive" -version = "0.5.9" +version = "0.5.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2be1598bf1c313dcdd12092e3f1920f463462525a21b7b4e11b4168353d0123e" +checksum = "0629cbd6b897944899b1f10496d9c4a7ac5878d45fd61bc22e9e79bfbbc29597" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -6400,9 +6403,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.0" +version = "1.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66" +checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" [[package]] name = "opaque-debug" @@ -7921,9 +7924,9 @@ dependencies = [ [[package]] name = "parity-scale-codec" -version = "3.3.0" +version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3840933452adf7b3b9145e27086a5a3376c619dca1a21b1e5a5af0d54979bed" +checksum = "637935964ff85a605d114591d4d2c13c5d1ba2806dae97cea6bf180238a749ac" dependencies = [ "arrayvec 0.7.2", "bitvec", @@ -7982,7 +7985,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" dependencies = [ "lock_api", - "parking_lot_core 0.9.6", + "parking_lot_core 0.9.7", ] [[package]] @@ -8001,15 +8004,15 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.6" +version = "0.9.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba1ef8814b5c993410bb3adfad7a5ed269563e4a2f90c41f5d85be7fb47133bf" +checksum = "9069cbb9f99e3a5083476ccb29ceb1de18b9118cafa53e90c9551235de2b9521" dependencies = [ "cfg-if", "libc", "redox_syscall", "smallvec", - "windows-sys 0.42.0", + "windows-sys 0.45.0", ] [[package]] @@ -8068,9 +8071,9 @@ checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" [[package]] name = "pest" -version = "2.5.4" +version = "2.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ab62d2fa33726dbe6321cc97ef96d8cde531e3eeaf858a058de53a8a6d40d8f" +checksum = "028accff104c4e513bad663bbcd2ad7cfd5304144404c31ed0a77ac103d00660" dependencies = [ "thiserror", "ucd-trie", @@ -8078,9 +8081,9 @@ dependencies = [ [[package]] name = "pest_derive" -version = "2.5.4" +version = "2.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bf026e2d0581559db66d837fe5242320f525d85c76283c61f4d51a1238d65ea" +checksum = "2ac3922aac69a40733080f53c1ce7f91dcf57e1a5f6c52f421fadec7fbdc4b69" dependencies = [ "pest", "pest_generator", @@ -8088,9 +8091,9 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.5.4" +version = "2.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b27bd18aa01d91c8ed2b61ea23406a676b42d82609c6e2581fba42f0c15f17f" +checksum = "d06646e185566b5961b4058dd107e0a7f56e77c3f484549fb119867773c0f202" dependencies = [ "pest", "pest_meta", @@ -8101,9 +8104,9 @@ dependencies = [ [[package]] name = "pest_meta" -version = "2.5.4" +version = "2.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f02b677c1859756359fc9983c2e56a0237f18624a3789528804406b7e915e5d" +checksum = "e6f60b2ba541577e2a0c307c8f39d1439108120eb7903adeb6497fa880c59616" dependencies = [ "once_cell", "pest", @@ -8112,9 +8115,9 @@ dependencies = [ [[package]] name = "petgraph" -version = "0.6.2" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6d5014253a1331579ce62aa67443b4a658c5e7dd03d4bc6d302b94474888143" +checksum = "4dd7d28ee937e54fe3080c91faa1c3a46c06de6252988a7f4592ba2310ef22a4" dependencies = [ "fixedbitset", "indexmap", @@ -9546,9 +9549,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.50" +version = "1.0.51" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ef7d57beacfaf2d8aee5937dab7b7f28de3cb8b1828479bb5de2a7106f2bae2" +checksum = "5d727cae5b39d21da60fa540906919ad737832fe0b1c165da3a34d6548c849d6" dependencies = [ "unicode-ident", ] @@ -9843,7 +9846,7 @@ checksum = "6413f3de1edee53342e6138e75b56d32e7bc6e332b3bd62d497b1929d4cfbcdd" dependencies = [ "pem", "ring", - "time 0.3.17", + "time 0.3.19", "x509-parser 0.13.2", "yasna", ] @@ -9856,7 +9859,7 @@ checksum = "ffbe84efe2f38dea12e9bfc1f65377fdf03e53a18cb3b995faedf7934c7e785b" dependencies = [ "pem", "ring", - "time 0.3.17", + "time 0.3.19", "yasna", ] @@ -10250,16 +10253,16 @@ dependencies = [ [[package]] name = "rustix" -version = "0.36.7" +version = "0.36.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4fdebc4b395b7fbb9ab11e462e20ed9051e7b16e42d24042c776eca0ac81b03" +checksum = "f43abb88211988493c1abb44a70efa56ff0ce98f233b7b276146f1f3f7ba9644" dependencies = [ "bitflags", "errno", - "io-lifetimes 1.0.4", + "io-lifetimes 1.0.5", "libc", "linux-raw-sys 0.1.4", - "windows-sys 0.42.0", + "windows-sys 0.45.0", ] [[package]] @@ -11607,9 +11610,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.91" +version = "1.0.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "877c235533714907a8c2464236f5c4b2a17262ef1bd71f38f35ea592c8da6883" +checksum = "cad406b69c91885b5107daf2c29572f6c8cdb3c66826821e286c533490c0bc76" dependencies = [ "itoa", "ryu", @@ -11704,9 +11707,9 @@ checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3" [[package]] name = "signal-hook-registry" -version = "1.4.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e51e73328dc4ac0c7ccbda3a494dfa03df1de2f46018127f60c693f2648455b0" +checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1" dependencies = [ "libc", ] @@ -11755,9 +11758,9 @@ dependencies = [ [[package]] name = "slab" -version = "0.4.7" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4614a76b2a8be0058caa9dbbaf66d988527d86d003c11a94fbd335d7661edcef" +checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d" dependencies = [ "autocfg", ] @@ -11803,14 +11806,14 @@ checksum = "5e9f0ab6ef7eb7353d9119c170a436d1bf248eea575ac42d19d12f4e34130831" [[package]] name = "snow" -version = "0.9.0" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "774d05a3edae07ce6d68ea6984f3c05e9bba8927e3dd591e3b479e5b03213d0d" +checksum = "12ba5f4d4ff12bdb6a169ed51b7c48c0e0ac4b0b4b31012b2571e97d78d3201d" dependencies = [ "aes-gcm 0.9.4", "blake2", "chacha20poly1305", - "curve25519-dalek 4.0.0-pre.5", + "curve25519-dalek 4.0.0-rc.0", "rand_core 0.6.4", "ring", "rustc_version", @@ -12906,9 +12909,9 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "target-lexicon" -version = "0.12.5" +version = "0.12.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9410d0f6853b1d94f0e519fb95df60f29d2c1eff2d921ffdf01a4c8a3b54f12d" +checksum = "8ae9980cab1db3fceee2f6c6f643d5d8de2997c58ee8d25fb0cc8a9e9e7348e5" [[package]] name = "tempfile" @@ -12967,10 +12970,11 @@ checksum = "3bf63baf9f5039dadc247375c29eb13706706cfde997d0330d05aa63a77d8820" [[package]] name = "thread_local" -version = "1.1.4" +version = "1.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5516c27b78311c50bf42c071425c560ac799b11c30b31f87e3081965fe5e0180" +checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" dependencies = [ + "cfg-if", "once_cell", ] @@ -13009,12 +13013,11 @@ dependencies = [ [[package]] name = "tikv-jemalloc-sys" -version = "0.5.2+5.3.0-patched" +version = "0.5.3+5.3.0-patched" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec45c14da997d0925c7835883e4d5c181f196fa142f8c19d7643d1e9af2592c3" +checksum = "a678df20055b43e57ef8cddde41cdfda9a3c1a060b67f4c5836dfb1d78543ba8" dependencies = [ "cc", - "fs_extra", "libc", ] @@ -13031,9 +13034,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.17" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a561bf4617eebd33bca6434b988f39ed798e527f51a1e797d0ee4f61c0a38376" +checksum = "53250a3b3fed8ff8fd988587d8925d26a83ac3845d9e03b220b37f34c2b8d6c2" dependencies = [ "itoa", "serde", @@ -13049,9 +13052,9 @@ checksum = "2e153e1f1acaef8acc537e68b44906d2db6436e2b35ac2c6b42640fff91f00fd" [[package]] name = "time-macros" -version = "0.2.6" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d967f99f534ca7e495c575c62638eebc2898a8c84c119b89e250477bc4ba16b2" +checksum = "a460aeb8de6dcb0f381e1ee05f1cd56fcf5a5f6eb8187ff3d8f0b11078d38b7c" dependencies = [ "time-core", ] @@ -13105,9 +13108,9 @@ dependencies = [ [[package]] name = "tinyvec_macros" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" @@ -13153,9 +13156,9 @@ dependencies = [ [[package]] name = "tokio-stream" -version = "0.1.11" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d660770404473ccd7bc9f8b28494a811bc18542b915c0855c51e8f419d5223ce" +checksum = "8fb52b74f05dbf495a8fba459fdc331812b96aa086d9eb78101fa0d4569c3313" dependencies = [ "futures-core", "pin-project-lite 0.2.9", @@ -13165,9 +13168,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.4" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bb2e075f03b3d66d8d8785356224ba688d2906a371015e225beeb65ca92c740" +checksum = "5427d89453009325de0d8f342c9490009f76e999cb7672d77e46267448f7e6b2" dependencies = [ "bytes", "futures-core", @@ -13564,9 +13567,9 @@ dependencies = [ [[package]] name = "unicode-segmentation" -version = "1.10.0" +version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fdbf052a0783de01e944a6ce7a8cb939e295b1e7be835a1112c3b9a7f047a5a" +checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" [[package]] name = "unicode-width" @@ -13708,9 +13711,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.83" +version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eaf9f5aceeec8be17c128b2e93e031fb8a4d469bb9c4ae2d7dc1888b26887268" +checksum = "31f8dcbc21f30d9b8f2ea926ecb58f6b91192c17e9d33594b3df58b2007ca53b" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -13718,9 +13721,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.83" +version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c8ffb332579b0557b52d268b91feab8df3615f265d5270fec2a8c95b17c1142" +checksum = "95ce90fd5bcc06af55a641a86428ee4229e44e07033963a2290a8e241607ccb9" dependencies = [ "bumpalo", "log", @@ -13733,9 +13736,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.33" +version = "0.4.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23639446165ca5a5de86ae1d8896b737ae80319560fbaa4c2887b7da6e7ebd7d" +checksum = "f219e0d211ba40266969f6dbdd90636da12f75bee4fc9d6c23d1260dadb51454" dependencies = [ "cfg-if", "js-sys", @@ -13745,9 +13748,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.83" +version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "052be0f94026e6cbc75cdefc9bae13fd6052cdcaf532fa6c45e7ae33a1e6c810" +checksum = "4c21f77c0bedc37fd5dc21f897894a5ca01e7bb159884559461862ae90c0b4c5" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -13755,9 +13758,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.83" +version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07bc0c051dc5f23e307b13285f9d75df86bfdf816c5721e573dec1f9b8aa193c" +checksum = "2aff81306fcac3c7515ad4e177f521b5c9a15f2b08f4e32d823066102f35a5f6" dependencies = [ "proc-macro2", "quote", @@ -13768,9 +13771,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.83" +version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f" +checksum = "0046fef7e28c3804e5e38bfa31ea2a0f73905319b677e57ebe37e49358989b5d" [[package]] name = "wasm-instrument" @@ -14051,9 +14054,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.60" +version = "0.3.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcda906d8be16e728fd5adc5b729afad4e444e106ab28cd1c7256e54fa61510f" +checksum = "e33b99f4b23ba3eec1a53ac264e35a755f00e966e0065077d6027c0f575b0b97" dependencies = [ "js-sys", "wasm-bindgen", @@ -14114,7 +14117,7 @@ dependencies = [ "sha2 0.10.6", "stun", "thiserror", - "time 0.3.17", + "time 0.3.19", "tokio", "turn", "url", @@ -14187,9 +14190,9 @@ dependencies = [ [[package]] name = "webrtc-ice" -version = "0.9.0" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "494483fbb2f5492620871fdc78b084aed8807377f6e3fe88b2e49f0a9c9c41d7" +checksum = "465a03cc11e9a7d7b4f9f99870558fe37a102b65b93f8045392fef7c67b39e80" dependencies = [ "arc-swap", "async-trait", @@ -14502,6 +14505,30 @@ dependencies = [ "windows_x86_64_msvc 0.42.1", ] +[[package]] +name = "windows-sys" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e2522491fbfcd58cc84d47aeb2958948c4b8982e9a2d8a2a35bbaed431390e7" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc 0.42.1", + "windows_i686_gnu 0.42.1", + "windows_i686_msvc 0.42.1", + "windows_x86_64_gnu 0.42.1", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc 0.42.1", +] + [[package]] name = "windows_aarch64_gnullvm" version = "0.42.1" @@ -14660,7 +14687,7 @@ dependencies = [ "ring", "rusticata-macros", "thiserror", - "time 0.3.17", + "time 0.3.19", ] [[package]] @@ -14678,7 +14705,7 @@ dependencies = [ "oid-registry 0.6.1", "rusticata-macros", "thiserror", - "time 0.3.17", + "time 0.3.19", ] [[package]] @@ -14788,7 +14815,7 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aed2e7a52e3744ab4d0c05c20aa065258e84c49fd4226f5191b2ed29712710b4" dependencies = [ - "time 0.3.17", + "time 0.3.19", ] [[package]] @@ -14833,9 +14860,9 @@ dependencies = [ [[package]] name = "zstd-sys" -version = "2.0.5+zstd.1.5.2" +version = "2.0.7+zstd.1.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edc50ffce891ad571e9f9afe5039c4837bede781ac4bb13052ed7ae695518596" +checksum = "94509c3ba2fe55294d752b79842c530ccfab760192521df74a081a78d2b3c7f5" dependencies = [ "cc", "libc", diff --git a/pallet/account-migration/Cargo.toml b/pallet/account-migration/Cargo.toml index f7b9be10a..820eef60d 100644 --- a/pallet/account-migration/Cargo.toml +++ b/pallet/account-migration/Cargo.toml @@ -30,8 +30,9 @@ sp-runtime = { workspace = true } sp-std = { workspace = true } [dev-dependencies] -sp-keyring = { workspace = true } -sp-version = { workspace = true } +pallet-timestamp = { workspace = true, features = ["std"] } +sp-keyring = { workspace = true } +sp-version = { workspace = true, features = ["std"] } [features] default = ["std"] diff --git a/pallet/account-migration/tests/mock.rs b/pallet/account-migration/tests/mock.rs index 91c737fdd..13efbfd55 100644 --- a/pallet/account-migration/tests/mock.rs +++ b/pallet/account-migration/tests/mock.rs @@ -92,6 +92,13 @@ impl frame_system::Config for Runtime { type Version = Version; } +impl pallet_timestamp::Config for Runtime { + type MinimumPeriod = (); + type Moment = Moment; + type OnTimestampSet = (); + type WeightInfo = (); +} + impl pallet_balances::Config for Runtime { type AccountStore = System; type Balance = Balance; @@ -149,7 +156,7 @@ impl darwinia_deposit::Config for Runtime { type MinLockingAmount = (); type Ring = Balances; type RuntimeEvent = RuntimeEvent; - type UnixTime = Dummy; + type WeightInfo = (); } impl darwinia_staking::Config for Runtime { @@ -185,13 +192,14 @@ impl darwinia_account_migration::Config for Runtime { type RuntimeEvent = RuntimeEvent; } -frame_support::construct_runtime!( +frame_support::construct_runtime! { pub enum Runtime where Block = frame_system::mocking::MockBlock, NodeBlock = frame_system::mocking::MockBlock, UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic, { System: frame_system, + Timestamp: pallet_timestamp, Balances: pallet_balances, Assets: pallet_assets, Vesting: pallet_vesting, @@ -200,7 +208,7 @@ frame_support::construct_runtime!( Identity: pallet_identity, AccountMigration: darwinia_account_migration, } -); +} pub fn new_test_ext() -> TestExternalities { frame_system::GenesisConfig::default().build_storage::().unwrap().into() diff --git a/pallet/deposit/Cargo.toml b/pallet/deposit/Cargo.toml index 8445a26dd..72267e57c 100644 --- a/pallet/deposit/Cargo.toml +++ b/pallet/deposit/Cargo.toml @@ -17,18 +17,19 @@ dc-inflation = { workspace = true } dc-types = { workspace = true } # subtrate -frame-support = { workspace = true } -frame-system = { workspace = true } -sp-core = { workspace = true } -sp-runtime = { workspace = true } -sp-std = { workspace = true } +frame-benchmarking = { workspace = true, optional = true } +frame-support = { workspace = true } +frame-system = { workspace = true } +pallet-timestamp = { workspace = true } +sp-core = { workspace = true } +sp-runtime = { workspace = true } +sp-std = { workspace = true } [dev-dependencies] # substrate -pallet-assets = { workspace = true, features = ["std"] } -pallet-balances = { workspace = true, features = ["std"] } -pallet-timestamp = { workspace = true, features = ["std"] } -sp-io = { workspace = true } +pallet-assets = { workspace = true, features = ["std"] } +pallet-balances = { workspace = true, features = ["std"] } +sp-io = { workspace = true, features = ["std"] } [features] default = ["std"] @@ -44,10 +45,21 @@ std = [ # subtrate "frame-support/std", "frame-system/std", + "pallet-timestamp/std", "sp-core/std", "sp-runtime/std", "sp-std/std", + # substrate optional + "frame-benchmarking?/std", ] -# TODO: runtime-benchmarks -try-runtime = ["frame-support/try-runtime"] +runtime-benchmarks = [ + # substrate + "frame-benchmarking/runtime-benchmarks", + "pallet-timestamp/runtime-benchmarks", +] + +try-runtime = [ + # substrate + "frame-support/try-runtime", +] diff --git a/pallet/deposit/src/benchmarking.rs b/pallet/deposit/src/benchmarking.rs new file mode 100644 index 000000000..12ef2a99b --- /dev/null +++ b/pallet/deposit/src/benchmarking.rs @@ -0,0 +1,119 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +// darwinia +use crate::*; +use dc_types::UNIT; +// substrate +use frame_benchmarking::v2; +use frame_system::RawOrigin; +use sp_runtime::SaturatedConversion; +use sp_std::prelude::*; + +#[v2::benchmarks] +mod benchmarks { + // darwinia + use super::*; + + #[benchmark] + fn lock() { + let a = frame_benchmarking::whitelisted_caller(); + let max_deposits = T::MaxDeposits::get(); + + T::Ring::make_free_balance_be(&a, max_deposits as Balance * UNIT); + + // The worst case: + // + // Calculate the last deposit's id. + (0..max_deposits - 1).for_each(|_| { + >::lock(RawOrigin::Signed(a.clone()).into(), UNIT, MAX_LOCKING_MONTHS) + .unwrap() + }); + + #[extrinsic_call] + _(RawOrigin::Signed(a), UNIT, MAX_LOCKING_MONTHS); + } + + #[benchmark] + fn claim() { + let a = frame_benchmarking::whitelisted_caller(); + let max_deposits = T::MaxDeposits::get(); + + T::Ring::make_free_balance_be(&a, max_deposits as Balance * UNIT); + + (0..max_deposits).for_each(|_| { + >::lock(RawOrigin::Signed(a.clone()).into(), UNIT, MAX_LOCKING_MONTHS) + .unwrap() + }); + + // The worst case: + // + // Let all locks be expired. + >::set_timestamp( + >::now() + + (MAX_LOCKING_MONTHS as Moment * MILLISECS_PER_MONTH).saturated_into(), + ); + + assert_eq!(>::deposit_of(&a).unwrap().len(), max_deposits as usize); + + #[extrinsic_call] + _(RawOrigin::Signed(a.clone())); + + assert!(>::deposit_of(&a).is_none()); + } + + #[benchmark] + fn claim_with_penalty() { + let a = frame_benchmarking::whitelisted_caller(); + let max_deposits = T::MaxDeposits::get(); + + T::Ring::make_free_balance_be(&a, max_deposits as Balance * UNIT); + T::Kton::mint(&a, UNIT).unwrap(); + + (0..max_deposits).for_each(|_| { + >::lock(RawOrigin::Signed(a.clone()).into(), UNIT, MAX_LOCKING_MONTHS) + .unwrap() + }); + + // The worst case: + // + // Remove the head item from a 'full-size' bounded vector. + { + let ds = >::deposit_of(&a).unwrap(); + + assert_eq!(ds.len(), max_deposits as usize); + assert_eq!(ds[0].id, 0); + } + + #[extrinsic_call] + _(RawOrigin::Signed(a.clone()), 0); + + { + let ds = >::deposit_of(&a).unwrap(); + + assert_eq!(ds.len(), max_deposits as usize - 1); + assert_eq!(ds[0].id, 1); + } + } + + frame_benchmarking::impl_benchmark_test_suite!( + Pallet, + crate::mock::new_test_ext(), + crate::mock::Runtime + ); +} diff --git a/pallet/deposit/src/lib.rs b/pallet/deposit/src/lib.rs index ec980f841..9446cb03e 100644 --- a/pallet/deposit/src/lib.rs +++ b/pallet/deposit/src/lib.rs @@ -26,6 +26,14 @@ #![cfg_attr(not(feature = "std"), no_std)] #![deny(missing_docs)] +#[cfg(test)] +mod mock; +#[cfg(test)] +mod tests; + +#[cfg(feature = "runtime-benchmarks")] +mod benchmarking; + mod weights; pub use weights::WeightInfo; @@ -55,6 +63,9 @@ use sp_runtime::traits::AccountIdConversion; /// Milliseconds per month. pub const MILLISECS_PER_MONTH: Moment = MILLISECS_PER_YEAR / 12; +/// The maximum locking period for a deposit. +pub const MAX_LOCKING_MONTHS: u8 = 36; + /// Simple asset APIs. pub trait SimpleAsset { /// Account type. @@ -96,12 +107,12 @@ pub mod pallet { use crate::*; #[pallet::config] - pub trait Config: frame_system::Config { + pub trait Config: frame_system::Config + pallet_timestamp::Config { /// Override the [`frame_system::Config::RuntimeEvent`]. type RuntimeEvent: From> + IsType<::RuntimeEvent>; - /// Unix time getter. - type UnixTime: UnixTime; + /// Weight information for extrinsics in this pallet. + type WeightInfo: WeightInfo; /// RING asset. type Ring: Currency; @@ -188,7 +199,7 @@ pub mod pallet { if months == 0 { Err(>::LockAtLeastOneMonth)?; } - if months > 36 { + if months > MAX_LOCKING_MONTHS { Err(>::LockAtMostThirtySixMonths)?; } if >::decode_len(&who).unwrap_or_default() as u32 >= T::MaxDeposits::get() { @@ -216,7 +227,7 @@ pub mod pallet { Continue(c) => c, Break(b) => b, }; - let start_time = T::UnixTime::now().as_millis(); + let start_time = Self::now(); let expired_time = start_time + MILLISECS_PER_MONTH * months as Moment; ds.try_insert( @@ -251,7 +262,7 @@ pub mod pallet { #[pallet::weight(0)] pub fn claim(origin: OriginFor) -> DispatchResult { let who = ensure_signed(origin)?; - let now = T::UnixTime::now().as_millis(); + let now = Self::now(); let mut claimed = 0; let _ = >::try_mutate(&who, |maybe_ds| { let ds = maybe_ds.as_mut().ok_or(())?; @@ -303,7 +314,7 @@ pub mod pallet { >::Ok(d) })?; - let now = T::UnixTime::now().as_millis(); + let now = Self::now(); if d.expired_time <= now { Err(>::DepositAlreadyExpired)?; @@ -328,6 +339,14 @@ pub mod pallet { } pub use pallet::*; +impl Pallet +where + T: Config, +{ + fn now() -> Moment { + as UnixTime>::now().as_millis() + } +} impl darwinia_staking::Stake for Pallet where T: Config, diff --git a/pallet/deposit/tests/mock.rs b/pallet/deposit/src/mock.rs similarity index 96% rename from pallet/deposit/tests/mock.rs rename to pallet/deposit/src/mock.rs index c00eca4e8..bf5aaa067 100644 --- a/pallet/deposit/tests/mock.rs +++ b/pallet/deposit/src/mock.rs @@ -16,8 +16,9 @@ // You should have received a copy of the GNU General Public License // along with Darwinia. If not, see . -// darwinia -use dc_types::{AssetId, Balance, Moment, UNIT}; +pub use crate as darwinia_deposit; +pub use dc_types::{AssetId, Balance, Moment, UNIT}; + // substrate use frame_support::traits::GenesisBuild; use sp_io::TestExternalities; @@ -113,10 +114,10 @@ impl darwinia_deposit::Config for Runtime { type MinLockingAmount = frame_support::traits::ConstU128; type Ring = Balances; type RuntimeEvent = RuntimeEvent; - type UnixTime = Timestamp; + type WeightInfo = (); } -frame_support::construct_runtime!( +frame_support::construct_runtime! { pub enum Runtime where Block = frame_system::mocking::MockBlock, NodeBlock = frame_system::mocking::MockBlock, @@ -128,7 +129,7 @@ frame_support::construct_runtime!( Assets: pallet_assets, Deposit: darwinia_deposit, } -); +} pub fn efflux(milli_secs: Moment) { Timestamp::set_timestamp(Timestamp::now() + milli_secs); diff --git a/pallet/deposit/tests/tests.rs b/pallet/deposit/src/tests.rs similarity index 98% rename from pallet/deposit/tests/tests.rs rename to pallet/deposit/src/tests.rs index 4c672489f..c0eea971c 100644 --- a/pallet/deposit/tests/tests.rs +++ b/pallet/deposit/src/tests.rs @@ -16,13 +16,12 @@ // You should have received a copy of the GNU General Public License // along with Darwinia. If not, see . -mod mock; -use mock::{Deposit, *}; - // darwinia -use darwinia_deposit::{Deposit as DepositS, *}; +use crate::{ + mock::{Deposit, *}, + Deposit as DepositS, *, +}; use darwinia_staking::Stake; -use dc_types::{Moment, UNIT}; // substrate use frame_support::{assert_noop, assert_ok, traits::Get}; @@ -47,7 +46,7 @@ fn deposit_interest_should_work() { assert_eq!(Assets::balance(0, 1), 7_614_213_197_969); assert_eq!(Assets::balance(0, 2), 0); - assert_ok!(Deposit::lock(RuntimeOrigin::signed(2), 1000 * UNIT, 36)); + assert_ok!(Deposit::lock(RuntimeOrigin::signed(2), 1000 * UNIT, MAX_LOCKING_MONTHS)); assert_eq!(Assets::balance(0, 2), 364_467_005_076_142_131); }); } diff --git a/pallet/deposit/src/weights.rs b/pallet/deposit/src/weights.rs index 18be72e2c..3df89e8f2 100644 --- a/pallet/deposit/src/weights.rs +++ b/pallet/deposit/src/weights.rs @@ -1,4 +1,178 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for darwinia_deposit +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-02-22, STEPS: `2`, REPEAT: `1`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `inv.cafe`, CPU: `13th Gen Intel(R) Core(TM) i9-13900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("pangolin-local"), DB CACHE: 1024 + +// Executed Command: +// target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --template +// .maintain/pallet-weight-template.hbs +// --execution +// wasm +// --heap-pages +// 4096 +// --chain +// pangolin-local +// --output +// pallet/deposit/src/weights.rs +// --extrinsic +// * +// --pallet +// darwinia-deposit + +#![cfg_attr(rustfmt, rustfmt_skip)] #![allow(missing_docs)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use sp_std::marker::PhantomData; + +/// Weight functions needed for darwinia_deposit. +pub trait WeightInfo { + fn lock() -> Weight; + fn claim() -> Weight; + fn claim_with_penalty() -> Weight; +} + +/// Weights for darwinia_deposit using the Substrate node and recommended hardware. +pub struct SubstrateWeight(PhantomData); +impl WeightInfo for SubstrateWeight { + /// Storage: Deposit Deposits (r:1 w:1) + /// Proof: Deposit Deposits (max_values: None, max_size: Some(853), added: 3328, mode: MaxEncodedLen) + /// Storage: Timestamp Now (r:1 w:0) + /// Proof: Timestamp Now (max_values: Some(1), max_size: Some(8), added: 503, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(116), added: 2591, mode: MaxEncodedLen) + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(166), added: 2641, mode: MaxEncodedLen) + /// Storage: Assets Account (r:1 w:1) + /// Proof: Assets Account (max_values: None, max_size: Some(94), added: 2569, mode: MaxEncodedLen) + fn lock() -> Weight { + // Proof Size summary in bytes: + // Measured: `3208` + // Estimated: `11632` + // Minimum execution time: 51_636 nanoseconds. + Weight::from_ref_time(51_636_000) + .saturating_add(Weight::from_proof_size(11632)) + .saturating_add(T::DbWeight::get().reads(5_u64)) + .saturating_add(T::DbWeight::get().writes(4_u64)) + } + /// Storage: Timestamp Now (r:1 w:0) + /// Proof: Timestamp Now (max_values: Some(1), max_size: Some(8), added: 503, mode: MaxEncodedLen) + /// Storage: Deposit Deposits (r:1 w:1) + /// Proof: Deposit Deposits (max_values: None, max_size: Some(853), added: 3328, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(116), added: 2591, mode: MaxEncodedLen) + fn claim() -> Weight { + // Proof Size summary in bytes: + // Measured: `2906` + // Estimated: `6422` + // Minimum execution time: 73_239 nanoseconds. + Weight::from_ref_time(73_239_000) + .saturating_add(Weight::from_proof_size(6422)) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: Deposit Deposits (r:1 w:1) + /// Proof: Deposit Deposits (max_values: None, max_size: Some(853), added: 3328, mode: MaxEncodedLen) + /// Storage: Timestamp Now (r:1 w:0) + /// Proof: Timestamp Now (max_values: Some(1), max_size: Some(8), added: 503, mode: MaxEncodedLen) + /// Storage: Assets Account (r:1 w:1) + /// Proof: Assets Account (max_values: None, max_size: Some(94), added: 2569, mode: MaxEncodedLen) + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(166), added: 2641, mode: MaxEncodedLen) + fn claim_with_penalty() -> Weight { + // Proof Size summary in bytes: + // Measured: `2420` + // Estimated: `9041` + // Minimum execution time: 52_162 nanoseconds. + Weight::from_ref_time(52_162_000) + .saturating_add(Weight::from_proof_size(9041)) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } +} -pub trait WeightInfo {} -impl WeightInfo for () {} +// For backwards compatibility and tests +impl WeightInfo for () { + /// Storage: Deposit Deposits (r:1 w:1) + /// Proof: Deposit Deposits (max_values: None, max_size: Some(853), added: 3328, mode: MaxEncodedLen) + /// Storage: Timestamp Now (r:1 w:0) + /// Proof: Timestamp Now (max_values: Some(1), max_size: Some(8), added: 503, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(116), added: 2591, mode: MaxEncodedLen) + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(166), added: 2641, mode: MaxEncodedLen) + /// Storage: Assets Account (r:1 w:1) + /// Proof: Assets Account (max_values: None, max_size: Some(94), added: 2569, mode: MaxEncodedLen) + fn lock() -> Weight { + // Proof Size summary in bytes: + // Measured: `3208` + // Estimated: `11632` + // Minimum execution time: 51_636 nanoseconds. + Weight::from_ref_time(51_636_000) + .saturating_add(Weight::from_proof_size(11632)) + .saturating_add(RocksDbWeight::get().reads(5_u64)) + .saturating_add(RocksDbWeight::get().writes(4_u64)) + } + /// Storage: Timestamp Now (r:1 w:0) + /// Proof: Timestamp Now (max_values: Some(1), max_size: Some(8), added: 503, mode: MaxEncodedLen) + /// Storage: Deposit Deposits (r:1 w:1) + /// Proof: Deposit Deposits (max_values: None, max_size: Some(853), added: 3328, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(116), added: 2591, mode: MaxEncodedLen) + fn claim() -> Weight { + // Proof Size summary in bytes: + // Measured: `2906` + // Estimated: `6422` + // Minimum execution time: 73_239 nanoseconds. + Weight::from_ref_time(73_239_000) + .saturating_add(Weight::from_proof_size(6422)) + .saturating_add(RocksDbWeight::get().reads(3_u64)) + .saturating_add(RocksDbWeight::get().writes(2_u64)) + } + /// Storage: Deposit Deposits (r:1 w:1) + /// Proof: Deposit Deposits (max_values: None, max_size: Some(853), added: 3328, mode: MaxEncodedLen) + /// Storage: Timestamp Now (r:1 w:0) + /// Proof: Timestamp Now (max_values: Some(1), max_size: Some(8), added: 503, mode: MaxEncodedLen) + /// Storage: Assets Account (r:1 w:1) + /// Proof: Assets Account (max_values: None, max_size: Some(94), added: 2569, mode: MaxEncodedLen) + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(166), added: 2641, mode: MaxEncodedLen) + fn claim_with_penalty() -> Weight { + // Proof Size summary in bytes: + // Measured: `2420` + // Estimated: `9041` + // Minimum execution time: 52_162 nanoseconds. + Weight::from_ref_time(52_162_000) + .saturating_add(Weight::from_proof_size(9041)) + .saturating_add(RocksDbWeight::get().reads(4_u64)) + .saturating_add(RocksDbWeight::get().writes(3_u64)) + } +} diff --git a/pallet/staking/tests/mock.rs b/pallet/staking/tests/mock.rs index e1574aa3d..5a3e1325c 100644 --- a/pallet/staking/tests/mock.rs +++ b/pallet/staking/tests/mock.rs @@ -128,7 +128,7 @@ impl darwinia_deposit::Config for Runtime { type MinLockingAmount = frame_support::traits::ConstU128; type Ring = Balances; type RuntimeEvent = RuntimeEvent; - type UnixTime = Time; + type WeightInfo = (); } pub enum RingStaking {} @@ -239,7 +239,7 @@ impl darwinia_staking::Config for Runtime { type UnixTime = Time; } -frame_support::construct_runtime!( +frame_support::construct_runtime! { pub enum Runtime where Block = frame_system::mocking::MockBlock, NodeBlock = frame_system::mocking::MockBlock, @@ -253,7 +253,7 @@ frame_support::construct_runtime!( Session: pallet_session, Staking: darwinia_staking, } -); +} pub trait ZeroDefault { fn default() -> Self; diff --git a/precompile/deposit/src/mock.rs b/precompile/deposit/src/mock.rs index ee62615a5..55c3a37b9 100644 --- a/precompile/deposit/src/mock.rs +++ b/precompile/deposit/src/mock.rs @@ -111,7 +111,7 @@ impl darwinia_deposit::Config for TestRuntime { type MinLockingAmount = frame_support::traits::ConstU128<100>; type Ring = Balances; type RuntimeEvent = RuntimeEvent; - type UnixTime = Timestamp; + type WeightInfo = (); } pub struct TestPrecompiles(PhantomData); @@ -173,7 +173,7 @@ impl pallet_evm::Config for TestRuntime { type WithdrawOrigin = pallet_evm::EnsureAddressNever; } -frame_support::construct_runtime!( +frame_support::construct_runtime! { pub enum TestRuntime where Block = frame_system::mocking::MockBlock, NodeBlock = frame_system::mocking::MockBlock, @@ -185,7 +185,7 @@ frame_support::construct_runtime!( Deposit: darwinia_deposit, EVM: pallet_evm, } -); +} pub fn efflux(milli_secs: u128) { Timestamp::set_timestamp(Timestamp::now() + milli_secs); diff --git a/precompile/staking/src/mock.rs b/precompile/staking/src/mock.rs index b7ef3374e..92ca83133 100644 --- a/precompile/staking/src/mock.rs +++ b/precompile/staking/src/mock.rs @@ -113,7 +113,7 @@ impl darwinia_deposit::Config for TestRuntime { type MinLockingAmount = frame_support::traits::ConstU128<100>; type Ring = Balances; type RuntimeEvent = RuntimeEvent; - type UnixTime = Timestamp; + type WeightInfo = (); } pub struct TestPrecompiles(PhantomData); @@ -233,7 +233,7 @@ impl darwinia_staking::Config for TestRuntime { type UnixTime = Timestamp; } -frame_support::construct_runtime!( +frame_support::construct_runtime! { pub enum TestRuntime where Block = frame_system::mocking::MockBlock, NodeBlock = frame_system::mocking::MockBlock, @@ -246,7 +246,7 @@ frame_support::construct_runtime!( EVM: pallet_evm, Staking: darwinia_staking, } -); +} #[derive(Default)] pub(crate) struct ExtBuilder { diff --git a/runtime/crab/Cargo.toml b/runtime/crab/Cargo.toml index 4c70f0e37..5646a09a9 100644 --- a/runtime/crab/Cargo.toml +++ b/runtime/crab/Cargo.toml @@ -259,6 +259,7 @@ runtime-benchmarks = [ # darwinia "darwinia-common-runtime/runtime-benchmarks", + "darwinia-deposit/runtime-benchmarks", # darwinia-messages-substrate "bridge-runtime-common/runtime-benchmarks", diff --git a/runtime/crab/src/lib.rs b/runtime/crab/src/lib.rs index b9d26a2e8..98b5f36f6 100644 --- a/runtime/crab/src/lib.rs +++ b/runtime/crab/src/lib.rs @@ -168,7 +168,12 @@ frame_support::construct_runtime! { #[cfg(feature = "runtime-benchmarks")] frame_benchmarking::define_benchmarks! { - // Substrate + // darwinia + [darwinia_deposit, Deposit] + // darwinia-messages-substrate + [pallet_bridge_grandpa, BridgePolkadotGrandpa] + [pallet_fee_market, DarwiniaFeeMarket] + // substrate [cumulus_pallet_xcmp_queue, XcmpQueue] [frame_system, SystemBench::] [pallet_assets, Assets] @@ -189,9 +194,6 @@ frame_benchmarking::define_benchmarks! { [pallet_vesting, Vesting] [pallet_session, SessionBench::] [pallet_timestamp, Timestamp] - // Bridge - [pallet_bridge_grandpa, BridgePolkadotGrandpa] - [pallet_fee_market, DarwiniaFeeMarket] } impl_self_contained_call!(); diff --git a/runtime/crab/src/pallets/mod.rs b/runtime/crab/src/pallets.rs similarity index 100% rename from runtime/crab/src/pallets/mod.rs rename to runtime/crab/src/pallets.rs diff --git a/runtime/crab/src/pallets/deposit.rs b/runtime/crab/src/pallets/deposit.rs index a37e0be81..2c07d0d8b 100644 --- a/runtime/crab/src/pallets/deposit.rs +++ b/runtime/crab/src/pallets/deposit.rs @@ -49,5 +49,5 @@ impl darwinia_deposit::Config for Runtime { type MinLockingAmount = ConstU128; type Ring = Balances; type RuntimeEvent = RuntimeEvent; - type UnixTime = Timestamp; + type WeightInfo = weights::darwinia_deposit::WeightInfo; } diff --git a/runtime/crab/src/pallets/timestamp.rs b/runtime/crab/src/pallets/timestamp.rs index b18b2a162..4f8909931 100644 --- a/runtime/crab/src/pallets/timestamp.rs +++ b/runtime/crab/src/pallets/timestamp.rs @@ -23,6 +23,9 @@ impl pallet_timestamp::Config for Runtime { type MinimumPeriod = ConstU64<{ SLOT_DURATION / 2 }>; /// A timestamp: milliseconds since the unix epoch. type Moment = u64; + #[cfg(not(feature = "runtime-benchmarks"))] type OnTimestampSet = Aura; + #[cfg(feature = "runtime-benchmarks")] + type OnTimestampSet = (); type WeightInfo = weights::pallet_timestamp::WeightInfo; } diff --git a/runtime/crab/src/weights/mod.rs b/runtime/crab/src/weights.rs similarity index 98% rename from runtime/crab/src/weights/mod.rs rename to runtime/crab/src/weights.rs index 4580cd631..d5a785a96 100644 --- a/runtime/crab/src/weights/mod.rs +++ b/runtime/crab/src/weights.rs @@ -33,6 +33,7 @@ pub mod rocksdb_weights; pub use rocksdb_weights::constants::RocksDbWeight; pub mod cumulus_pallet_xcmp_queue; +pub mod darwinia_deposit; pub mod frame_system; pub mod pallet_assets; pub mod pallet_balances; diff --git a/runtime/crab/src/weights/darwinia_deposit.rs b/runtime/crab/src/weights/darwinia_deposit.rs new file mode 100644 index 000000000..e594624d7 --- /dev/null +++ b/runtime/crab/src/weights/darwinia_deposit.rs @@ -0,0 +1,107 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `darwinia_deposit` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-02-22, STEPS: `2`, REPEAT: `1`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `inv.cafe`, CPU: `13th Gen Intel(R) Core(TM) i9-13900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("crab-local"), DB CACHE: 1024 + +// Executed Command: +// target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --chain +// crab-local +// --output +// runtime/crab/src/weights +// --extrinsic +// * +// --pallet +// darwinia-deposit + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `darwinia_deposit`. +pub struct WeightInfo(PhantomData); +impl darwinia_deposit::WeightInfo for WeightInfo { + /// Storage: Deposit Deposits (r:1 w:1) + /// Proof: Deposit Deposits (max_values: None, max_size: Some(853), added: 3328, mode: MaxEncodedLen) + /// Storage: Timestamp Now (r:1 w:0) + /// Proof: Timestamp Now (max_values: Some(1), max_size: Some(8), added: 503, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(116), added: 2591, mode: MaxEncodedLen) + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(166), added: 2641, mode: MaxEncodedLen) + /// Storage: Assets Account (r:1 w:1) + /// Proof: Assets Account (max_values: None, max_size: Some(94), added: 2569, mode: MaxEncodedLen) + fn lock() -> Weight { + // Proof Size summary in bytes: + // Measured: `3267` + // Estimated: `11632` + // Minimum execution time: 59_662 nanoseconds. + Weight::from_parts(59_662_000, 11632) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(4)) + } + /// Storage: Timestamp Now (r:1 w:0) + /// Proof: Timestamp Now (max_values: Some(1), max_size: Some(8), added: 503, mode: MaxEncodedLen) + /// Storage: Deposit Deposits (r:1 w:1) + /// Proof: Deposit Deposits (max_values: None, max_size: Some(853), added: 3328, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(116), added: 2591, mode: MaxEncodedLen) + fn claim() -> Weight { + // Proof Size summary in bytes: + // Measured: `3002` + // Estimated: `6422` + // Minimum execution time: 74_713 nanoseconds. + Weight::from_parts(74_713_000, 6422) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: Deposit Deposits (r:1 w:1) + /// Proof: Deposit Deposits (max_values: None, max_size: Some(853), added: 3328, mode: MaxEncodedLen) + /// Storage: Timestamp Now (r:1 w:0) + /// Proof: Timestamp Now (max_values: Some(1), max_size: Some(8), added: 503, mode: MaxEncodedLen) + /// Storage: Assets Account (r:1 w:1) + /// Proof: Assets Account (max_values: None, max_size: Some(94), added: 2569, mode: MaxEncodedLen) + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(166), added: 2641, mode: MaxEncodedLen) + fn claim_with_penalty() -> Weight { + // Proof Size summary in bytes: + // Measured: `2479` + // Estimated: `9041` + // Minimum execution time: 42_715 nanoseconds. + Weight::from_parts(42_715_000, 9041) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(3)) + } +} diff --git a/runtime/darwinia/Cargo.toml b/runtime/darwinia/Cargo.toml index 40c7ee032..fa648f7f1 100644 --- a/runtime/darwinia/Cargo.toml +++ b/runtime/darwinia/Cargo.toml @@ -260,6 +260,7 @@ runtime-benchmarks = [ # darwinia "darwinia-common-runtime/runtime-benchmarks", + "darwinia-deposit/runtime-benchmarks", # darwinia-messages-substrate "bridge-runtime-common/runtime-benchmarks", diff --git a/runtime/darwinia/src/lib.rs b/runtime/darwinia/src/lib.rs index 1a87b6c85..43b5f9128 100644 --- a/runtime/darwinia/src/lib.rs +++ b/runtime/darwinia/src/lib.rs @@ -168,7 +168,12 @@ frame_support::construct_runtime! { #[cfg(feature = "runtime-benchmarks")] frame_benchmarking::define_benchmarks! { - // Substrate + // darwinia + [darwinia_deposit, Deposit] + // darwinia-messages-substrate + [pallet_bridge_grandpa, BridgeKusamaGrandpa] + [pallet_fee_market, CrabFeeMarket] + // substrate [cumulus_pallet_xcmp_queue, XcmpQueue] [frame_system, SystemBench::] [pallet_assets, Assets] @@ -189,9 +194,6 @@ frame_benchmarking::define_benchmarks! { [pallet_vesting, Vesting] [pallet_session, SessionBench::] [pallet_timestamp, Timestamp] - // Bridge - [pallet_bridge_grandpa, BridgeKusamaGrandpa] - [pallet_fee_market, CrabFeeMarket] } impl_self_contained_call!(); diff --git a/runtime/darwinia/src/pallets/mod.rs b/runtime/darwinia/src/pallets.rs similarity index 100% rename from runtime/darwinia/src/pallets/mod.rs rename to runtime/darwinia/src/pallets.rs diff --git a/runtime/darwinia/src/pallets/deposit.rs b/runtime/darwinia/src/pallets/deposit.rs index dbfd17088..adda459f0 100644 --- a/runtime/darwinia/src/pallets/deposit.rs +++ b/runtime/darwinia/src/pallets/deposit.rs @@ -49,5 +49,5 @@ impl darwinia_deposit::Config for Runtime { type MinLockingAmount = ConstU128; type Ring = Balances; type RuntimeEvent = RuntimeEvent; - type UnixTime = Timestamp; + type WeightInfo = weights::darwinia_deposit::WeightInfo; } diff --git a/runtime/darwinia/src/pallets/timestamp.rs b/runtime/darwinia/src/pallets/timestamp.rs index b18b2a162..4f8909931 100644 --- a/runtime/darwinia/src/pallets/timestamp.rs +++ b/runtime/darwinia/src/pallets/timestamp.rs @@ -23,6 +23,9 @@ impl pallet_timestamp::Config for Runtime { type MinimumPeriod = ConstU64<{ SLOT_DURATION / 2 }>; /// A timestamp: milliseconds since the unix epoch. type Moment = u64; + #[cfg(not(feature = "runtime-benchmarks"))] type OnTimestampSet = Aura; + #[cfg(feature = "runtime-benchmarks")] + type OnTimestampSet = (); type WeightInfo = weights::pallet_timestamp::WeightInfo; } diff --git a/runtime/darwinia/src/weights/mod.rs b/runtime/darwinia/src/weights.rs similarity index 98% rename from runtime/darwinia/src/weights/mod.rs rename to runtime/darwinia/src/weights.rs index 4580cd631..d5a785a96 100644 --- a/runtime/darwinia/src/weights/mod.rs +++ b/runtime/darwinia/src/weights.rs @@ -33,6 +33,7 @@ pub mod rocksdb_weights; pub use rocksdb_weights::constants::RocksDbWeight; pub mod cumulus_pallet_xcmp_queue; +pub mod darwinia_deposit; pub mod frame_system; pub mod pallet_assets; pub mod pallet_balances; diff --git a/runtime/darwinia/src/weights/darwinia_deposit.rs b/runtime/darwinia/src/weights/darwinia_deposit.rs new file mode 100644 index 000000000..9310b51d5 --- /dev/null +++ b/runtime/darwinia/src/weights/darwinia_deposit.rs @@ -0,0 +1,107 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `darwinia_deposit` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-02-22, STEPS: `2`, REPEAT: `1`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `inv.cafe`, CPU: `13th Gen Intel(R) Core(TM) i9-13900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("darwinia-local"), DB CACHE: 1024 + +// Executed Command: +// target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --chain +// darwinia-local +// --output +// runtime/darwinia/src/weights +// --extrinsic +// * +// --pallet +// darwinia-deposit + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `darwinia_deposit`. +pub struct WeightInfo(PhantomData); +impl darwinia_deposit::WeightInfo for WeightInfo { + /// Storage: Deposit Deposits (r:1 w:1) + /// Proof: Deposit Deposits (max_values: None, max_size: Some(853), added: 3328, mode: MaxEncodedLen) + /// Storage: Timestamp Now (r:1 w:0) + /// Proof: Timestamp Now (max_values: Some(1), max_size: Some(8), added: 503, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(116), added: 2591, mode: MaxEncodedLen) + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(166), added: 2641, mode: MaxEncodedLen) + /// Storage: Assets Account (r:1 w:1) + /// Proof: Assets Account (max_values: None, max_size: Some(94), added: 2569, mode: MaxEncodedLen) + fn lock() -> Weight { + // Proof Size summary in bytes: + // Measured: `3237` + // Estimated: `11632` + // Minimum execution time: 57_981 nanoseconds. + Weight::from_parts(57_981_000, 11632) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(4)) + } + /// Storage: Timestamp Now (r:1 w:0) + /// Proof: Timestamp Now (max_values: Some(1), max_size: Some(8), added: 503, mode: MaxEncodedLen) + /// Storage: Deposit Deposits (r:1 w:1) + /// Proof: Deposit Deposits (max_values: None, max_size: Some(853), added: 3328, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(116), added: 2591, mode: MaxEncodedLen) + fn claim() -> Weight { + // Proof Size summary in bytes: + // Measured: `2972` + // Estimated: `6422` + // Minimum execution time: 76_933 nanoseconds. + Weight::from_parts(76_933_000, 6422) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: Deposit Deposits (r:1 w:1) + /// Proof: Deposit Deposits (max_values: None, max_size: Some(853), added: 3328, mode: MaxEncodedLen) + /// Storage: Timestamp Now (r:1 w:0) + /// Proof: Timestamp Now (max_values: Some(1), max_size: Some(8), added: 503, mode: MaxEncodedLen) + /// Storage: Assets Account (r:1 w:1) + /// Proof: Assets Account (max_values: None, max_size: Some(94), added: 2569, mode: MaxEncodedLen) + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(166), added: 2641, mode: MaxEncodedLen) + fn claim_with_penalty() -> Weight { + // Proof Size summary in bytes: + // Measured: `2449` + // Estimated: `9041` + // Minimum execution time: 71_371 nanoseconds. + Weight::from_parts(71_371_000, 9041) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(3)) + } +} diff --git a/runtime/pangolin/Cargo.toml b/runtime/pangolin/Cargo.toml index b48121080..375cb0f66 100644 --- a/runtime/pangolin/Cargo.toml +++ b/runtime/pangolin/Cargo.toml @@ -243,7 +243,6 @@ std = [ "frame-benchmarking?/std", "frame-system-benchmarking?/std", "frame-try-runtime?/std", - ] runtime-benchmarks = [ @@ -258,6 +257,7 @@ runtime-benchmarks = [ # darwinia "darwinia-common-runtime/runtime-benchmarks", + "darwinia-deposit/runtime-benchmarks", # darwinia-messages-substrate "bridge-runtime-common/runtime-benchmarks", diff --git a/runtime/pangolin/src/lib.rs b/runtime/pangolin/src/lib.rs index a69f0e0d2..d415fd5de 100644 --- a/runtime/pangolin/src/lib.rs +++ b/runtime/pangolin/src/lib.rs @@ -170,7 +170,12 @@ frame_support::construct_runtime! { #[cfg(feature = "runtime-benchmarks")] frame_benchmarking::define_benchmarks! { - // Substrate + // darwinia + [darwinia_deposit, Deposit] + // darwinia-messages-substrate + [pallet_bridge_grandpa, BridgeMoonbaseGrandpa] + [pallet_fee_market, PangoroFeeMarket] + // substrate [cumulus_pallet_xcmp_queue, XcmpQueue] [frame_system, SystemBench::] [pallet_assets, Assets] @@ -191,9 +196,6 @@ frame_benchmarking::define_benchmarks! { [pallet_vesting, Vesting] [pallet_session, SessionBench::] [pallet_timestamp, Timestamp] - // Bridge - [pallet_bridge_grandpa, BridgeMoonbaseGrandpa] - [pallet_fee_market, PangoroFeeMarket] } impl_self_contained_call!(); diff --git a/runtime/pangolin/src/pallets/mod.rs b/runtime/pangolin/src/pallets.rs similarity index 100% rename from runtime/pangolin/src/pallets/mod.rs rename to runtime/pangolin/src/pallets.rs diff --git a/runtime/pangolin/src/pallets/deposit.rs b/runtime/pangolin/src/pallets/deposit.rs index 9b60262fe..c221225a9 100644 --- a/runtime/pangolin/src/pallets/deposit.rs +++ b/runtime/pangolin/src/pallets/deposit.rs @@ -49,5 +49,5 @@ impl darwinia_deposit::Config for Runtime { type MinLockingAmount = ConstU128; type Ring = Balances; type RuntimeEvent = RuntimeEvent; - type UnixTime = Timestamp; + type WeightInfo = weights::darwinia_deposit::WeightInfo; } diff --git a/runtime/pangolin/src/pallets/timestamp.rs b/runtime/pangolin/src/pallets/timestamp.rs index b18b2a162..4f8909931 100644 --- a/runtime/pangolin/src/pallets/timestamp.rs +++ b/runtime/pangolin/src/pallets/timestamp.rs @@ -23,6 +23,9 @@ impl pallet_timestamp::Config for Runtime { type MinimumPeriod = ConstU64<{ SLOT_DURATION / 2 }>; /// A timestamp: milliseconds since the unix epoch. type Moment = u64; + #[cfg(not(feature = "runtime-benchmarks"))] type OnTimestampSet = Aura; + #[cfg(feature = "runtime-benchmarks")] + type OnTimestampSet = (); type WeightInfo = weights::pallet_timestamp::WeightInfo; } diff --git a/runtime/pangolin/src/weights/mod.rs b/runtime/pangolin/src/weights.rs similarity index 98% rename from runtime/pangolin/src/weights/mod.rs rename to runtime/pangolin/src/weights.rs index 4580cd631..d5a785a96 100644 --- a/runtime/pangolin/src/weights/mod.rs +++ b/runtime/pangolin/src/weights.rs @@ -33,6 +33,7 @@ pub mod rocksdb_weights; pub use rocksdb_weights::constants::RocksDbWeight; pub mod cumulus_pallet_xcmp_queue; +pub mod darwinia_deposit; pub mod frame_system; pub mod pallet_assets; pub mod pallet_balances; diff --git a/runtime/pangolin/src/weights/darwinia_deposit.rs b/runtime/pangolin/src/weights/darwinia_deposit.rs new file mode 100644 index 000000000..3280fd2ff --- /dev/null +++ b/runtime/pangolin/src/weights/darwinia_deposit.rs @@ -0,0 +1,107 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `darwinia_deposit` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-02-22, STEPS: `2`, REPEAT: `1`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `inv.cafe`, CPU: `13th Gen Intel(R) Core(TM) i9-13900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("pangolin-local"), DB CACHE: 1024 + +// Executed Command: +// target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --chain +// pangolin-local +// --output +// runtime/pangolin/src/weights +// --extrinsic +// * +// --pallet +// darwinia-deposit + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `darwinia_deposit`. +pub struct WeightInfo(PhantomData); +impl darwinia_deposit::WeightInfo for WeightInfo { + /// Storage: Deposit Deposits (r:1 w:1) + /// Proof: Deposit Deposits (max_values: None, max_size: Some(853), added: 3328, mode: MaxEncodedLen) + /// Storage: Timestamp Now (r:1 w:0) + /// Proof: Timestamp Now (max_values: Some(1), max_size: Some(8), added: 503, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(116), added: 2591, mode: MaxEncodedLen) + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(166), added: 2641, mode: MaxEncodedLen) + /// Storage: Assets Account (r:1 w:1) + /// Proof: Assets Account (max_values: None, max_size: Some(94), added: 2569, mode: MaxEncodedLen) + fn lock() -> Weight { + // Proof Size summary in bytes: + // Measured: `3208` + // Estimated: `11632` + // Minimum execution time: 60_242 nanoseconds. + Weight::from_parts(60_242_000, 11632) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(4)) + } + /// Storage: Timestamp Now (r:1 w:0) + /// Proof: Timestamp Now (max_values: Some(1), max_size: Some(8), added: 503, mode: MaxEncodedLen) + /// Storage: Deposit Deposits (r:1 w:1) + /// Proof: Deposit Deposits (max_values: None, max_size: Some(853), added: 3328, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(116), added: 2591, mode: MaxEncodedLen) + fn claim() -> Weight { + // Proof Size summary in bytes: + // Measured: `2906` + // Estimated: `6422` + // Minimum execution time: 84_038 nanoseconds. + Weight::from_parts(84_038_000, 6422) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: Deposit Deposits (r:1 w:1) + /// Proof: Deposit Deposits (max_values: None, max_size: Some(853), added: 3328, mode: MaxEncodedLen) + /// Storage: Timestamp Now (r:1 w:0) + /// Proof: Timestamp Now (max_values: Some(1), max_size: Some(8), added: 503, mode: MaxEncodedLen) + /// Storage: Assets Account (r:1 w:1) + /// Proof: Assets Account (max_values: None, max_size: Some(94), added: 2569, mode: MaxEncodedLen) + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(166), added: 2641, mode: MaxEncodedLen) + fn claim_with_penalty() -> Weight { + // Proof Size summary in bytes: + // Measured: `2420` + // Estimated: `9041` + // Minimum execution time: 50_070 nanoseconds. + Weight::from_parts(50_070_000, 9041) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(3)) + } +} diff --git a/runtime/pangoro/Cargo.toml b/runtime/pangoro/Cargo.toml index 8a18bf2e7..18e04d80b 100644 --- a/runtime/pangoro/Cargo.toml +++ b/runtime/pangoro/Cargo.toml @@ -258,6 +258,7 @@ runtime-benchmarks = [ # darwinia "darwinia-common-runtime/runtime-benchmarks", + "darwinia-deposit/runtime-benchmarks", # darwinia-messages-substrate "bridge-runtime-common/runtime-benchmarks", diff --git a/runtime/pangoro/src/lib.rs b/runtime/pangoro/src/lib.rs index 469dddea5..c26a02464 100644 --- a/runtime/pangoro/src/lib.rs +++ b/runtime/pangoro/src/lib.rs @@ -170,7 +170,12 @@ frame_support::construct_runtime! { #[cfg(feature = "runtime-benchmarks")] frame_benchmarking::define_benchmarks! { - // Substrate + // darwinia + [darwinia_deposit, Deposit] + // darwinia-messages-substrate + [pallet_bridge_grandpa, BridgeRococoGrandpa] + [pallet_fee_market, PangolinFeeMarket] + // substrate [cumulus_pallet_xcmp_queue, XcmpQueue] [frame_system, SystemBench::] [pallet_assets, Assets] @@ -191,9 +196,6 @@ frame_benchmarking::define_benchmarks! { [pallet_vesting, Vesting] [pallet_session, SessionBench::] [pallet_timestamp, Timestamp] - // Bridge - [pallet_bridge_grandpa, BridgeRococoGrandpa] - [pallet_fee_market, PangolinFeeMarket] } impl_self_contained_call!(); diff --git a/runtime/pangoro/src/pallets/mod.rs b/runtime/pangoro/src/pallets.rs similarity index 100% rename from runtime/pangoro/src/pallets/mod.rs rename to runtime/pangoro/src/pallets.rs diff --git a/runtime/pangoro/src/pallets/deposit.rs b/runtime/pangoro/src/pallets/deposit.rs index f20d43b53..28596810b 100644 --- a/runtime/pangoro/src/pallets/deposit.rs +++ b/runtime/pangoro/src/pallets/deposit.rs @@ -49,5 +49,5 @@ impl darwinia_deposit::Config for Runtime { type MinLockingAmount = ConstU128; type Ring = Balances; type RuntimeEvent = RuntimeEvent; - type UnixTime = Timestamp; + type WeightInfo = weights::darwinia_deposit::WeightInfo; } diff --git a/runtime/pangoro/src/pallets/timestamp.rs b/runtime/pangoro/src/pallets/timestamp.rs index b18b2a162..4f8909931 100644 --- a/runtime/pangoro/src/pallets/timestamp.rs +++ b/runtime/pangoro/src/pallets/timestamp.rs @@ -23,6 +23,9 @@ impl pallet_timestamp::Config for Runtime { type MinimumPeriod = ConstU64<{ SLOT_DURATION / 2 }>; /// A timestamp: milliseconds since the unix epoch. type Moment = u64; + #[cfg(not(feature = "runtime-benchmarks"))] type OnTimestampSet = Aura; + #[cfg(feature = "runtime-benchmarks")] + type OnTimestampSet = (); type WeightInfo = weights::pallet_timestamp::WeightInfo; } diff --git a/runtime/pangoro/src/weights/mod.rs b/runtime/pangoro/src/weights.rs similarity index 98% rename from runtime/pangoro/src/weights/mod.rs rename to runtime/pangoro/src/weights.rs index 4580cd631..d5a785a96 100644 --- a/runtime/pangoro/src/weights/mod.rs +++ b/runtime/pangoro/src/weights.rs @@ -33,6 +33,7 @@ pub mod rocksdb_weights; pub use rocksdb_weights::constants::RocksDbWeight; pub mod cumulus_pallet_xcmp_queue; +pub mod darwinia_deposit; pub mod frame_system; pub mod pallet_assets; pub mod pallet_balances; diff --git a/runtime/pangoro/src/weights/darwinia_deposit.rs b/runtime/pangoro/src/weights/darwinia_deposit.rs new file mode 100644 index 000000000..81b1defc6 --- /dev/null +++ b/runtime/pangoro/src/weights/darwinia_deposit.rs @@ -0,0 +1,107 @@ +// This file is part of Darwinia. +// +// Copyright (C) 2018-2023 Darwinia Network +// SPDX-License-Identifier: GPL-3.0 +// +// Darwinia is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Darwinia 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 Darwinia. If not, see . + +//! Autogenerated weights for `darwinia_deposit` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-02-22, STEPS: `2`, REPEAT: `1`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `inv.cafe`, CPU: `13th Gen Intel(R) Core(TM) i9-13900K` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("pangoro-local"), DB CACHE: 1024 + +// Executed Command: +// target/release/darwinia +// benchmark +// pallet +// --header +// .maintain/license-header +// --execution +// wasm +// --heap-pages +// 4096 +// --chain +// pangoro-local +// --output +// runtime/pangoro/src/weights +// --extrinsic +// * +// --pallet +// darwinia-deposit + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `darwinia_deposit`. +pub struct WeightInfo(PhantomData); +impl darwinia_deposit::WeightInfo for WeightInfo { + /// Storage: Deposit Deposits (r:1 w:1) + /// Proof: Deposit Deposits (max_values: None, max_size: Some(853), added: 3328, mode: MaxEncodedLen) + /// Storage: Timestamp Now (r:1 w:0) + /// Proof: Timestamp Now (max_values: Some(1), max_size: Some(8), added: 503, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(116), added: 2591, mode: MaxEncodedLen) + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(166), added: 2641, mode: MaxEncodedLen) + /// Storage: Assets Account (r:1 w:1) + /// Proof: Assets Account (max_values: None, max_size: Some(94), added: 2569, mode: MaxEncodedLen) + fn lock() -> Weight { + // Proof Size summary in bytes: + // Measured: `3237` + // Estimated: `11632` + // Minimum execution time: 50_430 nanoseconds. + Weight::from_parts(50_430_000, 11632) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(4)) + } + /// Storage: Timestamp Now (r:1 w:0) + /// Proof: Timestamp Now (max_values: Some(1), max_size: Some(8), added: 503, mode: MaxEncodedLen) + /// Storage: Deposit Deposits (r:1 w:1) + /// Proof: Deposit Deposits (max_values: None, max_size: Some(853), added: 3328, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(116), added: 2591, mode: MaxEncodedLen) + fn claim() -> Weight { + // Proof Size summary in bytes: + // Measured: `2972` + // Estimated: `6422` + // Minimum execution time: 86_362 nanoseconds. + Weight::from_parts(86_362_000, 6422) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: Deposit Deposits (r:1 w:1) + /// Proof: Deposit Deposits (max_values: None, max_size: Some(853), added: 3328, mode: MaxEncodedLen) + /// Storage: Timestamp Now (r:1 w:0) + /// Proof: Timestamp Now (max_values: Some(1), max_size: Some(8), added: 503, mode: MaxEncodedLen) + /// Storage: Assets Account (r:1 w:1) + /// Proof: Assets Account (max_values: None, max_size: Some(94), added: 2569, mode: MaxEncodedLen) + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(166), added: 2641, mode: MaxEncodedLen) + fn claim_with_penalty() -> Weight { + // Proof Size summary in bytes: + // Measured: `2449` + // Estimated: `9041` + // Minimum execution time: 44_408 nanoseconds. + Weight::from_parts(44_408_000, 9041) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(3)) + } +} From 31b79c58b3c0135d3be9875674e2f8ef08fc5a5d Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Fri, 24 Feb 2023 01:25:41 +0800 Subject: [PATCH 156/189] Auto load large genesis (#295) * Auto load large genesis * Remove unused feature * Format * Opt --- Cargo.lock | 465 +++++++++++++++++++++++++++++++- node/Cargo.toml | 2 + node/src/chain_spec/mod.rs | 41 ++- node/src/chain_spec/pangolin.rs | 2 +- node/src/command.rs | 10 +- 5 files changed, 509 insertions(+), 11 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4fec3ca1a..868e0c6ee 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1243,6 +1243,7 @@ dependencies = [ "encode_unicode", "lazy_static", "libc", + "unicode-width", "windows-sys 0.42.0", ] @@ -2365,6 +2366,8 @@ dependencies = [ "substrate-build-script-utils", "substrate-frame-rpc-system", "substrate-prometheus-endpoint", + "tokio", + "trauma", "try-runtime-cli", "xcm", ] @@ -2734,6 +2737,19 @@ dependencies = [ "sp-std", ] +[[package]] +name = "dashmap" +version = "5.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "907076dfda823b0b36d2a1bb5f90c96660a5bbcd7729e10727f07858f22c4edc" +dependencies = [ + "cfg-if", + "hashbrown 0.12.3", + "lock_api", + "once_cell", + "parking_lot_core 0.9.7", +] + [[package]] name = "data-encoding" version = "2.3.3" @@ -3104,6 +3120,15 @@ version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" +[[package]] +name = "encoding_rs" +version = "0.8.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071a31f4ee85403370b58aca746f01041ede6f0da2730960ad001edc2b71b394" +dependencies = [ + "cfg-if", +] + [[package]] name = "enum-as-inner" version = "0.5.1" @@ -3689,6 +3714,21 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + [[package]] name = "fork-tree" version = "3.0.0" @@ -4596,6 +4636,19 @@ dependencies = [ "tokio-rustls", ] +[[package]] +name = "hyper-tls" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" +dependencies = [ + "bytes", + "hyper", + "native-tls", + "tokio", + "tokio-native-tls", +] + [[package]] name = "iana-time-zone" version = "0.1.53" @@ -4734,6 +4787,18 @@ dependencies = [ "serde", ] +[[package]] +name = "indicatif" +version = "0.17.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cef509aa9bc73864d6756f0d34d35504af3cf0844373afe9b8669a5b8005a729" +dependencies = [ + "console", + "number_prefix", + "portable-atomic", + "unicode-width", +] + [[package]] name = "instant" version = "0.1.12" @@ -5916,6 +5981,22 @@ dependencies = [ "zeroize", ] +[[package]] +name = "mime" +version = "0.3.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" + +[[package]] +name = "mime_guess" +version = "2.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4192263c238a5f0d0c6bfd21f336a313a4ce1c450542449ca191bb657b4642ef" +dependencies = [ + "mime", + "unicase", +] + [[package]] name = "minimal-lexical" version = "0.2.1" @@ -6129,6 +6210,24 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a51313c5820b0b02bd422f4b44776fbf47961755c74ce64afc73bfad10226c3" +[[package]] +name = "native-tls" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e" +dependencies = [ + "lazy_static", + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", +] + [[package]] name = "netlink-packet-core" version = "0.4.2" @@ -6244,6 +6343,16 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "61807f77802ff30975e01f4f071c8ba10c022052f98b3294119f3e615d13e5be" +[[package]] +name = "nu-ansi-term" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" +dependencies = [ + "overload", + "winapi", +] + [[package]] name = "num" version = "0.4.0" @@ -6362,6 +6471,12 @@ dependencies = [ "syn", ] +[[package]] +name = "number_prefix" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" + [[package]] name = "object" version = "0.29.0" @@ -6419,12 +6534,116 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" +[[package]] +name = "openssl" +version = "0.10.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b102428fd03bc5edf97f62620f7298614c45cedf287c271e7ed450bbaf83f2e1" +dependencies = [ + "bitflags", + "cfg-if", + "foreign-types", + "libc", + "once_cell", + "openssl-macros", + "openssl-sys", +] + +[[package]] +name = "openssl-macros" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b501e44f11665960c7e7fcf062c7d96a14ade4aa98116c004b2e37b5be7d736c" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "openssl-probe" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" +[[package]] +name = "openssl-sys" +version = "0.9.80" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23bbbf7854cd45b83958ebe919f0e8e516793727652e27fda10a8384cfc790b7" +dependencies = [ + "autocfg", + "cc", + "libc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "opentelemetry" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6105e89802af13fdf48c49d7646d3b533a70e536d818aae7e78ba0433d01acb8" +dependencies = [ + "async-trait", + "crossbeam-channel", + "futures-channel", + "futures-executor", + "futures-util", + "js-sys", + "lazy_static", + "percent-encoding", + "pin-project", + "rand 0.8.5", + "thiserror", +] + +[[package]] +name = "opentelemetry" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69d6c3d7288a106c0a363e4b0e8d308058d56902adefb16f4936f417ffef086e" +dependencies = [ + "opentelemetry_api", + "opentelemetry_sdk", +] + +[[package]] +name = "opentelemetry_api" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c24f96e21e7acc813c7a8394ee94978929db2bcc46cf6b5014fc612bf7760c22" +dependencies = [ + "fnv", + "futures-channel", + "futures-util", + "indexmap", + "js-sys", + "once_cell", + "pin-project-lite 0.2.9", + "thiserror", +] + +[[package]] +name = "opentelemetry_sdk" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ca41c4933371b61c2a2f214bf16931499af4ec90543604ec828f7a625c09113" +dependencies = [ + "async-trait", + "crossbeam-channel", + "dashmap", + "fnv", + "futures-channel", + "futures-executor", + "futures-util", + "once_cell", + "opentelemetry_api", + "percent-encoding", + "rand 0.8.5", + "thiserror", +] + [[package]] name = "orchestra" version = "0.0.4" @@ -6502,6 +6721,12 @@ version = "6.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b7820b9daea5457c9f21c69448905d723fbd21136ccf521748f23fd49e723ee" +[[package]] +name = "overload" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" + [[package]] name = "p256" version = "0.11.1" @@ -9372,6 +9597,12 @@ dependencies = [ "universal-hash", ] +[[package]] +name = "portable-atomic" +version = "0.3.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26f6a7b87c2e435a3241addceeeff740ff8b7e76b74c13bf9acb17fa454ea00b" + [[package]] name = "ppv-lite86" version = "0.2.17" @@ -9963,6 +10194,97 @@ dependencies = [ "winapi", ] +[[package]] +name = "reqwest" +version = "0.11.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21eed90ec8570952d53b772ecf8f206aa1ec9a3d76b2521c56c42973f2d91ee9" +dependencies = [ + "base64 0.21.0", + "bytes", + "encoding_rs", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "hyper", + "hyper-tls", + "ipnet", + "js-sys", + "log", + "mime", + "mime_guess", + "native-tls", + "once_cell", + "percent-encoding", + "pin-project-lite 0.2.9", + "serde", + "serde_json", + "serde_urlencoded", + "tokio", + "tokio-native-tls", + "tokio-socks", + "tokio-util", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "wasm-streams", + "web-sys", + "winreg", +] + +[[package]] +name = "reqwest-middleware" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a1c03e9011a8c59716ad13115550469e081e2e9892656b0ba6a47c907921894" +dependencies = [ + "anyhow", + "async-trait", + "http", + "reqwest", + "serde", + "task-local-extensions", + "thiserror", +] + +[[package]] +name = "reqwest-retry" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db161043fcfae3bdf30768bb1fa833853cd55ddf2411b1acb03e0c72bf86a9ea" +dependencies = [ + "anyhow", + "async-trait", + "chrono", + "futures", + "http", + "hyper", + "reqwest", + "reqwest-middleware", + "retry-policies", + "task-local-extensions", + "tokio", + "tracing", +] + +[[package]] +name = "reqwest-tracing" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b739d87a6b2cf4743968ad2b4cef648fbe0204c19999509824425babb2097bce" +dependencies = [ + "async-trait", + "opentelemetry 0.17.0", + "reqwest", + "reqwest-middleware", + "task-local-extensions", + "tracing", + "tracing-opentelemetry 0.17.4", +] + [[package]] name = "resolv-conf" version = "0.7.0" @@ -9973,6 +10295,17 @@ dependencies = [ "quick-error", ] +[[package]] +name = "retry-policies" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e09bbcb5003282bcb688f0bae741b278e9c7e8f378f561522c9806c58e075d9b" +dependencies = [ + "anyhow", + "chrono", + "rand 0.8.5", +] + [[package]] name = "rfc6979" version = "0.3.1" @@ -11324,7 +11657,7 @@ dependencies = [ "thiserror", "tracing", "tracing-log", - "tracing-subscriber", + "tracing-subscriber 0.2.25", ] [[package]] @@ -11619,6 +11952,18 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + [[package]] name = "sha-1" version = "0.9.8" @@ -12454,7 +12799,7 @@ dependencies = [ "sp-std", "tracing", "tracing-core", - "tracing-subscriber", + "tracing-subscriber 0.2.25", ] [[package]] @@ -12913,6 +13258,15 @@ version = "0.12.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ae9980cab1db3fceee2f6c6f643d5d8de2997c58ee8d25fb0cc8a9e9e7348e5" +[[package]] +name = "task-local-extensions" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4167afbec18ae012de40f8cf1b9bf48420abb390678c34821caa07d924941cc4" +dependencies = [ + "tokio", +] + [[package]] name = "tempfile" version = "3.3.0" @@ -13143,6 +13497,16 @@ dependencies = [ "syn", ] +[[package]] +name = "tokio-native-tls" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" +dependencies = [ + "native-tls", + "tokio", +] + [[package]] name = "tokio-rustls" version = "0.23.4" @@ -13154,6 +13518,18 @@ dependencies = [ "webpki 0.22.0", ] +[[package]] +name = "tokio-socks" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51165dfa029d2a65969413a6cc96f354b86b464498702f174a4efa13608fd8c0" +dependencies = [ + "either", + "futures-util", + "thiserror", + "tokio", +] + [[package]] name = "tokio-stream" version = "0.1.12" @@ -13326,6 +13702,34 @@ dependencies = [ "tracing-core", ] +[[package]] +name = "tracing-opentelemetry" +version = "0.17.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbbe89715c1dbbb790059e2565353978564924ee85017b5fff365c872ff6721f" +dependencies = [ + "once_cell", + "opentelemetry 0.17.0", + "tracing", + "tracing-core", + "tracing-log", + "tracing-subscriber 0.3.16", +] + +[[package]] +name = "tracing-opentelemetry" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21ebb87a95ea13271332df069020513ab70bdb5637ca42d6e492dc3bbbad48de" +dependencies = [ + "once_cell", + "opentelemetry 0.18.0", + "tracing", + "tracing-core", + "tracing-log", + "tracing-subscriber 0.3.16", +] + [[package]] name = "tracing-serde" version = "0.1.3" @@ -13359,6 +13763,41 @@ dependencies = [ "tracing-serde", ] +[[package]] +name = "tracing-subscriber" +version = "0.3.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6176eae26dd70d0c919749377897b54a9276bd7061339665dd68777926b5a70" +dependencies = [ + "nu-ansi-term", + "sharded-slab", + "smallvec", + "thread_local", + "tracing-core", + "tracing-log", +] + +[[package]] +name = "trauma" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02aa517841c36bca47afb504d3e02439626919b4c963f221807777c4a2b9c1a8" +dependencies = [ + "form_urlencoded", + "futures", + "indicatif", + "reqwest", + "reqwest-middleware", + "reqwest-retry", + "reqwest-tracing", + "task-local-extensions", + "thiserror", + "tokio", + "tracing", + "tracing-opentelemetry 0.18.0", + "tracing-subscriber 0.3.16", +] + [[package]] name = "trie-db" version = "0.24.0" @@ -13544,6 +13983,15 @@ dependencies = [ "static_assertions", ] +[[package]] +name = "unicase" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6" +dependencies = [ + "version_check", +] + [[package]] name = "unicode-bidi" version = "0.3.10" @@ -13825,6 +14273,19 @@ dependencies = [ "regex", ] +[[package]] +name = "wasm-streams" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6bbae3363c08332cadccd13b67db371814cd214c2524020932f0804b8cf7c078" +dependencies = [ + "futures-util", + "js-sys", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + [[package]] name = "wasm-timer" version = "0.2.5" diff --git a/node/Cargo.toml b/node/Cargo.toml index 472e6df3e..b7ee6fa6b 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -19,6 +19,8 @@ futures = { version = "0.3" } jsonrpsee = { version = "0.16", features = ["server"] } log = { version = "0.4" } serde = { version = "1.0", features = ["derive"] } +tokio = { version = "1.25" } +trauma = { version = "2.2" } # cumulus cumulus-client-cli = { workspace = true } diff --git a/node/src/chain_spec/mod.rs b/node/src/chain_spec/mod.rs index 11f5e099c..8855326f5 100644 --- a/node/src/chain_spec/mod.rs +++ b/node/src/chain_spec/mod.rs @@ -59,16 +59,20 @@ mod testnet_keys { #[cfg(any(feature = "pangolin-native", feature = "pangoro-native"))] use testnet_keys::*; +// std +use std::{env, thread}; // crates.io -use serde::{Deserialize, Serialize}; +use serde::{de::DeserializeOwned, Deserialize, Serialize}; +use tokio::runtime::Runtime as TokioRuntime; +use trauma::{download::Download, downloader::DownloaderBuilder}; // substrate -use sc_chain_spec::{ChainSpecExtension, ChainSpecGroup, Properties}; +use sc_chain_spec::{ChainSpecExtension, ChainSpecGroup, GenericChainSpec, Properties}; use sp_consensus_aura::sr25519::AuthorityId as AuraId; use sp_core::{Pair, Public}; // Dummy chain spec, in case when we don't have the native runtime. #[allow(unused)] -pub type DummyChainSpec = sc_service::GenericChainSpec<(), Extensions>; +pub type DummyChainSpec = sc_chain_spec::GenericChainSpec<(), Extensions>; const ALITH: &str = "0xf24FF3a9CF04c71Dbc94D0b566f7A27B94566cac"; const BALTATHAR: &str = "0x3Cd0A705a2DC65e5b1E1205896BaA2be8A07c6e0"; @@ -120,3 +124,34 @@ fn get_from_seed(seed: &str) -> ::Public .expect("static values are valid; qed") .public() } + +fn load_config(name: &'static str) -> GenericChainSpec +where + E: DeserializeOwned, +{ + let d = env::current_exe().unwrap().parent().unwrap().to_path_buf(); + let p = d.join(name); + + if !p.is_file() { + println!("Downloading `{name}` to `{}`", d.display()); + + thread::spawn(move || { + TokioRuntime::new().unwrap().block_on( + DownloaderBuilder::new().directory(d).build().download(&[Download::try_from( + format!( + "https://github.com/darwinia-network/darwinia-2.0/releases/download/{}/{name}", + name.strip_suffix(".json").unwrap() + ) + .as_str(), + ) + .unwrap()]), + ); + }) + .join() + .unwrap(); + } + + println!("Loading genesis from `{}`", p.display()); + + GenericChainSpec::from_json_file(p).unwrap() +} diff --git a/node/src/chain_spec/pangolin.rs b/node/src/chain_spec/pangolin.rs index ae54ff451..84f70bdc5 100644 --- a/node/src/chain_spec/pangolin.rs +++ b/node/src/chain_spec/pangolin.rs @@ -262,7 +262,7 @@ pub fn genesis_config() -> ChainSpec { } pub fn config() -> ChainSpec { - unimplemented!("TODO") + load_config("pangolin2.json") } fn testnet_genesis( diff --git a/node/src/command.rs b/node/src/command.rs index ef676a400..1a11952a3 100644 --- a/node/src/command.rs +++ b/node/src/command.rs @@ -35,12 +35,12 @@ use fc_db::frontier_database_dir; // substrate use frame_benchmarking_cli::{BenchmarkCmd, SUBSTRATE_REFERENCE_HARDWARE}; use sc_cli::{ - ChainSpec, CliConfiguration, DefaultConfigurationValues, ImportParams, KeystoreParams, - NetworkParams, Result, RuntimeVersion, SharedParams, SubstrateCli, + CliConfiguration, DefaultConfigurationValues, ImportParams, KeystoreParams, NetworkParams, + Result, RuntimeVersion, SharedParams, SubstrateCli, }; use sc_service::{ config::{BasePath, PrometheusConfig}, - DatabaseSource, PartialComponents, + ChainSpec, DatabaseSource, PartialComponents, }; use sp_core::{crypto::Ss58AddressFormatRegistry, hexdisplay::HexDisplay}; use sp_runtime::traits::{AccountIdConversion, Block as BlockT}; @@ -76,7 +76,7 @@ impl SubstrateCli for Cli { 2018 } - fn load_spec(&self, id: &str) -> std::result::Result, String> { + fn load_spec(&self, id: &str) -> std::result::Result, String> { load_spec(id) } @@ -138,7 +138,7 @@ impl SubstrateCli for RelayChainCli { 2018 } - fn load_spec(&self, id: &str) -> std::result::Result, String> { + fn load_spec(&self, id: &str) -> std::result::Result, String> { polkadot_cli::Cli::from_iter([RelayChainCli::executable_name()].iter()).load_spec(id) } From 3ae132afb0e5db96f132b260f24e95f4253b00d1 Mon Sep 17 00:00:00 2001 From: bear Date: Fri, 24 Feb 2023 10:32:06 +0800 Subject: [PATCH 157/189] Fix broken CI (#296) * Try fix * Fix it! --- tests/ethereum/test-balance.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/tests/ethereum/test-balance.ts b/tests/ethereum/test-balance.ts index 89ccb387d..f53fa0223 100644 --- a/tests/ethereum/test-balance.ts +++ b/tests/ethereum/test-balance.ts @@ -2,19 +2,18 @@ import Web3 from "web3"; import { describe } from "mocha"; import { step } from "mocha-steps"; import { expect } from "chai"; -import { HOST_HTTP_URL, FAITH, FAITH_P } from "../config"; +import { HOST_HTTP_URL, FAITH, FAITH_P, ALITH } from "../config"; const web3 = new Web3(HOST_HTTP_URL); describe("Test balances", () => { const VALUE = "0x200"; - const TO = "0x1111111111111111111111111111111111111111"; const GAS_PRICE = "0x3B9ACA00"; // 1000000000 let init_from; let init_to; - it("Account has correct balance", async function () { + step("Account has correct balance", async function () { init_from = await web3.eth.getBalance(FAITH); - init_to = await web3.eth.getBalance(TO); + init_to = await web3.eth.getBalance(ALITH); expect(Number(init_from)).to.be.greaterThan(Number(VALUE)); }); @@ -23,7 +22,7 @@ describe("Test balances", () => { let tx = await web3.eth.accounts.signTransaction( { from: FAITH, - to: TO, + to: ALITH, value: VALUE, gasPrice: GAS_PRICE, gas: "0x100000", @@ -42,6 +41,6 @@ describe("Test balances", () => { const expectedToBalance = (BigInt(init_to) + BigInt(VALUE)).toString(); expect(await web3.eth.getBalance(FAITH)).to.equal(expectedFromBalance); - expect(await web3.eth.getBalance(TO)).to.equal(expectedToBalance); + expect(await web3.eth.getBalance(ALITH)).to.equal(expectedToBalance); }); }); From 0f93b3246fd6223133ee97d605325b8b809cf46e Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Fri, 24 Feb 2023 15:10:35 +0800 Subject: [PATCH 158/189] Remove multisig (#299) --- Cargo.lock | 6 +- Cargo.toml | 2 - runtime/crab/Cargo.toml | 4 - runtime/crab/src/lib.rs | 2 - runtime/crab/src/pallets.rs | 2 - runtime/crab/src/pallets/multisig.rs | 32 ----- runtime/crab/src/pallets/proxy.rs | 1 - runtime/crab/src/weights.rs | 1 - runtime/crab/src/weights/pallet_multisig.rs | 128 ----------------- runtime/darwinia/Cargo.toml | 4 - runtime/darwinia/src/lib.rs | 2 - runtime/darwinia/src/pallets.rs | 2 - runtime/darwinia/src/pallets/multisig.rs | 32 ----- runtime/darwinia/src/pallets/proxy.rs | 1 - runtime/darwinia/src/weights.rs | 1 - .../darwinia/src/weights/pallet_multisig.rs | 128 ----------------- runtime/pangolin/Cargo.toml | 4 - runtime/pangolin/src/lib.rs | 2 - runtime/pangolin/src/pallets.rs | 2 - runtime/pangolin/src/pallets/multisig.rs | 32 ----- runtime/pangolin/src/pallets/proxy.rs | 1 - runtime/pangolin/src/weights.rs | 1 - .../pangolin/src/weights/pallet_multisig.rs | 130 ------------------ runtime/pangoro/Cargo.toml | 4 - runtime/pangoro/src/lib.rs | 2 - runtime/pangoro/src/pallets.rs | 2 - runtime/pangoro/src/pallets/multisig.rs | 32 ----- runtime/pangoro/src/pallets/proxy.rs | 1 - runtime/pangoro/src/weights.rs | 1 - .../pangoro/src/weights/pallet_multisig.rs | 130 ------------------ 30 files changed, 1 insertion(+), 691 deletions(-) delete mode 100644 runtime/crab/src/pallets/multisig.rs delete mode 100644 runtime/crab/src/weights/pallet_multisig.rs delete mode 100644 runtime/darwinia/src/pallets/multisig.rs delete mode 100644 runtime/darwinia/src/weights/pallet_multisig.rs delete mode 100644 runtime/pangolin/src/pallets/multisig.rs delete mode 100644 runtime/pangolin/src/weights/pallet_multisig.rs delete mode 100644 runtime/pangoro/src/pallets/multisig.rs delete mode 100644 runtime/pangoro/src/weights/pallet_multisig.rs diff --git a/Cargo.lock b/Cargo.lock index 868e0c6ee..a4d6bd7cd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1398,7 +1398,6 @@ dependencies = [ "pallet-fee-market", "pallet-identity", "pallet-membership", - "pallet-multisig", "pallet-preimage", "pallet-proxy", "pallet-scheduler", @@ -2673,7 +2672,6 @@ dependencies = [ "pallet-fee-market", "pallet-identity", "pallet-membership", - "pallet-multisig", "pallet-preimage", "pallet-proxy", "pallet-scheduler", @@ -7389,7 +7387,7 @@ dependencies = [ [[package]] name = "pallet-multisig" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.37#f38bd6671d460293c93062cc1e4fe9e9e490cb29" dependencies = [ "frame-benchmarking", "frame-support", @@ -7972,7 +7970,6 @@ dependencies = [ "pallet-fee-market", "pallet-identity", "pallet-membership", - "pallet-multisig", "pallet-preimage", "pallet-proxy", "pallet-scheduler", @@ -8075,7 +8072,6 @@ dependencies = [ "pallet-fee-market", "pallet-identity", "pallet-membership", - "pallet-multisig", "pallet-preimage", "pallet-proxy", "pallet-scheduler", diff --git a/Cargo.toml b/Cargo.toml index 39c146b15..bed125e81 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -135,7 +135,6 @@ pallet-democracy = { default-features = false, git = " pallet-elections-phragmen = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } pallet-identity = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } pallet-membership = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } -pallet-multisig = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } pallet-preimage = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } pallet-proxy = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } pallet-scheduler = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } @@ -235,7 +234,6 @@ pallet-im-online = { git = "https://github.com/darw pallet-indices = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } pallet-membership = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } pallet-mmr = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -pallet-multisig = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } pallet-nis = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } pallet-nomination-pools = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } pallet-nomination-pools-benchmarking = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } diff --git a/runtime/crab/Cargo.toml b/runtime/crab/Cargo.toml index 5646a09a9..b28d439ca 100644 --- a/runtime/crab/Cargo.toml +++ b/runtime/crab/Cargo.toml @@ -94,7 +94,6 @@ pallet-democracy = { workspace = true } pallet-elections-phragmen = { workspace = true } pallet-identity = { workspace = true } pallet-membership = { workspace = true } -pallet-multisig = { workspace = true } pallet-preimage = { workspace = true } pallet-proxy = { workspace = true } pallet-scheduler = { workspace = true } @@ -214,7 +213,6 @@ std = [ "pallet-elections-phragmen/std", "pallet-membership/std", "pallet-identity/std", - "pallet-multisig/std", "pallet-preimage/std", "pallet-proxy/std", "pallet-scheduler/std", @@ -292,7 +290,6 @@ runtime-benchmarks = [ "pallet-elections-phragmen/runtime-benchmarks", "pallet-membership/runtime-benchmarks", "pallet-identity/runtime-benchmarks", - "pallet-multisig/runtime-benchmarks", "pallet-preimage/runtime-benchmarks", "pallet-proxy/runtime-benchmarks", "pallet-scheduler/runtime-benchmarks", @@ -353,7 +350,6 @@ try-runtime = [ "pallet-elections-phragmen/try-runtime", "pallet-membership/try-runtime", "pallet-identity/try-runtime", - "pallet-multisig/try-runtime", "pallet-preimage/try-runtime", "pallet-proxy/try-runtime", "pallet-scheduler/try-runtime", diff --git a/runtime/crab/src/lib.rs b/runtime/crab/src/lib.rs index 98b5f36f6..ef5745483 100644 --- a/runtime/crab/src/lib.rs +++ b/runtime/crab/src/lib.rs @@ -144,7 +144,6 @@ frame_support::construct_runtime! { Scheduler: pallet_scheduler = 28, Preimage: pallet_preimage = 29, Proxy: pallet_proxy = 30, - Multisig: pallet_multisig = 31, // XCM stuff. XcmpQueue: cumulus_pallet_xcmp_queue = 32, @@ -184,7 +183,6 @@ frame_benchmarking::define_benchmarks! { [pallet_elections_phragmen, PhragmenElection] [pallet_identity, Identity] [pallet_membership, TechnicalMembership] - [pallet_multisig, Multisig] [pallet_preimage, Preimage] [pallet_proxy, Proxy] [pallet_scheduler, Scheduler] diff --git a/runtime/crab/src/pallets.rs b/runtime/crab/src/pallets.rs index a82061ac6..541ef06c6 100644 --- a/runtime/crab/src/pallets.rs +++ b/runtime/crab/src/pallets.rs @@ -91,8 +91,6 @@ mod preimage; mod proxy; -mod multisig; - // XCM stuff. mod xcmp_queue; diff --git a/runtime/crab/src/pallets/multisig.rs b/runtime/crab/src/pallets/multisig.rs deleted file mode 100644 index d2e226434..000000000 --- a/runtime/crab/src/pallets/multisig.rs +++ /dev/null @@ -1,32 +0,0 @@ -// This file is part of Darwinia. -// -// Copyright (C) 2018-2023 Darwinia Network -// SPDX-License-Identifier: GPL-3.0 -// -// Darwinia is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// Darwinia 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 Darwinia. If not, see . - -// darwinia -use crate::*; - -impl pallet_multisig::Config for Runtime { - type Currency = Balances; - // One storage item; key size is 32; value is size 4+4+16+32 bytes = 56 bytes. - type DepositBase = ConstU128<{ darwinia_deposit(1, 88) }>; - // Additional storage item size of 32 bytes. - type DepositFactor = ConstU128<{ darwinia_deposit(0, 32) }>; - type MaxSignatories = ConstU32<100>; - type RuntimeCall = RuntimeCall; - type RuntimeEvent = RuntimeEvent; - type WeightInfo = weights::pallet_multisig::WeightInfo; -} diff --git a/runtime/crab/src/pallets/proxy.rs b/runtime/crab/src/pallets/proxy.rs index 3b0f76578..484ecf55a 100644 --- a/runtime/crab/src/pallets/proxy.rs +++ b/runtime/crab/src/pallets/proxy.rs @@ -62,7 +62,6 @@ impl frame_support::traits::InstanceFilter for ProxyType { // Might contains transfer { | RuntimeCall::Utility(..) | RuntimeCall::Proxy(..) - | RuntimeCall::Multisig(..) | RuntimeCall::PolkadotXcm(..) | RuntimeCall::Ethereum(..) // } ), diff --git a/runtime/crab/src/weights.rs b/runtime/crab/src/weights.rs index d5a785a96..1ad80ad60 100644 --- a/runtime/crab/src/weights.rs +++ b/runtime/crab/src/weights.rs @@ -45,7 +45,6 @@ pub mod pallet_elections_phragmen; pub mod pallet_fee_market; pub mod pallet_identity; pub mod pallet_membership; -pub mod pallet_multisig; pub mod pallet_preimage; pub mod pallet_proxy; pub mod pallet_scheduler; diff --git a/runtime/crab/src/weights/pallet_multisig.rs b/runtime/crab/src/weights/pallet_multisig.rs deleted file mode 100644 index 150af6e74..000000000 --- a/runtime/crab/src/weights/pallet_multisig.rs +++ /dev/null @@ -1,128 +0,0 @@ -// This file is part of Darwinia. -// -// Copyright (C) 2018-2023 Darwinia Network -// SPDX-License-Identifier: GPL-3.0 -// -// Darwinia is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// Darwinia 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 Darwinia. If not, see . - -//! Autogenerated weights for `pallet_multisig` -//! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-02-22, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("crab-local"), DB CACHE: 1024 - -// Executed Command: -// ./target/release/darwinia -// benchmark -// pallet -// --header -// .maintain/license-header -// --execution -// wasm -// --heap-pages -// 4096 -// --steps -// 2 -// --repeat -// 1 -// --chain -// crab-local -// --output -// runtime/crab/src/weights/ -// --extrinsic -// * -// --pallet -// * - -#![cfg_attr(rustfmt, rustfmt_skip)] -#![allow(unused_parens)] -#![allow(unused_imports)] - -use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; - -/// Weight functions for `pallet_multisig`. -pub struct WeightInfo(PhantomData); -impl pallet_multisig::WeightInfo for WeightInfo { - /// The range of component `z` is `[0, 10000]`. - fn as_multi_threshold_1(_z: u32, ) -> Weight { - // Minimum execution time: 30_147 nanoseconds. - Weight::from_ref_time(40_302_000) - } - // Storage: Multisig Multisigs (r:1 w:1) - // Storage: unknown [0x3a65787472696e7369635f696e646578] (r:1 w:0) - /// The range of component `s` is `[2, 100]`. - /// The range of component `z` is `[0, 10000]`. - fn as_multi_create(_s: u32, z: u32, ) -> Weight { - // Minimum execution time: 67_837 nanoseconds. - Weight::from_ref_time(80_600_775) - // Standard Error: 105 - .saturating_add(Weight::from_ref_time(966).saturating_mul(z.into())) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(1)) - } - // Storage: Multisig Multisigs (r:1 w:1) - /// The range of component `s` is `[3, 100]`. - /// The range of component `z` is `[0, 10000]`. - fn as_multi_approve(s: u32, z: u32, ) -> Weight { - // Minimum execution time: 35_866 nanoseconds. - Weight::from_ref_time(28_035_587) - // Standard Error: 20_918 - .saturating_add(Weight::from_ref_time(78_304).saturating_mul(s.into())) - // Standard Error: 202 - .saturating_add(Weight::from_ref_time(994).saturating_mul(z.into())) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } - // Storage: Multisig Multisigs (r:1 w:1) - // Storage: System Account (r:1 w:1) - /// The range of component `s` is `[2, 100]`. - /// The range of component `z` is `[0, 10000]`. - fn as_multi_complete(s: u32, z: u32, ) -> Weight { - // Minimum execution time: 49_688 nanoseconds. - Weight::from_ref_time(45_614_020) - // Standard Error: 7_272 - .saturating_add(Weight::from_ref_time(40_739).saturating_mul(s.into())) - // Standard Error: 71 - .saturating_add(Weight::from_ref_time(1_237).saturating_mul(z.into())) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(2)) - } - // Storage: Multisig Multisigs (r:1 w:1) - // Storage: unknown [0x3a65787472696e7369635f696e646578] (r:1 w:0) - /// The range of component `s` is `[2, 100]`. - fn approve_as_multi_create(_s: u32, ) -> Weight { - // Minimum execution time: 50_716 nanoseconds. - Weight::from_ref_time(73_678_000) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(1)) - } - // Storage: Multisig Multisigs (r:1 w:1) - /// The range of component `s` is `[2, 100]`. - fn approve_as_multi_approve(_s: u32, ) -> Weight { - // Minimum execution time: 26_779 nanoseconds. - Weight::from_ref_time(36_380_000) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } - // Storage: Multisig Multisigs (r:1 w:1) - /// The range of component `s` is `[2, 100]`. - fn cancel_as_multi(_s: u32, ) -> Weight { - // Minimum execution time: 36_523 nanoseconds. - Weight::from_ref_time(52_074_000) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } -} diff --git a/runtime/darwinia/Cargo.toml b/runtime/darwinia/Cargo.toml index fa648f7f1..15fdf3819 100644 --- a/runtime/darwinia/Cargo.toml +++ b/runtime/darwinia/Cargo.toml @@ -94,7 +94,6 @@ pallet-democracy = { workspace = true } pallet-elections-phragmen = { workspace = true } pallet-identity = { workspace = true } pallet-membership = { workspace = true } -pallet-multisig = { workspace = true } pallet-preimage = { workspace = true } pallet-proxy = { workspace = true } pallet-scheduler = { workspace = true } @@ -214,7 +213,6 @@ std = [ "pallet-elections-phragmen/std", "pallet-membership/std", "pallet-identity/std", - "pallet-multisig/std", "pallet-preimage/std", "pallet-proxy/std", "pallet-scheduler/std", @@ -293,7 +291,6 @@ runtime-benchmarks = [ "pallet-elections-phragmen/runtime-benchmarks", "pallet-membership/runtime-benchmarks", "pallet-identity/runtime-benchmarks", - "pallet-multisig/runtime-benchmarks", "pallet-preimage/runtime-benchmarks", "pallet-proxy/runtime-benchmarks", "pallet-scheduler/runtime-benchmarks", @@ -354,7 +351,6 @@ try-runtime = [ "pallet-elections-phragmen/try-runtime", "pallet-membership/try-runtime", "pallet-identity/try-runtime", - "pallet-multisig/try-runtime", "pallet-preimage/try-runtime", "pallet-proxy/try-runtime", "pallet-scheduler/try-runtime", diff --git a/runtime/darwinia/src/lib.rs b/runtime/darwinia/src/lib.rs index 43b5f9128..24bc6d425 100644 --- a/runtime/darwinia/src/lib.rs +++ b/runtime/darwinia/src/lib.rs @@ -144,7 +144,6 @@ frame_support::construct_runtime! { Scheduler: pallet_scheduler = 28, Preimage: pallet_preimage = 29, Proxy: pallet_proxy = 30, - Multisig: pallet_multisig = 31, // XCM stuff. XcmpQueue: cumulus_pallet_xcmp_queue = 32, @@ -184,7 +183,6 @@ frame_benchmarking::define_benchmarks! { [pallet_elections_phragmen, PhragmenElection] [pallet_identity, Identity] [pallet_membership, TechnicalMembership] - [pallet_multisig, Multisig] [pallet_preimage, Preimage] [pallet_proxy, Proxy] [pallet_scheduler, Scheduler] diff --git a/runtime/darwinia/src/pallets.rs b/runtime/darwinia/src/pallets.rs index a82061ac6..541ef06c6 100644 --- a/runtime/darwinia/src/pallets.rs +++ b/runtime/darwinia/src/pallets.rs @@ -91,8 +91,6 @@ mod preimage; mod proxy; -mod multisig; - // XCM stuff. mod xcmp_queue; diff --git a/runtime/darwinia/src/pallets/multisig.rs b/runtime/darwinia/src/pallets/multisig.rs deleted file mode 100644 index d2e226434..000000000 --- a/runtime/darwinia/src/pallets/multisig.rs +++ /dev/null @@ -1,32 +0,0 @@ -// This file is part of Darwinia. -// -// Copyright (C) 2018-2023 Darwinia Network -// SPDX-License-Identifier: GPL-3.0 -// -// Darwinia is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// Darwinia 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 Darwinia. If not, see . - -// darwinia -use crate::*; - -impl pallet_multisig::Config for Runtime { - type Currency = Balances; - // One storage item; key size is 32; value is size 4+4+16+32 bytes = 56 bytes. - type DepositBase = ConstU128<{ darwinia_deposit(1, 88) }>; - // Additional storage item size of 32 bytes. - type DepositFactor = ConstU128<{ darwinia_deposit(0, 32) }>; - type MaxSignatories = ConstU32<100>; - type RuntimeCall = RuntimeCall; - type RuntimeEvent = RuntimeEvent; - type WeightInfo = weights::pallet_multisig::WeightInfo; -} diff --git a/runtime/darwinia/src/pallets/proxy.rs b/runtime/darwinia/src/pallets/proxy.rs index 39e8cb5c7..224146989 100644 --- a/runtime/darwinia/src/pallets/proxy.rs +++ b/runtime/darwinia/src/pallets/proxy.rs @@ -62,7 +62,6 @@ impl frame_support::traits::InstanceFilter for ProxyType { // Might contains transfer { | RuntimeCall::Utility(..) | RuntimeCall::Proxy(..) - | RuntimeCall::Multisig(..) | RuntimeCall::PolkadotXcm(..) | RuntimeCall::Ethereum(..) // } ), diff --git a/runtime/darwinia/src/weights.rs b/runtime/darwinia/src/weights.rs index d5a785a96..1ad80ad60 100644 --- a/runtime/darwinia/src/weights.rs +++ b/runtime/darwinia/src/weights.rs @@ -45,7 +45,6 @@ pub mod pallet_elections_phragmen; pub mod pallet_fee_market; pub mod pallet_identity; pub mod pallet_membership; -pub mod pallet_multisig; pub mod pallet_preimage; pub mod pallet_proxy; pub mod pallet_scheduler; diff --git a/runtime/darwinia/src/weights/pallet_multisig.rs b/runtime/darwinia/src/weights/pallet_multisig.rs deleted file mode 100644 index f8c783be0..000000000 --- a/runtime/darwinia/src/weights/pallet_multisig.rs +++ /dev/null @@ -1,128 +0,0 @@ -// This file is part of Darwinia. -// -// Copyright (C) 2018-2023 Darwinia Network -// SPDX-License-Identifier: GPL-3.0 -// -// Darwinia is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// Darwinia 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 Darwinia. If not, see . - -//! Autogenerated weights for `pallet_multisig` -//! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-02-22, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("darwinia-local"), DB CACHE: 1024 - -// Executed Command: -// ./target/release/darwinia -// benchmark -// pallet -// --header -// .maintain/license-header -// --execution -// wasm -// --heap-pages -// 4096 -// --steps -// 2 -// --repeat -// 1 -// --chain -// darwinia-local -// --output -// runtime/darwinia/src/weights/ -// --extrinsic -// * -// --pallet -// * - -#![cfg_attr(rustfmt, rustfmt_skip)] -#![allow(unused_parens)] -#![allow(unused_imports)] - -use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; - -/// Weight functions for `pallet_multisig`. -pub struct WeightInfo(PhantomData); -impl pallet_multisig::WeightInfo for WeightInfo { - /// The range of component `z` is `[0, 10000]`. - fn as_multi_threshold_1(_z: u32, ) -> Weight { - // Minimum execution time: 31_203 nanoseconds. - Weight::from_ref_time(34_003_000) - } - // Storage: Multisig Multisigs (r:1 w:1) - // Storage: unknown [0x3a65787472696e7369635f696e646578] (r:1 w:0) - /// The range of component `s` is `[2, 100]`. - /// The range of component `z` is `[0, 10000]`. - fn as_multi_create(_s: u32, z: u32, ) -> Weight { - // Minimum execution time: 62_662 nanoseconds. - Weight::from_ref_time(70_789_551) - // Standard Error: 205 - .saturating_add(Weight::from_ref_time(1_601).saturating_mul(z.into())) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(1)) - } - // Storage: Multisig Multisigs (r:1 w:1) - /// The range of component `s` is `[3, 100]`. - /// The range of component `z` is `[0, 10000]`. - fn as_multi_approve(s: u32, z: u32, ) -> Weight { - // Minimum execution time: 33_547 nanoseconds. - Weight::from_ref_time(18_171_226) - // Standard Error: 44_310 - .saturating_add(Weight::from_ref_time(153_757).saturating_mul(s.into())) - // Standard Error: 429 - .saturating_add(Weight::from_ref_time(2_315).saturating_mul(z.into())) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } - // Storage: Multisig Multisigs (r:1 w:1) - // Storage: System Account (r:1 w:1) - /// The range of component `s` is `[2, 100]`. - /// The range of component `z` is `[0, 10000]`. - fn as_multi_complete(s: u32, z: u32, ) -> Weight { - // Minimum execution time: 50_131 nanoseconds. - Weight::from_ref_time(37_518_673) - // Standard Error: 40_862 - .saturating_add(Weight::from_ref_time(158_163).saturating_mul(s.into())) - // Standard Error: 400 - .saturating_add(Weight::from_ref_time(1_229).saturating_mul(z.into())) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(2)) - } - // Storage: Multisig Multisigs (r:1 w:1) - // Storage: unknown [0x3a65787472696e7369635f696e646578] (r:1 w:0) - /// The range of component `s` is `[2, 100]`. - fn approve_as_multi_create(_s: u32, ) -> Weight { - // Minimum execution time: 54_869 nanoseconds. - Weight::from_ref_time(64_526_000) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(1)) - } - // Storage: Multisig Multisigs (r:1 w:1) - /// The range of component `s` is `[2, 100]`. - fn approve_as_multi_approve(_s: u32, ) -> Weight { - // Minimum execution time: 24_490 nanoseconds. - Weight::from_ref_time(37_222_000) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } - // Storage: Multisig Multisigs (r:1 w:1) - /// The range of component `s` is `[2, 100]`. - fn cancel_as_multi(_s: u32, ) -> Weight { - // Minimum execution time: 39_999 nanoseconds. - Weight::from_ref_time(49_556_000) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } -} diff --git a/runtime/pangolin/Cargo.toml b/runtime/pangolin/Cargo.toml index 375cb0f66..ec4ec4b65 100644 --- a/runtime/pangolin/Cargo.toml +++ b/runtime/pangolin/Cargo.toml @@ -94,7 +94,6 @@ pallet-democracy = { workspace = true } pallet-elections-phragmen = { workspace = true } pallet-identity = { workspace = true } pallet-membership = { workspace = true } -pallet-multisig = { workspace = true } pallet-preimage = { workspace = true } pallet-proxy = { workspace = true } pallet-scheduler = { workspace = true } @@ -214,7 +213,6 @@ std = [ "pallet-elections-phragmen/std", "pallet-membership/std", "pallet-identity/std", - "pallet-multisig/std", "pallet-preimage/std", "pallet-proxy/std", "pallet-scheduler/std", @@ -290,7 +288,6 @@ runtime-benchmarks = [ "pallet-elections-phragmen/runtime-benchmarks", "pallet-membership/runtime-benchmarks", "pallet-identity/runtime-benchmarks", - "pallet-multisig/runtime-benchmarks", "pallet-preimage/runtime-benchmarks", "pallet-proxy/runtime-benchmarks", "pallet-scheduler/runtime-benchmarks", @@ -353,7 +350,6 @@ try-runtime = [ "pallet-elections-phragmen/try-runtime", "pallet-membership/try-runtime", "pallet-identity/try-runtime", - "pallet-multisig/try-runtime", "pallet-preimage/try-runtime", "pallet-proxy/try-runtime", "pallet-scheduler/try-runtime", diff --git a/runtime/pangolin/src/lib.rs b/runtime/pangolin/src/lib.rs index d415fd5de..1ac780e8d 100644 --- a/runtime/pangolin/src/lib.rs +++ b/runtime/pangolin/src/lib.rs @@ -146,7 +146,6 @@ frame_support::construct_runtime! { Scheduler: pallet_scheduler = 28, Preimage: pallet_preimage = 29, Proxy: pallet_proxy = 30, - Multisig: pallet_multisig = 31, // XCM stuff. XcmpQueue: cumulus_pallet_xcmp_queue = 32, @@ -186,7 +185,6 @@ frame_benchmarking::define_benchmarks! { [pallet_elections_phragmen, PhragmenElection] [pallet_identity, Identity] [pallet_membership, TechnicalMembership] - [pallet_multisig, Multisig] [pallet_preimage, Preimage] [pallet_proxy, Proxy] [pallet_scheduler, Scheduler] diff --git a/runtime/pangolin/src/pallets.rs b/runtime/pangolin/src/pallets.rs index 2ac24d6da..2ec32fdb5 100644 --- a/runtime/pangolin/src/pallets.rs +++ b/runtime/pangolin/src/pallets.rs @@ -92,8 +92,6 @@ mod preimage; mod proxy; -mod multisig; - // XCM stuff. mod xcmp_queue; diff --git a/runtime/pangolin/src/pallets/multisig.rs b/runtime/pangolin/src/pallets/multisig.rs deleted file mode 100644 index d2e226434..000000000 --- a/runtime/pangolin/src/pallets/multisig.rs +++ /dev/null @@ -1,32 +0,0 @@ -// This file is part of Darwinia. -// -// Copyright (C) 2018-2023 Darwinia Network -// SPDX-License-Identifier: GPL-3.0 -// -// Darwinia is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// Darwinia 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 Darwinia. If not, see . - -// darwinia -use crate::*; - -impl pallet_multisig::Config for Runtime { - type Currency = Balances; - // One storage item; key size is 32; value is size 4+4+16+32 bytes = 56 bytes. - type DepositBase = ConstU128<{ darwinia_deposit(1, 88) }>; - // Additional storage item size of 32 bytes. - type DepositFactor = ConstU128<{ darwinia_deposit(0, 32) }>; - type MaxSignatories = ConstU32<100>; - type RuntimeCall = RuntimeCall; - type RuntimeEvent = RuntimeEvent; - type WeightInfo = weights::pallet_multisig::WeightInfo; -} diff --git a/runtime/pangolin/src/pallets/proxy.rs b/runtime/pangolin/src/pallets/proxy.rs index 3917f7c48..6c807e38a 100644 --- a/runtime/pangolin/src/pallets/proxy.rs +++ b/runtime/pangolin/src/pallets/proxy.rs @@ -61,7 +61,6 @@ impl frame_support::traits::InstanceFilter for ProxyType { // Might contains transfer { | RuntimeCall::Utility(..) | RuntimeCall::Proxy(..) - | RuntimeCall::Multisig(..) | RuntimeCall::PolkadotXcm(..) | RuntimeCall::Ethereum(..) // } ), diff --git a/runtime/pangolin/src/weights.rs b/runtime/pangolin/src/weights.rs index d5a785a96..1ad80ad60 100644 --- a/runtime/pangolin/src/weights.rs +++ b/runtime/pangolin/src/weights.rs @@ -45,7 +45,6 @@ pub mod pallet_elections_phragmen; pub mod pallet_fee_market; pub mod pallet_identity; pub mod pallet_membership; -pub mod pallet_multisig; pub mod pallet_preimage; pub mod pallet_proxy; pub mod pallet_scheduler; diff --git a/runtime/pangolin/src/weights/pallet_multisig.rs b/runtime/pangolin/src/weights/pallet_multisig.rs deleted file mode 100644 index c6c5131f8..000000000 --- a/runtime/pangolin/src/weights/pallet_multisig.rs +++ /dev/null @@ -1,130 +0,0 @@ -// This file is part of Darwinia. -// -// Copyright (C) 2018-2023 Darwinia Network -// SPDX-License-Identifier: GPL-3.0 -// -// Darwinia is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// Darwinia 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 Darwinia. If not, see . - -//! Autogenerated weights for `pallet_multisig` -//! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-02-21, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("pangolin-local"), DB CACHE: 1024 - -// Executed Command: -// ./target/release/darwinia -// benchmark -// pallet -// --header -// .maintain/license-header -// --execution -// wasm -// --heap-pages -// 4096 -// --steps -// 2 -// --repeat -// 1 -// --chain -// pangolin-local -// --output -// runtime/pangolin/src/weights/ -// --extrinsic -// * -// --pallet -// * - -#![cfg_attr(rustfmt, rustfmt_skip)] -#![allow(unused_parens)] -#![allow(unused_imports)] - -use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; - -/// Weight functions for `pallet_multisig`. -pub struct WeightInfo(PhantomData); -impl pallet_multisig::WeightInfo for WeightInfo { - /// The range of component `z` is `[0, 10000]`. - fn as_multi_threshold_1(_z: u32, ) -> Weight { - // Minimum execution time: 18_811 nanoseconds. - Weight::from_ref_time(25_726_000) - } - // Storage: Multisig Multisigs (r:1 w:1) - // Storage: unknown [0x3a65787472696e7369635f696e646578] (r:1 w:0) - /// The range of component `s` is `[2, 100]`. - /// The range of component `z` is `[0, 10000]`. - fn as_multi_create(s: u32, z: u32, ) -> Weight { - // Minimum execution time: 49_100 nanoseconds. - Weight::from_ref_time(35_786_224) - // Standard Error: 99_230 - .saturating_add(Weight::from_ref_time(133_137).saturating_mul(s.into())) - // Standard Error: 972 - .saturating_add(Weight::from_ref_time(1_960).saturating_mul(z.into())) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(1)) - } - // Storage: Multisig Multisigs (r:1 w:1) - /// The range of component `s` is `[3, 100]`. - /// The range of component `z` is `[0, 10000]`. - fn as_multi_approve(s: u32, z: u32, ) -> Weight { - // Minimum execution time: 35_870 nanoseconds. - Weight::from_ref_time(34_647_319) - // Standard Error: 28_480 - .saturating_add(Weight::from_ref_time(12_226).saturating_mul(s.into())) - // Standard Error: 276 - .saturating_add(Weight::from_ref_time(928).saturating_mul(z.into())) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } - // Storage: Multisig Multisigs (r:1 w:1) - // Storage: System Account (r:1 w:1) - /// The range of component `s` is `[2, 100]`. - /// The range of component `z` is `[0, 10000]`. - fn as_multi_complete(s: u32, z: u32, ) -> Weight { - // Minimum execution time: 52_387 nanoseconds. - Weight::from_ref_time(51_591_591) - // Standard Error: 12_097 - .saturating_add(Weight::from_ref_time(7_954).saturating_mul(s.into())) - // Standard Error: 118 - .saturating_add(Weight::from_ref_time(1_039).saturating_mul(z.into())) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(2)) - } - // Storage: Multisig Multisigs (r:1 w:1) - // Storage: unknown [0x3a65787472696e7369635f696e646578] (r:1 w:0) - /// The range of component `s` is `[2, 100]`. - fn approve_as_multi_create(_s: u32, ) -> Weight { - // Minimum execution time: 40_670 nanoseconds. - Weight::from_ref_time(53_977_000) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(1)) - } - // Storage: Multisig Multisigs (r:1 w:1) - /// The range of component `s` is `[2, 100]`. - fn approve_as_multi_approve(_s: u32, ) -> Weight { - // Minimum execution time: 24_643 nanoseconds. - Weight::from_ref_time(33_293_000) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } - // Storage: Multisig Multisigs (r:1 w:1) - /// The range of component `s` is `[2, 100]`. - fn cancel_as_multi(_s: u32, ) -> Weight { - // Minimum execution time: 38_988 nanoseconds. - Weight::from_ref_time(43_679_000) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } -} diff --git a/runtime/pangoro/Cargo.toml b/runtime/pangoro/Cargo.toml index 18e04d80b..459b47b63 100644 --- a/runtime/pangoro/Cargo.toml +++ b/runtime/pangoro/Cargo.toml @@ -94,7 +94,6 @@ pallet-democracy = { workspace = true } pallet-elections-phragmen = { workspace = true } pallet-identity = { workspace = true } pallet-membership = { workspace = true } -pallet-multisig = { workspace = true } pallet-preimage = { workspace = true } pallet-proxy = { workspace = true } pallet-scheduler = { workspace = true } @@ -214,7 +213,6 @@ std = [ "pallet-elections-phragmen/std", "pallet-membership/std", "pallet-identity/std", - "pallet-multisig/std", "pallet-preimage/std", "pallet-proxy/std", "pallet-scheduler/std", @@ -291,7 +289,6 @@ runtime-benchmarks = [ "pallet-elections-phragmen/runtime-benchmarks", "pallet-membership/runtime-benchmarks", "pallet-identity/runtime-benchmarks", - "pallet-multisig/runtime-benchmarks", "pallet-preimage/runtime-benchmarks", "pallet-proxy/runtime-benchmarks", "pallet-scheduler/runtime-benchmarks", @@ -354,7 +351,6 @@ try-runtime = [ "pallet-elections-phragmen/try-runtime", "pallet-membership/try-runtime", "pallet-identity/try-runtime", - "pallet-multisig/try-runtime", "pallet-preimage/try-runtime", "pallet-proxy/try-runtime", "pallet-scheduler/try-runtime", diff --git a/runtime/pangoro/src/lib.rs b/runtime/pangoro/src/lib.rs index c26a02464..3d269ebc1 100644 --- a/runtime/pangoro/src/lib.rs +++ b/runtime/pangoro/src/lib.rs @@ -146,7 +146,6 @@ frame_support::construct_runtime! { Scheduler: pallet_scheduler = 28, Preimage: pallet_preimage = 29, Proxy: pallet_proxy = 30, - Multisig: pallet_multisig = 31, // XCM stuff. XcmpQueue: cumulus_pallet_xcmp_queue = 32, @@ -186,7 +185,6 @@ frame_benchmarking::define_benchmarks! { [pallet_elections_phragmen, PhragmenElection] [pallet_identity, Identity] [pallet_membership, TechnicalMembership] - [pallet_multisig, Multisig] [pallet_preimage, Preimage] [pallet_proxy, Proxy] [pallet_scheduler, Scheduler] diff --git a/runtime/pangoro/src/pallets.rs b/runtime/pangoro/src/pallets.rs index 2ac24d6da..2ec32fdb5 100644 --- a/runtime/pangoro/src/pallets.rs +++ b/runtime/pangoro/src/pallets.rs @@ -92,8 +92,6 @@ mod preimage; mod proxy; -mod multisig; - // XCM stuff. mod xcmp_queue; diff --git a/runtime/pangoro/src/pallets/multisig.rs b/runtime/pangoro/src/pallets/multisig.rs deleted file mode 100644 index d2e226434..000000000 --- a/runtime/pangoro/src/pallets/multisig.rs +++ /dev/null @@ -1,32 +0,0 @@ -// This file is part of Darwinia. -// -// Copyright (C) 2018-2023 Darwinia Network -// SPDX-License-Identifier: GPL-3.0 -// -// Darwinia is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// Darwinia 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 Darwinia. If not, see . - -// darwinia -use crate::*; - -impl pallet_multisig::Config for Runtime { - type Currency = Balances; - // One storage item; key size is 32; value is size 4+4+16+32 bytes = 56 bytes. - type DepositBase = ConstU128<{ darwinia_deposit(1, 88) }>; - // Additional storage item size of 32 bytes. - type DepositFactor = ConstU128<{ darwinia_deposit(0, 32) }>; - type MaxSignatories = ConstU32<100>; - type RuntimeCall = RuntimeCall; - type RuntimeEvent = RuntimeEvent; - type WeightInfo = weights::pallet_multisig::WeightInfo; -} diff --git a/runtime/pangoro/src/pallets/proxy.rs b/runtime/pangoro/src/pallets/proxy.rs index 3917f7c48..6c807e38a 100644 --- a/runtime/pangoro/src/pallets/proxy.rs +++ b/runtime/pangoro/src/pallets/proxy.rs @@ -61,7 +61,6 @@ impl frame_support::traits::InstanceFilter for ProxyType { // Might contains transfer { | RuntimeCall::Utility(..) | RuntimeCall::Proxy(..) - | RuntimeCall::Multisig(..) | RuntimeCall::PolkadotXcm(..) | RuntimeCall::Ethereum(..) // } ), diff --git a/runtime/pangoro/src/weights.rs b/runtime/pangoro/src/weights.rs index d5a785a96..1ad80ad60 100644 --- a/runtime/pangoro/src/weights.rs +++ b/runtime/pangoro/src/weights.rs @@ -45,7 +45,6 @@ pub mod pallet_elections_phragmen; pub mod pallet_fee_market; pub mod pallet_identity; pub mod pallet_membership; -pub mod pallet_multisig; pub mod pallet_preimage; pub mod pallet_proxy; pub mod pallet_scheduler; diff --git a/runtime/pangoro/src/weights/pallet_multisig.rs b/runtime/pangoro/src/weights/pallet_multisig.rs deleted file mode 100644 index f67aa2e9c..000000000 --- a/runtime/pangoro/src/weights/pallet_multisig.rs +++ /dev/null @@ -1,130 +0,0 @@ -// This file is part of Darwinia. -// -// Copyright (C) 2018-2023 Darwinia Network -// SPDX-License-Identifier: GPL-3.0 -// -// Darwinia is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// Darwinia 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 Darwinia. If not, see . - -//! Autogenerated weights for `pallet_multisig` -//! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-02-22, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! HOSTNAME: `Debian`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("pangoro-local"), DB CACHE: 1024 - -// Executed Command: -// ./target/release/darwinia -// benchmark -// pallet -// --header -// .maintain/license-header -// --execution -// wasm -// --heap-pages -// 4096 -// --steps -// 2 -// --repeat -// 1 -// --chain -// pangoro-local -// --output -// runtime/pangoro/src/weights/ -// --extrinsic -// * -// --pallet -// * - -#![cfg_attr(rustfmt, rustfmt_skip)] -#![allow(unused_parens)] -#![allow(unused_imports)] - -use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; - -/// Weight functions for `pallet_multisig`. -pub struct WeightInfo(PhantomData); -impl pallet_multisig::WeightInfo for WeightInfo { - /// The range of component `z` is `[0, 10000]`. - fn as_multi_threshold_1(_z: u32, ) -> Weight { - // Minimum execution time: 20_241 nanoseconds. - Weight::from_ref_time(24_721_000) - } - // Storage: Multisig Multisigs (r:1 w:1) - // Storage: unknown [0x3a65787472696e7369635f696e646578] (r:1 w:0) - /// The range of component `s` is `[2, 100]`. - /// The range of component `z` is `[0, 10000]`. - fn as_multi_create(s: u32, z: u32, ) -> Weight { - // Minimum execution time: 51_971 nanoseconds. - Weight::from_ref_time(35_974_061) - // Standard Error: 108_359 - .saturating_add(Weight::from_ref_time(159_969).saturating_mul(s.into())) - // Standard Error: 1_061 - .saturating_add(Weight::from_ref_time(1_995).saturating_mul(z.into())) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(1)) - } - // Storage: Multisig Multisigs (r:1 w:1) - /// The range of component `s` is `[3, 100]`. - /// The range of component `z` is `[0, 10000]`. - fn as_multi_approve(s: u32, z: u32, ) -> Weight { - // Minimum execution time: 38_583 nanoseconds. - Weight::from_ref_time(29_986_690) - // Standard Error: 26_445 - .saturating_add(Weight::from_ref_time(106_103).saturating_mul(s.into())) - // Standard Error: 256 - .saturating_add(Weight::from_ref_time(827).saturating_mul(z.into())) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } - // Storage: Multisig Multisigs (r:1 w:1) - // Storage: System Account (r:1 w:1) - /// The range of component `s` is `[2, 100]`. - /// The range of component `z` is `[0, 10000]`. - fn as_multi_complete(s: u32, z: u32, ) -> Weight { - // Minimum execution time: 52_702 nanoseconds. - Weight::from_ref_time(48_998_428) - // Standard Error: 27_986 - .saturating_add(Weight::from_ref_time(37_035).saturating_mul(s.into())) - // Standard Error: 274 - .saturating_add(Weight::from_ref_time(691).saturating_mul(z.into())) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(2)) - } - // Storage: Multisig Multisigs (r:1 w:1) - // Storage: unknown [0x3a65787472696e7369635f696e646578] (r:1 w:0) - /// The range of component `s` is `[2, 100]`. - fn approve_as_multi_create(_s: u32, ) -> Weight { - // Minimum execution time: 42_941 nanoseconds. - Weight::from_ref_time(55_953_000) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(1)) - } - // Storage: Multisig Multisigs (r:1 w:1) - /// The range of component `s` is `[2, 100]`. - fn approve_as_multi_approve(_s: u32, ) -> Weight { - // Minimum execution time: 24_880 nanoseconds. - Weight::from_ref_time(31_857_000) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } - // Storage: Multisig Multisigs (r:1 w:1) - /// The range of component `s` is `[2, 100]`. - fn cancel_as_multi(_s: u32, ) -> Weight { - // Minimum execution time: 40_588 nanoseconds. - Weight::from_ref_time(41_468_000) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } -} From 5356f0bfb04e1785299bfdf96ee12cd5ebfd98bc Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Mon, 27 Feb 2023 15:42:22 +0800 Subject: [PATCH 159/189] Update Pangoro2 parachain id (#304) --- node/src/chain_spec/pangoro.rs | 14 +++++++------- tool/state-processor/src/main.rs | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/node/src/chain_spec/pangoro.rs b/node/src/chain_spec/pangoro.rs index a5220be1e..eac3e006c 100644 --- a/node/src/chain_spec/pangoro.rs +++ b/node/src/chain_spec/pangoro.rs @@ -72,7 +72,7 @@ pub fn development_config() -> ChainSpec { array_bytes::hex_n_into_unchecked(ETHAN), array_bytes::hex_n_into_unchecked(FAITH), ], - 2046.into(), + 2105.into(), ) }, Vec::new(), @@ -82,7 +82,7 @@ pub fn development_config() -> ChainSpec { Some(properties()), Extensions { relay_chain: "rococo-local".into(), // You MUST set this to the correct network! - para_id: 2046, + para_id: 2105, }, ) } @@ -119,7 +119,7 @@ pub fn local_config() -> ChainSpec { array_bytes::hex_n_into_unchecked(ETHAN), array_bytes::hex_n_into_unchecked(FAITH), ], - 2046.into(), + 2105.into(), ) }, Vec::new(), @@ -129,7 +129,7 @@ pub fn local_config() -> ChainSpec { Some(properties()), Extensions { relay_chain: "rococo-local".into(), // You MUST set this to the correct network! - para_id: 2046, + para_id: 2105, }, ) } @@ -144,7 +144,7 @@ pub fn genesis_config() -> ChainSpec { // System stuff. system: SystemConfig { code: WASM_BINARY.unwrap().to_vec() }, parachain_system: Default::default(), - parachain_info: ParachainInfoConfig { parachain_id: 2046.into() }, + parachain_info: ParachainInfoConfig { parachain_id: 2105.into() }, // Monetary stuff. balances: BalancesConfig { @@ -255,8 +255,8 @@ pub fn genesis_config() -> ChainSpec { None, Some(properties()), Extensions { - relay_chain: "rococo".into(), // You MUST set this to the correct network! - para_id: 2046, + relay_chain: "westend".into(), // You MUST set this to the correct network! + para_id: 2105, }, ) } diff --git a/tool/state-processor/src/main.rs b/tool/state-processor/src/main.rs index 862d064a2..7ab49e4cf 100644 --- a/tool/state-processor/src/main.rs +++ b/tool/state-processor/src/main.rs @@ -33,8 +33,8 @@ fn main() -> Result<()> { // >::new()?.process().save()?; // >::new()?.test().process().save()?; - // >::new()?.process().save()?; - >::new()?.test().process().save()?; + >::new()?.process().save()?; + // >::new()?.test().process().save()?; // >::new()?.process().save()?; // >::new()?.test().process().save()?; // >::new()?.process().save()?; From b2b03058b872659ad357ae004097267ecd24d82c Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Mon, 27 Feb 2023 15:42:38 +0800 Subject: [PATCH 160/189] Update cross compile docker image (#303) * Update cross compile docker image * Fix compile --- .github/workflows/staging.yml | 2 +- .maintain/docker/ubuntu:20.04 | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/staging.yml b/.github/workflows/staging.yml index 4543b1b46..e83ce5542 100644 --- a/.github/workflows/staging.yml +++ b/.github/workflows/staging.yml @@ -22,7 +22,7 @@ jobs: apt update -y apt install --no-install-recommends -y \ ca-certificates curl git python3-pip \ - clang make gcc g++ protobuf-compiler + clang make gcc g++ libssl-dev pkg-config protobuf-compiler pip3 install --upgrade pip pip3 install cmake --upgrade diff --git a/.maintain/docker/ubuntu:20.04 b/.maintain/docker/ubuntu:20.04 index 635567f3c..a6d8ae26a 100644 --- a/.maintain/docker/ubuntu:20.04 +++ b/.maintain/docker/ubuntu:20.04 @@ -1,3 +1,5 @@ FROM ubuntu:20.04 -RUN apt-get -y update && apt-get -y install clang gcc g++ llvm libssl-dev libudev-dev make git protobuf-compiler +ARG DEBIAN_FRONTEND=noninteractive +ENV TZ=Etc/UTC +RUN apt-get -y update && apt-get -y install clang gcc g++ llvm libssl-dev libudev-dev make git pkg-config protobuf-compiler From 8ddcaa429956e4ec069fd08c0e41e7507b96375f Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Mon, 27 Feb 2023 18:35:53 +0800 Subject: [PATCH 161/189] Easy make (#305) * Easy make * Format --- Makefile.toml | 113 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100644 Makefile.toml diff --git a/Makefile.toml b/Makefile.toml new file mode 100644 index 000000000..51c489a7e --- /dev/null +++ b/Makefile.toml @@ -0,0 +1,113 @@ +[config] +default_to_workspace = false + +[env] +WASM_BUILD_WORKSPACE_HINT = "${CARGO_MAKE_WORKING_DIRECTORY}" + +[tasks.fmt] +args = ["fmt"] +command = "cargo" +install_crate = "rustfmt" + +[tasks.check] +args = ["check"] +command = "cargo" +dependencies = ["format"] +env = { "SKIP_WASM_BUILD" = "1" } + +[tasks.clippy] +args = ["clippy"] +command = "cargo" +dependencies = ["format"] +env = { "SKIP_WASM_BUILD" = "1" } + +[tasks.common-build] +args = [ + "build", + "--locked", + "-p", + "darwinia", + "--release", + "--no-default-features", + "--features", + "@@split(FEATURES, )", +] +[tasks.common-run] +args = [ + "--unsafe-ws-external", + "--unsafe-rpc-external", + "--rpc-methods", + "unsafe", + "--rpc-cors", + "all", + "--tmp", + "--alice", + "--collator", + "@@split(FLAGS, )", +] + +[tasks.build-darwinia] +command = "cargo" +env = { "FEATURES" = "darwinia-native" } +extend = "common-build" +[tasks.cbuild-darwinia] +command = "cross" +env = { "FEATURES" = "darwinia-native" } +extend = "common-build" +[tasks.run-darwinia] +command = "target/release/darwinia" +env = { "FLAGS" = "--chain darwinia-dev" } +extend = "common-run" + +[tasks.build-crab] +command = "cargo" +env = { "FEATURES" = "crab-native" } +extend = "common-build" +[tasks.cbuild-crab] +command = "cross" +env = { "FEATURES" = "crab-native" } +extend = "common-build" +[tasks.run-crab] +command = "target/release/darwinia" +env = { "FLAGS" = "--chain crab-dev" } +extend = "common-run" + +[tasks.build-pangoro] +command = "cargo" +env = { "FEATURES" = "pangoro-native" } +extend = "common-build" +[tasks.cbuild-pangoro] +command = "cross" +env = { "FEATURES" = "pangoro-native" } +extend = "common-build" +[tasks.run-pangoro] +command = "target/release/darwinia" +env = { "FLAGS" = "--chain pangoro-dev" } +extend = "common-run" + +[tasks.build-pangolin] +command = "cargo" +env = { "FEATURES" = "pangolin-native" } +extend = "common-build" +[tasks.cbuild-pangolin] +command = "cross" +env = { "FEATURES" = "pangolin-native" } +extend = "common-build" +[tasks.run-pangolin] +command = "target/release/darwinia" +env = { "FLAGS" = "--chain pangolin-dev" } +extend = "common-run" + +[tasks.build-bench] +command = "cargo" +env = { "FEATURES" = "all-natives runtime-benchmarks" } +extend = "common-build" + +[tasks.build-trt] +command = "cargo" +env = { "FEATURES" = "all-natives try-runtime" } +extend = "common-build" + +[tasks.build-all] +args = ["build", "--locked", "--release", "--all-features"] +command = "cargo" From 92533724d8192f8917b51f0eaf5dc665bfe3317e Mon Sep 17 00:00:00 2001 From: bear Date: Wed, 1 Mar 2023 13:41:33 +0800 Subject: [PATCH 162/189] Update EthBlockGasLimit (#306) * Update pangolin's max gas limit * Update other runtimes * Move evm tests * Self review --- Cargo.lock | 43 ++++++++++++++------------ runtime/common/src/test.rs | 20 ++++++++++++ runtime/crab/Cargo.toml | 2 ++ runtime/crab/src/lib.rs | 16 ---------- runtime/crab/src/pallets/evm.rs | 7 ++--- runtime/crab/src/pallets/system.rs | 3 +- runtime/crab/tests/tests.rs | 2 ++ runtime/darwinia/Cargo.toml | 2 ++ runtime/darwinia/src/lib.rs | 16 ---------- runtime/darwinia/src/pallets/evm.rs | 7 ++--- runtime/darwinia/src/pallets/system.rs | 3 +- runtime/darwinia/tests/tests.rs | 2 ++ runtime/pangolin/Cargo.toml | 2 ++ runtime/pangolin/src/lib.rs | 16 ---------- runtime/pangolin/src/pallets/evm.rs | 7 ++--- runtime/pangolin/src/pallets/system.rs | 3 +- runtime/pangolin/tests/tests.rs | 2 ++ runtime/pangoro/Cargo.toml | 2 ++ runtime/pangoro/src/lib.rs | 16 ---------- runtime/pangoro/src/pallets/evm.rs | 7 ++--- runtime/pangoro/src/pallets/system.rs | 3 +- runtime/pangoro/tests/tests.rs | 2 ++ tests/config.ts | 5 +-- tests/ethereum/test-gas.ts | 14 ++++----- 24 files changed, 88 insertions(+), 114 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a4d6bd7cd..3f7659bdf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1368,6 +1368,7 @@ dependencies = [ "darwinia-precompile-state-storage", "darwinia-staking", "dc-primitives", + "fp-evm", "fp-rpc", "fp-self-contained", "frame-benchmarking", @@ -2642,6 +2643,7 @@ dependencies = [ "darwinia-precompile-state-storage", "darwinia-staking", "dc-primitives", + "fp-evm", "fp-rpc", "fp-self-contained", "frame-benchmarking", @@ -3468,7 +3470,7 @@ dependencies = [ [[package]] name = "fc-cli" version = "1.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.37#6783dcd10ffcdb06a52793e0ffb793161881a5f2" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.37#3aaad52672ea4977ad39cf315c022085c23ddfd4" dependencies = [ "clap", "ethereum-types 0.14.1", @@ -3486,7 +3488,7 @@ dependencies = [ [[package]] name = "fc-consensus" version = "2.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.37#6783dcd10ffcdb06a52793e0ffb793161881a5f2" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.37#3aaad52672ea4977ad39cf315c022085c23ddfd4" dependencies = [ "async-trait", "fc-db", @@ -3505,7 +3507,7 @@ dependencies = [ [[package]] name = "fc-db" version = "2.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.37#6783dcd10ffcdb06a52793e0ffb793161881a5f2" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.37#3aaad52672ea4977ad39cf315c022085c23ddfd4" dependencies = [ "fp-storage", "kvdb-rocksdb", @@ -3524,7 +3526,7 @@ dependencies = [ [[package]] name = "fc-mapping-sync" version = "2.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.37#6783dcd10ffcdb06a52793e0ffb793161881a5f2" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.37#3aaad52672ea4977ad39cf315c022085c23ddfd4" dependencies = [ "fc-db", "fp-consensus", @@ -3541,7 +3543,7 @@ dependencies = [ [[package]] name = "fc-rpc" version = "2.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.37#6783dcd10ffcdb06a52793e0ffb793161881a5f2" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.37#3aaad52672ea4977ad39cf315c022085c23ddfd4" dependencies = [ "ethereum", "ethereum-types 0.14.1", @@ -3583,7 +3585,7 @@ dependencies = [ [[package]] name = "fc-rpc-core" version = "1.1.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.37#6783dcd10ffcdb06a52793e0ffb793161881a5f2" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.37#3aaad52672ea4977ad39cf315c022085c23ddfd4" dependencies = [ "ethereum", "ethereum-types 0.14.1", @@ -3747,7 +3749,7 @@ dependencies = [ [[package]] name = "fp-consensus" version = "2.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.37#6783dcd10ffcdb06a52793e0ffb793161881a5f2" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.37#3aaad52672ea4977ad39cf315c022085c23ddfd4" dependencies = [ "ethereum", "parity-scale-codec", @@ -3759,7 +3761,7 @@ dependencies = [ [[package]] name = "fp-ethereum" version = "1.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.37#6783dcd10ffcdb06a52793e0ffb793161881a5f2" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.37#3aaad52672ea4977ad39cf315c022085c23ddfd4" dependencies = [ "ethereum", "ethereum-types 0.14.1", @@ -3773,20 +3775,21 @@ dependencies = [ [[package]] name = "fp-evm" version = "3.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.37#6783dcd10ffcdb06a52793e0ffb793161881a5f2" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.37#3aaad52672ea4977ad39cf315c022085c23ddfd4" dependencies = [ "evm", "frame-support", "parity-scale-codec", "serde", "sp-core", + "sp-runtime", "sp-std", ] [[package]] name = "fp-rpc" version = "3.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.37#6783dcd10ffcdb06a52793e0ffb793161881a5f2" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.37#3aaad52672ea4977ad39cf315c022085c23ddfd4" dependencies = [ "ethereum", "ethereum-types 0.14.1", @@ -3802,7 +3805,7 @@ dependencies = [ [[package]] name = "fp-self-contained" version = "1.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.37#6783dcd10ffcdb06a52793e0ffb793161881a5f2" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.37#3aaad52672ea4977ad39cf315c022085c23ddfd4" dependencies = [ "frame-support", "parity-scale-codec", @@ -3814,7 +3817,7 @@ dependencies = [ [[package]] name = "fp-storage" version = "2.0.0" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.37#6783dcd10ffcdb06a52793e0ffb793161881a5f2" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.37#3aaad52672ea4977ad39cf315c022085c23ddfd4" dependencies = [ "parity-scale-codec", "serde", @@ -7143,7 +7146,7 @@ dependencies = [ [[package]] name = "pallet-ethereum" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.37#6783dcd10ffcdb06a52793e0ffb793161881a5f2" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.37#3aaad52672ea4977ad39cf315c022085c23ddfd4" dependencies = [ "ethereum", "ethereum-types 0.14.1", @@ -7169,7 +7172,7 @@ dependencies = [ [[package]] name = "pallet-evm" version = "6.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.37#6783dcd10ffcdb06a52793e0ffb793161881a5f2" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.37#3aaad52672ea4977ad39cf315c022085c23ddfd4" dependencies = [ "environmental", "evm", @@ -7193,7 +7196,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-blake2" version = "2.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.37#6783dcd10ffcdb06a52793e0ffb793161881a5f2" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.37#3aaad52672ea4977ad39cf315c022085c23ddfd4" dependencies = [ "fp-evm", ] @@ -7201,7 +7204,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-bn128" version = "2.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.37#6783dcd10ffcdb06a52793e0ffb793161881a5f2" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.37#3aaad52672ea4977ad39cf315c022085c23ddfd4" dependencies = [ "fp-evm", "sp-core", @@ -7211,7 +7214,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-dispatch" version = "2.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.37#6783dcd10ffcdb06a52793e0ffb793161881a5f2" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.37#3aaad52672ea4977ad39cf315c022085c23ddfd4" dependencies = [ "fp-evm", "frame-support", @@ -7221,7 +7224,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-modexp" version = "2.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.37#6783dcd10ffcdb06a52793e0ffb793161881a5f2" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.37#3aaad52672ea4977ad39cf315c022085c23ddfd4" dependencies = [ "fp-evm", "num", @@ -7230,7 +7233,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-simple" version = "2.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.37#6783dcd10ffcdb06a52793e0ffb793161881a5f2" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.37#3aaad52672ea4977ad39cf315c022085c23ddfd4" dependencies = [ "fp-evm", "ripemd", @@ -7940,6 +7943,7 @@ dependencies = [ "darwinia-precompile-state-storage", "darwinia-staking", "dc-primitives", + "fp-evm", "fp-rpc", "fp-self-contained", "frame-benchmarking", @@ -8042,6 +8046,7 @@ dependencies = [ "darwinia-precompile-state-storage", "darwinia-staking", "dc-primitives", + "fp-evm", "fp-rpc", "fp-self-contained", "frame-benchmarking", diff --git a/runtime/common/src/test.rs b/runtime/common/src/test.rs index e6e08ebe9..f681f6750 100644 --- a/runtime/common/src/test.rs +++ b/runtime/common/src/test.rs @@ -376,3 +376,23 @@ macro_rules! impl_account_migration_tests { } }; } + +#[macro_export] +macro_rules! impl_evm_tests { + () => { + mod evm { + // darwinia + use crate::mock::{Runtime, WeightPerGas}; + + #[test] + fn configured_base_extrinsic_weight_is_evm_compatible() { + let min_ethereum_transaction_weight = WeightPerGas::get() * 21_000; + let base_extrinsic = ::BlockWeights::get() + .get(frame_support::dispatch::DispatchClass::Normal) + .base_extrinsic; + + assert!(base_extrinsic.ref_time() <= min_ethereum_transaction_weight.ref_time()); + } + } + }; +} diff --git a/runtime/crab/Cargo.toml b/runtime/crab/Cargo.toml index b28d439ca..e3839b125 100644 --- a/runtime/crab/Cargo.toml +++ b/runtime/crab/Cargo.toml @@ -58,6 +58,7 @@ pallet-bridge-parachains = { workspace = true } pallet-fee-market = { workspace = true } # frontier +fp-evm = { workspace = true } fp-rpc = { workspace = true } fp-self-contained = { workspace = true } pallet-ethereum = { workspace = true, features = ["forbid-evm-reentrancy"] } @@ -177,6 +178,7 @@ std = [ "pallet-fee-market/std", # frontier + "fp-evm/std", "fp-rpc/std", "fp-self-contained/std", "pallet-ethereum/std", diff --git a/runtime/crab/src/lib.rs b/runtime/crab/src/lib.rs index ef5745483..6f7ed1f1c 100644 --- a/runtime/crab/src/lib.rs +++ b/runtime/crab/src/lib.rs @@ -615,19 +615,3 @@ cumulus_pallet_parachain_system::register_validate_block! { BlockExecutor = cumulus_pallet_aura_ext::BlockExecutor::, CheckInherents = CheckInherents, } - -#[cfg(test)] -mod tests { - // darwinia - use super::*; - - #[test] - fn configured_base_extrinsic_weight_is_evm_compatible() { - let min_ethereum_transaction_weight = WeightPerGas::get() * 21_000; - let base_extrinsic = ::BlockWeights::get() - .get(frame_support::dispatch::DispatchClass::Normal) - .base_extrinsic; - - assert!(base_extrinsic.ref_time() <= min_ethereum_transaction_weight.ref_time()); - } -} diff --git a/runtime/crab/src/pallets/evm.rs b/runtime/crab/src/pallets/evm.rs index a370d5f07..2e28a9ff1 100644 --- a/runtime/crab/src/pallets/evm.rs +++ b/runtime/crab/src/pallets/evm.rs @@ -21,12 +21,11 @@ use crate::*; // frontier use pallet_evm::Precompile; -const WEIGHT_PER_GAS: u64 = 40_000; - +const BLOCK_GAS_LIMIT: u64 = 10_000_000; frame_support::parameter_types! { - pub BlockGasLimit: sp_core::U256 = sp_core::U256::from(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT.ref_time() / WEIGHT_PER_GAS); + pub BlockGasLimit: sp_core::U256 = sp_core::U256::from(BLOCK_GAS_LIMIT); pub PrecompilesValue: CrabPrecompiles = CrabPrecompiles::<_>::new(); - pub WeightPerGas: frame_support::weights::Weight = frame_support::weights::Weight::from_ref_time(WEIGHT_PER_GAS); + pub WeightPerGas: frame_support::weights::Weight = frame_support::weights::Weight::from_ref_time(fp_evm::weight_per_gas(BLOCK_GAS_LIMIT, NORMAL_DISPATCH_RATIO, WEIGHT_MILLISECS_PER_BLOCK)); } // TODO: Integrate to the upstream repo diff --git a/runtime/crab/src/pallets/system.rs b/runtime/crab/src/pallets/system.rs index 74d82b74c..1668a4912 100644 --- a/runtime/crab/src/pallets/system.rs +++ b/runtime/crab/src/pallets/system.rs @@ -28,9 +28,10 @@ const AVERAGE_ON_INITIALIZE_RATIO: sp_runtime::Perbill = sp_runtime::Perbill::fr pub const NORMAL_DISPATCH_RATIO: sp_runtime::Perbill = sp_runtime::Perbill::from_percent(75); /// We allow for 0.5 of a second of compute with a 12 second average block time. +pub const WEIGHT_MILLISECS_PER_BLOCK: u64 = 500; pub const MAXIMUM_BLOCK_WEIGHT: frame_support::weights::Weight = frame_support::weights::Weight::from_parts( - frame_support::weights::constants::WEIGHT_REF_TIME_PER_SECOND.saturating_div(2), + frame_support::weights::constants::WEIGHT_REF_TIME_PER_MILLIS * WEIGHT_MILLISECS_PER_BLOCK, cumulus_primitives_core::relay_chain::v2::MAX_POV_SIZE as u64, ); diff --git a/runtime/crab/tests/tests.rs b/runtime/crab/tests/tests.rs index 43b5d3724..c027aab1f 100644 --- a/runtime/crab/tests/tests.rs +++ b/runtime/crab/tests/tests.rs @@ -1,3 +1,5 @@ pub mod mock; darwinia_common_runtime::impl_account_migration_tests! {} + +darwinia_common_runtime::impl_evm_tests! {} diff --git a/runtime/darwinia/Cargo.toml b/runtime/darwinia/Cargo.toml index 15fdf3819..80f461988 100644 --- a/runtime/darwinia/Cargo.toml +++ b/runtime/darwinia/Cargo.toml @@ -58,6 +58,7 @@ pallet-bridge-parachains = { workspace = true } pallet-fee-market = { workspace = true } # frontier +fp-evm = { workspace = true } fp-rpc = { workspace = true } fp-self-contained = { workspace = true } pallet-ethereum = { features = ["forbid-evm-reentrancy"], workspace = true } @@ -177,6 +178,7 @@ std = [ "pallet-fee-market/std", # frontier + "fp-evm/std", "fp-rpc/std", "fp-self-contained/std", "pallet-ethereum/std", diff --git a/runtime/darwinia/src/lib.rs b/runtime/darwinia/src/lib.rs index 24bc6d425..5e442f580 100644 --- a/runtime/darwinia/src/lib.rs +++ b/runtime/darwinia/src/lib.rs @@ -616,19 +616,3 @@ cumulus_pallet_parachain_system::register_validate_block! { BlockExecutor = cumulus_pallet_aura_ext::BlockExecutor::, CheckInherents = CheckInherents, } - -#[cfg(test)] -mod tests { - // darwinia - use super::*; - - #[test] - fn configured_base_extrinsic_weight_is_evm_compatible() { - let min_ethereum_transaction_weight = WeightPerGas::get() * 21_000; - let base_extrinsic = ::BlockWeights::get() - .get(frame_support::dispatch::DispatchClass::Normal) - .base_extrinsic; - - assert!(base_extrinsic.ref_time() <= min_ethereum_transaction_weight.ref_time()); - } -} diff --git a/runtime/darwinia/src/pallets/evm.rs b/runtime/darwinia/src/pallets/evm.rs index 4fa2feb2a..49ba628dd 100644 --- a/runtime/darwinia/src/pallets/evm.rs +++ b/runtime/darwinia/src/pallets/evm.rs @@ -21,12 +21,11 @@ use crate::*; // frontier use pallet_evm::Precompile; -const WEIGHT_PER_GAS: u64 = 40_000; - +const BLOCK_GAS_LIMIT: u64 = 10_000_000; frame_support::parameter_types! { - pub BlockGasLimit: sp_core::U256 = sp_core::U256::from(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT.ref_time() / WEIGHT_PER_GAS); + pub BlockGasLimit: sp_core::U256 = sp_core::U256::from(BLOCK_GAS_LIMIT); pub PrecompilesValue: DarwiniaPrecompiles = DarwiniaPrecompiles::<_>::new(); - pub WeightPerGas: frame_support::weights::Weight = frame_support::weights::Weight::from_ref_time(WEIGHT_PER_GAS); + pub WeightPerGas: frame_support::weights::Weight = frame_support::weights::Weight::from_ref_time(fp_evm::weight_per_gas(BLOCK_GAS_LIMIT, NORMAL_DISPATCH_RATIO, WEIGHT_MILLISECS_PER_BLOCK)); } // TODO: Integrate to the upstream repo diff --git a/runtime/darwinia/src/pallets/system.rs b/runtime/darwinia/src/pallets/system.rs index 96faace69..2b08d5384 100644 --- a/runtime/darwinia/src/pallets/system.rs +++ b/runtime/darwinia/src/pallets/system.rs @@ -28,9 +28,10 @@ const AVERAGE_ON_INITIALIZE_RATIO: sp_runtime::Perbill = sp_runtime::Perbill::fr pub const NORMAL_DISPATCH_RATIO: sp_runtime::Perbill = sp_runtime::Perbill::from_percent(75); /// We allow for 0.5 of a second of compute with a 12 second average block time. +pub const WEIGHT_MILLISECS_PER_BLOCK: u64 = 500; pub const MAXIMUM_BLOCK_WEIGHT: frame_support::weights::Weight = frame_support::weights::Weight::from_parts( - frame_support::weights::constants::WEIGHT_REF_TIME_PER_SECOND.saturating_div(2), + frame_support::weights::constants::WEIGHT_REF_TIME_PER_MILLIS * WEIGHT_MILLISECS_PER_BLOCK, cumulus_primitives_core::relay_chain::v2::MAX_POV_SIZE as u64, ); diff --git a/runtime/darwinia/tests/tests.rs b/runtime/darwinia/tests/tests.rs index 43b5d3724..c027aab1f 100644 --- a/runtime/darwinia/tests/tests.rs +++ b/runtime/darwinia/tests/tests.rs @@ -1,3 +1,5 @@ pub mod mock; darwinia_common_runtime::impl_account_migration_tests! {} + +darwinia_common_runtime::impl_evm_tests! {} diff --git a/runtime/pangolin/Cargo.toml b/runtime/pangolin/Cargo.toml index ec4ec4b65..7f02d681f 100644 --- a/runtime/pangolin/Cargo.toml +++ b/runtime/pangolin/Cargo.toml @@ -58,6 +58,7 @@ pallet-bridge-parachains = { workspace = true } pallet-fee-market = { workspace = true } # frontier +fp-evm = { workspace = true } fp-rpc = { workspace = true } fp-self-contained = { workspace = true } pallet-ethereum = { features = ["forbid-evm-reentrancy"], workspace = true } @@ -177,6 +178,7 @@ std = [ "pallet-fee-market/std", # frontier + "fp-evm/std", "fp-rpc/std", "fp-self-contained/std", "pallet-ethereum/std", diff --git a/runtime/pangolin/src/lib.rs b/runtime/pangolin/src/lib.rs index 1ac780e8d..71e36fb3c 100644 --- a/runtime/pangolin/src/lib.rs +++ b/runtime/pangolin/src/lib.rs @@ -618,19 +618,3 @@ cumulus_pallet_parachain_system::register_validate_block! { BlockExecutor = cumulus_pallet_aura_ext::BlockExecutor::, CheckInherents = CheckInherents, } - -#[cfg(test)] -mod tests { - // darwinia - use super::*; - - #[test] - fn configured_base_extrinsic_weight_is_evm_compatible() { - let min_ethereum_transaction_weight = WeightPerGas::get() * 21_000; - let base_extrinsic = ::BlockWeights::get() - .get(frame_support::dispatch::DispatchClass::Normal) - .base_extrinsic; - - assert!(base_extrinsic.ref_time() <= min_ethereum_transaction_weight.ref_time()); - } -} diff --git a/runtime/pangolin/src/pallets/evm.rs b/runtime/pangolin/src/pallets/evm.rs index 0aedc8b85..e76eca82d 100644 --- a/runtime/pangolin/src/pallets/evm.rs +++ b/runtime/pangolin/src/pallets/evm.rs @@ -21,12 +21,11 @@ use crate::*; // frontier use pallet_evm::Precompile; -const WEIGHT_PER_GAS: u64 = 40_000; - +const BLOCK_GAS_LIMIT: u64 = 10_000_000; frame_support::parameter_types! { - pub BlockGasLimit: sp_core::U256 = sp_core::U256::from(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT.ref_time() / WEIGHT_PER_GAS); + pub BlockGasLimit: sp_core::U256 = sp_core::U256::from(BLOCK_GAS_LIMIT); pub PrecompilesValue: PangolinPrecompiles = PangolinPrecompiles::<_>::new(); - pub WeightPerGas: frame_support::weights::Weight = frame_support::weights::Weight::from_ref_time(WEIGHT_PER_GAS); + pub WeightPerGas: frame_support::weights::Weight = frame_support::weights::Weight::from_ref_time(fp_evm::weight_per_gas(BLOCK_GAS_LIMIT, NORMAL_DISPATCH_RATIO, WEIGHT_MILLISECS_PER_BLOCK)); } // TODO: Integrate to the upstream repo diff --git a/runtime/pangolin/src/pallets/system.rs b/runtime/pangolin/src/pallets/system.rs index 74d82b74c..1668a4912 100644 --- a/runtime/pangolin/src/pallets/system.rs +++ b/runtime/pangolin/src/pallets/system.rs @@ -28,9 +28,10 @@ const AVERAGE_ON_INITIALIZE_RATIO: sp_runtime::Perbill = sp_runtime::Perbill::fr pub const NORMAL_DISPATCH_RATIO: sp_runtime::Perbill = sp_runtime::Perbill::from_percent(75); /// We allow for 0.5 of a second of compute with a 12 second average block time. +pub const WEIGHT_MILLISECS_PER_BLOCK: u64 = 500; pub const MAXIMUM_BLOCK_WEIGHT: frame_support::weights::Weight = frame_support::weights::Weight::from_parts( - frame_support::weights::constants::WEIGHT_REF_TIME_PER_SECOND.saturating_div(2), + frame_support::weights::constants::WEIGHT_REF_TIME_PER_MILLIS * WEIGHT_MILLISECS_PER_BLOCK, cumulus_primitives_core::relay_chain::v2::MAX_POV_SIZE as u64, ); diff --git a/runtime/pangolin/tests/tests.rs b/runtime/pangolin/tests/tests.rs index 43b5d3724..c027aab1f 100644 --- a/runtime/pangolin/tests/tests.rs +++ b/runtime/pangolin/tests/tests.rs @@ -1,3 +1,5 @@ pub mod mock; darwinia_common_runtime::impl_account_migration_tests! {} + +darwinia_common_runtime::impl_evm_tests! {} diff --git a/runtime/pangoro/Cargo.toml b/runtime/pangoro/Cargo.toml index 459b47b63..ce67499b2 100644 --- a/runtime/pangoro/Cargo.toml +++ b/runtime/pangoro/Cargo.toml @@ -58,6 +58,7 @@ pallet-bridge-parachains = { workspace = true } pallet-fee-market = { workspace = true } # frontier +fp-evm = { workspace = true } fp-rpc = { workspace = true } fp-self-contained = { workspace = true } pallet-ethereum = { features = ["forbid-evm-reentrancy"], workspace = true } @@ -177,6 +178,7 @@ std = [ "pallet-fee-market/std", # frontier + "fp-evm/std", "fp-rpc/std", "fp-self-contained/std", "pallet-ethereum/std", diff --git a/runtime/pangoro/src/lib.rs b/runtime/pangoro/src/lib.rs index 3d269ebc1..b69c606a6 100644 --- a/runtime/pangoro/src/lib.rs +++ b/runtime/pangoro/src/lib.rs @@ -618,19 +618,3 @@ cumulus_pallet_parachain_system::register_validate_block! { BlockExecutor = cumulus_pallet_aura_ext::BlockExecutor::, CheckInherents = CheckInherents, } - -#[cfg(test)] -mod tests { - // darwinia - use super::*; - - #[test] - fn configured_base_extrinsic_weight_is_evm_compatible() { - let min_ethereum_transaction_weight = WeightPerGas::get() * 21_000; - let base_extrinsic = ::BlockWeights::get() - .get(frame_support::dispatch::DispatchClass::Normal) - .base_extrinsic; - - assert!(base_extrinsic.ref_time() <= min_ethereum_transaction_weight.ref_time()); - } -} diff --git a/runtime/pangoro/src/pallets/evm.rs b/runtime/pangoro/src/pallets/evm.rs index 14429eea1..ddf438b5e 100644 --- a/runtime/pangoro/src/pallets/evm.rs +++ b/runtime/pangoro/src/pallets/evm.rs @@ -21,12 +21,11 @@ use crate::*; // frontier use pallet_evm::Precompile; -const WEIGHT_PER_GAS: u64 = 40_000; - +const BLOCK_GAS_LIMIT: u64 = 10_000_000; frame_support::parameter_types! { - pub BlockGasLimit: sp_core::U256 = sp_core::U256::from(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT.ref_time() / WEIGHT_PER_GAS); + pub BlockGasLimit: sp_core::U256 = sp_core::U256::from(BLOCK_GAS_LIMIT); pub PrecompilesValue: PangoroPrecompiles = PangoroPrecompiles::<_>::new(); - pub WeightPerGas: frame_support::weights::Weight = frame_support::weights::Weight::from_ref_time(WEIGHT_PER_GAS); + pub WeightPerGas: frame_support::weights::Weight = frame_support::weights::Weight::from_ref_time(fp_evm::weight_per_gas(BLOCK_GAS_LIMIT, NORMAL_DISPATCH_RATIO, WEIGHT_MILLISECS_PER_BLOCK)); } // TODO: Integrate to the upstream repo pub struct FromH160; diff --git a/runtime/pangoro/src/pallets/system.rs b/runtime/pangoro/src/pallets/system.rs index 96faace69..2b08d5384 100644 --- a/runtime/pangoro/src/pallets/system.rs +++ b/runtime/pangoro/src/pallets/system.rs @@ -28,9 +28,10 @@ const AVERAGE_ON_INITIALIZE_RATIO: sp_runtime::Perbill = sp_runtime::Perbill::fr pub const NORMAL_DISPATCH_RATIO: sp_runtime::Perbill = sp_runtime::Perbill::from_percent(75); /// We allow for 0.5 of a second of compute with a 12 second average block time. +pub const WEIGHT_MILLISECS_PER_BLOCK: u64 = 500; pub const MAXIMUM_BLOCK_WEIGHT: frame_support::weights::Weight = frame_support::weights::Weight::from_parts( - frame_support::weights::constants::WEIGHT_REF_TIME_PER_SECOND.saturating_div(2), + frame_support::weights::constants::WEIGHT_REF_TIME_PER_MILLIS * WEIGHT_MILLISECS_PER_BLOCK, cumulus_primitives_core::relay_chain::v2::MAX_POV_SIZE as u64, ); diff --git a/runtime/pangoro/tests/tests.rs b/runtime/pangoro/tests/tests.rs index 43b5d3724..c027aab1f 100644 --- a/runtime/pangoro/tests/tests.rs +++ b/runtime/pangoro/tests/tests.rs @@ -1,3 +1,5 @@ pub mod mock; darwinia_common_runtime::impl_account_migration_tests! {} + +darwinia_common_runtime::impl_evm_tests! {} diff --git a/tests/config.ts b/tests/config.ts index 52e56213b..4a3bd34aa 100644 --- a/tests/config.ts +++ b/tests/config.ts @@ -4,11 +4,8 @@ import { JsonRpcResponse } from "web3-core-helpers"; export const CHAIN_ID = 43; export const HOST_HTTP_URL = "http://127.0.0.1:9933"; export const HOST_WS_URL = "ws://127.0.0.1:9944"; -// TODO: https://github.com/darwinia-network/darwinia-2.0/issues/248 -export const BLOCK_GAS_LIMIT = 9375000; +export const BLOCK_GAS_LIMIT = 10000000; export const DEFAULT_GAS = 4000000; -// EXTRINSIC_GAS_LIMIT = [BLOCK_GAS_LIMIT - BLOCK_GAS_LIMIT * (NORMAL_DISPATCH_RATIO - AVERAGE_ON_INITIALIZE_RATIO) - EXTRINSIC_BASE_Weight] / WEIGHT_PER_GAS = (1_000_000_000_000 * 2 * (0.75-0.025) - 125_000_000) / 40_000 -export const EXTRINSIC_GAS_LIMIT = 9059375; // Accounts builtin export const ALITH = "0xf24ff3a9cf04c71dbc94d0b566f7a27b94566cac"; diff --git a/tests/ethereum/test-gas.ts b/tests/ethereum/test-gas.ts index d5ce48818..87a3b4f5d 100644 --- a/tests/ethereum/test-gas.ts +++ b/tests/ethereum/test-gas.ts @@ -6,7 +6,7 @@ import { HOST_HTTP_URL, FAITH, FAITH_P, - EXTRINSIC_GAS_LIMIT, + BLOCK_GAS_LIMIT, customRequest, DEFAULT_GAS, } from "../config"; @@ -43,12 +43,12 @@ describe("Test transaction gas limit", () => { expect(await inc.methods.increment(3).estimateGas()).to.equal(28340); }).timeout(60000); - it("Test transaction gas limit < `EXTRINSIC_GAS_LIMIT`", async () => { + it("Test transaction gas limit < `BLOCK_GAS_LIMIT`", async () => { let tx = await web3.eth.accounts.signTransaction( { from: FAITH, data: data.encodeABI(), - gas: EXTRINSIC_GAS_LIMIT - 1, + gas: BLOCK_GAS_LIMIT - 1, }, FAITH_P ); @@ -57,12 +57,12 @@ describe("Test transaction gas limit", () => { expect((receipt as any).transactionHash).to.be.not.null; }).timeout(60000); - it("Test transaction gas limit = `EXTRINSIC_GAS_LIMIT`", async () => { + it("Test transaction gas limit = `BLOCK_GAS_LIMIT`", async () => { let tx = await web3.eth.accounts.signTransaction( { from: FAITH, data: data.encodeABI(), - gas: EXTRINSIC_GAS_LIMIT, + gas: BLOCK_GAS_LIMIT, }, FAITH_P ); @@ -71,12 +71,12 @@ describe("Test transaction gas limit", () => { expect((receipt as any).transactionHash).to.be.not.null; }).timeout(60000); - it("Test transaction gas limit > `EXTRINSIC_GAS_LIMIT`", async () => { + it("Test transaction gas limit > `BLOCK_GAS_LIMIT`", async () => { let tx = await web3.eth.accounts.signTransaction( { from: FAITH, data: data.encodeABI(), - gas: EXTRINSIC_GAS_LIMIT + 1, + gas: BLOCK_GAS_LIMIT + 1, }, FAITH_P ); From b490d8def545bf2919585c1084bd272ef8df94a1 Mon Sep 17 00:00:00 2001 From: Guantong Date: Wed, 1 Mar 2023 17:42:46 +0800 Subject: [PATCH 163/189] Anchor v0.9.38 --- Cargo.toml | 449 ++++++++++++++++------------------------------------- 1 file changed, 131 insertions(+), 318 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index bed125e81..8f3d7b15b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,24 +28,24 @@ sha3 = { version = "0.9" } static_assertions = { version = "1.1" } # cumulus -cumulus-client-cli = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.37" } -cumulus-client-collator = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.37" } -cumulus-client-consensus-aura = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.37" } -cumulus-client-consensus-common = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.37" } -cumulus-client-network = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.37" } -cumulus-client-service = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.37" } -cumulus-pallet-aura-ext = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.37" } -cumulus-pallet-dmp-queue = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.37" } -cumulus-pallet-parachain-system = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.37" } -cumulus-pallet-session-benchmarking = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.37" } -cumulus-pallet-xcm = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.37" } -cumulus-pallet-xcmp-queue = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.37" } -cumulus-primitives-core = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.37" } -cumulus-primitives-parachain-inherent = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.37" } -cumulus-primitives-timestamp = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.37" } -cumulus-primitives-utility = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.37" } -cumulus-relay-chain-interface = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.37" } -parachain-info = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.37" } +cumulus-client-cli = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.38" } +cumulus-client-collator = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.38" } +cumulus-client-consensus-aura = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.38" } +cumulus-client-consensus-common = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.38" } +cumulus-client-network = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.38" } +cumulus-client-service = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.38" } +cumulus-pallet-aura-ext = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.38" } +cumulus-pallet-dmp-queue = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.38" } +cumulus-pallet-parachain-system = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.38" } +cumulus-pallet-session-benchmarking = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.38" } +cumulus-pallet-xcm = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.38" } +cumulus-pallet-xcmp-queue = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.38" } +cumulus-primitives-core = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.38" } +cumulus-primitives-parachain-inherent = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.38" } +cumulus-primitives-timestamp = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.38" } +cumulus-primitives-utility = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.38" } +cumulus-relay-chain-interface = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.38" } +parachain-info = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.38" } # darwinia crab-runtime = { path = "runtime/crab" } @@ -69,311 +69,124 @@ pangolin-runtime = { path = "runtime/pangolin" } pangoro-runtime = { path = "runtime/pangoro" } # darwinia-messages-substrate -bp-darwinia-core = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.37" } -bp-message-dispatch = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.37" } -bp-messages = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.37" } -bp-polkadot-core = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.37" } -bp-runtime = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.37" } -bridge-runtime-common = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.37" } -pallet-bridge-dispatch = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.37" } -pallet-bridge-grandpa = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.37" } -pallet-bridge-messages = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.37" } -pallet-bridge-parachains = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.37" } -pallet-fee-market = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.37" } +bp-darwinia-core = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.38" } +bp-message-dispatch = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.38" } +bp-messages = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.38" } +bp-polkadot-core = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.38" } +bp-runtime = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.38" } +bridge-runtime-common = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.38" } +pallet-bridge-dispatch = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.38" } +pallet-bridge-grandpa = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.38" } +pallet-bridge-messages = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.38" } +pallet-bridge-parachains = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.38" } +pallet-fee-market = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.38" } # frontier -fc-cli = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.37" } -fc-consensus = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.37" } -fc-db = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.37" } -fc-mapping-sync = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.37" } -fc-rpc = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.37" } -fc-rpc-core = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.37" } -fp-ethereum = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.37" } -fp-evm = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.37" } -fp-rpc = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.37" } -fp-self-contained = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.37" } -fp-storage = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.37" } -pallet-ethereum = { default-features = false, features = ["forbid-evm-reentrancy"], git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.37" } -pallet-evm = { default-features = false, features = ["forbid-evm-reentrancy"], git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.37" } -pallet-evm-precompile-blake2 = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.37" } -pallet-evm-precompile-bn128 = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.37" } -pallet-evm-precompile-dispatch = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.37" } -pallet-evm-precompile-modexp = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.37" } -pallet-evm-precompile-simple = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.37" } +fc-cli = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.38" } +fc-consensus = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.38" } +fc-db = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.38" } +fc-mapping-sync = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.38" } +fc-rpc = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.38" } +fc-rpc-core = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.38" } +fp-ethereum = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.38" } +fp-evm = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.38" } +fp-rpc = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.38" } +fp-self-contained = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.38" } +fp-storage = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.38" } +pallet-ethereum = { default-features = false, features = ["forbid-evm-reentrancy"], git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.38" } +pallet-evm = { default-features = false, features = ["forbid-evm-reentrancy"], git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.38" } +pallet-evm-precompile-blake2 = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.38" } +pallet-evm-precompile-bn128 = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.38" } +pallet-evm-precompile-dispatch = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.38" } +pallet-evm-precompile-modexp = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.38" } +pallet-evm-precompile-simple = { default-features = false, git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.38" } # moonbeam -account = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.37" } -precompile-utils = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.37" } -xcm-primitives = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.37" } +account = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.38" } +precompile-utils = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.38" } +xcm-primitives = { default-features = false, git = "https://github.com/darwinia-network/moonbeam", branch = "polkadot-v0.9.38" } # polkadot -pallet-xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.37" } -polkadot-cli = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.37" } -polkadot-parachain = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.37" } -polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.37" } -polkadot-runtime-common = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.37" } -polkadot-service = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.37" } -xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.37" } -xcm-builder = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.37" } -xcm-executor = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.37" } +pallet-xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.38" } +polkadot-cli = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.38" } +polkadot-parachain = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.38" } +polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.38" } +polkadot-runtime-common = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.38" } +polkadot-service = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.38" } +xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.38" } +xcm-builder = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.38" } +xcm-executor = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.38" } # substrate -frame-benchmarking = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } -frame-benchmarking-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } -frame-executive = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } -frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } -frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } -frame-system-benchmarking = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } -frame-system-rpc-runtime-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } -frame-try-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } -pallet-assets = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } -pallet-aura = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } -pallet-authorship = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } -pallet-balances = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } -pallet-collective = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } -pallet-democracy = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } -pallet-elections-phragmen = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } -pallet-identity = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } -pallet-membership = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } -pallet-preimage = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } -pallet-proxy = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } -pallet-scheduler = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } -pallet-session = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } -pallet-sudo = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } -pallet-timestamp = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } -pallet-tips = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } -pallet-transaction-payment = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } -pallet-transaction-payment-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } -pallet-transaction-payment-rpc-runtime-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } -pallet-treasury = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } -pallet-utility = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } -pallet-vesting = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } -sc-basic-authorship = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } -sc-chain-spec = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } -sc-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } -sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } -sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } -sc-consensus-aura = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } -sc-executor = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } -sc-keystore = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } -sc-network = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } -sc-network-common = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } -sc-offchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } -sc-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } -sc-rpc-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } -sc-service = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } -sc-sysinfo = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } -sc-telemetry = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } -sc-tracing = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } -sc-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } -sc-transaction-pool-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } -sp-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } -sp-arithmetic = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } -sp-block-builder = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } -sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } -sp-consensus = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } -sp-consensus-aura = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } -sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } -sp-inherents = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } -sp-io = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } -sp-keyring = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } -sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } -sp-offchain = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } -sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } -sp-session = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } -sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } -sp-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } -sp-transaction-pool = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } -sp-version = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } -substrate-build-script-utils = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } -substrate-frame-rpc-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } -substrate-prometheus-endpoint = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } -substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } -try-runtime-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" } - -[patch."https://github.com/paritytech/substrate"] -beefy-gadget = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -beefy-gadget-rpc = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -beefy-merkle-tree = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -frame-benchmarking = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -frame-benchmarking-cli = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -frame-election-provider-solution-type = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -frame-election-provider-support = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -frame-executive = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -frame-support = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -frame-support-procedural = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -frame-support-procedural-tools = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -frame-support-procedural-tools-derive = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -frame-system = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -frame-system-benchmarking = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -frame-system-rpc-runtime-api = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -frame-try-runtime = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -mmr-gadget = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -mmr-rpc = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -pallet-assets = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -pallet-aura = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -pallet-authority-discovery = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -pallet-authorship = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -pallet-babe = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -pallet-bags-list = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -pallet-balances = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -pallet-beefy = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -pallet-beefy-mmr = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -pallet-bounties = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -pallet-child-bounties = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -pallet-collective = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -pallet-conviction-voting = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -pallet-democracy = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -pallet-election-provider-multi-phase = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -pallet-election-provider-support-benchmarking = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -pallet-elections-phragmen = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -pallet-fast-unstake = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -pallet-grandpa = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -pallet-identity = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -pallet-im-online = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -pallet-indices = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -pallet-membership = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -pallet-mmr = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -pallet-nis = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -pallet-nomination-pools = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -pallet-nomination-pools-benchmarking = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -pallet-nomination-pools-runtime-api = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -pallet-offences = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -pallet-offences-benchmarking = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -pallet-preimage = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -pallet-proxy = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -pallet-ranked-collective = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -pallet-recovery = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -pallet-referenda = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -pallet-scheduler = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -pallet-session = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -pallet-session-benchmarking = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -pallet-society = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -pallet-staking = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -pallet-staking-reward-curve = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -pallet-staking-reward-fn = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -pallet-state-trie-migration = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -pallet-sudo = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -pallet-timestamp = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -pallet-tips = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -pallet-transaction-payment = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -pallet-transaction-payment-rpc = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -pallet-transaction-payment-rpc-runtime-api = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -pallet-treasury = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -pallet-utility = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -pallet-vesting = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -pallet-whitelist = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -sc-allocator = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -sc-authority-discovery = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -sc-basic-authorship = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -sc-block-builder = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -sc-chain-spec = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -sc-chain-spec-derive = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -sc-cli = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -sc-client-api = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -sc-client-db = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -sc-consensus = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -sc-consensus-aura = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -sc-consensus-babe = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -sc-consensus-babe-rpc = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -sc-consensus-epochs = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -sc-consensus-slots = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -sc-executor = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -sc-executor-common = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -sc-executor-wasmi = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -sc-executor-wasmtime = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -sc-finality-grandpa = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -sc-finality-grandpa-rpc = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -sc-informant = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -sc-keystore = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -sc-network = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -sc-network-common = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -sc-network-gossip = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -sc-offchain = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -sc-peerset = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -sc-proposer-metrics = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -sc-rpc = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -sc-rpc-api = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -sc-rpc-server = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -sc-service = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -sc-state-db = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -sc-sync-state-rpc = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -sc-sysinfo = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -sc-telemetry = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -sc-tracing = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -sc-tracing-proc-macro = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -sc-transaction-pool = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -sc-transaction-pool-api = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -sc-utils = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -sp-api = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -sp-api-proc-macro = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -sp-application-crypto = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -sp-arithmetic = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -sp-authority-discovery = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -sp-beefy = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -sp-block-builder = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -sp-blockchain = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -sp-consensus = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -sp-consensus-aura = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -sp-consensus-babe = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -sp-consensus-slots = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -sp-consensus-vrf = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -sp-core = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -sp-database = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -sp-debug-derive = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -sp-externalities = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -sp-finality-grandpa = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -sp-inherents = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -sp-io = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -sp-keyring = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -sp-keystore = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -sp-maybe-compressed-blob = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -sp-mmr-primitives = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -sp-npos-elections = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -sp-offchain = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -sp-panic-handler = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -sp-rpc = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -sp-runtime = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -sp-runtime-interface = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -sp-runtime-interface-proc-macro = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -sp-session = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -sp-staking = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -sp-state-machine = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -sp-std = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -sp-storage = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -sp-timestamp = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -sp-tracing = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -sp-transaction-pool = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -sp-transaction-storage-proof = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -sp-trie = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -sp-version = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -sp-version-proc-macro = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -sp-wasm-interface = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -sp-weights = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -substrate-build-script-utils = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -substrate-frame-rpc-system = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -substrate-prometheus-endpoint = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -substrate-rpc-client = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -substrate-state-trie-migration-rpc = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -substrate-wasm-builder = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } -try-runtime-cli = { git = "https://github.com/darwinia-network/substrate", branch = "polkadot-v0.9.37" } - -[patch."https://github.com/paritytech/cumulus"] -cumulus-client-cli = { git = "https://github.com/darwinia-network/cumulus", branch = "remove-assertion-v0.9.37" } -cumulus-client-collator = { git = "https://github.com/darwinia-network/cumulus", branch = "remove-assertion-v0.9.37" } -cumulus-client-consensus-aura = { git = "https://github.com/darwinia-network/cumulus", branch = "remove-assertion-v0.9.37" } -cumulus-client-consensus-common = { git = "https://github.com/darwinia-network/cumulus", branch = "remove-assertion-v0.9.37" } -cumulus-client-network = { git = "https://github.com/darwinia-network/cumulus", branch = "remove-assertion-v0.9.37" } -cumulus-client-service = { git = "https://github.com/darwinia-network/cumulus", branch = "remove-assertion-v0.9.37" } -cumulus-pallet-aura-ext = { git = "https://github.com/darwinia-network/cumulus", branch = "remove-assertion-v0.9.37" } -cumulus-pallet-dmp-queue = { git = "https://github.com/darwinia-network/cumulus", branch = "remove-assertion-v0.9.37" } -cumulus-pallet-parachain-system = { git = "https://github.com/darwinia-network/cumulus", branch = "remove-assertion-v0.9.37" } -cumulus-pallet-session-benchmarking = { git = "https://github.com/darwinia-network/cumulus", branch = "remove-assertion-v0.9.37" } -cumulus-pallet-xcm = { git = "https://github.com/darwinia-network/cumulus", branch = "remove-assertion-v0.9.37" } -cumulus-pallet-xcmp-queue = { git = "https://github.com/darwinia-network/cumulus", branch = "remove-assertion-v0.9.37" } -cumulus-primitives-core = { git = "https://github.com/darwinia-network/cumulus", branch = "remove-assertion-v0.9.37" } -cumulus-primitives-parachain-inherent = { git = "https://github.com/darwinia-network/cumulus", branch = "remove-assertion-v0.9.37" } -cumulus-primitives-timestamp = { git = "https://github.com/darwinia-network/cumulus", branch = "remove-assertion-v0.9.37" } -cumulus-primitives-utility = { git = "https://github.com/darwinia-network/cumulus", branch = "remove-assertion-v0.9.37" } -cumulus-relay-chain-interface = { git = "https://github.com/darwinia-network/cumulus", branch = "remove-assertion-v0.9.37" } -parachain-info = { git = "https://github.com/darwinia-network/cumulus", branch = "remove-assertion-v0.9.37" } +frame-benchmarking = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } +frame-benchmarking-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } +frame-executive = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } +frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } +frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } +frame-system-benchmarking = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } +frame-system-rpc-runtime-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } +frame-try-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } +pallet-assets = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } +pallet-aura = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } +pallet-authorship = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } +pallet-balances = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } +pallet-collective = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } +pallet-democracy = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } +pallet-elections-phragmen = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } +pallet-identity = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } +pallet-membership = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } +pallet-preimage = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } +pallet-proxy = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } +pallet-scheduler = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } +pallet-session = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } +pallet-sudo = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } +pallet-timestamp = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } +pallet-tips = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } +pallet-transaction-payment = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } +pallet-transaction-payment-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } +pallet-transaction-payment-rpc-runtime-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } +pallet-treasury = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } +pallet-utility = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } +pallet-vesting = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } +sc-basic-authorship = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } +sc-chain-spec = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } +sc-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } +sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } +sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } +sc-consensus-aura = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } +sc-executor = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } +sc-keystore = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } +sc-network = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } +sc-network-common = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } +sc-offchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } +sc-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } +sc-rpc-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } +sc-service = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } +sc-sysinfo = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } +sc-telemetry = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } +sc-tracing = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } +sc-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } +sc-transaction-pool-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } +sp-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } +sp-arithmetic = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } +sp-block-builder = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } +sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } +sp-consensus = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } +sp-consensus-aura = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } +sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } +sp-inherents = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } +sp-io = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } +sp-keyring = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } +sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } +sp-offchain = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } +sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } +sp-session = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } +sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } +sp-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } +sp-transaction-pool = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } +sp-version = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } +substrate-build-script-utils = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } +substrate-frame-rpc-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } +substrate-prometheus-endpoint = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } +substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } +try-runtime-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } From c92e180f5a9787294e5a22a8809b67900da4f9ae Mon Sep 17 00:00:00 2001 From: Guantong Date: Thu, 2 Mar 2023 09:44:46 +0800 Subject: [PATCH 164/189] Companion for paritytech/cumulus#2067 --- node/src/command.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node/src/command.rs b/node/src/command.rs index 1a11952a3..947d1adb5 100644 --- a/node/src/command.rs +++ b/node/src/command.rs @@ -674,7 +674,7 @@ pub fn run() -> Result<()> { ); let id = ParaId::from(para_id); let parachain_account = - AccountIdConversion::::into_account_truncating(&id); + AccountIdConversion::::into_account_truncating(&id); let state_version = Cli::native_runtime_version(&config.chain_spec).state_version(); let block: Block = cumulus_client_cli::generate_genesis_block(&*config.chain_spec, state_version) From 4140e16d02dfd521a6473a43da6c00b56da141d5 Mon Sep 17 00:00:00 2001 From: Guantong Date: Thu, 2 Mar 2023 10:15:10 +0800 Subject: [PATCH 165/189] Companion for paritytech/cumulus#697 XCM v3 --- runtime/common/src/xcm_configs.rs | 17 +++--- runtime/crab/src/pallets/polkadot_xcm.rs | 57 +++++++++++++++----- runtime/crab/src/pallets/xcmp_queue.rs | 1 + runtime/darwinia/src/pallets/polkadot_xcm.rs | 53 ++++++++++++++---- runtime/darwinia/src/pallets/xcmp_queue.rs | 1 + runtime/pangolin/src/pallets/polkadot_xcm.rs | 53 ++++++++++++++---- runtime/pangolin/src/pallets/xcmp_queue.rs | 1 + runtime/pangoro/src/pallets/polkadot_xcm.rs | 53 ++++++++++++++---- runtime/pangoro/src/pallets/xcmp_queue.rs | 1 + 9 files changed, 185 insertions(+), 52 deletions(-) diff --git a/runtime/common/src/xcm_configs.rs b/runtime/common/src/xcm_configs.rs index ad47ef8e9..436c1dc26 100644 --- a/runtime/common/src/xcm_configs.rs +++ b/runtime/common/src/xcm_configs.rs @@ -70,9 +70,9 @@ where { fn should_execute( origin: &MultiLocation, - message: &mut Xcm, - max_weight: XcmWeight, - weight_credit: &mut XcmWeight, + message: &mut [Instruction], + max_weight: Weight, + weight_credit: &mut Weight, ) -> Result<(), ()> { Deny::should_execute(origin, message, max_weight, weight_credit)?; Allow::should_execute(origin, message, max_weight, weight_credit) @@ -84,12 +84,11 @@ pub struct DenyReserveTransferToRelayChain; impl ShouldExecute for DenyReserveTransferToRelayChain { fn should_execute( origin: &MultiLocation, - - message: &mut Xcm, - _max_weight: XcmWeight, - _weight_credit: &mut XcmWeight, + message: &mut [Instruction], + _max_weight: Weight, + _weight_credit: &mut Weight, ) -> Result<(), ()> { - if message.0.iter().any(|inst| { + if message.iter().any(|inst| { matches!( inst, InitiateReserveWithdraw { @@ -108,7 +107,7 @@ impl ShouldExecute for DenyReserveTransferToRelayChain { // An unexpected reserve transfer has arrived from the Relay Chain. Generally, `IsReserve` // should not allow this, but we just log it here. if matches!(origin, MultiLocation { parents: 1, interior: Here }) - && message.0.iter().any(|inst| matches!(inst, ReserveAssetDeposited { .. })) + && message.iter().any(|inst| matches!(inst, ReserveAssetDeposited { .. })) { log::warn!( target: "xcm::barriers", diff --git a/runtime/crab/src/pallets/polkadot_xcm.rs b/runtime/crab/src/pallets/polkadot_xcm.rs index ba6375318..b3ed01656 100644 --- a/runtime/crab/src/pallets/polkadot_xcm.rs +++ b/runtime/crab/src/pallets/polkadot_xcm.rs @@ -36,7 +36,7 @@ pub type LocalAssetTransactor = xcm_builder::CurrencyAdapter< >; frame_support::parameter_types! { - pub const RelayNetwork: xcm::latest::prelude::NetworkId = xcm::latest::prelude::NetworkId::Kusama; + pub const RelayNetwork: Option = Some(xcm::latest::NetworkId::Kusama); pub RelayChainOrigin: RuntimeOrigin = cumulus_pallet_xcm::Origin::Relay.into(); } /// Type for specifying how a `MultiLocation` can be converted into an `AccountId`. This is used @@ -77,27 +77,36 @@ pub type Barrier = darwinia_common_runtime::xcm_configs::DenyThenTry< darwinia_common_runtime::xcm_configs::DenyReserveTransferToRelayChain, ( xcm_builder::TakeWeightCredit, - xcm_builder::AllowTopLevelPaidExecutionFrom, - // Parent and its exec plurality get free execution - xcm_builder::AllowUnpaidExecutionFrom< - darwinia_common_runtime::xcm_configs::ParentOrParentsExecutivePlurality, + WithComputedOrigin< + ( + xcm_builder::AllowTopLevelPaidExecutionFrom, + // Parent and its exec plurality get free execution + xcm_builder::AllowUnpaidExecutionFrom< + darwinia_common_runtime::xcm_configs::ParentOrParentsExecutivePlurality, + >, + // Subscriptions for version tracking are OK. + xcm_builder::AllowSubscriptionsFrom< + darwinia_common_runtime::xcm_configs::ParentOrSiblings, + >, + ), + UniversalLocation, + ConstU32<8>, >, // Expected responses are OK. xcm_builder::AllowKnownQueryResponses, - // Subscriptions for version tracking are OK. - xcm_builder::AllowSubscriptionsFrom, ), >; frame_support::parameter_types! { + pub const MaxAssetsIntoHolding: u32 = 64; pub const MaxInstructions: u32 = 100; pub AnchoringSelfReserve: xcm::latest::prelude::MultiLocation = xcm::latest::prelude::MultiLocation::new( 0, xcm::latest::prelude::X1(xcm::latest::prelude::PalletInstance(::index() as u8)) ); + pub UniversalLocation: xcm::latest::prelude::InteriorMultiLocation = xcm::latest::prelude::Parachain(ParachainInfo::parachain_id().into()).into(); // One XCM operation is 1_000_000_000 weight - almost certainly a conservative estimate. - pub Ancestry: xcm::latest::prelude::MultiLocation = xcm::latest::prelude::Parachain(ParachainInfo::parachain_id().into()).into(); - pub UnitWeightCost: u64 = 1_000_000_000; + pub UnitWeightCost: Weight = Weight::from_parts(1_000_000_000, 64 * 1024); } pub struct ToTreasury; @@ -122,17 +131,23 @@ impl xcm_builder::TakeRevenue for ToTreasury { pub struct XcmExecutorConfig; impl xcm_executor::Config for XcmExecutorConfig { type AssetClaims = PolkadotXcm; + type AssetExchanger = (); + type AssetLocker = (); // How to withdraw and deposit an asset. type AssetTransactor = LocalAssetTransactor; type AssetTrap = PolkadotXcm; type Barrier = Barrier; + type CallDispatcher = RuntimeCall; + type FeeManager = (); type IsReserve = xcm_builder::NativeAsset; type IsTeleporter = (); - // Teleporting is disabled. - type LocationInverter = xcm_builder::LocationInverter; + type MaxAssetsIntoHolding = MaxAssetsIntoHolding; + type MessageExporter = (); type OriginConverter = XcmOriginToTransactDispatchOrigin; + type PalletInstancesInfo = AllPalletsWithSystem; type ResponseHandler = PolkadotXcm; type RuntimeCall = RuntimeCall; + type SafeCallFilter = Everything; type SubscriptionService = PolkadotXcm; type Trader = xcm_configs::LocalAssetTrader< frame_support::weights::ConstantMultiplier< @@ -145,6 +160,9 @@ impl xcm_executor::Config for XcmExecutorConfig { DealWithFees, ToTreasury, >; + type UniversalAliases = Nothing; + // Teleporting is disabled. + type UniversalLocation = UniversalLocation; type Weigher = xcm_builder::FixedWeightBounds; type XcmSender = XcmRouter; } @@ -156,21 +174,34 @@ pub type LocalOriginToLocation = /// queues. pub type XcmRouter = ( // Two routers - use UMP to communicate with the relay chain: - cumulus_primitives_utility::ParentAsUmp, + cumulus_primitives_utility::ParentAsUmp, // ..and XCMP to communicate with the sibling chains. XcmpQueue, ); +#[cfg(feature = "runtime-benchmarks")] +parameter_types! { + pub ReachableDest: Option = Some(Parent.into()); +} + impl pallet_xcm::Config for Runtime { // ^ Override for AdvertisedXcmVersion default type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion; + type Currency = Balances; + type CurrencyMatcher = (); type ExecuteXcmOrigin = xcm_builder::EnsureXcmOrigin; - type LocationInverter = xcm_builder::LocationInverter; + type MaxLockers = ConstU32<8>; + #[cfg(feature = "runtime-benchmarks")] + type ReachableDest = ReachableDest; type RuntimeCall = RuntimeCall; type RuntimeEvent = RuntimeEvent; type RuntimeOrigin = RuntimeOrigin; type SendXcmOrigin = xcm_builder::EnsureXcmOrigin; + type SovereignAccountOf = LocationToAccountId; + type TrustedLockers = (); + type UniversalLocation = UniversalLocation; type Weigher = xcm_builder::FixedWeightBounds; + type WeightInfo = pallet_xcm::TestWeightInfo; type XcmExecuteFilter = frame_support::traits::Everything; type XcmExecutor = xcm_executor::XcmExecutor; type XcmReserveTransferFilter = frame_support::traits::Everything; diff --git a/runtime/crab/src/pallets/xcmp_queue.rs b/runtime/crab/src/pallets/xcmp_queue.rs index f3f8d642d..9931ff3cc 100644 --- a/runtime/crab/src/pallets/xcmp_queue.rs +++ b/runtime/crab/src/pallets/xcmp_queue.rs @@ -28,4 +28,5 @@ impl cumulus_pallet_xcmp_queue::Config for Runtime { type VersionWrapper = (); type WeightInfo = weights::cumulus_pallet_xcmp_queue::WeightInfo; type XcmExecutor = xcm_executor::XcmExecutor; + type PriceForSiblingDelivery = (); } diff --git a/runtime/darwinia/src/pallets/polkadot_xcm.rs b/runtime/darwinia/src/pallets/polkadot_xcm.rs index 7eb1fbefa..98cb926c6 100644 --- a/runtime/darwinia/src/pallets/polkadot_xcm.rs +++ b/runtime/darwinia/src/pallets/polkadot_xcm.rs @@ -36,7 +36,7 @@ pub type LocalAssetTransactor = xcm_builder::CurrencyAdapter< >; frame_support::parameter_types! { - pub const RelayNetwork: xcm::latest::prelude::NetworkId = xcm::latest::prelude::NetworkId::Polkadot; + pub const RelayNetwork: Option = Some(xcm::latest::NetworkId::Polkadot); pub RelayChainOrigin: RuntimeOrigin = cumulus_pallet_xcm::Origin::Relay.into(); } /// Type for specifying how a `MultiLocation` can be converted into an `AccountId`. This is used @@ -77,10 +77,20 @@ pub type Barrier = darwinia_common_runtime::xcm_configs::DenyThenTry< darwinia_common_runtime::xcm_configs::DenyReserveTransferToRelayChain, ( xcm_builder::TakeWeightCredit, - xcm_builder::AllowTopLevelPaidExecutionFrom, - // Parent and its exec plurality get free execution - xcm_builder::AllowUnpaidExecutionFrom< - darwinia_common_runtime::xcm_configs::ParentOrParentsExecutivePlurality, + WithComputedOrigin< + ( + xcm_builder::AllowTopLevelPaidExecutionFrom, + // Parent and its exec plurality get free execution + xcm_builder::AllowUnpaidExecutionFrom< + darwinia_common_runtime::xcm_configs::ParentOrParentsExecutivePlurality, + >, + // Subscriptions for version tracking are OK. + xcm_builder::AllowSubscriptionsFrom< + darwinia_common_runtime::xcm_configs::ParentOrSiblings, + >, + ), + UniversalLocation, + ConstU32<8>, >, // Expected responses are OK. xcm_builder::AllowKnownQueryResponses, @@ -90,14 +100,15 @@ pub type Barrier = darwinia_common_runtime::xcm_configs::DenyThenTry< >; frame_support::parameter_types! { + pub const MaxAssetsIntoHolding: u32 = 64; pub const MaxInstructions: u32 = 100; pub AnchoringSelfReserve: xcm::latest::prelude::MultiLocation = xcm::latest::prelude::MultiLocation::new( 0, xcm::latest::prelude::X1(xcm::latest::prelude::PalletInstance(::index() as u8)) ); + pub UniversalLocation: xcm::latest::prelude::InteriorMultiLocation = xcm::latest::prelude::Parachain(ParachainInfo::parachain_id().into()).into(); // One XCM operation is 1_000_000_000 weight - almost certainly a conservative estimate. - pub Ancestry: xcm::latest::prelude::MultiLocation = xcm::latest::prelude::Parachain(ParachainInfo::parachain_id().into()).into(); - pub UnitWeightCost: u64 = 1_000_000_000; + pub UnitWeightCost: Weight = Weight::from_parts(1_000_000_000, 64 * 1024); } pub struct ToTreasury; @@ -129,7 +140,7 @@ impl xcm_executor::Config for XcmExecutorConfig { type IsReserve = xcm_builder::NativeAsset; type IsTeleporter = (); // Teleporting is disabled. - type LocationInverter = xcm_builder::LocationInverter; + type UniversalLocation = UniversalLocation; type OriginConverter = XcmOriginToTransactDispatchOrigin; type ResponseHandler = PolkadotXcm; type RuntimeCall = RuntimeCall; @@ -147,6 +158,15 @@ impl xcm_executor::Config for XcmExecutorConfig { >; type Weigher = xcm_builder::FixedWeightBounds; type XcmSender = XcmRouter; + type PalletInstancesInfo = AllPalletsWithSystem; + type MaxAssetsIntoHolding = MaxAssetsIntoHolding; + type AssetLocker = (); + type AssetExchanger = (); + type FeeManager = (); + type MessageExporter = (); + type UniversalAliases = Nothing; + type CallDispatcher = RuntimeCall; + type SafeCallFilter = Everything; } /// No local origins on this chain are allowed to dispatch XCM sends/executions. @@ -156,16 +176,21 @@ pub type LocalOriginToLocation = /// queues. pub type XcmRouter = ( // Two routers - use UMP to communicate with the relay chain: - cumulus_primitives_utility::ParentAsUmp, + cumulus_primitives_utility::ParentAsUmp, // ..and XCMP to communicate with the sibling chains. XcmpQueue, ); +#[cfg(feature = "runtime-benchmarks")] +parameter_types! { + pub ReachableDest: Option = Some(Parent.into()); +} + impl pallet_xcm::Config for Runtime { // ^ Override for AdvertisedXcmVersion default type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion; type ExecuteXcmOrigin = xcm_builder::EnsureXcmOrigin; - type LocationInverter = xcm_builder::LocationInverter; + type UniversalLocation = UniversalLocation; type RuntimeCall = RuntimeCall; type RuntimeEvent = RuntimeEvent; type RuntimeOrigin = RuntimeOrigin; @@ -178,6 +203,14 @@ impl pallet_xcm::Config for Runtime { type XcmTeleportFilter = frame_support::traits::Nothing; const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100; + type Currency = Balances; + type CurrencyMatcher = (); + type TrustedLockers = (); + type SovereignAccountOf = LocationToAccountId; + type MaxLockers = ConstU32<8>; + type WeightInfo = pallet_xcm::TestWeightInfo; + #[cfg(feature = "runtime-benchmarks")] + type ReachableDest = ReachableDest; } impl cumulus_pallet_xcm::Config for Runtime { diff --git a/runtime/darwinia/src/pallets/xcmp_queue.rs b/runtime/darwinia/src/pallets/xcmp_queue.rs index f3f8d642d..9931ff3cc 100644 --- a/runtime/darwinia/src/pallets/xcmp_queue.rs +++ b/runtime/darwinia/src/pallets/xcmp_queue.rs @@ -28,4 +28,5 @@ impl cumulus_pallet_xcmp_queue::Config for Runtime { type VersionWrapper = (); type WeightInfo = weights::cumulus_pallet_xcmp_queue::WeightInfo; type XcmExecutor = xcm_executor::XcmExecutor; + type PriceForSiblingDelivery = (); } diff --git a/runtime/pangolin/src/pallets/polkadot_xcm.rs b/runtime/pangolin/src/pallets/polkadot_xcm.rs index 4aec5bbe3..0bcc91f43 100644 --- a/runtime/pangolin/src/pallets/polkadot_xcm.rs +++ b/runtime/pangolin/src/pallets/polkadot_xcm.rs @@ -36,7 +36,7 @@ pub type LocalAssetTransactor = xcm_builder::CurrencyAdapter< >; frame_support::parameter_types! { - pub const RelayNetwork: xcm::latest::prelude::NetworkId = xcm::latest::prelude::NetworkId::Any; + pub const RelayNetwork: Option = None; pub RelayChainOrigin: RuntimeOrigin = cumulus_pallet_xcm::Origin::Relay.into(); } /// Type for specifying how a `MultiLocation` can be converted into an `AccountId`. This is used @@ -77,10 +77,20 @@ pub type Barrier = darwinia_common_runtime::xcm_configs::DenyThenTry< darwinia_common_runtime::xcm_configs::DenyReserveTransferToRelayChain, ( xcm_builder::TakeWeightCredit, - xcm_builder::AllowTopLevelPaidExecutionFrom, - // Parent and its exec plurality get free execution - xcm_builder::AllowUnpaidExecutionFrom< - darwinia_common_runtime::xcm_configs::ParentOrParentsExecutivePlurality, + WithComputedOrigin< + ( + xcm_builder::AllowTopLevelPaidExecutionFrom, + // Parent and its exec plurality get free execution + xcm_builder::AllowUnpaidExecutionFrom< + darwinia_common_runtime::xcm_configs::ParentOrParentsExecutivePlurality, + >, + // Subscriptions for version tracking are OK. + xcm_builder::AllowSubscriptionsFrom< + darwinia_common_runtime::xcm_configs::ParentOrSiblings, + >, + ), + UniversalLocation, + ConstU32<8>, >, // Expected responses are OK. xcm_builder::AllowKnownQueryResponses, @@ -90,14 +100,15 @@ pub type Barrier = darwinia_common_runtime::xcm_configs::DenyThenTry< >; frame_support::parameter_types! { + pub const MaxAssetsIntoHolding: u32 = 64; pub const MaxInstructions: u32 = 100; pub AnchoringSelfReserve: xcm::latest::prelude::MultiLocation = xcm::latest::prelude::MultiLocation::new( 0, xcm::latest::prelude::X1(xcm::latest::prelude::PalletInstance(::index() as u8)) ); + pub UniversalLocation: xcm::latest::prelude::InteriorMultiLocation = xcm::latest::prelude::Parachain(ParachainInfo::parachain_id().into()).into(); // One XCM operation is 1_000_000_000 weight - almost certainly a conservative estimate. - pub Ancestry: xcm::latest::prelude::MultiLocation = xcm::latest::prelude::Parachain(ParachainInfo::parachain_id().into()).into(); - pub UnitWeightCost: u64 = 1_000_000_000; + pub UnitWeightCost: Weight = Weight::from_parts(1_000_000_000, 64 * 1024); } pub struct ToTreasury; @@ -129,7 +140,7 @@ impl xcm_executor::Config for XcmExecutorConfig { type IsReserve = xcm_builder::NativeAsset; type IsTeleporter = (); // Teleporting is disabled. - type LocationInverter = xcm_builder::LocationInverter; + type UniversalLocation = UniversalLocation; type OriginConverter = XcmOriginToTransactDispatchOrigin; type ResponseHandler = PolkadotXcm; type RuntimeCall = RuntimeCall; @@ -147,6 +158,15 @@ impl xcm_executor::Config for XcmExecutorConfig { >; type Weigher = xcm_builder::FixedWeightBounds; type XcmSender = XcmRouter; + type PalletInstancesInfo = AllPalletsWithSystem; + type MaxAssetsIntoHolding = MaxAssetsIntoHolding; + type AssetLocker = (); + type AssetExchanger = (); + type FeeManager = (); + type MessageExporter = (); + type UniversalAliases = Nothing; + type CallDispatcher = RuntimeCall; + type SafeCallFilter = Everything; } /// No local origins on this chain are allowed to dispatch XCM sends/executions. @@ -156,16 +176,21 @@ pub type LocalOriginToLocation = /// queues. pub type XcmRouter = ( // Two routers - use UMP to communicate with the relay chain: - cumulus_primitives_utility::ParentAsUmp, + cumulus_primitives_utility::ParentAsUmp, // ..and XCMP to communicate with the sibling chains. XcmpQueue, ); +#[cfg(feature = "runtime-benchmarks")] +parameter_types! { + pub ReachableDest: Option = Some(Parent.into()); +} + impl pallet_xcm::Config for Runtime { // ^ Override for AdvertisedXcmVersion default type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion; type ExecuteXcmOrigin = xcm_builder::EnsureXcmOrigin; - type LocationInverter = xcm_builder::LocationInverter; + type UniversalLocation = UniversalLocation; type RuntimeCall = RuntimeCall; type RuntimeEvent = RuntimeEvent; type RuntimeOrigin = RuntimeOrigin; @@ -178,6 +203,14 @@ impl pallet_xcm::Config for Runtime { type XcmTeleportFilter = frame_support::traits::Nothing; const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100; + type Currency = Balances; + type CurrencyMatcher = (); + type TrustedLockers = (); + type SovereignAccountOf = LocationToAccountId; + type MaxLockers = ConstU32<8>; + type WeightInfo = pallet_xcm::TestWeightInfo; + #[cfg(feature = "runtime-benchmarks")] + type ReachableDest = ReachableDest; } impl cumulus_pallet_xcm::Config for Runtime { diff --git a/runtime/pangolin/src/pallets/xcmp_queue.rs b/runtime/pangolin/src/pallets/xcmp_queue.rs index f3f8d642d..9931ff3cc 100644 --- a/runtime/pangolin/src/pallets/xcmp_queue.rs +++ b/runtime/pangolin/src/pallets/xcmp_queue.rs @@ -28,4 +28,5 @@ impl cumulus_pallet_xcmp_queue::Config for Runtime { type VersionWrapper = (); type WeightInfo = weights::cumulus_pallet_xcmp_queue::WeightInfo; type XcmExecutor = xcm_executor::XcmExecutor; + type PriceForSiblingDelivery = (); } diff --git a/runtime/pangoro/src/pallets/polkadot_xcm.rs b/runtime/pangoro/src/pallets/polkadot_xcm.rs index 4aec5bbe3..0bcc91f43 100644 --- a/runtime/pangoro/src/pallets/polkadot_xcm.rs +++ b/runtime/pangoro/src/pallets/polkadot_xcm.rs @@ -36,7 +36,7 @@ pub type LocalAssetTransactor = xcm_builder::CurrencyAdapter< >; frame_support::parameter_types! { - pub const RelayNetwork: xcm::latest::prelude::NetworkId = xcm::latest::prelude::NetworkId::Any; + pub const RelayNetwork: Option = None; pub RelayChainOrigin: RuntimeOrigin = cumulus_pallet_xcm::Origin::Relay.into(); } /// Type for specifying how a `MultiLocation` can be converted into an `AccountId`. This is used @@ -77,10 +77,20 @@ pub type Barrier = darwinia_common_runtime::xcm_configs::DenyThenTry< darwinia_common_runtime::xcm_configs::DenyReserveTransferToRelayChain, ( xcm_builder::TakeWeightCredit, - xcm_builder::AllowTopLevelPaidExecutionFrom, - // Parent and its exec plurality get free execution - xcm_builder::AllowUnpaidExecutionFrom< - darwinia_common_runtime::xcm_configs::ParentOrParentsExecutivePlurality, + WithComputedOrigin< + ( + xcm_builder::AllowTopLevelPaidExecutionFrom, + // Parent and its exec plurality get free execution + xcm_builder::AllowUnpaidExecutionFrom< + darwinia_common_runtime::xcm_configs::ParentOrParentsExecutivePlurality, + >, + // Subscriptions for version tracking are OK. + xcm_builder::AllowSubscriptionsFrom< + darwinia_common_runtime::xcm_configs::ParentOrSiblings, + >, + ), + UniversalLocation, + ConstU32<8>, >, // Expected responses are OK. xcm_builder::AllowKnownQueryResponses, @@ -90,14 +100,15 @@ pub type Barrier = darwinia_common_runtime::xcm_configs::DenyThenTry< >; frame_support::parameter_types! { + pub const MaxAssetsIntoHolding: u32 = 64; pub const MaxInstructions: u32 = 100; pub AnchoringSelfReserve: xcm::latest::prelude::MultiLocation = xcm::latest::prelude::MultiLocation::new( 0, xcm::latest::prelude::X1(xcm::latest::prelude::PalletInstance(::index() as u8)) ); + pub UniversalLocation: xcm::latest::prelude::InteriorMultiLocation = xcm::latest::prelude::Parachain(ParachainInfo::parachain_id().into()).into(); // One XCM operation is 1_000_000_000 weight - almost certainly a conservative estimate. - pub Ancestry: xcm::latest::prelude::MultiLocation = xcm::latest::prelude::Parachain(ParachainInfo::parachain_id().into()).into(); - pub UnitWeightCost: u64 = 1_000_000_000; + pub UnitWeightCost: Weight = Weight::from_parts(1_000_000_000, 64 * 1024); } pub struct ToTreasury; @@ -129,7 +140,7 @@ impl xcm_executor::Config for XcmExecutorConfig { type IsReserve = xcm_builder::NativeAsset; type IsTeleporter = (); // Teleporting is disabled. - type LocationInverter = xcm_builder::LocationInverter; + type UniversalLocation = UniversalLocation; type OriginConverter = XcmOriginToTransactDispatchOrigin; type ResponseHandler = PolkadotXcm; type RuntimeCall = RuntimeCall; @@ -147,6 +158,15 @@ impl xcm_executor::Config for XcmExecutorConfig { >; type Weigher = xcm_builder::FixedWeightBounds; type XcmSender = XcmRouter; + type PalletInstancesInfo = AllPalletsWithSystem; + type MaxAssetsIntoHolding = MaxAssetsIntoHolding; + type AssetLocker = (); + type AssetExchanger = (); + type FeeManager = (); + type MessageExporter = (); + type UniversalAliases = Nothing; + type CallDispatcher = RuntimeCall; + type SafeCallFilter = Everything; } /// No local origins on this chain are allowed to dispatch XCM sends/executions. @@ -156,16 +176,21 @@ pub type LocalOriginToLocation = /// queues. pub type XcmRouter = ( // Two routers - use UMP to communicate with the relay chain: - cumulus_primitives_utility::ParentAsUmp, + cumulus_primitives_utility::ParentAsUmp, // ..and XCMP to communicate with the sibling chains. XcmpQueue, ); +#[cfg(feature = "runtime-benchmarks")] +parameter_types! { + pub ReachableDest: Option = Some(Parent.into()); +} + impl pallet_xcm::Config for Runtime { // ^ Override for AdvertisedXcmVersion default type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion; type ExecuteXcmOrigin = xcm_builder::EnsureXcmOrigin; - type LocationInverter = xcm_builder::LocationInverter; + type UniversalLocation = UniversalLocation; type RuntimeCall = RuntimeCall; type RuntimeEvent = RuntimeEvent; type RuntimeOrigin = RuntimeOrigin; @@ -178,6 +203,14 @@ impl pallet_xcm::Config for Runtime { type XcmTeleportFilter = frame_support::traits::Nothing; const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100; + type Currency = Balances; + type CurrencyMatcher = (); + type TrustedLockers = (); + type SovereignAccountOf = LocationToAccountId; + type MaxLockers = ConstU32<8>; + type WeightInfo = pallet_xcm::TestWeightInfo; + #[cfg(feature = "runtime-benchmarks")] + type ReachableDest = ReachableDest; } impl cumulus_pallet_xcm::Config for Runtime { diff --git a/runtime/pangoro/src/pallets/xcmp_queue.rs b/runtime/pangoro/src/pallets/xcmp_queue.rs index f3f8d642d..9931ff3cc 100644 --- a/runtime/pangoro/src/pallets/xcmp_queue.rs +++ b/runtime/pangoro/src/pallets/xcmp_queue.rs @@ -28,4 +28,5 @@ impl cumulus_pallet_xcmp_queue::Config for Runtime { type VersionWrapper = (); type WeightInfo = weights::cumulus_pallet_xcmp_queue::WeightInfo; type XcmExecutor = xcm_executor::XcmExecutor; + type PriceForSiblingDelivery = (); } From 8a59e125e29e96568d179797a402fd766c10e51a Mon Sep 17 00:00:00 2001 From: Guantong Date: Thu, 2 Mar 2023 10:20:45 +0800 Subject: [PATCH 166/189] Companion for paritytech/cumulus#2096 --- node/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node/Cargo.toml b/node/Cargo.toml index b7ee6fa6b..71dde80ce 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -13,7 +13,7 @@ substrate-build-script-utils = { workspace = true } # crates.io array-bytes = { workspace = true } async-trait = { version = "0.1" } -clap = { version = "4.0", features = ["derive"] } +clap = { version = "4.1", features = ["derive"] } codec = { package = "parity-scale-codec", workspace = true } futures = { version = "0.3" } jsonrpsee = { version = "0.16", features = ["server"] } From 373ef3b31b4b91055c444488bbd4614d1e28f366 Mon Sep 17 00:00:00 2001 From: Guantong Date: Thu, 2 Mar 2023 10:23:07 +0800 Subject: [PATCH 167/189] Companion for paritytech/cumulus#1863 --- node/src/command.rs | 7 ++----- node/src/service/mod.rs | 8 ++++++++ 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/node/src/command.rs b/node/src/command.rs index 947d1adb5..0776ca42e 100644 --- a/node/src/command.rs +++ b/node/src/command.rs @@ -654,14 +654,11 @@ pub fn run() -> Result<()> { runner.run_node_until_exit(|config| async move { let chain_spec = &config.chain_spec; - let hwbench = if !cli.no_hardware_benchmarks { + let hwbench = (!cli.no_hardware_benchmarks).then_some( config.database.path().map(|database_path| { let _ = std::fs::create_dir_all(database_path); sc_sysinfo::gather_hwbench(Some(database_path)) - }) - } else { - None - }; + })).flatten(); set_default_ss58_version(chain_spec); diff --git a/node/src/service/mod.rs b/node/src/service/mod.rs index 3f1369aa1..6aa4005a4 100644 --- a/node/src/service/mod.rs +++ b/node/src/service/mod.rs @@ -416,6 +416,14 @@ where if let Some(hwbench) = hwbench { sc_sysinfo::print_hwbench(&hwbench); + // Here you can check whether the hardware meets your chains' requirements. Putting a link + // in there and swapping out the requirements for your own are probably a good idea. The + // requirements for a para-chain are dictated by its relay-chain. + if !SUBSTRATE_REFERENCE_HARDWARE.check_hardware(&hwbench) && validator { + log::warn!( + "⚠️ The hardware does not meet the minimal requirements for role 'Authority'." + ); + } if let Some(ref mut telemetry) = telemetry { let telemetry_handle = telemetry.handle(); From 3506b418683bd400a8a2fd6e953e7f13acf52d35 Mon Sep 17 00:00:00 2001 From: Guantong Date: Thu, 2 Mar 2023 10:28:03 +0800 Subject: [PATCH 168/189] Companion for paritytech/cumulus#2073 --- runtime/crab/src/lib.rs | 8 ++++++++ runtime/darwinia/src/lib.rs | 8 ++++++++ runtime/pangolin/src/lib.rs | 8 ++++++++ runtime/pangoro/src/lib.rs | 8 ++++++++ 4 files changed, 32 insertions(+) diff --git a/runtime/crab/src/lib.rs b/runtime/crab/src/lib.rs index 6f7ed1f1c..012a6a148 100644 --- a/runtime/crab/src/lib.rs +++ b/runtime/crab/src/lib.rs @@ -215,6 +215,14 @@ sp_api::impl_runtime_apis! { fn authorities() -> Vec { Aura::authorities().into_inner() } + + fn query_weight_to_fee(weight: Weight) -> Balance { + TransactionPayment::weight_to_fee(weight) + } + + fn query_length_to_fee(length: u32) -> Balance { + TransactionPayment::length_to_fee(length) + } } impl sp_api::Core for Runtime { diff --git a/runtime/darwinia/src/lib.rs b/runtime/darwinia/src/lib.rs index 5e442f580..f870fc237 100644 --- a/runtime/darwinia/src/lib.rs +++ b/runtime/darwinia/src/lib.rs @@ -215,6 +215,14 @@ sp_api::impl_runtime_apis! { fn authorities() -> Vec { Aura::authorities().into_inner() } + + fn query_weight_to_fee(weight: Weight) -> Balance { + TransactionPayment::weight_to_fee(weight) + } + + fn query_length_to_fee(length: u32) -> Balance { + TransactionPayment::length_to_fee(length) + } } impl sp_api::Core for Runtime { diff --git a/runtime/pangolin/src/lib.rs b/runtime/pangolin/src/lib.rs index 71e36fb3c..90b87af88 100644 --- a/runtime/pangolin/src/lib.rs +++ b/runtime/pangolin/src/lib.rs @@ -217,6 +217,14 @@ sp_api::impl_runtime_apis! { fn authorities() -> Vec { Aura::authorities().into_inner() } + + fn query_weight_to_fee(weight: Weight) -> Balance { + TransactionPayment::weight_to_fee(weight) + } + + fn query_length_to_fee(length: u32) -> Balance { + TransactionPayment::length_to_fee(length) + } } impl sp_api::Core for Runtime { diff --git a/runtime/pangoro/src/lib.rs b/runtime/pangoro/src/lib.rs index b69c606a6..3693be58f 100644 --- a/runtime/pangoro/src/lib.rs +++ b/runtime/pangoro/src/lib.rs @@ -217,6 +217,14 @@ sp_api::impl_runtime_apis! { fn authorities() -> Vec { Aura::authorities().into_inner() } + + fn query_weight_to_fee(weight: Weight) -> Balance { + TransactionPayment::weight_to_fee(weight) + } + + fn query_length_to_fee(length: u32) -> Balance { + TransactionPayment::length_to_fee(length) + } } impl sp_api::Core for Runtime { From e1ca54028895bd5e0cf98afb4385fdb5bb295e35 Mon Sep 17 00:00:00 2001 From: Guantong Date: Thu, 2 Mar 2023 10:29:48 +0800 Subject: [PATCH 169/189] Companion for paritytech/cumulus#2126 --- runtime/crab/src/pallets/authorship.rs | 2 -- runtime/darwinia/src/pallets/authorship.rs | 2 -- runtime/pangolin/src/pallets/authorship.rs | 2 -- runtime/pangoro/src/pallets/authorship.rs | 2 -- 4 files changed, 8 deletions(-) diff --git a/runtime/crab/src/pallets/authorship.rs b/runtime/crab/src/pallets/authorship.rs index 5b5f8109d..80c215907 100644 --- a/runtime/crab/src/pallets/authorship.rs +++ b/runtime/crab/src/pallets/authorship.rs @@ -21,7 +21,5 @@ use crate::*; impl pallet_authorship::Config for Runtime { type EventHandler = (DarwiniaStaking,); - type FilterUncle = (); type FindAuthor = pallet_session::FindAccountFromAuthorIndex; - type UncleGenerations = ConstU32<0>; } diff --git a/runtime/darwinia/src/pallets/authorship.rs b/runtime/darwinia/src/pallets/authorship.rs index 5b5f8109d..80c215907 100644 --- a/runtime/darwinia/src/pallets/authorship.rs +++ b/runtime/darwinia/src/pallets/authorship.rs @@ -21,7 +21,5 @@ use crate::*; impl pallet_authorship::Config for Runtime { type EventHandler = (DarwiniaStaking,); - type FilterUncle = (); type FindAuthor = pallet_session::FindAccountFromAuthorIndex; - type UncleGenerations = ConstU32<0>; } diff --git a/runtime/pangolin/src/pallets/authorship.rs b/runtime/pangolin/src/pallets/authorship.rs index 5b5f8109d..80c215907 100644 --- a/runtime/pangolin/src/pallets/authorship.rs +++ b/runtime/pangolin/src/pallets/authorship.rs @@ -21,7 +21,5 @@ use crate::*; impl pallet_authorship::Config for Runtime { type EventHandler = (DarwiniaStaking,); - type FilterUncle = (); type FindAuthor = pallet_session::FindAccountFromAuthorIndex; - type UncleGenerations = ConstU32<0>; } diff --git a/runtime/pangoro/src/pallets/authorship.rs b/runtime/pangoro/src/pallets/authorship.rs index 5b5f8109d..80c215907 100644 --- a/runtime/pangoro/src/pallets/authorship.rs +++ b/runtime/pangoro/src/pallets/authorship.rs @@ -21,7 +21,5 @@ use crate::*; impl pallet_authorship::Config for Runtime { type EventHandler = (DarwiniaStaking,); - type FilterUncle = (); type FindAuthor = pallet_session::FindAccountFromAuthorIndex; - type UncleGenerations = ConstU32<0>; } From 857a05a2187e4a16d32b1486d70eecf1d692e918 Mon Sep 17 00:00:00 2001 From: Guantong Date: Thu, 2 Mar 2023 10:57:04 +0800 Subject: [PATCH 170/189] Use prepare branch --- Cargo.lock | 866 ++++++++++++++++++++++++++++------------------------- Cargo.toml | 22 +- 2 files changed, 472 insertions(+), 416 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3f7659bdf..1c2b48f35 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -15,7 +15,7 @@ dependencies = [ [[package]] name = "account" version = "0.1.1" -source = "git+https://github.com/darwinia-network/moonbeam?branch=polkadot-v0.9.37#3e272b5e0fad227e09880cd5a7c1c709a69f0a92" +source = "git+https://github.com/darwinia-network/moonbeam?branch=polkadot-v0.9.38#81caf339d816df9fab32bd2d7fd71a9d9b6b650f" dependencies = [ "blake2-rfc", "hex", @@ -508,7 +508,7 @@ dependencies = [ [[package]] name = "beefy-gadget" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "array-bytes 4.2.0", "async-trait", @@ -542,7 +542,7 @@ dependencies = [ [[package]] name = "beefy-gadget-rpc" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "beefy-gadget", "futures", @@ -561,7 +561,7 @@ dependencies = [ [[package]] name = "beefy-merkle-tree" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "sp-api", "sp-beefy", @@ -738,7 +738,7 @@ dependencies = [ [[package]] name = "bp-darwinia-core" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.37#1092b5c91cb64c508dc581bfa2e58f0801970d32" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=prepare-polkadot-v0.9.38#13267a91a97a46fcf02ce137272331733b88e512" dependencies = [ "account", "bp-messages", @@ -755,7 +755,7 @@ dependencies = [ [[package]] name = "bp-header-chain" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.37#1092b5c91cb64c508dc581bfa2e58f0801970d32" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=prepare-polkadot-v0.9.38#13267a91a97a46fcf02ce137272331733b88e512" dependencies = [ "bp-runtime", "finality-grandpa", @@ -772,7 +772,7 @@ dependencies = [ [[package]] name = "bp-message-dispatch" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.37#1092b5c91cb64c508dc581bfa2e58f0801970d32" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=prepare-polkadot-v0.9.38#13267a91a97a46fcf02ce137272331733b88e512" dependencies = [ "bp-runtime", "frame-support", @@ -785,7 +785,7 @@ dependencies = [ [[package]] name = "bp-messages" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.37#1092b5c91cb64c508dc581bfa2e58f0801970d32" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=prepare-polkadot-v0.9.38#13267a91a97a46fcf02ce137272331733b88e512" dependencies = [ "bitvec", "bp-runtime", @@ -802,7 +802,7 @@ dependencies = [ [[package]] name = "bp-parachains" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.37#1092b5c91cb64c508dc581bfa2e58f0801970d32" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=prepare-polkadot-v0.9.38#13267a91a97a46fcf02ce137272331733b88e512" dependencies = [ "bp-polkadot-core", "bp-runtime", @@ -815,7 +815,7 @@ dependencies = [ [[package]] name = "bp-polkadot-core" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.37#1092b5c91cb64c508dc581bfa2e58f0801970d32" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=prepare-polkadot-v0.9.38#13267a91a97a46fcf02ce137272331733b88e512" dependencies = [ "bp-messages", "bp-runtime", @@ -834,7 +834,7 @@ dependencies = [ [[package]] name = "bp-runtime" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.37#1092b5c91cb64c508dc581bfa2e58f0801970d32" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=prepare-polkadot-v0.9.38#13267a91a97a46fcf02ce137272331733b88e512" dependencies = [ "frame-support", "frame-system", @@ -855,7 +855,7 @@ dependencies = [ [[package]] name = "bp-test-utils" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.37#1092b5c91cb64c508dc581bfa2e58f0801970d32" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=prepare-polkadot-v0.9.38#13267a91a97a46fcf02ce137272331733b88e512" dependencies = [ "bp-header-chain", "ed25519-dalek", @@ -870,7 +870,7 @@ dependencies = [ [[package]] name = "bridge-runtime-common" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.37#1092b5c91cb64c508dc581bfa2e58f0801970d32" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=prepare-polkadot-v0.9.38#13267a91a97a46fcf02ce137272331733b88e512" dependencies = [ "bp-header-chain", "bp-message-dispatch", @@ -1693,7 +1693,7 @@ dependencies = [ [[package]] name = "cumulus-client-cli" version = "0.1.0" -source = "git+https://github.com/darwinia-network/cumulus?branch=remove-assertion-v0.9.37#3ea837814e9734c9831f652896a232807e88bed8" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.38#3275e271e8937c06dca44331e98f31ef020a71e6" dependencies = [ "clap", "parity-scale-codec", @@ -1708,7 +1708,7 @@ dependencies = [ [[package]] name = "cumulus-client-collator" version = "0.1.0" -source = "git+https://github.com/darwinia-network/cumulus?branch=remove-assertion-v0.9.37#3ea837814e9734c9831f652896a232807e88bed8" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.38#3275e271e8937c06dca44331e98f31ef020a71e6" dependencies = [ "cumulus-client-consensus-common", "cumulus-client-network", @@ -1731,7 +1731,7 @@ dependencies = [ [[package]] name = "cumulus-client-consensus-aura" version = "0.1.0" -source = "git+https://github.com/darwinia-network/cumulus?branch=remove-assertion-v0.9.37#3ea837814e9734c9831f652896a232807e88bed8" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.38#3275e271e8937c06dca44331e98f31ef020a71e6" dependencies = [ "async-trait", "cumulus-client-consensus-common", @@ -1760,7 +1760,7 @@ dependencies = [ [[package]] name = "cumulus-client-consensus-common" version = "0.1.0" -source = "git+https://github.com/darwinia-network/cumulus?branch=remove-assertion-v0.9.37#3ea837814e9734c9831f652896a232807e88bed8" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.38#3275e271e8937c06dca44331e98f31ef020a71e6" dependencies = [ "async-trait", "cumulus-client-pov-recovery", @@ -1783,7 +1783,7 @@ dependencies = [ [[package]] name = "cumulus-client-network" version = "0.1.0" -source = "git+https://github.com/darwinia-network/cumulus?branch=remove-assertion-v0.9.37#3ea837814e9734c9831f652896a232807e88bed8" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.38#3275e271e8937c06dca44331e98f31ef020a71e6" dependencies = [ "async-trait", "cumulus-relay-chain-interface", @@ -1806,7 +1806,7 @@ dependencies = [ [[package]] name = "cumulus-client-pov-recovery" version = "0.1.0" -source = "git+https://github.com/darwinia-network/cumulus?branch=remove-assertion-v0.9.37#3ea837814e9734c9831f652896a232807e88bed8" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.38#3275e271e8937c06dca44331e98f31ef020a71e6" dependencies = [ "cumulus-primitives-core", "cumulus-relay-chain-interface", @@ -1829,7 +1829,7 @@ dependencies = [ [[package]] name = "cumulus-client-service" version = "0.1.0" -source = "git+https://github.com/darwinia-network/cumulus?branch=remove-assertion-v0.9.37#3ea837814e9734c9831f652896a232807e88bed8" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.38#3275e271e8937c06dca44331e98f31ef020a71e6" dependencies = [ "cumulus-client-cli", "cumulus-client-collator", @@ -1857,7 +1857,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-aura-ext" version = "0.1.0" -source = "git+https://github.com/darwinia-network/cumulus?branch=remove-assertion-v0.9.37#3ea837814e9734c9831f652896a232807e88bed8" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.38#3275e271e8937c06dca44331e98f31ef020a71e6" dependencies = [ "frame-support", "frame-system", @@ -1873,7 +1873,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-dmp-queue" version = "0.1.0" -source = "git+https://github.com/darwinia-network/cumulus?branch=remove-assertion-v0.9.37#3ea837814e9734c9831f652896a232807e88bed8" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.38#3275e271e8937c06dca44331e98f31ef020a71e6" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -1890,7 +1890,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-parachain-system" version = "0.1.0" -source = "git+https://github.com/darwinia-network/cumulus?branch=remove-assertion-v0.9.37#3ea837814e9734c9831f652896a232807e88bed8" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.38#3275e271e8937c06dca44331e98f31ef020a71e6" dependencies = [ "bytes", "cumulus-pallet-parachain-system-proc-macro", @@ -1913,12 +1913,13 @@ dependencies = [ "sp-std", "sp-trie", "sp-version", + "xcm", ] [[package]] name = "cumulus-pallet-parachain-system-proc-macro" version = "0.1.0" -source = "git+https://github.com/darwinia-network/cumulus?branch=remove-assertion-v0.9.37#3ea837814e9734c9831f652896a232807e88bed8" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.38#3275e271e8937c06dca44331e98f31ef020a71e6" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -1929,7 +1930,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-session-benchmarking" version = "3.0.0" -source = "git+https://github.com/darwinia-network/cumulus?branch=remove-assertion-v0.9.37#3ea837814e9734c9831f652896a232807e88bed8" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.38#3275e271e8937c06dca44331e98f31ef020a71e6" dependencies = [ "frame-benchmarking", "frame-support", @@ -1943,7 +1944,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-xcm" version = "0.1.0" -source = "git+https://github.com/darwinia-network/cumulus?branch=remove-assertion-v0.9.37#3ea837814e9734c9831f652896a232807e88bed8" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.38#3275e271e8937c06dca44331e98f31ef020a71e6" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -1959,7 +1960,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-xcmp-queue" version = "0.1.0" -source = "git+https://github.com/darwinia-network/cumulus?branch=remove-assertion-v0.9.37#3ea837814e9734c9831f652896a232807e88bed8" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.38#3275e271e8937c06dca44331e98f31ef020a71e6" dependencies = [ "cumulus-primitives-core", "frame-benchmarking", @@ -1967,8 +1968,10 @@ dependencies = [ "frame-system", "log", "parity-scale-codec", + "polkadot-runtime-common", "rand_chacha 0.3.1", "scale-info", + "sp-io", "sp-runtime", "sp-std", "xcm", @@ -1978,7 +1981,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-core" version = "0.1.0" -source = "git+https://github.com/darwinia-network/cumulus?branch=remove-assertion-v0.9.37#3ea837814e9734c9831f652896a232807e88bed8" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.38#3275e271e8937c06dca44331e98f31ef020a71e6" dependencies = [ "parity-scale-codec", "polkadot-core-primitives", @@ -1988,12 +1991,13 @@ dependencies = [ "sp-runtime", "sp-std", "sp-trie", + "xcm", ] [[package]] name = "cumulus-primitives-parachain-inherent" version = "0.1.0" -source = "git+https://github.com/darwinia-network/cumulus?branch=remove-assertion-v0.9.37#3ea837814e9734c9831f652896a232807e88bed8" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.38#3275e271e8937c06dca44331e98f31ef020a71e6" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -2016,7 +2020,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-timestamp" version = "0.1.0" -source = "git+https://github.com/darwinia-network/cumulus?branch=remove-assertion-v0.9.37#3ea837814e9734c9831f652896a232807e88bed8" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.38#3275e271e8937c06dca44331e98f31ef020a71e6" dependencies = [ "cumulus-primitives-core", "futures", @@ -2029,12 +2033,14 @@ dependencies = [ [[package]] name = "cumulus-primitives-utility" version = "0.1.0" -source = "git+https://github.com/darwinia-network/cumulus?branch=remove-assertion-v0.9.37#3ea837814e9734c9831f652896a232807e88bed8" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.38#3275e271e8937c06dca44331e98f31ef020a71e6" dependencies = [ "cumulus-primitives-core", "frame-support", "log", "parity-scale-codec", + "polkadot-runtime-common", + "sp-io", "sp-runtime", "sp-std", "xcm", @@ -2045,7 +2051,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-inprocess-interface" version = "0.1.0" -source = "git+https://github.com/darwinia-network/cumulus?branch=remove-assertion-v0.9.37#3ea837814e9734c9831f652896a232807e88bed8" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.38#3275e271e8937c06dca44331e98f31ef020a71e6" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -2070,7 +2076,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-interface" version = "0.1.0" -source = "git+https://github.com/darwinia-network/cumulus?branch=remove-assertion-v0.9.37#3ea837814e9734c9831f652896a232807e88bed8" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.38#3275e271e8937c06dca44331e98f31ef020a71e6" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -2090,7 +2096,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-minimal-node" version = "0.1.0" -source = "git+https://github.com/darwinia-network/cumulus?branch=remove-assertion-v0.9.37#3ea837814e9734c9831f652896a232807e88bed8" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.38#3275e271e8937c06dca44331e98f31ef020a71e6" dependencies = [ "array-bytes 6.0.0", "async-trait", @@ -2098,7 +2104,7 @@ dependencies = [ "cumulus-relay-chain-interface", "cumulus-relay-chain-rpc-interface", "futures", - "lru", + "lru 0.9.0", "polkadot-core-primitives", "polkadot-network-bridge", "polkadot-node-network-protocol", @@ -2130,7 +2136,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-rpc-interface" version = "0.1.0" -source = "git+https://github.com/darwinia-network/cumulus?branch=remove-assertion-v0.9.37#3ea837814e9734c9831f652896a232807e88bed8" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.38#3275e271e8937c06dca44331e98f31ef020a71e6" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -2138,7 +2144,7 @@ dependencies = [ "futures", "futures-timer", "jsonrpsee", - "lru", + "lru 0.9.0", "parity-scale-codec", "polkadot-service", "sc-client-api", @@ -2159,7 +2165,7 @@ dependencies = [ [[package]] name = "cumulus-test-relay-sproof-builder" version = "0.1.0" -source = "git+https://github.com/darwinia-network/cumulus?branch=remove-assertion-v0.9.37#3ea837814e9734c9831f652896a232807e88bed8" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.38#3275e271e8937c06dca44331e98f31ef020a71e6" dependencies = [ "cumulus-primitives-core", "parity-scale-codec", @@ -3470,7 +3476,7 @@ dependencies = [ [[package]] name = "fc-cli" version = "1.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.37#3aaad52672ea4977ad39cf315c022085c23ddfd4" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#7e9c5e5e52cede605cae20cf6b2f02b6cf73043a" dependencies = [ "clap", "ethereum-types 0.14.1", @@ -3488,7 +3494,7 @@ dependencies = [ [[package]] name = "fc-consensus" version = "2.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.37#3aaad52672ea4977ad39cf315c022085c23ddfd4" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#7e9c5e5e52cede605cae20cf6b2f02b6cf73043a" dependencies = [ "async-trait", "fc-db", @@ -3507,7 +3513,7 @@ dependencies = [ [[package]] name = "fc-db" version = "2.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.37#3aaad52672ea4977ad39cf315c022085c23ddfd4" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#7e9c5e5e52cede605cae20cf6b2f02b6cf73043a" dependencies = [ "fp-storage", "kvdb-rocksdb", @@ -3526,7 +3532,7 @@ dependencies = [ [[package]] name = "fc-mapping-sync" version = "2.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.37#3aaad52672ea4977ad39cf315c022085c23ddfd4" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#7e9c5e5e52cede605cae20cf6b2f02b6cf73043a" dependencies = [ "fc-db", "fp-consensus", @@ -3543,7 +3549,7 @@ dependencies = [ [[package]] name = "fc-rpc" version = "2.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.37#3aaad52672ea4977ad39cf315c022085c23ddfd4" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#7e9c5e5e52cede605cae20cf6b2f02b6cf73043a" dependencies = [ "ethereum", "ethereum-types 0.14.1", @@ -3558,7 +3564,7 @@ dependencies = [ "jsonrpsee", "libsecp256k1", "log", - "lru", + "lru 0.8.1", "parity-scale-codec", "prometheus", "rand 0.8.5", @@ -3585,7 +3591,7 @@ dependencies = [ [[package]] name = "fc-rpc-core" version = "1.1.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.37#3aaad52672ea4977ad39cf315c022085c23ddfd4" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#7e9c5e5e52cede605cae20cf6b2f02b6cf73043a" dependencies = [ "ethereum", "ethereum-types 0.14.1", @@ -3732,7 +3738,7 @@ checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" [[package]] name = "fork-tree" version = "3.0.0" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "parity-scale-codec", ] @@ -3749,7 +3755,7 @@ dependencies = [ [[package]] name = "fp-consensus" version = "2.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.37#3aaad52672ea4977ad39cf315c022085c23ddfd4" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#7e9c5e5e52cede605cae20cf6b2f02b6cf73043a" dependencies = [ "ethereum", "parity-scale-codec", @@ -3761,7 +3767,7 @@ dependencies = [ [[package]] name = "fp-ethereum" version = "1.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.37#3aaad52672ea4977ad39cf315c022085c23ddfd4" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#7e9c5e5e52cede605cae20cf6b2f02b6cf73043a" dependencies = [ "ethereum", "ethereum-types 0.14.1", @@ -3775,21 +3781,20 @@ dependencies = [ [[package]] name = "fp-evm" version = "3.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.37#3aaad52672ea4977ad39cf315c022085c23ddfd4" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#7e9c5e5e52cede605cae20cf6b2f02b6cf73043a" dependencies = [ "evm", "frame-support", "parity-scale-codec", "serde", "sp-core", - "sp-runtime", "sp-std", ] [[package]] name = "fp-rpc" version = "3.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.37#3aaad52672ea4977ad39cf315c022085c23ddfd4" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#7e9c5e5e52cede605cae20cf6b2f02b6cf73043a" dependencies = [ "ethereum", "ethereum-types 0.14.1", @@ -3805,7 +3810,7 @@ dependencies = [ [[package]] name = "fp-self-contained" version = "1.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.37#3aaad52672ea4977ad39cf315c022085c23ddfd4" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#7e9c5e5e52cede605cae20cf6b2f02b6cf73043a" dependencies = [ "frame-support", "parity-scale-codec", @@ -3817,7 +3822,7 @@ dependencies = [ [[package]] name = "fp-storage" version = "2.0.0" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.37#3aaad52672ea4977ad39cf315c022085c23ddfd4" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#7e9c5e5e52cede605cae20cf6b2f02b6cf73043a" dependencies = [ "parity-scale-codec", "serde", @@ -3832,7 +3837,7 @@ checksum = "6c2141d6d6c8512188a7891b4b01590a45f6dac67afb4f255c4124dbb86d4eaa" [[package]] name = "frame-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "frame-support", "frame-support-procedural", @@ -3857,7 +3862,7 @@ dependencies = [ [[package]] name = "frame-benchmarking-cli" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "Inflector", "array-bytes 4.2.0", @@ -3904,7 +3909,7 @@ dependencies = [ [[package]] name = "frame-election-provider-solution-type" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -3915,7 +3920,7 @@ dependencies = [ [[package]] name = "frame-election-provider-support" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "frame-election-provider-solution-type", "frame-support", @@ -3932,7 +3937,7 @@ dependencies = [ [[package]] name = "frame-executive" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "frame-support", "frame-system", @@ -3961,7 +3966,7 @@ dependencies = [ [[package]] name = "frame-remote-externalities" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "futures", "log", @@ -3977,7 +3982,7 @@ dependencies = [ [[package]] name = "frame-support" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "bitflags", "frame-metadata", @@ -4009,7 +4014,7 @@ dependencies = [ [[package]] name = "frame-support-procedural" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "Inflector", "cfg-expr", @@ -4024,7 +4029,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "frame-support-procedural-tools-derive", "proc-macro-crate", @@ -4036,7 +4041,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools-derive" version = "3.0.0" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "proc-macro2", "quote", @@ -4046,7 +4051,7 @@ dependencies = [ [[package]] name = "frame-system" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "frame-support", "log", @@ -4064,7 +4069,7 @@ dependencies = [ [[package]] name = "frame-system-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "frame-benchmarking", "frame-support", @@ -4079,7 +4084,7 @@ dependencies = [ [[package]] name = "frame-system-rpc-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "parity-scale-codec", "sp-api", @@ -4088,7 +4093,7 @@ dependencies = [ [[package]] name = "frame-try-runtime" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "frame-support", "parity-scale-codec", @@ -4430,6 +4435,9 @@ name = "hashbrown" version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" +dependencies = [ + "ahash 0.8.3", +] [[package]] name = "heck" @@ -5075,8 +5083,8 @@ dependencies = [ [[package]] name = "kusama-runtime" -version = "0.9.37" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" +version = "0.9.38" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.38#72309a2b2e68413305a56dce1097041309bd29c6" dependencies = [ "bitvec", "frame-benchmarking", @@ -5172,8 +5180,8 @@ dependencies = [ [[package]] name = "kusama-runtime-constants" -version = "0.9.37" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" +version = "0.9.38" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.38#72309a2b2e68413305a56dce1097041309bd29c6" dependencies = [ "frame-support", "polkadot-primitives", @@ -5354,7 +5362,7 @@ dependencies = [ "libp2p-core", "libp2p-swarm", "log", - "lru", + "lru 0.8.1", "prost", "prost-build", "prost-codec", @@ -5814,6 +5822,15 @@ dependencies = [ "hashbrown 0.12.3", ] +[[package]] +name = "lru" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71e7d46de488603ffdd5f30afbc64fbba2378214a2c3a2fb83abf3d33126df17" +dependencies = [ + "hashbrown 0.13.2", +] + [[package]] name = "lru-cache" version = "0.1.2" @@ -6028,7 +6045,7 @@ dependencies = [ [[package]] name = "mmr-gadget" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "futures", "log", @@ -6047,7 +6064,7 @@ dependencies = [ [[package]] name = "mmr-rpc" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "anyhow", "jsonrpsee", @@ -6307,6 +6324,20 @@ dependencies = [ "memoffset 0.6.5", ] +[[package]] +name = "nix" +version = "0.26.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfdda3d196821d6af13126e40375cdf7da646a96114af134d5f417a9a1dc8e1a" +dependencies = [ + "bitflags", + "cfg-if", + "libc", + "memoffset 0.7.1", + "pin-utils", + "static_assertions", +] + [[package]] name = "nodrop" version = "0.1.14" @@ -6689,7 +6720,7 @@ dependencies = [ [[package]] name = "orml-traits" version = "0.4.1-dev" -source = "git+https://github.com/open-web3-stack/open-runtime-module-library?branch=polkadot-v0.9.37#16b6c1149a15674d21c87244b7988a667e2c14d9" +source = "git+https://github.com/open-web3-stack/open-runtime-module-library?branch=polkadot-v0.9.38#0a64a0b761f0a33e8953eccdac55dedb1e9ef580" dependencies = [ "frame-support", "impl-trait-for-tuples", @@ -6697,6 +6728,7 @@ dependencies = [ "orml-utilities", "parity-scale-codec", "scale-info", + "sp-core", "sp-io", "sp-runtime", "sp-std", @@ -6706,7 +6738,7 @@ dependencies = [ [[package]] name = "orml-utilities" version = "0.4.1-dev" -source = "git+https://github.com/open-web3-stack/open-runtime-module-library?branch=polkadot-v0.9.37#16b6c1149a15674d21c87244b7988a667e2c14d9" +source = "git+https://github.com/open-web3-stack/open-runtime-module-library?branch=polkadot-v0.9.38#0a64a0b761f0a33e8953eccdac55dedb1e9ef580" dependencies = [ "frame-support", "parity-scale-codec", @@ -6763,7 +6795,7 @@ dependencies = [ [[package]] name = "pallet-assets" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "frame-benchmarking", "frame-support", @@ -6778,7 +6810,7 @@ dependencies = [ [[package]] name = "pallet-aura" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "frame-support", "frame-system", @@ -6794,7 +6826,7 @@ dependencies = [ [[package]] name = "pallet-authority-discovery" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "frame-support", "frame-system", @@ -6810,14 +6842,13 @@ dependencies = [ [[package]] name = "pallet-authorship" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "frame-support", "frame-system", "impl-trait-for-tuples", "parity-scale-codec", "scale-info", - "sp-authorship", "sp-runtime", "sp-std", ] @@ -6825,7 +6856,7 @@ dependencies = [ [[package]] name = "pallet-babe" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "frame-benchmarking", "frame-support", @@ -6849,7 +6880,7 @@ dependencies = [ [[package]] name = "pallet-bags-list" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -6869,7 +6900,7 @@ dependencies = [ [[package]] name = "pallet-balances" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "frame-benchmarking", "frame-support", @@ -6884,7 +6915,7 @@ dependencies = [ [[package]] name = "pallet-beefy" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "frame-support", "frame-system", @@ -6900,7 +6931,7 @@ dependencies = [ [[package]] name = "pallet-beefy-mmr" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "array-bytes 4.2.0", "beefy-merkle-tree", @@ -6923,7 +6954,7 @@ dependencies = [ [[package]] name = "pallet-bounties" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "frame-benchmarking", "frame-support", @@ -6941,7 +6972,7 @@ dependencies = [ [[package]] name = "pallet-bridge-dispatch" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.37#1092b5c91cb64c508dc581bfa2e58f0801970d32" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=prepare-polkadot-v0.9.38#13267a91a97a46fcf02ce137272331733b88e512" dependencies = [ "bp-message-dispatch", "bp-runtime", @@ -6957,7 +6988,7 @@ dependencies = [ [[package]] name = "pallet-bridge-grandpa" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.37#1092b5c91cb64c508dc581bfa2e58f0801970d32" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=prepare-polkadot-v0.9.38#13267a91a97a46fcf02ce137272331733b88e512" dependencies = [ "bp-header-chain", "bp-runtime", @@ -6979,7 +7010,7 @@ dependencies = [ [[package]] name = "pallet-bridge-messages" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.37#1092b5c91cb64c508dc581bfa2e58f0801970d32" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=prepare-polkadot-v0.9.38#13267a91a97a46fcf02ce137272331733b88e512" dependencies = [ "bitvec", "bp-message-dispatch", @@ -7000,7 +7031,7 @@ dependencies = [ [[package]] name = "pallet-bridge-parachains" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.37#1092b5c91cb64c508dc581bfa2e58f0801970d32" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=prepare-polkadot-v0.9.38#13267a91a97a46fcf02ce137272331733b88e512" dependencies = [ "bp-parachains", "bp-polkadot-core", @@ -7021,7 +7052,7 @@ dependencies = [ [[package]] name = "pallet-child-bounties" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "frame-benchmarking", "frame-support", @@ -7040,7 +7071,7 @@ dependencies = [ [[package]] name = "pallet-collective" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "frame-benchmarking", "frame-support", @@ -7057,7 +7088,7 @@ dependencies = [ [[package]] name = "pallet-conviction-voting" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "assert_matches", "frame-benchmarking", @@ -7074,7 +7105,7 @@ dependencies = [ [[package]] name = "pallet-democracy" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "frame-benchmarking", "frame-support", @@ -7092,7 +7123,7 @@ dependencies = [ [[package]] name = "pallet-election-provider-multi-phase" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -7115,7 +7146,7 @@ dependencies = [ [[package]] name = "pallet-election-provider-support-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -7128,7 +7159,7 @@ dependencies = [ [[package]] name = "pallet-elections-phragmen" version = "5.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "frame-benchmarking", "frame-support", @@ -7146,7 +7177,7 @@ dependencies = [ [[package]] name = "pallet-ethereum" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.37#3aaad52672ea4977ad39cf315c022085c23ddfd4" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#7e9c5e5e52cede605cae20cf6b2f02b6cf73043a" dependencies = [ "ethereum", "ethereum-types 0.14.1", @@ -7172,7 +7203,7 @@ dependencies = [ [[package]] name = "pallet-evm" version = "6.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.37#3aaad52672ea4977ad39cf315c022085c23ddfd4" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#7e9c5e5e52cede605cae20cf6b2f02b6cf73043a" dependencies = [ "environmental", "evm", @@ -7196,7 +7227,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-blake2" version = "2.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.37#3aaad52672ea4977ad39cf315c022085c23ddfd4" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#7e9c5e5e52cede605cae20cf6b2f02b6cf73043a" dependencies = [ "fp-evm", ] @@ -7204,7 +7235,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-bn128" version = "2.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.37#3aaad52672ea4977ad39cf315c022085c23ddfd4" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#7e9c5e5e52cede605cae20cf6b2f02b6cf73043a" dependencies = [ "fp-evm", "sp-core", @@ -7214,7 +7245,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-dispatch" version = "2.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.37#3aaad52672ea4977ad39cf315c022085c23ddfd4" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#7e9c5e5e52cede605cae20cf6b2f02b6cf73043a" dependencies = [ "fp-evm", "frame-support", @@ -7224,7 +7255,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-modexp" version = "2.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.37#3aaad52672ea4977ad39cf315c022085c23ddfd4" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#7e9c5e5e52cede605cae20cf6b2f02b6cf73043a" dependencies = [ "fp-evm", "num", @@ -7233,7 +7264,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-simple" version = "2.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.37#3aaad52672ea4977ad39cf315c022085c23ddfd4" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#7e9c5e5e52cede605cae20cf6b2f02b6cf73043a" dependencies = [ "fp-evm", "ripemd", @@ -7243,7 +7274,7 @@ dependencies = [ [[package]] name = "pallet-fast-unstake" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -7261,7 +7292,7 @@ dependencies = [ [[package]] name = "pallet-fee-market" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.37#1092b5c91cb64c508dc581bfa2e58f0801970d32" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=prepare-polkadot-v0.9.38#13267a91a97a46fcf02ce137272331733b88e512" dependencies = [ "bp-messages", "bp-runtime", @@ -7280,7 +7311,7 @@ dependencies = [ [[package]] name = "pallet-grandpa" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "frame-benchmarking", "frame-support", @@ -7303,7 +7334,7 @@ dependencies = [ [[package]] name = "pallet-identity" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "enumflags2", "frame-benchmarking", @@ -7319,7 +7350,7 @@ dependencies = [ [[package]] name = "pallet-im-online" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "frame-benchmarking", "frame-support", @@ -7339,7 +7370,7 @@ dependencies = [ [[package]] name = "pallet-indices" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "frame-benchmarking", "frame-support", @@ -7356,7 +7387,7 @@ dependencies = [ [[package]] name = "pallet-membership" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "frame-benchmarking", "frame-support", @@ -7373,7 +7404,7 @@ dependencies = [ [[package]] name = "pallet-mmr" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "frame-benchmarking", "frame-support", @@ -7390,7 +7421,7 @@ dependencies = [ [[package]] name = "pallet-multisig" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.37#f38bd6671d460293c93062cc1e4fe9e9e490cb29" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "frame-benchmarking", "frame-support", @@ -7406,7 +7437,7 @@ dependencies = [ [[package]] name = "pallet-nis" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "frame-benchmarking", "frame-support", @@ -7422,7 +7453,7 @@ dependencies = [ [[package]] name = "pallet-nomination-pools" version = "1.0.0" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "frame-support", "frame-system", @@ -7439,7 +7470,7 @@ dependencies = [ [[package]] name = "pallet-nomination-pools-benchmarking" version = "1.0.0" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -7459,7 +7490,7 @@ dependencies = [ [[package]] name = "pallet-nomination-pools-runtime-api" version = "1.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "parity-scale-codec", "sp-api", @@ -7469,7 +7500,7 @@ dependencies = [ [[package]] name = "pallet-offences" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "frame-support", "frame-system", @@ -7486,12 +7517,13 @@ dependencies = [ [[package]] name = "pallet-offences-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "frame-benchmarking", "frame-election-provider-support", "frame-support", "frame-system", + "log", "pallet-babe", "pallet-balances", "pallet-grandpa", @@ -7509,7 +7541,7 @@ dependencies = [ [[package]] name = "pallet-preimage" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "frame-benchmarking", "frame-support", @@ -7526,7 +7558,7 @@ dependencies = [ [[package]] name = "pallet-proxy" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "frame-benchmarking", "frame-support", @@ -7541,7 +7573,7 @@ dependencies = [ [[package]] name = "pallet-ranked-collective" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "frame-benchmarking", "frame-support", @@ -7559,7 +7591,7 @@ dependencies = [ [[package]] name = "pallet-recovery" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "frame-benchmarking", "frame-support", @@ -7574,7 +7606,7 @@ dependencies = [ [[package]] name = "pallet-referenda" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "assert_matches", "frame-benchmarking", @@ -7593,7 +7625,7 @@ dependencies = [ [[package]] name = "pallet-scheduler" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "frame-benchmarking", "frame-support", @@ -7610,7 +7642,7 @@ dependencies = [ [[package]] name = "pallet-session" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "frame-support", "frame-system", @@ -7631,7 +7663,7 @@ dependencies = [ [[package]] name = "pallet-session-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "frame-benchmarking", "frame-support", @@ -7647,7 +7679,7 @@ dependencies = [ [[package]] name = "pallet-society" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "frame-support", "frame-system", @@ -7661,7 +7693,7 @@ dependencies = [ [[package]] name = "pallet-staking" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -7684,7 +7716,7 @@ dependencies = [ [[package]] name = "pallet-staking-reward-curve" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -7695,7 +7727,7 @@ dependencies = [ [[package]] name = "pallet-staking-reward-fn" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "log", "sp-arithmetic", @@ -7704,7 +7736,7 @@ dependencies = [ [[package]] name = "pallet-state-trie-migration" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "frame-benchmarking", "frame-support", @@ -7721,7 +7753,7 @@ dependencies = [ [[package]] name = "pallet-sudo" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "frame-support", "frame-system", @@ -7735,7 +7767,7 @@ dependencies = [ [[package]] name = "pallet-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "frame-benchmarking", "frame-support", @@ -7753,7 +7785,7 @@ dependencies = [ [[package]] name = "pallet-tips" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "frame-benchmarking", "frame-support", @@ -7772,7 +7804,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "frame-support", "frame-system", @@ -7788,7 +7820,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "jsonrpsee", "pallet-transaction-payment-rpc-runtime-api", @@ -7804,7 +7836,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "pallet-transaction-payment", "parity-scale-codec", @@ -7816,7 +7848,7 @@ dependencies = [ [[package]] name = "pallet-treasury" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "frame-benchmarking", "frame-support", @@ -7833,7 +7865,7 @@ dependencies = [ [[package]] name = "pallet-utility" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "frame-benchmarking", "frame-support", @@ -7849,7 +7881,7 @@ dependencies = [ [[package]] name = "pallet-vesting" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "frame-benchmarking", "frame-support", @@ -7864,7 +7896,7 @@ dependencies = [ [[package]] name = "pallet-whitelist" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "frame-benchmarking", "frame-support", @@ -7878,9 +7910,10 @@ dependencies = [ [[package]] name = "pallet-xcm" -version = "0.9.37" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" +version = "0.9.38" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.38#72309a2b2e68413305a56dce1097041309bd29c6" dependencies = [ + "frame-benchmarking", "frame-support", "frame-system", "log", @@ -7888,6 +7921,7 @@ dependencies = [ "scale-info", "serde", "sp-core", + "sp-io", "sp-runtime", "sp-std", "xcm", @@ -7896,8 +7930,8 @@ dependencies = [ [[package]] name = "pallet-xcm-benchmarks" -version = "0.9.37" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" +version = "0.9.38" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.38#72309a2b2e68413305a56dce1097041309bd29c6" dependencies = [ "frame-benchmarking", "frame-support", @@ -7905,9 +7939,11 @@ dependencies = [ "log", "parity-scale-codec", "scale-info", + "sp-io", "sp-runtime", "sp-std", "xcm", + "xcm-builder", "xcm-executor", ] @@ -8120,7 +8156,7 @@ dependencies = [ [[package]] name = "parachain-info" version = "0.1.0" -source = "git+https://github.com/darwinia-network/cumulus?branch=remove-assertion-v0.9.37#3ea837814e9734c9831f652896a232807e88bed8" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.38#3275e271e8937c06dca44331e98f31ef020a71e6" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -8417,8 +8453,8 @@ checksum = "e3d7ddaed09e0eb771a79ab0fd64609ba0afb0a8366421957936ad14cbd13630" [[package]] name = "polkadot-approval-distribution" -version = "0.9.37" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" +version = "0.9.38" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.38#72309a2b2e68413305a56dce1097041309bd29c6" dependencies = [ "futures", "polkadot-node-metrics", @@ -8432,8 +8468,8 @@ dependencies = [ [[package]] name = "polkadot-availability-bitfield-distribution" -version = "0.9.37" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" +version = "0.9.38" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.38#72309a2b2e68413305a56dce1097041309bd29c6" dependencies = [ "futures", "polkadot-node-network-protocol", @@ -8446,13 +8482,13 @@ dependencies = [ [[package]] name = "polkadot-availability-distribution" -version = "0.9.37" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" +version = "0.9.38" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.38#72309a2b2e68413305a56dce1097041309bd29c6" dependencies = [ "derive_more", "fatality", "futures", - "lru", + "lru 0.9.0", "parity-scale-codec", "polkadot-erasure-coding", "polkadot-node-network-protocol", @@ -8469,12 +8505,12 @@ dependencies = [ [[package]] name = "polkadot-availability-recovery" -version = "0.9.37" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" +version = "0.9.38" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.38#72309a2b2e68413305a56dce1097041309bd29c6" dependencies = [ "fatality", "futures", - "lru", + "lru 0.9.0", "parity-scale-codec", "polkadot-erasure-coding", "polkadot-node-network-protocol", @@ -8490,8 +8526,8 @@ dependencies = [ [[package]] name = "polkadot-cli" -version = "0.9.37" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" +version = "0.9.38" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.38#72309a2b2e68413305a56dce1097041309bd29c6" dependencies = [ "clap", "frame-benchmarking-cli", @@ -8505,6 +8541,7 @@ dependencies = [ "sc-cli", "sc-executor", "sc-service", + "sc-storage-monitor", "sc-sysinfo", "sc-tracing", "sp-core", @@ -8517,8 +8554,8 @@ dependencies = [ [[package]] name = "polkadot-client" -version = "0.9.37" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" +version = "0.9.38" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.38#72309a2b2e68413305a56dce1097041309bd29c6" dependencies = [ "async-trait", "frame-benchmarking", @@ -8561,8 +8598,8 @@ dependencies = [ [[package]] name = "polkadot-collator-protocol" -version = "0.9.37" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" +version = "0.9.38" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.38#72309a2b2e68413305a56dce1097041309bd29c6" dependencies = [ "always-assert", "bitvec", @@ -8583,8 +8620,8 @@ dependencies = [ [[package]] name = "polkadot-core-primitives" -version = "0.9.37" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" +version = "0.9.38" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.38#72309a2b2e68413305a56dce1097041309bd29c6" dependencies = [ "parity-scale-codec", "scale-info", @@ -8595,15 +8632,15 @@ dependencies = [ [[package]] name = "polkadot-dispute-distribution" -version = "0.9.37" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" +version = "0.9.38" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.38#72309a2b2e68413305a56dce1097041309bd29c6" dependencies = [ "derive_more", "fatality", "futures", "futures-timer", "indexmap", - "lru", + "lru 0.9.0", "parity-scale-codec", "polkadot-erasure-coding", "polkadot-node-network-protocol", @@ -8620,8 +8657,8 @@ dependencies = [ [[package]] name = "polkadot-erasure-coding" -version = "0.9.37" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" +version = "0.9.38" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.38#72309a2b2e68413305a56dce1097041309bd29c6" dependencies = [ "parity-scale-codec", "polkadot-node-primitives", @@ -8634,8 +8671,8 @@ dependencies = [ [[package]] name = "polkadot-gossip-support" -version = "0.9.37" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" +version = "0.9.38" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.38#72309a2b2e68413305a56dce1097041309bd29c6" dependencies = [ "futures", "futures-timer", @@ -8654,8 +8691,8 @@ dependencies = [ [[package]] name = "polkadot-network-bridge" -version = "0.9.37" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" +version = "0.9.38" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.38#72309a2b2e68413305a56dce1097041309bd29c6" dependencies = [ "always-assert", "async-trait", @@ -8678,8 +8715,8 @@ dependencies = [ [[package]] name = "polkadot-node-collation-generation" -version = "0.9.37" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" +version = "0.9.38" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.38#72309a2b2e68413305a56dce1097041309bd29c6" dependencies = [ "futures", "parity-scale-codec", @@ -8696,15 +8733,15 @@ dependencies = [ [[package]] name = "polkadot-node-core-approval-voting" -version = "0.9.37" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" +version = "0.9.38" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.38#72309a2b2e68413305a56dce1097041309bd29c6" dependencies = [ "bitvec", "derive_more", "futures", "futures-timer", "kvdb", - "lru", + "lru 0.9.0", "merlin", "parity-scale-codec", "polkadot-node-jaeger", @@ -8725,8 +8762,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-av-store" -version = "0.9.37" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" +version = "0.9.38" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.38#72309a2b2e68413305a56dce1097041309bd29c6" dependencies = [ "bitvec", "futures", @@ -8745,8 +8782,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-backing" -version = "0.9.37" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" +version = "0.9.38" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.38#72309a2b2e68413305a56dce1097041309bd29c6" dependencies = [ "bitvec", "fatality", @@ -8764,8 +8801,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-bitfield-signing" -version = "0.9.37" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" +version = "0.9.38" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.38#72309a2b2e68413305a56dce1097041309bd29c6" dependencies = [ "futures", "polkadot-node-subsystem", @@ -8779,8 +8816,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-candidate-validation" -version = "0.9.37" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" +version = "0.9.38" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.38#72309a2b2e68413305a56dce1097041309bd29c6" dependencies = [ "async-trait", "futures", @@ -8798,8 +8835,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-chain-api" -version = "0.9.37" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" +version = "0.9.38" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.38#72309a2b2e68413305a56dce1097041309bd29c6" dependencies = [ "futures", "polkadot-node-metrics", @@ -8813,8 +8850,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-chain-selection" -version = "0.9.37" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" +version = "0.9.38" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.38#72309a2b2e68413305a56dce1097041309bd29c6" dependencies = [ "futures", "futures-timer", @@ -8830,13 +8867,13 @@ dependencies = [ [[package]] name = "polkadot-node-core-dispute-coordinator" -version = "0.9.37" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" +version = "0.9.38" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.38#72309a2b2e68413305a56dce1097041309bd29c6" dependencies = [ "fatality", "futures", "kvdb", - "lru", + "lru 0.9.0", "parity-scale-codec", "polkadot-node-primitives", "polkadot-node-subsystem", @@ -8849,8 +8886,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-parachains-inherent" -version = "0.9.37" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" +version = "0.9.38" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.38#72309a2b2e68413305a56dce1097041309bd29c6" dependencies = [ "async-trait", "futures", @@ -8866,8 +8903,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-provisioner" -version = "0.9.37" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" +version = "0.9.38" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.38#72309a2b2e68413305a56dce1097041309bd29c6" dependencies = [ "bitvec", "fatality", @@ -8884,8 +8921,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-pvf" -version = "0.9.37" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" +version = "0.9.38" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.38#72309a2b2e68413305a56dce1097041309bd29c6" dependencies = [ "always-assert", "assert_matches", @@ -8916,8 +8953,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-pvf-checker" -version = "0.9.37" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" +version = "0.9.38" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.38#72309a2b2e68413305a56dce1097041309bd29c6" dependencies = [ "futures", "polkadot-node-primitives", @@ -8932,11 +8969,11 @@ dependencies = [ [[package]] name = "polkadot-node-core-runtime-api" -version = "0.9.37" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" +version = "0.9.38" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.38#72309a2b2e68413305a56dce1097041309bd29c6" dependencies = [ "futures", - "lru", + "lru 0.9.0", "polkadot-node-metrics", "polkadot-node-subsystem", "polkadot-node-subsystem-types", @@ -8947,8 +8984,8 @@ dependencies = [ [[package]] name = "polkadot-node-jaeger" -version = "0.9.37" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" +version = "0.9.38" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.38#72309a2b2e68413305a56dce1097041309bd29c6" dependencies = [ "lazy_static", "log", @@ -8965,8 +9002,8 @@ dependencies = [ [[package]] name = "polkadot-node-metrics" -version = "0.9.37" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" +version = "0.9.38" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.38#72309a2b2e68413305a56dce1097041309bd29c6" dependencies = [ "bs58", "futures", @@ -8984,8 +9021,8 @@ dependencies = [ [[package]] name = "polkadot-node-network-protocol" -version = "0.9.37" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" +version = "0.9.38" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.38#72309a2b2e68413305a56dce1097041309bd29c6" dependencies = [ "async-trait", "derive_more", @@ -9007,8 +9044,8 @@ dependencies = [ [[package]] name = "polkadot-node-primitives" -version = "0.9.37" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" +version = "0.9.38" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.38#72309a2b2e68413305a56dce1097041309bd29c6" dependencies = [ "bounded-vec", "futures", @@ -9029,8 +9066,8 @@ dependencies = [ [[package]] name = "polkadot-node-subsystem" -version = "0.9.37" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" +version = "0.9.38" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.38#72309a2b2e68413305a56dce1097041309bd29c6" dependencies = [ "polkadot-node-jaeger", "polkadot-node-subsystem-types", @@ -9039,8 +9076,8 @@ dependencies = [ [[package]] name = "polkadot-node-subsystem-types" -version = "0.9.37" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" +version = "0.9.38" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.38#72309a2b2e68413305a56dce1097041309bd29c6" dependencies = [ "async-trait", "derive_more", @@ -9062,8 +9099,8 @@ dependencies = [ [[package]] name = "polkadot-node-subsystem-util" -version = "0.9.37" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" +version = "0.9.38" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.38#72309a2b2e68413305a56dce1097041309bd29c6" dependencies = [ "async-trait", "derive_more", @@ -9072,7 +9109,7 @@ dependencies = [ "futures-channel", "itertools", "kvdb", - "lru", + "lru 0.9.0", "parity-db", "parity-scale-codec", "parking_lot 0.11.2", @@ -9095,13 +9132,13 @@ dependencies = [ [[package]] name = "polkadot-overseer" -version = "0.9.37" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" +version = "0.9.38" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.38#72309a2b2e68413305a56dce1097041309bd29c6" dependencies = [ "async-trait", "futures", "futures-timer", - "lru", + "lru 0.9.0", "orchestra", "parking_lot 0.12.1", "polkadot-node-metrics", @@ -9118,8 +9155,8 @@ dependencies = [ [[package]] name = "polkadot-parachain" -version = "0.9.37" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" +version = "0.9.38" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.38#72309a2b2e68413305a56dce1097041309bd29c6" dependencies = [ "derive_more", "frame-support", @@ -9134,8 +9171,8 @@ dependencies = [ [[package]] name = "polkadot-performance-test" -version = "0.9.37" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" +version = "0.9.38" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.38#72309a2b2e68413305a56dce1097041309bd29c6" dependencies = [ "env_logger 0.9.3", "kusama-runtime", @@ -9149,8 +9186,8 @@ dependencies = [ [[package]] name = "polkadot-primitives" -version = "0.9.37" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" +version = "0.9.38" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.38#72309a2b2e68413305a56dce1097041309bd29c6" dependencies = [ "bitvec", "hex-literal", @@ -9175,8 +9212,8 @@ dependencies = [ [[package]] name = "polkadot-rpc" -version = "0.9.37" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" +version = "0.9.38" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.38#72309a2b2e68413305a56dce1097041309bd29c6" dependencies = [ "beefy-gadget", "beefy-gadget-rpc", @@ -9207,8 +9244,8 @@ dependencies = [ [[package]] name = "polkadot-runtime" -version = "0.9.37" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" +version = "0.9.38" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.38#72309a2b2e68413305a56dce1097041309bd29c6" dependencies = [ "bitvec", "frame-benchmarking", @@ -9296,8 +9333,8 @@ dependencies = [ [[package]] name = "polkadot-runtime-common" -version = "0.9.37" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" +version = "0.9.38" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.38#72309a2b2e68413305a56dce1097041309bd29c6" dependencies = [ "bitvec", "frame-benchmarking", @@ -9313,6 +9350,7 @@ dependencies = [ "pallet-balances", "pallet-beefy-mmr", "pallet-election-provider-multi-phase", + "pallet-fast-unstake", "pallet-session", "pallet-staking", "pallet-staking-reward-fn", @@ -9344,8 +9382,8 @@ dependencies = [ [[package]] name = "polkadot-runtime-constants" -version = "0.9.37" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" +version = "0.9.38" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.38#72309a2b2e68413305a56dce1097041309bd29c6" dependencies = [ "frame-support", "polkadot-primitives", @@ -9358,8 +9396,8 @@ dependencies = [ [[package]] name = "polkadot-runtime-metrics" -version = "0.9.37" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" +version = "0.9.38" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.38#72309a2b2e68413305a56dce1097041309bd29c6" dependencies = [ "bs58", "parity-scale-codec", @@ -9370,8 +9408,8 @@ dependencies = [ [[package]] name = "polkadot-runtime-parachains" -version = "0.9.37" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" +version = "0.9.38" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.38#72309a2b2e68413305a56dce1097041309bd29c6" dependencies = [ "bitflags", "bitvec", @@ -9413,11 +9451,12 @@ dependencies = [ [[package]] name = "polkadot-service" -version = "0.9.37" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" +version = "0.9.38" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.38#72309a2b2e68413305a56dce1097041309bd29c6" dependencies = [ "async-trait", "beefy-gadget", + "frame-benchmarking-cli", "frame-support", "frame-system-rpc-runtime-api", "futures", @@ -9426,7 +9465,8 @@ dependencies = [ "kusama-runtime-constants", "kvdb", "kvdb-rocksdb", - "lru", + "log", + "lru 0.9.0", "mmr-gadget", "pallet-babe", "pallet-im-online", @@ -9521,8 +9561,8 @@ dependencies = [ [[package]] name = "polkadot-statement-distribution" -version = "0.9.37" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" +version = "0.9.38" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.38#72309a2b2e68413305a56dce1097041309bd29c6" dependencies = [ "arrayvec 0.5.2", "fatality", @@ -9542,8 +9582,8 @@ dependencies = [ [[package]] name = "polkadot-statement-table" -version = "0.9.37" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" +version = "0.9.38" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.38#72309a2b2e68413305a56dce1097041309bd29c6" dependencies = [ "parity-scale-codec", "polkadot-primitives", @@ -9613,10 +9653,11 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "precompile-utils" version = "0.1.0" -source = "git+https://github.com/darwinia-network/moonbeam?branch=polkadot-v0.9.37#3e272b5e0fad227e09880cd5a7c1c709a69f0a92" +source = "git+https://github.com/darwinia-network/moonbeam?branch=polkadot-v0.9.38#81caf339d816df9fab32bd2d7fd71a9d9b6b650f" dependencies = [ "affix", "derive_more", + "environmental", "evm", "fp-evm", "frame-support", @@ -9643,7 +9684,7 @@ dependencies = [ [[package]] name = "precompile-utils-macro" version = "0.1.0" -source = "git+https://github.com/darwinia-network/moonbeam?branch=polkadot-v0.9.37#3e272b5e0fad227e09880cd5a7c1c709a69f0a92" +source = "git+https://github.com/darwinia-network/moonbeam?branch=polkadot-v0.9.38#81caf339d816df9fab32bd2d7fd71a9d9b6b650f" dependencies = [ "case", "num_enum", @@ -10376,8 +10417,8 @@ dependencies = [ [[package]] name = "rococo-runtime" -version = "0.9.37" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" +version = "0.9.38" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.38#72309a2b2e68413305a56dce1097041309bd29c6" dependencies = [ "beefy-merkle-tree", "frame-benchmarking", @@ -10462,8 +10503,8 @@ dependencies = [ [[package]] name = "rococo-runtime-constants" -version = "0.9.37" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" +version = "0.9.38" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.38#72309a2b2e68413305a56dce1097041309bd29c6" dependencies = [ "frame-support", "polkadot-primitives", @@ -10506,7 +10547,7 @@ dependencies = [ "log", "netlink-packet-route", "netlink-proto", - "nix", + "nix 0.24.3", "thiserror", "tokio", ] @@ -10680,7 +10721,7 @@ dependencies = [ [[package]] name = "sc-allocator" version = "4.1.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "log", "sp-core", @@ -10691,7 +10732,7 @@ dependencies = [ [[package]] name = "sc-authority-discovery" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "async-trait", "futures", @@ -10718,7 +10759,7 @@ dependencies = [ [[package]] name = "sc-basic-authorship" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "futures", "futures-timer", @@ -10741,7 +10782,7 @@ dependencies = [ [[package]] name = "sc-block-builder" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "parity-scale-codec", "sc-client-api", @@ -10757,7 +10798,7 @@ dependencies = [ [[package]] name = "sc-chain-spec" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "memmap2", "sc-chain-spec-derive", @@ -10772,7 +10813,7 @@ dependencies = [ [[package]] name = "sc-chain-spec-derive" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -10783,7 +10824,7 @@ dependencies = [ [[package]] name = "sc-cli" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "array-bytes 4.2.0", "chrono", @@ -10823,7 +10864,7 @@ dependencies = [ [[package]] name = "sc-client-api" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "fnv", "futures", @@ -10849,7 +10890,7 @@ dependencies = [ [[package]] name = "sc-client-db" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "hash-db", "kvdb", @@ -10875,7 +10916,7 @@ dependencies = [ [[package]] name = "sc-consensus" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "async-trait", "futures", @@ -10900,7 +10941,7 @@ dependencies = [ [[package]] name = "sc-consensus-aura" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "async-trait", "futures", @@ -10929,7 +10970,7 @@ dependencies = [ [[package]] name = "sc-consensus-babe" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "async-trait", "fork-tree", @@ -10967,7 +11008,7 @@ dependencies = [ [[package]] name = "sc-consensus-babe-rpc" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "futures", "jsonrpsee", @@ -10989,7 +11030,7 @@ dependencies = [ [[package]] name = "sc-consensus-epochs" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "fork-tree", "parity-scale-codec", @@ -11002,7 +11043,7 @@ dependencies = [ [[package]] name = "sc-consensus-slots" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "async-trait", "futures", @@ -11025,9 +11066,9 @@ dependencies = [ [[package]] name = "sc-executor" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ - "lru", + "lru 0.8.1", "parity-scale-codec", "parking_lot 0.12.1", "sc-executor-common", @@ -11049,7 +11090,7 @@ dependencies = [ [[package]] name = "sc-executor-common" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "sc-allocator", "sp-maybe-compressed-blob", @@ -11062,7 +11103,7 @@ dependencies = [ [[package]] name = "sc-executor-wasmi" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "log", "sc-allocator", @@ -11075,7 +11116,7 @@ dependencies = [ [[package]] name = "sc-executor-wasmtime" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "cfg-if", "libc", @@ -11092,9 +11133,9 @@ dependencies = [ [[package]] name = "sc-finality-grandpa" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ - "ahash 0.7.6", + "ahash 0.8.3", "array-bytes 4.2.0", "async-trait", "dyn-clone", @@ -11132,7 +11173,7 @@ dependencies = [ [[package]] name = "sc-finality-grandpa-rpc" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "finality-grandpa", "futures", @@ -11152,7 +11193,7 @@ dependencies = [ [[package]] name = "sc-informant" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "ansi_term", "futures", @@ -11167,7 +11208,7 @@ dependencies = [ [[package]] name = "sc-keystore" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "array-bytes 4.2.0", "async-trait", @@ -11182,7 +11223,7 @@ dependencies = [ [[package]] name = "sc-network" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "array-bytes 4.2.0", "async-trait", @@ -11196,7 +11237,7 @@ dependencies = [ "ip_network", "libp2p", "log", - "lru", + "lru 0.8.1", "parity-scale-codec", "parking_lot 0.12.1", "pin-project", @@ -11224,7 +11265,7 @@ dependencies = [ [[package]] name = "sc-network-bitswap" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "cid", "futures", @@ -11243,7 +11284,7 @@ dependencies = [ [[package]] name = "sc-network-common" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "async-trait", "bitflags", @@ -11269,14 +11310,14 @@ dependencies = [ [[package]] name = "sc-network-gossip" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ - "ahash 0.7.6", + "ahash 0.8.3", "futures", "futures-timer", "libp2p", "log", - "lru", + "lru 0.8.1", "sc-network-common", "sc-peerset", "sp-runtime", @@ -11287,7 +11328,7 @@ dependencies = [ [[package]] name = "sc-network-light" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "array-bytes 4.2.0", "futures", @@ -11308,7 +11349,7 @@ dependencies = [ [[package]] name = "sc-network-sync" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "array-bytes 4.2.0", "async-trait", @@ -11316,7 +11357,7 @@ dependencies = [ "futures", "libp2p", "log", - "lru", + "lru 0.8.1", "mockall", "parity-scale-codec", "prost", @@ -11340,7 +11381,7 @@ dependencies = [ [[package]] name = "sc-network-transactions" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "array-bytes 4.2.0", "futures", @@ -11359,7 +11400,7 @@ dependencies = [ [[package]] name = "sc-offchain" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "array-bytes 4.2.0", "bytes", @@ -11389,7 +11430,7 @@ dependencies = [ [[package]] name = "sc-peerset" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "futures", "libp2p", @@ -11402,7 +11443,7 @@ dependencies = [ [[package]] name = "sc-proposer-metrics" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "log", "substrate-prometheus-endpoint", @@ -11411,7 +11452,7 @@ dependencies = [ [[package]] name = "sc-rpc" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "futures", "jsonrpsee", @@ -11435,12 +11476,13 @@ dependencies = [ "sp-runtime", "sp-session", "sp-version", + "tokio", ] [[package]] name = "sc-rpc-api" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "jsonrpsee", "parity-scale-codec", @@ -11459,7 +11501,7 @@ dependencies = [ [[package]] name = "sc-rpc-server" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "http", "jsonrpsee", @@ -11474,7 +11516,7 @@ dependencies = [ [[package]] name = "sc-rpc-spec-v2" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "array-bytes 4.2.0", "futures", @@ -11500,7 +11542,7 @@ dependencies = [ [[package]] name = "sc-service" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "async-trait", "directories", @@ -11531,6 +11573,7 @@ dependencies = [ "sc-rpc", "sc-rpc-server", "sc-rpc-spec-v2", + "sc-storage-monitor", "sc-sysinfo", "sc-telemetry", "sc-tracing", @@ -11565,7 +11608,7 @@ dependencies = [ [[package]] name = "sc-state-db" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "log", "parity-scale-codec", @@ -11573,10 +11616,26 @@ dependencies = [ "sp-core", ] +[[package]] +name = "sc-storage-monitor" +version = "0.1.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" +dependencies = [ + "clap", + "futures", + "log", + "nix 0.26.2", + "sc-client-db", + "sc-utils", + "sp-core", + "thiserror", + "tokio", +] + [[package]] name = "sc-sync-state-rpc" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "jsonrpsee", "parity-scale-codec", @@ -11595,7 +11654,7 @@ dependencies = [ [[package]] name = "sc-sysinfo" version = "6.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "futures", "libc", @@ -11614,7 +11673,7 @@ dependencies = [ [[package]] name = "sc-telemetry" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "chrono", "futures", @@ -11633,7 +11692,7 @@ dependencies = [ [[package]] name = "sc-tracing" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "ansi_term", "atty", @@ -11664,7 +11723,7 @@ dependencies = [ [[package]] name = "sc-tracing-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -11675,13 +11734,14 @@ dependencies = [ [[package]] name = "sc-transaction-pool" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "async-trait", "futures", "futures-timer", "linked-hash-map", "log", + "num-traits", "parity-scale-codec", "parking_lot 0.12.1", "sc-client-api", @@ -11701,7 +11761,7 @@ dependencies = [ [[package]] name = "sc-transaction-pool-api" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "async-trait", "futures", @@ -11715,7 +11775,7 @@ dependencies = [ [[package]] name = "sc-utils" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "backtrace", "futures", @@ -12119,8 +12179,8 @@ checksum = "03b634d87b960ab1a38c4fe143b508576f075e7c978bfad18217645ebfdfa2ec" [[package]] name = "slot-range-helper" -version = "0.9.37" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" +version = "0.9.38" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.38#72309a2b2e68413305a56dce1097041309bd29c6" dependencies = [ "enumn", "parity-scale-codec", @@ -12197,7 +12257,7 @@ dependencies = [ [[package]] name = "sp-api" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "hash-db", "log", @@ -12215,7 +12275,7 @@ dependencies = [ [[package]] name = "sp-api-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "blake2", "proc-macro-crate", @@ -12227,7 +12287,7 @@ dependencies = [ [[package]] name = "sp-application-crypto" version = "7.0.0" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "parity-scale-codec", "scale-info", @@ -12240,7 +12300,7 @@ dependencies = [ [[package]] name = "sp-arithmetic" version = "6.0.0" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "integer-sqrt", "num-traits", @@ -12254,7 +12314,7 @@ dependencies = [ [[package]] name = "sp-authority-discovery" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "parity-scale-codec", "scale-info", @@ -12264,22 +12324,10 @@ dependencies = [ "sp-std", ] -[[package]] -name = "sp-authorship" -version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" -dependencies = [ - "async-trait", - "parity-scale-codec", - "sp-inherents", - "sp-runtime", - "sp-std", -] - [[package]] name = "sp-beefy" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "parity-scale-codec", "scale-info", @@ -12296,7 +12344,7 @@ dependencies = [ [[package]] name = "sp-block-builder" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "parity-scale-codec", "sp-api", @@ -12308,11 +12356,11 @@ dependencies = [ [[package]] name = "sp-blockchain" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "futures", "log", - "lru", + "lru 0.8.1", "parity-scale-codec", "parking_lot 0.12.1", "sp-api", @@ -12326,7 +12374,7 @@ dependencies = [ [[package]] name = "sp-consensus" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "async-trait", "futures", @@ -12344,7 +12392,7 @@ dependencies = [ [[package]] name = "sp-consensus-aura" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "async-trait", "parity-scale-codec", @@ -12362,7 +12410,7 @@ dependencies = [ [[package]] name = "sp-consensus-babe" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "async-trait", "merlin", @@ -12385,7 +12433,7 @@ dependencies = [ [[package]] name = "sp-consensus-slots" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "parity-scale-codec", "scale-info", @@ -12397,7 +12445,7 @@ dependencies = [ [[package]] name = "sp-consensus-vrf" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "parity-scale-codec", "scale-info", @@ -12410,7 +12458,7 @@ dependencies = [ [[package]] name = "sp-core" version = "7.0.0" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "array-bytes 4.2.0", "base58", @@ -12452,7 +12500,7 @@ dependencies = [ [[package]] name = "sp-core-hashing" version = "5.0.0" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "blake2", "byteorder", @@ -12466,7 +12514,7 @@ dependencies = [ [[package]] name = "sp-core-hashing-proc-macro" version = "5.0.0" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "proc-macro2", "quote", @@ -12477,7 +12525,7 @@ dependencies = [ [[package]] name = "sp-database" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "kvdb", "parking_lot 0.12.1", @@ -12486,7 +12534,7 @@ dependencies = [ [[package]] name = "sp-debug-derive" version = "5.0.0" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "proc-macro2", "quote", @@ -12496,7 +12544,7 @@ dependencies = [ [[package]] name = "sp-externalities" version = "0.13.0" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "environmental", "parity-scale-codec", @@ -12507,7 +12555,7 @@ dependencies = [ [[package]] name = "sp-finality-grandpa" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "finality-grandpa", "log", @@ -12525,7 +12573,7 @@ dependencies = [ [[package]] name = "sp-inherents" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "async-trait", "impl-trait-for-tuples", @@ -12539,7 +12587,7 @@ dependencies = [ [[package]] name = "sp-io" version = "7.0.0" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "bytes", "ed25519", @@ -12564,7 +12612,7 @@ dependencies = [ [[package]] name = "sp-keyring" version = "7.0.0" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "lazy_static", "sp-core", @@ -12575,7 +12623,7 @@ dependencies = [ [[package]] name = "sp-keystore" version = "0.13.0" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "async-trait", "futures", @@ -12592,7 +12640,7 @@ dependencies = [ [[package]] name = "sp-maybe-compressed-blob" version = "4.1.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "thiserror", "zstd", @@ -12601,7 +12649,7 @@ dependencies = [ [[package]] name = "sp-mmr-primitives" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "ckb-merkle-mountain-range", "log", @@ -12619,7 +12667,7 @@ dependencies = [ [[package]] name = "sp-npos-elections" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "parity-scale-codec", "scale-info", @@ -12633,7 +12681,7 @@ dependencies = [ [[package]] name = "sp-offchain" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "sp-api", "sp-core", @@ -12643,7 +12691,7 @@ dependencies = [ [[package]] name = "sp-panic-handler" version = "5.0.0" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "backtrace", "lazy_static", @@ -12653,7 +12701,7 @@ dependencies = [ [[package]] name = "sp-rpc" version = "6.0.0" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "rustc-hash", "serde", @@ -12663,7 +12711,7 @@ dependencies = [ [[package]] name = "sp-runtime" version = "7.0.0" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "either", "hash256-std-hasher", @@ -12685,7 +12733,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface" version = "7.0.0" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "bytes", "impl-trait-for-tuples", @@ -12703,7 +12751,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" version = "6.0.0" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "Inflector", "proc-macro-crate", @@ -12715,7 +12763,7 @@ dependencies = [ [[package]] name = "sp-session" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "parity-scale-codec", "scale-info", @@ -12729,7 +12777,7 @@ dependencies = [ [[package]] name = "sp-staking" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "parity-scale-codec", "scale-info", @@ -12741,7 +12789,7 @@ dependencies = [ [[package]] name = "sp-state-machine" version = "0.13.0" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "hash-db", "log", @@ -12761,12 +12809,12 @@ dependencies = [ [[package]] name = "sp-std" version = "5.0.0" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" [[package]] name = "sp-storage" version = "7.0.0" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "impl-serde 0.4.0", "parity-scale-codec", @@ -12779,7 +12827,7 @@ dependencies = [ [[package]] name = "sp-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "async-trait", "futures-timer", @@ -12794,7 +12842,7 @@ dependencies = [ [[package]] name = "sp-tracing" version = "6.0.0" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "parity-scale-codec", "sp-std", @@ -12806,7 +12854,7 @@ dependencies = [ [[package]] name = "sp-transaction-pool" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "sp-api", "sp-runtime", @@ -12815,7 +12863,7 @@ dependencies = [ [[package]] name = "sp-transaction-storage-proof" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "async-trait", "log", @@ -12831,18 +12879,18 @@ dependencies = [ [[package]] name = "sp-trie" version = "7.0.0" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ - "ahash 0.7.6", + "ahash 0.8.3", "hash-db", "hashbrown 0.12.3", "lazy_static", - "lru", "memory-db", "nohash-hasher", "parity-scale-codec", "parking_lot 0.12.1", "scale-info", + "schnellru", "sp-core", "sp-std", "thiserror", @@ -12854,7 +12902,7 @@ dependencies = [ [[package]] name = "sp-version" version = "5.0.0" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "impl-serde 0.4.0", "parity-scale-codec", @@ -12871,7 +12919,7 @@ dependencies = [ [[package]] name = "sp-version-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "parity-scale-codec", "proc-macro2", @@ -12882,7 +12930,7 @@ dependencies = [ [[package]] name = "sp-wasm-interface" version = "7.0.0" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "impl-trait-for-tuples", "log", @@ -12895,7 +12943,7 @@ dependencies = [ [[package]] name = "sp-weights" version = "4.0.0" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "parity-scale-codec", "scale-info", @@ -13092,7 +13140,7 @@ dependencies = [ [[package]] name = "substrate-build-script-utils" version = "3.0.0" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "platforms 2.0.0", ] @@ -13111,7 +13159,7 @@ dependencies = [ [[package]] name = "substrate-frame-rpc-system" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "frame-system-rpc-runtime-api", "futures", @@ -13130,7 +13178,7 @@ dependencies = [ [[package]] name = "substrate-prometheus-endpoint" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "hyper", "log", @@ -13142,7 +13190,7 @@ dependencies = [ [[package]] name = "substrate-rpc-client" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "async-trait", "jsonrpsee", @@ -13155,7 +13203,7 @@ dependencies = [ [[package]] name = "substrate-state-trie-migration-rpc" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "jsonrpsee", "log", @@ -13174,7 +13222,7 @@ dependencies = [ [[package]] name = "substrate-wasm-builder" version = "5.0.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "ansi_term", "build-helper", @@ -13671,8 +13719,8 @@ dependencies = [ [[package]] name = "tracing-gum" -version = "0.9.37" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" +version = "0.9.38" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.38#72309a2b2e68413305a56dce1097041309bd29c6" dependencies = [ "polkadot-node-jaeger", "polkadot-primitives", @@ -13682,8 +13730,8 @@ dependencies = [ [[package]] name = "tracing-gum-proc-macro" -version = "0.9.37" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" +version = "0.9.38" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.38#72309a2b2e68413305a56dce1097041309bd29c6" dependencies = [ "expander 0.0.6", "proc-macro-crate", @@ -13886,7 +13934,7 @@ checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" [[package]] name = "try-runtime-cli" version = "0.10.0-dev" -source = "git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37#3f1259a3e4e896a39733564a77f24116ebc370cc" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#18bb7c7c841b101c19a8d1881b893ae8e37de460" dependencies = [ "clap", "frame-remote-externalities", @@ -14235,9 +14283,9 @@ dependencies = [ [[package]] name = "wasm-opt" -version = "0.110.2" +version = "0.111.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b68e8037b4daf711393f4be2056246d12d975651b14d581520ad5d1f19219cec" +checksum = "84a303793cbc01fb96551badfc7367db6007396bba6bac97936b3c8b6f7fdb41" dependencies = [ "anyhow", "libc", @@ -14251,9 +14299,9 @@ dependencies = [ [[package]] name = "wasm-opt-cxx-sys" -version = "0.110.2" +version = "0.111.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91adbad477e97bba3fbd21dd7bfb594e7ad5ceb9169ab1c93ab9cb0ada636b6f" +checksum = "d9c9deb56f8a9f2ec177b3bd642a8205621835944ed5da55f2388ef216aca5a4" dependencies = [ "anyhow", "cxx", @@ -14263,9 +14311,9 @@ dependencies = [ [[package]] name = "wasm-opt-sys" -version = "0.110.2" +version = "0.111.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec4fa5a322a4e6ac22fd141f498d56afbdbf9df5debeac32380d2dcaa3e06941" +checksum = "4432e28b542738a9776cedf92e8a99d8991c7b4667ee2c7ccddfb479dd2856a7" dependencies = [ "anyhow", "cc", @@ -14758,7 +14806,7 @@ dependencies = [ "lazy_static", "libc", "log", - "nix", + "nix 0.24.3", "rand 0.8.5", "thiserror", "tokio", @@ -14776,8 +14824,8 @@ dependencies = [ [[package]] name = "westend-runtime" -version = "0.9.37" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" +version = "0.9.38" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.38#72309a2b2e68413305a56dce1097041309bd29c6" dependencies = [ "bitvec", "frame-benchmarking", @@ -14821,6 +14869,7 @@ dependencies = [ "pallet-society", "pallet-staking", "pallet-staking-reward-curve", + "pallet-state-trie-migration", "pallet-sudo", "pallet-timestamp", "pallet-transaction-payment", @@ -14866,8 +14915,8 @@ dependencies = [ [[package]] name = "westend-runtime-constants" -version = "0.9.37" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" +version = "0.9.38" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.38#72309a2b2e68413305a56dce1097041309bd29c6" dependencies = [ "frame-support", "polkadot-primitives", @@ -15172,25 +15221,28 @@ dependencies = [ [[package]] name = "xcm" -version = "0.9.37" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" +version = "0.9.38" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.38#72309a2b2e68413305a56dce1097041309bd29c6" dependencies = [ "derivative", "impl-trait-for-tuples", "log", "parity-scale-codec", "scale-info", - "sp-runtime", + "serde", + "sp-core", + "sp-weights", "xcm-procedural", ] [[package]] name = "xcm-builder" -version = "0.9.37" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" +version = "0.9.38" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.38#72309a2b2e68413305a56dce1097041309bd29c6" dependencies = [ "frame-support", "frame-system", + "impl-trait-for-tuples", "log", "pallet-transaction-payment", "parity-scale-codec", @@ -15206,9 +15258,10 @@ dependencies = [ [[package]] name = "xcm-executor" -version = "0.9.37" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" +version = "0.9.38" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.38#72309a2b2e68413305a56dce1097041309bd29c6" dependencies = [ + "environmental", "frame-benchmarking", "frame-support", "impl-trait-for-tuples", @@ -15219,19 +15272,22 @@ dependencies = [ "sp-io", "sp-runtime", "sp-std", + "sp-weights", "xcm", ] [[package]] name = "xcm-primitives" version = "0.1.0" -source = "git+https://github.com/darwinia-network/moonbeam?branch=polkadot-v0.9.37#3e272b5e0fad227e09880cd5a7c1c709a69f0a92" +source = "git+https://github.com/darwinia-network/moonbeam?branch=polkadot-v0.9.38#81caf339d816df9fab32bd2d7fd71a9d9b6b650f" dependencies = [ + "cumulus-primitives-core", "ethereum", "ethereum-types 0.14.1", "frame-support", "frame-system", "hex", + "impl-trait-for-tuples", "log", "orml-traits", "parity-scale-codec", @@ -15248,8 +15304,8 @@ dependencies = [ [[package]] name = "xcm-procedural" -version = "0.9.37" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.37#645723987cf9662244be8faf4e9b63e8b9a1b3a3" +version = "0.9.38" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.38#72309a2b2e68413305a56dce1097041309bd29c6" dependencies = [ "Inflector", "proc-macro2", diff --git a/Cargo.toml b/Cargo.toml index 8f3d7b15b..7a51e4717 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -69,17 +69,17 @@ pangolin-runtime = { path = "runtime/pangolin" } pangoro-runtime = { path = "runtime/pangoro" } # darwinia-messages-substrate -bp-darwinia-core = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.38" } -bp-message-dispatch = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.38" } -bp-messages = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.38" } -bp-polkadot-core = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.38" } -bp-runtime = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.38" } -bridge-runtime-common = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.38" } -pallet-bridge-dispatch = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.38" } -pallet-bridge-grandpa = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.38" } -pallet-bridge-messages = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.38" } -pallet-bridge-parachains = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.38" } -pallet-fee-market = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.38" } +bp-darwinia-core = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "prepare-polkadot-v0.9.38" } +bp-message-dispatch = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "prepare-polkadot-v0.9.38" } +bp-messages = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "prepare-polkadot-v0.9.38" } +bp-polkadot-core = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "prepare-polkadot-v0.9.38" } +bp-runtime = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "prepare-polkadot-v0.9.38" } +bridge-runtime-common = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "prepare-polkadot-v0.9.38" } +pallet-bridge-dispatch = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "prepare-polkadot-v0.9.38" } +pallet-bridge-grandpa = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "prepare-polkadot-v0.9.38" } +pallet-bridge-messages = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "prepare-polkadot-v0.9.38" } +pallet-bridge-parachains = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "prepare-polkadot-v0.9.38" } +pallet-fee-market = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "prepare-polkadot-v0.9.38" } # frontier fc-cli = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.38" } From 5acfb7e8c71d1e8f29d9b181aa09e1d9ae85da4d Mon Sep 17 00:00:00 2001 From: Guantong Date: Thu, 2 Mar 2023 10:57:49 +0800 Subject: [PATCH 171/189] Companion for paritytech/substrate#13216 --- pallet/staking/src/lib.rs | 8 -------- 1 file changed, 8 deletions(-) diff --git a/pallet/staking/src/lib.rs b/pallet/staking/src/lib.rs index d38d9d861..7a209c992 100644 --- a/pallet/staking/src/lib.rs +++ b/pallet/staking/src/lib.rs @@ -979,14 +979,6 @@ where fn note_author(author: T::AccountId) { Self::reward_by_ids(&[(author, 20)]) } - - fn note_uncle(uncle_author: T::AccountId, _age: T::BlockNumber) { - if let Some(block_author) = >::author() { - Self::reward_by_ids(&[(block_author, 2), (uncle_author, 1)]) - } else { - log::error!("[pallet::staking] block author not set, this should never happen; qed"); - } - } } // Play the role of the session manager. From 7c67b908a09f8952ab0ce998d3327ba4a828508b Mon Sep 17 00:00:00 2001 From: Guantong Date: Thu, 2 Mar 2023 10:59:08 +0800 Subject: [PATCH 172/189] Companion for darwinia-messages-substrate#254 --- runtime/crab/src/bridges_message/darwinia.rs | 1 - runtime/darwinia/src/bridges_message/crab.rs | 1 - runtime/pangolin/src/bridges_message/pangoro.rs | 1 - runtime/pangoro/src/bridges_message/pangolin.rs | 1 - 4 files changed, 4 deletions(-) diff --git a/runtime/crab/src/bridges_message/darwinia.rs b/runtime/crab/src/bridges_message/darwinia.rs index f6cfcb873..1eadb2b11 100644 --- a/runtime/crab/src/bridges_message/darwinia.rs +++ b/runtime/crab/src/bridges_message/darwinia.rs @@ -96,7 +96,6 @@ impl MessageBridge for WithDarwiniaMessageBridge { const BRIDGED_CHAIN_ID: bp_runtime::ChainId = DARWINIA_CHAIN_ID; const BRIDGED_MESSAGES_PALLET_NAME: &'static str = bridge_runtime_common::pallets::WITH_CRAB_MESSAGES_PALLET_NAME; - const RELAYER_FEE_PERCENT: u32 = 10; const THIS_CHAIN_ID: bp_runtime::ChainId = CRAB_CHAIN_ID; } diff --git a/runtime/darwinia/src/bridges_message/crab.rs b/runtime/darwinia/src/bridges_message/crab.rs index 174adaf12..de21782c0 100644 --- a/runtime/darwinia/src/bridges_message/crab.rs +++ b/runtime/darwinia/src/bridges_message/crab.rs @@ -92,7 +92,6 @@ impl MessageBridge for WithCrabMessageBridge { const BRIDGED_CHAIN_ID: bp_runtime::ChainId = CRAB_CHAIN_ID; const BRIDGED_MESSAGES_PALLET_NAME: &'static str = bridge_runtime_common::pallets::WITH_DARWINIA_MESSAGES_PALLET_NAME; - const RELAYER_FEE_PERCENT: u32 = 10; const THIS_CHAIN_ID: bp_runtime::ChainId = DARWINIA_CHAIN_ID; } diff --git a/runtime/pangolin/src/bridges_message/pangoro.rs b/runtime/pangolin/src/bridges_message/pangoro.rs index bb96b0a42..3cb0d2028 100644 --- a/runtime/pangolin/src/bridges_message/pangoro.rs +++ b/runtime/pangolin/src/bridges_message/pangoro.rs @@ -96,7 +96,6 @@ impl MessageBridge for WithPangoroMessageBridge { const BRIDGED_CHAIN_ID: bp_runtime::ChainId = PANGORO_CHAIN_ID; const BRIDGED_MESSAGES_PALLET_NAME: &'static str = bridge_runtime_common::pallets::WITH_PANGOLIN_MESSAGES_PALLET_NAME; - const RELAYER_FEE_PERCENT: u32 = 10; const THIS_CHAIN_ID: bp_runtime::ChainId = PANGOLIN_CHAIN_ID; } diff --git a/runtime/pangoro/src/bridges_message/pangolin.rs b/runtime/pangoro/src/bridges_message/pangolin.rs index 12f5cf2e4..0ee735f3a 100644 --- a/runtime/pangoro/src/bridges_message/pangolin.rs +++ b/runtime/pangoro/src/bridges_message/pangolin.rs @@ -96,7 +96,6 @@ impl MessageBridge for WithPangolinMessageBridge { const BRIDGED_CHAIN_ID: bp_runtime::ChainId = PANGOLIN_CHAIN_ID; const BRIDGED_MESSAGES_PALLET_NAME: &'static str = bridge_runtime_common::pallets::WITH_PANGORO_MESSAGES_PALLET_NAME; - const RELAYER_FEE_PERCENT: u32 = 10; const THIS_CHAIN_ID: bp_runtime::ChainId = PANGORO_CHAIN_ID; } From 412a7ebd3254e37db3d4042b4dc8475ecb6e0a6f Mon Sep 17 00:00:00 2001 From: Guantong Date: Thu, 2 Mar 2023 13:37:03 +0800 Subject: [PATCH 173/189] Companion for paritytech/polkadot#4097 --- Cargo.lock | 8 ++++---- runtime/common/src/xcm_configs.rs | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1c2b48f35..c259a423c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -15,7 +15,7 @@ dependencies = [ [[package]] name = "account" version = "0.1.1" -source = "git+https://github.com/darwinia-network/moonbeam?branch=polkadot-v0.9.38#81caf339d816df9fab32bd2d7fd71a9d9b6b650f" +source = "git+https://github.com/darwinia-network/moonbeam?branch=polkadot-v0.9.38#6b21c49d9c3def2b0cd799f67c1feb136831e749" dependencies = [ "blake2-rfc", "hex", @@ -9653,7 +9653,7 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "precompile-utils" version = "0.1.0" -source = "git+https://github.com/darwinia-network/moonbeam?branch=polkadot-v0.9.38#81caf339d816df9fab32bd2d7fd71a9d9b6b650f" +source = "git+https://github.com/darwinia-network/moonbeam?branch=polkadot-v0.9.38#6b21c49d9c3def2b0cd799f67c1feb136831e749" dependencies = [ "affix", "derive_more", @@ -9684,7 +9684,7 @@ dependencies = [ [[package]] name = "precompile-utils-macro" version = "0.1.0" -source = "git+https://github.com/darwinia-network/moonbeam?branch=polkadot-v0.9.38#81caf339d816df9fab32bd2d7fd71a9d9b6b650f" +source = "git+https://github.com/darwinia-network/moonbeam?branch=polkadot-v0.9.38#6b21c49d9c3def2b0cd799f67c1feb136831e749" dependencies = [ "case", "num_enum", @@ -15279,7 +15279,7 @@ dependencies = [ [[package]] name = "xcm-primitives" version = "0.1.0" -source = "git+https://github.com/darwinia-network/moonbeam?branch=polkadot-v0.9.38#81caf339d816df9fab32bd2d7fd71a9d9b6b650f" +source = "git+https://github.com/darwinia-network/moonbeam?branch=polkadot-v0.9.38#6b21c49d9c3def2b0cd799f67c1feb136831e749" dependencies = [ "cumulus-primitives-core", "ethereum", diff --git a/runtime/common/src/xcm_configs.rs b/runtime/common/src/xcm_configs.rs index 436c1dc26..3bbba264f 100644 --- a/runtime/common/src/xcm_configs.rs +++ b/runtime/common/src/xcm_configs.rs @@ -147,7 +147,7 @@ pub struct LocalAssetTrader< OnUnbalanced: OnUnbalancedT, R: TakeRevenue, >( - XcmWeight, + Weight, Currency::Balance, PhantomData<(WeightToFee, AssetId, AccountId, Currency, OnUnbalanced, R)>, ); @@ -161,12 +161,12 @@ impl< > WeightTrader for LocalAssetTrader { fn new() -> Self { - Self(0, Zero::zero(), PhantomData) + Self(Weight::zero(), Zero::zero(), PhantomData) } fn buy_weight(&mut self, weight: XcmWeight, payment: Assets) -> Result { log::trace!(target: "xcm::weight", "LocalAssetTrader::buy_weight weight: {:?}, payment: {:?}", weight, payment); - let amount = WeightToFee::weight_to_fee(&Weight::from_ref_time(weight)); + let amount = WeightToFee::weight_to_fee(&weight); let u128_amount: u128 = amount.try_into().map_err(|_| XcmError::Overflow)?; let required: MultiAsset = (Concrete(AssetId::get()), u128_amount).into(); let unused = payment.checked_sub(required.clone()).map_err(|_| XcmError::TooExpensive)?; @@ -179,7 +179,7 @@ impl< fn refund_weight(&mut self, weight: XcmWeight) -> Option { log::trace!(target: "xcm::weight", "LocalAssetTrader::refund_weight weight: {:?}", weight); let weight = weight.min(self.0); - let amount = WeightToFee::weight_to_fee(&Weight::from_ref_time(weight)); + let amount = WeightToFee::weight_to_fee(&weight); self.0 -= weight; self.1 = self.1.saturating_sub(amount); let amount: u128 = amount.saturated_into(); From 8c6a3fd583bcaa5c73fe9bcab503bbdb5da471f6 Mon Sep 17 00:00:00 2001 From: Guantong Date: Thu, 2 Mar 2023 13:40:53 +0800 Subject: [PATCH 174/189] Part companion for paritytech/cumulus#2067 --- runtime/crab/src/pallets/system.rs | 2 +- runtime/darwinia/src/pallets/system.rs | 2 +- runtime/pangolin/src/pallets/system.rs | 2 +- runtime/pangoro/src/pallets/system.rs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/runtime/crab/src/pallets/system.rs b/runtime/crab/src/pallets/system.rs index 1668a4912..a62436af6 100644 --- a/runtime/crab/src/pallets/system.rs +++ b/runtime/crab/src/pallets/system.rs @@ -32,7 +32,7 @@ pub const WEIGHT_MILLISECS_PER_BLOCK: u64 = 500; pub const MAXIMUM_BLOCK_WEIGHT: frame_support::weights::Weight = frame_support::weights::Weight::from_parts( frame_support::weights::constants::WEIGHT_REF_TIME_PER_MILLIS * WEIGHT_MILLISECS_PER_BLOCK, - cumulus_primitives_core::relay_chain::v2::MAX_POV_SIZE as u64, + cumulus_primitives_core::relay_chain::MAX_POV_SIZE as u64, ); frame_support::parameter_types! { diff --git a/runtime/darwinia/src/pallets/system.rs b/runtime/darwinia/src/pallets/system.rs index 2b08d5384..d8ea1c4b8 100644 --- a/runtime/darwinia/src/pallets/system.rs +++ b/runtime/darwinia/src/pallets/system.rs @@ -32,7 +32,7 @@ pub const WEIGHT_MILLISECS_PER_BLOCK: u64 = 500; pub const MAXIMUM_BLOCK_WEIGHT: frame_support::weights::Weight = frame_support::weights::Weight::from_parts( frame_support::weights::constants::WEIGHT_REF_TIME_PER_MILLIS * WEIGHT_MILLISECS_PER_BLOCK, - cumulus_primitives_core::relay_chain::v2::MAX_POV_SIZE as u64, + cumulus_primitives_core::relay_chain::MAX_POV_SIZE as u64, ); frame_support::parameter_types! { diff --git a/runtime/pangolin/src/pallets/system.rs b/runtime/pangolin/src/pallets/system.rs index 1668a4912..a62436af6 100644 --- a/runtime/pangolin/src/pallets/system.rs +++ b/runtime/pangolin/src/pallets/system.rs @@ -32,7 +32,7 @@ pub const WEIGHT_MILLISECS_PER_BLOCK: u64 = 500; pub const MAXIMUM_BLOCK_WEIGHT: frame_support::weights::Weight = frame_support::weights::Weight::from_parts( frame_support::weights::constants::WEIGHT_REF_TIME_PER_MILLIS * WEIGHT_MILLISECS_PER_BLOCK, - cumulus_primitives_core::relay_chain::v2::MAX_POV_SIZE as u64, + cumulus_primitives_core::relay_chain::MAX_POV_SIZE as u64, ); frame_support::parameter_types! { diff --git a/runtime/pangoro/src/pallets/system.rs b/runtime/pangoro/src/pallets/system.rs index 2b08d5384..d8ea1c4b8 100644 --- a/runtime/pangoro/src/pallets/system.rs +++ b/runtime/pangoro/src/pallets/system.rs @@ -32,7 +32,7 @@ pub const WEIGHT_MILLISECS_PER_BLOCK: u64 = 500; pub const MAXIMUM_BLOCK_WEIGHT: frame_support::weights::Weight = frame_support::weights::Weight::from_parts( frame_support::weights::constants::WEIGHT_REF_TIME_PER_MILLIS * WEIGHT_MILLISECS_PER_BLOCK, - cumulus_primitives_core::relay_chain::v2::MAX_POV_SIZE as u64, + cumulus_primitives_core::relay_chain::MAX_POV_SIZE as u64, ); frame_support::parameter_types! { From 25a7b33a13e2773be25a9d18f14b384a51adfb09 Mon Sep 17 00:00:00 2001 From: Guantong Date: Thu, 2 Mar 2023 13:47:14 +0800 Subject: [PATCH 175/189] Correct companion for cumulus#2073 --- runtime/crab/src/lib.rs | 20 ++++++++++++-------- runtime/darwinia/src/lib.rs | 20 ++++++++++++-------- runtime/pangolin/src/lib.rs | 20 ++++++++++++-------- runtime/pangoro/src/lib.rs | 20 ++++++++++++-------- 4 files changed, 48 insertions(+), 32 deletions(-) diff --git a/runtime/crab/src/lib.rs b/runtime/crab/src/lib.rs index 012a6a148..50288099b 100644 --- a/runtime/crab/src/lib.rs +++ b/runtime/crab/src/lib.rs @@ -215,14 +215,6 @@ sp_api::impl_runtime_apis! { fn authorities() -> Vec { Aura::authorities().into_inner() } - - fn query_weight_to_fee(weight: Weight) -> Balance { - TransactionPayment::weight_to_fee(weight) - } - - fn query_length_to_fee(length: u32) -> Balance { - TransactionPayment::length_to_fee(length) - } } impl sp_api::Core for Runtime { @@ -313,6 +305,12 @@ sp_api::impl_runtime_apis! { ) -> pallet_transaction_payment::FeeDetails { TransactionPayment::query_fee_details(uxt, len) } + fn query_weight_to_fee(weight: Weight) -> Balance { + TransactionPayment::weight_to_fee(weight) + } + fn query_length_to_fee(length: u32) -> Balance { + TransactionPayment::length_to_fee(length) + } } impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentCallApi @@ -330,6 +328,12 @@ sp_api::impl_runtime_apis! { ) -> pallet_transaction_payment::FeeDetails { TransactionPayment::query_call_fee_details(call, len) } + fn query_weight_to_fee(weight: Weight) -> Balance { + TransactionPayment::weight_to_fee(weight) + } + fn query_length_to_fee(length: u32) -> Balance { + TransactionPayment::length_to_fee(length) + } } impl cumulus_primitives_core::CollectCollationInfo for Runtime { diff --git a/runtime/darwinia/src/lib.rs b/runtime/darwinia/src/lib.rs index f870fc237..74af42051 100644 --- a/runtime/darwinia/src/lib.rs +++ b/runtime/darwinia/src/lib.rs @@ -215,14 +215,6 @@ sp_api::impl_runtime_apis! { fn authorities() -> Vec { Aura::authorities().into_inner() } - - fn query_weight_to_fee(weight: Weight) -> Balance { - TransactionPayment::weight_to_fee(weight) - } - - fn query_length_to_fee(length: u32) -> Balance { - TransactionPayment::length_to_fee(length) - } } impl sp_api::Core for Runtime { @@ -313,6 +305,12 @@ sp_api::impl_runtime_apis! { ) -> pallet_transaction_payment::FeeDetails { TransactionPayment::query_fee_details(uxt, len) } + fn query_weight_to_fee(weight: Weight) -> Balance { + TransactionPayment::weight_to_fee(weight) + } + fn query_length_to_fee(length: u32) -> Balance { + TransactionPayment::length_to_fee(length) + } } impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentCallApi @@ -330,6 +328,12 @@ sp_api::impl_runtime_apis! { ) -> pallet_transaction_payment::FeeDetails { TransactionPayment::query_call_fee_details(call, len) } + fn query_weight_to_fee(weight: Weight) -> Balance { + TransactionPayment::weight_to_fee(weight) + } + fn query_length_to_fee(length: u32) -> Balance { + TransactionPayment::length_to_fee(length) + } } impl cumulus_primitives_core::CollectCollationInfo for Runtime { diff --git a/runtime/pangolin/src/lib.rs b/runtime/pangolin/src/lib.rs index 90b87af88..7bbbb574c 100644 --- a/runtime/pangolin/src/lib.rs +++ b/runtime/pangolin/src/lib.rs @@ -217,14 +217,6 @@ sp_api::impl_runtime_apis! { fn authorities() -> Vec { Aura::authorities().into_inner() } - - fn query_weight_to_fee(weight: Weight) -> Balance { - TransactionPayment::weight_to_fee(weight) - } - - fn query_length_to_fee(length: u32) -> Balance { - TransactionPayment::length_to_fee(length) - } } impl sp_api::Core for Runtime { @@ -315,6 +307,12 @@ sp_api::impl_runtime_apis! { ) -> pallet_transaction_payment::FeeDetails { TransactionPayment::query_fee_details(uxt, len) } + fn query_weight_to_fee(weight: Weight) -> Balance { + TransactionPayment::weight_to_fee(weight) + } + fn query_length_to_fee(length: u32) -> Balance { + TransactionPayment::length_to_fee(length) + } } impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentCallApi @@ -332,6 +330,12 @@ sp_api::impl_runtime_apis! { ) -> pallet_transaction_payment::FeeDetails { TransactionPayment::query_call_fee_details(call, len) } + fn query_weight_to_fee(weight: Weight) -> Balance { + TransactionPayment::weight_to_fee(weight) + } + fn query_length_to_fee(length: u32) -> Balance { + TransactionPayment::length_to_fee(length) + } } impl cumulus_primitives_core::CollectCollationInfo for Runtime { diff --git a/runtime/pangoro/src/lib.rs b/runtime/pangoro/src/lib.rs index 3693be58f..e4c124f00 100644 --- a/runtime/pangoro/src/lib.rs +++ b/runtime/pangoro/src/lib.rs @@ -217,14 +217,6 @@ sp_api::impl_runtime_apis! { fn authorities() -> Vec { Aura::authorities().into_inner() } - - fn query_weight_to_fee(weight: Weight) -> Balance { - TransactionPayment::weight_to_fee(weight) - } - - fn query_length_to_fee(length: u32) -> Balance { - TransactionPayment::length_to_fee(length) - } } impl sp_api::Core for Runtime { @@ -315,6 +307,12 @@ sp_api::impl_runtime_apis! { ) -> pallet_transaction_payment::FeeDetails { TransactionPayment::query_fee_details(uxt, len) } + fn query_weight_to_fee(weight: Weight) -> Balance { + TransactionPayment::weight_to_fee(weight) + } + fn query_length_to_fee(length: u32) -> Balance { + TransactionPayment::length_to_fee(length) + } } impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentCallApi @@ -332,6 +330,12 @@ sp_api::impl_runtime_apis! { ) -> pallet_transaction_payment::FeeDetails { TransactionPayment::query_call_fee_details(call, len) } + fn query_weight_to_fee(weight: Weight) -> Balance { + TransactionPayment::weight_to_fee(weight) + } + fn query_length_to_fee(length: u32) -> Balance { + TransactionPayment::length_to_fee(length) + } } impl cumulus_primitives_core::CollectCollationInfo for Runtime { From fe23fd227c2179aa5c30a7462c806189117d0f64 Mon Sep 17 00:00:00 2001 From: Guantong Date: Thu, 2 Mar 2023 14:44:09 +0800 Subject: [PATCH 176/189] Fix xcm compilation --- Cargo.lock | 39 ++++++++++---------- runtime/crab/src/lib.rs | 4 +- runtime/crab/src/pallets/polkadot_xcm.rs | 26 +++++++------ runtime/darwinia/src/lib.rs | 2 +- runtime/darwinia/src/pallets/polkadot_xcm.rs | 26 +++++++------ runtime/pangolin/src/lib.rs | 4 +- runtime/pangolin/src/pallets/polkadot_xcm.rs | 26 +++++++------ runtime/pangoro/src/lib.rs | 4 +- runtime/pangoro/src/pallets/polkadot_xcm.rs | 26 +++++++------ 9 files changed, 83 insertions(+), 74 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c259a423c..ac078f8d8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3476,7 +3476,7 @@ dependencies = [ [[package]] name = "fc-cli" version = "1.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#7e9c5e5e52cede605cae20cf6b2f02b6cf73043a" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#3da6241e6cb992bbdbf01f09a7c6add48df1b34d" dependencies = [ "clap", "ethereum-types 0.14.1", @@ -3494,7 +3494,7 @@ dependencies = [ [[package]] name = "fc-consensus" version = "2.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#7e9c5e5e52cede605cae20cf6b2f02b6cf73043a" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#3da6241e6cb992bbdbf01f09a7c6add48df1b34d" dependencies = [ "async-trait", "fc-db", @@ -3513,7 +3513,7 @@ dependencies = [ [[package]] name = "fc-db" version = "2.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#7e9c5e5e52cede605cae20cf6b2f02b6cf73043a" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#3da6241e6cb992bbdbf01f09a7c6add48df1b34d" dependencies = [ "fp-storage", "kvdb-rocksdb", @@ -3532,7 +3532,7 @@ dependencies = [ [[package]] name = "fc-mapping-sync" version = "2.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#7e9c5e5e52cede605cae20cf6b2f02b6cf73043a" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#3da6241e6cb992bbdbf01f09a7c6add48df1b34d" dependencies = [ "fc-db", "fp-consensus", @@ -3549,7 +3549,7 @@ dependencies = [ [[package]] name = "fc-rpc" version = "2.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#7e9c5e5e52cede605cae20cf6b2f02b6cf73043a" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#3da6241e6cb992bbdbf01f09a7c6add48df1b34d" dependencies = [ "ethereum", "ethereum-types 0.14.1", @@ -3591,7 +3591,7 @@ dependencies = [ [[package]] name = "fc-rpc-core" version = "1.1.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#7e9c5e5e52cede605cae20cf6b2f02b6cf73043a" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#3da6241e6cb992bbdbf01f09a7c6add48df1b34d" dependencies = [ "ethereum", "ethereum-types 0.14.1", @@ -3755,7 +3755,7 @@ dependencies = [ [[package]] name = "fp-consensus" version = "2.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#7e9c5e5e52cede605cae20cf6b2f02b6cf73043a" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#3da6241e6cb992bbdbf01f09a7c6add48df1b34d" dependencies = [ "ethereum", "parity-scale-codec", @@ -3767,7 +3767,7 @@ dependencies = [ [[package]] name = "fp-ethereum" version = "1.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#7e9c5e5e52cede605cae20cf6b2f02b6cf73043a" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#3da6241e6cb992bbdbf01f09a7c6add48df1b34d" dependencies = [ "ethereum", "ethereum-types 0.14.1", @@ -3781,20 +3781,21 @@ dependencies = [ [[package]] name = "fp-evm" version = "3.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#7e9c5e5e52cede605cae20cf6b2f02b6cf73043a" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#3da6241e6cb992bbdbf01f09a7c6add48df1b34d" dependencies = [ "evm", "frame-support", "parity-scale-codec", "serde", "sp-core", + "sp-runtime", "sp-std", ] [[package]] name = "fp-rpc" version = "3.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#7e9c5e5e52cede605cae20cf6b2f02b6cf73043a" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#3da6241e6cb992bbdbf01f09a7c6add48df1b34d" dependencies = [ "ethereum", "ethereum-types 0.14.1", @@ -3810,7 +3811,7 @@ dependencies = [ [[package]] name = "fp-self-contained" version = "1.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#7e9c5e5e52cede605cae20cf6b2f02b6cf73043a" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#3da6241e6cb992bbdbf01f09a7c6add48df1b34d" dependencies = [ "frame-support", "parity-scale-codec", @@ -3822,7 +3823,7 @@ dependencies = [ [[package]] name = "fp-storage" version = "2.0.0" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#7e9c5e5e52cede605cae20cf6b2f02b6cf73043a" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#3da6241e6cb992bbdbf01f09a7c6add48df1b34d" dependencies = [ "parity-scale-codec", "serde", @@ -7177,7 +7178,7 @@ dependencies = [ [[package]] name = "pallet-ethereum" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#7e9c5e5e52cede605cae20cf6b2f02b6cf73043a" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#3da6241e6cb992bbdbf01f09a7c6add48df1b34d" dependencies = [ "ethereum", "ethereum-types 0.14.1", @@ -7203,7 +7204,7 @@ dependencies = [ [[package]] name = "pallet-evm" version = "6.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#7e9c5e5e52cede605cae20cf6b2f02b6cf73043a" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#3da6241e6cb992bbdbf01f09a7c6add48df1b34d" dependencies = [ "environmental", "evm", @@ -7227,7 +7228,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-blake2" version = "2.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#7e9c5e5e52cede605cae20cf6b2f02b6cf73043a" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#3da6241e6cb992bbdbf01f09a7c6add48df1b34d" dependencies = [ "fp-evm", ] @@ -7235,7 +7236,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-bn128" version = "2.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#7e9c5e5e52cede605cae20cf6b2f02b6cf73043a" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#3da6241e6cb992bbdbf01f09a7c6add48df1b34d" dependencies = [ "fp-evm", "sp-core", @@ -7245,7 +7246,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-dispatch" version = "2.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#7e9c5e5e52cede605cae20cf6b2f02b6cf73043a" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#3da6241e6cb992bbdbf01f09a7c6add48df1b34d" dependencies = [ "fp-evm", "frame-support", @@ -7255,7 +7256,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-modexp" version = "2.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#7e9c5e5e52cede605cae20cf6b2f02b6cf73043a" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#3da6241e6cb992bbdbf01f09a7c6add48df1b34d" dependencies = [ "fp-evm", "num", @@ -7264,7 +7265,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-simple" version = "2.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#7e9c5e5e52cede605cae20cf6b2f02b6cf73043a" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#3da6241e6cb992bbdbf01f09a7c6add48df1b34d" dependencies = [ "fp-evm", "ripemd", diff --git a/runtime/crab/src/lib.rs b/runtime/crab/src/lib.rs index 50288099b..9fd732a7b 100644 --- a/runtime/crab/src/lib.rs +++ b/runtime/crab/src/lib.rs @@ -305,7 +305,7 @@ sp_api::impl_runtime_apis! { ) -> pallet_transaction_payment::FeeDetails { TransactionPayment::query_fee_details(uxt, len) } - fn query_weight_to_fee(weight: Weight) -> Balance { + fn query_weight_to_fee(weight: frame_support::weights::Weight) -> Balance { TransactionPayment::weight_to_fee(weight) } fn query_length_to_fee(length: u32) -> Balance { @@ -328,7 +328,7 @@ sp_api::impl_runtime_apis! { ) -> pallet_transaction_payment::FeeDetails { TransactionPayment::query_call_fee_details(call, len) } - fn query_weight_to_fee(weight: Weight) -> Balance { + fn query_weight_to_fee(weight: frame_support::weights::Weight) -> Balance { TransactionPayment::weight_to_fee(weight) } fn query_length_to_fee(length: u32) -> Balance { diff --git a/runtime/crab/src/pallets/polkadot_xcm.rs b/runtime/crab/src/pallets/polkadot_xcm.rs index b3ed01656..110e976fd 100644 --- a/runtime/crab/src/pallets/polkadot_xcm.rs +++ b/runtime/crab/src/pallets/polkadot_xcm.rs @@ -18,6 +18,8 @@ // darwinia use crate::*; +// polkadot +use xcm::latest::prelude::*; // substrate use frame_support::traits::Currency; @@ -36,7 +38,7 @@ pub type LocalAssetTransactor = xcm_builder::CurrencyAdapter< >; frame_support::parameter_types! { - pub const RelayNetwork: Option = Some(xcm::latest::NetworkId::Kusama); + pub const RelayNetwork: NetworkId = NetworkId::Kusama; pub RelayChainOrigin: RuntimeOrigin = cumulus_pallet_xcm::Origin::Relay.into(); } /// Type for specifying how a `MultiLocation` can be converted into an `AccountId`. This is used @@ -77,7 +79,7 @@ pub type Barrier = darwinia_common_runtime::xcm_configs::DenyThenTry< darwinia_common_runtime::xcm_configs::DenyReserveTransferToRelayChain, ( xcm_builder::TakeWeightCredit, - WithComputedOrigin< + xcm_builder::WithComputedOrigin< ( xcm_builder::AllowTopLevelPaidExecutionFrom, // Parent and its exec plurality get free execution @@ -100,21 +102,21 @@ pub type Barrier = darwinia_common_runtime::xcm_configs::DenyThenTry< frame_support::parameter_types! { pub const MaxAssetsIntoHolding: u32 = 64; pub const MaxInstructions: u32 = 100; - pub AnchoringSelfReserve: xcm::latest::prelude::MultiLocation = xcm::latest::prelude::MultiLocation::new( + pub AnchoringSelfReserve: MultiLocation = MultiLocation::new( 0, - xcm::latest::prelude::X1(xcm::latest::prelude::PalletInstance(::index() as u8)) + X1(PalletInstance(::index() as u8)) ); - pub UniversalLocation: xcm::latest::prelude::InteriorMultiLocation = xcm::latest::prelude::Parachain(ParachainInfo::parachain_id().into()).into(); + pub UniversalLocation: InteriorMultiLocation = Parachain(ParachainInfo::parachain_id().into()).into(); // One XCM operation is 1_000_000_000 weight - almost certainly a conservative estimate. - pub UnitWeightCost: Weight = Weight::from_parts(1_000_000_000, 64 * 1024); + pub UnitWeightCost: frame_support::weights::Weight = frame_support::weights::Weight::from_parts(1_000_000_000, 64 * 1024); } pub struct ToTreasury; impl xcm_builder::TakeRevenue for ToTreasury { - fn take_revenue(revenue: xcm::latest::prelude::MultiAsset) { - if let xcm::latest::prelude::MultiAsset { - id: xcm::latest::prelude::Concrete(_location), - fun: xcm::latest::prelude::Fungible(amount), + fn take_revenue(revenue: MultiAsset) { + if let MultiAsset { + id: Concrete(_location), + fun: Fungible(amount), } = revenue { let treasury_account = Treasury::account_id(); @@ -147,7 +149,7 @@ impl xcm_executor::Config for XcmExecutorConfig { type PalletInstancesInfo = AllPalletsWithSystem; type ResponseHandler = PolkadotXcm; type RuntimeCall = RuntimeCall; - type SafeCallFilter = Everything; + type SafeCallFilter = frame_support::traits::Everything; type SubscriptionService = PolkadotXcm; type Trader = xcm_configs::LocalAssetTrader< frame_support::weights::ConstantMultiplier< @@ -160,7 +162,7 @@ impl xcm_executor::Config for XcmExecutorConfig { DealWithFees, ToTreasury, >; - type UniversalAliases = Nothing; + type UniversalAliases = frame_support::traits::Nothing; // Teleporting is disabled. type UniversalLocation = UniversalLocation; type Weigher = xcm_builder::FixedWeightBounds; diff --git a/runtime/darwinia/src/lib.rs b/runtime/darwinia/src/lib.rs index 74af42051..70f99fcf0 100644 --- a/runtime/darwinia/src/lib.rs +++ b/runtime/darwinia/src/lib.rs @@ -305,7 +305,7 @@ sp_api::impl_runtime_apis! { ) -> pallet_transaction_payment::FeeDetails { TransactionPayment::query_fee_details(uxt, len) } - fn query_weight_to_fee(weight: Weight) -> Balance { + fn query_weight_to_fee(weight: frame_support::weights::Weight) -> Balance { TransactionPayment::weight_to_fee(weight) } fn query_length_to_fee(length: u32) -> Balance { diff --git a/runtime/darwinia/src/pallets/polkadot_xcm.rs b/runtime/darwinia/src/pallets/polkadot_xcm.rs index 98cb926c6..b49f28015 100644 --- a/runtime/darwinia/src/pallets/polkadot_xcm.rs +++ b/runtime/darwinia/src/pallets/polkadot_xcm.rs @@ -18,6 +18,8 @@ // darwinia use crate::*; +// polkadot +use use xcm::latest::prelude::*; // substrate use frame_support::traits::Currency; @@ -36,7 +38,7 @@ pub type LocalAssetTransactor = xcm_builder::CurrencyAdapter< >; frame_support::parameter_types! { - pub const RelayNetwork: Option = Some(xcm::latest::NetworkId::Polkadot); + pub const RelayNetwork: NetworkId = NetworkId::Polkadot; pub RelayChainOrigin: RuntimeOrigin = cumulus_pallet_xcm::Origin::Relay.into(); } /// Type for specifying how a `MultiLocation` can be converted into an `AccountId`. This is used @@ -77,7 +79,7 @@ pub type Barrier = darwinia_common_runtime::xcm_configs::DenyThenTry< darwinia_common_runtime::xcm_configs::DenyReserveTransferToRelayChain, ( xcm_builder::TakeWeightCredit, - WithComputedOrigin< + xcm_builder::WithComputedOrigin< ( xcm_builder::AllowTopLevelPaidExecutionFrom, // Parent and its exec plurality get free execution @@ -102,21 +104,21 @@ pub type Barrier = darwinia_common_runtime::xcm_configs::DenyThenTry< frame_support::parameter_types! { pub const MaxAssetsIntoHolding: u32 = 64; pub const MaxInstructions: u32 = 100; - pub AnchoringSelfReserve: xcm::latest::prelude::MultiLocation = xcm::latest::prelude::MultiLocation::new( + pub AnchoringSelfReserve: MultiLocation = MultiLocation::new( 0, - xcm::latest::prelude::X1(xcm::latest::prelude::PalletInstance(::index() as u8)) + X1(PalletInstance(::index() as u8)) ); - pub UniversalLocation: xcm::latest::prelude::InteriorMultiLocation = xcm::latest::prelude::Parachain(ParachainInfo::parachain_id().into()).into(); + pub UniversalLocation: InteriorMultiLocation = Parachain(ParachainInfo::parachain_id().into()).into(); // One XCM operation is 1_000_000_000 weight - almost certainly a conservative estimate. - pub UnitWeightCost: Weight = Weight::from_parts(1_000_000_000, 64 * 1024); + pub UnitWeightCost: frame_support::weights::Weight = frame_support::weights::Weight::from_parts(1_000_000_000, 64 * 1024); } pub struct ToTreasury; impl xcm_builder::TakeRevenue for ToTreasury { - fn take_revenue(revenue: xcm::latest::prelude::MultiAsset) { - if let xcm::latest::prelude::MultiAsset { - id: xcm::latest::prelude::Concrete(_location), - fun: xcm::latest::prelude::Fungible(amount), + fn take_revenue(revenue: MultiAsset) { + if let MultiAsset { + id: Concrete(_location), + fun: Fungible(amount), } = revenue { let treasury_account = Treasury::account_id(); @@ -164,9 +166,9 @@ impl xcm_executor::Config for XcmExecutorConfig { type AssetExchanger = (); type FeeManager = (); type MessageExporter = (); - type UniversalAliases = Nothing; + type UniversalAliases = frame_support::traits::Nothing; type CallDispatcher = RuntimeCall; - type SafeCallFilter = Everything; + type SafeCallFilter = frame_support::traits::Everything; } /// No local origins on this chain are allowed to dispatch XCM sends/executions. diff --git a/runtime/pangolin/src/lib.rs b/runtime/pangolin/src/lib.rs index 7bbbb574c..8e77ccd6a 100644 --- a/runtime/pangolin/src/lib.rs +++ b/runtime/pangolin/src/lib.rs @@ -307,7 +307,7 @@ sp_api::impl_runtime_apis! { ) -> pallet_transaction_payment::FeeDetails { TransactionPayment::query_fee_details(uxt, len) } - fn query_weight_to_fee(weight: Weight) -> Balance { + fn query_weight_to_fee(weight: frame_support::weights::Weight) -> Balance { TransactionPayment::weight_to_fee(weight) } fn query_length_to_fee(length: u32) -> Balance { @@ -330,7 +330,7 @@ sp_api::impl_runtime_apis! { ) -> pallet_transaction_payment::FeeDetails { TransactionPayment::query_call_fee_details(call, len) } - fn query_weight_to_fee(weight: Weight) -> Balance { + fn query_weight_to_fee(weight: frame_support::weights::Weight) -> Balance { TransactionPayment::weight_to_fee(weight) } fn query_length_to_fee(length: u32) -> Balance { diff --git a/runtime/pangolin/src/pallets/polkadot_xcm.rs b/runtime/pangolin/src/pallets/polkadot_xcm.rs index 0bcc91f43..bc073a7a2 100644 --- a/runtime/pangolin/src/pallets/polkadot_xcm.rs +++ b/runtime/pangolin/src/pallets/polkadot_xcm.rs @@ -18,6 +18,8 @@ // darwinia use crate::*; +// polkadot +use xcm::latest::prelude::*; // substrate use frame_support::traits::Currency; @@ -36,7 +38,7 @@ pub type LocalAssetTransactor = xcm_builder::CurrencyAdapter< >; frame_support::parameter_types! { - pub const RelayNetwork: Option = None; + pub const RelayNetwork: NetworkId = NetworkId::Rococo; pub RelayChainOrigin: RuntimeOrigin = cumulus_pallet_xcm::Origin::Relay.into(); } /// Type for specifying how a `MultiLocation` can be converted into an `AccountId`. This is used @@ -77,7 +79,7 @@ pub type Barrier = darwinia_common_runtime::xcm_configs::DenyThenTry< darwinia_common_runtime::xcm_configs::DenyReserveTransferToRelayChain, ( xcm_builder::TakeWeightCredit, - WithComputedOrigin< + xcm_builder::WithComputedOrigin< ( xcm_builder::AllowTopLevelPaidExecutionFrom, // Parent and its exec plurality get free execution @@ -102,21 +104,21 @@ pub type Barrier = darwinia_common_runtime::xcm_configs::DenyThenTry< frame_support::parameter_types! { pub const MaxAssetsIntoHolding: u32 = 64; pub const MaxInstructions: u32 = 100; - pub AnchoringSelfReserve: xcm::latest::prelude::MultiLocation = xcm::latest::prelude::MultiLocation::new( + pub AnchoringSelfReserve: MultiLocation = MultiLocation::new( 0, - xcm::latest::prelude::X1(xcm::latest::prelude::PalletInstance(::index() as u8)) + X1(PalletInstance(::index() as u8)) ); - pub UniversalLocation: xcm::latest::prelude::InteriorMultiLocation = xcm::latest::prelude::Parachain(ParachainInfo::parachain_id().into()).into(); + pub UniversalLocation: InteriorMultiLocation = Parachain(ParachainInfo::parachain_id().into()).into(); // One XCM operation is 1_000_000_000 weight - almost certainly a conservative estimate. - pub UnitWeightCost: Weight = Weight::from_parts(1_000_000_000, 64 * 1024); + pub UnitWeightCost: frame_support::weights::Weight = frame_support::weights::Weight::from_parts(1_000_000_000, 64 * 1024); } pub struct ToTreasury; impl xcm_builder::TakeRevenue for ToTreasury { - fn take_revenue(revenue: xcm::latest::prelude::MultiAsset) { - if let xcm::latest::prelude::MultiAsset { - id: xcm::latest::prelude::Concrete(_location), - fun: xcm::latest::prelude::Fungible(amount), + fn take_revenue(revenue: MultiAsset) { + if let MultiAsset { + id: Concrete(_location), + fun: Fungible(amount), } = revenue { let treasury_account = Treasury::account_id(); @@ -164,9 +166,9 @@ impl xcm_executor::Config for XcmExecutorConfig { type AssetExchanger = (); type FeeManager = (); type MessageExporter = (); - type UniversalAliases = Nothing; + type UniversalAliases = frame_support::traits::Nothing; type CallDispatcher = RuntimeCall; - type SafeCallFilter = Everything; + type SafeCallFilter = frame_support::traits::Everything; } /// No local origins on this chain are allowed to dispatch XCM sends/executions. diff --git a/runtime/pangoro/src/lib.rs b/runtime/pangoro/src/lib.rs index e4c124f00..3bf5dea25 100644 --- a/runtime/pangoro/src/lib.rs +++ b/runtime/pangoro/src/lib.rs @@ -307,7 +307,7 @@ sp_api::impl_runtime_apis! { ) -> pallet_transaction_payment::FeeDetails { TransactionPayment::query_fee_details(uxt, len) } - fn query_weight_to_fee(weight: Weight) -> Balance { + fn query_weight_to_fee(weight: frame_support::weights::Weight) -> Balance { TransactionPayment::weight_to_fee(weight) } fn query_length_to_fee(length: u32) -> Balance { @@ -330,7 +330,7 @@ sp_api::impl_runtime_apis! { ) -> pallet_transaction_payment::FeeDetails { TransactionPayment::query_call_fee_details(call, len) } - fn query_weight_to_fee(weight: Weight) -> Balance { + fn query_weight_to_fee(weight: frame_support::weights::Weight) -> Balance { TransactionPayment::weight_to_fee(weight) } fn query_length_to_fee(length: u32) -> Balance { diff --git a/runtime/pangoro/src/pallets/polkadot_xcm.rs b/runtime/pangoro/src/pallets/polkadot_xcm.rs index 0bcc91f43..e3c9969ae 100644 --- a/runtime/pangoro/src/pallets/polkadot_xcm.rs +++ b/runtime/pangoro/src/pallets/polkadot_xcm.rs @@ -18,6 +18,8 @@ // darwinia use crate::*; +// polkadot +use xcm::latest::prelude::*; // substrate use frame_support::traits::Currency; @@ -36,7 +38,7 @@ pub type LocalAssetTransactor = xcm_builder::CurrencyAdapter< >; frame_support::parameter_types! { - pub const RelayNetwork: Option = None; + pub const RelayNetwork: NetworkId = NetworkId::Westend; pub RelayChainOrigin: RuntimeOrigin = cumulus_pallet_xcm::Origin::Relay.into(); } /// Type for specifying how a `MultiLocation` can be converted into an `AccountId`. This is used @@ -77,7 +79,7 @@ pub type Barrier = darwinia_common_runtime::xcm_configs::DenyThenTry< darwinia_common_runtime::xcm_configs::DenyReserveTransferToRelayChain, ( xcm_builder::TakeWeightCredit, - WithComputedOrigin< + xcm_builder::WithComputedOrigin< ( xcm_builder::AllowTopLevelPaidExecutionFrom, // Parent and its exec plurality get free execution @@ -102,21 +104,21 @@ pub type Barrier = darwinia_common_runtime::xcm_configs::DenyThenTry< frame_support::parameter_types! { pub const MaxAssetsIntoHolding: u32 = 64; pub const MaxInstructions: u32 = 100; - pub AnchoringSelfReserve: xcm::latest::prelude::MultiLocation = xcm::latest::prelude::MultiLocation::new( + pub AnchoringSelfReserve: MultiLocation = MultiLocation::new( 0, - xcm::latest::prelude::X1(xcm::latest::prelude::PalletInstance(::index() as u8)) + X1(PalletInstance(::index() as u8)) ); - pub UniversalLocation: xcm::latest::prelude::InteriorMultiLocation = xcm::latest::prelude::Parachain(ParachainInfo::parachain_id().into()).into(); + pub UniversalLocation: InteriorMultiLocation = Parachain(ParachainInfo::parachain_id().into()).into(); // One XCM operation is 1_000_000_000 weight - almost certainly a conservative estimate. - pub UnitWeightCost: Weight = Weight::from_parts(1_000_000_000, 64 * 1024); + pub UnitWeightCost: frame_support::weights::Weight = frame_support::weights::Weight::from_parts(1_000_000_000, 64 * 1024); } pub struct ToTreasury; impl xcm_builder::TakeRevenue for ToTreasury { - fn take_revenue(revenue: xcm::latest::prelude::MultiAsset) { - if let xcm::latest::prelude::MultiAsset { - id: xcm::latest::prelude::Concrete(_location), - fun: xcm::latest::prelude::Fungible(amount), + fn take_revenue(revenue: MultiAsset) { + if let MultiAsset { + id: Concrete(_location), + fun: Fungible(amount), } = revenue { let treasury_account = Treasury::account_id(); @@ -164,9 +166,9 @@ impl xcm_executor::Config for XcmExecutorConfig { type AssetExchanger = (); type FeeManager = (); type MessageExporter = (); - type UniversalAliases = Nothing; + type UniversalAliases = frame_support::traits::Nothing; type CallDispatcher = RuntimeCall; - type SafeCallFilter = Everything; + type SafeCallFilter = frame_support::traits::Everything; } /// No local origins on this chain are allowed to dispatch XCM sends/executions. From d36bd4dbb0b9a98cd8264a1243e27907f878b6ed Mon Sep 17 00:00:00 2001 From: Guantong Date: Thu, 2 Mar 2023 15:33:39 +0800 Subject: [PATCH 177/189] Fix compilation done --- node/src/chain_spec/mod.rs | 1 + node/src/service/mod.rs | 2 +- pallet/message-transact/src/lib.rs | 9 +++++++-- runtime/darwinia/src/lib.rs | 2 +- runtime/darwinia/src/pallets/polkadot_xcm.rs | 2 +- 5 files changed, 11 insertions(+), 5 deletions(-) diff --git a/node/src/chain_spec/mod.rs b/node/src/chain_spec/mod.rs index 8855326f5..95ddfc64a 100644 --- a/node/src/chain_spec/mod.rs +++ b/node/src/chain_spec/mod.rs @@ -125,6 +125,7 @@ fn get_from_seed(seed: &str) -> ::Public .public() } +#[allow(dead_code)] fn load_config(name: &'static str) -> GenericChainSpec where E: DeserializeOwned, diff --git a/node/src/service/mod.rs b/node/src/service/mod.rs index 6aa4005a4..655f7d3df 100644 --- a/node/src/service/mod.rs +++ b/node/src/service/mod.rs @@ -419,7 +419,7 @@ where // Here you can check whether the hardware meets your chains' requirements. Putting a link // in there and swapping out the requirements for your own are probably a good idea. The // requirements for a para-chain are dictated by its relay-chain. - if !SUBSTRATE_REFERENCE_HARDWARE.check_hardware(&hwbench) && validator { + if !frame_benchmarking_cli::SUBSTRATE_REFERENCE_HARDWARE.check_hardware(&hwbench) && validator { log::warn!( "⚠️ The hardware does not meet the minimal requirements for role 'Authority'." ); diff --git a/pallet/message-transact/src/lib.rs b/pallet/message-transact/src/lib.rs index b5463f6bf..ceb44aad0 100644 --- a/pallet/message-transact/src/lib.rs +++ b/pallet/message-transact/src/lib.rs @@ -38,6 +38,7 @@ use pallet_evm::{FeeCalculator, GasWeightMapping}; use frame_support::{traits::EnsureOrigin, PalletError, RuntimeDebug}; use sp_core::{H160, U256}; use sp_std::boxed::Box; +use sp_runtime::traits::BadOrigin; pub use pallet::*; @@ -62,6 +63,10 @@ impl> + From> EnsureOrigin { type Success = H160; + fn ensure_origin(o: O) -> Result { + Self::try_origin(o).map_err(|_| BadOrigin) + } + fn try_origin(o: O) -> Result { o.into().map(|o| match o { LcmpEthOrigin::MessageTransact(id) => id, @@ -69,8 +74,8 @@ impl> + From> EnsureOrigin } #[cfg(feature = "runtime-benchmarks")] - fn successful_origin() -> O { - O::from(LcmpEthOrigin::MessageTransact(Default::default())) + fn try_successful_origin() -> Result { + Ok(O::from(LcmpEthOrigin::MessageTransact(Default::default()))) } } diff --git a/runtime/darwinia/src/lib.rs b/runtime/darwinia/src/lib.rs index 70f99fcf0..bc22f23b1 100644 --- a/runtime/darwinia/src/lib.rs +++ b/runtime/darwinia/src/lib.rs @@ -328,7 +328,7 @@ sp_api::impl_runtime_apis! { ) -> pallet_transaction_payment::FeeDetails { TransactionPayment::query_call_fee_details(call, len) } - fn query_weight_to_fee(weight: Weight) -> Balance { + fn query_weight_to_fee(weight: frame_support::weights::Weight) -> Balance { TransactionPayment::weight_to_fee(weight) } fn query_length_to_fee(length: u32) -> Balance { diff --git a/runtime/darwinia/src/pallets/polkadot_xcm.rs b/runtime/darwinia/src/pallets/polkadot_xcm.rs index b49f28015..b19c9b1e7 100644 --- a/runtime/darwinia/src/pallets/polkadot_xcm.rs +++ b/runtime/darwinia/src/pallets/polkadot_xcm.rs @@ -19,7 +19,7 @@ // darwinia use crate::*; // polkadot -use use xcm::latest::prelude::*; +use xcm::latest::prelude::*; // substrate use frame_support::traits::Currency; From 731a4e6d41576d4741834679494f6d05033da993 Mon Sep 17 00:00:00 2001 From: Guantong Date: Thu, 2 Mar 2023 15:54:11 +0800 Subject: [PATCH 178/189] Fix compilation with benchmark --- Cargo.lock | 38 ++++++++++---------- pallet/message-transact/Cargo.toml | 3 ++ runtime/crab/Cargo.toml | 1 + runtime/crab/src/pallets/polkadot_xcm.rs | 2 +- runtime/darwinia/Cargo.toml | 1 + runtime/darwinia/src/pallets/polkadot_xcm.rs | 2 +- runtime/pangolin/Cargo.toml | 1 + runtime/pangolin/src/pallets/polkadot_xcm.rs | 2 +- runtime/pangoro/Cargo.toml | 1 + runtime/pangoro/src/pallets/polkadot_xcm.rs | 2 +- 10 files changed, 30 insertions(+), 23 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ac078f8d8..0f956a28b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3476,7 +3476,7 @@ dependencies = [ [[package]] name = "fc-cli" version = "1.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#3da6241e6cb992bbdbf01f09a7c6add48df1b34d" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#28c1f8a80152cabdf98afe58dc37fa963682d978" dependencies = [ "clap", "ethereum-types 0.14.1", @@ -3494,7 +3494,7 @@ dependencies = [ [[package]] name = "fc-consensus" version = "2.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#3da6241e6cb992bbdbf01f09a7c6add48df1b34d" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#28c1f8a80152cabdf98afe58dc37fa963682d978" dependencies = [ "async-trait", "fc-db", @@ -3513,7 +3513,7 @@ dependencies = [ [[package]] name = "fc-db" version = "2.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#3da6241e6cb992bbdbf01f09a7c6add48df1b34d" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#28c1f8a80152cabdf98afe58dc37fa963682d978" dependencies = [ "fp-storage", "kvdb-rocksdb", @@ -3532,7 +3532,7 @@ dependencies = [ [[package]] name = "fc-mapping-sync" version = "2.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#3da6241e6cb992bbdbf01f09a7c6add48df1b34d" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#28c1f8a80152cabdf98afe58dc37fa963682d978" dependencies = [ "fc-db", "fp-consensus", @@ -3549,7 +3549,7 @@ dependencies = [ [[package]] name = "fc-rpc" version = "2.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#3da6241e6cb992bbdbf01f09a7c6add48df1b34d" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#28c1f8a80152cabdf98afe58dc37fa963682d978" dependencies = [ "ethereum", "ethereum-types 0.14.1", @@ -3591,7 +3591,7 @@ dependencies = [ [[package]] name = "fc-rpc-core" version = "1.1.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#3da6241e6cb992bbdbf01f09a7c6add48df1b34d" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#28c1f8a80152cabdf98afe58dc37fa963682d978" dependencies = [ "ethereum", "ethereum-types 0.14.1", @@ -3755,7 +3755,7 @@ dependencies = [ [[package]] name = "fp-consensus" version = "2.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#3da6241e6cb992bbdbf01f09a7c6add48df1b34d" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#28c1f8a80152cabdf98afe58dc37fa963682d978" dependencies = [ "ethereum", "parity-scale-codec", @@ -3767,7 +3767,7 @@ dependencies = [ [[package]] name = "fp-ethereum" version = "1.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#3da6241e6cb992bbdbf01f09a7c6add48df1b34d" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#28c1f8a80152cabdf98afe58dc37fa963682d978" dependencies = [ "ethereum", "ethereum-types 0.14.1", @@ -3781,7 +3781,7 @@ dependencies = [ [[package]] name = "fp-evm" version = "3.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#3da6241e6cb992bbdbf01f09a7c6add48df1b34d" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#28c1f8a80152cabdf98afe58dc37fa963682d978" dependencies = [ "evm", "frame-support", @@ -3795,7 +3795,7 @@ dependencies = [ [[package]] name = "fp-rpc" version = "3.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#3da6241e6cb992bbdbf01f09a7c6add48df1b34d" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#28c1f8a80152cabdf98afe58dc37fa963682d978" dependencies = [ "ethereum", "ethereum-types 0.14.1", @@ -3811,7 +3811,7 @@ dependencies = [ [[package]] name = "fp-self-contained" version = "1.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#3da6241e6cb992bbdbf01f09a7c6add48df1b34d" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#28c1f8a80152cabdf98afe58dc37fa963682d978" dependencies = [ "frame-support", "parity-scale-codec", @@ -3823,7 +3823,7 @@ dependencies = [ [[package]] name = "fp-storage" version = "2.0.0" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#3da6241e6cb992bbdbf01f09a7c6add48df1b34d" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#28c1f8a80152cabdf98afe58dc37fa963682d978" dependencies = [ "parity-scale-codec", "serde", @@ -7178,7 +7178,7 @@ dependencies = [ [[package]] name = "pallet-ethereum" version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#3da6241e6cb992bbdbf01f09a7c6add48df1b34d" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#28c1f8a80152cabdf98afe58dc37fa963682d978" dependencies = [ "ethereum", "ethereum-types 0.14.1", @@ -7204,7 +7204,7 @@ dependencies = [ [[package]] name = "pallet-evm" version = "6.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#3da6241e6cb992bbdbf01f09a7c6add48df1b34d" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#28c1f8a80152cabdf98afe58dc37fa963682d978" dependencies = [ "environmental", "evm", @@ -7228,7 +7228,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-blake2" version = "2.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#3da6241e6cb992bbdbf01f09a7c6add48df1b34d" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#28c1f8a80152cabdf98afe58dc37fa963682d978" dependencies = [ "fp-evm", ] @@ -7236,7 +7236,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-bn128" version = "2.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#3da6241e6cb992bbdbf01f09a7c6add48df1b34d" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#28c1f8a80152cabdf98afe58dc37fa963682d978" dependencies = [ "fp-evm", "sp-core", @@ -7246,7 +7246,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-dispatch" version = "2.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#3da6241e6cb992bbdbf01f09a7c6add48df1b34d" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#28c1f8a80152cabdf98afe58dc37fa963682d978" dependencies = [ "fp-evm", "frame-support", @@ -7256,7 +7256,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-modexp" version = "2.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#3da6241e6cb992bbdbf01f09a7c6add48df1b34d" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#28c1f8a80152cabdf98afe58dc37fa963682d978" dependencies = [ "fp-evm", "num", @@ -7265,7 +7265,7 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-simple" version = "2.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#3da6241e6cb992bbdbf01f09a7c6add48df1b34d" +source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#28c1f8a80152cabdf98afe58dc37fa963682d978" dependencies = [ "fp-evm", "ripemd", diff --git a/pallet/message-transact/Cargo.toml b/pallet/message-transact/Cargo.toml index 4dd967889..7e3788b36 100644 --- a/pallet/message-transact/Cargo.toml +++ b/pallet/message-transact/Cargo.toml @@ -49,6 +49,9 @@ sp-io = { workspace = true } [features] default = ["std"] + +runtime-benchmarks = [] + std = [ # crates.io "codec/std", diff --git a/runtime/crab/Cargo.toml b/runtime/crab/Cargo.toml index e3839b125..4c76c01bb 100644 --- a/runtime/crab/Cargo.toml +++ b/runtime/crab/Cargo.toml @@ -260,6 +260,7 @@ runtime-benchmarks = [ # darwinia "darwinia-common-runtime/runtime-benchmarks", "darwinia-deposit/runtime-benchmarks", + "darwinia-message-transact/runtime-benchmarks", # darwinia-messages-substrate "bridge-runtime-common/runtime-benchmarks", diff --git a/runtime/crab/src/pallets/polkadot_xcm.rs b/runtime/crab/src/pallets/polkadot_xcm.rs index 110e976fd..ef2a250fe 100644 --- a/runtime/crab/src/pallets/polkadot_xcm.rs +++ b/runtime/crab/src/pallets/polkadot_xcm.rs @@ -182,7 +182,7 @@ pub type XcmRouter = ( ); #[cfg(feature = "runtime-benchmarks")] -parameter_types! { +frame_support::parameter_types! { pub ReachableDest: Option = Some(Parent.into()); } diff --git a/runtime/darwinia/Cargo.toml b/runtime/darwinia/Cargo.toml index 80f461988..59fcd8587 100644 --- a/runtime/darwinia/Cargo.toml +++ b/runtime/darwinia/Cargo.toml @@ -261,6 +261,7 @@ runtime-benchmarks = [ # darwinia "darwinia-common-runtime/runtime-benchmarks", "darwinia-deposit/runtime-benchmarks", + "darwinia-message-transact/runtime-benchmarks", # darwinia-messages-substrate "bridge-runtime-common/runtime-benchmarks", diff --git a/runtime/darwinia/src/pallets/polkadot_xcm.rs b/runtime/darwinia/src/pallets/polkadot_xcm.rs index b19c9b1e7..3cd332cbf 100644 --- a/runtime/darwinia/src/pallets/polkadot_xcm.rs +++ b/runtime/darwinia/src/pallets/polkadot_xcm.rs @@ -184,7 +184,7 @@ pub type XcmRouter = ( ); #[cfg(feature = "runtime-benchmarks")] -parameter_types! { +frame_support::parameter_types! { pub ReachableDest: Option = Some(Parent.into()); } diff --git a/runtime/pangolin/Cargo.toml b/runtime/pangolin/Cargo.toml index 7f02d681f..eb969bf6a 100644 --- a/runtime/pangolin/Cargo.toml +++ b/runtime/pangolin/Cargo.toml @@ -258,6 +258,7 @@ runtime-benchmarks = [ # darwinia "darwinia-common-runtime/runtime-benchmarks", "darwinia-deposit/runtime-benchmarks", + "darwinia-message-transact/runtime-benchmarks", # darwinia-messages-substrate "bridge-runtime-common/runtime-benchmarks", diff --git a/runtime/pangolin/src/pallets/polkadot_xcm.rs b/runtime/pangolin/src/pallets/polkadot_xcm.rs index bc073a7a2..29b6d2a15 100644 --- a/runtime/pangolin/src/pallets/polkadot_xcm.rs +++ b/runtime/pangolin/src/pallets/polkadot_xcm.rs @@ -184,7 +184,7 @@ pub type XcmRouter = ( ); #[cfg(feature = "runtime-benchmarks")] -parameter_types! { +frame_support::parameter_types! { pub ReachableDest: Option = Some(Parent.into()); } diff --git a/runtime/pangoro/Cargo.toml b/runtime/pangoro/Cargo.toml index ce67499b2..b14d4d592 100644 --- a/runtime/pangoro/Cargo.toml +++ b/runtime/pangoro/Cargo.toml @@ -259,6 +259,7 @@ runtime-benchmarks = [ # darwinia "darwinia-common-runtime/runtime-benchmarks", "darwinia-deposit/runtime-benchmarks", + "darwinia-message-transact/runtime-benchmarks", # darwinia-messages-substrate "bridge-runtime-common/runtime-benchmarks", diff --git a/runtime/pangoro/src/pallets/polkadot_xcm.rs b/runtime/pangoro/src/pallets/polkadot_xcm.rs index e3c9969ae..76299faee 100644 --- a/runtime/pangoro/src/pallets/polkadot_xcm.rs +++ b/runtime/pangoro/src/pallets/polkadot_xcm.rs @@ -184,7 +184,7 @@ pub type XcmRouter = ( ); #[cfg(feature = "runtime-benchmarks")] -parameter_types! { +frame_support::parameter_types! { pub ReachableDest: Option = Some(Parent.into()); } From b3b86e241a18cfdca765fc9f3860273426cf4c4f Mon Sep 17 00:00:00 2001 From: Guantong Date: Thu, 2 Mar 2023 16:10:58 +0800 Subject: [PATCH 179/189] Replace prepare branch --- Cargo.lock | 28 ++++++++++++++-------------- Cargo.toml | 22 +++++++++++----------- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0f956a28b..1d80760a4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -738,7 +738,7 @@ dependencies = [ [[package]] name = "bp-darwinia-core" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=prepare-polkadot-v0.9.38#13267a91a97a46fcf02ce137272331733b88e512" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.38#b5bf1f59cc9ff8e38f9d1baa65b2dfca68980f0a" dependencies = [ "account", "bp-messages", @@ -755,7 +755,7 @@ dependencies = [ [[package]] name = "bp-header-chain" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=prepare-polkadot-v0.9.38#13267a91a97a46fcf02ce137272331733b88e512" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.38#b5bf1f59cc9ff8e38f9d1baa65b2dfca68980f0a" dependencies = [ "bp-runtime", "finality-grandpa", @@ -772,7 +772,7 @@ dependencies = [ [[package]] name = "bp-message-dispatch" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=prepare-polkadot-v0.9.38#13267a91a97a46fcf02ce137272331733b88e512" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.38#b5bf1f59cc9ff8e38f9d1baa65b2dfca68980f0a" dependencies = [ "bp-runtime", "frame-support", @@ -785,7 +785,7 @@ dependencies = [ [[package]] name = "bp-messages" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=prepare-polkadot-v0.9.38#13267a91a97a46fcf02ce137272331733b88e512" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.38#b5bf1f59cc9ff8e38f9d1baa65b2dfca68980f0a" dependencies = [ "bitvec", "bp-runtime", @@ -802,7 +802,7 @@ dependencies = [ [[package]] name = "bp-parachains" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=prepare-polkadot-v0.9.38#13267a91a97a46fcf02ce137272331733b88e512" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.38#b5bf1f59cc9ff8e38f9d1baa65b2dfca68980f0a" dependencies = [ "bp-polkadot-core", "bp-runtime", @@ -815,7 +815,7 @@ dependencies = [ [[package]] name = "bp-polkadot-core" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=prepare-polkadot-v0.9.38#13267a91a97a46fcf02ce137272331733b88e512" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.38#b5bf1f59cc9ff8e38f9d1baa65b2dfca68980f0a" dependencies = [ "bp-messages", "bp-runtime", @@ -834,7 +834,7 @@ dependencies = [ [[package]] name = "bp-runtime" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=prepare-polkadot-v0.9.38#13267a91a97a46fcf02ce137272331733b88e512" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.38#b5bf1f59cc9ff8e38f9d1baa65b2dfca68980f0a" dependencies = [ "frame-support", "frame-system", @@ -855,7 +855,7 @@ dependencies = [ [[package]] name = "bp-test-utils" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=prepare-polkadot-v0.9.38#13267a91a97a46fcf02ce137272331733b88e512" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.38#b5bf1f59cc9ff8e38f9d1baa65b2dfca68980f0a" dependencies = [ "bp-header-chain", "ed25519-dalek", @@ -870,7 +870,7 @@ dependencies = [ [[package]] name = "bridge-runtime-common" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=prepare-polkadot-v0.9.38#13267a91a97a46fcf02ce137272331733b88e512" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.38#b5bf1f59cc9ff8e38f9d1baa65b2dfca68980f0a" dependencies = [ "bp-header-chain", "bp-message-dispatch", @@ -6973,7 +6973,7 @@ dependencies = [ [[package]] name = "pallet-bridge-dispatch" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=prepare-polkadot-v0.9.38#13267a91a97a46fcf02ce137272331733b88e512" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.38#b5bf1f59cc9ff8e38f9d1baa65b2dfca68980f0a" dependencies = [ "bp-message-dispatch", "bp-runtime", @@ -6989,7 +6989,7 @@ dependencies = [ [[package]] name = "pallet-bridge-grandpa" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=prepare-polkadot-v0.9.38#13267a91a97a46fcf02ce137272331733b88e512" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.38#b5bf1f59cc9ff8e38f9d1baa65b2dfca68980f0a" dependencies = [ "bp-header-chain", "bp-runtime", @@ -7011,7 +7011,7 @@ dependencies = [ [[package]] name = "pallet-bridge-messages" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=prepare-polkadot-v0.9.38#13267a91a97a46fcf02ce137272331733b88e512" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.38#b5bf1f59cc9ff8e38f9d1baa65b2dfca68980f0a" dependencies = [ "bitvec", "bp-message-dispatch", @@ -7032,7 +7032,7 @@ dependencies = [ [[package]] name = "pallet-bridge-parachains" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=prepare-polkadot-v0.9.38#13267a91a97a46fcf02ce137272331733b88e512" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.38#b5bf1f59cc9ff8e38f9d1baa65b2dfca68980f0a" dependencies = [ "bp-parachains", "bp-polkadot-core", @@ -7293,7 +7293,7 @@ dependencies = [ [[package]] name = "pallet-fee-market" version = "0.1.0" -source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=prepare-polkadot-v0.9.38#13267a91a97a46fcf02ce137272331733b88e512" +source = "git+https://github.com/darwinia-network/darwinia-messages-substrate?branch=polkadot-v0.9.38#b5bf1f59cc9ff8e38f9d1baa65b2dfca68980f0a" dependencies = [ "bp-messages", "bp-runtime", diff --git a/Cargo.toml b/Cargo.toml index 7a51e4717..8f3d7b15b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -69,17 +69,17 @@ pangolin-runtime = { path = "runtime/pangolin" } pangoro-runtime = { path = "runtime/pangoro" } # darwinia-messages-substrate -bp-darwinia-core = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "prepare-polkadot-v0.9.38" } -bp-message-dispatch = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "prepare-polkadot-v0.9.38" } -bp-messages = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "prepare-polkadot-v0.9.38" } -bp-polkadot-core = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "prepare-polkadot-v0.9.38" } -bp-runtime = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "prepare-polkadot-v0.9.38" } -bridge-runtime-common = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "prepare-polkadot-v0.9.38" } -pallet-bridge-dispatch = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "prepare-polkadot-v0.9.38" } -pallet-bridge-grandpa = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "prepare-polkadot-v0.9.38" } -pallet-bridge-messages = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "prepare-polkadot-v0.9.38" } -pallet-bridge-parachains = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "prepare-polkadot-v0.9.38" } -pallet-fee-market = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "prepare-polkadot-v0.9.38" } +bp-darwinia-core = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.38" } +bp-message-dispatch = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.38" } +bp-messages = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.38" } +bp-polkadot-core = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.38" } +bp-runtime = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.38" } +bridge-runtime-common = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.38" } +pallet-bridge-dispatch = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.38" } +pallet-bridge-grandpa = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.38" } +pallet-bridge-messages = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.38" } +pallet-bridge-parachains = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.38" } +pallet-fee-market = { default-features = false, git = "https://github.com/darwinia-network/darwinia-messages-substrate", branch = "polkadot-v0.9.38" } # frontier fc-cli = { git = "https://github.com/darwinia-network/frontier", branch = "polkadot-v0.9.38" } From 0d4adbad8d006be7f893cf4ef6c47488d0d48daa Mon Sep 17 00:00:00 2001 From: Guantong Date: Thu, 2 Mar 2023 16:44:40 +0800 Subject: [PATCH 180/189] Format --- node/src/service/mod.rs | 4 +- pallet/message-transact/src/lib.rs | 4 +- runtime/crab/src/pallets/polkadot_xcm.rs | 6 +-- runtime/crab/src/pallets/xcmp_queue.rs | 2 +- runtime/darwinia/src/pallets/polkadot_xcm.rs | 46 +++++++++----------- runtime/darwinia/src/pallets/xcmp_queue.rs | 2 +- runtime/pangolin/src/pallets/polkadot_xcm.rs | 46 +++++++++----------- runtime/pangolin/src/pallets/xcmp_queue.rs | 2 +- runtime/pangoro/src/pallets/polkadot_xcm.rs | 46 +++++++++----------- runtime/pangoro/src/pallets/xcmp_queue.rs | 2 +- 10 files changed, 73 insertions(+), 87 deletions(-) diff --git a/node/src/service/mod.rs b/node/src/service/mod.rs index 655f7d3df..ae6eaf745 100644 --- a/node/src/service/mod.rs +++ b/node/src/service/mod.rs @@ -419,7 +419,9 @@ where // Here you can check whether the hardware meets your chains' requirements. Putting a link // in there and swapping out the requirements for your own are probably a good idea. The // requirements for a para-chain are dictated by its relay-chain. - if !frame_benchmarking_cli::SUBSTRATE_REFERENCE_HARDWARE.check_hardware(&hwbench) && validator { + if !frame_benchmarking_cli::SUBSTRATE_REFERENCE_HARDWARE.check_hardware(&hwbench) + && validator + { log::warn!( "⚠️ The hardware does not meet the minimal requirements for role 'Authority'." ); diff --git a/pallet/message-transact/src/lib.rs b/pallet/message-transact/src/lib.rs index ceb44aad0..32dae2532 100644 --- a/pallet/message-transact/src/lib.rs +++ b/pallet/message-transact/src/lib.rs @@ -37,8 +37,8 @@ use pallet_evm::{FeeCalculator, GasWeightMapping}; // substrate use frame_support::{traits::EnsureOrigin, PalletError, RuntimeDebug}; use sp_core::{H160, U256}; -use sp_std::boxed::Box; use sp_runtime::traits::BadOrigin; +use sp_std::boxed::Box; pub use pallet::*; @@ -75,7 +75,7 @@ impl> + From> EnsureOrigin #[cfg(feature = "runtime-benchmarks")] fn try_successful_origin() -> Result { - Ok(O::from(LcmpEthOrigin::MessageTransact(Default::default()))) + Ok(O::from(LcmpEthOrigin::MessageTransact(Default::default()))) } } diff --git a/runtime/crab/src/pallets/polkadot_xcm.rs b/runtime/crab/src/pallets/polkadot_xcm.rs index ef2a250fe..dacb2808b 100644 --- a/runtime/crab/src/pallets/polkadot_xcm.rs +++ b/runtime/crab/src/pallets/polkadot_xcm.rs @@ -114,11 +114,7 @@ frame_support::parameter_types! { pub struct ToTreasury; impl xcm_builder::TakeRevenue for ToTreasury { fn take_revenue(revenue: MultiAsset) { - if let MultiAsset { - id: Concrete(_location), - fun: Fungible(amount), - } = revenue - { + if let MultiAsset { id: Concrete(_location), fun: Fungible(amount) } = revenue { let treasury_account = Treasury::account_id(); let _ = Balances::deposit_creating(&treasury_account, amount); diff --git a/runtime/crab/src/pallets/xcmp_queue.rs b/runtime/crab/src/pallets/xcmp_queue.rs index 9931ff3cc..5b07d20c4 100644 --- a/runtime/crab/src/pallets/xcmp_queue.rs +++ b/runtime/crab/src/pallets/xcmp_queue.rs @@ -24,9 +24,9 @@ impl cumulus_pallet_xcmp_queue::Config for Runtime { type ControllerOrigin = frame_system::EnsureRoot; type ControllerOriginConverter = XcmOriginToTransactDispatchOrigin; type ExecuteOverweightOrigin = frame_system::EnsureRoot; + type PriceForSiblingDelivery = (); type RuntimeEvent = RuntimeEvent; type VersionWrapper = (); type WeightInfo = weights::cumulus_pallet_xcmp_queue::WeightInfo; type XcmExecutor = xcm_executor::XcmExecutor; - type PriceForSiblingDelivery = (); } diff --git a/runtime/darwinia/src/pallets/polkadot_xcm.rs b/runtime/darwinia/src/pallets/polkadot_xcm.rs index 3cd332cbf..b0b688a4b 100644 --- a/runtime/darwinia/src/pallets/polkadot_xcm.rs +++ b/runtime/darwinia/src/pallets/polkadot_xcm.rs @@ -116,11 +116,7 @@ frame_support::parameter_types! { pub struct ToTreasury; impl xcm_builder::TakeRevenue for ToTreasury { fn take_revenue(revenue: MultiAsset) { - if let MultiAsset { - id: Concrete(_location), - fun: Fungible(amount), - } = revenue - { + if let MultiAsset { id: Concrete(_location), fun: Fungible(amount) } = revenue { let treasury_account = Treasury::account_id(); let _ = Balances::deposit_creating(&treasury_account, amount); @@ -135,17 +131,23 @@ impl xcm_builder::TakeRevenue for ToTreasury { pub struct XcmExecutorConfig; impl xcm_executor::Config for XcmExecutorConfig { type AssetClaims = PolkadotXcm; + type AssetExchanger = (); + type AssetLocker = (); // How to withdraw and deposit an asset. type AssetTransactor = LocalAssetTransactor; type AssetTrap = PolkadotXcm; type Barrier = Barrier; + type CallDispatcher = RuntimeCall; + type FeeManager = (); type IsReserve = xcm_builder::NativeAsset; type IsTeleporter = (); - // Teleporting is disabled. - type UniversalLocation = UniversalLocation; + type MaxAssetsIntoHolding = MaxAssetsIntoHolding; + type MessageExporter = (); type OriginConverter = XcmOriginToTransactDispatchOrigin; + type PalletInstancesInfo = AllPalletsWithSystem; type ResponseHandler = PolkadotXcm; type RuntimeCall = RuntimeCall; + type SafeCallFilter = frame_support::traits::Everything; type SubscriptionService = PolkadotXcm; type Trader = xcm_configs::LocalAssetTrader< frame_support::weights::ConstantMultiplier< @@ -158,17 +160,11 @@ impl xcm_executor::Config for XcmExecutorConfig { DealWithFees, ToTreasury, >; + type UniversalAliases = frame_support::traits::Nothing; + // Teleporting is disabled. + type UniversalLocation = UniversalLocation; type Weigher = xcm_builder::FixedWeightBounds; type XcmSender = XcmRouter; - type PalletInstancesInfo = AllPalletsWithSystem; - type MaxAssetsIntoHolding = MaxAssetsIntoHolding; - type AssetLocker = (); - type AssetExchanger = (); - type FeeManager = (); - type MessageExporter = (); - type UniversalAliases = frame_support::traits::Nothing; - type CallDispatcher = RuntimeCall; - type SafeCallFilter = frame_support::traits::Everything; } /// No local origins on this chain are allowed to dispatch XCM sends/executions. @@ -191,13 +187,21 @@ frame_support::parameter_types! { impl pallet_xcm::Config for Runtime { // ^ Override for AdvertisedXcmVersion default type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion; + type Currency = Balances; + type CurrencyMatcher = (); type ExecuteXcmOrigin = xcm_builder::EnsureXcmOrigin; - type UniversalLocation = UniversalLocation; + type MaxLockers = ConstU32<8>; + #[cfg(feature = "runtime-benchmarks")] + type ReachableDest = ReachableDest; type RuntimeCall = RuntimeCall; type RuntimeEvent = RuntimeEvent; type RuntimeOrigin = RuntimeOrigin; type SendXcmOrigin = xcm_builder::EnsureXcmOrigin; + type SovereignAccountOf = LocationToAccountId; + type TrustedLockers = (); + type UniversalLocation = UniversalLocation; type Weigher = xcm_builder::FixedWeightBounds; + type WeightInfo = pallet_xcm::TestWeightInfo; type XcmExecuteFilter = frame_support::traits::Everything; type XcmExecutor = xcm_executor::XcmExecutor; type XcmReserveTransferFilter = frame_support::traits::Everything; @@ -205,14 +209,6 @@ impl pallet_xcm::Config for Runtime { type XcmTeleportFilter = frame_support::traits::Nothing; const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100; - type Currency = Balances; - type CurrencyMatcher = (); - type TrustedLockers = (); - type SovereignAccountOf = LocationToAccountId; - type MaxLockers = ConstU32<8>; - type WeightInfo = pallet_xcm::TestWeightInfo; - #[cfg(feature = "runtime-benchmarks")] - type ReachableDest = ReachableDest; } impl cumulus_pallet_xcm::Config for Runtime { diff --git a/runtime/darwinia/src/pallets/xcmp_queue.rs b/runtime/darwinia/src/pallets/xcmp_queue.rs index 9931ff3cc..5b07d20c4 100644 --- a/runtime/darwinia/src/pallets/xcmp_queue.rs +++ b/runtime/darwinia/src/pallets/xcmp_queue.rs @@ -24,9 +24,9 @@ impl cumulus_pallet_xcmp_queue::Config for Runtime { type ControllerOrigin = frame_system::EnsureRoot; type ControllerOriginConverter = XcmOriginToTransactDispatchOrigin; type ExecuteOverweightOrigin = frame_system::EnsureRoot; + type PriceForSiblingDelivery = (); type RuntimeEvent = RuntimeEvent; type VersionWrapper = (); type WeightInfo = weights::cumulus_pallet_xcmp_queue::WeightInfo; type XcmExecutor = xcm_executor::XcmExecutor; - type PriceForSiblingDelivery = (); } diff --git a/runtime/pangolin/src/pallets/polkadot_xcm.rs b/runtime/pangolin/src/pallets/polkadot_xcm.rs index 29b6d2a15..b95d6c7d9 100644 --- a/runtime/pangolin/src/pallets/polkadot_xcm.rs +++ b/runtime/pangolin/src/pallets/polkadot_xcm.rs @@ -116,11 +116,7 @@ frame_support::parameter_types! { pub struct ToTreasury; impl xcm_builder::TakeRevenue for ToTreasury { fn take_revenue(revenue: MultiAsset) { - if let MultiAsset { - id: Concrete(_location), - fun: Fungible(amount), - } = revenue - { + if let MultiAsset { id: Concrete(_location), fun: Fungible(amount) } = revenue { let treasury_account = Treasury::account_id(); let _ = Balances::deposit_creating(&treasury_account, amount); @@ -135,17 +131,23 @@ impl xcm_builder::TakeRevenue for ToTreasury { pub struct XcmExecutorConfig; impl xcm_executor::Config for XcmExecutorConfig { type AssetClaims = PolkadotXcm; + type AssetExchanger = (); + type AssetLocker = (); // How to withdraw and deposit an asset. type AssetTransactor = LocalAssetTransactor; type AssetTrap = PolkadotXcm; type Barrier = Barrier; + type CallDispatcher = RuntimeCall; + type FeeManager = (); type IsReserve = xcm_builder::NativeAsset; type IsTeleporter = (); - // Teleporting is disabled. - type UniversalLocation = UniversalLocation; + type MaxAssetsIntoHolding = MaxAssetsIntoHolding; + type MessageExporter = (); type OriginConverter = XcmOriginToTransactDispatchOrigin; + type PalletInstancesInfo = AllPalletsWithSystem; type ResponseHandler = PolkadotXcm; type RuntimeCall = RuntimeCall; + type SafeCallFilter = frame_support::traits::Everything; type SubscriptionService = PolkadotXcm; type Trader = xcm_configs::LocalAssetTrader< frame_support::weights::ConstantMultiplier< @@ -158,17 +160,11 @@ impl xcm_executor::Config for XcmExecutorConfig { DealWithFees, ToTreasury, >; + type UniversalAliases = frame_support::traits::Nothing; + // Teleporting is disabled. + type UniversalLocation = UniversalLocation; type Weigher = xcm_builder::FixedWeightBounds; type XcmSender = XcmRouter; - type PalletInstancesInfo = AllPalletsWithSystem; - type MaxAssetsIntoHolding = MaxAssetsIntoHolding; - type AssetLocker = (); - type AssetExchanger = (); - type FeeManager = (); - type MessageExporter = (); - type UniversalAliases = frame_support::traits::Nothing; - type CallDispatcher = RuntimeCall; - type SafeCallFilter = frame_support::traits::Everything; } /// No local origins on this chain are allowed to dispatch XCM sends/executions. @@ -191,13 +187,21 @@ frame_support::parameter_types! { impl pallet_xcm::Config for Runtime { // ^ Override for AdvertisedXcmVersion default type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion; + type Currency = Balances; + type CurrencyMatcher = (); type ExecuteXcmOrigin = xcm_builder::EnsureXcmOrigin; - type UniversalLocation = UniversalLocation; + type MaxLockers = ConstU32<8>; + #[cfg(feature = "runtime-benchmarks")] + type ReachableDest = ReachableDest; type RuntimeCall = RuntimeCall; type RuntimeEvent = RuntimeEvent; type RuntimeOrigin = RuntimeOrigin; type SendXcmOrigin = xcm_builder::EnsureXcmOrigin; + type SovereignAccountOf = LocationToAccountId; + type TrustedLockers = (); + type UniversalLocation = UniversalLocation; type Weigher = xcm_builder::FixedWeightBounds; + type WeightInfo = pallet_xcm::TestWeightInfo; type XcmExecuteFilter = frame_support::traits::Everything; type XcmExecutor = xcm_executor::XcmExecutor; type XcmReserveTransferFilter = frame_support::traits::Everything; @@ -205,14 +209,6 @@ impl pallet_xcm::Config for Runtime { type XcmTeleportFilter = frame_support::traits::Nothing; const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100; - type Currency = Balances; - type CurrencyMatcher = (); - type TrustedLockers = (); - type SovereignAccountOf = LocationToAccountId; - type MaxLockers = ConstU32<8>; - type WeightInfo = pallet_xcm::TestWeightInfo; - #[cfg(feature = "runtime-benchmarks")] - type ReachableDest = ReachableDest; } impl cumulus_pallet_xcm::Config for Runtime { diff --git a/runtime/pangolin/src/pallets/xcmp_queue.rs b/runtime/pangolin/src/pallets/xcmp_queue.rs index 9931ff3cc..5b07d20c4 100644 --- a/runtime/pangolin/src/pallets/xcmp_queue.rs +++ b/runtime/pangolin/src/pallets/xcmp_queue.rs @@ -24,9 +24,9 @@ impl cumulus_pallet_xcmp_queue::Config for Runtime { type ControllerOrigin = frame_system::EnsureRoot; type ControllerOriginConverter = XcmOriginToTransactDispatchOrigin; type ExecuteOverweightOrigin = frame_system::EnsureRoot; + type PriceForSiblingDelivery = (); type RuntimeEvent = RuntimeEvent; type VersionWrapper = (); type WeightInfo = weights::cumulus_pallet_xcmp_queue::WeightInfo; type XcmExecutor = xcm_executor::XcmExecutor; - type PriceForSiblingDelivery = (); } diff --git a/runtime/pangoro/src/pallets/polkadot_xcm.rs b/runtime/pangoro/src/pallets/polkadot_xcm.rs index 76299faee..4287ad252 100644 --- a/runtime/pangoro/src/pallets/polkadot_xcm.rs +++ b/runtime/pangoro/src/pallets/polkadot_xcm.rs @@ -116,11 +116,7 @@ frame_support::parameter_types! { pub struct ToTreasury; impl xcm_builder::TakeRevenue for ToTreasury { fn take_revenue(revenue: MultiAsset) { - if let MultiAsset { - id: Concrete(_location), - fun: Fungible(amount), - } = revenue - { + if let MultiAsset { id: Concrete(_location), fun: Fungible(amount) } = revenue { let treasury_account = Treasury::account_id(); let _ = Balances::deposit_creating(&treasury_account, amount); @@ -135,17 +131,23 @@ impl xcm_builder::TakeRevenue for ToTreasury { pub struct XcmExecutorConfig; impl xcm_executor::Config for XcmExecutorConfig { type AssetClaims = PolkadotXcm; + type AssetExchanger = (); + type AssetLocker = (); // How to withdraw and deposit an asset. type AssetTransactor = LocalAssetTransactor; type AssetTrap = PolkadotXcm; type Barrier = Barrier; + type CallDispatcher = RuntimeCall; + type FeeManager = (); type IsReserve = xcm_builder::NativeAsset; type IsTeleporter = (); - // Teleporting is disabled. - type UniversalLocation = UniversalLocation; + type MaxAssetsIntoHolding = MaxAssetsIntoHolding; + type MessageExporter = (); type OriginConverter = XcmOriginToTransactDispatchOrigin; + type PalletInstancesInfo = AllPalletsWithSystem; type ResponseHandler = PolkadotXcm; type RuntimeCall = RuntimeCall; + type SafeCallFilter = frame_support::traits::Everything; type SubscriptionService = PolkadotXcm; type Trader = xcm_configs::LocalAssetTrader< frame_support::weights::ConstantMultiplier< @@ -158,17 +160,11 @@ impl xcm_executor::Config for XcmExecutorConfig { DealWithFees, ToTreasury, >; + type UniversalAliases = frame_support::traits::Nothing; + // Teleporting is disabled. + type UniversalLocation = UniversalLocation; type Weigher = xcm_builder::FixedWeightBounds; type XcmSender = XcmRouter; - type PalletInstancesInfo = AllPalletsWithSystem; - type MaxAssetsIntoHolding = MaxAssetsIntoHolding; - type AssetLocker = (); - type AssetExchanger = (); - type FeeManager = (); - type MessageExporter = (); - type UniversalAliases = frame_support::traits::Nothing; - type CallDispatcher = RuntimeCall; - type SafeCallFilter = frame_support::traits::Everything; } /// No local origins on this chain are allowed to dispatch XCM sends/executions. @@ -191,13 +187,21 @@ frame_support::parameter_types! { impl pallet_xcm::Config for Runtime { // ^ Override for AdvertisedXcmVersion default type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion; + type Currency = Balances; + type CurrencyMatcher = (); type ExecuteXcmOrigin = xcm_builder::EnsureXcmOrigin; - type UniversalLocation = UniversalLocation; + type MaxLockers = ConstU32<8>; + #[cfg(feature = "runtime-benchmarks")] + type ReachableDest = ReachableDest; type RuntimeCall = RuntimeCall; type RuntimeEvent = RuntimeEvent; type RuntimeOrigin = RuntimeOrigin; type SendXcmOrigin = xcm_builder::EnsureXcmOrigin; + type SovereignAccountOf = LocationToAccountId; + type TrustedLockers = (); + type UniversalLocation = UniversalLocation; type Weigher = xcm_builder::FixedWeightBounds; + type WeightInfo = pallet_xcm::TestWeightInfo; type XcmExecuteFilter = frame_support::traits::Everything; type XcmExecutor = xcm_executor::XcmExecutor; type XcmReserveTransferFilter = frame_support::traits::Everything; @@ -205,14 +209,6 @@ impl pallet_xcm::Config for Runtime { type XcmTeleportFilter = frame_support::traits::Nothing; const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100; - type Currency = Balances; - type CurrencyMatcher = (); - type TrustedLockers = (); - type SovereignAccountOf = LocationToAccountId; - type MaxLockers = ConstU32<8>; - type WeightInfo = pallet_xcm::TestWeightInfo; - #[cfg(feature = "runtime-benchmarks")] - type ReachableDest = ReachableDest; } impl cumulus_pallet_xcm::Config for Runtime { diff --git a/runtime/pangoro/src/pallets/xcmp_queue.rs b/runtime/pangoro/src/pallets/xcmp_queue.rs index 9931ff3cc..5b07d20c4 100644 --- a/runtime/pangoro/src/pallets/xcmp_queue.rs +++ b/runtime/pangoro/src/pallets/xcmp_queue.rs @@ -24,9 +24,9 @@ impl cumulus_pallet_xcmp_queue::Config for Runtime { type ControllerOrigin = frame_system::EnsureRoot; type ControllerOriginConverter = XcmOriginToTransactDispatchOrigin; type ExecuteOverweightOrigin = frame_system::EnsureRoot; + type PriceForSiblingDelivery = (); type RuntimeEvent = RuntimeEvent; type VersionWrapper = (); type WeightInfo = weights::cumulus_pallet_xcmp_queue::WeightInfo; type XcmExecutor = xcm_executor::XcmExecutor; - type PriceForSiblingDelivery = (); } From a1ff86dd357887f1f28755c346af58a68ad702f1 Mon Sep 17 00:00:00 2001 From: Guantong Date: Wed, 22 Mar 2023 16:50:03 +0800 Subject: [PATCH 181/189] Fix compile --- Cargo.lock | 83 +++++++----------------------- node/Cargo.toml | 3 +- pallet/message-transact/src/lib.rs | 2 +- 3 files changed, 21 insertions(+), 67 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0e07f383f..6601058bb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -215,11 +215,6 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fbf688625d06217d5b1bb0ea9d9c44a1635fd0ee3534466388d18203174f4d11" -[[package]] -name = "amcl" -version = "0.3.0" -source = "git+https://github.com/darwinia-network/milagro_bls#076d5fb697b304534b26cb8b7fe488b9a7e70a99" - [[package]] name = "android_system_properties" version = "0.1.5" @@ -2036,7 +2031,6 @@ dependencies = [ "environmental", "frame-support", "frame-system", - "hex", "impl-trait-for-tuples", "log", "parity-scale-codec", @@ -2286,7 +2280,7 @@ dependencies = [ "parity-scale-codec", "polkadot-service", "sc-client-api", - "sc-rpc-api 0.10.0-dev (git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.37)", + "sc-rpc-api", "serde", "serde_json", "sp-api", @@ -2681,9 +2675,7 @@ dependencies = [ "ark-serialize", "ark-std", "fp-evm", - "frame-system", - "milagro_bls", - "pallet-balances", + "frame-support", "pallet-evm", "precompile-utils", "rand 0.8.5", @@ -3624,25 +3616,6 @@ dependencies = [ "sp-runtime", ] -[[package]] -name = "fc-consensus" -version = "2.0.0-dev" -source = "git+https://github.com/darwinia-network/frontier?branch=polkadot-v0.9.38#28c1f8a80152cabdf98afe58dc37fa963682d978" -dependencies = [ - "async-trait", - "fc-db", - "fp-consensus", - "fp-rpc", - "sc-client-api", - "sc-consensus", - "sp-api", - "sp-block-builder", - "sp-blockchain", - "sp-consensus", - "sp-runtime", - "thiserror", -] - [[package]] name = "fc-db" version = "2.0.0-dev" @@ -6128,6 +6101,15 @@ dependencies = [ "autocfg", ] +[[package]] +name = "memoffset" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4" +dependencies = [ + "autocfg", +] + [[package]] name = "memoffset" version = "0.8.0" @@ -6176,16 +6158,6 @@ dependencies = [ "thrift", ] -[[package]] -name = "milagro_bls" -version = "1.5.0" -source = "git+https://github.com/darwinia-network/milagro_bls#076d5fb697b304534b26cb8b7fe488b9a7e70a99" -dependencies = [ - "amcl", - "rand 0.8.5", - "zeroize", -] - [[package]] name = "mime" version = "0.3.16" @@ -6548,7 +6520,7 @@ version = "0.26.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfdda3d196821d6af13126e40375cdf7da646a96114af134d5f417a9a1dc8e1a" dependencies = [ - "bitflags", + "bitflags 1.3.2", "cfg-if", "libc", "memoffset 0.7.1", @@ -8804,6 +8776,7 @@ dependencies = [ "sp-storage", "sp-timestamp", "sp-transaction-pool", + "westend-runtime", ] [[package]] @@ -9767,6 +9740,7 @@ dependencies = [ "thiserror", "tracing-gum", "westend-runtime", + "westend-runtime-constants", ] [[package]] @@ -11230,7 +11204,7 @@ dependencies = [ "jsonrpsee", "sc-consensus-babe", "sc-consensus-epochs", - "sc-rpc-api 0.10.0-dev (git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37)", + "sc-rpc-api", "serde", "sp-api", "sp-application-crypto", @@ -11678,7 +11652,7 @@ dependencies = [ "sc-block-builder", "sc-chain-spec", "sc-client-api", - "sc-rpc-api 0.10.0-dev (git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37)", + "sc-rpc-api", "sc-tracing", "sc-transaction-pool-api", "sc-utils", @@ -11714,25 +11688,6 @@ dependencies = [ "thiserror", ] -[[package]] -name = "sc-rpc-api" -version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.37#f38bd6671d460293c93062cc1e4fe9e9e490cb29" -dependencies = [ - "jsonrpsee", - "parity-scale-codec", - "sc-chain-spec", - "sc-transaction-pool-api", - "scale-info", - "serde", - "serde_json", - "sp-core", - "sp-rpc", - "sp-runtime", - "sp-version", - "thiserror", -] - [[package]] name = "sc-rpc-server" version = "4.0.0-dev" @@ -13406,7 +13361,7 @@ dependencies = [ "jsonrpsee", "log", "parity-scale-codec", - "sc-rpc-api 0.10.0-dev (git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37)", + "sc-rpc-api", "sc-transaction-pool-api", "sp-api", "sp-block-builder", @@ -13435,7 +13390,7 @@ dependencies = [ "async-trait", "jsonrpsee", "log", - "sc-rpc-api 0.10.0-dev (git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37)", + "sc-rpc-api", "serde", "sp-runtime", ] @@ -13449,7 +13404,7 @@ dependencies = [ "log", "parity-scale-codec", "sc-client-api", - "sc-rpc-api 0.10.0-dev (git+https://github.com/darwinia-network/substrate?branch=polkadot-v0.9.37)", + "sc-rpc-api", "scale-info", "serde", "sp-core", diff --git a/node/Cargo.toml b/node/Cargo.toml index 72828ac65..d41809516 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -57,7 +57,7 @@ xcm = { workspace = true } # substrate frame-benchmarking = { workspace = true, optional = true } -frame-benchmarking-cli = { workspace = true, optional = true } +frame-benchmarking-cli = { workspace = true } pallet-transaction-payment-rpc = { workspace = true } sc-basic-authorship = { workspace = true } sc-chain-spec = { workspace = true } @@ -119,7 +119,6 @@ runtime-benchmarks = [ # substrate "frame-benchmarking", - "frame-benchmarking-cli", ] try-runtime = [ diff --git a/pallet/message-transact/src/lib.rs b/pallet/message-transact/src/lib.rs index 28835ca15..0655f926d 100644 --- a/pallet/message-transact/src/lib.rs +++ b/pallet/message-transact/src/lib.rs @@ -38,7 +38,7 @@ use pallet_evm::{FeeCalculator, GasWeightMapping}; // substrate use frame_support::{traits::EnsureOrigin, PalletError, RuntimeDebug}; use sp_core::{H160, U256}; -use sp_runtime::traits::BadOrigin; +use frame_support::sp_runtime::traits::BadOrigin; use sp_std::boxed::Box; pub use pallet::*; From 9d4fd65ee4dd3ea910ac7b7becf5be115de72497 Mon Sep 17 00:00:00 2001 From: Guantong Date: Fri, 24 Mar 2023 11:03:32 +0800 Subject: [PATCH 182/189] Format --- pallet/message-transact/src/lib.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pallet/message-transact/src/lib.rs b/pallet/message-transact/src/lib.rs index 0655f926d..72d700b49 100644 --- a/pallet/message-transact/src/lib.rs +++ b/pallet/message-transact/src/lib.rs @@ -36,9 +36,10 @@ use fp_ethereum::{TransactionData, ValidatedTransaction}; use fp_evm::{CheckEvmTransaction, CheckEvmTransactionConfig, InvalidEvmTransactionError}; use pallet_evm::{FeeCalculator, GasWeightMapping}; // substrate -use frame_support::{traits::EnsureOrigin, PalletError, RuntimeDebug}; +use frame_support::{ + sp_runtime::traits::BadOrigin, traits::EnsureOrigin, PalletError, RuntimeDebug, +}; use sp_core::{H160, U256}; -use frame_support::sp_runtime::traits::BadOrigin; use sp_std::boxed::Box; pub use pallet::*; From 30b89643c4ab7be1fed0452b0452bf3fa5687e98 Mon Sep 17 00:00:00 2001 From: Guantong Date: Fri, 24 Mar 2023 11:34:23 +0800 Subject: [PATCH 183/189] Fix CI check features --- runtime/crab/Cargo.toml | 1 + runtime/darwinia/Cargo.toml | 1 + runtime/pangolin/Cargo.toml | 1 + runtime/pangoro/Cargo.toml | 1 + 4 files changed, 4 insertions(+) diff --git a/runtime/crab/Cargo.toml b/runtime/crab/Cargo.toml index c842d4a9f..822e30206 100644 --- a/runtime/crab/Cargo.toml +++ b/runtime/crab/Cargo.toml @@ -265,6 +265,7 @@ runtime-benchmarks = [ "darwinia-common-runtime/runtime-benchmarks", "darwinia-deposit/runtime-benchmarks", "darwinia-ecdsa-authority/runtime-benchmarks", + "darwinia-message-transact/runtime-benchmarks", "darwinia-staking/runtime-benchmarks", # darwinia-messages-substrate diff --git a/runtime/darwinia/Cargo.toml b/runtime/darwinia/Cargo.toml index 22f6785b9..48e2b4e30 100644 --- a/runtime/darwinia/Cargo.toml +++ b/runtime/darwinia/Cargo.toml @@ -270,6 +270,7 @@ runtime-benchmarks = [ "darwinia-common-runtime/runtime-benchmarks", "darwinia-deposit/runtime-benchmarks", "darwinia-ecdsa-authority/runtime-benchmarks", + "darwinia-message-transact/runtime-benchmarks", "darwinia-staking/runtime-benchmarks", # darwinia-messages-substrate diff --git a/runtime/pangolin/Cargo.toml b/runtime/pangolin/Cargo.toml index 9335e367d..ac1ed7144 100644 --- a/runtime/pangolin/Cargo.toml +++ b/runtime/pangolin/Cargo.toml @@ -269,6 +269,7 @@ runtime-benchmarks = [ "darwinia-common-runtime/runtime-benchmarks", "darwinia-deposit/runtime-benchmarks", "darwinia-ecdsa-authority/runtime-benchmarks", + "darwinia-message-transact/runtime-benchmarks", "darwinia-staking/runtime-benchmarks", # darwinia-messages-substrate diff --git a/runtime/pangoro/Cargo.toml b/runtime/pangoro/Cargo.toml index 0a717a81b..017af21f7 100644 --- a/runtime/pangoro/Cargo.toml +++ b/runtime/pangoro/Cargo.toml @@ -270,6 +270,7 @@ runtime-benchmarks = [ "darwinia-common-runtime/runtime-benchmarks", "darwinia-deposit/runtime-benchmarks", "darwinia-ecdsa-authority/runtime-benchmarks", + "darwinia-message-transact/runtime-benchmarks", "darwinia-staking/runtime-benchmarks", # darwinia-messages-substrate From 9bf6c3763fae01610f225fb2328aa15aa0ed2c97 Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Tue, 28 Mar 2023 02:34:12 +0800 Subject: [PATCH 184/189] Format --- pallet/message-gadget/Cargo.toml | 5 ++++- pallet/message-transact/Cargo.toml | 10 ++++++---- pallet/staking/Cargo.toml | 5 ++++- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/pallet/message-gadget/Cargo.toml b/pallet/message-gadget/Cargo.toml index c8a279ec7..fd70d1afe 100644 --- a/pallet/message-gadget/Cargo.toml +++ b/pallet/message-gadget/Cargo.toml @@ -48,4 +48,7 @@ std = [ "sp-io/std", ] -try-runtime = ["frame-support/try-runtime"] +try-runtime = [ + # substrate + "frame-support/try-runtime", +] diff --git a/pallet/message-transact/Cargo.toml b/pallet/message-transact/Cargo.toml index 1a209e5ef..9b4b76bfd 100644 --- a/pallet/message-transact/Cargo.toml +++ b/pallet/message-transact/Cargo.toml @@ -46,9 +46,6 @@ sp-runtime = { workspace = true, features = ["std"] } [features] default = ["std"] - -runtime-benchmarks = [] - std = [ # crates.io "codec/std", @@ -67,4 +64,9 @@ std = [ "sp-std/std", ] -try-runtime = ["frame-support/try-runtime"] +runtime-benchmarks = [] + +try-runtime = [ + # substrate + "frame-support/try-runtime", +] diff --git a/pallet/staking/Cargo.toml b/pallet/staking/Cargo.toml index 03ba52b94..d7e9bda90 100644 --- a/pallet/staking/Cargo.toml +++ b/pallet/staking/Cargo.toml @@ -60,4 +60,7 @@ std = [ runtime-benchmarks = [] -try-runtime = ["frame-support/try-runtime"] +try-runtime = [ + # substrate + "frame-support/try-runtime", +] From c8e560978facbac095c19b278af80694d4774e9c Mon Sep 17 00:00:00 2001 From: Guantong Date: Tue, 28 Mar 2023 10:20:25 +0800 Subject: [PATCH 185/189] Patch cumulus assertion branch v0.9.38 --- Cargo.lock | 50 +++++++++++++++++++++++++------------------------- Cargo.toml | 20 ++++++++++++++++++++ 2 files changed, 45 insertions(+), 25 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6601058bb..19cbda50b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1825,7 +1825,7 @@ dependencies = [ [[package]] name = "cumulus-client-cli" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.38#3275e271e8937c06dca44331e98f31ef020a71e6" +source = "git+https://github.com/darwinia-network/cumulus?branch=remove-assertion-v0.9.38#fb975bb81664c4bf8cac02e593e377478a510f40" dependencies = [ "clap", "parity-scale-codec", @@ -1840,7 +1840,7 @@ dependencies = [ [[package]] name = "cumulus-client-collator" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.38#3275e271e8937c06dca44331e98f31ef020a71e6" +source = "git+https://github.com/darwinia-network/cumulus?branch=remove-assertion-v0.9.38#fb975bb81664c4bf8cac02e593e377478a510f40" dependencies = [ "cumulus-client-consensus-common", "cumulus-client-network", @@ -1863,7 +1863,7 @@ dependencies = [ [[package]] name = "cumulus-client-consensus-aura" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.38#3275e271e8937c06dca44331e98f31ef020a71e6" +source = "git+https://github.com/darwinia-network/cumulus?branch=remove-assertion-v0.9.38#fb975bb81664c4bf8cac02e593e377478a510f40" dependencies = [ "async-trait", "cumulus-client-consensus-common", @@ -1892,7 +1892,7 @@ dependencies = [ [[package]] name = "cumulus-client-consensus-common" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.38#3275e271e8937c06dca44331e98f31ef020a71e6" +source = "git+https://github.com/darwinia-network/cumulus?branch=remove-assertion-v0.9.38#fb975bb81664c4bf8cac02e593e377478a510f40" dependencies = [ "async-trait", "cumulus-client-pov-recovery", @@ -1915,7 +1915,7 @@ dependencies = [ [[package]] name = "cumulus-client-network" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.38#3275e271e8937c06dca44331e98f31ef020a71e6" +source = "git+https://github.com/darwinia-network/cumulus?branch=remove-assertion-v0.9.38#fb975bb81664c4bf8cac02e593e377478a510f40" dependencies = [ "async-trait", "cumulus-relay-chain-interface", @@ -1938,7 +1938,7 @@ dependencies = [ [[package]] name = "cumulus-client-pov-recovery" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.38#3275e271e8937c06dca44331e98f31ef020a71e6" +source = "git+https://github.com/darwinia-network/cumulus?branch=remove-assertion-v0.9.38#fb975bb81664c4bf8cac02e593e377478a510f40" dependencies = [ "cumulus-primitives-core", "cumulus-relay-chain-interface", @@ -1961,7 +1961,7 @@ dependencies = [ [[package]] name = "cumulus-client-service" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.38#3275e271e8937c06dca44331e98f31ef020a71e6" +source = "git+https://github.com/darwinia-network/cumulus?branch=remove-assertion-v0.9.38#fb975bb81664c4bf8cac02e593e377478a510f40" dependencies = [ "cumulus-client-cli", "cumulus-client-collator", @@ -1989,7 +1989,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-aura-ext" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.38#3275e271e8937c06dca44331e98f31ef020a71e6" +source = "git+https://github.com/darwinia-network/cumulus?branch=remove-assertion-v0.9.38#fb975bb81664c4bf8cac02e593e377478a510f40" dependencies = [ "frame-support", "frame-system", @@ -2005,7 +2005,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-dmp-queue" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.38#3275e271e8937c06dca44331e98f31ef020a71e6" +source = "git+https://github.com/darwinia-network/cumulus?branch=remove-assertion-v0.9.38#fb975bb81664c4bf8cac02e593e377478a510f40" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -2022,7 +2022,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-parachain-system" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.38#3275e271e8937c06dca44331e98f31ef020a71e6" +source = "git+https://github.com/darwinia-network/cumulus?branch=remove-assertion-v0.9.38#fb975bb81664c4bf8cac02e593e377478a510f40" dependencies = [ "bytes", "cumulus-pallet-parachain-system-proc-macro", @@ -2031,6 +2031,7 @@ dependencies = [ "environmental", "frame-support", "frame-system", + "hex", "impl-trait-for-tuples", "log", "parity-scale-codec", @@ -2051,7 +2052,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-parachain-system-proc-macro" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.38#3275e271e8937c06dca44331e98f31ef020a71e6" +source = "git+https://github.com/darwinia-network/cumulus?branch=remove-assertion-v0.9.38#fb975bb81664c4bf8cac02e593e377478a510f40" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -2062,7 +2063,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-session-benchmarking" version = "3.0.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.38#3275e271e8937c06dca44331e98f31ef020a71e6" +source = "git+https://github.com/darwinia-network/cumulus?branch=remove-assertion-v0.9.38#fb975bb81664c4bf8cac02e593e377478a510f40" dependencies = [ "frame-benchmarking", "frame-support", @@ -2076,7 +2077,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-xcm" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.38#3275e271e8937c06dca44331e98f31ef020a71e6" +source = "git+https://github.com/darwinia-network/cumulus?branch=remove-assertion-v0.9.38#fb975bb81664c4bf8cac02e593e377478a510f40" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -2092,7 +2093,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-xcmp-queue" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.38#3275e271e8937c06dca44331e98f31ef020a71e6" +source = "git+https://github.com/darwinia-network/cumulus?branch=remove-assertion-v0.9.38#fb975bb81664c4bf8cac02e593e377478a510f40" dependencies = [ "cumulus-primitives-core", "frame-benchmarking", @@ -2113,7 +2114,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-core" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.38#3275e271e8937c06dca44331e98f31ef020a71e6" +source = "git+https://github.com/darwinia-network/cumulus?branch=remove-assertion-v0.9.38#fb975bb81664c4bf8cac02e593e377478a510f40" dependencies = [ "parity-scale-codec", "polkadot-core-primitives", @@ -2129,7 +2130,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-parachain-inherent" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.38#3275e271e8937c06dca44331e98f31ef020a71e6" +source = "git+https://github.com/darwinia-network/cumulus?branch=remove-assertion-v0.9.38#fb975bb81664c4bf8cac02e593e377478a510f40" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -2152,7 +2153,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-timestamp" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.38#3275e271e8937c06dca44331e98f31ef020a71e6" +source = "git+https://github.com/darwinia-network/cumulus?branch=remove-assertion-v0.9.38#fb975bb81664c4bf8cac02e593e377478a510f40" dependencies = [ "cumulus-primitives-core", "futures", @@ -2165,7 +2166,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-utility" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.38#3275e271e8937c06dca44331e98f31ef020a71e6" +source = "git+https://github.com/darwinia-network/cumulus?branch=remove-assertion-v0.9.38#fb975bb81664c4bf8cac02e593e377478a510f40" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -2183,7 +2184,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-inprocess-interface" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.38#3275e271e8937c06dca44331e98f31ef020a71e6" +source = "git+https://github.com/darwinia-network/cumulus?branch=remove-assertion-v0.9.38#fb975bb81664c4bf8cac02e593e377478a510f40" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -2208,7 +2209,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-interface" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.38#3275e271e8937c06dca44331e98f31ef020a71e6" +source = "git+https://github.com/darwinia-network/cumulus?branch=remove-assertion-v0.9.38#fb975bb81664c4bf8cac02e593e377478a510f40" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -2216,7 +2217,6 @@ dependencies = [ "jsonrpsee-core", "parity-scale-codec", "polkadot-overseer", - "polkadot-service", "sc-client-api", "sp-api", "sp-blockchain", @@ -2228,7 +2228,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-minimal-node" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.38#3275e271e8937c06dca44331e98f31ef020a71e6" +source = "git+https://github.com/darwinia-network/cumulus?branch=remove-assertion-v0.9.38#fb975bb81664c4bf8cac02e593e377478a510f40" dependencies = [ "array-bytes 6.0.0", "async-trait", @@ -2268,7 +2268,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-rpc-interface" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.38#3275e271e8937c06dca44331e98f31ef020a71e6" +source = "git+https://github.com/darwinia-network/cumulus?branch=remove-assertion-v0.9.38#fb975bb81664c4bf8cac02e593e377478a510f40" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -2297,7 +2297,7 @@ dependencies = [ [[package]] name = "cumulus-test-relay-sproof-builder" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.38#3275e271e8937c06dca44331e98f31ef020a71e6" +source = "git+https://github.com/darwinia-network/cumulus?branch=remove-assertion-v0.9.38#fb975bb81664c4bf8cac02e593e377478a510f40" dependencies = [ "cumulus-primitives-core", "parity-scale-codec", @@ -8337,7 +8337,7 @@ dependencies = [ [[package]] name = "parachain-info" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.38#3275e271e8937c06dca44331e98f31ef020a71e6" +source = "git+https://github.com/darwinia-network/cumulus?branch=remove-assertion-v0.9.38#fb975bb81664c4bf8cac02e593e377478a510f40" dependencies = [ "cumulus-primitives-core", "frame-support", diff --git a/Cargo.toml b/Cargo.toml index c30bfe5cd..cf889f648 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -190,3 +190,23 @@ substrate-frame-rpc-system = { git = "https://github.com/parityt substrate-prometheus-endpoint = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } try-runtime-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } + +[patch."https://github.com/paritytech/cumulus"] +cumulus-client-cli = { git = "https://github.com/darwinia-network/cumulus", branch = "remove-assertion-v0.9.38" } +cumulus-client-collator = { git = "https://github.com/darwinia-network/cumulus", branch = "remove-assertion-v0.9.38" } +cumulus-client-consensus-aura = { git = "https://github.com/darwinia-network/cumulus", branch = "remove-assertion-v0.9.38" } +cumulus-client-consensus-common = { git = "https://github.com/darwinia-network/cumulus", branch = "remove-assertion-v0.9.38" } +cumulus-client-network = { git = "https://github.com/darwinia-network/cumulus", branch = "remove-assertion-v0.9.38" } +cumulus-client-service = { git = "https://github.com/darwinia-network/cumulus", branch = "remove-assertion-v0.9.38" } +cumulus-pallet-aura-ext = { git = "https://github.com/darwinia-network/cumulus", branch = "remove-assertion-v0.9.38" } +cumulus-pallet-dmp-queue = { git = "https://github.com/darwinia-network/cumulus", branch = "remove-assertion-v0.9.38" } +cumulus-pallet-parachain-system = { git = "https://github.com/darwinia-network/cumulus", branch = "remove-assertion-v0.9.38" } +cumulus-pallet-session-benchmarking = { git = "https://github.com/darwinia-network/cumulus", branch = "remove-assertion-v0.9.38" } +cumulus-pallet-xcm = { git = "https://github.com/darwinia-network/cumulus", branch = "remove-assertion-v0.9.38" } +cumulus-pallet-xcmp-queue = { git = "https://github.com/darwinia-network/cumulus", branch = "remove-assertion-v0.9.38" } +cumulus-primitives-core = { git = "https://github.com/darwinia-network/cumulus", branch = "remove-assertion-v0.9.38" } +cumulus-primitives-parachain-inherent = { git = "https://github.com/darwinia-network/cumulus", branch = "remove-assertion-v0.9.38" } +cumulus-primitives-timestamp = { git = "https://github.com/darwinia-network/cumulus", branch = "remove-assertion-v0.9.38" } +cumulus-primitives-utility = { git = "https://github.com/darwinia-network/cumulus", branch = "remove-assertion-v0.9.38" } +cumulus-relay-chain-interface = { git = "https://github.com/darwinia-network/cumulus", branch = "remove-assertion-v0.9.38" } +parachain-info = { git = "https://github.com/darwinia-network/cumulus", branch = "remove-assertion-v0.9.38" } From e42cf6893eba9a4fa506426c3a7f9c116355ed23 Mon Sep 17 00:00:00 2001 From: Guantong Date: Tue, 28 Mar 2023 10:27:29 +0800 Subject: [PATCH 186/189] Companion for paritytech/cumulus#2287 --- node/src/service/mod.rs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/node/src/service/mod.rs b/node/src/service/mod.rs index fdeeda08c..01f926172 100644 --- a/node/src/service/mod.rs +++ b/node/src/service/mod.rs @@ -312,12 +312,7 @@ where hwbench.clone(), ) .await - .map_err(|e| match e { - cumulus_relay_chain_interface::RelayChainError::ServiceError( - polkadot_service::Error::Sub(x), - ) => x, - s => s.to_string().into(), - })?; + .map_err(|e| sc_service::Error::Application(Box::new(e) as Box<_>))?; let block_announce_validator = cumulus_client_network::BlockAnnounceValidator::new(relay_chain_interface.clone(), para_id); From ebe2dec487ba86cd0e0e372a6191431b5ac1af18 Mon Sep 17 00:00:00 2001 From: Guantong Date: Tue, 28 Mar 2023 10:47:49 +0800 Subject: [PATCH 187/189] Remove unused polkadot-service --- Cargo.lock | 1 - node/Cargo.toml | 1 - 2 files changed, 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 19cbda50b..11af1b32a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2463,7 +2463,6 @@ dependencies = [ "parity-scale-codec", "polkadot-cli", "polkadot-primitives", - "polkadot-service", "sc-basic-authorship", "sc-chain-spec", "sc-cli", diff --git a/node/Cargo.toml b/node/Cargo.toml index d41809516..82f9ee1ab 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -52,7 +52,6 @@ fp-storage = { workspace = true } # polkadot polkadot-cli = { workspace = true } polkadot-primitives = { workspace = true } -polkadot-service = { workspace = true } xcm = { workspace = true } # substrate From 64556ffe9e7f2fce1d9e3d61565fc38a210f6b97 Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Tue, 28 Mar 2023 13:27:44 +0800 Subject: [PATCH 188/189] Revert changes --- node/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node/Cargo.toml b/node/Cargo.toml index 82f9ee1ab..e79824983 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -14,7 +14,7 @@ substrate-build-script-utils = { workspace = true } array-bytes = { workspace = true } async-trait = { version = "0.1" } clap = { version = "4.1", features = ["derive"] } -codec = { package = "parity-scale-codec", workspace = true } +codec = { workspace = true, package = "parity-scale-codec" } futures = { version = "0.3" } jsonrpsee = { version = "0.16", features = ["server"] } log = { version = "0.4" } From 379c5778b12fb8e23056871d14d16f2586c883cd Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Tue, 28 Mar 2023 13:47:40 +0800 Subject: [PATCH 189/189] Format --- Cargo.toml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 9034e78ae..5f22e3e38 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -29,12 +29,12 @@ sha3 = { version = "0.10" } static_assertions = { version = "1.1" } # cumulus -cumulus-client-cli = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.38" } -cumulus-client-collator = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.38" } -cumulus-client-consensus-aura = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.38" } -cumulus-client-consensus-common = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.38" } -cumulus-client-network = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.38" } -cumulus-client-service = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.38" } +cumulus-client-cli = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.38" } +cumulus-client-collator = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.38" } +cumulus-client-consensus-aura = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.38" } +cumulus-client-consensus-common = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.38" } +cumulus-client-network = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.38" } +cumulus-client-service = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.38" } cumulus-pallet-aura-ext = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.38" } cumulus-pallet-dmp-queue = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.38" } cumulus-pallet-parachain-system = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.38" } @@ -42,10 +42,10 @@ cumulus-pallet-session-benchmarking = { default-features = false, git = "https cumulus-pallet-xcm = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.38" } cumulus-pallet-xcmp-queue = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.38" } cumulus-primitives-core = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.38" } -cumulus-primitives-parachain-inherent = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.38" } +cumulus-primitives-parachain-inherent = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.38" } cumulus-primitives-timestamp = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.38" } cumulus-primitives-utility = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.38" } -cumulus-relay-chain-interface = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.38" } +cumulus-relay-chain-interface = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.38" } parachain-info = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.38" } # darwinia