diff --git a/.github/license-check/config.json b/.github/license-check/config.json
index 0625a49e0d..ffaa32c450 100644
--- a/.github/license-check/config.json
+++ b/.github/license-check/config.json
@@ -3,6 +3,19 @@
"include": [
"**/*.rs"
],
+ "exclude": [
+ "pallets/collator-selection/**",
+ "pallets/custom-signatures/**",
+ "precompiles/utils/**",
+ "vendor/**"
+ ],
"license": "./.github/license-check/headers/HEADER-GNUv3"
+ },
+ {
+ "include": [
+ "pallets/collator-selection/*.rs",
+ "pallets/custom-signatures/*.rs"
+ ],
+ "license": "./.github/license-check/headers/HEADER-APACHE2"
}
]
diff --git a/.github/license-check/headers/HEADER-APACHE2 b/.github/license-check/headers/HEADER-APACHE2
new file mode 100644
index 0000000000..2fae0a167e
--- /dev/null
+++ b/.github/license-check/headers/HEADER-APACHE2
@@ -0,0 +1,16 @@
+// This file is part of Astar.
+
+// Copyright (C) 2019-2023 Stake Technologies Pte.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.
diff --git a/.github/scripts/generate-release-body.ts b/.github/scripts/generate-release-body.ts
index a77b9b5c32..67d9765261 100644
--- a/.github/scripts/generate-release-body.ts
+++ b/.github/scripts/generate-release-body.ts
@@ -255,7 +255,7 @@ async function main() {
getRuntimeInfo(argv["srtool-report-folder"], runtimeName)
);
- const moduleLinks = ["substrate", "polkadot", "cumulus", "frontier", "astar-frame"].map((repoName) => ({
+ const moduleLinks = ["substrate", "polkadot", "cumulus", "frontier"].map((repoName) => ({
name: repoName,
link: getCompareLink(repoName, previousTag, newTag),
}));
@@ -339,7 +339,7 @@ ${moduleLinks.map((modules) => `${capitalize(modules.name)}: ${modules.link}`).j
| \`Ubuntu x86_64\` | [Download](https://github.com/AstarNetwork/Astar/releases/download/${newTag}/astar-collator-${newTag}-ubuntu-x86_64.tar.gz) |
| \`Ubuntu aarch64\` | [Download](https://github.com/AstarNetwork/Astar/releases/download/${newTag}/astar-collator-${newTag}-ubuntu-aarch64.tar.gz) |
-[](https://hub.docker.com/r/staketechnologies/astar-collator/tags)
+[](https://hub.docker.com/r/staketechnologies/astar-collator/tags)
`
console.log(template);
diff --git a/.github/workflows/base_checks.yaml b/.github/workflows/base_checks.yaml
index d61c3b151d..9fab7737b9 100644
--- a/.github/workflows/base_checks.yaml
+++ b/.github/workflows/base_checks.yaml
@@ -7,6 +7,16 @@ on:
- v[0-9]+.[0-9]+.[0-9]+*
workflow_dispatch:
jobs:
+ clean-up-actions:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Cancel Previous Runs
+ # Only cancel non-master branch runs
+ if: ${{ github.ref != 'refs/heads/master' }}
+ uses: styfle/cancel-workflow-action@0.11.0
+ with:
+ access_token: ${{ github.token }}
+
compile-and-check:
runs-on: ubuntu-latest
steps:
diff --git a/.github/workflows/coverage.yaml b/.github/workflows/coverage.yaml
new file mode 100644
index 0000000000..3134714845
--- /dev/null
+++ b/.github/workflows/coverage.yaml
@@ -0,0 +1,74 @@
+name: Code coverage
+on:
+ pull_request:
+ types: [opened, reopened, synchronize, ready_for_review]
+ workflow_dispatch:
+jobs:
+ clean-up-actions:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Cancel Previous Runs
+ # Only cancel non-master branch runs
+ if: ${{ github.ref != 'refs/heads/master' }}
+ uses: styfle/cancel-workflow-action@0.11.0
+ with:
+ access_token: ${{ github.token }}
+
+ coverage:
+ if: github.event.pull_request.draft == false
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout the source code
+ uses: actions/checkout@v3
+
+ - name: Install & display rust toolchain
+ run: rustup show
+
+ - name: Check targets are installed correctly
+ run: rustup target list --installed
+
+ - uses: actions/cache@v3
+ with:
+ path: |
+ ~/.cargo/registry
+ ~/.cargo/git
+ target/
+ key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}
+ restore-keys: |
+ ${{ runner.os }}-cargo-
+
+ - name: Install deps
+ run: sudo apt -y install protobuf-compiler
+
+ - name: Run all tests & Generate report
+ uses: actions-rs/tarpaulin@v0.1
+ with:
+ version: 0.22.0
+ args: '--workspace -e astar-collator xcm-tools local-runtime shibuya-runtime shiden-runtime astar-runtime integration-tests --exclude-files vendor/* bin/* runtime/* tests/* **/mock.rs **/weights.rs'
+ out-type: Xml
+
+ - name: Code Coverage Summary Report
+ uses: irongut/CodeCoverageSummary@v1.2.0
+ with:
+ filename: cobertura.xml
+ badge: true
+ fail_below_min: true
+ format: markdown
+ hide_branch_rate: false
+ hide_complexity: true
+ indicators: true
+ output: both
+ thresholds: '50 80'
+
+ - name: Add Coverage PR Comment
+ uses: marocchino/sticky-pull-request-comment@v2
+ if: github.event_name == 'pull_request'
+ with:
+ recreate: true
+ path: code-coverage-results.md
+
+ - name: Archive code coverage results
+ uses: actions/upload-artifact@v1
+ with:
+ name: code-coverage-report
+ path: cobertura.xml
diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml
index d986ecf584..e02991191b 100644
--- a/.github/workflows/static-analysis.yml
+++ b/.github/workflows/static-analysis.yml
@@ -1,6 +1,16 @@
name: Static Analysis
on: [push, workflow_dispatch]
jobs:
+ clean-up-actions:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Cancel Previous Runs
+ # Only cancel non-master branch runs
+ if: ${{ github.ref != 'refs/heads/master' }}
+ uses: styfle/cancel-workflow-action@0.11.0
+ with:
+ access_token: ${{ github.token }}
+
fmt:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
@@ -64,7 +74,7 @@ jobs:
- name: Checkout the source code
uses: actions/checkout@v3
- - name: Check license
+ - name: Check license
uses: viperproject/check-license-header@v2
with:
path: ./
diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml
index acb41063fa..87b6177a83 100644
--- a/.github/workflows/tests.yaml
+++ b/.github/workflows/tests.yaml
@@ -7,7 +7,17 @@ on:
- v[0-9]+.[0-9]+.[0-9]+*
workflow_dispatch:
jobs:
- run-tests:
+ clean-up-actions:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Cancel Previous Runs
+ # Only cancel non-master branch runs
+ if: ${{ github.ref != 'refs/heads/master' }}
+ uses: styfle/cancel-workflow-action@0.11.0
+ with:
+ access_token: ${{ github.token }}
+
+ test-runtimes:
runs-on: ubuntu-latest
steps:
- name: Free disk space
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 90df720ae6..c6bf2cd0ab 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -12,10 +12,6 @@ We welcome any types of contributions that can improve the project/network in an
The Astar Network project uses GitHub as the main source control hosting service. Most forms of communication regarding changes to the code will be done within the issue board of the repository.
-The core of Astar Network codebase is split into two repositories:
-* [Astar](https://github.com/AstarNetwork/Astar)
-* [astar-frame](https://github.com/AstarNetwork/astar-frame)
-
### Opening an Issue
Contributions within GitHub can take on the following forms:
@@ -32,7 +28,7 @@ In short:
1. Open an issue regarding a bug fix or feature request (fill in our issue templates)
2. Briefly describe how you plan to make changes to the code
-3. Fork the current default branch on _Astar_ or _astar-frame_ or both (depending on where you need to make changes)
+3. Fork the current default branch on _Astar_.
4. Open a pull request to the default branch (fill in our pull request template) and add the appropriate label.
5. Ensure all workflow checks have passed
6. Wait for the maintainers approval or change requests
@@ -75,7 +71,7 @@ The expected flow is:
### Contributor Licenses
-By contributing, you agree that your contributions will be licensed under the [GNU General Public License v3.0](https://github.com/AstarNetwork/astar-frame/blob/polkadot-v0.9.19/LICENSE) as is with the Astar source code. If you have any concerns regarding this matter, please contact the maintainer.
+By contributing, you agree that your contributions will be licensed under the [GNU General Public License v3.0](https://github.com/AstarNetwork/Astar/blob/master/LICENSE) as is with the Astar source code. If you have any concerns regarding this matter, please contact the maintainer.
## Community Contribution
diff --git a/Cargo.lock b/Cargo.lock
index 255f9d8f30..bf5dbf95d1 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -115,9 +115,9 @@ dependencies = [
[[package]]
name = "aes-gcm"
-version = "0.10.1"
+version = "0.10.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "82e1366e0c69c9f927b1fa5ce2c7bf9eafc8f9268c0b9800729e8b267612447c"
+checksum = "209b47e8954a928e1d72e86eca7000ebb6655fe1436d33eefc2201cad027e237"
dependencies = [
"aead 0.5.2",
"aes 0.8.2",
@@ -153,7 +153,7 @@ version = "0.7.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47"
dependencies = [
- "getrandom 0.2.9",
+ "getrandom 0.2.10",
"once_cell",
"version_check",
]
@@ -165,7 +165,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f"
dependencies = [
"cfg-if",
- "getrandom 0.2.9",
+ "getrandom 0.2.10",
"once_cell",
"version_check",
]
@@ -181,9 +181,9 @@ dependencies = [
[[package]]
name = "aho-corasick"
-version = "1.0.1"
+version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "67fc08ce920c31afb70f013dcce1bfc3a3195de6a228474e45e1f145b36f8d04"
+checksum = "43f6cb1bf222025340178f382c426f13757b2960e89779dfcb319c32542a5a41"
dependencies = [
"memchr",
]
@@ -194,6 +194,12 @@ version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4436e0292ab1bb631b42973c61205e704475fe8126af845c8d923c0996328127"
+[[package]]
+name = "android-tzdata"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0"
+
[[package]]
name = "android_system_properties"
version = "0.1.5"
@@ -308,9 +314,9 @@ checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b"
[[package]]
name = "arrayvec"
-version = "0.7.2"
+version = "0.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6"
+checksum = "8868f09ff8cea88b079da74ae569d9b8c62a23c68c746240b704ee6f7525c89c"
[[package]]
name = "asn1-rs"
@@ -325,7 +331,7 @@ dependencies = [
"num-traits",
"rusticata-macros",
"thiserror",
- "time 0.3.21",
+ "time 0.3.22",
]
[[package]]
@@ -341,7 +347,7 @@ dependencies = [
"num-traits",
"rusticata-macros",
"thiserror",
- "time 0.3.21",
+ "time 0.3.22",
]
[[package]]
@@ -394,7 +400,6 @@ checksum = "9b34d609dfbaf33d6889b2b7106d3ca345eacad44200913df5ba02bfd31d2ba9"
[[package]]
name = "assets-chain-extension-types"
version = "0.1.0"
-source = "git+https://github.com/AstarNetwork/astar-frame?branch=polkadot-v0.9.39#a3f214919bbbdefeb6962f528b35b5384626961d"
dependencies = [
"frame-system",
"pallet-contracts",
@@ -548,6 +553,7 @@ dependencies = [
"pallet-evm-precompile-assets-erc20",
"pallet-evm-precompile-blake2",
"pallet-evm-precompile-bn128",
+ "pallet-evm-precompile-dapps-staking",
"pallet-evm-precompile-dispatch",
"pallet-evm-precompile-ed25519",
"pallet-evm-precompile-modexp",
@@ -558,7 +564,6 @@ dependencies = [
"pallet-evm-precompile-xcm",
"pallet-identity",
"pallet-multisig",
- "pallet-precompile-dapps-staking",
"pallet-proxy",
"pallet-session",
"pallet-state-trie-migration",
@@ -612,9 +617,9 @@ dependencies = [
"log",
"parking",
"polling",
- "rustix 0.37.19",
+ "rustix 0.37.20",
"slab",
- "socket2",
+ "socket2 0.4.9",
"waker-fn",
]
@@ -635,7 +640,7 @@ checksum = "b9ccdd8f2a161be9bd5c023df56f1b2a0bd1d83872ae53b71a84a12c9bf6e842"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.15",
+ "syn 2.0.18",
]
[[package]]
@@ -697,7 +702,7 @@ dependencies = [
"cfg-if",
"libc",
"miniz_oxide 0.6.2",
- "object 0.30.3",
+ "object 0.30.4",
"rustc-demangle",
]
@@ -727,9 +732,9 @@ checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8"
[[package]]
name = "base64"
-version = "0.21.0"
+version = "0.21.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a4a4ddaa51a5bc52a6948f74c06d20aaaddb71924eab79b8c97a8c556e942d6a"
+checksum = "604178f6c5c21f02dc555784810edfb88d34ac2c73b2eae109655649ee73ce3d"
[[package]]
name = "base64ct"
@@ -861,7 +866,7 @@ version = "0.10.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe"
dependencies = [
- "digest 0.10.6",
+ "digest 0.10.7",
]
[[package]]
@@ -871,7 +876,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3c2f0dc9a68c6317d884f97cc36cf5a3d20ba14ce404227df55e1af708ab04bc"
dependencies = [
"arrayref",
- "arrayvec 0.7.2",
+ "arrayvec 0.7.3",
"constant_time_eq",
]
@@ -882,22 +887,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6637f448b9e61dfadbdcbae9a885fadee1f3eaffb1f8d3c1965d3ade8bdfd44f"
dependencies = [
"arrayref",
- "arrayvec 0.7.2",
+ "arrayvec 0.7.3",
"constant_time_eq",
]
[[package]]
name = "blake3"
-version = "1.3.3"
+version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "42ae2468a89544a466886840aa467a25b766499f4f04bf7d9fcd10ecee9fccef"
+checksum = "729b71f35bd3fa1a4c86b85d32c8b9069ea7fe14f7a53cfabb65f62d4265b888"
dependencies = [
"arrayref",
- "arrayvec 0.7.2",
+ "arrayvec 0.7.3",
"cc",
"cfg-if",
"constant_time_eq",
- "digest 0.10.6",
+ "digest 0.10.7",
]
[[package]]
@@ -957,9 +962,9 @@ checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae"
[[package]]
name = "bounded-collections"
-version = "0.1.6"
+version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e3888522b497857eb606bf51695988dba7096941822c1bcf676e3a929a9ae7a0"
+checksum = "eb5b05133427c07c4776906f673ccf36c21b102c9829c641a5b56bd151d44fd6"
dependencies = [
"log",
"parity-scale-codec",
@@ -984,9 +989,20 @@ checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3"
[[package]]
name = "bstr"
-version = "1.4.0"
+version = "0.2.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c3d4260bcc2e8fc9df1eac4919a720effeb63a3f0952f5bf4944adfa18897f09"
+checksum = "ba3569f383e8f1598449f1a423e72e99569137b47740b1da11ef19af3d5c3223"
+dependencies = [
+ "lazy_static",
+ "memchr",
+ "regex-automata",
+]
+
+[[package]]
+name = "bstr"
+version = "1.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a246e68bb43f6cd9db24bea052a53e40405417c5fb372e3d1a8a7f770a564ef5"
dependencies = [
"memchr",
"serde",
@@ -1003,9 +1019,9 @@ dependencies = [
[[package]]
name = "bumpalo"
-version = "3.12.2"
+version = "3.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3c6ed94e98ecff0c12dd1b04c15ec0d7d9458ca8fe806cea6f12954efe74c63b"
+checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1"
[[package]]
name = "byte-slice-cast"
@@ -1157,13 +1173,13 @@ dependencies = [
[[package]]
name = "chrono"
-version = "0.4.24"
+version = "0.4.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4e3c5919066adf22df73762e50cffcde3a758f2a848b113b586d1f86728b673b"
+checksum = "ec837a71355b28f6556dbd569b37b3f363091c0bd4b2e735674521b4c5fd9bc5"
dependencies = [
+ "android-tzdata",
"iana-time-zone",
"js-sys",
- "num-integer",
"num-traits",
"time 0.1.45",
"wasm-bindgen",
@@ -1233,9 +1249,9 @@ dependencies = [
[[package]]
name = "clap"
-version = "4.2.7"
+version = "4.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "34d21f9bf1b425d2968943631ec91202fe5e837264063503708b83013f8fc938"
+checksum = "ca8f255e4b8027970e78db75e78831229c9815fdbfa67eb1a1b777a62e24b4a0"
dependencies = [
"clap_builder",
"clap_derive",
@@ -1244,9 +1260,9 @@ dependencies = [
[[package]]
name = "clap_builder"
-version = "4.2.7"
+version = "4.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "914c8c79fb560f238ef6429439a30023c862f7a28e688c58f7203f12b29970bd"
+checksum = "acd4f3c17c83b0ba34ffbc4f8bbd74f079413f747f84a6f89292f138057e36ab"
dependencies = [
"anstream",
"anstyle",
@@ -1257,21 +1273,21 @@ dependencies = [
[[package]]
name = "clap_derive"
-version = "4.2.0"
+version = "4.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3f9644cd56d6b87dbe899ef8b053e331c0637664e9e21a33dfcdc36093f5c5c4"
+checksum = "b8cd2b2a819ad6eec39e8f1d6b53001af1e5469f8c177579cdaeb313115b825f"
dependencies = [
"heck",
"proc-macro2",
"quote",
- "syn 2.0.15",
+ "syn 2.0.18",
]
[[package]]
name = "clap_lex"
-version = "0.4.1"
+version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8a2dd5a6fe8c6e3502f568a6353e5273bbb15193ad9a89e457b9970798efbea1"
+checksum = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b"
[[package]]
name = "coarsetime"
@@ -1303,9 +1319,9 @@ checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7"
[[package]]
name = "comfy-table"
-version = "6.1.4"
+version = "6.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6e7b787b0dc42e8111badfdbe4c3059158ccb2db8780352fa1b01e8ccf45cc4d"
+checksum = "7e959d788268e3bf9d35ace83e81b124190378e4c91c9067524675e33394b8ba"
dependencies = [
"strum",
"strum_macros",
@@ -1321,6 +1337,18 @@ dependencies = [
"crossbeam-utils",
]
+[[package]]
+name = "console"
+version = "0.15.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c926e00cc70edefdc64d3a5ff31cc65bb97a3460097762bd23afb4d8145fccf8"
+dependencies = [
+ "encode_unicode",
+ "lazy_static",
+ "libc",
+ "windows-sys 0.45.0",
+]
+
[[package]]
name = "const-oid"
version = "0.9.2"
@@ -1329,9 +1357,9 @@ checksum = "520fbf3c07483f94e3e3ca9d0cfd913d7718ef2483d2cfd91c0d9e91474ab913"
[[package]]
name = "constant_time_eq"
-version = "0.2.5"
+version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "13418e745008f7349ec7e449155f419a61b92b58a99cc3616942b926825ec76b"
+checksum = "21a53c0a4d288377e7415b53dcfc3c04da5cdc2cc95c8d5ac178b58f0b861ad6"
[[package]]
name = "convert_case"
@@ -1407,7 +1435,7 @@ version = "0.93.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "253531aca9b6f56103c9420369db3263e784df39aa1c90685a1f69cfbba0623e"
dependencies = [
- "arrayvec 0.7.2",
+ "arrayvec 0.7.3",
"bumpalo",
"cranelift-bforest",
"cranelift-codegen-meta",
@@ -1538,14 +1566,14 @@ dependencies = [
[[package]]
name = "crossbeam-epoch"
-version = "0.9.14"
+version = "0.9.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "46bd5f3f85273295a9d14aedfb86f6aadbff6d8f5295c4a9edb08e819dcf5695"
+checksum = "ae211234986c545741a7dc064309f67ee1e5ad243d0e48335adc0484d960bcc7"
dependencies = [
"autocfg",
"cfg-if",
"crossbeam-utils",
- "memoffset 0.8.0",
+ "memoffset 0.9.0",
"scopeguard",
]
@@ -1561,9 +1589,9 @@ dependencies = [
[[package]]
name = "crossbeam-utils"
-version = "0.8.15"
+version = "0.8.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3c063cd8cc95f5c377ed0d4b49a4b21f632396ff690e8470c29b3359b346984b"
+checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294"
dependencies = [
"cfg-if",
]
@@ -2179,9 +2207,9 @@ dependencies = [
[[package]]
name = "cxx"
-version = "1.0.94"
+version = "1.0.95"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f61f1b6389c3fe1c316bf8a4dccc90a38208354b330925bce1f74a6c4756eb93"
+checksum = "109308c20e8445959c2792e81871054c6a17e6976489a93d2769641a2ba5839c"
dependencies = [
"cc",
"cxxbridge-flags",
@@ -2191,9 +2219,9 @@ dependencies = [
[[package]]
name = "cxx-build"
-version = "1.0.94"
+version = "1.0.95"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "12cee708e8962df2aeb38f594aae5d827c022b6460ac71a7a3e2c3c2aae5a07b"
+checksum = "daf4c6755cdf10798b97510e0e2b3edb9573032bd9379de8fffa59d68165494f"
dependencies = [
"cc",
"codespan-reporting",
@@ -2201,30 +2229,29 @@ dependencies = [
"proc-macro2",
"quote",
"scratch",
- "syn 2.0.15",
+ "syn 2.0.18",
]
[[package]]
name = "cxxbridge-flags"
-version = "1.0.94"
+version = "1.0.95"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7944172ae7e4068c533afbb984114a56c46e9ccddda550499caa222902c7f7bb"
+checksum = "882074421238e84fe3b4c65d0081de34e5b323bf64555d3e61991f76eb64a7bb"
[[package]]
name = "cxxbridge-macro"
-version = "1.0.94"
+version = "1.0.95"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2345488264226bf682893e25de0769f3360aac9957980ec49361b083ddaa5bc5"
+checksum = "4a076022ece33e7686fb76513518e219cca4fce5750a8ae6d1ce6c0f48fd1af9"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.15",
+ "syn 2.0.18",
]
[[package]]
name = "dapps-staking-chain-extension-types"
version = "1.1.0"
-source = "git+https://github.com/AstarNetwork/astar-frame?branch=polkadot-v0.9.39#a3f214919bbbdefeb6962f528b35b5384626961d"
dependencies = [
"frame-support",
"parity-scale-codec",
@@ -2270,15 +2297,15 @@ dependencies = [
[[package]]
name = "data-encoding"
-version = "2.3.3"
+version = "2.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "23d8666cb01533c39dde32bcbab8e227b4ed6679b2c925eba05feabea39508fb"
+checksum = "c2e66c9d817f1720209181c316d28635c050fa304f9c79e47a520882661b7308"
[[package]]
name = "data-encoding-macro"
-version = "0.1.12"
+version = "0.1.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "86927b7cd2fe88fa698b87404b287ab98d1a0063a34071d92e575b72d3029aca"
+checksum = "c904b33cc60130e1aeea4956ab803d08a3f4a0ca82d64ed757afac3891f2bb99"
dependencies = [
"data-encoding",
"data-encoding-macro-internal",
@@ -2286,9 +2313,9 @@ dependencies = [
[[package]]
name = "data-encoding-macro-internal"
-version = "0.1.10"
+version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a5bbed42daaa95e780b60a50546aa345b8413a1e46f9a40a12907d3598f038db"
+checksum = "8fdf3fce3ce863539ec1d7fd1b6dcc3c645663376b43ed376bbf887733e4f772"
dependencies = [
"data-encoding",
"syn 1.0.109",
@@ -2425,9 +2452,9 @@ dependencies = [
[[package]]
name = "digest"
-version = "0.10.6"
+version = "0.10.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f"
+checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
dependencies = [
"block-buffer 0.10.4",
"crypto-common",
@@ -2483,7 +2510,7 @@ checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.15",
+ "syn 2.0.18",
]
[[package]]
@@ -2595,7 +2622,7 @@ dependencies = [
"base16ct",
"crypto-bigint",
"der",
- "digest 0.10.6",
+ "digest 0.10.7",
"ff",
"generic-array 0.14.7",
"group",
@@ -2608,6 +2635,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.5.1"
@@ -2637,7 +2670,7 @@ checksum = "5e9a1f9f7d83e59740248a6e14ecf93929ade55027844dfcea78beafccc15745"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.15",
+ "syn 2.0.18",
]
[[package]]
@@ -2648,7 +2681,7 @@ checksum = "48016319042fb7c87b78d2993084a831793a897a5cd1a2a67cab9d1eeb4b7d76"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.15",
+ "syn 2.0.18",
]
[[package]]
@@ -2820,7 +2853,6 @@ dependencies = [
[[package]]
name = "evm-tracing-events"
version = "0.1.0"
-source = "git+https://github.com/AstarNetwork/astar-frame?branch=polkadot-v0.9.39#a3f214919bbbdefeb6962f528b35b5384626961d"
dependencies = [
"environmental",
"ethereum",
@@ -3163,9 +3195,9 @@ dependencies = [
[[package]]
name = "form_urlencoded"
-version = "1.1.0"
+version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a9c384f161156f5260c24a097c56119f9be8c798586aecc13afbcbe7b7e26bf8"
+checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652"
dependencies = [
"percent-encoding",
]
@@ -3639,7 +3671,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.15",
+ "syn 2.0.18",
]
[[package]]
@@ -3741,9 +3773,9 @@ dependencies = [
[[package]]
name = "getrandom"
-version = "0.2.9"
+version = "0.2.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c85e1d9ab2eadba7e5040d4e09cbd6d072b76a557ad64e797c2cb9d4da21d7e4"
+checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427"
dependencies = [
"cfg-if",
"libc",
@@ -3800,7 +3832,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "029d74589adefde59de1a0c4f4732695c32805624aec7b68d91503d4dba79afc"
dependencies = [
"aho-corasick 0.7.20",
- "bstr",
+ "bstr 1.5.0",
"fnv",
"log",
"regex",
@@ -3819,9 +3851,9 @@ dependencies = [
[[package]]
name = "h2"
-version = "0.3.18"
+version = "0.3.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "17f8a914c2987b688368b5138aa05321db91f4090cf26118185672ad588bce21"
+checksum = "d357c7ae988e7d2182f7d7871d0b963962420b0678b0997ce7de72001aeab782"
dependencies = [
"bytes",
"fnv",
@@ -3838,9 +3870,9 @@ dependencies = [
[[package]]
name = "handlebars"
-version = "4.3.6"
+version = "4.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "035ef95d03713f2c347a72547b7cd38cbc9af7cd51e6099fb62d586d4a6dee3a"
+checksum = "83c3372087601b532857d332f5957cbae686da52bb7810bf038c3e3c3cc2fa0d"
dependencies = [
"log",
"pest",
@@ -3969,7 +4001,7 @@ version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e"
dependencies = [
- "digest 0.10.6",
+ "digest 0.10.7",
]
[[package]]
@@ -4057,7 +4089,7 @@ dependencies = [
"httpdate",
"itoa",
"pin-project-lite 0.2.9",
- "socket2",
+ "socket2 0.4.9",
"tokio",
"tower-service",
"tracing",
@@ -4081,9 +4113,9 @@ dependencies = [
[[package]]
name = "iana-time-zone"
-version = "0.1.56"
+version = "0.1.57"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0722cd7114b7de04316e7ea5456a0bbb20e4adb46fd27a3697adb812cff0f37c"
+checksum = "2fad5b825842d2b38bd206f3e81d6957625fd7f0a361e345c30e01a0ae2dd613"
dependencies = [
"android_system_properties",
"core-foundation-sys",
@@ -4095,12 +4127,11 @@ dependencies = [
[[package]]
name = "iana-time-zone-haiku"
-version = "0.1.1"
+version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0703ae284fc167426161c2e3f1da3ea71d94b21bedbcc9494e92b28e334e3dca"
+checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f"
dependencies = [
- "cxx",
- "cxx-build",
+ "cc",
]
[[package]]
@@ -4122,9 +4153,9 @@ dependencies = [
[[package]]
name = "idna"
-version = "0.3.0"
+version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e14ddfc70884202db2244c223200c204c2bda1bc6e0998d11b5e024d657209e6"
+checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c"
dependencies = [
"unicode-bidi",
"unicode-normalization",
@@ -4286,9 +4317,9 @@ dependencies = [
[[package]]
name = "io-lifetimes"
-version = "1.0.10"
+version = "1.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9c66c74d2ae7e79a5a8f7ac924adbe38ee42a859c6539ad869eb51f0b52dc220"
+checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2"
dependencies = [
"hermit-abi 0.3.1",
"libc",
@@ -4303,13 +4334,13 @@ checksum = "aa2f047c0a98b2f299aa5d6d7088443570faae494e9ae1305e48be000c9e0eb1"
[[package]]
name = "ipconfig"
-version = "0.3.1"
+version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bd302af1b90f2463a98fa5ad469fc212c8e3175a41c3068601bfa2727591c5be"
+checksum = "b58db92f96b720de98181bbbe63c831e87005ab460c1bf306eb2622b4707997f"
dependencies = [
- "socket2",
+ "socket2 0.5.3",
"widestring",
- "winapi",
+ "windows-sys 0.48.0",
"winreg",
]
@@ -4327,7 +4358,7 @@ checksum = "adcf93614601c8129ddf72e2d5633df827ba6551541c6d8c59520a371475be1f"
dependencies = [
"hermit-abi 0.3.1",
"io-lifetimes",
- "rustix 0.37.19",
+ "rustix 0.37.20",
"windows-sys 0.48.0",
]
@@ -4357,9 +4388,9 @@ dependencies = [
[[package]]
name = "js-sys"
-version = "0.3.62"
+version = "0.3.64"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "68c16e1bfd491478ab155fd8b4896b86f9ede344949b641e61501e07c2b8b4d5"
+checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a"
dependencies = [
"wasm-bindgen",
]
@@ -4406,7 +4437,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a4e70b4439a751a5de7dd5ed55eacff78ebf4ffe0fc009cb1ebb11417f5b536b"
dependencies = [
"anyhow",
- "arrayvec 0.7.2",
+ "arrayvec 0.7.3",
"async-lock",
"async-trait",
"beef",
@@ -4671,9 +4702,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
[[package]]
name = "libc"
-version = "0.2.144"
+version = "0.2.146"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2b00cc1c228a6782d0f076e7b232802e0c5689d41bb5df366f2a6b6621cfdfe1"
+checksum = "f92be4933c13fd498862a9e02a3055f8a8d9c039ce33db97306fd5a6caa7f29b"
[[package]]
name = "libloading"
@@ -4693,9 +4724,9 @@ checksum = "7fc7aa29613bd6a620df431842069224d8bc9011086b1db4c0e0cd47fa03ec9a"
[[package]]
name = "libm"
-version = "0.2.6"
+version = "0.2.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "348108ab3fba42ec82ff6e9564fc4ca0247bdccdc68dd8af9764bbc79c3c8ffb"
+checksum = "f7012b1bbb0719e1097c47611d3898568c546d597c2e74d66f6087edd5233ff4"
[[package]]
name = "libp2p"
@@ -4706,7 +4737,7 @@ dependencies = [
"bytes",
"futures 0.3.28",
"futures-timer",
- "getrandom 0.2.9",
+ "getrandom 0.2.10",
"instant",
"libp2p-core 0.38.0",
"libp2p-dns",
@@ -4852,7 +4883,7 @@ version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2766dcd2be8c87d5e1f35487deb22d765f49c6ae1251b3633efe3b25698bd3d2"
dependencies = [
- "arrayvec 0.7.2",
+ "arrayvec 0.7.3",
"asynchronous-codec",
"bytes",
"either",
@@ -4888,7 +4919,7 @@ dependencies = [
"log",
"rand 0.8.5",
"smallvec",
- "socket2",
+ "socket2 0.4.9",
"tokio",
"trust-dns-proto",
"void",
@@ -5049,7 +5080,7 @@ dependencies = [
"libc",
"libp2p-core 0.38.0",
"log",
- "socket2",
+ "socket2 0.4.9",
"tokio",
]
@@ -5265,9 +5296,9 @@ checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4"
[[package]]
name = "linux-raw-sys"
-version = "0.3.7"
+version = "0.3.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ece97ea872ece730aed82664c424eb4c8291e1ff2480247ccf7409044bc6479f"
+checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519"
[[package]]
name = "local-runtime"
@@ -5306,6 +5337,7 @@ dependencies = [
"pallet-evm-precompile-assets-erc20",
"pallet-evm-precompile-blake2",
"pallet-evm-precompile-bn128",
+ "pallet-evm-precompile-dapps-staking",
"pallet-evm-precompile-dispatch",
"pallet-evm-precompile-ed25519",
"pallet-evm-precompile-modexp",
@@ -5316,7 +5348,6 @@ dependencies = [
"pallet-evm-precompile-xvm",
"pallet-grandpa",
"pallet-insecure-randomness-collective-flip",
- "pallet-precompile-dapps-staking",
"pallet-preimage",
"pallet-proxy",
"pallet-scheduler",
@@ -5346,9 +5377,9 @@ dependencies = [
[[package]]
name = "lock_api"
-version = "0.4.9"
+version = "0.4.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df"
+checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16"
dependencies = [
"autocfg",
"scopeguard",
@@ -5356,12 +5387,9 @@ dependencies = [
[[package]]
name = "log"
-version = "0.4.17"
+version = "0.4.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e"
-dependencies = [
- "cfg-if",
-]
+checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4"
[[package]]
name = "lru"
@@ -5456,7 +5484,7 @@ version = "0.10.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6365506850d44bff6e2fbcb5176cf63650e48bd45ef2fe2665ae1570e0f4b9ca"
dependencies = [
- "digest 0.10.6",
+ "digest 0.10.7",
]
[[package]]
@@ -5471,7 +5499,7 @@ version = "0.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ffc89ccdc6e10d6907450f753537ebc5c5d3460d2e4e62ea74bd571db62c0f9e"
dependencies = [
- "rustix 0.37.19",
+ "rustix 0.37.20",
]
[[package]]
@@ -5503,9 +5531,9 @@ dependencies = [
[[package]]
name = "memoffset"
-version = "0.8.0"
+version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d61c719bcfbcf5d62b3a09efa6088de8c54bc0bfcd3ea7ae39fcc186108b8de1"
+checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c"
dependencies = [
"autocfg",
]
@@ -5575,14 +5603,13 @@ dependencies = [
[[package]]
name = "mio"
-version = "0.8.6"
+version = "0.8.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5b9d9a46eff5b4ff64b45a9e316a6d1e0bc719ef429cbec4dc630684212bfdf9"
+checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2"
dependencies = [
"libc",
- "log",
"wasi 0.11.0+wasi-snapshot-preview1",
- "windows-sys 0.45.0",
+ "windows-sys 0.48.0",
]
[[package]]
@@ -5650,7 +5677,6 @@ dependencies = [
[[package]]
name = "moonbeam-client-evm-tracing"
version = "0.1.0"
-source = "git+https://github.com/AstarNetwork/astar-frame?branch=polkadot-v0.9.39#a3f214919bbbdefeb6962f528b35b5384626961d"
dependencies = [
"ethereum-types",
"evm-tracing-events",
@@ -5665,7 +5691,6 @@ dependencies = [
[[package]]
name = "moonbeam-evm-tracer"
version = "0.1.0"
-source = "git+https://github.com/AstarNetwork/astar-frame?branch=polkadot-v0.9.39#a3f214919bbbdefeb6962f528b35b5384626961d"
dependencies = [
"ethereum-types",
"evm",
@@ -5685,7 +5710,6 @@ dependencies = [
[[package]]
name = "moonbeam-primitives-ext"
version = "0.1.0"
-source = "git+https://github.com/AstarNetwork/astar-frame?branch=polkadot-v0.9.39#a3f214919bbbdefeb6962f528b35b5384626961d"
dependencies = [
"ethereum-types",
"evm-tracing-events",
@@ -5698,7 +5722,6 @@ dependencies = [
[[package]]
name = "moonbeam-rpc-core-debug"
version = "0.1.0"
-source = "git+https://github.com/AstarNetwork/astar-frame?branch=polkadot-v0.9.39#a3f214919bbbdefeb6962f528b35b5384626961d"
dependencies = [
"ethereum-types",
"futures 0.3.28",
@@ -5713,7 +5736,6 @@ dependencies = [
[[package]]
name = "moonbeam-rpc-core-trace"
version = "0.6.0"
-source = "git+https://github.com/AstarNetwork/astar-frame?branch=polkadot-v0.9.39#a3f214919bbbdefeb6962f528b35b5384626961d"
dependencies = [
"ethereum-types",
"futures 0.3.28",
@@ -5727,7 +5749,6 @@ dependencies = [
[[package]]
name = "moonbeam-rpc-core-txpool"
version = "0.6.0"
-source = "git+https://github.com/AstarNetwork/astar-frame?branch=polkadot-v0.9.39#a3f214919bbbdefeb6962f528b35b5384626961d"
dependencies = [
"ethereum",
"ethereum-types",
@@ -5740,7 +5761,6 @@ dependencies = [
[[package]]
name = "moonbeam-rpc-core-types"
version = "0.1.0"
-source = "git+https://github.com/AstarNetwork/astar-frame?branch=polkadot-v0.9.39#a3f214919bbbdefeb6962f528b35b5384626961d"
dependencies = [
"ethereum-types",
"serde",
@@ -5750,7 +5770,6 @@ dependencies = [
[[package]]
name = "moonbeam-rpc-debug"
version = "0.1.0"
-source = "git+https://github.com/AstarNetwork/astar-frame?branch=polkadot-v0.9.39#a3f214919bbbdefeb6962f528b35b5384626961d"
dependencies = [
"ethereum",
"ethereum-types",
@@ -5760,7 +5779,7 @@ dependencies = [
"fc-storage",
"fp-rpc",
"futures 0.3.28",
- "hex-literal 0.3.4",
+ "hex-literal 0.4.1",
"jsonrpsee",
"moonbeam-client-evm-tracing",
"moonbeam-rpc-core-debug",
@@ -5780,7 +5799,6 @@ dependencies = [
[[package]]
name = "moonbeam-rpc-primitives-debug"
version = "0.1.0"
-source = "git+https://github.com/AstarNetwork/astar-frame?branch=polkadot-v0.9.39#a3f214919bbbdefeb6962f528b35b5384626961d"
dependencies = [
"environmental",
"ethereum",
@@ -5799,7 +5817,6 @@ dependencies = [
[[package]]
name = "moonbeam-rpc-primitives-txpool"
version = "0.6.0"
-source = "git+https://github.com/AstarNetwork/astar-frame?branch=polkadot-v0.9.39#a3f214919bbbdefeb6962f528b35b5384626961d"
dependencies = [
"ethereum",
"parity-scale-codec",
@@ -5812,7 +5829,6 @@ dependencies = [
[[package]]
name = "moonbeam-rpc-trace"
version = "0.6.0"
-source = "git+https://github.com/AstarNetwork/astar-frame?branch=polkadot-v0.9.39#a3f214919bbbdefeb6962f528b35b5384626961d"
dependencies = [
"ethereum",
"ethereum-types",
@@ -5846,7 +5862,6 @@ dependencies = [
[[package]]
name = "moonbeam-rpc-txpool"
version = "0.6.0"
-source = "git+https://github.com/AstarNetwork/astar-frame?branch=polkadot-v0.9.39#a3f214919bbbdefeb6962f528b35b5384626961d"
dependencies = [
"ethereum-types",
"fc-rpc",
@@ -5924,7 +5939,7 @@ dependencies = [
"blake2s_simd",
"blake3",
"core2",
- "digest 0.10.6",
+ "digest 0.10.7",
"multihash-derive",
"sha2 0.10.6",
"sha3",
@@ -6172,7 +6187,7 @@ version = "0.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a652d9771a63711fd3c3deb670acfbe5c30a4072e664d7a3bf5a9e1056ac72c3"
dependencies = [
- "arrayvec 0.7.2",
+ "arrayvec 0.7.3",
"itoa",
]
@@ -6263,9 +6278,9 @@ dependencies = [
[[package]]
name = "object"
-version = "0.30.3"
+version = "0.30.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ea86265d3d3dcb6a27fc51bd29a4bf387fae9d2986b823079d4986af253eb439"
+checksum = "03b4680b86d9cfafba8fc491dc9b6df26b68cf40e9e6cd73909194759a63c385"
dependencies = [
"memchr",
]
@@ -6290,9 +6305,9 @@ dependencies = [
[[package]]
name = "once_cell"
-version = "1.17.1"
+version = "1.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3"
+checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d"
[[package]]
name = "opaque-debug"
@@ -6633,15 +6648,17 @@ dependencies = [
[[package]]
name = "pallet-block-reward"
version = "2.2.2"
-source = "git+https://github.com/AstarNetwork/astar-frame?branch=polkadot-v0.9.39#a3f214919bbbdefeb6962f528b35b5384626961d"
dependencies = [
"frame-benchmarking",
"frame-support",
"frame-system",
+ "pallet-balances",
+ "pallet-timestamp",
"parity-scale-codec",
"scale-info",
"serde",
"sp-arithmetic",
+ "sp-core",
"sp-runtime",
"sp-std",
]
@@ -6667,7 +6684,6 @@ dependencies = [
[[package]]
name = "pallet-chain-extension-assets"
version = "0.1.0"
-source = "git+https://github.com/AstarNetwork/astar-frame?branch=polkadot-v0.9.39#a3f214919bbbdefeb6962f528b35b5384626961d"
dependencies = [
"assets-chain-extension-types",
"frame-support",
@@ -6687,7 +6703,6 @@ dependencies = [
[[package]]
name = "pallet-chain-extension-dapps-staking"
version = "1.1.0"
-source = "git+https://github.com/AstarNetwork/astar-frame?branch=polkadot-v0.9.39#a3f214919bbbdefeb6962f528b35b5384626961d"
dependencies = [
"dapps-staking-chain-extension-types",
"frame-support",
@@ -6707,7 +6722,6 @@ dependencies = [
[[package]]
name = "pallet-chain-extension-xvm"
version = "0.1.0"
-source = "git+https://github.com/AstarNetwork/astar-frame?branch=polkadot-v0.9.39#a3f214919bbbdefeb6962f528b35b5384626961d"
dependencies = [
"frame-support",
"frame-system",
@@ -6746,21 +6760,27 @@ dependencies = [
[[package]]
name = "pallet-collator-selection"
version = "3.3.2"
-source = "git+https://github.com/AstarNetwork/astar-frame?branch=polkadot-v0.9.39#a3f214919bbbdefeb6962f528b35b5384626961d"
dependencies = [
"frame-benchmarking",
"frame-support",
"frame-system",
"log",
+ "pallet-aura",
"pallet-authorship",
+ "pallet-balances",
"pallet-session",
+ "pallet-timestamp",
"parity-scale-codec",
"rand 0.8.5",
"scale-info",
"serde",
+ "sp-consensus-aura",
+ "sp-core",
+ "sp-io",
"sp-runtime",
"sp-staking",
"sp-std",
+ "sp-tracing",
]
[[package]]
@@ -6809,6 +6829,20 @@ dependencies = [
"wasmparser-nostd",
]
+[[package]]
+name = "pallet-contracts-migration"
+version = "1.0.0"
+dependencies = [
+ "frame-support",
+ "frame-system",
+ "pallet-contracts",
+ "parity-scale-codec",
+ "scale-info",
+ "sp-arithmetic",
+ "sp-runtime",
+ "sp-std",
+]
+
[[package]]
name = "pallet-contracts-primitives"
version = "7.0.0"
@@ -6852,15 +6886,19 @@ dependencies = [
[[package]]
name = "pallet-custom-signatures"
version = "4.6.0"
-source = "git+https://github.com/AstarNetwork/astar-frame?branch=polkadot-v0.9.39#a3f214919bbbdefeb6962f528b35b5384626961d"
dependencies = [
+ "assert_matches",
"frame-support",
"frame-system",
+ "hex-literal 0.4.1",
+ "libsecp256k1",
+ "pallet-balances",
"parity-scale-codec",
"scale-info",
"serde",
"sp-core",
"sp-io",
+ "sp-keyring",
"sp-runtime",
"sp-std",
]
@@ -6868,12 +6906,14 @@ dependencies = [
[[package]]
name = "pallet-dapps-staking"
version = "3.9.0"
-source = "git+https://github.com/AstarNetwork/astar-frame?branch=polkadot-v0.9.39#a3f214919bbbdefeb6962f528b35b5384626961d"
dependencies = [
"frame-benchmarking",
"frame-support",
"frame-system",
"num-traits",
+ "pallet-balances",
+ "pallet-session",
+ "pallet-timestamp",
"parity-scale-codec",
"scale-info",
"serde",
@@ -7021,8 +7061,8 @@ dependencies = [
[[package]]
name = "pallet-evm-precompile-assets-erc20"
version = "0.5.2"
-source = "git+https://github.com/AstarNetwork/astar-frame?branch=polkadot-v0.9.39#a3f214919bbbdefeb6962f528b35b5384626961d"
dependencies = [
+ "derive_more",
"fp-evm",
"frame-support",
"frame-system",
@@ -7031,8 +7071,12 @@ dependencies = [
"pallet-assets",
"pallet-balances",
"pallet-evm",
+ "pallet-timestamp",
"parity-scale-codec",
"precompile-utils",
+ "scale-info",
+ "serde",
+ "sha3",
"slices",
"sp-core",
"sp-io",
@@ -7058,6 +7102,31 @@ dependencies = [
"substrate-bn",
]
+[[package]]
+name = "pallet-evm-precompile-dapps-staking"
+version = "3.6.3"
+dependencies = [
+ "derive_more",
+ "fp-evm",
+ "frame-support",
+ "frame-system",
+ "log",
+ "num_enum",
+ "pallet-balances",
+ "pallet-dapps-staking",
+ "pallet-evm",
+ "pallet-timestamp",
+ "parity-scale-codec",
+ "precompile-utils",
+ "scale-info",
+ "serde",
+ "sha3",
+ "sp-core",
+ "sp-io",
+ "sp-runtime",
+ "sp-std",
+]
+
[[package]]
name = "pallet-evm-precompile-dispatch"
version = "2.0.0-dev"
@@ -7108,72 +7177,100 @@ dependencies = [
[[package]]
name = "pallet-evm-precompile-sr25519"
version = "1.2.1"
-source = "git+https://github.com/AstarNetwork/astar-frame?branch=polkadot-v0.9.39#a3f214919bbbdefeb6962f528b35b5384626961d"
dependencies = [
+ "derive_more",
"fp-evm",
+ "frame-support",
+ "frame-system",
+ "hex-literal 0.4.1",
"log",
"num_enum",
+ "pallet-balances",
"pallet-evm",
+ "pallet-timestamp",
"parity-scale-codec",
"precompile-utils",
+ "scale-info",
+ "serde",
"sp-core",
"sp-io",
+ "sp-runtime",
"sp-std",
]
[[package]]
name = "pallet-evm-precompile-substrate-ecdsa"
version = "1.2.2"
-source = "git+https://github.com/AstarNetwork/astar-frame?branch=polkadot-v0.9.39#a3f214919bbbdefeb6962f528b35b5384626961d"
dependencies = [
+ "derive_more",
"fp-evm",
+ "frame-support",
+ "frame-system",
+ "hex-literal 0.4.1",
"log",
"num_enum",
+ "pallet-balances",
"pallet-evm",
+ "pallet-timestamp",
"parity-scale-codec",
"precompile-utils",
+ "scale-info",
+ "serde",
"sp-core",
"sp-io",
+ "sp-runtime",
"sp-std",
]
[[package]]
name = "pallet-evm-precompile-xcm"
version = "0.9.0"
-source = "git+https://github.com/AstarNetwork/astar-frame?branch=polkadot-v0.9.39#a3f214919bbbdefeb6962f528b35b5384626961d"
dependencies = [
+ "derive_more",
"fp-evm",
"frame-support",
"frame-system",
+ "hex-literal 0.4.1",
"log",
"num_enum",
"pallet-assets",
+ "pallet-balances",
"pallet-evm",
"pallet-evm-precompile-assets-erc20",
+ "pallet-timestamp",
"pallet-xcm 0.9.39",
"parity-scale-codec",
"precompile-utils",
+ "scale-info",
+ "serde",
"sp-core",
"sp-io",
+ "sp-runtime",
"sp-std",
"xcm",
+ "xcm-builder",
"xcm-executor",
]
[[package]]
name = "pallet-evm-precompile-xvm"
version = "0.1.0"
-source = "git+https://github.com/AstarNetwork/astar-frame?branch=polkadot-v0.9.39#a3f214919bbbdefeb6962f528b35b5384626961d"
dependencies = [
+ "derive_more",
"fp-evm",
"frame-support",
"frame-system",
+ "hex-literal 0.4.1",
"log",
"num_enum",
+ "pallet-balances",
"pallet-evm",
+ "pallet-timestamp",
"pallet-xvm",
"parity-scale-codec",
"precompile-utils",
+ "scale-info",
+ "serde",
"sp-core",
"sp-io",
"sp-runtime",
@@ -7443,26 +7540,6 @@ dependencies = [
"sp-std",
]
-[[package]]
-name = "pallet-precompile-dapps-staking"
-version = "3.6.3"
-source = "git+https://github.com/AstarNetwork/astar-frame?branch=polkadot-v0.9.39#a3f214919bbbdefeb6962f528b35b5384626961d"
-dependencies = [
- "fp-evm",
- "frame-support",
- "frame-system",
- "log",
- "num_enum",
- "pallet-dapps-staking",
- "pallet-evm",
- "parity-scale-codec",
- "precompile-utils",
- "scale-info",
- "sp-core",
- "sp-runtime",
- "sp-std",
-]
-
[[package]]
name = "pallet-preimage"
version = "4.0.0-dev"
@@ -7845,15 +7922,17 @@ dependencies = [
[[package]]
name = "pallet-xc-asset-config"
version = "1.3.0"
-source = "git+https://github.com/AstarNetwork/astar-frame?branch=polkadot-v0.9.39#a3f214919bbbdefeb6962f528b35b5384626961d"
dependencies = [
"frame-benchmarking",
"frame-support",
"frame-system",
"log",
+ "pallet-balances",
+ "pallet-timestamp",
"parity-scale-codec",
"scale-info",
"serde",
+ "sp-core",
"sp-io",
"sp-runtime",
"sp-std",
@@ -7884,14 +7963,16 @@ dependencies = [
[[package]]
name = "pallet-xcm"
version = "0.9.39"
-source = "git+https://github.com/AstarNetwork/astar-frame?branch=polkadot-v0.9.39#a3f214919bbbdefeb6962f528b35b5384626961d"
dependencies = [
"bounded-collections",
"frame-benchmarking",
"frame-support",
"frame-system",
"log",
+ "pallet-balances",
"parity-scale-codec",
+ "polkadot-parachain",
+ "polkadot-runtime-parachains",
"scale-info",
"serde",
"sp-core",
@@ -7899,6 +7980,7 @@ dependencies = [
"sp-runtime",
"sp-std",
"xcm",
+ "xcm-builder",
"xcm-executor",
]
@@ -7924,8 +8006,8 @@ dependencies = [
[[package]]
name = "pallet-xvm"
version = "0.2.1"
-source = "git+https://github.com/AstarNetwork/astar-frame?branch=polkadot-v0.9.39#a3f214919bbbdefeb6962f528b35b5384626961d"
dependencies = [
+ "frame-benchmarking",
"frame-support",
"frame-system",
"impl-trait-for-tuples",
@@ -7954,9 +8036,9 @@ dependencies = [
[[package]]
name = "parity-db"
-version = "0.4.7"
+version = "0.4.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bd4572a52711e2ccff02b4973ec7e4a5b5c23387ebbfbd6cd42b34755714cefc"
+checksum = "4890dcb9556136a4ec2b0c51fa4a08c8b733b829506af8fff2e853f3a065985b"
dependencies = [
"blake2",
"crc32fast",
@@ -7978,7 +8060,7 @@ version = "3.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5ddb756ca205bd108aee3c62c6d3c994e1df84a59b9d6d4a5ea42ee1fd5a9a28"
dependencies = [
- "arrayvec 0.7.2",
+ "arrayvec 0.7.3",
"bitvec",
"byte-slice-cast",
"bytes",
@@ -8035,7 +8117,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f"
dependencies = [
"lock_api",
- "parking_lot_core 0.9.7",
+ "parking_lot_core 0.9.8",
]
[[package]]
@@ -8054,15 +8136,15 @@ dependencies = [
[[package]]
name = "parking_lot_core"
-version = "0.9.7"
+version = "0.9.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9069cbb9f99e3a5083476ccb29ceb1de18b9118cafa53e90c9551235de2b9521"
+checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447"
dependencies = [
"cfg-if",
"libc",
- "redox_syscall 0.2.16",
+ "redox_syscall 0.3.5",
"smallvec",
- "windows-sys 0.45.0",
+ "windows-targets 0.48.0",
]
[[package]]
@@ -8086,7 +8168,7 @@ version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917"
dependencies = [
- "digest 0.10.6",
+ "digest 0.10.7",
]
[[package]]
@@ -8115,9 +8197,9 @@ dependencies = [
[[package]]
name = "percent-encoding"
-version = "2.2.0"
+version = "2.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e"
+checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94"
[[package]]
name = "pest"
@@ -8149,7 +8231,7 @@ dependencies = [
"pest_meta",
"proc-macro2",
"quote",
- "syn 2.0.15",
+ "syn 2.0.18",
]
[[package]]
@@ -8175,22 +8257,22 @@ dependencies = [
[[package]]
name = "pin-project"
-version = "1.0.12"
+version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ad29a609b6bcd67fee905812e544992d216af9d755757c05ed2d0e15a74c6ecc"
+checksum = "c95a7476719eab1e366eaf73d0260af3021184f18177925b07f54b30089ceead"
dependencies = [
"pin-project-internal",
]
[[package]]
name = "pin-project-internal"
-version = "1.0.12"
+version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "069bdb1e05adc7a8990dce9cc75370895fbe4e3d58b9b73bf1aee56359344a55"
+checksum = "39407670928234ebc5e6e580247dd567ad73a3578460c5990f9503df207e8f07"
dependencies = [
"proc-macro2",
"quote",
- "syn 1.0.109",
+ "syn 2.0.18",
]
[[package]]
@@ -9432,7 +9514,7 @@ dependencies = [
"cfg-if",
"cpufeatures",
"opaque-debug 0.3.0",
- "universal-hash 0.5.0",
+ "universal-hash 0.5.1",
]
[[package]]
@@ -9444,13 +9526,13 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de"
[[package]]
name = "precompile-utils"
version = "0.4.3"
-source = "git+https://github.com/AstarNetwork/astar-frame?branch=polkadot-v0.9.39#a3f214919bbbdefeb6962f528b35b5384626961d"
dependencies = [
"assert_matches",
"evm",
"fp-evm",
"frame-support",
"frame-system",
+ "hex-literal 0.4.1",
"impl-trait-for-tuples",
"log",
"num_enum",
@@ -9458,6 +9540,7 @@ dependencies = [
"parity-scale-codec",
"precompile-utils-macro",
"sha3",
+ "similar-asserts",
"sp-core",
"sp-io",
"sp-runtime",
@@ -9468,7 +9551,6 @@ dependencies = [
[[package]]
name = "precompile-utils-macro"
version = "0.1.0"
-source = "git+https://github.com/AstarNetwork/astar-frame?branch=polkadot-v0.9.39#a3f214919bbbdefeb6962f528b35b5384626961d"
dependencies = [
"num_enum",
"proc-macro2",
@@ -9583,9 +9665,9 @@ dependencies = [
[[package]]
name = "proc-macro2"
-version = "1.0.56"
+version = "1.0.60"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2b63bdb0cd06f1f4dedf69b254734f9b45af66e4a031e42a7480257d9898b435"
+checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406"
dependencies = [
"unicode-ident",
]
@@ -9749,9 +9831,9 @@ dependencies = [
[[package]]
name = "quote"
-version = "1.0.27"
+version = "1.0.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8f4f29d145265ec1c483c7c654450edde0bfe043d3938d6972630663356d9500"
+checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488"
dependencies = [
"proc-macro2",
]
@@ -9821,7 +9903,7 @@ version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
dependencies = [
- "getrandom 0.2.9",
+ "getrandom 0.2.10",
]
[[package]]
@@ -9878,7 +9960,7 @@ checksum = "6413f3de1edee53342e6138e75b56d32e7bc6e332b3bd62d497b1929d4cfbcdd"
dependencies = [
"pem",
"ring",
- "time 0.3.21",
+ "time 0.3.22",
"x509-parser 0.13.2",
"yasna",
]
@@ -9891,7 +9973,7 @@ checksum = "ffbe84efe2f38dea12e9bfc1f65377fdf03e53a18cb3b995faedf7934c7e785b"
dependencies = [
"pem",
"ring",
- "time 0.3.21",
+ "time 0.3.22",
"yasna",
]
@@ -9919,7 +10001,7 @@ version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b"
dependencies = [
- "getrandom 0.2.9",
+ "getrandom 0.2.10",
"redox_syscall 0.2.16",
"thiserror",
]
@@ -9954,7 +10036,7 @@ checksum = "8d2275aab483050ab2a7364c1a46604865ee7d6906684e08db0f090acf74f9e7"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.15",
+ "syn 2.0.18",
]
[[package]]
@@ -9971,13 +10053,13 @@ dependencies = [
[[package]]
name = "regex"
-version = "1.8.1"
+version = "1.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "af83e617f331cc6ae2da5443c602dfa5af81e517212d9d611a5b3ba1777b5370"
+checksum = "d0ab3ca65655bb1e41f2a8c8cd662eb4fb035e67c3f78da1d61dffe89d07300f"
dependencies = [
- "aho-corasick 1.0.1",
+ "aho-corasick 1.0.2",
"memchr",
- "regex-syntax 0.7.1",
+ "regex-syntax 0.7.2",
]
[[package]]
@@ -9997,9 +10079,9 @@ checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1"
[[package]]
name = "regex-syntax"
-version = "0.7.1"
+version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a5996294f19bd3aae0453a862ad728f60e6600695733dd5df01da90c54363a3c"
+checksum = "436b050e76ed2903236f032a59761c1eb99e1b0aead2c257922771dab1fc8c78"
[[package]]
name = "region"
@@ -10055,7 +10137,7 @@ version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bd124222d17ad93a644ed9d011a40f4fb64aa54275c08cc216524a9ea82fb09f"
dependencies = [
- "digest 0.10.6",
+ "digest 0.10.7",
]
[[package]]
@@ -10298,9 +10380,9 @@ dependencies = [
[[package]]
name = "rustix"
-version = "0.36.13"
+version = "0.36.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3a38f9520be93aba504e8ca974197f46158de5dcaa9fa04b57c57cd6a679d658"
+checksum = "14e4d67015953998ad0eb82887a0eb0129e18a7e2f3b7b0f6c422fddcd503d62"
dependencies = [
"bitflags",
"errno",
@@ -10312,15 +10394,15 @@ dependencies = [
[[package]]
name = "rustix"
-version = "0.37.19"
+version = "0.37.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "acf8729d8542766f1b2cf77eb034d52f40d375bb8b615d0b147089946e16613d"
+checksum = "b96e891d04aa506a6d1f318d2771bcb1c7dfda84e126660ace067c9b474bb2c0"
dependencies = [
"bitflags",
"errno",
"io-lifetimes",
"libc",
- "linux-raw-sys 0.3.7",
+ "linux-raw-sys 0.3.8",
"windows-sys 0.48.0",
]
@@ -10367,7 +10449,7 @@ version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d194b56d58803a43635bdc398cd17e383d6f71f9182b9a192c127ca42494a59b"
dependencies = [
- "base64 0.21.0",
+ "base64 0.21.2",
]
[[package]]
@@ -10404,9 +10486,9 @@ dependencies = [
[[package]]
name = "safe_arch"
-version = "0.6.0"
+version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "794821e4ccb0d9f979512f9c1973480123f9bd62a90d74ab0f9426fcf8f4a529"
+checksum = "62a7484307bd40f8f7ccbacccac730108f2cae119a3b11c74485b48aa9ea650f"
dependencies = [
"bytemuck",
]
@@ -10826,7 +10908,7 @@ dependencies = [
"libc",
"log",
"once_cell",
- "rustix 0.36.13",
+ "rustix 0.36.14",
"sc-allocator",
"sc-executor-common",
"sp-runtime-interface",
@@ -11493,9 +11575,9 @@ dependencies = [
[[package]]
name = "scale-info"
-version = "2.6.0"
+version = "2.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dfdef77228a4c05dc94211441595746732131ad7f6530c6c18f045da7b7ab937"
+checksum = "b569c32c806ec3abdf3b5869fb8bf1e0d275a7c1c9b0b05603d9464632649edf"
dependencies = [
"bitvec",
"cfg-if",
@@ -11642,9 +11724,9 @@ dependencies = [
[[package]]
name = "security-framework"
-version = "2.8.2"
+version = "2.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a332be01508d814fed64bf28f798a146d73792121129962fdf335bb3c49a4254"
+checksum = "1fc758eb7bffce5b308734e9b0c1468893cae9ff70ebf13e7090be8dcbcc83a8"
dependencies = [
"bitflags",
"core-foundation",
@@ -11655,9 +11737,9 @@ dependencies = [
[[package]]
name = "security-framework-sys"
-version = "2.8.0"
+version = "2.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "31c9bb296072e961fcbd8853511dd39c2d8be2deb1e17c6860b1d30732b323b4"
+checksum = "f51d0c0d83bec45f16480d0ce0058397a69e48fcdc52d1dc8855fb68acbd31a7"
dependencies = [
"core-foundation-sys",
"libc",
@@ -11698,22 +11780,22 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
[[package]]
name = "serde"
-version = "1.0.162"
+version = "1.0.164"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "71b2f6e1ab5c2b98c05f0f35b236b22e8df7ead6ffbf51d7808da7f8817e7ab6"
+checksum = "9e8c8cf938e98f769bc164923b06dce91cea1751522f46f8466461af04c9027d"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
-version = "1.0.162"
+version = "1.0.164"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a2a0814352fd64b58489904a44ea8d90cb1a91dcb6b4f5ebabc32c8318e93cb6"
+checksum = "d9735b638ccc51c28bf6914d90a2e9725b377144fc612c49a611fddd1b631d68"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.15",
+ "syn 2.0.18",
]
[[package]]
@@ -11748,7 +11830,7 @@ checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3"
dependencies = [
"cfg-if",
"cpufeatures",
- "digest 0.10.6",
+ "digest 0.10.7",
]
[[package]]
@@ -11784,7 +11866,7 @@ checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0"
dependencies = [
"cfg-if",
"cpufeatures",
- "digest 0.10.6",
+ "digest 0.10.7",
]
[[package]]
@@ -11793,7 +11875,7 @@ version = "0.10.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60"
dependencies = [
- "digest 0.10.6",
+ "digest 0.10.7",
"keccak",
]
@@ -11858,6 +11940,7 @@ dependencies = [
"pallet-evm-precompile-assets-erc20",
"pallet-evm-precompile-blake2",
"pallet-evm-precompile-bn128",
+ "pallet-evm-precompile-dapps-staking",
"pallet-evm-precompile-dispatch",
"pallet-evm-precompile-ed25519",
"pallet-evm-precompile-modexp",
@@ -11870,7 +11953,6 @@ dependencies = [
"pallet-identity",
"pallet-insecure-randomness-collective-flip",
"pallet-multisig",
- "pallet-precompile-dapps-staking",
"pallet-preimage",
"pallet-proxy",
"pallet-scheduler",
@@ -11961,6 +12043,7 @@ dependencies = [
"pallet-evm-precompile-assets-erc20",
"pallet-evm-precompile-blake2",
"pallet-evm-precompile-bn128",
+ "pallet-evm-precompile-dapps-staking",
"pallet-evm-precompile-dispatch",
"pallet-evm-precompile-ed25519",
"pallet-evm-precompile-modexp",
@@ -11972,7 +12055,6 @@ dependencies = [
"pallet-identity",
"pallet-insecure-randomness-collective-flip",
"pallet-multisig",
- "pallet-precompile-dapps-staking",
"pallet-proxy",
"pallet-session",
"pallet-state-trie-migration",
@@ -12033,7 +12115,7 @@ version = "1.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c"
dependencies = [
- "digest 0.10.6",
+ "digest 0.10.7",
"rand_core 0.6.4",
]
@@ -12050,6 +12132,26 @@ dependencies = [
"wide",
]
+[[package]]
+name = "similar"
+version = "2.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "420acb44afdae038210c99e69aae24109f32f15500aa708e81d46c9f29d55fcf"
+dependencies = [
+ "bstr 0.2.17",
+ "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 = "siphasher"
version = "0.3.10"
@@ -12143,6 +12245,16 @@ dependencies = [
"winapi",
]
+[[package]]
+name = "socket2"
+version = "0.5.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2538b18701741680e0322a2302176d3253a35388e2e62f172f64f4f16605f877"
+dependencies = [
+ "libc",
+ "windows-sys 0.48.0",
+]
+
[[package]]
name = "soketto"
version = "0.7.1"
@@ -12413,7 +12525,7 @@ source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.39#8c
dependencies = [
"blake2",
"byteorder",
- "digest 0.10.6",
+ "digest 0.10.7",
"sha2 0.10.6",
"sha3",
"sp-std",
@@ -13157,9 +13269,9 @@ dependencies = [
[[package]]
name = "syn"
-version = "2.0.15"
+version = "2.0.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a34fcf3e8b60f57e6a14301a2e916d323af98b0ea63c599441eec8558660c822"
+checksum = "32d41677bcbe24c20c52e7c70b0d8db04134c5d1066bf98662e2871ad200ea3e"
dependencies = [
"proc-macro2",
"quote",
@@ -13180,9 +13292,9 @@ dependencies = [
[[package]]
name = "system-configuration"
-version = "0.5.0"
+version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d75182f12f490e953596550b65ee31bda7c8e043d9386174b353bda50838c3fd"
+checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7"
dependencies = [
"bitflags",
"core-foundation",
@@ -13213,15 +13325,16 @@ checksum = "fd1ba337640d60c3e96bc6f0638a939b9c9a7f2c316a1598c279828b3d1dc8c5"
[[package]]
name = "tempfile"
-version = "3.5.0"
+version = "3.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b9fbec84f381d5795b08656e4912bec604d162bff9291d6189a78f4c8ab87998"
+checksum = "31c0432476357e58790aaa47a8efb0c5138f137343f3b5f23bd36a27e3b0a6d6"
dependencies = [
+ "autocfg",
"cfg-if",
"fastrand",
"redox_syscall 0.3.5",
- "rustix 0.37.19",
- "windows-sys 0.45.0",
+ "rustix 0.37.20",
+ "windows-sys 0.48.0",
]
[[package]]
@@ -13256,7 +13369,7 @@ checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.15",
+ "syn 2.0.18",
]
[[package]]
@@ -13331,9 +13444,9 @@ dependencies = [
[[package]]
name = "time"
-version = "0.3.21"
+version = "0.3.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8f3403384eaacbca9923fa06940178ac13e4edb725486d70e8e15881d0c836cc"
+checksum = "ea9e1b3cf1243ae005d9e74085d4d542f3125458f3a81af210d901dcd7411efd"
dependencies = [
"itoa",
"serde",
@@ -13411,9 +13524,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
[[package]]
name = "tokio"
-version = "1.28.0"
+version = "1.28.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c3c786bf8134e5a3a166db9b29ab8f48134739014a3eca7bc6bfa95d673b136f"
+checksum = "94d7b1cfd2aa4011f2de74c2c4c63665e27a71006b0a192dcd2710272e73dfa2"
dependencies = [
"autocfg",
"bytes",
@@ -13423,7 +13536,7 @@ dependencies = [
"parking_lot 0.12.1",
"pin-project-lite 0.2.9",
"signal-hook-registry",
- "socket2",
+ "socket2 0.4.9",
"tokio-macros",
"windows-sys 0.48.0",
]
@@ -13436,7 +13549,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.15",
+ "syn 2.0.18",
]
[[package]]
@@ -13488,15 +13601,15 @@ dependencies = [
[[package]]
name = "toml_datetime"
-version = "0.6.1"
+version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3ab8ed2edee10b50132aed5f331333428b011c99402b5a534154ed15746f9622"
+checksum = "5a76a9312f5ba4c2dec6b9161fdf25d87ad8a09256ccea5a556fef03c706a10f"
[[package]]
name = "toml_edit"
-version = "0.19.8"
+version = "0.19.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "239410c8609e8125456927e6707163a3b1fdb40561e4b803bc041f466ccfdc13"
+checksum = "2380d56e8670370eee6566b0bfd4265f65b3f432e8c6d85623f728d4fa31f739"
dependencies = [
"indexmap",
"toml_datetime",
@@ -13565,14 +13678,14 @@ checksum = "0f57e3ca2a01450b1a921183a9c9cbfda207fd822cef4ccb00a65402cbba7a74"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.15",
+ "syn 2.0.18",
]
[[package]]
name = "tracing-core"
-version = "0.1.30"
+version = "0.1.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "24eb03ba0eab1fd845050058ce5e616558e8f8d8fca633e6b163fe25c797213a"
+checksum = "0955b8137a1df6f1a2e9a37d8a6656291ff0297c1a97c24e0d8425fe2312f79a"
dependencies = [
"once_cell",
"valuable",
@@ -13705,7 +13818,7 @@ dependencies = [
"lazy_static",
"rand 0.8.5",
"smallvec",
- "socket2",
+ "socket2 0.4.9",
"thiserror",
"tinyvec",
"tokio",
@@ -13808,7 +13921,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675"
dependencies = [
"cfg-if",
- "digest 0.10.6",
+ "digest 0.10.7",
"rand 0.8.5",
"static_assertions",
]
@@ -13845,9 +13958,9 @@ checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460"
[[package]]
name = "unicode-ident"
-version = "1.0.8"
+version = "1.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4"
+checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0"
[[package]]
name = "unicode-normalization"
@@ -13858,6 +13971,12 @@ 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-width"
version = "0.1.10"
@@ -13882,9 +14001,9 @@ dependencies = [
[[package]]
name = "universal-hash"
-version = "0.5.0"
+version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7d3160b73c9a19f7e2939a2fdad446c57c1bbbbf4d919d3213ff1267a580d8b5"
+checksum = "fc1de2c688dc15305988b563c3854064043356019f97a4b46276fe734c4f07ea"
dependencies = [
"crypto-common",
"subtle",
@@ -13910,12 +14029,12 @@ checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a"
[[package]]
name = "url"
-version = "2.3.1"
+version = "2.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0d68c799ae75762b8c3fe375feb6600ef5602c883c5d21eb51c09f22b83c4643"
+checksum = "50bff7831e19200a85b17131d085c25d7811bc4e186efdaf54bbd132994a88cb"
dependencies = [
"form_urlencoded",
- "idna 0.3.0",
+ "idna 0.4.0",
"percent-encoding",
]
@@ -13927,11 +14046,11 @@ checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a"
[[package]]
name = "uuid"
-version = "1.3.2"
+version = "1.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4dad5567ad0cf5b760e5665964bec1b47dfd077ba8a2544b513f3556d3d239a2"
+checksum = "0fa2982af2eec27de306107c027578ff7f423d65f7250e40ce0fea8f45248b81"
dependencies = [
- "getrandom 0.2.9",
+ "getrandom 0.2.10",
]
[[package]]
@@ -14013,9 +14132,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
[[package]]
name = "wasm-bindgen"
-version = "0.2.85"
+version = "0.2.87"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5b6cb788c4e39112fbe1822277ef6fb3c55cd86b95cb3d3c4c1c9597e4ac74b4"
+checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342"
dependencies = [
"cfg-if",
"wasm-bindgen-macro",
@@ -14023,24 +14142,24 @@ dependencies = [
[[package]]
name = "wasm-bindgen-backend"
-version = "0.2.85"
+version = "0.2.87"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "35e522ed4105a9d626d885b35d62501b30d9666283a5c8be12c14a8bdafe7822"
+checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd"
dependencies = [
"bumpalo",
"log",
"once_cell",
"proc-macro2",
"quote",
- "syn 2.0.15",
+ "syn 2.0.18",
"wasm-bindgen-shared",
]
[[package]]
name = "wasm-bindgen-futures"
-version = "0.4.35"
+version = "0.4.37"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "083abe15c5d88556b77bdf7aef403625be9e327ad37c62c4e4129af740168163"
+checksum = "c02dbc21516f9f1f04f187958890d7e6026df8d16540b7ad9492bc34a67cea03"
dependencies = [
"cfg-if",
"js-sys",
@@ -14050,9 +14169,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro"
-version = "0.2.85"
+version = "0.2.87"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "358a79a0cb89d21db8120cbfb91392335913e4890665b1a7981d9e956903b434"
+checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d"
dependencies = [
"quote",
"wasm-bindgen-macro-support",
@@ -14060,22 +14179,22 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro-support"
-version = "0.2.85"
+version = "0.2.87"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4783ce29f09b9d93134d41297aded3a712b7b979e9c6f28c32cb88c973a94869"
+checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.15",
+ "syn 2.0.18",
"wasm-bindgen-backend",
"wasm-bindgen-shared",
]
[[package]]
name = "wasm-bindgen-shared"
-version = "0.2.85"
+version = "0.2.87"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a901d592cafaa4d711bc324edfaff879ac700b19c3dfd60058d2b445be2691eb"
+checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1"
[[package]]
name = "wasm-instrument"
@@ -14196,7 +14315,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57d20cb3c59b788653d99541c646c561c9dd26506f25c0cebfe810659c54c6d7"
dependencies = [
"downcast-rs",
- "libm 0.2.6",
+ "libm 0.2.7",
"memory_units",
"num-rational",
"num-traits",
@@ -14210,7 +14329,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c5bf998ab792be85e20e771fe14182b4295571ad1d4f89d3da521c1bef5f597a"
dependencies = [
"downcast-rs",
- "libm 0.2.6",
+ "libm 0.2.7",
"num-traits",
]
@@ -14282,7 +14401,7 @@ dependencies = [
"directories-next",
"file-per-thread-logger",
"log",
- "rustix 0.36.13",
+ "rustix 0.36.14",
"serde",
"sha2 0.10.6",
"toml",
@@ -14362,7 +14481,7 @@ checksum = "eed41cbcbf74ce3ff6f1d07d1b707888166dc408d1a880f651268f4f7c9194b2"
dependencies = [
"object 0.29.0",
"once_cell",
- "rustix 0.36.13",
+ "rustix 0.36.14",
]
[[package]]
@@ -14393,7 +14512,7 @@ dependencies = [
"memoffset 0.6.5",
"paste",
"rand 0.8.5",
- "rustix 0.36.13",
+ "rustix 0.36.14",
"wasmtime-asm-macros",
"wasmtime-environ",
"wasmtime-jit-debug",
@@ -14414,9 +14533,9 @@ dependencies = [
[[package]]
name = "web-sys"
-version = "0.3.62"
+version = "0.3.64"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "16b5f940c7edfdc6d12126d98c9ef4d1b3d470011c47c76a6581df47ad9ba721"
+checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b"
dependencies = [
"js-sys",
"wasm-bindgen",
@@ -14477,7 +14596,7 @@ dependencies = [
"sha2 0.10.6",
"stun",
"thiserror",
- "time 0.3.21",
+ "time 0.3.22",
"tokio",
"turn",
"url",
@@ -14514,7 +14633,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "942be5bd85f072c3128396f6e5a9bfb93ca8c1939ded735d177b7bcba9a13d05"
dependencies = [
"aes 0.6.0",
- "aes-gcm 0.10.1",
+ "aes-gcm 0.10.2",
"async-trait",
"bincode",
"block-modes",
@@ -14579,7 +14698,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f08dfd7a6e3987e255c4dbe710dde5d94d0f0574f8a21afa95d171376c143106"
dependencies = [
"log",
- "socket2",
+ "socket2 0.4.9",
"thiserror",
"tokio",
"webrtc-util",
@@ -14779,9 +14898,9 @@ dependencies = [
[[package]]
name = "wide"
-version = "0.7.8"
+version = "0.7.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b689b6c49d6549434bf944e6b0f39238cf63693cb7a147e9d887507fffa3b223"
+checksum = "40018623e2dba2602a9790faba8d33f2ebdebf4b86561b83928db735f8784728"
dependencies = [
"bytemuck",
"safe_arch",
@@ -14789,9 +14908,9 @@ dependencies = [
[[package]]
name = "widestring"
-version = "0.5.1"
+version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "17882f045410753661207383517a6f62ec3dbeb6a4ed2acce01f0728238d1983"
+checksum = "653f141f39ec16bba3c5abe400a0c60da7468261cc2cbf36805022876bc721a8"
[[package]]
name = "winapi"
@@ -15034,11 +15153,12 @@ dependencies = [
[[package]]
name = "winreg"
-version = "0.10.1"
+version = "0.50.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d"
+checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1"
dependencies = [
- "winapi",
+ "cfg-if",
+ "windows-sys 0.48.0",
]
[[package]]
@@ -15088,7 +15208,7 @@ dependencies = [
"ring",
"rusticata-macros",
"thiserror",
- "time 0.3.21",
+ "time 0.3.22",
]
[[package]]
@@ -15106,7 +15226,7 @@ dependencies = [
"oid-registry 0.6.1",
"rusticata-macros",
"thiserror",
- "time 0.3.21",
+ "time 0.3.22",
]
[[package]]
@@ -15169,7 +15289,6 @@ dependencies = [
[[package]]
name = "xcm-primitives"
version = "0.4.1"
-source = "git+https://github.com/AstarNetwork/astar-frame?branch=polkadot-v0.9.39#a3f214919bbbdefeb6962f528b35b5384626961d"
dependencies = [
"frame-support",
"log",
@@ -15271,7 +15390,6 @@ dependencies = [
[[package]]
name = "xvm-chain-extension-types"
version = "0.1.0"
-source = "git+https://github.com/AstarNetwork/astar-frame?branch=polkadot-v0.9.39#a3f214919bbbdefeb6962f528b35b5384626961d"
dependencies = [
"parity-scale-codec",
"scale-info",
@@ -15299,7 +15417,7 @@ version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e17bb3549cc1321ae1296b9cdc2698e2b6cb1992adfa19a8c72e5b7a738f44cd"
dependencies = [
- "time 0.3.21",
+ "time 0.3.22",
]
[[package]]
@@ -15319,7 +15437,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.15",
+ "syn 2.0.18",
]
[[package]]
diff --git a/Cargo.toml b/Cargo.toml
index f53d14221c..b3cf139cae 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -8,6 +8,28 @@ members = [
"runtime/shibuya",
"tests/xcm-simulator",
"tests/integration",
+
+ "pallets/*",
+ "precompiles/*",
+
+ "chain-extensions/dapps-staking",
+ "chain-extensions/pallet-assets",
+ "chain-extensions/xvm",
+ "chain-extensions/types/*",
+
+ "vendor/evm-tracing",
+ "vendor/primitives/debug",
+ "vendor/primitives/evm-tracing-events",
+ "vendor/primitives/txpool",
+ "vendor/rpc/debug",
+ "vendor/rpc/trace",
+ "vendor/rpc/txpool",
+ "vendor/rpc-core/debug",
+ "vendor/rpc-core/trace",
+ "vendor/rpc-core/txpool",
+ "vendor/rpc-core/types",
+ "vendor/runtime/evm-tracer",
+ "vendor/runtime/ext",
]
exclude = ["vendor"]
@@ -32,6 +54,12 @@ repository = "https://github.com/AstarNetwork/Astar"
parity-scale-codec = { version = "3.4.0", default-features = false, features = ["derive"] }
scale-info = { version = "2.3.0", default-features = false, features = ["derive"] }
log = { version = "0.4.17", default-features = false }
+environmental = { version = "1.1.2", default-features = false }
+sha3 = { version = "0.10.1", default-features = false }
+num_enum = { version = "0.5.3", default-features = false }
+num-traits = { version = "0.2", default-features = false }
+rand = { version = "0.8.5", default-features = false }
+bounded-collections = { version = "0.1.5", default-features = false }
# (native)
array-bytes = "6.0.0"
@@ -44,9 +72,20 @@ serde_json = "1.0.92"
tokio = { version = "1.24.2", features = ["macros", "sync"] }
url = "2.2.2"
jsonrpsee = { version = "0.16.2", features = ["server"] }
-hex = "0.4.3"
+hex = { version = "0.4.3", features = ["serde"] }
hex-literal = "0.4.1"
regex = "1.6.0"
+rlp = "0.5"
+tracing = "0.1.34"
+similar-asserts = { version = "1.1.0" }
+assert_matches = "1.3.0"
+libsecp256k1 = "0.7.0"
+impl-trait-for-tuples = "0.2.2"
+slices = "0.2.0"
+derive_more = { version = "0.99" }
+proc-macro2 = "1.0"
+quote = "1.0"
+syn = { version = "1.0" }
# Substrate
# (wasm)
@@ -64,6 +103,9 @@ sp-runtime-interface = { git = "https://github.com/paritytech/substrate", branch
sp-session = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39", default-features = false }
sp-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39", default-features = false }
sp-version = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39", default-features = false }
+sp-arithmetic = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39", default-features = false }
+sp-staking = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39", default-features = false }
+sp-externalities = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39", default-features = false }
# (native)
sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39" }
@@ -89,6 +131,7 @@ sc-telemetry = { git = "https://github.com/paritytech/substrate", branch = "polk
sc-tracing = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39" }
sc-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39" }
sc-transaction-pool-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39" }
+sc-utils = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39" }
substrate-prometheus-endpoint = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39" }
pallet-transaction-payment-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39" }
substrate-frame-rpc-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39" }
@@ -130,6 +173,14 @@ pallet-treasury = { git = "https://github.com/paritytech/substrate", branch = "p
pallet-grandpa = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39", default-features = false }
pallet-state-trie-migration = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39", default-features = false }
+# EVM & Ethereum
+# (wasm)
+evm = { version = "0.37.0", default-features = false }
+ethereum-types = { version = "0.14", default-features = false }
+ethereum = { version = "0.14.0", default-features = false }
+evm-gasometer = { version = "0.37.0", default-features = false }
+evm-runtime = { version = "0.37.0", default-features = false }
+
# Frontier
# (wasm)
fp-rpc = { git = "https://github.com/AstarNetwork/frontier", branch = "polkadot-v0.9.39", default-features = false }
@@ -213,36 +264,55 @@ orml-xcm-support = { git = "https://github.com/open-web3-stack/open-runtime-modu
# Astar pallets & modules
# (wasm)
-pallet-block-reward = { git = "https://github.com/AstarNetwork/astar-frame", branch = "polkadot-v0.9.39", default-features = false }
-pallet-collator-selection = { git = "https://github.com/AstarNetwork/astar-frame", branch = "polkadot-v0.9.39", default-features = false }
-pallet-custom-signatures = { git = "https://github.com/AstarNetwork/astar-frame", branch = "polkadot-v0.9.39", default-features = false }
-pallet-evm-precompile-assets-erc20 = { git = "https://github.com/AstarNetwork/astar-frame", branch = "polkadot-v0.9.39", default-features = false }
-pallet-evm-precompile-sr25519 = { git = "https://github.com/AstarNetwork/astar-frame", branch = "polkadot-v0.9.39", default-features = false }
-pallet-evm-precompile-substrate-ecdsa = { git = "https://github.com/AstarNetwork/astar-frame", branch = "polkadot-v0.9.39", default-features = false }
-pallet-evm-precompile-xcm = { git = "https://github.com/AstarNetwork/astar-frame", branch = "polkadot-v0.9.39", default-features = false }
-pallet-evm-precompile-xvm = { git = "https://github.com/AstarNetwork/astar-frame", branch = "polkadot-v0.9.39", default-features = false }
-pallet-precompile-dapps-staking = { git = "https://github.com/AstarNetwork/astar-frame", branch = "polkadot-v0.9.39", default-features = false }
-pallet-dapps-staking = { git = "https://github.com/AstarNetwork/astar-frame", branch = "polkadot-v0.9.39", default-features = false }
-pallet-xc-asset-config = { git = "https://github.com/AstarNetwork/astar-frame", branch = "polkadot-v0.9.39", default-features = false }
-xcm-primitives = { git = "https://github.com/AstarNetwork/astar-frame", branch = "polkadot-v0.9.39", default-features = false }
-pallet-xvm = { git = "https://github.com/AstarNetwork/astar-frame", branch = "polkadot-v0.9.39", default-features = false }
-pallet-xcm = { git = "https://github.com/AstarNetwork/astar-frame", branch = "polkadot-v0.9.39", default-features = false }
-
-pallet-chain-extension-dapps-staking = { git = "https://github.com/AstarNetwork/astar-frame", branch = "polkadot-v0.9.39", default-features = false }
-pallet-chain-extension-xvm = { git = "https://github.com/AstarNetwork/astar-frame", branch = "polkadot-v0.9.39", default-features = false }
-pallet-chain-extension-assets = { git = "https://github.com/AstarNetwork/astar-frame", branch = "polkadot-v0.9.39", default-features = false }
+pallet-block-reward = { path = "./pallets/block-reward", default-features = false }
+pallet-collator-selection = { path = "./pallets/collator-selection", default-features = false }
+pallet-custom-signatures = { path = "./pallets/custom-signatures", default-features = false }
+pallet-dapps-staking = { path = "./pallets/dapps-staking", default-features = false }
+pallet-xc-asset-config = { path = "./pallets/xc-asset-config", default-features = false }
+pallet-xvm = { path = "./pallets/pallet-xvm", default-features = false }
+pallet-xcm = { path = "./pallets/pallet-xcm", default-features = false }
+
+xcm-primitives = { path = "./primitives/xcm", default-features = false }
+
+pallet-evm-precompile-assets-erc20 = { path = "./precompiles/assets-erc20", default-features = false }
+pallet-evm-precompile-sr25519 = { path = "./precompiles/sr25519", default-features = false }
+pallet-evm-precompile-substrate-ecdsa = { path = "./precompiles/substrate-ecdsa", default-features = false }
+pallet-evm-precompile-xcm = { path = "./precompiles/xcm", default-features = false }
+pallet-evm-precompile-xvm = { path = "./precompiles/xvm", default-features = false }
+pallet-evm-precompile-dapps-staking = { path = "./precompiles/dapps-staking", default-features = false }
+
+pallet-chain-extension-dapps-staking = { path = "./chain-extensions/dapps-staking", default-features = false }
+pallet-chain-extension-xvm = { path = "./chain-extensions/xvm", default-features = false }
+pallet-chain-extension-assets = { path = "./chain-extensions/pallet-assets", default-features = false }
+
+dapps-staking-chain-extension-types = { path = "./chain-extensions/types/dapps-staking", default-features = false }
+xvm-chain-extension-types = { path = "./chain-extensions/types/xvm", default-features = false }
+assets-chain-extension-types = { path = "./chain-extensions/types/assets", default-features = false }
+
+precompile-utils = { path = "./precompiles/utils", default-features = false }
+
+local-runtime = { path = "./runtime/local", default-features = false }
+shibuya-runtime = { path = "./runtime/shibuya", default-features = false }
+shiden-runtime = { path = "./runtime/shiden", default-features = false }
+astar-runtime = { path = "./runtime/astar", default-features = false }
## Moonbeam tracing
## (wasm)
-moonbeam-evm-tracer = { git = "https://github.com/AstarNetwork/astar-frame", branch = "polkadot-v0.9.39", default-features = false }
-moonbeam-rpc-primitives-debug = { git = "https://github.com/AstarNetwork/astar-frame", branch = "polkadot-v0.9.39", default-features = false }
-moonbeam-rpc-primitives-txpool = { git = "https://github.com/AstarNetwork/astar-frame", branch = "polkadot-v0.9.39", default-features = false }
+moonbeam-evm-tracer = { path = "./vendor/runtime/evm-tracer", default-features = false }
+moonbeam-rpc-primitives-debug = { path = "./vendor/primitives/debug", default-features = false }
+moonbeam-rpc-primitives-txpool = { path = "./vendor/primitives/txpool", default-features = false }
+evm-tracing-events = { path = "./vendor/primitives/evm-tracing-events", default-features = false }
+moonbeam-primitives-ext = { path = "./vendor/runtime/ext", default-features = false }
## (native)
-moonbeam-primitives-ext = { git = "https://github.com/AstarNetwork/astar-frame", branch = "polkadot-v0.9.39" }
-moonbeam-rpc-debug = { git = "https://github.com/AstarNetwork/astar-frame", branch = "polkadot-v0.9.39" }
-moonbeam-rpc-trace = { git = "https://github.com/AstarNetwork/astar-frame", branch = "polkadot-v0.9.39" }
-moonbeam-rpc-txpool = { git = "https://github.com/AstarNetwork/astar-frame", branch = "polkadot-v0.9.39" }
+moonbeam-rpc-debug = { path = "./vendor/rpc/debug" }
+moonbeam-rpc-trace = { path = "./vendor/rpc/trace" }
+moonbeam-rpc-txpool = { path = "./vendor/rpc/txpool" }
+moonbeam-client-evm-tracing = { path = "./vendor/evm-tracing" }
+moonbeam-rpc-core-types = { path = "./vendor/rpc-core/types" }
+moonbeam-rpc-core-txpool = { path = "./vendor/rpc-core/txpool" }
+moonbeam-rpc-core-trace = { path = "./vendor/rpc-core/trace" }
+moonbeam-rpc-core-debug = { path = "./vendor/rpc-core/debug" }
# Build deps
substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39" }
diff --git a/bin/collator/Cargo.toml b/bin/collator/Cargo.toml
index a432ee01f5..d6a935ff5d 100644
--- a/bin/collator/Cargo.toml
+++ b/bin/collator/Cargo.toml
@@ -86,12 +86,12 @@ fp-evm = { workspace = true, features = ["std"] }
fp-storage = { workspace = true }
# astar-specific dependencies
-astar-runtime = { path = "../../runtime/astar" }
-local-runtime = { path = "../../runtime/local" }
-shibuya-runtime = { path = "../../runtime/shibuya" }
-shiden-runtime = { path = "../../runtime/shiden" }
+astar-runtime = { workspace = true, features = ["std"] }
+local-runtime = { workspace = true, features = ["std"] }
+shibuya-runtime = { workspace = true, features = ["std"] }
+shiden-runtime = { workspace = true, features = ["std"] }
-# astar-frame dependencies
+# astar pallets dependencies
pallet-block-reward = { workspace = true }
# frame dependencies
diff --git a/chain-extensions/dapps-staking/Cargo.toml b/chain-extensions/dapps-staking/Cargo.toml
new file mode 100644
index 0000000000..4169a7bd00
--- /dev/null
+++ b/chain-extensions/dapps-staking/Cargo.toml
@@ -0,0 +1,43 @@
+[package]
+name = "pallet-chain-extension-dapps-staking"
+version = "1.1.0"
+license = "Apache-2.0"
+description = "dApps Staking chain extension for WASM contracts"
+authors.workspace = true
+edition.workspace = true
+homepage.workspace = true
+repository.workspace = true
+
+[dependencies]
+frame-support = { workspace = true }
+frame-system = { workspace = true }
+log = { workspace = true }
+num-traits = { workspace = true }
+pallet-contracts = { workspace = true }
+pallet-contracts-primitives = { workspace = true }
+parity-scale-codec = { workspace = true }
+scale-info = { workspace = true }
+sp-core = { workspace = true }
+sp-runtime = { workspace = true }
+sp-std = { workspace = true }
+
+# Astar
+dapps-staking-chain-extension-types = { workspace = true }
+pallet-dapps-staking = { workspace = true }
+
+[features]
+default = ["std"]
+std = [
+ "parity-scale-codec/std",
+ "dapps-staking-chain-extension-types/std",
+ "frame-support/std",
+ "frame-system/std",
+ "num-traits/std",
+ "pallet-contracts/std",
+ "pallet-contracts-primitives/std",
+ "pallet-dapps-staking/std",
+ "scale-info/std",
+ "sp-std/std",
+ "sp-core/std",
+ "sp-runtime/std",
+]
diff --git a/chain-extensions/dapps-staking/src/lib.rs b/chain-extensions/dapps-staking/src/lib.rs
new file mode 100644
index 0000000000..4d5149eb4f
--- /dev/null
+++ b/chain-extensions/dapps-staking/src/lib.rs
@@ -0,0 +1,369 @@
+// This file is part of Astar.
+
+// Copyright (C) 2019-2023 Stake Technologies Pte.Ltd.
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+// Astar is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// Astar is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Astar. If not, see .
+
+#![cfg_attr(not(feature = "std"), no_std)]
+use sp_runtime::{
+ traits::{Saturating, Zero},
+ DispatchError,
+};
+
+use dapps_staking_chain_extension_types::{
+ DSError, DappsStakingAccountInput, DappsStakingEraInput, DappsStakingNominationInput,
+ DappsStakingValueInput,
+};
+use frame_support::traits::{Currency, Get};
+use frame_system::RawOrigin;
+use pallet_contracts::chain_extension::{
+ ChainExtension, Environment, Ext, InitState, RetVal, SysConfig,
+};
+use pallet_dapps_staking::{RewardDestination, WeightInfo};
+use parity_scale_codec::Encode;
+use sp_std::marker::PhantomData;
+
+type BalanceOf = <::Currency as Currency<
+ ::AccountId,
+>>::Balance;
+
+enum DappsStakingFunc {
+ CurrentEra,
+ UnbondingPeriod,
+ EraRewards,
+ EraStaked,
+ StakedAmount,
+ StakedAmountOnContract,
+ ReadContractStake,
+ BondAndStake,
+ UnbondAndUnstake,
+ WithdrawUnbonded,
+ ClaimStaker,
+ ClaimDapp,
+ SetRewardDestination,
+ NominationTransfer,
+}
+
+impl TryFrom for DappsStakingFunc {
+ type Error = DispatchError;
+
+ fn try_from(value: u16) -> Result {
+ match value {
+ 1 => Ok(DappsStakingFunc::CurrentEra),
+ 2 => Ok(DappsStakingFunc::UnbondingPeriod),
+ 3 => Ok(DappsStakingFunc::EraRewards),
+ 4 => Ok(DappsStakingFunc::EraStaked),
+ 5 => Ok(DappsStakingFunc::StakedAmount),
+ 6 => Ok(DappsStakingFunc::StakedAmountOnContract),
+ 7 => Ok(DappsStakingFunc::ReadContractStake),
+ 8 => Ok(DappsStakingFunc::BondAndStake),
+ 9 => Ok(DappsStakingFunc::UnbondAndUnstake),
+ 10 => Ok(DappsStakingFunc::WithdrawUnbonded),
+ 11 => Ok(DappsStakingFunc::ClaimStaker),
+ 12 => Ok(DappsStakingFunc::ClaimDapp),
+ 13 => Ok(DappsStakingFunc::SetRewardDestination),
+ 14 => Ok(DappsStakingFunc::NominationTransfer),
+ _ => Err(DispatchError::Other(
+ "DappsStakingExtension: Unimplemented func_id",
+ )),
+ }
+ }
+}
+
+/// Dapps Staking chain extension.
+pub struct DappsStakingExtension(PhantomData);
+
+impl Default for DappsStakingExtension {
+ fn default() -> Self {
+ DappsStakingExtension(PhantomData)
+ }
+}
+
+impl ChainExtension for DappsStakingExtension
+where
+ T: pallet_dapps_staking::Config + pallet_contracts::Config,
+ ::SmartContract: From<[u8; 32]>,
+ ::AccountId: From<[u8; 32]>,
+{
+ fn call(&mut self, env: Environment) -> Result
+ where
+ E: Ext,
+ {
+ let func_id = env.func_id().try_into()?;
+ let mut env = env.buf_in_buf_out();
+
+ match func_id {
+ DappsStakingFunc::CurrentEra => {
+ let base_weight = ::DbWeight::get().reads(1);
+ env.charge_weight(base_weight)?;
+
+ let era_index = pallet_dapps_staking::CurrentEra::::get();
+ env.write(&era_index.encode(), false, None)?;
+ }
+
+ DappsStakingFunc::UnbondingPeriod => {
+ let base_weight = ::DbWeight::get().reads(1);
+ env.charge_weight(base_weight)?;
+
+ let unbonding_period = T::UnbondingPeriod::get();
+ env.write(&unbonding_period.encode(), false, None)?;
+ }
+
+ DappsStakingFunc::EraRewards => {
+ let arg: u32 = env.read_as()?;
+
+ let base_weight = ::DbWeight::get().reads(1);
+ env.charge_weight(base_weight)?;
+
+ let era_info = pallet_dapps_staking::GeneralEraInfo::::get(arg);
+ let reward = era_info.map_or(Zero::zero(), |r| {
+ r.rewards.stakers.saturating_add(r.rewards.dapps)
+ });
+ env.write(&reward.encode(), false, None)?;
+ }
+
+ DappsStakingFunc::EraStaked => {
+ let arg: u32 = env.read_as()?;
+
+ let base_weight = ::DbWeight::get().reads(1);
+ env.charge_weight(base_weight)?;
+
+ let era_info = pallet_dapps_staking::GeneralEraInfo::::get(arg);
+ let staked_amount = era_info.map_or(Zero::zero(), |r| r.staked);
+ env.write(&staked_amount.encode(), false, None)?;
+ }
+
+ DappsStakingFunc::StakedAmount => {
+ let staker: T::AccountId = env.read_as()?;
+
+ let base_weight = ::DbWeight::get().reads(1);
+ env.charge_weight(base_weight)?;
+
+ let ledger = pallet_dapps_staking::Ledger::::get(&staker);
+ env.write(&ledger.locked.encode(), false, None)?;
+ }
+
+ DappsStakingFunc::StakedAmountOnContract => {
+ let args: DappsStakingAccountInput = env.read_as()?;
+ let staker: T::AccountId = args.staker.into();
+ let contract: ::SmartContract =
+ args.contract.into();
+
+ let base_weight = ::DbWeight::get().reads(1);
+ env.charge_weight(base_weight)?;
+
+ let staking_info =
+ pallet_dapps_staking::GeneralStakerInfo::::get(&staker, &contract);
+ let staked_amount = staking_info.latest_staked_value();
+ env.write(&staked_amount.encode(), false, None)?;
+ }
+
+ DappsStakingFunc::ReadContractStake => {
+ let contract_bytes: [u8; 32] = env.read_as()?;
+ let contract: ::SmartContract =
+ contract_bytes.into();
+
+ let base_weight = ::DbWeight::get().reads(1);
+ env.charge_weight(base_weight.saturating_add(base_weight))?;
+
+ let current_era = pallet_dapps_staking::CurrentEra::::get();
+ let staking_info =
+ pallet_dapps_staking::Pallet::::contract_stake_info(&contract, current_era)
+ .unwrap_or_default();
+ let total = TryInto::::try_into(staking_info.total).unwrap_or(0);
+ env.write(&total.encode(), false, None)?;
+ }
+
+ DappsStakingFunc::BondAndStake => {
+ let args: DappsStakingValueInput> = env.read_as()?;
+ let contract = args.contract.into();
+ let value: BalanceOf = args.value;
+
+ let base_weight = ::WeightInfo::bond_and_stake();
+ env.charge_weight(base_weight)?;
+
+ let caller = env.ext().address().clone();
+ let call_result = pallet_dapps_staking::Pallet::::bond_and_stake(
+ RawOrigin::Signed(caller).into(),
+ contract,
+ value,
+ );
+ return match call_result {
+ Err(e) => {
+ let mapped_error = DSError::try_from(e.error)?;
+ Ok(RetVal::Converging(mapped_error as u32))
+ }
+ Ok(_) => Ok(RetVal::Converging(DSError::Success as u32)),
+ };
+ }
+
+ DappsStakingFunc::UnbondAndUnstake => {
+ let args: DappsStakingValueInput> = env.read_as()?;
+ let contract = args.contract.into();
+ let value: BalanceOf = args.value;
+
+ let base_weight =
+ ::WeightInfo::unbond_and_unstake();
+ env.charge_weight(base_weight)?;
+
+ let caller = env.ext().address().clone();
+ let call_result = pallet_dapps_staking::Pallet::::unbond_and_unstake(
+ RawOrigin::Signed(caller).into(),
+ contract,
+ value,
+ );
+ return match call_result {
+ Err(e) => {
+ let mapped_error = DSError::try_from(e.error)?;
+ Ok(RetVal::Converging(mapped_error as u32))
+ }
+ Ok(_) => Ok(RetVal::Converging(DSError::Success as u32)),
+ };
+ }
+
+ DappsStakingFunc::WithdrawUnbonded => {
+ let caller = env.ext().address().clone();
+
+ let base_weight =
+ ::WeightInfo::withdraw_unbonded();
+ env.charge_weight(base_weight)?;
+
+ let call_result = pallet_dapps_staking::Pallet::::withdraw_unbonded(
+ RawOrigin::Signed(caller).into(),
+ );
+ return match call_result {
+ Err(e) => {
+ let mapped_error = DSError::try_from(e.error)?;
+ Ok(RetVal::Converging(mapped_error as u32))
+ }
+ Ok(_) => Ok(RetVal::Converging(DSError::Success as u32)),
+ };
+ }
+
+ DappsStakingFunc::ClaimStaker => {
+ let contract_bytes: [u8; 32] = env.read_as()?;
+ let contract = contract_bytes.into();
+
+ let base_weight = ::WeightInfo::claim_staker_with_restake()
+ .max(::WeightInfo::claim_staker_without_restake());
+ let charged_weight = env.charge_weight(base_weight)?;
+
+ let caller = env.ext().address().clone();
+ let call_result = pallet_dapps_staking::Pallet::::claim_staker(
+ RawOrigin::Signed(caller).into(),
+ contract,
+ );
+
+ let actual_weight = match call_result {
+ Ok(e) => e.actual_weight,
+ Err(e) => e.post_info.actual_weight,
+ };
+ if let Some(actual_weight) = actual_weight {
+ env.adjust_weight(charged_weight, actual_weight);
+ }
+
+ return match call_result {
+ Err(e) => {
+ let mapped_error = DSError::try_from(e.error)?;
+ Ok(RetVal::Converging(mapped_error as u32))
+ }
+ Ok(_) => Ok(RetVal::Converging(DSError::Success as u32)),
+ };
+ }
+
+ DappsStakingFunc::ClaimDapp => {
+ let args: DappsStakingEraInput = env.read_as()?;
+ let contract = args.contract.into();
+ let era: u32 = args.era;
+
+ let base_weight = ::WeightInfo::claim_dapp();
+ env.charge_weight(base_weight)?;
+
+ let caller = env.ext().address().clone();
+ let call_result = pallet_dapps_staking::Pallet::::claim_dapp(
+ RawOrigin::Signed(caller).into(),
+ contract,
+ era,
+ );
+ return match call_result {
+ Err(e) => {
+ let mapped_error = DSError::try_from(e.error)?;
+ Ok(RetVal::Converging(mapped_error as u32))
+ }
+ Ok(_) => Ok(RetVal::Converging(DSError::Success as u32)),
+ };
+ }
+
+ DappsStakingFunc::SetRewardDestination => {
+ let reward_destination_raw: u8 = env.read_as()?;
+
+ let base_weight =
+ ::WeightInfo::set_reward_destination();
+ env.charge_weight(base_weight)?;
+
+ // Transform raw value into dapps staking enum
+ let reward_destination = if reward_destination_raw == 0 {
+ RewardDestination::FreeBalance
+ } else if reward_destination_raw == 1 {
+ RewardDestination::StakeBalance
+ } else {
+ let error = DSError::RewardDestinationValueOutOfBounds;
+ return Ok(RetVal::Converging(error as u32));
+ };
+
+ let caller = env.ext().address().clone();
+ let call_result = pallet_dapps_staking::Pallet::::set_reward_destination(
+ RawOrigin::Signed(caller).into(),
+ reward_destination,
+ );
+ return match call_result {
+ Err(e) => {
+ let mapped_error = DSError::try_from(e.error)?;
+ Ok(RetVal::Converging(mapped_error as u32))
+ }
+ Ok(_) => Ok(RetVal::Converging(DSError::Success as u32)),
+ };
+ }
+
+ DappsStakingFunc::NominationTransfer => {
+ let args: DappsStakingNominationInput> = env.read_as()?;
+ let origin_smart_contract = args.origin_contract.into();
+ let target_smart_contract = args.target_contract.into();
+ let value: BalanceOf = args.value;
+
+ let base_weight =
+ ::WeightInfo::nomination_transfer();
+ env.charge_weight(base_weight)?;
+
+ let caller = env.ext().address().clone();
+ let call_result = pallet_dapps_staking::Pallet::::nomination_transfer(
+ RawOrigin::Signed(caller).into(),
+ origin_smart_contract,
+ value,
+ target_smart_contract,
+ );
+ return match call_result {
+ Err(e) => {
+ let mapped_error = DSError::try_from(e.error)?;
+ Ok(RetVal::Converging(mapped_error as u32))
+ }
+ Ok(_) => Ok(RetVal::Converging(DSError::Success as u32)),
+ };
+ }
+ }
+
+ Ok(RetVal::Converging(DSError::Success as u32))
+ }
+}
diff --git a/chain-extensions/pallet-assets/Cargo.toml b/chain-extensions/pallet-assets/Cargo.toml
new file mode 100644
index 0000000000..94319eef7f
--- /dev/null
+++ b/chain-extensions/pallet-assets/Cargo.toml
@@ -0,0 +1,41 @@
+[package]
+name = "pallet-chain-extension-assets"
+version = "0.1.0"
+license = "Apache-2.0"
+description = "Assets chain extension for WASM contracts"
+authors.workspace = true
+edition.workspace = true
+homepage.workspace = true
+repository.workspace = true
+
+[dependencies]
+assets-chain-extension-types = { workspace = true }
+frame-support = { workspace = true }
+frame-system = { workspace = true }
+log = { workspace = true }
+num-traits = { workspace = true }
+pallet-assets = { workspace = true }
+pallet-contracts = { workspace = true }
+pallet-contracts-primitives = { workspace = true }
+parity-scale-codec = { workspace = true }
+scale-info = { workspace = true }
+sp-core = { workspace = true }
+sp-runtime = { workspace = true }
+sp-std = { workspace = true }
+
+[features]
+default = ["std"]
+std = [
+ "parity-scale-codec/std",
+ "frame-support/std",
+ "frame-system/std",
+ "num-traits/std",
+ "pallet-contracts/std",
+ "pallet-contracts-primitives/std",
+ "scale-info/std",
+ "sp-std/std",
+ "sp-core/std",
+ "sp-runtime/std",
+ "pallet-assets/std",
+ "assets-chain-extension-types/std",
+]
diff --git a/chain-extensions/pallet-assets/src/lib.rs b/chain-extensions/pallet-assets/src/lib.rs
new file mode 100644
index 0000000000..f4ff4695e9
--- /dev/null
+++ b/chain-extensions/pallet-assets/src/lib.rs
@@ -0,0 +1,415 @@
+// This file is part of Astar.
+
+// Copyright (C) 2019-2023 Stake Technologies Pte.Ltd.
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+// Astar is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// Astar is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Astar. If not, see .
+
+#![cfg_attr(not(feature = "std"), no_std)]
+
+pub mod weights;
+
+use assets_chain_extension_types::{select_origin, Origin, Outcome};
+use frame_support::traits::fungibles::InspectMetadata;
+use frame_support::traits::tokens::fungibles::approvals::Inspect;
+use frame_system::RawOrigin;
+use pallet_assets::WeightInfo;
+use pallet_contracts::chain_extension::{
+ ChainExtension, Environment, Ext, InitState, RetVal, SysConfig,
+};
+use parity_scale_codec::Encode;
+use sp_runtime::traits::StaticLookup;
+use sp_runtime::DispatchError;
+use sp_std::marker::PhantomData;
+use sp_std::vec::Vec;
+
+enum AssetsFunc {
+ Create,
+ Transfer,
+ Mint,
+ Burn,
+ BalanceOf,
+ TotalSupply,
+ Allowance,
+ ApproveTransfer,
+ CancelApproval,
+ TransferApproved,
+ SetMetadata,
+ MetadataName,
+ MetadataSymbol,
+ MetadataDecimals,
+ TransferOwnership,
+}
+
+impl TryFrom for AssetsFunc {
+ type Error = DispatchError;
+
+ fn try_from(value: u16) -> Result {
+ match value {
+ 1 => Ok(AssetsFunc::Create),
+ 2 => Ok(AssetsFunc::Transfer),
+ 3 => Ok(AssetsFunc::Mint),
+ 4 => Ok(AssetsFunc::Burn),
+ 5 => Ok(AssetsFunc::BalanceOf),
+ 6 => Ok(AssetsFunc::TotalSupply),
+ 7 => Ok(AssetsFunc::Allowance),
+ 8 => Ok(AssetsFunc::ApproveTransfer),
+ 9 => Ok(AssetsFunc::CancelApproval),
+ 10 => Ok(AssetsFunc::TransferApproved),
+ 11 => Ok(AssetsFunc::SetMetadata),
+ 12 => Ok(AssetsFunc::MetadataName),
+ 13 => Ok(AssetsFunc::MetadataSymbol),
+ 14 => Ok(AssetsFunc::MetadataDecimals),
+ 15 => Ok(AssetsFunc::TransferOwnership),
+ _ => Err(DispatchError::Other(
+ "PalletAssetsExtension: Unimplemented func_id",
+ )),
+ }
+ }
+}
+
+/// Pallet Assets chain extension.
+pub struct AssetsExtension(PhantomData<(T, W)>);
+
+impl Default for AssetsExtension {
+ fn default() -> Self {
+ AssetsExtension(PhantomData)
+ }
+}
+
+impl ChainExtension for AssetsExtension
+where
+ T: pallet_assets::Config + pallet_contracts::Config,
+ <::Lookup as StaticLookup>::Source: From<::AccountId>,
+ ::AccountId: From<[u8; 32]>,
+ W: weights::WeightInfo,
+{
+ fn call(&mut self, env: Environment) -> Result
+ where
+ E: Ext,
+ {
+ let func_id = env.func_id().try_into()?;
+ let mut env = env.buf_in_buf_out();
+
+ match func_id {
+ AssetsFunc::Create => {
+ let (origin, id, admin, min_balance): (
+ Origin,
+ ::AssetId,
+ T::AccountId,
+ T::Balance,
+ ) = env.read_as()?;
+
+ let base_weight = ::WeightInfo::create();
+ env.charge_weight(base_weight)?;
+
+ let raw_origin = select_origin!(&origin, env.ext().address().clone());
+
+ let call_result = pallet_assets::Pallet::::create(
+ raw_origin.into(),
+ id.into(),
+ admin.into(),
+ min_balance,
+ );
+ return match call_result {
+ Err(e) => {
+ let mapped_error = Outcome::from(e);
+ Ok(RetVal::Converging(mapped_error as u32))
+ }
+ Ok(_) => Ok(RetVal::Converging(Outcome::Success as u32)),
+ };
+ }
+ AssetsFunc::Transfer => {
+ let (origin, id, target, amount): (
+ Origin,
+ ::AssetId,
+ T::AccountId,
+ T::Balance,
+ ) = env.read_as()?;
+
+ let base_weight = ::WeightInfo::transfer();
+ env.charge_weight(base_weight)?;
+
+ let raw_origin = select_origin!(&origin, env.ext().address().clone());
+
+ let call_result = pallet_assets::Pallet::::transfer(
+ raw_origin.into(),
+ id.into(),
+ target.into(),
+ amount,
+ );
+ return match call_result {
+ Err(e) => {
+ let mapped_error = Outcome::from(e);
+ Ok(RetVal::Converging(mapped_error as u32))
+ }
+ Ok(_) => Ok(RetVal::Converging(Outcome::Success as u32)),
+ };
+ }
+ AssetsFunc::Mint => {
+ let (origin, id, beneficiary, amount): (
+ Origin,
+ ::AssetId,
+ T::AccountId,
+ T::Balance,
+ ) = env.read_as()?;
+
+ let base_weight = ::WeightInfo::mint();
+ env.charge_weight(base_weight)?;
+
+ let raw_origin = select_origin!(&origin, env.ext().address().clone());
+
+ let call_result = pallet_assets::Pallet::::mint(
+ raw_origin.into(),
+ id.into(),
+ beneficiary.into(),
+ amount,
+ );
+ return match call_result {
+ Err(e) => {
+ let mapped_error = Outcome::from(e);
+ Ok(RetVal::Converging(mapped_error as u32))
+ }
+ Ok(_) => Ok(RetVal::Converging(Outcome::Success as u32)),
+ };
+ }
+ AssetsFunc::Burn => {
+ let (origin, id, who, amount): (
+ Origin,
+ ::AssetId,
+ T::AccountId,
+ T::Balance,
+ ) = env.read_as()?;
+
+ let base_weight = ::WeightInfo::burn();
+ env.charge_weight(base_weight)?;
+
+ let raw_origin = select_origin!(&origin, env.ext().address().clone());
+
+ let call_result = pallet_assets::Pallet::::burn(
+ raw_origin.into(),
+ id.into(),
+ who.into(),
+ amount,
+ );
+ return match call_result {
+ Err(e) => {
+ let mapped_error = Outcome::from(e);
+ Ok(RetVal::Converging(mapped_error as u32))
+ }
+ Ok(_) => Ok(RetVal::Converging(Outcome::Success as u32)),
+ };
+ }
+ AssetsFunc::BalanceOf => {
+ let (id, who): (::AssetId, T::AccountId) =
+ env.read_as()?;
+
+ let base_weight = ::balance_of();
+ env.charge_weight(base_weight)?;
+
+ let balance = pallet_assets::Pallet::::balance(id, who);
+ env.write(&balance.encode(), false, None)?;
+ }
+ AssetsFunc::TotalSupply => {
+ let id: ::AssetId = env.read_as()?;
+
+ let base_weight = ::total_supply();
+ env.charge_weight(base_weight)?;
+
+ let total_supply = pallet_assets::Pallet::::total_supply(id);
+ env.write(&total_supply.encode(), false, None)?;
+ }
+ AssetsFunc::Allowance => {
+ let (id, owner, delegate): (
+ ::AssetId,
+ T::AccountId,
+ T::AccountId,
+ ) = env.read_as()?;
+
+ let base_weight = ::allowance();
+ env.charge_weight(base_weight)?;
+
+ let allowance = pallet_assets::Pallet::::allowance(id, &owner, &delegate);
+ env.write(&allowance.encode(), false, None)?;
+ }
+ AssetsFunc::ApproveTransfer => {
+ let (origin, id, delegate, amount): (
+ Origin,
+ ::AssetId,
+ T::AccountId,
+ T::Balance,
+ ) = env.read_as()?;
+
+ let base_weight = ::WeightInfo::approve_transfer();
+ env.charge_weight(base_weight)?;
+
+ let raw_origin = select_origin!(&origin, env.ext().address().clone());
+
+ let call_result = pallet_assets::Pallet::::approve_transfer(
+ raw_origin.into(),
+ id.into(),
+ delegate.into(),
+ amount,
+ );
+ return match call_result {
+ Err(e) => {
+ let mapped_error = Outcome::from(e);
+ Ok(RetVal::Converging(mapped_error as u32))
+ }
+ Ok(_) => Ok(RetVal::Converging(Outcome::Success as u32)),
+ };
+ }
+ AssetsFunc::CancelApproval => {
+ let (origin, id, delegate): (
+ Origin,
+ ::AssetId,
+ T::AccountId,
+ ) = env.read_as()?;
+
+ let base_weight = ::WeightInfo::cancel_approval();
+ env.charge_weight(base_weight)?;
+
+ let raw_origin = select_origin!(&origin, env.ext().address().clone());
+
+ let call_result = pallet_assets::Pallet::::cancel_approval(
+ raw_origin.into(),
+ id.into(),
+ delegate.into(),
+ );
+ return match call_result {
+ Err(e) => {
+ let mapped_error = Outcome::from(e);
+ Ok(RetVal::Converging(mapped_error as u32))
+ }
+ Ok(_) => Ok(RetVal::Converging(Outcome::Success as u32)),
+ };
+ }
+ AssetsFunc::TransferApproved => {
+ let (origin, id, owner, destination, amount): (
+ Origin,
+ ::AssetId,
+ T::AccountId,
+ T::AccountId,
+ T::Balance,
+ ) = env.read_as()?;
+
+ let base_weight = ::WeightInfo::transfer_approved();
+ env.charge_weight(base_weight)?;
+
+ let raw_origin = select_origin!(&origin, env.ext().address().clone());
+
+ let call_result = pallet_assets::Pallet::::transfer_approved(
+ raw_origin.into(),
+ id.into(),
+ owner.into(),
+ destination.into(),
+ amount,
+ );
+ return match call_result {
+ Err(e) => {
+ let mapped_error = Outcome::from(e);
+ Ok(RetVal::Converging(mapped_error as u32))
+ }
+ Ok(_) => Ok(RetVal::Converging(Outcome::Success as u32)),
+ };
+ }
+ AssetsFunc::SetMetadata => {
+ let (origin, id, name, symbol, decimals): (
+ Origin,
+ ::AssetId,
+ Vec,
+ Vec,
+ u8,
+ ) = env.read_as_unbounded(env.in_len())?;
+
+ let base_weight = ::WeightInfo::set_metadata(
+ name.len() as u32,
+ symbol.len() as u32,
+ );
+ env.charge_weight(base_weight)?;
+
+ let raw_origin = select_origin!(&origin, env.ext().address().clone());
+
+ let call_result = pallet_assets::Pallet::::set_metadata(
+ raw_origin.into(),
+ id.into(),
+ name,
+ symbol,
+ decimals,
+ );
+ return match call_result {
+ Err(e) => {
+ let mapped_error = Outcome::from(e);
+ Ok(RetVal::Converging(mapped_error as u32))
+ }
+ Ok(_) => Ok(RetVal::Converging(Outcome::Success as u32)),
+ };
+ }
+ AssetsFunc::MetadataName => {
+ let id: ::AssetId = env.read_as()?;
+
+ let base_weight = ::metadata_name();
+ env.charge_weight(base_weight)?;
+
+ let name = pallet_assets::Pallet::::name(&id);
+ env.write(&name.encode(), false, None)?;
+ }
+ AssetsFunc::MetadataSymbol => {
+ let id: ::AssetId = env.read_as()?;
+
+ let base_weight = ::metadata_symbol();
+ env.charge_weight(base_weight)?;
+
+ let symbol = pallet_assets::Pallet::::symbol(&id);
+ env.write(&symbol.encode(), false, None)?;
+ }
+ AssetsFunc::MetadataDecimals => {
+ let id: ::AssetId = env.read_as()?;
+
+ let base_weight = ::metadata_decimals();
+ env.charge_weight(base_weight)?;
+
+ let decimals = pallet_assets::Pallet::::decimals(&id);
+ env.write(&decimals.encode(), false, None)?;
+ }
+ AssetsFunc::TransferOwnership => {
+ let (origin, id, owner): (
+ Origin,
+ ::AssetId,
+ T::AccountId,
+ ) = env.read_as()?;
+
+ let base_weight = ::WeightInfo::transfer_ownership();
+ env.charge_weight(base_weight)?;
+
+ let raw_origin = select_origin!(&origin, env.ext().address().clone());
+
+ let call_result = pallet_assets::Pallet::::transfer_ownership(
+ raw_origin.into(),
+ id.into(),
+ owner.into(),
+ );
+ return match call_result {
+ Err(e) => {
+ let mapped_error = Outcome::from(e);
+ Ok(RetVal::Converging(mapped_error as u32))
+ }
+ Ok(_) => Ok(RetVal::Converging(Outcome::Success as u32)),
+ };
+ }
+ }
+
+ Ok(RetVal::Converging(Outcome::Success as u32))
+ }
+}
diff --git a/chain-extensions/pallet-assets/src/weights.rs b/chain-extensions/pallet-assets/src/weights.rs
new file mode 100644
index 0000000000..3b2913684a
--- /dev/null
+++ b/chain-extensions/pallet-assets/src/weights.rs
@@ -0,0 +1,62 @@
+// This file is part of Astar.
+
+// Copyright (C) 2019-2023 Stake Technologies Pte.Ltd.
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+// Astar is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// Astar is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Astar. If not, see .
+
+#![cfg_attr(rustfmt, rustfmt_skip)]
+#![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-assets chain-extension.
+pub trait WeightInfo {
+ fn balance_of() -> Weight;
+ fn total_supply() -> Weight;
+ fn allowance() -> Weight;
+ fn metadata_name() -> Weight;
+ fn metadata_symbol() -> Weight;
+ fn metadata_decimals() -> Weight;
+}
+
+/// Weights for pallet-assets chain-extension
+pub struct SubstrateWeight(PhantomData);
+impl WeightInfo for SubstrateWeight {
+ fn balance_of() -> Weight {
+ T::DbWeight::get().reads(1 as u64)
+ }
+
+ fn total_supply() -> Weight {
+ T::DbWeight::get().reads(1 as u64)
+ }
+
+ fn allowance() -> Weight {
+ T::DbWeight::get().reads(1 as u64)
+ }
+
+ fn metadata_name() -> Weight {
+ T::DbWeight::get().reads(1 as u64)
+ }
+
+ fn metadata_symbol() -> Weight {
+ T::DbWeight::get().reads(1 as u64)
+ }
+
+ fn metadata_decimals() -> Weight {
+ T::DbWeight::get().reads(1 as u64)
+ }
+}
diff --git a/chain-extensions/types/assets/Cargo.toml b/chain-extensions/types/assets/Cargo.toml
new file mode 100644
index 0000000000..af2c61ada9
--- /dev/null
+++ b/chain-extensions/types/assets/Cargo.toml
@@ -0,0 +1,27 @@
+[package]
+name = "assets-chain-extension-types"
+version = "0.1.0"
+license = "Apache-2.0"
+description = "Types definitions for assets chain-extension"
+authors.workspace = true
+edition.workspace = true
+homepage.workspace = true
+repository.workspace = true
+
+[dependencies]
+parity-scale-codec = { workspace = true }
+scale-info = { workspace = true }
+
+frame-system = { workspace = true }
+pallet-contracts = { workspace = true }
+sp-runtime = { workspace = true }
+
+[features]
+default = ["std"]
+std = [
+ "scale-info/std",
+ "parity-scale-codec/std",
+ "pallet-contracts/std",
+ "sp-runtime/std",
+ "frame-system/std",
+]
diff --git a/chain-extensions/types/assets/src/lib.rs b/chain-extensions/types/assets/src/lib.rs
new file mode 100644
index 0000000000..5ca4b8bfbb
--- /dev/null
+++ b/chain-extensions/types/assets/src/lib.rs
@@ -0,0 +1,128 @@
+// This file is part of Astar.
+
+// Copyright (C) 2019-2023 Stake Technologies Pte.Ltd.
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+// Astar is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// Astar is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Astar. If not, see .
+
+#![cfg_attr(not(feature = "std"), no_std)]
+use parity_scale_codec::MaxEncodedLen;
+use parity_scale_codec::{Decode, Encode};
+use sp_runtime::{DispatchError, ModuleError};
+
+#[derive(PartialEq, Eq, Copy, Clone, Encode, Decode, Debug)]
+#[cfg_attr(feature = "std", derive(scale_info::TypeInfo))]
+pub enum Outcome {
+ /// Success
+ Success = 0,
+ /// Account balance must be greater than or equal to the transfer amount.
+ BalanceLow = 1,
+ /// The account to alter does not exist.
+ NoAccount = 2,
+ /// The signing account has no permission to do the operation.
+ NoPermission = 3,
+ /// The given asset ID is unknown.
+ Unknown = 4,
+ /// The origin account is frozen.
+ Frozen = 5,
+ /// The asset ID is already taken.
+ InUse = 6,
+ /// Invalid witness data given.
+ BadWitness = 7,
+ /// Minimum balance should be non-zero.
+ MinBalanceZero = 8,
+ /// Unable to increment the consumer reference counters on the account. Either no provider
+ /// reference exists to allow a non-zero balance of a non-self-sufficient asset, or the
+ /// maximum number of consumers has been reached.
+ NoProvider = 9,
+ /// Invalid metadata given.
+ BadMetadata = 10,
+ /// No approval exists that would allow the transfer.
+ Unapproved = 11,
+ /// The source account would not survive the transfer and it needs to stay alive.
+ WouldDie = 12,
+ /// The asset-account already exists.
+ AlreadyExists = 13,
+ /// The asset-account doesn't have an associated deposit.
+ NoDeposit = 14,
+ /// The operation would result in funds being burned.
+ WouldBurn = 15,
+ /// The asset is a live asset and is actively being used. Usually emit for operations such
+ /// as `start_destroy` which require the asset to be in a destroying state.
+ LiveAsset = 16,
+ /// The asset is not live, and likely being destroyed.
+ AssetNotLive = 17,
+ /// The asset status is not the expected status.
+ IncorrectStatus = 18,
+ /// The asset should be frozen before the given operation.
+ NotFrozen = 19,
+ /// Origin Caller is not supported
+ OriginCannotBeCaller = 98,
+ /// Unknown error
+ RuntimeError = 99,
+}
+
+impl From for Outcome {
+ fn from(input: DispatchError) -> Self {
+ let error_text = match input {
+ DispatchError::Module(ModuleError { message, .. }) => message,
+ _ => Some("No module error Info"),
+ };
+ return match error_text {
+ Some("BalanceLow") => Outcome::BalanceLow,
+ Some("NoAccount") => Outcome::NoAccount,
+ Some("NoPermission") => Outcome::NoPermission,
+ Some("Unknown") => Outcome::Unknown,
+ Some("Frozen") => Outcome::Frozen,
+ Some("InUse") => Outcome::InUse,
+ Some("BadWitness") => Outcome::BadWitness,
+ Some("MinBalanceZero") => Outcome::MinBalanceZero,
+ Some("NoProvider") => Outcome::NoProvider,
+ Some("BadMetadata") => Outcome::BadMetadata,
+ Some("Unapproved") => Outcome::Unapproved,
+ Some("WouldDie") => Outcome::WouldDie,
+ Some("AlreadyExists") => Outcome::AlreadyExists,
+ Some("NoDeposit") => Outcome::NoDeposit,
+ Some("WouldBurn") => Outcome::WouldBurn,
+ Some("LiveAsset") => Outcome::LiveAsset,
+ Some("AssetNotLive") => Outcome::AssetNotLive,
+ Some("IncorrectStatus") => Outcome::IncorrectStatus,
+ Some("NotFrozen") => Outcome::NotFrozen,
+ _ => Outcome::RuntimeError,
+ };
+ }
+}
+
+#[derive(Debug, Copy, Clone, PartialEq, Eq, Encode, Decode, MaxEncodedLen)]
+#[cfg_attr(feature = "std", derive(scale_info::TypeInfo))]
+pub enum Origin {
+ Caller,
+ Address,
+}
+
+impl Default for Origin {
+ fn default() -> Self {
+ Self::Address
+ }
+}
+
+#[macro_export]
+macro_rules! select_origin {
+ ($origin:expr, $account:expr) => {
+ match $origin {
+ Origin::Caller => return Ok(RetVal::Converging(Outcome::OriginCannotBeCaller as u32)),
+ Origin::Address => RawOrigin::Signed($account),
+ }
+ };
+}
diff --git a/chain-extensions/types/dapps-staking/Cargo.toml b/chain-extensions/types/dapps-staking/Cargo.toml
new file mode 100644
index 0000000000..fcd45a0034
--- /dev/null
+++ b/chain-extensions/types/dapps-staking/Cargo.toml
@@ -0,0 +1,26 @@
+[package]
+name = "dapps-staking-chain-extension-types"
+version = "1.1.0"
+license = "Apache-2.0"
+description = "Types definitions for dapps-staking chain-extension"
+authors.workspace = true
+edition.workspace = true
+homepage.workspace = true
+repository.workspace = true
+
+[dependencies]
+frame-support = { workspace = true }
+parity-scale-codec = { workspace = true }
+scale-info = { workspace = true }
+sp-core = { workspace = true }
+sp-runtime = { workspace = true }
+
+[features]
+default = ["std"]
+std = [
+ "parity-scale-codec/std",
+ "frame-support/std",
+ "scale-info/std",
+ "sp-core/std",
+ "sp-runtime/std",
+]
diff --git a/chain-extensions/types/dapps-staking/src/lib.rs b/chain-extensions/types/dapps-staking/src/lib.rs
new file mode 100644
index 0000000000..585a15213c
--- /dev/null
+++ b/chain-extensions/types/dapps-staking/src/lib.rs
@@ -0,0 +1,154 @@
+// This file is part of Astar.
+
+// Copyright (C) 2019-2023 Stake Technologies Pte.Ltd.
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+// Astar is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// Astar is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Astar. If not, see .
+
+#![cfg_attr(not(feature = "std"), no_std)]
+use frame_support::pallet_prelude::MaxEncodedLen;
+use parity_scale_codec::{Decode, Encode};
+use sp_runtime::{DispatchError, ModuleError};
+
+#[cfg_attr(feature = "std", derive(scale_info::TypeInfo))]
+#[derive(PartialEq, Eq, Copy, Clone, Encode, Decode, Debug)]
+pub enum DSError {
+ /// Success
+ Success = 0,
+ /// Disabled
+ Disabled = 1,
+ /// No change in maintenance mode
+ NoMaintenanceModeChange = 2,
+ /// Upgrade is too heavy, reduce the weight parameter.
+ UpgradeTooHeavy = 3,
+ /// Can not stake with zero value.
+ StakingWithNoValue = 4,
+ /// Can not stake with value less than minimum staking value
+ InsufficientValue = 5,
+ /// Number of stakers per contract exceeded.
+ MaxNumberOfStakersExceeded = 6,
+ /// Targets must be operated contracts
+ NotOperatedContract = 7,
+ /// Contract isn't staked.
+ NotStakedContract = 8,
+ /// Contract isn't unregistered.
+ NotUnregisteredContract = 9,
+ /// Unclaimed rewards should be claimed before withdrawing stake.
+ UnclaimedRewardsRemaining = 10,
+ /// Unstaking a contract with zero value
+ UnstakingWithNoValue = 11,
+ /// There are no previously unbonded funds that can be unstaked and withdrawn.
+ NothingToWithdraw = 12,
+ /// The contract is already registered by other account
+ AlreadyRegisteredContract = 13,
+ /// User attempts to register with address which is not contract
+ ContractIsNotValid = 14,
+ /// This account was already used to register contract
+ AlreadyUsedDeveloperAccount = 15,
+ /// Smart contract not owned by the account id.
+ NotOwnedContract = 16,
+ /// Report issue on github if this is ever emitted
+ UnknownEraReward = 17,
+ /// Report issue on github if this is ever emitted
+ UnexpectedStakeInfoEra = 18,
+ /// Contract has too many unlocking chunks. Withdraw the existing chunks if possible
+ /// or wait for current chunks to complete unlocking process to withdraw them.
+ TooManyUnlockingChunks = 19,
+ /// Contract already claimed in this era and reward is distributed
+ AlreadyClaimedInThisEra = 20,
+ /// Era parameter is out of bounds
+ EraOutOfBounds = 21,
+ /// Too many active `EraStake` values for (staker, contract) pairing.
+ /// Claim existing rewards to fix this problem.
+ TooManyEraStakeValues = 22,
+ /// To register a contract, pre-approval is needed for this address
+ RequiredContractPreApproval = 23,
+ /// Developer's account is already part of pre-approved list
+ AlreadyPreApprovedDeveloper = 24,
+ /// Account is not actively staking
+ NotActiveStaker = 25,
+ /// Transfering nomination to the same contract
+ NominationTransferToSameContract = 26,
+ /// Unexpected reward destination value
+ RewardDestinationValueOutOfBounds = 27,
+ /// Unknown error
+ UnknownError = 99,
+}
+
+impl TryFrom for DSError {
+ type Error = DispatchError;
+
+ fn try_from(input: DispatchError) -> Result {
+ let error_text = match input {
+ DispatchError::Module(ModuleError { message, .. }) => message,
+ _ => Some("No module error Info"),
+ };
+ return match error_text {
+ Some("Disabled") => Ok(DSError::Disabled),
+ Some("NoMaintenanceModeChange") => Ok(DSError::NoMaintenanceModeChange),
+ Some("UpgradeTooHeavy") => Ok(DSError::UpgradeTooHeavy),
+ Some("StakingWithNoValue") => Ok(DSError::StakingWithNoValue),
+ Some("InsufficientValue") => Ok(DSError::InsufficientValue),
+ Some("MaxNumberOfStakersExceeded") => Ok(DSError::MaxNumberOfStakersExceeded),
+ Some("NotOperatedContract") => Ok(DSError::NotOperatedContract),
+ Some("NotStakedContract") => Ok(DSError::NotStakedContract),
+ Some("NotUnregisteredContract") => Ok(DSError::NotUnregisteredContract),
+ Some("UnclaimedRewardsRemaining") => Ok(DSError::UnclaimedRewardsRemaining),
+ Some("UnstakingWithNoValue") => Ok(DSError::UnstakingWithNoValue),
+ Some("NothingToWithdraw") => Ok(DSError::NothingToWithdraw),
+ Some("AlreadyRegisteredContract") => Ok(DSError::AlreadyRegisteredContract),
+ Some("ContractIsNotValid") => Ok(DSError::ContractIsNotValid),
+ Some("AlreadyUsedDeveloperAccount") => Ok(DSError::AlreadyUsedDeveloperAccount),
+ Some("NotOwnedContract") => Ok(DSError::NotOwnedContract),
+ Some("UnknownEraReward") => Ok(DSError::UnknownEraReward),
+ Some("UnexpectedStakeInfoEra") => Ok(DSError::UnexpectedStakeInfoEra),
+ Some("TooManyUnlockingChunks") => Ok(DSError::TooManyUnlockingChunks),
+ Some("AlreadyClaimedInThisEra") => Ok(DSError::AlreadyClaimedInThisEra),
+ Some("EraOutOfBounds") => Ok(DSError::EraOutOfBounds),
+ Some("TooManyEraStakeValues") => Ok(DSError::TooManyEraStakeValues),
+ Some("RequiredContractPreApproval") => Ok(DSError::RequiredContractPreApproval),
+ Some("AlreadyPreApprovedDeveloper") => Ok(DSError::AlreadyPreApprovedDeveloper),
+ Some("NotActiveStaker") => Ok(DSError::NotActiveStaker),
+ Some("NominationTransferToSameContract") => {
+ Ok(DSError::NominationTransferToSameContract)
+ }
+ _ => Ok(DSError::UnknownError),
+ };
+ }
+}
+
+#[derive(Debug, Copy, Clone, PartialEq, Eq, Encode, Decode, MaxEncodedLen)]
+pub struct DappsStakingValueInput {
+ pub contract: [u8; 32],
+ pub value: Balance,
+}
+
+#[derive(Debug, Copy, Clone, PartialEq, Eq, Encode, Decode, MaxEncodedLen)]
+pub struct DappsStakingAccountInput {
+ pub contract: [u8; 32],
+ pub staker: [u8; 32],
+}
+
+#[derive(Debug, Copy, Clone, PartialEq, Eq, Encode, Decode, MaxEncodedLen)]
+pub struct DappsStakingEraInput {
+ pub contract: [u8; 32],
+ pub era: u32,
+}
+
+#[derive(Debug, Copy, Clone, PartialEq, Eq, Encode, Decode, MaxEncodedLen)]
+pub struct DappsStakingNominationInput {
+ pub origin_contract: [u8; 32],
+ pub target_contract: [u8; 32],
+ pub value: Balance,
+}
diff --git a/chain-extensions/types/xvm/Cargo.toml b/chain-extensions/types/xvm/Cargo.toml
new file mode 100644
index 0000000000..dd9129cc2b
--- /dev/null
+++ b/chain-extensions/types/xvm/Cargo.toml
@@ -0,0 +1,24 @@
+[package]
+name = "xvm-chain-extension-types"
+version = "0.1.0"
+license = "Apache-2.0"
+description = "Types definitions for contracts using xvm chain-extension."
+authors.workspace = true
+edition.workspace = true
+homepage.workspace = true
+repository.workspace = true
+
+[dependencies]
+parity-scale-codec = { workspace = true }
+scale-info = { workspace = true }
+sp-runtime = { workspace = true }
+sp-std = { workspace = true }
+
+[features]
+default = ["std"]
+std = [
+ "parity-scale-codec/std",
+ "scale-info/std",
+ "sp-runtime/std",
+ "sp-std/std",
+]
diff --git a/chain-extensions/types/xvm/src/lib.rs b/chain-extensions/types/xvm/src/lib.rs
new file mode 100644
index 0000000000..76443104fd
--- /dev/null
+++ b/chain-extensions/types/xvm/src/lib.rs
@@ -0,0 +1,60 @@
+// This file is part of Astar.
+
+// Copyright (C) 2019-2023 Stake Technologies Pte.Ltd.
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+// Astar is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// Astar is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Astar. If not, see .
+
+#![cfg_attr(not(feature = "std"), no_std)]
+
+use parity_scale_codec::{Decode, Encode};
+use sp_runtime::{DispatchError, ModuleError};
+use sp_std::vec::Vec;
+
+#[cfg_attr(feature = "std", derive(scale_info::TypeInfo))]
+#[derive(PartialEq, Eq, Copy, Clone, Encode, Decode, Debug)]
+pub enum XvmExecutionResult {
+ /// Success
+ Success = 0,
+ // TODO: expand this with concrete XVM errors
+ /// Error not (yet) covered by a dedidacted code
+ UnknownError = 255,
+}
+
+impl TryFrom for XvmExecutionResult {
+ type Error = DispatchError;
+
+ fn try_from(input: DispatchError) -> Result {
+ let _error_text = match input {
+ DispatchError::Module(ModuleError { message, .. }) => message,
+ _ => Some("No module error Info"),
+ };
+
+ // TODO: expand this with concrete XVM errors (see dapps-staking types for example)
+ Ok(XvmExecutionResult::UnknownError)
+ }
+}
+
+#[derive(Clone, PartialEq, Eq, Encode, Decode, Debug)]
+pub struct XvmCallArgs {
+ /// virtual machine identifier
+ pub vm_id: u8,
+ /// Call destination (e.g. address)
+ pub to: Vec,
+ /// Encoded call params
+ pub input: Vec,
+}
+
+pub const FRONTIER_VM_ID: u8 = 0x0F;
+pub const PARITY_WASM_VM_ID: u8 = 0x1F;
diff --git a/chain-extensions/xvm/Cargo.toml b/chain-extensions/xvm/Cargo.toml
new file mode 100644
index 0000000000..ae661fa79d
--- /dev/null
+++ b/chain-extensions/xvm/Cargo.toml
@@ -0,0 +1,43 @@
+[package]
+name = "pallet-chain-extension-xvm"
+version = "0.1.0"
+license = "Apache-2.0"
+description = "Chain extension for XVM"
+authors.workspace = true
+edition.workspace = true
+homepage.workspace = true
+repository.workspace = true
+
+[dependencies]
+frame-support = { workspace = true }
+frame-system = { workspace = true }
+log = { workspace = true }
+num-traits = { workspace = true }
+pallet-contracts = { workspace = true }
+pallet-contracts-primitives = { workspace = true }
+parity-scale-codec = { workspace = true }
+scale-info = { workspace = true }
+sp-core = { workspace = true }
+sp-runtime = { workspace = true }
+sp-std = { workspace = true }
+
+# Astar
+pallet-xvm = { workspace = true }
+xvm-chain-extension-types = { workspace = true }
+
+[features]
+default = ["std"]
+std = [
+ "parity-scale-codec/std",
+ "frame-support/std",
+ "frame-system/std",
+ "num-traits/std",
+ "pallet-contracts/std",
+ "pallet-contracts-primitives/std",
+ "scale-info/std",
+ "sp-std/std",
+ "sp-core/std",
+ "sp-runtime/std",
+ # Astar
+ "pallet-xvm/std",
+]
diff --git a/chain-extensions/xvm/src/lib.rs b/chain-extensions/xvm/src/lib.rs
new file mode 100644
index 0000000000..851271c187
--- /dev/null
+++ b/chain-extensions/xvm/src/lib.rs
@@ -0,0 +1,120 @@
+// This file is part of Astar.
+
+// Copyright (C) 2019-2023 Stake Technologies Pte.Ltd.
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+// Astar is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// Astar is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Astar. If not, see .
+
+#![cfg_attr(not(feature = "std"), no_std)]
+
+use frame_support::dispatch::Encode;
+use frame_support::weights::Weight;
+use pallet_contracts::chain_extension::{ChainExtension, Environment, Ext, InitState, RetVal};
+use pallet_xvm::XvmContext;
+use sp_runtime::DispatchError;
+use sp_std::marker::PhantomData;
+use xvm_chain_extension_types::{XvmCallArgs, XvmExecutionResult};
+
+enum XvmFuncId {
+ XvmCall,
+ // TODO: expand with other calls too
+}
+
+impl TryFrom for XvmFuncId {
+ type Error = DispatchError;
+
+ fn try_from(value: u16) -> Result {
+ match value {
+ 1 => Ok(XvmFuncId::XvmCall),
+ _ => Err(DispatchError::Other(
+ "Unsupported func id in Xvm chain extension",
+ )),
+ }
+ }
+}
+
+/// XVM chain extension.
+pub struct XvmExtension(PhantomData);
+
+impl Default for XvmExtension {
+ fn default() -> Self {
+ XvmExtension(PhantomData)
+ }
+}
+
+impl ChainExtension for XvmExtension
+where
+ T: pallet_contracts::Config + pallet_xvm::Config,
+{
+ fn call(&mut self, env: Environment) -> Result
+ where
+ E: Ext,
+ {
+ let func_id = env.func_id().try_into()?;
+ let mut env = env.buf_in_buf_out();
+
+ match func_id {
+ XvmFuncId::XvmCall => {
+ // We need to immediately charge for the worst case scenario. Gas equals Weight in pallet-contracts context.
+ let remaining_weight = env.ext().gas_meter().gas_left();
+ // We don't track used proof size, so we can't refund after.
+ // So we will charge a 32KB dummy value as a temporary replacement.
+ let charged_weight =
+ env.charge_weight(remaining_weight.set_proof_size(32 * 1024))?;
+
+ let caller = env.ext().caller().clone();
+
+ let XvmCallArgs { vm_id, to, input } = env.read_as_unbounded(env.in_len())?;
+
+ let _origin_address = env.ext().address().clone();
+ let _value = env.ext().value_transferred();
+ let xvm_context = XvmContext {
+ id: vm_id,
+ max_weight: remaining_weight,
+ env: None,
+ };
+
+ let call_result =
+ pallet_xvm::Pallet::::xvm_bare_call(xvm_context, caller, to, input);
+
+ let actual_weight = pallet_xvm::consumed_weight(&call_result);
+ // TODO: implement proof of size refund.
+ env.adjust_weight(charged_weight, Weight::from_ref_time(actual_weight));
+
+ match call_result {
+ Ok(success) => {
+ log::trace!(
+ target: "xvm-extension::xvm_call",
+ "success: {:?}", success
+ );
+
+ let buffer: sp_std::vec::Vec<_> = success.output().encode();
+ env.write(&buffer, false, None)?;
+ Ok(RetVal::Converging(XvmExecutionResult::Success as u32))
+ }
+
+ Err(failure) => {
+ log::trace!(
+ target: "xvm-extension::xvm_call",
+ "failure: {:?}", failure
+ );
+
+ // TODO Propagate error
+ Ok(RetVal::Converging(XvmExecutionResult::UnknownError as u32))
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/pallets/block-reward/Cargo.toml b/pallets/block-reward/Cargo.toml
new file mode 100644
index 0000000000..4520a1afff
--- /dev/null
+++ b/pallets/block-reward/Cargo.toml
@@ -0,0 +1,48 @@
+[package]
+name = "pallet-block-reward"
+version = "2.2.2"
+license = "Apache-2.0"
+description = "FRAME pallet for managing block reward issuance & distribution"
+authors.workspace = true
+edition.workspace = true
+homepage.workspace = true
+repository.workspace = true
+
+[dependencies]
+parity-scale-codec = { workspace = true }
+serde = { workspace = true }
+
+frame-support = { workspace = true }
+frame-system = { workspace = true }
+scale-info = { workspace = true }
+sp-arithmetic = { workspace = true }
+sp-runtime = { workspace = true }
+sp-std = { workspace = true }
+
+frame-benchmarking = { workspace = true, optional = true }
+
+[dev-dependencies]
+pallet-balances = { workspace = true }
+pallet-timestamp = { workspace = true }
+sp-core = { workspace = true }
+
+[features]
+default = ["std"]
+std = [
+ "parity-scale-codec/std",
+ "sp-core/std",
+ "scale-info/std",
+ "sp-std/std",
+ "serde/std",
+ "frame-support/std",
+ "frame-system/std",
+ "pallet-timestamp/std",
+ "pallet-balances/std",
+]
+runtime-benchmarks = [
+ "frame-benchmarking",
+ "frame-support/runtime-benchmarks",
+ "frame-system/runtime-benchmarks",
+ "sp-runtime/runtime-benchmarks",
+]
+try-runtime = ["frame-support/try-runtime"]
diff --git a/pallets/block-reward/src/benchmarking.rs b/pallets/block-reward/src/benchmarking.rs
new file mode 100644
index 0000000000..5f1a9c1a47
--- /dev/null
+++ b/pallets/block-reward/src/benchmarking.rs
@@ -0,0 +1,56 @@
+// This file is part of Astar.
+
+// Copyright (C) 2019-2023 Stake Technologies Pte.Ltd.
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+// Astar is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// Astar is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Astar. If not, see .
+
+#![cfg(feature = "runtime-benchmarks")]
+
+use super::*;
+
+use frame_benchmarking::{benchmarks, impl_benchmark_test_suite};
+use frame_system::{Pallet as System, RawOrigin};
+
+/// Assert that the last event equals the provided one.
+fn assert_last_event(generic_event: ::RuntimeEvent) {
+ System::::assert_last_event(generic_event.into());
+}
+
+benchmarks! {
+
+ set_configuration {
+ let reward_config = RewardDistributionConfig::default();
+ assert!(reward_config.is_consistent());
+ }: _(RawOrigin::Root, reward_config.clone())
+ verify {
+ assert_last_event::(Event::::DistributionConfigurationChanged(reward_config).into());
+ }
+}
+
+#[cfg(test)]
+mod tests {
+ use crate::mock;
+ use frame_support::sp_io::TestExternalities;
+
+ pub fn new_test_ext() -> TestExternalities {
+ mock::ExternalityBuilder::build()
+ }
+}
+
+impl_benchmark_test_suite!(
+ Pallet,
+ crate::benchmarking::tests::new_test_ext(),
+ crate::mock::TestRuntime,
+);
diff --git a/pallets/block-reward/src/lib.rs b/pallets/block-reward/src/lib.rs
new file mode 100644
index 0000000000..dee213e114
--- /dev/null
+++ b/pallets/block-reward/src/lib.rs
@@ -0,0 +1,350 @@
+// This file is part of Astar.
+
+// Copyright (C) 2019-2023 Stake Technologies Pte.Ltd.
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+// Astar is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// Astar is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Astar. If not, see .
+
+//! # Block Reward Distribution Pallet
+//!
+//! - [`Config`]
+//!
+//! ## Overview
+//!
+//! Pallet that implements block reward issuance and distribution mechanics.
+//!
+//! After issuing a block reward, pallet will calculate how to distribute the reward
+//! based on configurable parameters and chain state.
+//!
+//! Major on-chain factors which can influence reward distribution are total issuance and total value locked by dapps staking.
+//!
+//! ## Interface
+//!
+//! ### Dispatchable Function
+//!
+//! - `set_configuration` - used to change reward distribution configuration parameters
+//!
+//! ### Other
+//!
+//! - `on_timestamp_set` - This pallet implements the `OnTimestampSet` trait to handle block production.
+//! Note: We assume that it's impossible to set timestamp two times in a block.
+//!
+//! ## Usage
+//!
+//! 1. Pallet should be set as a handler of `OnTimestampSet`.
+//! 2. `DappsStakingTvlProvider` handler should be defined as an impl of `TvlProvider` trait. For example:
+//! ```nocompile
+//! pub struct TvlProvider();
+//! impl Get for TvlProvider {
+//! fn tvl() -> Balance {
+//! DappsStaking::total_locked_value()
+//! }
+//! }
+//! ```
+//! 3. `BeneficiaryPayout` handler should be defined as an impl of `BeneficiaryPayout` trait. For example:
+//! ```nocompile
+//! pub struct BeneficiaryPayout();
+//! impl BeneficiaryPayout> for BeneficiaryPayout {
+//!
+//! fn treasury(reward: NegativeImbalanceOf) {
+//! Balances::resolve_creating(&TREASURY_POT.into_account(), reward);
+//! }
+//!
+//! fn collators(reward: NegativeImbalanceOf) {
+//! Balances::resolve_creating(&COLLATOR_POT.into_account(), reward);
+//! }
+//!
+//! fn dapps_staking(stakers: NegativeImbalanceOf, dapps: NegativeImbalanceOf) {
+//! DappsStaking::rewards(stakers, dapps);
+//! }
+//! }
+//! ```
+//! 4. Set `RewardAmount` to desired block reward value in native currency.
+//!
+
+#![cfg_attr(not(feature = "std"), no_std)]
+
+pub use pallet::*;
+
+use frame_support::pallet_prelude::*;
+use frame_support::{
+ log,
+ traits::{Currency, Get, Imbalance, OnTimestampSet},
+};
+use frame_system::{ensure_root, pallet_prelude::*};
+use sp_runtime::{
+ traits::{CheckedAdd, Zero},
+ Perbill,
+};
+use sp_std::vec;
+
+#[cfg(any(feature = "runtime-benchmarks"))]
+pub mod benchmarking;
+#[cfg(test)]
+mod mock;
+#[cfg(test)]
+mod tests;
+
+pub mod weights;
+pub use weights::WeightInfo;
+
+#[frame_support::pallet]
+pub mod pallet {
+
+ use super::*;
+
+ #[pallet::pallet]
+ pub struct Pallet(PhantomData);
+
+ /// The balance type of this pallet.
+ pub(crate) type BalanceOf =
+ <::Currency as Currency<::AccountId>>::Balance;
+
+ // Negative imbalance type of this pallet.
+ pub(crate) type NegativeImbalanceOf = <::Currency as Currency<
+ ::AccountId,
+ >>::NegativeImbalance;
+
+ #[pallet::config]
+ pub trait Config: frame_system::Config {
+ /// The currency trait.
+ type Currency: Currency;
+
+ /// Provides information about how much value is locked by dapps staking
+ type DappsStakingTvlProvider: Get>;
+
+ /// Used to payout rewards
+ type BeneficiaryPayout: BeneficiaryPayout>;
+
+ /// The amount of issuance for each block.
+ #[pallet::constant]
+ type RewardAmount: Get>;
+
+ /// The overarching event type.
+ type RuntimeEvent: From> + IsType<::RuntimeEvent>;
+
+ /// Weight information for extrinsics in this pallet.
+ type WeightInfo: WeightInfo;
+ }
+
+ #[pallet::storage]
+ #[pallet::getter(fn reward_config)]
+ pub type RewardDistributionConfigStorage =
+ StorageValue<_, RewardDistributionConfig, ValueQuery>;
+
+ #[pallet::event]
+ #[pallet::generate_deposit(pub(crate) fn deposit_event)]
+ pub enum Event {
+ /// Distribution configuration has been updated.
+ DistributionConfigurationChanged(RewardDistributionConfig),
+ }
+
+ #[pallet::error]
+ pub enum Error {
+ /// Sum of all rations must be one whole (100%)
+ InvalidDistributionConfiguration,
+ }
+
+ #[pallet::genesis_config]
+ #[cfg_attr(feature = "std", derive(Default))]
+ pub struct GenesisConfig {
+ pub reward_config: RewardDistributionConfig,
+ }
+
+ #[pallet::genesis_build]
+ impl GenesisBuild for GenesisConfig {
+ fn build(&self) {
+ assert!(self.reward_config.is_consistent());
+ RewardDistributionConfigStorage::::put(self.reward_config.clone())
+ }
+ }
+
+ #[pallet::call]
+ impl Pallet {
+ /// Sets the reward distribution configuration parameters which will be used from next block reward distribution.
+ ///
+ /// It is mandatory that all components of configuration sum up to one whole (**100%**),
+ /// otherwise an error `InvalidDistributionConfiguration` will be raised.
+ ///
+ /// - `reward_distro_params` - reward distribution params
+ ///
+ /// Emits `DistributionConfigurationChanged` with config embeded into event itself.
+ ///
+ #[pallet::call_index(0)]
+ #[pallet::weight(T::WeightInfo::set_configuration())]
+ pub fn set_configuration(
+ origin: OriginFor,
+ reward_distro_params: RewardDistributionConfig,
+ ) -> DispatchResultWithPostInfo {
+ ensure_root(origin)?;
+
+ ensure!(
+ reward_distro_params.is_consistent(),
+ Error::::InvalidDistributionConfiguration
+ );
+ RewardDistributionConfigStorage::::put(reward_distro_params.clone());
+
+ Self::deposit_event(Event::::DistributionConfigurationChanged(
+ reward_distro_params,
+ ));
+
+ Ok(().into())
+ }
+ }
+
+ impl OnTimestampSet for Pallet {
+ fn on_timestamp_set(_moment: Moment) {
+ let inflation = T::Currency::issue(T::RewardAmount::get());
+ Self::distribute_rewards(inflation);
+ }
+ }
+
+ impl Pallet {
+ /// Distribute reward between beneficiaries.
+ ///
+ /// # Arguments
+ /// * `reward` - reward that will be split and distributed
+ ///
+ fn distribute_rewards(block_reward: NegativeImbalanceOf) {
+ let distro_params = Self::reward_config();
+
+ // Pre-calculate balance which will be deposited for each beneficiary
+ let base_staker_balance = distro_params.base_staker_percent * block_reward.peek();
+ let dapps_balance = distro_params.dapps_percent * block_reward.peek();
+ let collator_balance = distro_params.collators_percent * block_reward.peek();
+
+ // This is part that's distributed between stakers and treasury
+ let adjustable_balance = distro_params.adjustable_percent * block_reward.peek();
+
+ // Calculate total staker and treasury reward balance
+ let adjustable_staker_part = if distro_params.ideal_dapps_staking_tvl.is_zero() {
+ adjustable_balance
+ } else {
+ Self::tvl_percentage() / distro_params.ideal_dapps_staking_tvl * adjustable_balance
+ };
+
+ let total_staker_balance = base_staker_balance + adjustable_staker_part;
+
+ // Prepare imbalances
+ let (dapps_imbalance, remainder) = block_reward.split(dapps_balance);
+ let (stakers_imbalance, remainder) = remainder.split(total_staker_balance);
+ let (collator_imbalance, treasury_imbalance) = remainder.split(collator_balance);
+
+ // Payout beneficiaries
+ T::BeneficiaryPayout::treasury(treasury_imbalance);
+ T::BeneficiaryPayout::collators(collator_imbalance);
+ T::BeneficiaryPayout::dapps_staking(stakers_imbalance, dapps_imbalance);
+ }
+
+ /// Provides TVL as percentage of total issuance
+ fn tvl_percentage() -> Perbill {
+ let total_issuance = T::Currency::total_issuance();
+ if total_issuance.is_zero() {
+ log::warn!("Total issuance is zero - this should be impossible.");
+ Zero::zero()
+ } else {
+ Perbill::from_rational(T::DappsStakingTvlProvider::get(), total_issuance)
+ }
+ }
+ }
+}
+
+/// List of configuration parameters used to calculate reward distribution portions for all the beneficiaries.
+///
+/// Note that if `ideal_dapps_staking_tvl` is set to `Zero`, entire `adjustable_percent` goes to the stakers.
+///
+#[derive(PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug, TypeInfo, MaxEncodedLen)]
+#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))]
+pub struct RewardDistributionConfig {
+ /// Base percentage of reward that goes to treasury
+ #[codec(compact)]
+ pub base_treasury_percent: Perbill,
+ /// Base percentage of reward that goes to stakers
+ #[codec(compact)]
+ pub base_staker_percent: Perbill,
+ /// Percentage of rewards that goes to dApps
+ #[codec(compact)]
+ pub dapps_percent: Perbill,
+ /// Percentage of reward that goes to collators
+ #[codec(compact)]
+ pub collators_percent: Perbill,
+ /// Adjustable reward percentage that either goes to treasury or to stakers
+ #[codec(compact)]
+ pub adjustable_percent: Perbill,
+ /// Target dapps-staking TVL percentage at which adjustable inflation towards stakers becomes saturated
+ #[codec(compact)]
+ pub ideal_dapps_staking_tvl: Perbill,
+}
+
+impl Default for RewardDistributionConfig {
+ /// `default` values based on configuration at the time of writing this code.
+ /// Should be overriden by desired params.
+ fn default() -> Self {
+ RewardDistributionConfig {
+ base_treasury_percent: Perbill::from_percent(40),
+ base_staker_percent: Perbill::from_percent(25),
+ dapps_percent: Perbill::from_percent(25),
+ collators_percent: Perbill::from_percent(10),
+ adjustable_percent: Zero::zero(),
+ ideal_dapps_staking_tvl: Zero::zero(),
+ }
+ }
+}
+
+impl RewardDistributionConfig {
+ /// `true` if sum of all percentages is `one whole`, `false` otherwise.
+ pub fn is_consistent(&self) -> bool {
+ // TODO: perhaps this can be writen in a more cleaner way?
+ // experimental-only `try_reduce` could be used but it's not available
+ // https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.try_reduce
+
+ let variables = vec![
+ &self.base_treasury_percent,
+ &self.base_staker_percent,
+ &self.dapps_percent,
+ &self.collators_percent,
+ &self.adjustable_percent,
+ ];
+
+ let mut accumulator = Perbill::zero();
+ for config_param in variables {
+ let result = accumulator.checked_add(config_param);
+ if let Some(mid_result) = result {
+ accumulator = mid_result;
+ } else {
+ return false;
+ }
+ }
+
+ Perbill::one() == accumulator
+ }
+}
+
+/// Defines functions used to payout the beneficiaries of block rewards
+pub trait BeneficiaryPayout {
+ /// Payout reward to the treasury
+ fn treasury(reward: Imbalance);
+
+ /// Payout reward to the collators
+ fn collators(reward: Imbalance);
+
+ /// Payout reward to dapps staking
+ ///
+ /// # Arguments
+ ///
+ /// * `stakers` - reward that goes towards staker reward pot
+ /// * `dapps` - reward that goes towards dapps reward pot
+ ///
+ fn dapps_staking(stakers: Imbalance, dapps: Imbalance);
+}
diff --git a/pallets/block-reward/src/mock.rs b/pallets/block-reward/src/mock.rs
new file mode 100644
index 0000000000..5201fdd8af
--- /dev/null
+++ b/pallets/block-reward/src/mock.rs
@@ -0,0 +1,192 @@
+// This file is part of Astar.
+
+// Copyright (C) 2019-2023 Stake Technologies Pte.Ltd.
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+// Astar is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// Astar is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Astar. If not, see .
+
+use crate::{self as pallet_block_reward, NegativeImbalanceOf};
+
+use frame_support::{
+ construct_runtime, parameter_types, sp_io::TestExternalities, traits::Currency, traits::Get,
+ weights::Weight, PalletId,
+};
+
+use sp_core::H256;
+use sp_runtime::{
+ testing::Header,
+ traits::{AccountIdConversion, BlakeTwo256, IdentityLookup},
+};
+
+pub(crate) type AccountId = u64;
+pub(crate) type BlockNumber = u64;
+pub(crate) type Balance = u128;
+
+type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic;
+type Block = frame_system::mocking::MockBlock;
+
+/// Value shouldn't be less than 2 for testing purposes, otherwise we cannot test certain corner cases.
+pub(crate) const EXISTENTIAL_DEPOSIT: Balance = 2;
+
+construct_runtime!(
+ pub struct TestRuntime
+ where
+ Block = Block,
+ NodeBlock = Block,
+ UncheckedExtrinsic = UncheckedExtrinsic,
+ {
+ System: frame_system,
+ Balances: pallet_balances,
+ Timestamp: pallet_timestamp,
+ BlockReward: pallet_block_reward,
+ }
+);
+
+parameter_types! {
+ pub const BlockHashCount: u64 = 250;
+ pub BlockWeights: frame_system::limits::BlockWeights =
+ frame_system::limits::BlockWeights::simple_max(Weight::from_ref_time(1024));
+}
+
+impl frame_system::Config for TestRuntime {
+ type BaseCallFilter = frame_support::traits::Everything;
+ type BlockWeights = ();
+ type BlockLength = ();
+ type RuntimeOrigin = RuntimeOrigin;
+ type Index = u64;
+ type RuntimeCall = RuntimeCall;
+ type BlockNumber = BlockNumber;
+ type Hash = H256;
+ type Hashing = BlakeTwo256;
+ type AccountId = AccountId;
+ type Lookup = IdentityLookup;
+ type Header = Header;
+ type RuntimeEvent = RuntimeEvent;
+ type BlockHashCount = BlockHashCount;
+ type DbWeight = ();
+ type Version = ();
+ type PalletInfo = PalletInfo;
+ type AccountData = pallet_balances::AccountData;
+ type OnNewAccount = ();
+ type OnKilledAccount = ();
+ type SystemWeightInfo = ();
+ type SS58Prefix = ();
+ type OnSetCode = ();
+ type MaxConsumers = frame_support::traits::ConstU32<16>;
+}
+
+parameter_types! {
+ pub const MaxLocks: u32 = 4;
+ pub const ExistentialDeposit: Balance = EXISTENTIAL_DEPOSIT;
+}
+
+impl pallet_balances::Config for TestRuntime {
+ type MaxLocks = MaxLocks;
+ type MaxReserves = ();
+ type ReserveIdentifier = [u8; 8];
+ type Balance = Balance;
+ type RuntimeEvent = RuntimeEvent;
+ type DustRemoval = ();
+ type ExistentialDeposit = ExistentialDeposit;
+ type AccountStore = System;
+ type WeightInfo = ();
+}
+
+parameter_types! {
+ pub const MinimumPeriod: u64 = 3;
+}
+
+impl pallet_timestamp::Config for TestRuntime {
+ type Moment = u64;
+ type OnTimestampSet = ();
+ type MinimumPeriod = MinimumPeriod;
+ type WeightInfo = ();
+}
+
+// A fairly high block reward so we can detect slight changes in reward distribution
+// due to TVL changes.
+pub(crate) const BLOCK_REWARD: Balance = 1_000_000;
+
+// This gives us enough flexibility to get valid percentages by controlling issuance.
+pub(crate) const TVL: Balance = 1_000_000_000;
+
+// Fake accounts used to simulate reward beneficiaries balances
+pub(crate) const TREASURY_POT: PalletId = PalletId(*b"moktrsry");
+pub(crate) const COLLATOR_POT: PalletId = PalletId(*b"mokcolat");
+pub(crate) const STAKERS_POT: PalletId = PalletId(*b"mokstakr");
+pub(crate) const DAPPS_POT: PalletId = PalletId(*b"mokdapps");
+
+// Type used as TVL provider
+pub struct TvlProvider();
+impl Get for TvlProvider {
+ fn get() -> Balance {
+ TVL
+ }
+}
+
+// Type used as beneficiary payout handle
+pub struct BeneficiaryPayout();
+impl pallet_block_reward::BeneficiaryPayout>
+ for BeneficiaryPayout
+{
+ fn treasury(reward: NegativeImbalanceOf) {
+ Balances::resolve_creating(&TREASURY_POT.into_account_truncating(), reward);
+ }
+
+ fn collators(reward: NegativeImbalanceOf) {
+ Balances::resolve_creating(&COLLATOR_POT.into_account_truncating(), reward);
+ }
+
+ fn dapps_staking(
+ stakers: NegativeImbalanceOf,
+ dapps: NegativeImbalanceOf,
+ ) {
+ Balances::resolve_creating(&STAKERS_POT.into_account_truncating(), stakers);
+ Balances::resolve_creating(&DAPPS_POT.into_account_truncating(), dapps);
+ }
+}
+
+parameter_types! {
+ pub const RewardAmount: Balance = BLOCK_REWARD;
+}
+
+impl pallet_block_reward::Config for TestRuntime {
+ type RuntimeEvent = RuntimeEvent;
+ type Currency = Balances;
+ type RewardAmount = RewardAmount;
+ type DappsStakingTvlProvider = TvlProvider;
+ type BeneficiaryPayout = BeneficiaryPayout;
+ type WeightInfo = ();
+}
+
+pub struct ExternalityBuilder;
+
+impl ExternalityBuilder {
+ pub fn build() -> TestExternalities {
+ let mut storage = frame_system::GenesisConfig::default()
+ .build_storage::()
+ .unwrap();
+
+ // This will cause some initial issuance
+ pallet_balances::GenesisConfig:: {
+ balances: vec![(1, 9000), (2, 800), (3, 10000)],
+ }
+ .assimilate_storage(&mut storage)
+ .ok();
+
+ let mut ext = TestExternalities::from(storage);
+ ext.execute_with(|| System::set_block_number(1));
+ ext
+ }
+}
diff --git a/pallets/block-reward/src/tests.rs b/pallets/block-reward/src/tests.rs
new file mode 100644
index 0000000000..2669a74a28
--- /dev/null
+++ b/pallets/block-reward/src/tests.rs
@@ -0,0 +1,429 @@
+// This file is part of Astar.
+
+// Copyright (C) 2019-2023 Stake Technologies Pte.Ltd.
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+// Astar is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// Astar is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Astar. If not, see .
+
+use super::{pallet::Error, Event, *};
+use frame_support::{assert_noop, assert_ok, traits::OnTimestampSet};
+use mock::*;
+use sp_runtime::{
+ traits::{AccountIdConversion, BadOrigin, Zero},
+ Perbill,
+};
+
+#[test]
+fn default_reward_distribution_config_is_consitent() {
+ let reward_config = RewardDistributionConfig::default();
+ assert!(reward_config.is_consistent());
+}
+
+#[test]
+fn reward_distribution_config_is_consistent() {
+ // 1
+ let reward_config = RewardDistributionConfig {
+ base_treasury_percent: Perbill::from_percent(100),
+ base_staker_percent: Zero::zero(),
+ dapps_percent: Zero::zero(),
+ collators_percent: Zero::zero(),
+ adjustable_percent: Zero::zero(),
+ ideal_dapps_staking_tvl: Zero::zero(),
+ };
+ assert!(reward_config.is_consistent());
+
+ // 2
+ let reward_config = RewardDistributionConfig {
+ base_treasury_percent: Zero::zero(),
+ base_staker_percent: Perbill::from_percent(100),
+ dapps_percent: Zero::zero(),
+ collators_percent: Zero::zero(),
+ adjustable_percent: Zero::zero(),
+ ideal_dapps_staking_tvl: Zero::zero(),
+ };
+ assert!(reward_config.is_consistent());
+
+ // 3
+ let reward_config = RewardDistributionConfig {
+ base_treasury_percent: Zero::zero(),
+ base_staker_percent: Zero::zero(),
+ dapps_percent: Zero::zero(),
+ collators_percent: Zero::zero(),
+ adjustable_percent: Perbill::from_percent(100),
+ ideal_dapps_staking_tvl: Perbill::from_percent(13),
+ };
+ assert!(reward_config.is_consistent());
+
+ // 4
+ // 100%
+ let reward_config = RewardDistributionConfig {
+ base_treasury_percent: Perbill::from_percent(3),
+ base_staker_percent: Perbill::from_percent(14),
+ dapps_percent: Perbill::from_percent(18),
+ collators_percent: Perbill::from_percent(31),
+ adjustable_percent: Perbill::from_percent(34),
+ ideal_dapps_staking_tvl: Zero::zero(),
+ };
+ assert!(reward_config.is_consistent());
+}
+
+#[test]
+fn reward_distribution_config_not_consistent() {
+ // 1
+ let reward_config = RewardDistributionConfig {
+ base_treasury_percent: Perbill::from_percent(100),
+ ..Default::default()
+ };
+ assert!(!reward_config.is_consistent());
+
+ // 2
+ let reward_config = RewardDistributionConfig {
+ adjustable_percent: Perbill::from_percent(100),
+ ..Default::default()
+ };
+ assert!(!reward_config.is_consistent());
+
+ // 3
+ // 99%
+ let reward_config = RewardDistributionConfig {
+ base_treasury_percent: Perbill::from_percent(10),
+ base_staker_percent: Perbill::from_percent(20),
+ dapps_percent: Perbill::from_percent(20),
+ collators_percent: Perbill::from_percent(30),
+ adjustable_percent: Perbill::from_percent(19),
+ ideal_dapps_staking_tvl: Zero::zero(),
+ };
+ assert!(!reward_config.is_consistent());
+
+ // 4
+ // 101%
+ let reward_config = RewardDistributionConfig {
+ base_treasury_percent: Perbill::from_percent(10),
+ base_staker_percent: Perbill::from_percent(20),
+ dapps_percent: Perbill::from_percent(20),
+ collators_percent: Perbill::from_percent(31),
+ adjustable_percent: Perbill::from_percent(20),
+ ideal_dapps_staking_tvl: Zero::zero(),
+ };
+ assert!(!reward_config.is_consistent());
+}
+
+#[test]
+pub fn set_configuration_fails() {
+ ExternalityBuilder::build().execute_with(|| {
+ // 1
+ assert_noop!(
+ BlockReward::set_configuration(RuntimeOrigin::signed(1), Default::default()),
+ BadOrigin
+ );
+
+ // 2
+ let reward_config = RewardDistributionConfig {
+ base_treasury_percent: Perbill::from_percent(100),
+ ..Default::default()
+ };
+ assert!(!reward_config.is_consistent());
+ assert_noop!(
+ BlockReward::set_configuration(RuntimeOrigin::root(), reward_config),
+ Error::::InvalidDistributionConfiguration,
+ );
+ })
+}
+
+#[test]
+pub fn set_configuration_is_ok() {
+ ExternalityBuilder::build().execute_with(|| {
+ // custom config so it differs from the default one
+ let reward_config = RewardDistributionConfig {
+ base_treasury_percent: Perbill::from_percent(3),
+ base_staker_percent: Perbill::from_percent(14),
+ dapps_percent: Perbill::from_percent(18),
+ collators_percent: Perbill::from_percent(31),
+ adjustable_percent: Perbill::from_percent(34),
+ ideal_dapps_staking_tvl: Perbill::from_percent(87),
+ };
+ assert!(reward_config.is_consistent());
+
+ assert_ok!(BlockReward::set_configuration(
+ RuntimeOrigin::root(),
+ reward_config.clone()
+ ));
+ System::assert_last_event(mock::RuntimeEvent::BlockReward(
+ Event::DistributionConfigurationChanged(reward_config.clone()),
+ ));
+
+ assert_eq!(
+ RewardDistributionConfigStorage::::get(),
+ reward_config
+ );
+ })
+}
+
+#[test]
+pub fn inflation_and_total_issuance_as_expected() {
+ ExternalityBuilder::build().execute_with(|| {
+ let init_issuance = ::Currency::total_issuance();
+
+ for block in 0..10 {
+ assert_eq!(
+ ::Currency::total_issuance(),
+ block * BLOCK_REWARD + init_issuance
+ );
+ BlockReward::on_timestamp_set(0);
+ assert_eq!(
+ ::Currency::total_issuance(),
+ (block + 1) * BLOCK_REWARD + init_issuance
+ );
+ }
+ })
+}
+
+#[test]
+pub fn reward_distribution_as_expected() {
+ ExternalityBuilder::build().execute_with(|| {
+ // Ensure that initially, all beneficiaries have no free balance
+ let init_balance_snapshot = FreeBalanceSnapshot::new();
+ assert!(init_balance_snapshot.is_zero());
+
+ // Prepare a custom config (easily discernable percentages for visual verification)
+ let reward_config = RewardDistributionConfig {
+ base_treasury_percent: Perbill::from_percent(10),
+ base_staker_percent: Perbill::from_percent(20),
+ dapps_percent: Perbill::from_percent(25),
+ collators_percent: Perbill::from_percent(5),
+ adjustable_percent: Perbill::from_percent(40),
+ ideal_dapps_staking_tvl: Perbill::from_percent(50),
+ };
+ assert!(reward_config.is_consistent());
+ assert_ok!(BlockReward::set_configuration(
+ RuntimeOrigin::root(),
+ reward_config.clone()
+ ));
+
+ // Initial adjustment of TVL
+ adjust_tvl_percentage(Perbill::from_percent(30));
+
+ // Issue rewards a couple of times and verify distribution is as expected
+ for _block in 1..=100 {
+ let init_balance_state = FreeBalanceSnapshot::new();
+ let rewards = Rewards::calculate(&reward_config);
+
+ BlockReward::on_timestamp_set(0);
+
+ let final_balance_state = FreeBalanceSnapshot::new();
+ init_balance_state.assert_distribution(&final_balance_state, &rewards);
+ }
+ })
+}
+
+#[test]
+pub fn reward_distribution_no_adjustable_part() {
+ ExternalityBuilder::build().execute_with(|| {
+ let reward_config = RewardDistributionConfig {
+ base_treasury_percent: Perbill::from_percent(10),
+ base_staker_percent: Perbill::from_percent(45),
+ dapps_percent: Perbill::from_percent(40),
+ collators_percent: Perbill::from_percent(5),
+ adjustable_percent: Perbill::zero(),
+ ideal_dapps_staking_tvl: Perbill::from_percent(50), // this is irrelevant
+ };
+ assert!(reward_config.is_consistent());
+ assert_ok!(BlockReward::set_configuration(
+ RuntimeOrigin::root(),
+ reward_config.clone()
+ ));
+
+ // no adjustable part so we don't expect rewards to change with TVL percentage
+ let const_rewards = Rewards::calculate(&reward_config);
+
+ for _block in 1..=100 {
+ let init_balance_state = FreeBalanceSnapshot::new();
+ let rewards = Rewards::calculate(&reward_config);
+
+ assert_eq!(rewards, const_rewards);
+
+ BlockReward::on_timestamp_set(0);
+
+ let final_balance_state = FreeBalanceSnapshot::new();
+ init_balance_state.assert_distribution(&final_balance_state, &rewards);
+ }
+ })
+}
+
+#[test]
+pub fn reward_distribution_all_zero_except_one() {
+ ExternalityBuilder::build().execute_with(|| {
+ let reward_config = RewardDistributionConfig {
+ base_treasury_percent: Perbill::zero(),
+ base_staker_percent: Perbill::zero(),
+ dapps_percent: Perbill::zero(),
+ collators_percent: Perbill::zero(),
+ adjustable_percent: Perbill::one(),
+ ideal_dapps_staking_tvl: Perbill::from_percent(50), // this is irrelevant
+ };
+ assert!(reward_config.is_consistent());
+ assert_ok!(BlockReward::set_configuration(
+ RuntimeOrigin::root(),
+ reward_config.clone()
+ ));
+
+ for _block in 1..=10 {
+ let init_balance_state = FreeBalanceSnapshot::new();
+ let rewards = Rewards::calculate(&reward_config);
+
+ BlockReward::on_timestamp_set(0);
+
+ let final_balance_state = FreeBalanceSnapshot::new();
+ init_balance_state.assert_distribution(&final_balance_state, &rewards);
+ }
+ })
+}
+
+/// Represents free balance snapshot at a specific point in time
+#[derive(PartialEq, Eq, Clone, RuntimeDebug)]
+struct FreeBalanceSnapshot {
+ treasury: Balance,
+ collators: Balance,
+ stakers: Balance,
+ dapps: Balance,
+}
+
+impl FreeBalanceSnapshot {
+ /// Creates a new free balance snapshot using current balance state.
+ ///
+ /// Future balance changes won't be reflected in this instance.
+ fn new() -> Self {
+ Self {
+ treasury: ::Currency::free_balance(
+ &TREASURY_POT.into_account_truncating(),
+ ),
+ collators: ::Currency::free_balance(
+ &COLLATOR_POT.into_account_truncating(),
+ ),
+ stakers: ::Currency::free_balance(
+ &STAKERS_POT.into_account_truncating(),
+ ),
+ dapps: ::Currency::free_balance(
+ &DAPPS_POT.into_account_truncating(),
+ ),
+ }
+ }
+
+ /// `true` if all free balances equal `Zero`, `false` otherwise
+ fn is_zero(&self) -> bool {
+ self.treasury.is_zero()
+ && self.collators.is_zero()
+ && self.stakers.is_zero()
+ && self.dapps.is_zero()
+ }
+
+ /// Asserts that `post_reward_state` is as expected.
+ ///
+ /// Increase in balances, based on `rewards` values, is verified.
+ ///
+ fn assert_distribution(&self, post_reward_state: &Self, rewards: &Rewards) {
+ assert_eq!(
+ self.treasury + rewards.base_treasury_reward + rewards.adjustable_treasury_reward,
+ post_reward_state.treasury
+ );
+ assert_eq!(
+ self.stakers + rewards.base_staker_reward + rewards.adjustable_staker_reward,
+ post_reward_state.stakers
+ );
+ assert_eq!(
+ self.collators + rewards.collators_reward,
+ post_reward_state.collators
+ );
+ assert_eq!(self.dapps + rewards.dapps_reward, post_reward_state.dapps);
+ }
+}
+
+/// Represents reward distribution balances for a single distribution.
+#[derive(PartialEq, Eq, Clone, RuntimeDebug)]
+struct Rewards {
+ base_treasury_reward: Balance,
+ base_staker_reward: Balance,
+ dapps_reward: Balance,
+ collators_reward: Balance,
+ adjustable_treasury_reward: Balance,
+ adjustable_staker_reward: Balance,
+}
+
+impl Rewards {
+ /// Pre-calculates the reward distribution, using the provided `RewardDistributionConfig`.
+ /// Method assumes that total issuance will be increased by `BLOCK_REWARD`.
+ ///
+ /// Both current `total_issuance` and `TVL` are used. If these are changed after calling this function,
+ /// they won't be reflected in the struct.
+ ///
+ fn calculate(reward_config: &RewardDistributionConfig) -> Self {
+ // Calculate `tvl-independent` portions
+ let base_treasury_reward = reward_config.base_treasury_percent * BLOCK_REWARD;
+ let base_staker_reward = reward_config.base_staker_percent * BLOCK_REWARD;
+ let dapps_reward = reward_config.dapps_percent * BLOCK_REWARD;
+ let collators_reward = reward_config.collators_percent * BLOCK_REWARD;
+ let adjustable_reward = reward_config.adjustable_percent * BLOCK_REWARD;
+
+ // Calculate `tvl-dependent` portions
+ let future_total_issuance =
+ ::Currency::total_issuance() + BLOCK_REWARD;
+ let tvl = ::DappsStakingTvlProvider::get();
+ let tvl_percentage = Perbill::from_rational(tvl, future_total_issuance);
+
+ // Calculate factor for adjusting staker reward portion
+ let factor = if reward_config.ideal_dapps_staking_tvl <= tvl_percentage
+ || reward_config.ideal_dapps_staking_tvl.is_zero()
+ {
+ Perbill::one()
+ } else {
+ tvl_percentage / reward_config.ideal_dapps_staking_tvl
+ };
+
+ // Adjustable reward portions
+ let adjustable_staker_reward = factor * adjustable_reward;
+ let adjustable_treasury_reward = adjustable_reward - adjustable_staker_reward;
+
+ Self {
+ base_treasury_reward,
+ base_staker_reward,
+ dapps_reward,
+ collators_reward,
+ adjustable_treasury_reward,
+ adjustable_staker_reward,
+ }
+ }
+}
+
+/// Adjusts total_issuance in order to try-and-match the requested TVL percentage
+fn adjust_tvl_percentage(desired_tvl_percentage: Perbill) {
+ // Calculate the required total issuance
+ let tvl = ::DappsStakingTvlProvider::get();
+ let required_total_issuance = desired_tvl_percentage.saturating_reciprocal_mul(tvl);
+
+ // Calculate how much more we need to issue in order to get the desired TVL percentage
+ let init_total_issuance = ::Currency::total_issuance();
+ let to_issue = required_total_issuance.saturating_sub(init_total_issuance);
+
+ let dummy_acc = 1;
+ ::Currency::resolve_creating(
+ &dummy_acc,
+ ::Currency::issue(to_issue),
+ );
+
+ // Sanity check
+ assert_eq!(
+ ::Currency::total_issuance(),
+ required_total_issuance
+ );
+}
diff --git a/pallets/block-reward/src/weights.rs b/pallets/block-reward/src/weights.rs
new file mode 100644
index 0000000000..a040a73857
--- /dev/null
+++ b/pallets/block-reward/src/weights.rs
@@ -0,0 +1,77 @@
+// This file is part of Astar.
+
+// Copyright (C) 2019-2023 Stake Technologies Pte.Ltd.
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+// Astar is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// Astar is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Astar. If not, see .
+
+
+//! Autogenerated weights for pallet_block_reward
+//!
+//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
+//! DATE: 2023-04-04, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
+//! HOSTNAME: `devserver-01`, CPU: `Intel(R) Xeon(R) E-2236 CPU @ 3.40GHz`
+//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("shibuya-dev"), DB CACHE: 1024
+
+// Executed Command:
+// ./target/release/astar-collator
+// benchmark
+// pallet
+// --chain=shibuya-dev
+// --steps=50
+// --repeat=20
+// --pallet=pallet_block_reward
+// --extrinsic=*
+// --execution=wasm
+// --wasm-execution=compiled
+// --heap-pages=4096
+// --output=./benchmark-results/block_reward_weights.rs
+// --template=./scripts/templates/weight-template.hbs
+
+#![cfg_attr(rustfmt, rustfmt_skip)]
+#![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_block_reward.
+pub trait WeightInfo {
+ fn set_configuration() -> Weight;
+}
+
+/// Weights for pallet_block_reward using the Substrate node and recommended hardware.
+pub struct SubstrateWeight(PhantomData);
+impl WeightInfo for SubstrateWeight {
+ // Storage: BlockReward RewardDistributionConfigStorage (r:0 w:1)
+ // Proof: BlockReward RewardDistributionConfigStorage (max_values: Some(1), max_size: Some(24), added: 519, mode: MaxEncodedLen)
+ fn set_configuration() -> Weight {
+ // Minimum execution time: 9_085 nanoseconds.
+ Weight::from_ref_time(9_328_000)
+ .saturating_add(Weight::from_proof_size(0))
+ .saturating_add(T::DbWeight::get().writes(1_u64))
+ }
+}
+
+// For backwards compatibility and tests
+impl WeightInfo for () {
+ // Storage: BlockReward RewardDistributionConfigStorage (r:0 w:1)
+ // Proof: BlockReward RewardDistributionConfigStorage (max_values: Some(1), max_size: Some(24), added: 519, mode: MaxEncodedLen)
+ fn set_configuration() -> Weight {
+ // Minimum execution time: 9_085 nanoseconds.
+ Weight::from_ref_time(9_328_000)
+ .saturating_add(Weight::from_proof_size(0))
+ .saturating_add(RocksDbWeight::get().writes(1_u64))
+ }
+}
\ No newline at end of file
diff --git a/pallets/collator-selection/Cargo.toml b/pallets/collator-selection/Cargo.toml
new file mode 100644
index 0000000000..4374e602f4
--- /dev/null
+++ b/pallets/collator-selection/Cargo.toml
@@ -0,0 +1,64 @@
+[package]
+description = "Simple staking pallet with a fixed stake."
+license = "Apache-2.0"
+name = "pallet-collator-selection"
+readme = "README.md"
+version = "3.3.2"
+authors.workspace = true
+edition.workspace = true
+homepage.workspace = true
+repository.workspace = true
+
+[package.metadata.docs.rs]
+targets = ["x86_64-unknown-linux-gnu"]
+
+[dependencies]
+log = { workspace = true }
+parity-scale-codec = { workspace = true }
+rand = { workspace = true, features = ["std_rng"] }
+scale-info = { workspace = true }
+serde = { workspace = true }
+
+frame-support = { workspace = true }
+frame-system = { workspace = true }
+pallet-authorship = { workspace = true }
+pallet-session = { workspace = true }
+sp-runtime = { workspace = true }
+sp-staking = { workspace = true }
+sp-std = { workspace = true }
+
+frame-benchmarking = { workspace = true, optional = true }
+
+[dev-dependencies]
+pallet-aura = { workspace = true }
+pallet-balances = { workspace = true }
+pallet-timestamp = { workspace = true }
+sp-consensus-aura = { workspace = true }
+sp-core = { workspace = true }
+sp-io = { workspace = true }
+sp-tracing = { workspace = true }
+
+[features]
+default = ["std"]
+runtime-benchmarks = [
+ "frame-benchmarking",
+ "frame-support/runtime-benchmarks",
+ "frame-system/runtime-benchmarks",
+]
+std = [
+ "parity-scale-codec/std",
+ "log/std",
+ "scale-info/std",
+ "rand/std",
+ "sp-runtime/std",
+ "sp-staking/std",
+ "sp-std/std",
+ "frame-support/std",
+ "frame-system/std",
+ "frame-benchmarking/std",
+ "pallet-authorship/std",
+ "pallet-session/std",
+ "pallet-aura/std",
+]
+
+try-runtime = ["frame-support/try-runtime"]
diff --git a/pallets/collator-selection/README.md b/pallets/collator-selection/README.md
new file mode 100644
index 0000000000..9718db58b3
--- /dev/null
+++ b/pallets/collator-selection/README.md
@@ -0,0 +1 @@
+License: Apache-2.0
\ No newline at end of file
diff --git a/pallets/collator-selection/src/benchmarking.rs b/pallets/collator-selection/src/benchmarking.rs
new file mode 100644
index 0000000000..2844b69565
--- /dev/null
+++ b/pallets/collator-selection/src/benchmarking.rs
@@ -0,0 +1,271 @@
+// This file is part of Astar.
+
+// Copyright (C) 2019-2023 Stake Technologies Pte.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.
+
+//! Benchmarking setup for pallet-collator-selection
+
+use super::*;
+
+#[allow(unused)]
+use crate::Pallet as CollatorSelection;
+use frame_benchmarking::{
+ account, benchmarks, impl_benchmark_test_suite, whitelisted_caller, BenchmarkError,
+};
+use frame_support::{
+ assert_ok,
+ codec::Decode,
+ traits::{Currency, EnsureOrigin, Get},
+};
+use frame_system::{EventRecord, RawOrigin};
+use pallet_authorship::EventHandler;
+use pallet_session::{self as session, SessionManager};
+use sp_std::prelude::*;
+
+pub type BalanceOf =
+ <::Currency as Currency<::AccountId>>::Balance;
+
+const SEED: u32 = 0;
+
+// TODO: remove if this is given in substrate commit.
+macro_rules! whitelist {
+ ($acc:ident) => {
+ frame_benchmarking::benchmarking::add_to_whitelist(
+ frame_system::Account::::hashed_key_for(&$acc).into(),
+ );
+ };
+}
+
+fn assert_last_event(generic_event: ::RuntimeEvent) {
+ let events = frame_system::Pallet::::events();
+ let system_event: ::RuntimeEvent = generic_event.into();
+ // compare to the last event record
+ let EventRecord { event, .. } = &events[events.len() - 1];
+ assert_eq!(event, &system_event);
+}
+
+fn create_funded_user(
+ string: &'static str,
+ n: u32,
+ balance_factor: u32,
+) -> T::AccountId {
+ let user = account(string, n, SEED);
+ let balance = T::Currency::minimum_balance() * balance_factor.into();
+ let _ = T::Currency::make_free_balance_be(&user, balance);
+ user
+}
+
+fn keys(c: u32) -> ::Keys {
+ use rand::{RngCore, SeedableRng};
+
+ let keys = {
+ let mut keys = [0u8; 128];
+
+ if c > 0 {
+ let mut rng = rand::rngs::StdRng::seed_from_u64(c as u64);
+ rng.fill_bytes(&mut keys);
+ }
+
+ keys
+ };
+
+ Decode::decode(&mut &keys[..]).unwrap()
+}
+
+fn validator(c: u32) -> (T::AccountId, ::Keys) {
+ (create_funded_user::("candidate", c, 1000), keys::(c))
+}
+
+fn register_validators(count: u32) -> Vec {
+ let validators = (0..count).map(|c| validator::(c)).collect::>();
+
+ for (who, keys) in validators.clone() {
+ >::set_keys(RawOrigin::Signed(who).into(), keys, Vec::new()).unwrap();
+ }
+
+ validators.into_iter().map(|(who, _)| who).collect()
+}
+
+fn register_candidates(count: u32) {
+ let candidates = (0..count)
+ .map(|c| account("candidate", c, SEED))
+ .collect::>();
+ assert!(
+ >::get() > 0u32.into(),
+ "Bond cannot be zero!"
+ );
+
+ for who in candidates {
+ T::Currency::make_free_balance_be(&who, >::get() * 2u32.into());
+ >::register_as_candidate(RawOrigin::Signed(who).into()).unwrap();
+ }
+}
+
+benchmarks! {
+ where_clause { where T: pallet_authorship::Config + session::Config }
+
+ set_invulnerables {
+ let b in 1 .. T::MaxInvulnerables::get();
+ let new_invulnerables = register_validators::(b);
+ let origin = T::UpdateOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?;
+ }: {
+ assert_ok!(
+ >::set_invulnerables(origin, new_invulnerables.clone())
+ );
+ }
+ verify {
+ assert_last_event::(Event::NewInvulnerables(new_invulnerables).into());
+ }
+
+ set_desired_candidates {
+ let max: u32 = 148;
+ let origin = T::UpdateOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?;
+ }: {
+ assert_ok!(
+ >::set_desired_candidates(origin, max)
+ );
+ }
+ verify {
+ assert_last_event::(Event::NewDesiredCandidates(max).into());
+ }
+
+ set_candidacy_bond {
+ let bond: BalanceOf = T::Currency::minimum_balance() * 10u32.into();
+ let origin = T::UpdateOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?;
+ }: {
+ assert_ok!(
+ >::set_candidacy_bond(origin, bond)
+ );
+ }
+ verify {
+ assert_last_event::(Event::NewCandidacyBond(bond).into());
+ }
+
+ // worse case is when we have all the max-candidate slots filled except one, and we fill that
+ // one.
+ register_as_candidate {
+ let c in 1 .. T::MaxCandidates::get();
+
+