From 44d16ffd2275cfe2052ca23e77ebaf172841230f Mon Sep 17 00:00:00 2001 From: Dmitry Novikov Date: Fri, 15 Sep 2023 16:49:28 +0400 Subject: [PATCH 1/7] chore(v1.0.0): Versions (#3263) --- Cargo.lock | 76 ++++++++++++------------- Cargo.toml | 16 +++--- lazy-pages/Cargo.toml | 8 +-- node/authorship/Cargo.toml | 7 +-- node/cli/Cargo.toml | 3 + node/service/Cargo.toml | 7 +-- node/testing/Cargo.toml | 7 +-- pallets/gas/Cargo.toml | 12 ++-- pallets/gear-bank/Cargo.toml | 4 +- pallets/gear-debug/Cargo.toml | 11 ++-- pallets/gear-messenger/Cargo.toml | 12 ++-- pallets/gear-program/Cargo.toml | 12 ++-- pallets/gear-scheduler/Cargo.toml | 12 ++-- pallets/gear-voucher/Cargo.toml | 12 ++-- pallets/gear/Cargo.toml | 14 ++--- pallets/gear/proc-macro/Cargo.toml | 12 ++-- pallets/gear/rpc/Cargo.toml | 6 +- pallets/gear/rpc/runtime-api/Cargo.toml | 10 ++-- pallets/payment/Cargo.toml | 11 ++-- pallets/staking-rewards/Cargo.toml | 12 ++-- runtime-interface/Cargo.toml | 8 +-- runtime/common/Cargo.toml | 6 +- runtime/gear/Cargo.toml | 8 +-- runtime/gear/src/lib.rs | 2 +- runtime/primitives/Cargo.toml | 8 +-- runtime/vara/Cargo.toml | 8 +-- runtime/vara/src/lib.rs | 2 +- 27 files changed, 153 insertions(+), 153 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2500a3e11f1..32ac68ad265 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3631,14 +3631,14 @@ dependencies = [ [[package]] name = "galloc" -version = "0.3.4" +version = "1.0.0" dependencies = [ "dlmalloc", ] [[package]] name = "gcli" -version = "0.3.4" +version = "1.0.0" dependencies = [ "anyhow", "base64 0.21.3", @@ -3677,7 +3677,7 @@ dependencies = [ [[package]] name = "gclient" -version = "0.3.4" +version = "1.0.0" dependencies = [ "anyhow", "async-trait", @@ -3721,7 +3721,7 @@ dependencies = [ [[package]] name = "gcore" -version = "0.3.4" +version = "1.0.0" dependencies = [ "galloc", "gear-core-errors", @@ -3734,7 +3734,7 @@ dependencies = [ [[package]] name = "gear-authorship" -version = "0.1.0" +version = "1.0.0" dependencies = [ "demo-mul-by-const", "env_logger", @@ -3776,7 +3776,7 @@ dependencies = [ [[package]] name = "gear-backend-codegen" -version = "0.3.4" +version = "1.0.0" dependencies = [ "proc-macro2", "quote", @@ -3785,7 +3785,7 @@ dependencies = [ [[package]] name = "gear-backend-common" -version = "0.3.4" +version = "1.0.0" dependencies = [ "actor-system-error", "blake2-rfc", @@ -3844,7 +3844,7 @@ dependencies = [ [[package]] name = "gear-cli" -version = "0.3.4" +version = "1.0.0" dependencies = [ "clap 4.4.2", "frame-benchmarking", @@ -3878,7 +3878,7 @@ dependencies = [ [[package]] name = "gear-common" -version = "0.3.4" +version = "1.0.0" dependencies = [ "derive_more", "enum-iterator 1.4.1", @@ -3906,7 +3906,7 @@ dependencies = [ [[package]] name = "gear-common-codegen" -version = "0.3.4" +version = "1.0.0" dependencies = [ "quote", "syn 2.0.31", @@ -3914,7 +3914,7 @@ dependencies = [ [[package]] name = "gear-core" -version = "0.3.4" +version = "1.0.0" dependencies = [ "blake2-rfc", "byteorder", @@ -3936,7 +3936,7 @@ dependencies = [ [[package]] name = "gear-core-errors" -version = "0.3.4" +version = "1.0.0" dependencies = [ "derive_more", "enum-iterator 1.4.1", @@ -3945,7 +3945,7 @@ dependencies = [ [[package]] name = "gear-core-processor" -version = "0.3.4" +version = "1.0.0" dependencies = [ "actor-system-error", "derive_more", @@ -3963,7 +3963,7 @@ dependencies = [ [[package]] name = "gear-lazy-pages" -version = "0.1.0" +version = "1.0.0" dependencies = [ "cfg-if", "derive_more", @@ -4003,7 +4003,7 @@ dependencies = [ [[package]] name = "gear-node-loader" -version = "0.3.4" +version = "1.0.0" dependencies = [ "anyhow", "arbitrary", @@ -4035,7 +4035,7 @@ dependencies = [ [[package]] name = "gear-node-testing" -version = "0.1.0" +version = "1.0.0" dependencies = [ "frame-benchmarking", "frame-support", @@ -4103,7 +4103,7 @@ dependencies = [ [[package]] name = "gear-runtime" -version = "0.1.0" +version = "1.0.0" dependencies = [ "const-str", "frame-benchmarking", @@ -4163,7 +4163,7 @@ dependencies = [ [[package]] name = "gear-runtime-common" -version = "0.1.0" +version = "1.0.0" dependencies = [ "frame-benchmarking", "frame-support", @@ -4189,7 +4189,7 @@ dependencies = [ [[package]] name = "gear-runtime-interface" -version = "0.1.0" +version = "1.0.0" dependencies = [ "byteorder", "derive_more", @@ -4211,7 +4211,7 @@ dependencies = [ [[package]] name = "gear-runtime-primitives" -version = "0.1.0" +version = "1.0.0" dependencies = [ "sp-core 7.0.0 (git+https://github.com/gear-tech/substrate.git?branch=gear-polkadot-v0.9.41-canary-no-sandbox)", "sp-runtime 7.0.0 (git+https://github.com/gear-tech/substrate.git?branch=gear-polkadot-v0.9.41-canary-no-sandbox)", @@ -4264,7 +4264,7 @@ dependencies = [ [[package]] name = "gear-service" -version = "0.1.0" +version = "1.0.0" dependencies = [ "frame-benchmarking", "frame-benchmarking-cli", @@ -4343,7 +4343,7 @@ dependencies = [ [[package]] name = "gear-stack-buffer" -version = "0.3.4" +version = "1.0.0" dependencies = [ "cc", ] @@ -4436,7 +4436,7 @@ dependencies = [ [[package]] name = "gear-wasm-instrument" -version = "0.3.4" +version = "1.0.0" dependencies = [ "enum-iterator 1.4.1", "gear-backend-common", @@ -4606,7 +4606,7 @@ dependencies = [ [[package]] name = "gmeta" -version = "0.3.4" +version = "1.0.0" dependencies = [ "blake2-rfc", "derive_more", @@ -4620,7 +4620,7 @@ dependencies = [ [[package]] name = "gmeta-codegen" -version = "0.3.4" +version = "1.0.0" dependencies = [ "gmeta", "gstd", @@ -4644,7 +4644,7 @@ dependencies = [ [[package]] name = "gsdk" -version = "0.3.4" +version = "1.0.0" dependencies = [ "anyhow", "base64 0.21.3", @@ -4695,7 +4695,7 @@ dependencies = [ [[package]] name = "gsdk-codegen" -version = "0.3.4" +version = "1.0.0" dependencies = [ "proc-macro2", "quote", @@ -4704,7 +4704,7 @@ dependencies = [ [[package]] name = "gstd" -version = "0.3.4" +version = "1.0.0" dependencies = [ "bs58", "futures", @@ -4733,7 +4733,7 @@ dependencies = [ [[package]] name = "gsys" -version = "0.3.4" +version = "1.0.0" [[package]] name = "gtest" @@ -7330,7 +7330,7 @@ dependencies = [ [[package]] name = "pallet-gear" -version = "2.0.0" +version = "1.0.0" dependencies = [ "blake2-rfc", "demo-async", @@ -7446,7 +7446,7 @@ dependencies = [ [[package]] name = "pallet-gear-debug" -version = "2.0.0" +version = "1.0.0" dependencies = [ "demo-vec", "env_logger", @@ -7483,7 +7483,7 @@ dependencies = [ [[package]] name = "pallet-gear-gas" -version = "2.0.0" +version = "1.0.0" dependencies = [ "env_logger", "frame-benchmarking", @@ -7536,7 +7536,7 @@ dependencies = [ [[package]] name = "pallet-gear-payment" -version = "0.1.0" +version = "1.0.0" dependencies = [ "env_logger", "frame-benchmarking", @@ -7570,7 +7570,7 @@ dependencies = [ [[package]] name = "pallet-gear-proc-macro" -version = "2.0.0" +version = "1.0.0" dependencies = [ "proc-macro2", "quote", @@ -7579,7 +7579,7 @@ dependencies = [ [[package]] name = "pallet-gear-program" -version = "2.0.0" +version = "1.0.0" dependencies = [ "frame-support", "frame-system", @@ -7604,7 +7604,7 @@ dependencies = [ [[package]] name = "pallet-gear-rpc" -version = "2.0.0" +version = "1.0.0" dependencies = [ "gear-common", "gear-core", @@ -7620,7 +7620,7 @@ dependencies = [ [[package]] name = "pallet-gear-rpc-runtime-api" -version = "2.0.0" +version = "1.0.0" dependencies = [ "pallet-gear", "sp-api", @@ -13492,7 +13492,7 @@ checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" [[package]] name = "vara-runtime" -version = "0.1.0" +version = "1.0.0" dependencies = [ "const-str", "env_logger", diff --git a/Cargo.toml b/Cargo.toml index 6dbd8172a62..f3d587003ee 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,9 +1,9 @@ [workspace.package] -version = "0.3.4" +version = "1.0.0" authors = ["Gear Technologies"] edition = "2021" license = "GPL-3.0" -homepage = "https://www.gear-tech.io" +homepage = "https://gear-tech.io" repository = "https://github.com/gear-tech/gear" [workspace] @@ -226,16 +226,16 @@ pallet-gear = { path = "pallets/gear", default-features = false } pallet-gear-debug = { path = "pallets/gear-debug", default-features = false } pallet-gear-gas = { path = "pallets/gas", default-features = false } pallet-gear-messenger = { path = "pallets/gear-messenger", default-features = false } -pallet-gear-payment = { version = "0.1.0", path = "pallets/payment", default-features = false } +pallet-gear-payment = { path = "pallets/payment", default-features = false } pallet-gear-program = { path = "pallets/gear-program", default-features = false } pallet-gear-rpc = { path = "pallets/gear/rpc" } -pallet-gear-rpc-runtime-api = { version = "2.0.0", path = "pallets/gear/rpc/runtime-api", default-features = false } +pallet-gear-rpc-runtime-api = { path = "pallets/gear/rpc/runtime-api", default-features = false } pallet-gear-scheduler = { path = "pallets/gear-scheduler", default-features = false } -pallet-gear-staking-rewards = { version = "1.0.0", path = "pallets/staking-rewards", default-features = false } -pallet-gear-voucher = { version = "1.0.0", path = "pallets/gear-voucher", default-features = false } -pallet-gear-bank = { version = "1.0.0", path = "pallets/gear-bank", default-features = false } +pallet-gear-staking-rewards = { path = "pallets/staking-rewards", default-features = false } +pallet-gear-voucher = { path = "pallets/gear-voucher", default-features = false } +pallet-gear-bank = { path = "pallets/gear-bank", default-features = false } runtime-common = { package = "gear-runtime-common", path = "runtime/common", default-features = false } -runtime-primitives = { package = "gear-runtime-primitives", path = "runtime/primitives", version = "0.1.0", default-features = false } +runtime-primitives = { package = "gear-runtime-primitives", path = "runtime/primitives", default-features = false } service = { package = "gear-service", path = "node/service", default-features = false } testing = { package = "gear-node-testing", path = "node/testing" } vara-runtime = { path = "runtime/vara" } diff --git a/lazy-pages/Cargo.toml b/lazy-pages/Cargo.toml index a088e0b9a48..56510ab1ed5 100644 --- a/lazy-pages/Cargo.toml +++ b/lazy-pages/Cargo.toml @@ -1,12 +1,12 @@ [package] name = "gear-lazy-pages" -version = "0.1.0" -authors.workspace = true description = "Gear lazy-pages support" +version.workspace = true +authors.workspace = true edition.workspace = true license.workspace = true -homepage = "https://gear-tech.io" -repository = "https://github.com/gear-tech/gear" +homepage.workspace = true +repository.workspace = true [dependencies] log = { workspace = true, features = ["std"] } diff --git a/node/authorship/Cargo.toml b/node/authorship/Cargo.toml index a445c9d5f08..9c9633d0ce9 100644 --- a/node/authorship/Cargo.toml +++ b/node/authorship/Cargo.toml @@ -1,12 +1,11 @@ [package] name = "gear-authorship" -version = "0.1.0" +version.workspace = true authors.workspace = true -description = "Gear Node" edition.workspace = true license.workspace = true -homepage = "https://gear-tech.io" -repository = "https://github.com/gear-tech/gear" +homepage.workspace = true +repository.workspace = true [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] diff --git a/node/cli/Cargo.toml b/node/cli/Cargo.toml index 21fe8615206..022e3f13c0c 100644 --- a/node/cli/Cargo.toml +++ b/node/cli/Cargo.toml @@ -3,6 +3,9 @@ name = "gear-cli" version.workspace = true authors.workspace = true edition.workspace = true +license.workspace = true +homepage.workspace = true +repository.workspace = true [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] diff --git a/node/service/Cargo.toml b/node/service/Cargo.toml index a51975375cb..8a7149183bc 100644 --- a/node/service/Cargo.toml +++ b/node/service/Cargo.toml @@ -1,12 +1,11 @@ [package] name = "gear-service" -version = "0.1.0" +version.workspace = true authors.workspace = true -description = "Gear Node" edition.workspace = true license.workspace = true -homepage = "https://gear-tech.io" -repository = "https://github.com/gear-tech/gear" +homepage.workspace = true +repository.workspace = true [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] diff --git a/node/testing/Cargo.toml b/node/testing/Cargo.toml index c3d823d90e9..807793fdf89 100644 --- a/node/testing/Cargo.toml +++ b/node/testing/Cargo.toml @@ -1,12 +1,11 @@ [package] name = "gear-node-testing" -version = "0.1.0" +version.workspace = true authors.workspace = true -description = "Gear Node" edition.workspace = true license.workspace = true -homepage = "https://gear-tech.io" -repository = "https://github.com/gear-tech/gear" +homepage.workspace = true +repository.workspace = true [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] diff --git a/pallets/gas/Cargo.toml b/pallets/gas/Cargo.toml index 765924dc01c..2d78fad78e2 100644 --- a/pallets/gas/Cargo.toml +++ b/pallets/gas/Cargo.toml @@ -1,12 +1,12 @@ [package] name = "pallet-gear-gas" -version = "2.0.0" -authors = ['Gear Technologies'] -edition = '2021' -license.workspace = true -homepage = "https://gear-tech.io" -repository = "https://github.com/gear-tech/gear" description = "Gear gas pallet" +version.workspace = true +authors.workspace = true +edition.workspace = true +license.workspace = true +homepage.workspace = true +repository.workspace = true readme = "README.md" [package.metadata.docs.rs] diff --git a/pallets/gear-bank/Cargo.toml b/pallets/gear-bank/Cargo.toml index 0872ba22114..7075b18ace2 100644 --- a/pallets/gear-bank/Cargo.toml +++ b/pallets/gear-bank/Cargo.toml @@ -1,9 +1,11 @@ [package] name = "pallet-gear-bank" -version = "1.0.0" +version.workspace = true authors.workspace = true edition.workspace = true license.workspace = true +homepage.workspace = true +repository.workspace = true [dependencies] parity-scale-codec = { workspace = true, features = ["derive"] } diff --git a/pallets/gear-debug/Cargo.toml b/pallets/gear-debug/Cargo.toml index b50cc788401..f4d0e4c3294 100644 --- a/pallets/gear-debug/Cargo.toml +++ b/pallets/gear-debug/Cargo.toml @@ -1,12 +1,11 @@ [package] name = "pallet-gear-debug" -version = "2.0.0" -authors = ['Gear Technologies'] -edition = '2021' +version.workspace = true +authors.workspace = true +edition.workspace = true license.workspace = true -homepage = "https://gear-tech.io" -repository = "https://github.com/gear-tech/gear" -description = "Gear main pallet" +homepage.workspace = true +repository.workspace = true readme = "README.md" [package.metadata.docs.rs] diff --git a/pallets/gear-messenger/Cargo.toml b/pallets/gear-messenger/Cargo.toml index ba69981ea20..8037b76a09f 100644 --- a/pallets/gear-messenger/Cargo.toml +++ b/pallets/gear-messenger/Cargo.toml @@ -1,12 +1,12 @@ [package] name = "pallet-gear-messenger" -version = "1.0.0" -authors = ['Gear Technologies'] -edition = '2021' -license.workspace = true -homepage = "https://gear-tech.io" -repository = "https://github.com/gear-tech/gear" description = "Gear pallet to work with messages" +version.workspace = true +authors.workspace = true +edition.workspace = true +license.workspace = true +homepage.workspace = true +repository.workspace = true readme = "README.md" [package.metadata.docs.rs] diff --git a/pallets/gear-program/Cargo.toml b/pallets/gear-program/Cargo.toml index e66e32b9fa3..0dd3e2653b9 100644 --- a/pallets/gear-program/Cargo.toml +++ b/pallets/gear-program/Cargo.toml @@ -1,12 +1,12 @@ [package] name = "pallet-gear-program" -version = "2.0.0" -authors = ['Gear Technologies'] -edition = '2021' -license.workspace = true -homepage = "https://gear-tech.io" -repository = "https://github.com/gear-tech/gear" description = "Gear pallet to work with programs" +version.workspace = true +authors.workspace = true +edition.workspace = true +license.workspace = true +homepage.workspace = true +repository.workspace = true readme = "README.md" [package.metadata.docs.rs] diff --git a/pallets/gear-scheduler/Cargo.toml b/pallets/gear-scheduler/Cargo.toml index 58b1be5353f..b8d9a29ccb6 100644 --- a/pallets/gear-scheduler/Cargo.toml +++ b/pallets/gear-scheduler/Cargo.toml @@ -1,12 +1,12 @@ [package] name = "pallet-gear-scheduler" -version = "1.0.0" -authors = ['Gear Technologies'] -edition = '2021' -license.workspace = true -homepage = "https://gear-tech.io" -repository = "https://github.com/gear-tech/gear" description = "Gear pallet to work with delayed tasks" +version.workspace = true +authors.workspace = true +edition.workspace = true +license.workspace = true +homepage.workspace = true +repository.workspace = true readme = "README.md" [package.metadata.docs.rs] diff --git a/pallets/gear-voucher/Cargo.toml b/pallets/gear-voucher/Cargo.toml index 7243aba712f..95a87591564 100644 --- a/pallets/gear-voucher/Cargo.toml +++ b/pallets/gear-voucher/Cargo.toml @@ -1,12 +1,12 @@ [package] name = "pallet-gear-voucher" -version = "1.0.0" -authors = ['Gear Technologies'] -edition = '2021' -license.workspace = true -homepage = "https://gear-tech.io" -repository = "https://github.com/gear-tech/gear" description = "Gear pallet implementing payment-voucher like functionality" +version.workspace = true +authors.workspace = true +edition.workspace = true +license.workspace = true +homepage.workspace = true +repository.workspace = true readme = "README.md" [package.metadata.docs.rs] diff --git a/pallets/gear/Cargo.toml b/pallets/gear/Cargo.toml index efcf988b0a5..8dc26661bee 100644 --- a/pallets/gear/Cargo.toml +++ b/pallets/gear/Cargo.toml @@ -1,12 +1,12 @@ [package] name = "pallet-gear" -version = "2.0.0" -authors = ['Gear Technologies'] -edition = '2021' -license.workspace = true -homepage = "https://gear-tech.io" -repository = "https://github.com/gear-tech/gear" description = "Gear main pallet" +version.workspace = true +authors.workspace = true +edition.workspace = true +license.workspace = true +homepage.workspace = true +repository.workspace = true readme = "README.md" [package.metadata.docs.rs] @@ -32,7 +32,7 @@ gear-core.workspace = true gear-core-errors.workspace = true gear-backend-common.workspace = true gear-backend-sandbox.workspace = true -pallet-gear-proc-macro = { version = "2.0.0", path = "proc-macro" } +pallet-gear-proc-macro = { path = "proc-macro" } gsys = { workspace = true, optional = true } pallet-gear-voucher.workspace = true pallet-gear-bank.workspace = true diff --git a/pallets/gear/proc-macro/Cargo.toml b/pallets/gear/proc-macro/Cargo.toml index b325315e902..8100f907371 100644 --- a/pallets/gear/proc-macro/Cargo.toml +++ b/pallets/gear/proc-macro/Cargo.toml @@ -1,12 +1,12 @@ [package] name = "pallet-gear-proc-macro" -version = "2.0.0" -authors = ['Gear Technologies'] -edition = '2021' -license.workspace = true -homepage = "https://gear-tech.io" -repository = "https://github.com/gear-tech/gear" description = "Procedural macros used in pallet_gear" +version.workspace = true +authors.workspace = true +edition.workspace = true +license.workspace = true +homepage.workspace = true +repository.workspace = true [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] diff --git a/pallets/gear/rpc/Cargo.toml b/pallets/gear/rpc/Cargo.toml index 47e51e985f9..366c3bb3a48 100644 --- a/pallets/gear/rpc/Cargo.toml +++ b/pallets/gear/rpc/Cargo.toml @@ -1,11 +1,11 @@ [package] name = "pallet-gear-rpc" -version = "2.0.0" +version.workspace = true authors.workspace = true edition.workspace = true license.workspace = true -homepage = "https://gear-tech.io" -repository = "https://github.com/gear-tech/gear" +homepage.workspace = true +repository.workspace = true [dependencies] jsonrpsee = { workspace = true, features = ["server", "macros"] } diff --git a/pallets/gear/rpc/runtime-api/Cargo.toml b/pallets/gear/rpc/runtime-api/Cargo.toml index b4f28c1c773..252dc9e5d8e 100644 --- a/pallets/gear/rpc/runtime-api/Cargo.toml +++ b/pallets/gear/rpc/runtime-api/Cargo.toml @@ -1,11 +1,11 @@ [package] name = "pallet-gear-rpc-runtime-api" -version = "2.0.0" -authors = ['Gear Technologies'] -edition = '2021' +version.workspace = true +authors.workspace = true +edition.workspace = true license.workspace = true -homepage = "https://gear-tech.io" -repository = "https://github.com/gear-tech/gear" +homepage.workspace = true +repository.workspace = true [dependencies] sp-api.workspace = true diff --git a/pallets/payment/Cargo.toml b/pallets/payment/Cargo.toml index bb6f5903037..93c809367f0 100644 --- a/pallets/payment/Cargo.toml +++ b/pallets/payment/Cargo.toml @@ -1,12 +1,11 @@ [package] name = "pallet-gear-payment" -version = "0.1.0" -authors = ['Gear Technologies'] -edition = '2021' +version.workspace = true +authors.workspace = true +edition.workspace = true license.workspace = true -homepage = "https://gear-tech.io" -repository = "https://github.com/gear-tech/gear" -description = "Gear main pallet" +homepage.workspace = true +repository.workspace = true readme = "README.md" [package.metadata.docs.rs] diff --git a/pallets/staking-rewards/Cargo.toml b/pallets/staking-rewards/Cargo.toml index db9f816b402..567659a9853 100644 --- a/pallets/staking-rewards/Cargo.toml +++ b/pallets/staking-rewards/Cargo.toml @@ -1,12 +1,12 @@ [package] name = "pallet-gear-staking-rewards" -version = "1.0.0" -authors = ['Gear Technologies'] -edition = '2021' -license.workspace = true -homepage = "https://gear-tech.io" -repository = "https://github.com/gear-tech/gear" description = "Gear tokenomics implementation" +version.workspace = true +authors.workspace = true +edition.workspace = true +license.workspace = true +homepage.workspace = true +repository.workspace = true readme = "README.md" [package.metadata.docs.rs] diff --git a/runtime-interface/Cargo.toml b/runtime-interface/Cargo.toml index 15b023165b2..f2dd78dbb68 100644 --- a/runtime-interface/Cargo.toml +++ b/runtime-interface/Cargo.toml @@ -1,12 +1,12 @@ [package] name = "gear-runtime-interface" -version = "0.1.0" -authors.workspace = true description = "Gear Runtime Interface" +version.workspace = true +authors.workspace = true edition.workspace = true license.workspace = true -homepage = "https://gear-tech.io" -repository = "https://github.com/gear-tech/gear" +homepage.workspace = true +repository.workspace = true [dependencies] gear-core.workspace = true diff --git a/runtime/common/Cargo.toml b/runtime/common/Cargo.toml index ab712a38152..b673f851b3d 100644 --- a/runtime/common/Cargo.toml +++ b/runtime/common/Cargo.toml @@ -1,11 +1,11 @@ [package] name = "gear-runtime-common" -version = "0.1.0" +version.workspace = true authors.workspace = true edition.workspace = true license.workspace = true -homepage = "https://gear-tech.io" -repository = "https://github.com/gear-tech/gear" +homepage.workspace = true +repository.workspace = true [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] diff --git a/runtime/gear/Cargo.toml b/runtime/gear/Cargo.toml index 00cf7a60141..005773f2bed 100644 --- a/runtime/gear/Cargo.toml +++ b/runtime/gear/Cargo.toml @@ -1,12 +1,12 @@ [package] name = "gear-runtime" -version = "0.1.0" +version.workspace = true authors.workspace = true edition.workspace = true -build = "build.rs" license.workspace = true -homepage = "https://gear-tech.io" -repository = "https://github.com/gear-tech/gear" +homepage.workspace = true +repository.workspace = true +build = "build.rs" [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] diff --git a/runtime/gear/src/lib.rs b/runtime/gear/src/lib.rs index 16168baefca..e7ed11281e6 100644 --- a/runtime/gear/src/lib.rs +++ b/runtime/gear/src/lib.rs @@ -124,7 +124,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { impl_name: create_runtime_str!("gear"), apis: RUNTIME_API_VERSIONS, authoring_version: 1, - spec_version: 360, + spec_version: 1000, impl_version: 1, transaction_version: 1, state_version: 1, diff --git a/runtime/primitives/Cargo.toml b/runtime/primitives/Cargo.toml index 420c73e1de6..a4589cb002f 100644 --- a/runtime/primitives/Cargo.toml +++ b/runtime/primitives/Cargo.toml @@ -1,12 +1,12 @@ [package] name = "gear-runtime-primitives" -version = "0.1.0" -authors.workspace = true description = "Gear Runtime primitives" +version.workspace = true +authors.workspace = true edition.workspace = true license.workspace = true -homepage = "https://gear-tech.io" -repository = "https://github.com/gear-tech/gear" +homepage.workspace = true +repository.workspace = true [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] diff --git a/runtime/vara/Cargo.toml b/runtime/vara/Cargo.toml index 99fa7782b58..fa91b85ef26 100644 --- a/runtime/vara/Cargo.toml +++ b/runtime/vara/Cargo.toml @@ -1,12 +1,12 @@ [package] name = "vara-runtime" -version = "0.1.0" +version.workspace = true authors.workspace = true edition.workspace = true -build = "build.rs" license.workspace = true -homepage = "https://gear-tech.io" -repository = "https://github.com/gear-tech/gear" +homepage.workspace = true +repository.workspace = true +build = "build.rs" [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] diff --git a/runtime/vara/src/lib.rs b/runtime/vara/src/lib.rs index f175c6d9125..cf6de126ae5 100644 --- a/runtime/vara/src/lib.rs +++ b/runtime/vara/src/lib.rs @@ -142,7 +142,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { // The version of the runtime specification. A full node will not attempt to use its native // runtime in substitute for the on-chain Wasm runtime unless all of `spec_name`, // `spec_version`, and `authoring_version` are the same between Wasm and native. - spec_version: 360, + spec_version: 1000, impl_version: 1, apis: RUNTIME_API_VERSIONS, transaction_version: 1, From b9641da7d532727296ef0819b8053d8eceff0555 Mon Sep 17 00:00:00 2001 From: Dmitry Novikov Date: Fri, 15 Sep 2023 19:20:49 +0400 Subject: [PATCH 2/7] chore(v1.0.0): Clean up and constants fix (#3265) --- node/service/src/chain_spec/vara.rs | 6 +- node/testing/src/genesis.rs | 44 ++-- pallets/gas/src/lib.rs | 2 - pallets/gas/src/migrations.rs | 243 ---------------------- pallets/staking-rewards/src/mock.rs | 7 +- runtime/gear/src/constants.rs | 2 + runtime/gear/src/migrations.rs | 2 +- runtime/vara/src/constants.rs | 16 +- runtime/vara/src/governance/fellowship.rs | 22 +- runtime/vara/src/governance/mod.rs | 2 +- runtime/vara/src/governance/tracks.rs | 26 +-- runtime/vara/src/lib.rs | 34 +-- runtime/vara/src/migrations.rs | 2 +- 13 files changed, 86 insertions(+), 322 deletions(-) delete mode 100644 pallets/gas/src/migrations.rs diff --git a/node/service/src/chain_spec/vara.rs b/node/service/src/chain_spec/vara.rs index b6522ae114a..3122e7326d8 100644 --- a/node/service/src/chain_spec/vara.rs +++ b/node/service/src/chain_spec/vara.rs @@ -28,7 +28,7 @@ use sp_consensus_grandpa::AuthorityId as GrandpaId; use sp_core::{crypto::UncheckedInto, sr25519}; use sp_runtime::{Perbill, Perquintill}; use vara_runtime::{ - constants::currency::{DOLLARS, EXISTENTIAL_DEPOSIT, UNITS as TOKEN}, + constants::currency::{ECONOMIC_UNITS, EXISTENTIAL_DEPOSIT, UNITS as TOKEN}, AuthorityDiscoveryConfig, BabeConfig, BalancesConfig, GenesisConfig, GrandpaConfig, ImOnlineConfig, NominationPoolsConfig, SessionConfig, SessionKeys, StakerStatus, StakingConfig, StakingRewardsConfig, SudoConfig, SystemConfig, VestingConfig, WASM_BINARY, @@ -617,8 +617,8 @@ fn testnet_genesis( transaction_payment: Default::default(), treasury: Default::default(), nomination_pools: NominationPoolsConfig { - min_create_bond: 10 * DOLLARS, - min_join_bond: DOLLARS, + min_create_bond: 10 * ECONOMIC_UNITS, + min_join_bond: ECONOMIC_UNITS, ..Default::default() }, vesting: VestingConfig { vesting: vec![] }, diff --git a/node/testing/src/genesis.rs b/node/testing/src/genesis.rs index f5a63aa4629..019e3f93948 100644 --- a/node/testing/src/genesis.rs +++ b/node/testing/src/genesis.rs @@ -49,18 +49,18 @@ pub fn genesis_config(code: Option<&[u8]>) -> GenesisConfig { #[cfg(feature = "vara-native")] pub fn config_endowed(code: Option<&[u8]>, extra_endowed: Vec) -> GenesisConfig { let mut endowed = vec![ - (alice(), 111 * DOLLARS), - (bob(), 100 * DOLLARS), - (charlie(), 100_000_000 * DOLLARS), - (dave(), 111 * DOLLARS), - (eve(), 101 * DOLLARS), - (ferdie(), 100 * DOLLARS), + (alice(), 111 * ECONOMIC_UNITS), + (bob(), 100 * ECONOMIC_UNITS), + (charlie(), 100_000_000 * ECONOMIC_UNITS), + (dave(), 111 * ECONOMIC_UNITS), + (eve(), 101 * ECONOMIC_UNITS), + (ferdie(), 100 * ECONOMIC_UNITS), ]; endowed.extend( extra_endowed .into_iter() - .map(|endowed| (endowed, 100 * DOLLARS)), + .map(|endowed| (endowed, 100 * ECONOMIC_UNITS)), ); GenesisConfig { @@ -98,9 +98,19 @@ pub fn config_endowed(code: Option<&[u8]>, extra_endowed: Vec) -> Gen }, staking: StakingConfig { stakers: vec![ - (dave(), alice(), 111 * DOLLARS, StakerStatus::Validator), - (eve(), bob(), 100 * DOLLARS, StakerStatus::Validator), - (ferdie(), charlie(), 100 * DOLLARS, StakerStatus::Validator), + ( + dave(), + alice(), + 111 * ECONOMIC_UNITS, + StakerStatus::Validator, + ), + (eve(), bob(), 100 * ECONOMIC_UNITS, StakerStatus::Validator), + ( + ferdie(), + charlie(), + 100 * ECONOMIC_UNITS, + StakerStatus::Validator, + ), ], validator_count: 3, minimum_validator_count: 3, @@ -128,18 +138,18 @@ pub fn config_endowed(code: Option<&[u8]>, extra_endowed: Vec) -> Gen #[cfg(all(not(feature = "vara-native"), feature = "gear-native"))] pub fn config_endowed(code: Option<&[u8]>, extra_endowed: Vec) -> GenesisConfig { let mut endowed = vec![ - (alice(), 111 * DOLLARS), - (bob(), 100 * DOLLARS), - (charlie(), 100_000_000 * DOLLARS), - (dave(), 111 * DOLLARS), - (eve(), 101 * DOLLARS), - (ferdie(), 100 * DOLLARS), + (alice(), 111 * ECONOMIC_UNITS), + (bob(), 100 * ECONOMIC_UNITS), + (charlie(), 100_000_000 * ECONOMIC_UNITS), + (dave(), 111 * ECONOMIC_UNITS), + (eve(), 101 * ECONOMIC_UNITS), + (ferdie(), 100 * ECONOMIC_UNITS), ]; endowed.extend( extra_endowed .into_iter() - .map(|endowed| (endowed, 100 * DOLLARS)), + .map(|endowed| (endowed, 100 * ECONOMIC_UNITS)), ); GenesisConfig { diff --git a/pallets/gas/src/lib.rs b/pallets/gas/src/lib.rs index 24d49b20d33..db681e5ca60 100644 --- a/pallets/gas/src/lib.rs +++ b/pallets/gas/src/lib.rs @@ -139,8 +139,6 @@ mod mock; #[cfg(test)] mod tests; -pub mod migrations; - type BlockGasLimitOf = ::BlockGasLimit; type AccountIdOf = ::AccountId; diff --git a/pallets/gas/src/migrations.rs b/pallets/gas/src/migrations.rs deleted file mode 100644 index 8ade4e216c1..00000000000 --- a/pallets/gas/src/migrations.rs +++ /dev/null @@ -1,243 +0,0 @@ -use crate::{Config, Error, Key, NodeOf, Pallet, Weight}; -use common::GasMultiplier; -use core::marker::PhantomData; -use frame_support::{ - dispatch::GetStorageVersion, - traits::{Get, OnRuntimeUpgrade}, -}; -#[cfg(feature = "try-runtime")] -use sp_std::vec::Vec; - -const MULTIPLIER: GasMultiplier = GasMultiplier::ValuePerGas(1_000); - -pub struct MigrateToV3(PhantomData); - -impl OnRuntimeUpgrade for MigrateToV3 { - #[cfg(feature = "try-runtime")] - fn pre_upgrade() -> Result, &'static str> { - use parity_scale_codec::Encode as _; - - let version = >::on_chain_storage_version(); - - Ok(version.encode()) - } - - fn on_runtime_upgrade() -> Weight { - let onchain = Pallet::::on_chain_storage_version(); - let current = Pallet::::current_storage_version(); - - if current != 3 || onchain != 2 { - log::info!("❌ Migrations of `pallet-gear-gas` to V3 are outdated"); - - return T::DbWeight::get().reads(1); - } - - log::info!("🚚 Running migrations to version {current:?} from version {onchain:?}"); - - let mut writes = 0u64; - - crate::GasNodes::::translate::, _>(|key, value| { - writes += 1; - translate::(key, value) - .map_err(|e| { - log::error!("Error translating {key:?} node: {e:?})"); - e - }) - .ok() - }); - - log::info!("Upgraded {writes:?} gas nodes"); - - current.put::>(); - - T::DbWeight::get().reads_writes(1, writes + 1) - } - - #[cfg(feature = "try-runtime")] - fn post_upgrade(state: Vec) -> Result<(), &'static str> { - use frame_support::traits::StorageVersion; - use parity_scale_codec::Decode; - - let previous: StorageVersion = - Decode::decode(&mut state.as_ref()).map_err(|_| "Cannot decode version")?; - - if previous == 2 { - let onchain = Pallet::::on_chain_storage_version(); - - assert_ne!(previous, onchain, "Must have upgraded from version 2 to 3"); - - log::info!("Storage `pallet-gear-gas` successfully migrated to V3"); - } else { - log::info!("Storage `pallet-gear-gas` was already migrated to V3"); - } - - Ok(()) - } -} - -fn translate(node_key: Key, node: v2::GasNode) -> Result, Error> { - log::info!("Translating {node_key:?} node"); - - let new_node = match node { - v2::GasNode::::Cut { id, value, lock } => NodeOf::::Cut { - id, - multiplier: MULTIPLIER, - value, - lock, - }, - v2::GasNode::::External { - id, - value, - lock, - system_reserve, - refs, - consumed, - deposit, - } => NodeOf::::External { - id, - multiplier: MULTIPLIER, - value, - lock, - system_reserve, - refs, - consumed, - deposit, - }, - v2::GasNode::::Reserved { - id, - value, - lock, - refs, - consumed, - } => NodeOf::::Reserved { - id, - multiplier: MULTIPLIER, - value, - lock, - refs, - consumed, - }, - v2::GasNode::::SpecifiedLocal { - parent, - value, - lock, - system_reserve, - refs, - consumed, - } => NodeOf::::SpecifiedLocal { - parent, - root: v2::root(node_key, node)?, - value, - lock, - system_reserve, - refs, - consumed, - }, - v2::GasNode::::UnspecifiedLocal { - parent, - lock, - system_reserve, - } => NodeOf::::UnspecifiedLocal { - parent, - root: v2::root(node_key, node)?, - lock, - system_reserve, - }, - }; - - Ok(new_node) -} - -mod v2 { - use crate::{AccountIdOf, Balance, Config, Error, Key, Pallet}; - use common::gas_provider::{ChildrenRefs, GasNodeId, NodeLock}; - use core::marker::PhantomData; - use frame_support::{ - storage::types::StorageMap, - traits::{PalletInfo, StorageInstance}, - Identity, - }; - use gear_core::ids::{MessageId, ReservationId}; - use parity_scale_codec::{Decode, Encode}; - - pub type GasNode = GasNodeImpl, GasNodeId, Balance>; - - pub struct GasNodesPrefix(PhantomData); - - impl StorageInstance for GasNodesPrefix { - const STORAGE_PREFIX: &'static str = "GasNodes"; - - fn pallet_prefix() -> &'static str { - <::PalletInfo as PalletInfo>::name::>() - .expect("No name found for the pallet in the runtime!") - } - } - - pub type GasNodes = StorageMap, Identity, Key, GasNode>; - - #[derive(Encode, Decode, Debug)] - pub enum GasNodeImpl { - External { - id: ExternalId, - value: Balance, - lock: NodeLock, - system_reserve: Balance, - refs: ChildrenRefs, - consumed: bool, - deposit: bool, - }, - - Cut { - id: ExternalId, - value: Balance, - lock: NodeLock, - }, - - Reserved { - id: ExternalId, - value: Balance, - lock: NodeLock, - refs: ChildrenRefs, - consumed: bool, - }, - - SpecifiedLocal { - parent: Id, - value: Balance, - lock: NodeLock, - system_reserve: Balance, - refs: ChildrenRefs, - consumed: bool, - }, - - UnspecifiedLocal { - parent: Id, - lock: NodeLock, - system_reserve: Balance, - }, - } - - impl GasNodeImpl { - pub fn parent(&self) -> Option { - match self { - Self::External { .. } | Self::Cut { .. } | Self::Reserved { .. } => None, - Self::SpecifiedLocal { parent, .. } | Self::UnspecifiedLocal { parent, .. } => { - Some(*parent) - } - } - } - } - - pub fn root(mut node_key: Key, mut node: GasNode) -> Result> { - log::trace!("Looking for root of {node_key:?} ({node:?}"); - - while let Some(parent) = node.parent() { - node_key = parent; - node = GasNodes::::get(node_key).ok_or(Error::::ParentIsLost)?; - } - - log::trace!("Root found: {node_key:?}"); - - Ok(node_key) - } -} diff --git a/pallets/staking-rewards/src/mock.rs b/pallets/staking-rewards/src/mock.rs index d491261680b..e5037ced27b 100644 --- a/pallets/staking-rewards/src/mock.rs +++ b/pallets/staking-rewards/src/mock.rs @@ -67,14 +67,11 @@ pub(crate) const NOM_1_CONTROLLER: AccountId = 41; pub(crate) const ROOT: AccountId = 101; pub(crate) const INITIAL_TOTAL_TOKEN_SUPPLY: u128 = 1_000_000 * UNITS; -pub(crate) const EXISTENTIAL_DEPOSIT: u128 = 10 * MILLICENTS; // 10 +pub(crate) const EXISTENTIAL_DEPOSIT: u128 = 10 * UNITS / 100_000; // 10 pub(crate) const VALIDATOR_STAKE: u128 = 100 * UNITS; // 10 pub(crate) const ENDOWMENT: u128 = 100 * UNITS; pub(crate) const UNITS: u128 = 100_000; // 10^(-5) precision -pub(crate) const DOLLARS: u128 = UNITS; // 1 to 1 -pub(crate) const CENTS: u128 = DOLLARS / 100; // 1_000 -pub(crate) const MILLICENTS: u128 = CENTS / 1_000; // 1 pub(crate) const MILLISECONDS_PER_YEAR: u64 = 1_000 * 3_600 * 24 * 36_525 / 100; pub(crate) const MILLISECS_PER_BLOCK: u64 = 2_400; pub(crate) const SESSION_DURATION: u64 = 1000; @@ -394,7 +391,7 @@ impl pallet_bags_list::Config for Test { parameter_types! { pub const ProposalBond: Permill = Permill::from_percent(5); - pub const ProposalBondMinimum: u128 = DOLLARS; + pub const ProposalBondMinimum: u128 = UNITS; pub const SpendPeriod: u32 = 100; pub const Burn: Permill = Permill::from_percent(50); pub const TreasuryPalletId: PalletId = PalletId(*b"py/trsry"); diff --git a/runtime/gear/src/constants.rs b/runtime/gear/src/constants.rs index 35c4873d511..0b4e927003b 100644 --- a/runtime/gear/src/constants.rs +++ b/runtime/gear/src/constants.rs @@ -20,6 +20,8 @@ pub mod currency { use runtime_primitives::Balance; + pub const UNITS: Balance = 1_000_000_000_000; // 10^(-12) precision + /// The existential deposit. pub const EXISTENTIAL_DEPOSIT: Balance = 500; diff --git a/runtime/gear/src/migrations.rs b/runtime/gear/src/migrations.rs index 8749826d911..248916f1fad 100644 --- a/runtime/gear/src/migrations.rs +++ b/runtime/gear/src/migrations.rs @@ -19,4 +19,4 @@ #[allow(unused)] use crate::*; -pub type Migrations = (pallet_gear_gas::migrations::MigrateToV3,); +pub type Migrations = (); diff --git a/runtime/vara/src/constants.rs b/runtime/vara/src/constants.rs index 75f273a42ee..b80d724a3ec 100644 --- a/runtime/vara/src/constants.rs +++ b/runtime/vara/src/constants.rs @@ -20,22 +20,22 @@ pub mod currency { use runtime_primitives::Balance; + pub const UNITS: Balance = 1_000_000_000_000; // 10^(-12) precision + + /// Base economic unit, 50 Vara. + pub const ECONOMIC_UNITS: Balance = UNITS * 50; + pub const ECONOMIC_CENTIUNITS: Balance = ECONOMIC_UNITS / 100; + /// The existential deposit. - pub const EXISTENTIAL_DEPOSIT: Balance = 10_000_000_000_000; // 10 Vara + pub const EXISTENTIAL_DEPOSIT: Balance = 10 * UNITS; // 10 Vara /// The program rent cost per block. pub const RENT_COST_PER_BLOCK: Balance = 125_000_000; - // TODO: review quantities based on economic model (issue #1277) - pub const UNITS: Balance = 1_000_000_000_000; // 10^(-12) precision - pub const DOLLARS: Balance = UNITS * 20; // 1 token is worth ~$0.05 - pub const CENTS: Balance = DOLLARS / 100; // 200_000_000_000 - pub const MILLICENTS: Balance = CENTS / 1_000; // 200_000_000 - /// Helper function to calculate various deposits for using pallets' storage pub const fn deposit(items: u32, bytes: u32) -> Balance { // TODO: review numbers (#2650) - items as Balance * 15 * CENTS + (bytes as Balance) * 6 * CENTS + items as Balance * 15 * ECONOMIC_CENTIUNITS + (bytes as Balance) * 6 * ECONOMIC_CENTIUNITS } } diff --git a/runtime/vara/src/governance/fellowship.rs b/runtime/vara/src/governance/fellowship.rs index e0e9a39c2c4..6adad66c76d 100644 --- a/runtime/vara/src/governance/fellowship.rs +++ b/runtime/vara/src/governance/fellowship.rs @@ -30,7 +30,7 @@ use sp_runtime::{ }; use super::*; -use crate::{DAYS, DOLLARS}; +use crate::{DAYS, ECONOMIC_UNITS}; parameter_types! { pub const AlarmInterval: BlockNumber = 1; @@ -49,7 +49,7 @@ impl pallet_referenda::TracksInfo for TracksInfo { pallet_referenda::TrackInfo { name: "candidates", max_deciding: 10, - decision_deposit: 100 * DOLLARS, + decision_deposit: 100 * ECONOMIC_UNITS, prepare_period: 30 * MINUTES, decision_period: 7 * DAYS, confirm_period: 30 * MINUTES, @@ -71,7 +71,7 @@ impl pallet_referenda::TracksInfo for TracksInfo { pallet_referenda::TrackInfo { name: "members", max_deciding: 10, - decision_deposit: 10 * DOLLARS, + decision_deposit: 10 * ECONOMIC_UNITS, prepare_period: 30 * MINUTES, decision_period: 7 * DAYS, confirm_period: 30 * MINUTES, @@ -93,7 +93,7 @@ impl pallet_referenda::TracksInfo for TracksInfo { pallet_referenda::TrackInfo { name: "proficients", max_deciding: 10, - decision_deposit: 10 * DOLLARS, + decision_deposit: 10 * ECONOMIC_UNITS, prepare_period: 30 * MINUTES, decision_period: 7 * DAYS, confirm_period: 30 * MINUTES, @@ -115,7 +115,7 @@ impl pallet_referenda::TracksInfo for TracksInfo { pallet_referenda::TrackInfo { name: "fellows", max_deciding: 10, - decision_deposit: 10 * DOLLARS, + decision_deposit: 10 * ECONOMIC_UNITS, prepare_period: 30 * MINUTES, decision_period: 7 * DAYS, confirm_period: 30 * MINUTES, @@ -137,7 +137,7 @@ impl pallet_referenda::TracksInfo for TracksInfo { pallet_referenda::TrackInfo { name: "senior fellows", max_deciding: 10, - decision_deposit: 10 * DOLLARS, + decision_deposit: 10 * ECONOMIC_UNITS, prepare_period: 30 * MINUTES, decision_period: 7 * DAYS, confirm_period: 30 * MINUTES, @@ -159,7 +159,7 @@ impl pallet_referenda::TracksInfo for TracksInfo { pallet_referenda::TrackInfo { name: "experts", max_deciding: 10, - decision_deposit: 1 * DOLLARS, + decision_deposit: 1 * ECONOMIC_UNITS, prepare_period: 30 * MINUTES, decision_period: 7 * DAYS, confirm_period: 30 * MINUTES, @@ -181,7 +181,7 @@ impl pallet_referenda::TracksInfo for TracksInfo { pallet_referenda::TrackInfo { name: "senior experts", max_deciding: 10, - decision_deposit: 1 * DOLLARS, + decision_deposit: 1 * ECONOMIC_UNITS, prepare_period: 30 * MINUTES, decision_period: 7 * DAYS, confirm_period: 30 * MINUTES, @@ -203,7 +203,7 @@ impl pallet_referenda::TracksInfo for TracksInfo { pallet_referenda::TrackInfo { name: "masters", max_deciding: 10, - decision_deposit: 1 * DOLLARS, + decision_deposit: 1 * ECONOMIC_UNITS, prepare_period: 30 * MINUTES, decision_period: 7 * DAYS, confirm_period: 30 * MINUTES, @@ -225,7 +225,7 @@ impl pallet_referenda::TracksInfo for TracksInfo { pallet_referenda::TrackInfo { name: "senior masters", max_deciding: 10, - decision_deposit: 1 * DOLLARS, + decision_deposit: 1 * ECONOMIC_UNITS, prepare_period: 30 * MINUTES, decision_period: 7 * DAYS, confirm_period: 30 * MINUTES, @@ -247,7 +247,7 @@ impl pallet_referenda::TracksInfo for TracksInfo { pallet_referenda::TrackInfo { name: "grand masters", max_deciding: 10, - decision_deposit: 1 * DOLLARS, + decision_deposit: 1 * ECONOMIC_UNITS, prepare_period: 30 * MINUTES, decision_period: 7 * DAYS, confirm_period: 30 * MINUTES, diff --git a/runtime/vara/src/governance/mod.rs b/runtime/vara/src/governance/mod.rs index cd3189fc2f4..6e435b4df51 100644 --- a/runtime/vara/src/governance/mod.rs +++ b/runtime/vara/src/governance/mod.rs @@ -53,7 +53,7 @@ impl pallet_conviction_voting::Config for Runtime { parameter_types! { pub const AlarmInterval: BlockNumber = 1; - pub const SubmissionDeposit: Balance = 10 * DOLLARS; + pub const SubmissionDeposit: Balance = 10 * ECONOMIC_UNITS; pub const UndecidingTimeout: BlockNumber = 14 * DAYS; } diff --git a/runtime/vara/src/governance/tracks.rs b/runtime/vara/src/governance/tracks.rs index b20bbf0b3ce..48170c7e827 100644 --- a/runtime/vara/src/governance/tracks.rs +++ b/runtime/vara/src/governance/tracks.rs @@ -67,7 +67,7 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo); 13 pallet_referenda::TrackInfo { name: "root", max_deciding: 1, - decision_deposit: 100_000 * DOLLARS, + decision_deposit: 100_000 * ECONOMIC_UNITS, prepare_period: 2 * HOURS, decision_period: 14 * DAYS, confirm_period: 24 * HOURS, @@ -81,7 +81,7 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo); 13 pallet_referenda::TrackInfo { name: "whitelisted_caller", max_deciding: 100, - decision_deposit: 10_000 * DOLLARS, + decision_deposit: 10_000 * ECONOMIC_UNITS, prepare_period: 30 * MINUTES, decision_period: 14 * DAYS, confirm_period: 10 * MINUTES, @@ -95,7 +95,7 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo); 13 pallet_referenda::TrackInfo { name: "staking_admin", max_deciding: 10, - decision_deposit: 5_000 * DOLLARS, + decision_deposit: 5_000 * ECONOMIC_UNITS, prepare_period: 2 * HOURS, decision_period: 14 * DAYS, confirm_period: 3 * HOURS, @@ -109,7 +109,7 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo); 13 pallet_referenda::TrackInfo { name: "treasurer", max_deciding: 10, - decision_deposit: 1_000 * DOLLARS, + decision_deposit: 1_000 * ECONOMIC_UNITS, prepare_period: 2 * HOURS, decision_period: 14 * DAYS, confirm_period: 3 * HOURS, @@ -123,7 +123,7 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo); 13 pallet_referenda::TrackInfo { name: "fellowship_admin", max_deciding: 10, - decision_deposit: 5_000 * DOLLARS, + decision_deposit: 5_000 * ECONOMIC_UNITS, prepare_period: 2 * HOURS, decision_period: 14 * DAYS, confirm_period: 3 * HOURS, @@ -137,7 +137,7 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo); 13 pallet_referenda::TrackInfo { name: "general_admin", max_deciding: 10, - decision_deposit: 5_000 * DOLLARS, + decision_deposit: 5_000 * ECONOMIC_UNITS, prepare_period: 2 * HOURS, decision_period: 14 * DAYS, confirm_period: 3 * HOURS, @@ -151,7 +151,7 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo); 13 pallet_referenda::TrackInfo { name: "referendum_canceller", max_deciding: 1_000, - decision_deposit: 10_000 * DOLLARS, + decision_deposit: 10_000 * ECONOMIC_UNITS, prepare_period: 2 * HOURS, decision_period: 7 * DAYS, confirm_period: 3 * HOURS, @@ -165,7 +165,7 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo); 13 pallet_referenda::TrackInfo { name: "referendum_killer", max_deciding: 1_000, - decision_deposit: 50_000 * DOLLARS, + decision_deposit: 50_000 * ECONOMIC_UNITS, prepare_period: 2 * HOURS, decision_period: 14 * DAYS, confirm_period: 3 * HOURS, @@ -179,7 +179,7 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo); 13 pallet_referenda::TrackInfo { name: "small_tipper", max_deciding: 200, - decision_deposit: DOLLARS, + decision_deposit: ECONOMIC_UNITS, prepare_period: MINUTES, decision_period: 7 * DAYS, confirm_period: 10 * MINUTES, @@ -193,7 +193,7 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo); 13 pallet_referenda::TrackInfo { name: "big_tipper", max_deciding: 100, - decision_deposit: 10 * DOLLARS, + decision_deposit: 10 * ECONOMIC_UNITS, prepare_period: 10 * MINUTES, decision_period: 7 * DAYS, confirm_period: HOURS, @@ -207,7 +207,7 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo); 13 pallet_referenda::TrackInfo { name: "small_spender", max_deciding: 50, - decision_deposit: 100 * DOLLARS, + decision_deposit: 100 * ECONOMIC_UNITS, prepare_period: 4 * HOURS, decision_period: 14 * DAYS, confirm_period: 12 * HOURS, @@ -221,7 +221,7 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo); 13 pallet_referenda::TrackInfo { name: "medium_spender", max_deciding: 50, - decision_deposit: 200 * DOLLARS, + decision_deposit: 200 * ECONOMIC_UNITS, prepare_period: 4 * HOURS, decision_period: 14 * DAYS, confirm_period: 24 * HOURS, @@ -235,7 +235,7 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo); 13 pallet_referenda::TrackInfo { name: "big_spender", max_deciding: 50, - decision_deposit: 400 * DOLLARS, + decision_deposit: 400 * ECONOMIC_UNITS, prepare_period: 4 * HOURS, decision_period: 14 * DAYS, confirm_period: 48 * HOURS, diff --git a/runtime/vara/src/lib.rs b/runtime/vara/src/lib.rs index cf6de126ae5..c6332876d1b 100644 --- a/runtime/vara/src/lib.rs +++ b/runtime/vara/src/lib.rs @@ -313,8 +313,8 @@ impl pallet_scheduler::Config for Runtime { parameter_types! { pub const PreimageMaxSize: u32 = 4096 * 1024; - pub const PreimageBaseDeposit: Balance = DOLLARS; - pub const PreimageByteDeposit: Balance = CENTS; + pub const PreimageBaseDeposit: Balance = ECONOMIC_UNITS; + pub const PreimageByteDeposit: Balance = ECONOMIC_CENTIUNITS; } impl pallet_preimage::Config for Runtime { @@ -451,9 +451,9 @@ parameter_types! { pub const UnsignedPhase: u32 = EPOCH_DURATION_IN_BLOCKS / 4; // signed config - pub const SignedRewardBase: Balance = DOLLARS; - pub const SignedDepositBase: Balance = DOLLARS; - pub const SignedDepositByte: Balance = CENTS; + pub const SignedRewardBase: Balance = ECONOMIC_UNITS; + pub const SignedDepositBase: Balance = ECONOMIC_UNITS; + pub const SignedDepositByte: Balance = ECONOMIC_CENTIUNITS; pub BetterUnsignedThreshold: Perbill = Perbill::from_rational(1u32, 10_000); @@ -679,13 +679,13 @@ impl pallet_offences::Config for Runtime { parameter_types! { pub const ProposalBond: Permill = Permill::from_percent(5); - pub const ProposalBondMinimum: Balance = DOLLARS; + pub const ProposalBondMinimum: Balance = ECONOMIC_UNITS; pub const SpendPeriod: BlockNumber = DAYS; pub const Burn: Permill = Permill::from_percent(50); pub const TipCountdown: BlockNumber = DAYS; pub const TipFindersFee: Percent = Percent::from_percent(20); - pub const TipReportDepositBase: Balance = DOLLARS; - pub const DataDepositPerByte: Balance = CENTS; + pub const TipReportDepositBase: Balance = ECONOMIC_UNITS; + pub const DataDepositPerByte: Balance = ECONOMIC_CENTIUNITS; pub const TreasuryPalletId: PalletId = PalletId(*b"py/trsry"); pub const MaximumReasonLength: u32 = 300; pub const MaxApprovals: u32 = 100; @@ -712,11 +712,11 @@ impl pallet_treasury::Config for Runtime { parameter_types! { pub const BountyCuratorDeposit: Permill = Permill::from_percent(50); - pub const BountyValueMinimum: Balance = 5 * DOLLARS; - pub const BountyDepositBase: Balance = DOLLARS; + pub const BountyValueMinimum: Balance = 5 * ECONOMIC_UNITS; + pub const BountyDepositBase: Balance = ECONOMIC_UNITS; pub const CuratorDepositMultiplier: Permill = Permill::from_percent(50); - pub const CuratorDepositMin: Balance = DOLLARS; - pub const CuratorDepositMax: Balance = 100 * DOLLARS; + pub const CuratorDepositMin: Balance = ECONOMIC_UNITS; + pub const CuratorDepositMax: Balance = 100 * ECONOMIC_UNITS; pub const BountyDepositPayoutDelay: BlockNumber = DAYS; pub const BountyUpdatePeriod: BlockNumber = 14 * DAYS; } @@ -737,7 +737,7 @@ impl pallet_bounties::Config for Runtime { } parameter_types! { - pub const ChildBountyValueMinimum: Balance = DOLLARS; + pub const ChildBountyValueMinimum: Balance = ECONOMIC_UNITS; } impl pallet_child_bounties::Config for Runtime { @@ -775,9 +775,9 @@ impl pallet_authority_discovery::Config for Runtime { } parameter_types! { - pub const BasicDeposit: Balance = 10 * DOLLARS; // 258 bytes on-chain - pub const FieldDeposit: Balance = 250 * CENTS; // 66 bytes on-chain - pub const SubAccountDeposit: Balance = 2 * DOLLARS; // 53 bytes on-chain + pub const BasicDeposit: Balance = 10 * ECONOMIC_UNITS; // 258 bytes on-chain + pub const FieldDeposit: Balance = 250 * ECONOMIC_CENTIUNITS; // 66 bytes on-chain + pub const SubAccountDeposit: Balance = 2 * ECONOMIC_UNITS; // 53 bytes on-chain pub const MaxSubAccounts: u32 = 100; pub const MaxAdditionalFields: u32 = 100; pub const MaxRegistrars: u32 = 20; @@ -1094,7 +1094,7 @@ where } parameter_types! { - pub const MinVestedTransfer: Balance = 100 * CENTS; + pub const MinVestedTransfer: Balance = 100 * ECONOMIC_CENTIUNITS; pub UnvestedFundsAllowedWithdrawReasons: WithdrawReasons = WithdrawReasons::except(WithdrawReasons::TRANSFER | WithdrawReasons::RESERVE); } diff --git a/runtime/vara/src/migrations.rs b/runtime/vara/src/migrations.rs index 8749826d911..248916f1fad 100644 --- a/runtime/vara/src/migrations.rs +++ b/runtime/vara/src/migrations.rs @@ -19,4 +19,4 @@ #[allow(unused)] use crate::*; -pub type Migrations = (pallet_gear_gas::migrations::MigrateToV3,); +pub type Migrations = (); From 9e2576bd81fd257b329252acace14834f8bdf23e Mon Sep 17 00:00:00 2001 From: Dmitry Novikov Date: Fri, 15 Sep 2023 19:21:03 +0400 Subject: [PATCH 3/7] chore(v1.0.0): Remove `pallet-airdrop` (#3276) --- Cargo.lock | 32 --- Cargo.toml | 1 - gsdk/src/metadata/errors.rs | 1 - gsdk/src/metadata/generated.rs | 97 -------- pallets/airdrop/Cargo.toml | 70 ------ pallets/airdrop/README.md | 7 - pallets/airdrop/src/benchmarking.rs | 70 ------ pallets/airdrop/src/lib.rs | 214 ------------------ pallets/airdrop/src/mock.rs | 247 --------------------- pallets/airdrop/src/tests.rs | 173 --------------- pallets/airdrop/src/weights.rs | 95 -------- runtime/vara/Cargo.toml | 4 - runtime/vara/src/lib.rs | 13 +- runtime/vara/src/weights/mod.rs | 1 - runtime/vara/src/weights/pallet_airdrop.rs | 95 -------- 15 files changed, 2 insertions(+), 1118 deletions(-) delete mode 100644 pallets/airdrop/Cargo.toml delete mode 100644 pallets/airdrop/README.md delete mode 100644 pallets/airdrop/src/benchmarking.rs delete mode 100644 pallets/airdrop/src/lib.rs delete mode 100644 pallets/airdrop/src/mock.rs delete mode 100644 pallets/airdrop/src/tests.rs delete mode 100644 pallets/airdrop/src/weights.rs delete mode 100644 runtime/vara/src/weights/pallet_airdrop.rs diff --git a/Cargo.lock b/Cargo.lock index 32ac68ad265..f51d1120230 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7118,37 +7118,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "pallet-airdrop" -version = "1.0.0" -dependencies = [ - "env_logger", - "frame-benchmarking", - "frame-support", - "frame-support-test", - "frame-system", - "gear-common", - "log", - "pallet-authorship", - "pallet-balances", - "pallet-gear", - "pallet-gear-bank", - "pallet-gear-gas", - "pallet-gear-messenger", - "pallet-gear-program", - "pallet-gear-scheduler", - "pallet-sudo", - "pallet-timestamp", - "pallet-vesting", - "parity-scale-codec", - "scale-info", - "serde", - "sp-core 7.0.0 (git+https://github.com/gear-tech/substrate.git?branch=gear-polkadot-v0.9.41-canary-no-sandbox)", - "sp-io 7.0.0 (git+https://github.com/gear-tech/substrate.git?branch=gear-polkadot-v0.9.41-canary-no-sandbox)", - "sp-runtime 7.0.0 (git+https://github.com/gear-tech/substrate.git?branch=gear-polkadot-v0.9.41-canary-no-sandbox)", - "sp-std 5.0.0 (git+https://github.com/gear-tech/substrate.git?branch=gear-polkadot-v0.9.41-canary-no-sandbox)", -] - [[package]] name = "pallet-authority-discovery" version = "4.0.0-dev" @@ -13511,7 +13480,6 @@ dependencies = [ "gear-runtime-primitives", "hex-literal", "log", - "pallet-airdrop", "pallet-authority-discovery", "pallet-authorship", "pallet-babe", diff --git a/Cargo.toml b/Cargo.toml index f3d587003ee..108d5011b92 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -221,7 +221,6 @@ gear-wasm-gen = { path = "utils/wasm-gen" } gear-wasm-instrument = { path = "utils/wasm-instrument", default-features = false } junit-common = { path = "utils/junit-common" } actor-system-error = { path = "utils/actor-system-error" } -pallet-airdrop = { path = "pallets/airdrop", default-features = false } pallet-gear = { path = "pallets/gear", default-features = false } pallet-gear-debug = { path = "pallets/gear-debug", default-features = false } pallet-gear-gas = { path = "pallets/gas", default-features = false } diff --git a/gsdk/src/metadata/errors.rs b/gsdk/src/metadata/errors.rs index fef6f00d76e..bfbd006d5a9 100644 --- a/gsdk/src/metadata/errors.rs +++ b/gsdk/src/metadata/errors.rs @@ -94,7 +94,6 @@ macro_rules! export_module_error { // pallets that don't have `Error` type. // // - pallet_transaction_payment -// - pallet_airdrop // // pallets that share the same `errors::RankedCollective` // diff --git a/gsdk/src/metadata/generated.rs b/gsdk/src/metadata/generated.rs index cfc17329d53..77010704434 100644 --- a/gsdk/src/metadata/generated.rs +++ b/gsdk/src/metadata/generated.rs @@ -1000,73 +1000,6 @@ pub mod runtime_types { } } } - pub mod pallet_airdrop { - use super::runtime_types; - pub mod pallet { - use super::runtime_types; - #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] - #[doc = "Contains one variant per dispatchable that can be called by an extrinsic."] - pub enum Call { - #[codec(index = 0)] - #[doc = "Transfer tokens from pre-funded `source` to `dest` account."] - #[doc = ""] - #[doc = "The origin must be the root."] - #[doc = ""] - #[doc = "Parameters:"] - #[doc = "- `source`: the pre-funded account (i.e. root),"] - #[doc = "- `dest`: the beneficiary account,"] - #[doc = "- `amount`: the amount of tokens to be minted."] - #[doc = ""] - #[doc = "Emits the following events:"] - #[doc = "- `TokensDeposited{ dest, amount }`"] - transfer { - source: ::subxt::utils::AccountId32, - dest: ::subxt::utils::AccountId32, - amount: ::core::primitive::u128, - }, - #[codec(index = 1)] - #[doc = "Remove vesting for `source` account and transfer tokens to `dest` account."] - #[doc = ""] - #[doc = "The origin must be the root."] - #[doc = ""] - #[doc = "Parameters:"] - #[doc = "- `source`: the account with vesting running,"] - #[doc = "- `dest`: the beneficiary account,"] - #[doc = "- `schedule_index`: the index of `VestingInfo` for source account."] - #[doc = "- `amount`: the amount to be unlocked and transferred from `VestingInfo`."] - #[doc = ""] - #[doc = "Emits the following events:"] - #[doc = "- `VestingScheduleRemoved{ who, schedule_index }`"] - transfer_vested { - source: ::subxt::utils::AccountId32, - dest: ::subxt::utils::AccountId32, - schedule_index: ::core::primitive::u32, - amount: ::core::option::Option<::core::primitive::u128>, - }, - } - #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] - #[doc = "Error for the airdrop pallet."] - pub enum Error { - #[codec(index = 0)] - #[doc = "Amount to being transferred is bigger than vested."] - AmountBigger, - } - #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] - #[doc = "\n\t\t\tThe [event](https://docs.substrate.io/main-docs/build/events-errors/) emitted\n\t\t\tby this pallet.\n\t\t\t"] - pub enum Event { - #[codec(index = 0)] - TokensDeposited { - account: ::subxt::utils::AccountId32, - amount: ::core::primitive::u128, - }, - #[codec(index = 1)] - VestingScheduleRemoved { - who: ::subxt::utils::AccountId32, - schedule_index: ::core::primitive::u32, - }, - } - } - } pub mod pallet_babe { use super::runtime_types; pub mod pallet { @@ -9113,8 +9046,6 @@ pub mod runtime_types { GearVoucher(runtime_types::pallet_gear_voucher::pallet::Call), #[codec(index = 99)] Sudo(runtime_types::pallet_sudo::pallet::Call), - #[codec(index = 198)] - Airdrop(runtime_types::pallet_airdrop::pallet::Call), #[codec(index = 199)] GearDebug(runtime_types::pallet_gear_debug::pallet::Call), } @@ -9182,8 +9113,6 @@ pub mod runtime_types { GearVoucher(runtime_types::pallet_gear_voucher::pallet::Event), #[codec(index = 99)] Sudo(runtime_types::pallet_sudo::pallet::Event), - #[codec(index = 198)] - Airdrop(runtime_types::pallet_airdrop::pallet::Event), #[codec(index = 199)] GearDebug(runtime_types::pallet_gear_debug::pallet::Event), } @@ -9204,20 +9133,6 @@ pub mod calls { #[doc = r" returns call name."] fn call_name(&self) -> &'static str; } - #[doc = "Calls of pallet `Airdrop`."] - pub enum AirdropCall { - Transfer, - TransferVested, - } - impl CallInfo for AirdropCall { - const PALLET: &'static str = "Airdrop"; - fn call_name(&self) -> &'static str { - match self { - Self::Transfer => "transfer", - Self::TransferVested => "transfer_vested", - } - } - } #[doc = "Calls of pallet `Babe`."] pub enum BabeCall { ReportEquivocation, @@ -11061,15 +10976,6 @@ pub mod impls { )?, )); } - if pallet_name == "Airdrop" { - return Ok(Event::Airdrop( - crate::metadata::airdrop::Event::decode_with_metadata( - &mut &*pallet_bytes, - pallet_ty, - metadata, - )?, - )); - } if pallet_name == "GearDebug" { return Ok(Event::GearDebug( crate::metadata::gear_debug::Event::decode_with_metadata( @@ -11179,9 +11085,6 @@ pub mod exports { pub mod sudo { pub use super::runtime_types::pallet_sudo::pallet::Event; } - pub mod airdrop { - pub use super::runtime_types::pallet_airdrop::pallet::Event; - } pub mod gear_debug { pub use super::runtime_types::pallet_gear_debug::pallet::Event; } diff --git a/pallets/airdrop/Cargo.toml b/pallets/airdrop/Cargo.toml deleted file mode 100644 index 35f74034b41..00000000000 --- a/pallets/airdrop/Cargo.toml +++ /dev/null @@ -1,70 +0,0 @@ -[package] -name = "pallet-airdrop" -version = "1.0.0" -authors = ['Gear Technologies'] -edition = '2021' -license.workspace = true -homepage = "https://gear-tech.io" -repository = "https://github.com/gear-tech/gear" -description = "Airdrop pallet" -readme = "README.md" - -[package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu"] - -[dependencies] -parity-scale-codec = { workspace = true, features = ["derive", "max-encoded-len"] } -scale-info = { workspace = true, features = ["derive"] } -log.workspace = true - -# Internal deps -common.workspace = true -pallet-gear.workspace = true -pallet-gear-bank.workspace = true - -# Substrate deps -frame-support.workspace = true -frame-system.workspace = true -frame-benchmarking = { workspace = true, optional = true } -sp-runtime.workspace = true -sp-std.workspace = true -pallet-balances.workspace = true -pallet-vesting.workspace = true - -[dev-dependencies] -serde.workspace = true -env_logger.workspace = true -sp-core = { workspace = true, features = ["std"] } -sp-io = { workspace = true, features = ["std"] } -pallet-authorship = { workspace = true, features = ["std"] } -pallet-sudo = { workspace = true, features = ["std"] } -pallet-timestamp = { workspace = true, features = ["std"] } -pallet-gear-program = { workspace = true, features = ["std"] } -pallet-gear-messenger = { workspace = true, features = ["std"] } -pallet-gear-scheduler = { workspace = true, features = ["std"] } -pallet-gear-gas = { workspace = true, features = ["std"] } -frame-support-test = { workspace = true, features = ["std"] } - -[features] -default = ["std"] -std = [ - "common/std", - "parity-scale-codec/std", - "log/std", - "frame-benchmarking?/std", - "frame-support/std", - "frame-system/std", - "scale-info/std", - "sp-std/std", - "pallet-balances/std", - "pallet-vesting/std", - "pallet-gear/std", - "pallet-gear-bank/std", -] -runtime-benchmarks = [ - "frame-benchmarking/runtime-benchmarks", - "frame-system/runtime-benchmarks", - "frame-support/runtime-benchmarks", - "common/runtime-benchmarks", -] -try-runtime = ["frame-support/try-runtime"] diff --git a/pallets/airdrop/README.md b/pallets/airdrop/README.md deleted file mode 100644 index 3f75afc1b5b..00000000000 --- a/pallets/airdrop/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# Airdrop pallet used on testnet to dispense funds to users - -A crate which provides a mechanism to transfer tokens from pre-funded account to users while generic balance transfers are disabled. - -### Dispatchable Functions - -License: Unlicense diff --git a/pallets/airdrop/src/benchmarking.rs b/pallets/airdrop/src/benchmarking.rs deleted file mode 100644 index 68064fca290..00000000000 --- a/pallets/airdrop/src/benchmarking.rs +++ /dev/null @@ -1,70 +0,0 @@ -// This file is part of Gear. - -// Copyright (C) 2022-2023 Gear Technologies Inc. -// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -#[allow(unused)] -use crate::Pallet as Airdrop; -use crate::*; -use common::{benchmarking, Origin}; -use frame_benchmarking::{benchmarks, impl_benchmark_test_suite}; -use frame_support::traits::Currency; -use frame_system::RawOrigin; -use pallet_vesting::VestingInfo; -use sp_runtime::traits::{StaticLookup, UniqueSaturatedInto}; - -benchmarks! { - where_clause { where - T::AccountId: Origin, - } - - transfer { - let q in 1 .. 256; - - let source: T::AccountId = benchmarking::account("source", 0, 0); - ::Currency::deposit_creating(&source, (1u128 << 60).unique_saturated_into()); - let recipient: T::AccountId = benchmarking::account("recipient", 0, 0); - // Keeping in mind the existential deposit - let amount = 10_000_000_000_000_u128.saturating_add(10_u128.saturating_mul(q.into())); - - }: _(RawOrigin::Root, source, recipient.clone(), amount.unique_saturated_into()) - verify { - assert_eq!(pallet_balances::Pallet::::total_balance(&recipient), amount.unique_saturated_into()); - } - - transfer_vested { - let q in 1 .. 256; - - let source: T::AccountId = benchmarking::account("source", 0, 0); - let source_lookup = T::Lookup::unlookup(source.clone()); - ::Currency::deposit_creating(&source, (1u128 << 60).unique_saturated_into()); - let recipient: T::AccountId = benchmarking::account("recipient", 0, 0); - let amount = ::MinVestedTransfer::get().saturating_mul(q.into()); - - // create vesting schedule amount * 2 - let vested_amount = amount.saturating_mul(2u128.unique_saturated_into()); - let vesting_schedule = VestingInfo::new(vested_amount.unique_saturated_into(), 10u128.unique_saturated_into(), 1000u32.into()); - pallet_vesting::Pallet::::vested_transfer(RawOrigin::Signed(source.clone()).into(), source_lookup, vesting_schedule)?; - - }: _(RawOrigin::Root, source.clone(), recipient.clone(), 0, Some(amount)) - verify { - // check that the total vested amount is halved between the source and the recipient - assert_eq!(pallet_vesting::Pallet::::vesting_balance(&source), Some(amount)); - assert_eq!(::Currency::free_balance(&recipient), amount); - } -} - -impl_benchmark_test_suite!(Airdrop, crate::mock::new_test_ext(), crate::mock::Test,); diff --git a/pallets/airdrop/src/lib.rs b/pallets/airdrop/src/lib.rs deleted file mode 100644 index 7609271c50e..00000000000 --- a/pallets/airdrop/src/lib.rs +++ /dev/null @@ -1,214 +0,0 @@ -// This file is part of Gear. - -// Copyright (C) 2021-2023 Gear Technologies Inc. -// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -#![cfg_attr(not(feature = "std"), no_std)] - -use frame_support::{ - pallet_prelude::*, - traits::{Currency, ExistenceRequirement, VestingSchedule}, -}; -pub use pallet::*; -use sp_runtime::traits::{Convert, Saturating}; -pub use weights::WeightInfo; - -pub mod weights; - -#[cfg(feature = "runtime-benchmarks")] -mod benchmarking; - -#[cfg(test)] -mod mock; - -#[cfg(test)] -mod tests; - -pub(crate) type BalanceOf = <::Currency as Currency< - ::AccountId, ->>::Balance; - -pub(crate) type VestingBalanceOf = <::Currency as Currency< - ::AccountId, ->>::Balance; - -#[frame_support::pallet] -pub mod pallet { - use super::*; - - use frame_system::pallet_prelude::*; - - #[pallet::config] - pub trait Config: - frame_system::Config - + pallet_gear::Config - + pallet_balances::Config - + pallet_vesting::Config - { - /// Because this pallet emits events, it depends on the runtime's definition of an event. - type RuntimeEvent: From> + IsType<::RuntimeEvent>; - - /// Weight information for extrinsics in this pallet. - type WeightInfo: WeightInfo; - - /// To modify/remove vesting schedule - type VestingSchedule: VestingSchedule< - Self::AccountId, - Currency = ::Currency, - Moment = Self::BlockNumber, - >; - } - - #[pallet::pallet] - pub struct Pallet(_); - - #[pallet::event] - #[pallet::generate_deposit(pub(super) fn deposit_event)] - pub enum Event { - TokensDeposited { - account: T::AccountId, - amount: BalanceOf, - }, - VestingScheduleRemoved { - who: T::AccountId, - schedule_index: u32, - }, - } - - /// Error for the airdrop pallet. - #[pallet::error] - pub enum Error { - /// Amount to being transferred is bigger than vested. - AmountBigger, - } - - #[pallet::call] - impl Pallet { - /// Transfer tokens from pre-funded `source` to `dest` account. - /// - /// The origin must be the root. - /// - /// Parameters: - /// - `source`: the pre-funded account (i.e. root), - /// - `dest`: the beneficiary account, - /// - `amount`: the amount of tokens to be minted. - /// - /// Emits the following events: - /// - `TokensDeposited{ dest, amount }` - #[pallet::call_index(0)] - #[pallet::weight(::WeightInfo::transfer(1))] - pub fn transfer( - origin: OriginFor, - source: T::AccountId, - dest: T::AccountId, - amount: BalanceOf, - ) -> DispatchResultWithPostInfo { - ensure_root(origin)?; - - <::Currency as Currency<_>>::transfer( - &source, - &dest, - amount, - ExistenceRequirement::KeepAlive, - )?; - Self::deposit_event(Event::TokensDeposited { - account: dest, - amount, - }); - - // This extrinsic is not chargeable - Ok(Pays::No.into()) - } - - /// Remove vesting for `source` account and transfer tokens to `dest` account. - /// - /// The origin must be the root. - /// - /// Parameters: - /// - `source`: the account with vesting running, - /// - `dest`: the beneficiary account, - /// - `schedule_index`: the index of `VestingInfo` for source account. - /// - `amount`: the amount to be unlocked and transferred from `VestingInfo`. - /// - /// Emits the following events: - /// - `VestingScheduleRemoved{ who, schedule_index }` - #[pallet::call_index(1)] - #[pallet::weight(::WeightInfo::transfer_vested(1))] - pub fn transfer_vested( - origin: OriginFor, - source: T::AccountId, - dest: T::AccountId, - schedule_index: u32, - amount: Option>, - ) -> DispatchResultWithPostInfo { - ensure_root(origin)?; - - let schedules = pallet_vesting::Pallet::::vesting(&source) - .ok_or(pallet_vesting::Error::::NotVesting)?; - - let schedule = schedules - .get(schedule_index as usize) - .ok_or(pallet_vesting::Error::::ScheduleIndexOutOfBounds)?; - - T::VestingSchedule::remove_vesting_schedule(&source, schedule_index)?; - - Self::deposit_event(Event::VestingScheduleRemoved { - who: source.clone(), - schedule_index, - }); - - let amount = if let Some(amount) = amount { - ensure!(amount <= schedule.locked(), Error::::AmountBigger); - let end_amount = schedule.locked().saturating_sub(amount); - let end_block = schedule.ending_block_as_balance::(); - let start_block = T::BlockNumberToBalance::convert(schedule.starting_block()); - let per_block = end_amount / end_block.saturating_sub(start_block); - - T::VestingSchedule::can_add_vesting_schedule( - &source, - end_amount, - per_block, - schedule.starting_block(), - )?; - let res = T::VestingSchedule::add_vesting_schedule( - &source, - end_amount, - per_block, - schedule.starting_block(), - ); - - debug_assert!( - res.is_ok(), - "Failed to add a schedule when we had to succeed." - ); - - amount - } else { - schedule.locked() - }; - - <::Currency as Currency<_>>::transfer( - &source, - &dest, - amount, - ExistenceRequirement::AllowDeath, - )?; - - // This extrinsic is not chargeable - Ok(Pays::No.into()) - } - } -} diff --git a/pallets/airdrop/src/mock.rs b/pallets/airdrop/src/mock.rs deleted file mode 100644 index 6e4f334f9f2..00000000000 --- a/pallets/airdrop/src/mock.rs +++ /dev/null @@ -1,247 +0,0 @@ -// This file is part of Gear. - -// Copyright (C) 2021-2023 Gear Technologies Inc. -// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -use crate as pallet_airdrop; -use frame_support::{ - construct_runtime, parameter_types, - traits::{ConstU64, GenesisBuild, WithdrawReasons}, -}; -use frame_support_test::TestRandomness; -use frame_system as system; -use sp_core::ConstBool; -use sp_runtime::{ - testing::Header, - traits::{BlakeTwo256, ConvertInto, IdentityLookup}, -}; -use sp_std::convert::{TryFrom, TryInto}; - -type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; -type Block = frame_system::mocking::MockBlock; -type AccountId = u64; -type BlockNumber = u64; -type Balance = u128; - -pub const ALICE: AccountId = 1; -pub const BOB: AccountId = 2; -pub const ROOT: AccountId = 255; - -// Configure a mock runtime to test the pallet. -construct_runtime!( - pub enum Test where - Block = Block, - NodeBlock = Block, - UncheckedExtrinsic = UncheckedExtrinsic, - { - System: system, - Balances: pallet_balances, - Sudo: pallet_sudo, - Authorship: pallet_authorship, - Timestamp: pallet_timestamp, - GearProgram: pallet_gear_program, - GearMessenger: pallet_gear_messenger, - GearScheduler: pallet_gear_scheduler, - GearGas: pallet_gear_gas, - GearBank: pallet_gear_bank, - Gear: pallet_gear, - Airdrop: pallet_airdrop, - Vesting: pallet_vesting, - } -); - -parameter_types! { - pub const BlockHashCount: u64 = 250; - pub const SS58Prefix: u8 = 42; - pub const ExistentialDeposit: Balance = 1; - pub const OutgoingLimit: u32 = 1024; - pub GearSchedule: pallet_gear::Schedule = >::default(); -} - -impl system::Config for Test { - type BaseCallFilter = frame_support::traits::Everything; - type BlockWeights = (); - type BlockLength = (); - type DbWeight = (); - type RuntimeOrigin = RuntimeOrigin; - type RuntimeCall = RuntimeCall; - type Index = u64; - type BlockNumber = BlockNumber; - type Hash = sp_core::H256; - type Hashing = BlakeTwo256; - type AccountId = AccountId; - type Lookup = IdentityLookup; - type Header = Header; - type RuntimeEvent = RuntimeEvent; - type BlockHashCount = BlockHashCount; - type Version = (); - type PalletInfo = PalletInfo; - type AccountData = pallet_balances::AccountData; - type OnNewAccount = (); - type OnKilledAccount = (); - type SystemWeightInfo = (); - type SS58Prefix = SS58Prefix; - type OnSetCode = (); - type MaxConsumers = frame_support::traits::ConstU32<16>; -} - -impl pallet_balances::Config for Test { - type MaxLocks = (); - type MaxReserves = (); - type ReserveIdentifier = [u8; 8]; - type Balance = Balance; - type DustRemoval = (); - type RuntimeEvent = RuntimeEvent; - type ExistentialDeposit = ExistentialDeposit; - type AccountStore = System; - type WeightInfo = (); -} - -impl pallet_sudo::Config for Test { - type RuntimeEvent = RuntimeEvent; - type RuntimeCall = RuntimeCall; -} - -impl pallet_timestamp::Config for Test { - type Moment = u64; - type OnTimestampSet = (); - type MinimumPeriod = ConstU64<500>; - type WeightInfo = (); -} - -impl pallet_authorship::Config for Test { - type FindAuthor = (); - - type EventHandler = (); -} - -impl pallet_gear_gas::Config for Test { - type BlockGasLimit = ConstU64<100_000_000>; -} - -impl pallet_gear_messenger::Config for Test { - type BlockLimiter = GearGas; - type CurrentBlockNumber = Gear; -} - -impl pallet_gear_program::Config for Test { - type Scheduler = GearScheduler; - type CurrentBlockNumber = (); -} - -parameter_types! { - pub RentFreePeriod: BlockNumber = 1_000; - pub RentCostPerBlock: Balance = 11; - pub ResumeMinimalPeriod: BlockNumber = 100; - pub ResumeSessionDuration: BlockNumber = 1_000; - pub const BankAddress: AccountId = 15082001; - pub const GasMultiplier: common::GasMultiplier = common::GasMultiplier::ValuePerGas(25); -} - -impl pallet_gear_bank::Config for Test { - type Currency = Balances; - type BankAddress = BankAddress; - type GasMultiplier = GasMultiplier; -} - -impl pallet_gear::Config for Test { - type RuntimeEvent = RuntimeEvent; - type Randomness = TestRandomness; - type WeightInfo = (); - type Schedule = GearSchedule; - type OutgoingLimit = OutgoingLimit; - type DebugInfo = (); - type ProgramStorage = GearProgram; - type CodeStorage = GearProgram; - type MailboxThreshold = ConstU64<3000>; - type ReservationsLimit = ConstU64<256>; - type Messenger = GearMessenger; - type GasProvider = GearGas; - type BlockLimiter = GearGas; - type Scheduler = GearScheduler; - type QueueRunner = Gear; - type Voucher = (); - type ProgramRentFreePeriod = RentFreePeriod; - type ProgramResumeMinimalRentPeriod = ResumeMinimalPeriod; - type ProgramRentCostPerBlock = RentCostPerBlock; - type ProgramResumeSessionDuration = ResumeSessionDuration; - type ProgramRentEnabled = ConstBool; - type ProgramRentDisabledDelta = RentFreePeriod; -} - -impl pallet_gear_scheduler::Config for Test { - type BlockLimiter = GearGas; - type ReserveThreshold = ConstU64<1>; - type WaitlistCost = ConstU64<100>; - type MailboxCost = ConstU64<100>; - type ReservationCost = ConstU64<100>; - type DispatchHoldCost = ConstU64<100>; -} - -parameter_types! { - pub UnvestedFundsAllowedWithdrawReasons: WithdrawReasons = - WithdrawReasons::except(WithdrawReasons::TRANSFER | WithdrawReasons::RESERVE); -} - -impl pallet_vesting::Config for Test { - type RuntimeEvent = RuntimeEvent; - type Currency = Balances; - type BlockNumberToBalance = ConvertInto; - type MinVestedTransfer = (); - type WeightInfo = (); - type UnvestedFundsAllowedWithdrawReasons = UnvestedFundsAllowedWithdrawReasons; - const MAX_VESTING_SCHEDULES: u32 = 28; -} - -pub type VestingError = pallet_vesting::Error; - -impl pallet_airdrop::Config for Test { - type RuntimeEvent = RuntimeEvent; - type WeightInfo = (); - type VestingSchedule = Vesting; -} - -pub type AirdropCall = pallet_airdrop::Call; -pub type AirdropError = pallet_airdrop::Error; - -// Build genesis storage according to the mock runtime. -pub fn new_test_ext() -> sp_io::TestExternalities { - let mut t = system::GenesisConfig::default() - .build_storage::() - .unwrap(); - - pallet_balances::GenesisConfig:: { - balances: vec![ - (ROOT, 100_000_000_u128), - (BOB, 100_000_000_u128), - (BankAddress::get(), ExistentialDeposit::get()), - ], - } - .assimilate_storage(&mut t) - .unwrap(); - - pallet_sudo::GenesisConfig:: { key: Some(ROOT) } - .assimilate_storage(&mut t) - .unwrap(); - - pallet_vesting::GenesisConfig:: { - vesting: vec![(BOB, 100, 1000, 0)], - } - .assimilate_storage(&mut t) - .unwrap(); - - t.into() -} diff --git a/pallets/airdrop/src/tests.rs b/pallets/airdrop/src/tests.rs deleted file mode 100644 index 420b8c05930..00000000000 --- a/pallets/airdrop/src/tests.rs +++ /dev/null @@ -1,173 +0,0 @@ -// This file is part of Gear. - -// Copyright (C) 2021-2023 Gear Technologies Inc. -// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -use super::*; -use crate::mock::{ - new_test_ext, Airdrop, AirdropCall, AirdropError, Balances, BankAddress, ExistentialDeposit, - RuntimeCall, RuntimeOrigin, Sudo, Test, Vesting, VestingError, ALICE, BOB, ROOT, -}; -use frame_support::{assert_err, assert_noop, assert_ok}; -use frame_system::Config; -use pallet_vesting::VestingInfo; - -#[test] -fn test_setup_works() { - new_test_ext().execute_with(|| { - assert_eq!(Sudo::key(), Some(ROOT)); - assert_eq!( - Balances::total_issuance(), - 200_000_000 + ExistentialDeposit::get() - ); - }); -} - -#[test] -fn sudo_call_works() { - new_test_ext().execute_with(|| { - let call = Box::new(RuntimeCall::Airdrop(AirdropCall::transfer { - source: ROOT, - dest: ALICE, - amount: 10_000_000, - })); - assert_ok!(Sudo::sudo(RuntimeOrigin::signed(ROOT), call)); - assert_eq!(Balances::total_balance(&ALICE), 10_000_000); - assert_eq!(Balances::total_balance(&ROOT), 90_000_000); - assert_eq!( - Balances::total_balance(&BankAddress::get()), - ExistentialDeposit::get() - ); - assert_eq!( - Balances::total_issuance(), - 200_000_000 + ExistentialDeposit::get() - ); - - assert_eq!(Balances::locks(BOB).len(), 1); - let call = Box::new(RuntimeCall::Airdrop(AirdropCall::transfer_vested { - source: BOB, - dest: ALICE, - schedule_index: 0, - amount: None, - })); - assert_ok!(Sudo::sudo(RuntimeOrigin::signed(ROOT), call)); - assert_eq!(Balances::total_balance(&BOB), 0); - assert_eq!(Balances::locks(BOB), vec![]); - assert_eq!(Balances::total_balance(&ALICE), 110_000_000); - assert_eq!( - Balances::total_issuance(), - 200_000_000 + ExistentialDeposit::get() - ); - }); -} -#[test] -fn vesting_transfer_works() { - new_test_ext().execute_with(|| { - assert_eq!(Balances::locks(BOB).len(), 1); - assert_eq!( - Vesting::vesting(BOB).unwrap().first().unwrap(), - &VestingInfo::, ::BlockNumber>::new( - 100_000_000, - 100_000, - 100, - ) - ); - assert_eq!(Balances::total_balance(&ALICE), 0); - assert_eq!(Balances::total_balance(&BOB), 100_000_000); - assert_eq!(Balances::total_balance(&ROOT), 100_000_000); - assert_eq!( - Balances::total_balance(&BankAddress::get()), - ExistentialDeposit::get() - ); - assert_eq!( - Balances::total_issuance(), - 200_000_000 + ExistentialDeposit::get() - ); - - // Vesting must exist on the source account - assert_err!( - Airdrop::transfer_vested(RuntimeOrigin::root(), ALICE, BOB, 1, Some(200_000_000)), - VestingError::NotVesting - ); - - // Schedule must exist on the source account - assert_err!( - Airdrop::transfer_vested(RuntimeOrigin::root(), BOB, ALICE, 1, Some(200_000_000)), - VestingError::ScheduleIndexOutOfBounds - ); - - // Amount can't be bigger than locked funds - assert_err!( - Airdrop::transfer_vested(RuntimeOrigin::root(), BOB, ALICE, 0, Some(200_000_000)), - AirdropError::AmountBigger - ); - - // Transfer part of vested funds to ALICE - assert_ok!(Airdrop::transfer_vested( - RuntimeOrigin::root(), - BOB, - ALICE, - 0, - Some(10_000_000) - )); - - // Check that BOB have the same vesting schedule reduced by unlocked funds - assert_eq!( - Vesting::vesting(BOB).unwrap().first().unwrap(), - &VestingInfo::, ::BlockNumber>::new( - 90_000_000, 90_000, 100, - ) - ); - assert_eq!(Balances::total_balance(&BOB), 90_000_000); - assert_eq!(Balances::free_balance(ALICE), 10_000_000); - assert_eq!( - Balances::total_issuance(), - 200_000_000 + ExistentialDeposit::get() - ); - - // Transfer all of vested funds to ALICE - assert_ok!(Airdrop::transfer_vested( - RuntimeOrigin::root(), - BOB, - ALICE, - 0, - None - )); - - // Check that BOB have no vesting and ALICE have all the unlocked funds. - assert_eq!(Vesting::vesting(BOB), None); - assert_eq!(Balances::total_balance(&BOB), 0); - assert_eq!(Balances::free_balance(ALICE), 100_000_000); - assert_eq!( - Balances::total_issuance(), - 200_000_000 + ExistentialDeposit::get() - ); - }); -} - -#[test] -fn signed_extrinsic_fails() { - new_test_ext().execute_with(|| { - assert_noop!( - Airdrop::transfer(RuntimeOrigin::signed(ROOT), ROOT, ALICE, 10_000_000_u128), - DispatchError::BadOrigin, - ); - assert_noop!( - Airdrop::transfer_vested(RuntimeOrigin::signed(ROOT), BOB, ALICE, 0, None), - DispatchError::BadOrigin, - ); - }); -} diff --git a/pallets/airdrop/src/weights.rs b/pallets/airdrop/src/weights.rs deleted file mode 100644 index ddaa539a3d9..00000000000 --- a/pallets/airdrop/src/weights.rs +++ /dev/null @@ -1,95 +0,0 @@ -// This file is part of Gear. - -// Copyright (C) 2022-2023 Gear Technologies Inc. -// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -//! Autogenerated weights for pallet_airdrop -//! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-07-26, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! WORST CASE MAP SIZE: `1000000` -//! CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("vara-dev"), DB CACHE: 1024 - -// Executed Command: -// ./target/production/gear benchmark pallet --chain=vara-dev --steps=50 --repeat=20 --pallet=pallet_airdrop --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=pallet_airdrop.rs --template=.maintain/frame-weight-template.hbs - -#![cfg_attr(rustfmt, rustfmt_skip)] -#![allow(unused_parens)] -#![allow(unused_imports)] -#![allow(clippy::unnecessary_cast)] - -use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; -use sp_std::marker::PhantomData; - -/// Weight functions needed for pallet_airdrop. -pub trait WeightInfo { - fn transfer(q: u32, ) -> Weight; - fn transfer_vested(q: u32, ) -> Weight; -} - -/// Weights for pallet_airdrop using the Gear node and recommended hardware. -pub struct SubstrateWeight(PhantomData); -impl WeightInfo for SubstrateWeight { - /// The range of component `q` is `[1, 256]`. - fn transfer(_q: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `103` - // Estimated: `6196` - // Minimum execution time: 25_027_000 picoseconds. - Weight::from_parts(25_985_030, 6196) - .saturating_add(T::DbWeight::get().reads(2_u64)) - .saturating_add(T::DbWeight::get().writes(2_u64)) - } - /// The range of component `q` is `[1, 256]`. - fn transfer_vested(q: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `550` - // Estimated: `15482` - // Minimum execution time: 65_271_000 picoseconds. - Weight::from_parts(67_109_074, 15482) - // Standard Error: 328 - .saturating_add(Weight::from_parts(336, 0).saturating_mul(q.into())) - .saturating_add(T::DbWeight::get().reads(4_u64)) - .saturating_add(T::DbWeight::get().writes(4_u64)) - } -} - -// For backwards compatibility and tests -impl WeightInfo for () { - /// The range of component `q` is `[1, 256]`. - fn transfer(_q: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `103` - // Estimated: `6196` - // Minimum execution time: 25_027_000 picoseconds. - Weight::from_parts(25_985_030, 6196) - .saturating_add(RocksDbWeight::get().reads(2_u64)) - .saturating_add(RocksDbWeight::get().writes(2_u64)) - } - /// The range of component `q` is `[1, 256]`. - fn transfer_vested(q: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `550` - // Estimated: `15482` - // Minimum execution time: 65_271_000 picoseconds. - Weight::from_parts(67_109_074, 15482) - // Standard Error: 328 - .saturating_add(Weight::from_parts(336, 0).saturating_mul(q.into())) - .saturating_add(RocksDbWeight::get().reads(4_u64)) - .saturating_add(RocksDbWeight::get().writes(4_u64)) - } -} diff --git a/runtime/vara/Cargo.toml b/runtime/vara/Cargo.toml index fa91b85ef26..dcfed171e56 100644 --- a/runtime/vara/Cargo.toml +++ b/runtime/vara/Cargo.toml @@ -98,7 +98,6 @@ pallet-gear-staking-rewards.workspace = true pallet-gear-voucher.workspace = true pallet-gear-rpc-runtime-api.workspace = true runtime-primitives.workspace = true -pallet-airdrop.workspace = true [dev-dependencies] sp-io.workspace = true @@ -185,7 +184,6 @@ std = [ "sp-transaction-pool/std", "sp-version/std", "substrate-wasm-builder", - "pallet-airdrop/std", ] runtime-benchmarks = [ "frame-benchmarking/runtime-benchmarks", @@ -200,7 +198,6 @@ runtime-benchmarks = [ "pallet-gear/runtime-benchmarks", "pallet-gear-voucher/runtime-benchmarks", "sp-runtime/runtime-benchmarks", - "pallet-airdrop/runtime-benchmarks", "pallet-bags-list/runtime-benchmarks", "pallet-staking/runtime-benchmarks", "pallet-conviction-voting/runtime-benchmarks", @@ -255,7 +252,6 @@ try-runtime = [ "pallet-utility/try-runtime", "pallet-vesting/try-runtime", "pallet-whitelist/try-runtime", - "pallet-airdrop/try-runtime", "pallet-bags-list/try-runtime", "runtime-common/try-runtime", ] diff --git a/runtime/vara/src/lib.rs b/runtime/vara/src/lib.rs index c6332876d1b..6317db2cc24 100644 --- a/runtime/vara/src/lib.rs +++ b/runtime/vara/src/lib.rs @@ -1015,12 +1015,6 @@ impl pallet_gear_messenger::Config for Runtime { type CurrentBlockNumber = Gear; } -impl pallet_airdrop::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type WeightInfo = weights::pallet_airdrop::SubstrateWeight; - type VestingSchedule = Vesting; -} - pub struct ExtraFeeFilter; impl Contains for ExtraFeeFilter { fn contains(call: &RuntimeCall) -> bool { @@ -1167,8 +1161,7 @@ construct_runtime!( // TODO: Remove in stage 3 Sudo: pallet_sudo = 99, - // TODO: remove from production version - Airdrop: pallet_airdrop = 198, + // NOTE (!): `pallet_airdrop` used to be idx(198). // Only available with "debug-mode" feature on GearDebug: pallet_gear_debug = 199, @@ -1232,8 +1225,7 @@ construct_runtime!( // TODO: Remove in stage 3 Sudo: pallet_sudo = 99, - // TODO: remove from production version - Airdrop: pallet_airdrop = 198, + // NOTE (!): `pallet_airdrop` used to be idx(198). } ); @@ -1295,7 +1287,6 @@ mod benches { [pallet_timestamp, Timestamp] [pallet_utility, Utility] // Gear pallets - [pallet_airdrop, Airdrop] [pallet_gear, Gear] [pallet_gear_voucher, GearVoucher] ); diff --git a/runtime/vara/src/weights/mod.rs b/runtime/vara/src/weights/mod.rs index 170d6f59e22..b4eebedfe52 100644 --- a/runtime/vara/src/weights/mod.rs +++ b/runtime/vara/src/weights/mod.rs @@ -19,7 +19,6 @@ //! A list of the different weight modules for our runtime. pub mod frame_system; -pub mod pallet_airdrop; pub mod pallet_balances; pub mod pallet_gear; pub mod pallet_gear_voucher; diff --git a/runtime/vara/src/weights/pallet_airdrop.rs b/runtime/vara/src/weights/pallet_airdrop.rs deleted file mode 100644 index ffe616fea00..00000000000 --- a/runtime/vara/src/weights/pallet_airdrop.rs +++ /dev/null @@ -1,95 +0,0 @@ -// This file is part of Gear. - -// Copyright (C) 2022-2023 Gear Technologies Inc. -// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -//! Autogenerated weights for pallet_airdrop -//! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-09-11, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! WORST CASE MAP SIZE: `1000000` -//! CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("vara-dev"), DB CACHE: 1024 - -// Executed Command: -// ./target/production/gear benchmark pallet --chain=vara-dev --steps=50 --repeat=20 --pallet=pallet_airdrop --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./scripts/benchmarking/weights-output/pallet_airdrop.rs --template=.maintain/frame-weight-template.hbs - -#![cfg_attr(rustfmt, rustfmt_skip)] -#![allow(unused_parens)] -#![allow(unused_imports)] -#![allow(clippy::unnecessary_cast)] - -use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; -use sp_std::marker::PhantomData; - -/// Weight functions needed for pallet_airdrop. -pub trait WeightInfo { - fn transfer(q: u32, ) -> Weight; - fn transfer_vested(q: u32, ) -> Weight; -} - -/// Weights for pallet_airdrop using the Gear node and recommended hardware. -pub struct SubstrateWeight(PhantomData); -impl pallet_airdrop::WeightInfo for SubstrateWeight { - /// The range of component `q` is `[1, 256]`. - fn transfer(_q: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `103` - // Estimated: `6196` - // Minimum execution time: 25_162_000 picoseconds. - Weight::from_parts(26_300_954, 6196) - .saturating_add(T::DbWeight::get().reads(2_u64)) - .saturating_add(T::DbWeight::get().writes(2_u64)) - } - /// The range of component `q` is `[1, 256]`. - fn transfer_vested(q: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `550` - // Estimated: `15482` - // Minimum execution time: 65_671_000 picoseconds. - Weight::from_parts(67_524_170, 15482) - // Standard Error: 398 - .saturating_add(Weight::from_parts(280, 0).saturating_mul(q.into())) - .saturating_add(T::DbWeight::get().reads(4_u64)) - .saturating_add(T::DbWeight::get().writes(4_u64)) - } -} - -// For backwards compatibility and tests -impl WeightInfo for () { - /// The range of component `q` is `[1, 256]`. - fn transfer(_q: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `103` - // Estimated: `6196` - // Minimum execution time: 25_162_000 picoseconds. - Weight::from_parts(26_300_954, 6196) - .saturating_add(RocksDbWeight::get().reads(2_u64)) - .saturating_add(RocksDbWeight::get().writes(2_u64)) - } - /// The range of component `q` is `[1, 256]`. - fn transfer_vested(q: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `550` - // Estimated: `15482` - // Minimum execution time: 65_671_000 picoseconds. - Weight::from_parts(67_524_170, 15482) - // Standard Error: 398 - .saturating_add(Weight::from_parts(280, 0).saturating_mul(q.into())) - .saturating_add(RocksDbWeight::get().reads(4_u64)) - .saturating_add(RocksDbWeight::get().writes(4_u64)) - } -} From 80fb8478fffe5316f64fc0e491e76b358adda40c Mon Sep 17 00:00:00 2001 From: Dmitry Novikov Date: Fri, 15 Sep 2023 19:39:02 +0400 Subject: [PATCH 4/7] chore(v1.0.0): Development features gate (#3277) --- .github/workflows/release.yml | 53 ++++++++++++++++++++--------- gsdk/build.rs | 6 +--- node/authorship/Cargo.toml | 2 +- node/cli/Cargo.toml | 8 ++--- node/cli/src/command.rs | 39 ++++++++++++++------- node/service/Cargo.toml | 6 ++-- node/service/src/chain_spec/gear.rs | 1 + node/service/src/chain_spec/vara.rs | 1 + node/testing/Cargo.toml | 4 +-- pallets/gear-debug/Cargo.toml | 2 +- pallets/gear-debug/src/tests/mod.rs | 8 ++--- pallets/gear-program/Cargo.toml | 2 +- pallets/gear-program/src/lib.rs | 4 +-- runtime/gear/Cargo.toml | 2 +- runtime/gear/src/lib.rs | 14 ++++---- runtime/vara/Cargo.toml | 2 +- runtime/vara/src/lib.rs | 14 ++++---- scripts/update-gsdk-metadata.sh | 2 +- 18 files changed, 101 insertions(+), 69 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5c62aa29c58..07d09151710 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -49,46 +49,67 @@ jobs: needs: prepare runs-on: [kuberunner] steps: - - name: Checkout + - name: "Actions: Checkout" uses: actions/checkout@v4 - - name: Set cargo path - run: echo "/tmp/cargo/bin" >> $GITHUB_PATH + - name: "Environment: Cargo path" + run: > + echo "/tmp/cargo/bin" >> $GITHUB_PATH - name: "Install: Rust toolchain" uses: dsherret/rust-toolchain-file@v1 - - name: Install build deps + - name: "Install: Build dependencies" run: | sudo apt update -y sudo apt install -y git clang curl libssl-dev llvm libudev-dev cmake protobuf-compiler wget bzip2 - - name: Build wasm-proc + - name: "Environment: Export versions" + run: | + export GEAR_SPEC="$(cat runtime/gear/src/lib.rs | grep "spec_version: " | awk -F " " '{print substr($2, 1, length($2)-1)}')" + export VARA_SPEC="$(cat runtime/vara/src/lib.rs | grep "spec_version: " | awk -F " " '{print substr($2, 1, length($2)-1)}')" + + - name: "Artifact: Make `artifact` directory" + run: > + mkdir -p artifact + + - name: "Build: `wasm-proc`" run: | cargo build -p wasm-proc --release cp -vf target/release/wasm-proc ./ - - name: Build binaries + - name: "Build: Production `gear-cli`" run: > cargo build -p gear-cli --profile production - - name: Test runtimes + - name: "Test: Production runtimes" run: | ./wasm-proc --check-runtime-imports target/production/wbuild/gear-runtime/gear_runtime.wasm ./wasm-proc --check-runtime-imports target/production/wbuild/vara-runtime/vara_runtime.wasm - - name: Prepare artifacts + - name: "Artifact: Production binaries" run: | - mkdir -p artifact - cp target/production/wbuild/gear-runtime/gear_runtime.compact.compressed.wasm artifact/ - cp target/production/wbuild/gear-runtime/gear_runtime.compact.wasm artifact/ - cp target/production/wbuild/gear-runtime/gear_runtime.wasm artifact/ - cp target/production/wbuild/vara-runtime/vara_runtime.compact.compressed.wasm artifact/ - cp target/production/wbuild/vara-runtime/vara_runtime.compact.wasm artifact/ - cp target/production/wbuild/vara-runtime/vara_runtime.wasm artifact/ - cp target/production/gear artifact/ + cp target/production/wbuild/gear-runtime/gear_runtime.compact.compressed.wasm "artifact/gear_v$GEAR_SPEC.wasm" + cp target/production/wbuild/vara-runtime/vara_runtime.compact.compressed.wasm "artifact/vara_v$VARA_SPEC.wasm" + cp target/production/gear artifact/gear strip artifact/gear || true + - name: "Build: Development `gear-cli`" + run: > + cargo build -p gear-cli --profile production -F dev + + - name: "Test: Development runtimes" + run: | + ./wasm-proc --check-runtime-imports target/production/wbuild/gear-runtime/gear_runtime.wasm + ./wasm-proc --check-runtime-imports target/production/wbuild/vara-runtime/vara_runtime.wasm + + - name: "Artifact: Development binaries" + run: | + cp target/production/wbuild/gear-runtime/gear_runtime.compact.compressed.wasm "artifact/dev_gear_v$GEAR_SPEC.wasm" + cp target/production/wbuild/vara-runtime/vara_runtime.compact.compressed.wasm "artifact/dev_vara_v$VARA_SPEC.wasm" + cp target/production/gear artifact/dev-gear + strip artifact/dev-gear || true + - name: Publish uses: softprops/action-gh-release@v1 with: diff --git a/gsdk/build.rs b/gsdk/build.rs index 992126a4a46..a7e74efbc13 100644 --- a/gsdk/build.rs +++ b/gsdk/build.rs @@ -40,11 +40,7 @@ fn generate_api() -> Vec { // NOTE: use vara here since vara includes all pallets gear have, // and the API we are building here is for both vara and gear. let [vara_runtime, api_gen] = [ - ( - VARA_RUNTIME_RELATIVE_PATH, - VARA_RUNTIME_PKG, - vec!["debug-mode"], - ), + (VARA_RUNTIME_RELATIVE_PATH, VARA_RUNTIME_PKG, vec!["dev"]), (GSDK_API_GEN_RELATIVE_PATH, GSDK_API_GEN_PKG, vec![]), ] .map(|(relative_path, pkg, features)| get_path(root, &profile, relative_path, pkg, features)); diff --git a/node/authorship/Cargo.toml b/node/authorship/Cargo.toml index 9c9633d0ce9..041944ca157 100644 --- a/node/authorship/Cargo.toml +++ b/node/authorship/Cargo.toml @@ -55,6 +55,6 @@ pallet-balances = { workspace = true, features = ["std"] } pallet-gear = { workspace = true, features = ["std"] } pallet-gear-messenger = { workspace = true, features = ["std"] } testing = {workspace = true, features = ["vara-native"] } -vara-runtime = { workspace = true, features = ["std"] } +vara-runtime = { workspace = true, features = ["std", "dev"] } demo-mul-by-const.workspace = true env_logger.workspace = true diff --git a/node/cli/Cargo.toml b/node/cli/Cargo.toml index 022e3f13c0c..02fe1c8c9d2 100644 --- a/node/cli/Cargo.toml +++ b/node/cli/Cargo.toml @@ -86,10 +86,10 @@ runtime-benchmarks = [ runtime-benchmarks-checkers = [ "service/runtime-benchmarks-checkers", ] -debug-mode = [ - "service/debug-mode", - "gear-runtime?/debug-mode", - "vara-runtime?/debug-mode", +dev = [ + "service/dev", + "gear-runtime?/dev", + "vara-runtime?/dev", ] try-runtime = [ "service/try-runtime", diff --git a/node/cli/src/command.rs b/node/cli/src/command.rs index 42cf04ca104..d88945fd663 100644 --- a/node/cli/src/command.rs +++ b/node/cli/src/command.rs @@ -52,20 +52,32 @@ impl SubstrateCli for Cli { fn load_spec(&self, id: &str) -> Result, String> { Ok(match id { - #[cfg(feature = "gear-native")] + #[cfg(all(feature = "gear-native", feature = "dev"))] "dev" | "gear-dev" => Box::new(chain_spec::gear::development_config()?), - #[cfg(feature = "vara-native")] + #[cfg(all(feature = "vara-native", feature = "dev"))] "vara-dev" => Box::new(chain_spec::vara::development_config()?), #[cfg(feature = "gear-native")] - "local" | "gear-local" => Box::new(chain_spec::gear::local_testnet_config()?), + "local" | "gear-local" => { + #[cfg(feature = "dev")] + log::warn!("Running `gear-local` in `dev` mode"); + Box::new(chain_spec::gear::local_testnet_config()?) + } #[cfg(feature = "vara-native")] "vara" => Box::new(chain_spec::RawChainSpec::from_json_bytes( &include_bytes!("../../res/vara.json")[..], )?), #[cfg(feature = "vara-native")] - "vara-local" => Box::new(chain_spec::vara::local_testnet_config()?), + "vara-local" => { + #[cfg(feature = "dev")] + log::warn!("Running `vara-local` in `dev` mode"); + Box::new(chain_spec::vara::local_testnet_config()?) + } #[cfg(feature = "gear-native")] - "staging" | "gear-staging" => Box::new(chain_spec::gear::staging_testnet_config()?), + "staging" | "gear-staging" => { + #[cfg(feature = "dev")] + log::warn!("Running `gear-staging` in `dev` mode"); + Box::new(chain_spec::gear::staging_testnet_config()?) + } "test" | "" => Box::new(chain_spec::RawChainSpec::from_json_bytes( &include_bytes!("../../res/staging.json")[..], )?), @@ -75,24 +87,25 @@ impl SubstrateCli for Cli { let chain_spec = Box::new(chain_spec::RawChainSpec::from_json_file(path.clone())?) as Box; + if chain_spec.is_dev() { + #[cfg(not(feature = "dev"))] + return Err("Development runtimes are not available. Please compile the node with `-F dev` to enable it.".into()); + } + // When `force_*` is provide or the file name starts with the name of a known chain, // we use the chain spec for the specific chain. if self.run.force_vara || chain_spec.is_vara() { #[cfg(feature = "vara-native")] - { - Box::new(chain_spec::vara::ChainSpec::from_json_file(path)?) - } + return Ok(Box::new(chain_spec::vara::ChainSpec::from_json_file(path)?)); #[cfg(not(feature = "vara-native"))] - return Err("Vara runtime is not available. Please compile the node with `--features vara-native` to enable it.".into()); + return Err("Vara runtime is not available. Please compile the node with `-F vara-native` to enable it.".into()); } else { #[cfg(feature = "gear-native")] - { - Box::new(chain_spec::gear::ChainSpec::from_json_file(path)?) - } + return Ok(Box::new(chain_spec::gear::ChainSpec::from_json_file(path)?)); #[cfg(not(feature = "gear-native"))] - return Err("Gear runtime is not available. Please compile the node with default features to enable it.".into()); + return Err("Gear runtime is not available. Please compile the node with `-F gear-native` to enable it.".into()); } } }) diff --git a/node/service/Cargo.toml b/node/service/Cargo.toml index 8a7149183bc..79ff6da306f 100644 --- a/node/service/Cargo.toml +++ b/node/service/Cargo.toml @@ -123,9 +123,9 @@ runtime-benchmarks-checkers = [ "gear-runtime?/runtime-benchmarks-checkers", "vara-runtime?/runtime-benchmarks-checkers", ] -debug-mode = [ - "gear-runtime?/debug-mode", - "vara-runtime?/debug-mode", +dev = [ + "gear-runtime?/dev", + "vara-runtime?/dev", ] try-runtime = [ "gear-runtime?/try-runtime", diff --git a/node/service/src/chain_spec/gear.rs b/node/service/src/chain_spec/gear.rs index 89c4fd29c96..d180fde5185 100644 --- a/node/service/src/chain_spec/gear.rs +++ b/node/service/src/chain_spec/gear.rs @@ -41,6 +41,7 @@ pub fn authority_keys_from_seed(s: &str) -> (AccountId, BabeId, GrandpaId) { ) } +#[cfg(feature = "dev")] pub fn development_config() -> Result { let wasm_binary = WASM_BINARY.ok_or_else(|| "Development wasm not available".to_string())?; diff --git a/node/service/src/chain_spec/vara.rs b/node/service/src/chain_spec/vara.rs index 3122e7326d8..95bb0eb244f 100644 --- a/node/service/src/chain_spec/vara.rs +++ b/node/service/src/chain_spec/vara.rs @@ -91,6 +91,7 @@ pub fn authority_keys_from_seed( ) } +#[cfg(feature = "dev")] pub fn development_config() -> Result { let wasm_binary = WASM_BINARY.ok_or_else(|| "Development wasm not available".to_string())?; diff --git a/node/testing/Cargo.toml b/node/testing/Cargo.toml index 807793fdf89..8607639dc26 100644 --- a/node/testing/Cargo.toml +++ b/node/testing/Cargo.toml @@ -72,5 +72,5 @@ std = [ "gear-runtime?/std", "vara-runtime?/std", ] -gear-native = ["gear-runtime"] -vara-native = ["vara-runtime"] +gear-native = ["gear-runtime/dev"] +vara-native = ["vara-runtime/dev"] diff --git a/pallets/gear-debug/Cargo.toml b/pallets/gear-debug/Cargo.toml index f4d0e4c3294..af5b894aecf 100644 --- a/pallets/gear-debug/Cargo.toml +++ b/pallets/gear-debug/Cargo.toml @@ -45,7 +45,7 @@ pallet-gear-bank = { workspace = true, features = ["std"] } pallet-gear-gas = { workspace = true, features = ["std"] } pallet-gear-messenger = { workspace = true, features = ["std"] } pallet-gear-scheduler = { workspace = true, features = ["std"] } -pallet-gear-program = { workspace = true, features = ["debug-mode", "std"] } +pallet-gear-program = { workspace = true, features = ["dev", "std"] } gear-wasm-instrument.workspace = true demo-vec.workspace = true test-syscalls.workspace = true diff --git a/pallets/gear-debug/src/tests/mod.rs b/pallets/gear-debug/src/tests/mod.rs index 66d5b8b57ef..2008ae84895 100644 --- a/pallets/gear-debug/src/tests/mod.rs +++ b/pallets/gear-debug/src/tests/mod.rs @@ -159,7 +159,7 @@ fn debug_mode_works() { ) .expect("Failed to submit program"); - // Enable debug-mode + // Enable debug mode. DebugMode::::put(true); run_to_block(2, None); @@ -528,7 +528,7 @@ fn check_not_allocated_pages() { 0_u128, )); - // Enable debug-mode + // Enable debug mode. DebugMode::::put(true); run_to_block(2, None); @@ -756,7 +756,7 @@ fn check_changed_pages_in_storage() { 0_u128, )); - // Enable debug-mode + // Enable debug mode. DebugMode::::put(true); run_to_block(2, None); @@ -886,7 +886,7 @@ fn check_gear_stack_end() { 0_u128, )); - // Enable debug-mode + // Enable debug mode. DebugMode::::put(true); run_to_block(2, None); diff --git a/pallets/gear-program/Cargo.toml b/pallets/gear-program/Cargo.toml index 0dd3e2653b9..72b9afd28e1 100644 --- a/pallets/gear-program/Cargo.toml +++ b/pallets/gear-program/Cargo.toml @@ -55,4 +55,4 @@ std = [ "primitive-types/std", ] try-runtime = ["frame-support/try-runtime"] -debug-mode = [] +dev = [] diff --git a/pallets/gear-program/src/lib.rs b/pallets/gear-program/src/lib.rs index 8d6e8c0cea3..281366bac31 100644 --- a/pallets/gear-program/src/lib.rs +++ b/pallets/gear-program/src/lib.rs @@ -145,7 +145,7 @@ pub mod pallet { storage::*, CodeMetadata, Program, }; - #[cfg(feature = "debug-mode")] + #[cfg(feature = "dev")] use frame_support::storage::PrefixIterator; use frame_support::{ dispatch::EncodeLike, pallet_prelude::*, traits::StorageVersion, StoragePrefixedMap, @@ -388,7 +388,7 @@ pub mod pallet { type SessionMemoryPages = SessionMemoryPagesWrap; } - #[cfg(feature = "debug-mode")] + #[cfg(feature = "dev")] impl IterableMap<(ProgramId, Program>)> for pallet::Pallet { type DrainIter = PrefixIterator<(ProgramId, Program>)>; type Iter = PrefixIterator<(ProgramId, Program>)>; diff --git a/runtime/gear/Cargo.toml b/runtime/gear/Cargo.toml index 005773f2bed..fdd6f2deb3a 100644 --- a/runtime/gear/Cargo.toml +++ b/runtime/gear/Cargo.toml @@ -176,7 +176,7 @@ try-runtime = [ "validator-set/try-runtime", "runtime-common/try-runtime", ] -debug-mode = ["pallet-gear-debug", "pallet-gear-program/debug-mode"] +dev = ["pallet-gear-debug", "pallet-gear-program/dev"] lazy-pages = [ "pallet-gear/lazy-pages", "pallet-gear-payment/lazy-pages", diff --git a/runtime/gear/src/lib.rs b/runtime/gear/src/lib.rs index e7ed11281e6..6094556ebd9 100644 --- a/runtime/gear/src/lib.rs +++ b/runtime/gear/src/lib.rs @@ -89,7 +89,7 @@ pub use pallet_timestamp::Call as TimestampCall; pub use sp_runtime::BuildStorage; pub use pallet_gear; -#[cfg(feature = "debug-mode")] +#[cfg(feature = "dev")] pub use pallet_gear_debug; pub use pallet_gear_gas; pub use pallet_gear_payment; @@ -495,7 +495,7 @@ impl pallet_gear::Config for Runtime { type ProgramRentDisabledDelta = ConstU32<{ WEEKS * RENT_DISABLED_DELTA_WEEK_FACTOR }>; } -#[cfg(feature = "debug-mode")] +#[cfg(feature = "dev")] impl pallet_gear_debug::Config for Runtime { type RuntimeEvent = RuntimeEvent; type WeightInfo = pallet_gear_debug::weights::GearSupportWeight; @@ -600,7 +600,7 @@ where // // While updating the indexes, please update the indexes in `gsdk/src/metadata/mod.rs` // as well, example: https://github.com/gear-tech/gear/pull/2370/commits/a82cb5ba365cf47aef2c42a285a1793a86e711c1 -#[cfg(feature = "debug-mode")] +#[cfg(feature = "dev")] construct_runtime!( pub enum Runtime where Block = Block, @@ -631,12 +631,12 @@ construct_runtime!( GearVoucher: pallet_gear_voucher = 106, GearBank: pallet_gear_bank = 107, - // Only available with "debug-mode" feature on + // Only available with "dev" feature on GearDebug: pallet_gear_debug = 199, } ); -#[cfg(not(feature = "debug-mode"))] +#[cfg(not(feature = "dev"))] construct_runtime!( pub enum Runtime where Block = Block, @@ -704,9 +704,9 @@ pub type Executive = frame_executive::Executive< #[cfg(test)] mod tests; -#[cfg(feature = "debug-mode")] +#[cfg(feature = "dev")] type DebugInfo = GearDebug; -#[cfg(not(feature = "debug-mode"))] +#[cfg(not(feature = "dev"))] type DebugInfo = (); #[cfg(feature = "runtime-benchmarks")] diff --git a/runtime/vara/Cargo.toml b/runtime/vara/Cargo.toml index dcfed171e56..74551fefa6d 100644 --- a/runtime/vara/Cargo.toml +++ b/runtime/vara/Cargo.toml @@ -255,7 +255,7 @@ try-runtime = [ "pallet-bags-list/try-runtime", "runtime-common/try-runtime", ] -debug-mode = ["pallet-gear-debug", "pallet-gear-program/debug-mode"] +dev = ["pallet-gear-debug", "pallet-gear-program/dev"] lazy-pages = [ "pallet-gear/lazy-pages", "pallet-gear-payment/lazy-pages", diff --git a/runtime/vara/src/lib.rs b/runtime/vara/src/lib.rs index 6317db2cc24..7b9f86b4447 100644 --- a/runtime/vara/src/lib.rs +++ b/runtime/vara/src/lib.rs @@ -104,7 +104,7 @@ pub use pallet_sudo::Call as SudoCall; pub use sp_runtime::BuildStorage; pub use pallet_gear; -#[cfg(feature = "debug-mode")] +#[cfg(feature = "dev")] pub use pallet_gear_debug; pub use pallet_gear_gas; pub use pallet_gear_payment; @@ -988,7 +988,7 @@ impl pallet_gear::Config for Runtime { type ProgramRentDisabledDelta = ConstU32<{ WEEKS * RENT_DISABLED_DELTA_WEEK_FACTOR }>; } -#[cfg(feature = "debug-mode")] +#[cfg(feature = "dev")] impl pallet_gear_debug::Config for Runtime { type RuntimeEvent = RuntimeEvent; type WeightInfo = pallet_gear_debug::weights::GearSupportWeight; @@ -1104,7 +1104,7 @@ impl pallet_vesting::Config for Runtime { } // Create the runtime by composing the FRAME pallets that were previously configured. -#[cfg(feature = "debug-mode")] +#[cfg(feature = "dev")] construct_runtime!( pub enum Runtime where Block = Block, @@ -1163,12 +1163,12 @@ construct_runtime!( // NOTE (!): `pallet_airdrop` used to be idx(198). - // Only available with "debug-mode" feature on + // Only available with "dev" feature on GearDebug: pallet_gear_debug = 199, } ); -#[cfg(not(feature = "debug-mode"))] +#[cfg(not(feature = "dev"))] construct_runtime!( pub enum Runtime where Block = Block, @@ -1269,9 +1269,9 @@ mod tests; #[cfg(test)] mod integration_tests; -#[cfg(feature = "debug-mode")] +#[cfg(feature = "dev")] type DebugInfo = GearDebug; -#[cfg(not(feature = "debug-mode"))] +#[cfg(not(feature = "dev"))] type DebugInfo = (); #[cfg(feature = "runtime-benchmarks")] diff --git a/scripts/update-gsdk-metadata.sh b/scripts/update-gsdk-metadata.sh index 8ae3903eae0..b28692c0b81 100755 --- a/scripts/update-gsdk-metadata.sh +++ b/scripts/update-gsdk-metadata.sh @@ -5,7 +5,7 @@ set -ex -cargo build --package vara-runtime --features debug-mode --release +cargo build --package vara-runtime --features dev --release cargo build --package gsdk-api-gen --release touch gsdk/build.rs GSDK_API_GEN=1 cargo build --package gsdk --release From 30af61477b9c6c16c49b5f601d6e6aac41d13f58 Mon Sep 17 00:00:00 2001 From: Dmitry Novikov Date: Fri, 15 Sep 2023 22:15:27 +0400 Subject: [PATCH 5/7] fix(node): Throw error on `--dev` in case of non-dev build (#3280) --- Makefile | 4 ++-- node/cli/src/command.rs | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 0a253551404..347a011742a 100644 --- a/Makefile +++ b/Makefile @@ -46,11 +46,11 @@ examples-proc: wasm-proc-release .PHONY: node node: - @ ./scripts/gear.sh build node + @ ./scripts/gear.sh build node -F dev .PHONY: node-release node-release: - @ ./scripts/gear.sh build node --release + @ ./scripts/gear.sh build node -F dev --release .PHONY: vara vara: diff --git a/node/cli/src/command.rs b/node/cli/src/command.rs index d88945fd663..4daf4785562 100644 --- a/node/cli/src/command.rs +++ b/node/cli/src/command.rs @@ -52,6 +52,8 @@ impl SubstrateCli for Cli { fn load_spec(&self, id: &str) -> Result, String> { Ok(match id { + #[cfg(not(feature = "dev"))] + "dev" | "gear-dev" | "vara-dev" => return Err("Development runtimes are not available. Please compile the node with `-F dev` to enable it.".into()), #[cfg(all(feature = "gear-native", feature = "dev"))] "dev" | "gear-dev" => Box::new(chain_spec::gear::development_config()?), #[cfg(all(feature = "vara-native", feature = "dev"))] From 9eea531dae180c7150a8e0566f67b56967a73d35 Mon Sep 17 00:00:00 2001 From: Dmitry Novikov Date: Fri, 15 Sep 2023 22:15:39 +0400 Subject: [PATCH 6/7] chore(v1.0.0): Remove `pallet-sudo` from production Vara (#3279) --- .github/workflows/build.yml | 8 +++--- .github/workflows/test-measurements.yaml | 2 +- Cargo.lock | 2 ++ node/authorship/Cargo.toml | 1 + node/service/src/chain_spec/vara.rs | 8 +++++- node/testing/Cargo.toml | 5 ++-- runtime/vara/Cargo.toml | 12 +++++--- runtime/vara/src/lib.rs | 32 ++++++++++++++-------- scripts/benchmarking/run_all_benchmarks.sh | 2 +- 9 files changed, 47 insertions(+), 25 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 190dfc4f524..7dc8cfc4c84 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -66,7 +66,7 @@ jobs: run: ./scripts/gear.sh init cargo - name: "Build: Gear" - run: ./scripts/gear.sh build gear --locked --release + run: ./scripts/gear.sh build gear -F gear-cli/dev --locked --release - name: "Build fuzzer" run: ./scripts/gear.sh build fuzz --locked --release @@ -96,7 +96,7 @@ jobs: - name: "Test: Runtime benchmarks and benchmark tests work" run: | - cargo build -p gear-cli --release --features=runtime-benchmarks,runtime-benchmarks-checkers + cargo build -p gear-cli --release --features=dev,runtime-benchmarks,runtime-benchmarks-checkers # check that perf benchmarks works. `--steps=20` need to test, that benchmarks works for different input number. ./target/release/gear benchmark pallet --chain=dev --pallet=pallet_gear --steps=20 --extrinsic="*" --execution=wasm --wasm-execution=compiled --heap-pages=4096 # check that read_big_state benchmarks works @@ -111,11 +111,11 @@ jobs: - name: "Test: `try-runtime` feature tests" run: | - cargo test -p "pallet-*" --features try-runtime --release --locked + cargo test -p "pallet-*" --features try-runtime,dev --release --locked - name: "Test: Try runtime migrations" run: | - cargo build -p gear-cli --features try-runtime --release --locked + cargo build -p gear-cli --features try-runtime,dev --release --locked ./target/release/gear try-runtime --runtime ./target/release/wbuild/gear-runtime/gear_runtime.wasm on-runtime-upgrade --checks live --uri wss://rpc-private-testnet.gear-tech.io:443 env: RUST_LOG: info diff --git a/.github/workflows/test-measurements.yaml b/.github/workflows/test-measurements.yaml index 1368cadb136..b9c3a16a657 100644 --- a/.github/workflows/test-measurements.yaml +++ b/.github/workflows/test-measurements.yaml @@ -42,7 +42,7 @@ jobs: tar -xf /cache/check_cargo_registry_${{ github.ref_name }}.tar -C / - name: "Build: Gear" - run: ./scripts/gear.sh build gear --release --locked --features=runtime-benchmarks,lazy-pages + run: ./scripts/gear.sh build gear --release --locked --features=dev,runtime-benchmarks,lazy-pages - name: "Collect: Gear workspace tests" run: | diff --git a/Cargo.lock b/Cargo.lock index f51d1120230..108999619f0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3745,6 +3745,7 @@ dependencies = [ "gear-common", "gear-node-testing", "gear-runtime-primitives", + "gear-service", "log", "pallet-balances", "pallet-gear", @@ -4046,6 +4047,7 @@ dependencies = [ "gear-runtime", "gear-runtime-interface", "gear-runtime-primitives", + "gear-service", "log", "pallet-gear-rpc-runtime-api", "parity-scale-codec", diff --git a/node/authorship/Cargo.toml b/node/authorship/Cargo.toml index 041944ca157..7b474e043a6 100644 --- a/node/authorship/Cargo.toml +++ b/node/authorship/Cargo.toml @@ -58,3 +58,4 @@ testing = {workspace = true, features = ["vara-native"] } vara-runtime = { workspace = true, features = ["std", "dev"] } demo-mul-by-const.workspace = true env_logger.workspace = true +service = { workspace = true, features = ["dev", "vara-native"] } diff --git a/node/service/src/chain_spec/vara.rs b/node/service/src/chain_spec/vara.rs index 95bb0eb244f..3245ae1aef5 100644 --- a/node/service/src/chain_spec/vara.rs +++ b/node/service/src/chain_spec/vara.rs @@ -27,11 +27,13 @@ use sp_consensus_babe::AuthorityId as BabeId; use sp_consensus_grandpa::AuthorityId as GrandpaId; use sp_core::{crypto::UncheckedInto, sr25519}; use sp_runtime::{Perbill, Perquintill}; +#[cfg(feature = "dev")] +use vara_runtime::SudoConfig; use vara_runtime::{ constants::currency::{ECONOMIC_UNITS, EXISTENTIAL_DEPOSIT, UNITS as TOKEN}, AuthorityDiscoveryConfig, BabeConfig, BalancesConfig, GenesisConfig, GrandpaConfig, ImOnlineConfig, NominationPoolsConfig, SessionConfig, SessionKeys, StakerStatus, StakingConfig, - StakingRewardsConfig, SudoConfig, SystemConfig, VestingConfig, WASM_BINARY, + StakingRewardsConfig, SystemConfig, VestingConfig, WASM_BINARY, }; /// Specialized `ChainSpec`. This is a specialization of the general Substrate ChainSpec type. @@ -558,6 +560,9 @@ fn testnet_genesis( bank_account: AccountId, _enable_println: bool, ) -> GenesisConfig { + #[cfg(not(feature = "dev"))] + let _ = root_key; + const ENDOWMENT: u128 = 1_000_000 * TOKEN; const STASH: u128 = 100 * TOKEN; const MIN_NOMINATOR_BOND: u128 = 50 * TOKEN; @@ -609,6 +614,7 @@ fn testnet_genesis( min_nominator_bond: MIN_NOMINATOR_BOND, ..Default::default() }, + #[cfg(feature = "dev")] sudo: SudoConfig { // Assign network admin rights. key: Some(root_key), diff --git a/node/testing/Cargo.toml b/node/testing/Cargo.toml index 8607639dc26..6706a388f32 100644 --- a/node/testing/Cargo.toml +++ b/node/testing/Cargo.toml @@ -25,6 +25,7 @@ pallet-gear-rpc-runtime-api.workspace = true gear-runtime = { workspace = true, optional = true } vara-runtime = { workspace = true, optional = true } gear-runtime-interface.workspace = true +service = { workspace = true, features = ["dev"] } # Substrate Client sc-block-builder.workspace = true @@ -72,5 +73,5 @@ std = [ "gear-runtime?/std", "vara-runtime?/std", ] -gear-native = ["gear-runtime/dev"] -vara-native = ["vara-runtime/dev"] +gear-native = ["gear-runtime/dev", "service/gear-native"] +vara-native = ["vara-runtime/dev", "service/vara-native"] diff --git a/runtime/vara/Cargo.toml b/runtime/vara/Cargo.toml index 74551fefa6d..f179c2bd346 100644 --- a/runtime/vara/Cargo.toml +++ b/runtime/vara/Cargo.toml @@ -49,7 +49,7 @@ pallet-referenda.workspace = true pallet-scheduler.workspace = true pallet-session = { workspace = true, features = [ "historical" ] } pallet-staking.workspace = true -pallet-sudo.workspace = true +pallet-sudo = { workspace = true, optional = true } pallet-timestamp.workspace = true pallet-transaction-payment.workspace = true pallet-treasury.workspace = true @@ -157,7 +157,7 @@ std = [ "pallet-session/std", "pallet-scheduler/std", "pallet-staking/std", - "pallet-sudo/std", + "pallet-sudo?/std", "pallet-timestamp/std", "pallet-transaction-payment/std", "pallet-transaction-payment-rpc-runtime-api/std", @@ -245,7 +245,7 @@ try-runtime = [ "pallet-scheduler/try-runtime", "pallet-session/try-runtime", "pallet-staking/try-runtime", - "pallet-sudo/try-runtime", + "pallet-sudo?/try-runtime", "pallet-timestamp/try-runtime", "pallet-transaction-payment/try-runtime", "pallet-treasury/try-runtime", @@ -255,7 +255,11 @@ try-runtime = [ "pallet-bags-list/try-runtime", "runtime-common/try-runtime", ] -dev = ["pallet-gear-debug", "pallet-gear-program/dev"] +dev = [ + "pallet-gear-debug", + "pallet-gear-program/dev", + "pallet-sudo", +] lazy-pages = [ "pallet-gear/lazy-pages", "pallet-gear-payment/lazy-pages", diff --git a/runtime/vara/src/lib.rs b/runtime/vara/src/lib.rs index 7b9f86b4447..fee12da3048 100644 --- a/runtime/vara/src/lib.rs +++ b/runtime/vara/src/lib.rs @@ -98,7 +98,7 @@ pub use frame_system::Call as SystemCall; pub use pallet_balances::Call as BalancesCall; #[cfg(any(feature = "std", test))] pub use pallet_staking::StakerStatus; -#[cfg(any(feature = "std", test))] +#[cfg(all(feature = "dev", any(feature = "std", test)))] pub use pallet_sudo::Call as SudoCall; #[cfg(any(feature = "std", test))] pub use sp_runtime::BuildStorage; @@ -798,6 +798,7 @@ impl pallet_identity::Config for Runtime { type WeightInfo = pallet_identity::weights::SubstrateWeight; } +#[cfg(feature = "dev")] impl pallet_sudo::Config for Runtime { type RuntimeEvent = RuntimeEvent; type RuntimeCall = RuntimeCall; @@ -869,13 +870,23 @@ impl InstanceFilter for ProxyType { fn filter(&self, c: &RuntimeCall) -> bool { match self { ProxyType::Any => true, - ProxyType::NonTransfer => !matches!( - c, - RuntimeCall::Balances(..) - | RuntimeCall::Sudo(..) - | RuntimeCall::Vesting(pallet_vesting::Call::vested_transfer { .. }) - | RuntimeCall::Vesting(pallet_vesting::Call::force_vested_transfer { .. }) - ), + ProxyType::NonTransfer => { + #[cfg(feature = "dev")] + return !matches!( + c, + RuntimeCall::Balances(..) + | RuntimeCall::Sudo(..) + | RuntimeCall::Vesting(pallet_vesting::Call::vested_transfer { .. }) + | RuntimeCall::Vesting(pallet_vesting::Call::force_vested_transfer { .. }) + ); + #[cfg(not(feature = "dev"))] + return !matches!( + c, + RuntimeCall::Balances(..) + | RuntimeCall::Vesting(pallet_vesting::Call::vested_transfer { .. }) + | RuntimeCall::Vesting(pallet_vesting::Call::force_vested_transfer { .. }) + ); + } ProxyType::Governance => matches!( c, RuntimeCall::Treasury(..) @@ -1158,7 +1169,6 @@ construct_runtime!( GearVoucher: pallet_gear_voucher = 107, GearBank: pallet_gear_bank = 108, - // TODO: Remove in stage 3 Sudo: pallet_sudo = 99, // NOTE (!): `pallet_airdrop` used to be idx(198). @@ -1222,9 +1232,7 @@ construct_runtime!( GearVoucher: pallet_gear_voucher = 107, GearBank: pallet_gear_bank = 108, - // TODO: Remove in stage 3 - Sudo: pallet_sudo = 99, - + // NOTE (!): `pallet_sudo` used to be idx(99). // NOTE (!): `pallet_airdrop` used to be idx(198). } ); diff --git a/scripts/benchmarking/run_all_benchmarks.sh b/scripts/benchmarking/run_all_benchmarks.sh index 87c957ca3f4..caa838da4f2 100755 --- a/scripts/benchmarking/run_all_benchmarks.sh +++ b/scripts/benchmarking/run_all_benchmarks.sh @@ -58,7 +58,7 @@ done if [ "$skip_build" != true ] then echo "[+] Compiling Gear benchmarks..." - cargo build --profile=production --locked --features=runtime-benchmarks + cargo build --profile=production --locked --features=dev,runtime-benchmarks fi # The executable to use. From 604d713569fb817982da88706e5d00c23c67bb86 Mon Sep 17 00:00:00 2001 From: clearloop <26088946+clearloop@users.noreply.github.com> Date: Sat, 16 Sep 2023 11:33:27 +0800 Subject: [PATCH 7/7] chore(scripts): sync doc test command with the help message (#3223) --- .github/workflows/check.yml | 2 +- Makefile | 2 +- scripts/gear.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index c69b1afdf27..5d0588a862e 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -43,7 +43,7 @@ jobs: run: ./scripts/gear.sh clippy examples --all-targets --locked - name: "Test: Doc tests" - run: ./scripts/gear.sh test doc + run: ./scripts/gear.sh test docs - name: "Test: Changes in gsdk generated code" run: | diff --git a/Makefile b/Makefile index 347a011742a..23d3f966ed4 100644 --- a/Makefile +++ b/Makefile @@ -191,7 +191,7 @@ test-release: test-gear-release .PHONY: test-doc test-doc: - @ ./scripts/gear.sh test doc + @ ./scripts/gear.sh test docs .PHONY: test-gear test-gear: #\ diff --git a/scripts/gear.sh b/scripts/gear.sh index e74c01c7145..05161f5c741 100755 --- a/scripts/gear.sh +++ b/scripts/gear.sh @@ -309,7 +309,7 @@ case "$COMMAND" in header "Running syscalls integrity test of pallet-gear 'benchmarking' module on WASMI executor" syscalls_integrity_test "$@"; ;; - doc) + docs) header "Testing examples in docs" doc_test "$ROOT_DIR/Cargo.toml" "$@"; ;;