From caa30ea9be03528017488bd5b02974182e26a1da Mon Sep 17 00:00:00 2001 From: Kian Paimani <5588131+kianenigma@users.noreply.github.com> Date: Sun, 22 Oct 2023 13:17:32 +0100 Subject: [PATCH 01/21] Create docs --- .github/workflows/docs | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/workflows/docs diff --git a/.github/workflows/docs b/.github/workflows/docs new file mode 100644 index 000000000000..514e5d4c5e3e --- /dev/null +++ b/.github/workflows/docs @@ -0,0 +1,30 @@ +name: Rust Docs + +on: + push: + branches: [kiz-umbrella-crates] + +jobs: + docs: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Setup Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + components: rust-docs + target: wasm32-unknown-unknown + + - name: Generate docs + run: cargo doc developer-hub + + - name: Deploy + uses: JamesIves/github-pages-deploy-action@v4 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + BRANCH: gh-pages # The branch the action should deploy to. + FOLDER: target/doc # The folder the action should deploy. From 3acf463707d3ea3fe38cb34d7b191582c76b62d0 Mon Sep 17 00:00:00 2001 From: Kian Paimani <5588131+kianenigma@users.noreply.github.com> Date: Sun, 22 Oct 2023 13:17:47 +0100 Subject: [PATCH 02/21] Rename docs to docs.yml --- .github/workflows/{docs => docs.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{docs => docs.yml} (100%) diff --git a/.github/workflows/docs b/.github/workflows/docs.yml similarity index 100% rename from .github/workflows/docs rename to .github/workflows/docs.yml From dcf4cb15fd7b0274bf3c082830173375dcb17b7d Mon Sep 17 00:00:00 2001 From: Kian Paimani <5588131+kianenigma@users.noreply.github.com> Date: Sun, 22 Oct 2023 13:24:47 +0100 Subject: [PATCH 03/21] Update docs.yml --- .github/workflows/docs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 514e5d4c5e3e..78f3e3d52bb4 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -20,7 +20,7 @@ jobs: target: wasm32-unknown-unknown - name: Generate docs - run: cargo doc developer-hub + run: cargo doc -p developer-hub - name: Deploy uses: JamesIves/github-pages-deploy-action@v4 From de9613aed265977aabe493ddb64182de12b4d3a3 Mon Sep 17 00:00:00 2001 From: kianenigma Date: Fri, 23 Feb 2024 11:27:10 +0000 Subject: [PATCH 04/21] repot templates into one folder --- Cargo.lock | 300 +++++------------- Cargo.toml | 20 +- substrate/bin/minimal/node/Cargo.toml | 60 ---- substrate/bin/node-template/.editorconfig | 16 - substrate/bin/node-template/env-setup/.envrc | 1 - substrate/bin/node-template/node/Cargo.toml | 92 ------ .../bin/node-template/runtime/Cargo.toml | 125 -------- templates/minimal/README.md | 0 templates/minimal/node/Cargo.toml | 65 ++++ .../bin => templates}/minimal/node/build.rs | 0 .../minimal/node/src/chain_spec.rs | 0 .../bin => templates}/minimal/node/src/cli.rs | 0 .../minimal/node/src/command.rs | 0 .../bin => templates}/minimal/node/src/lib.rs | 2 +- .../minimal/node/src/main.rs | 0 .../bin => templates}/minimal/node/src/rpc.rs | 0 .../minimal/node/src/service.rs | 0 .../minimal/runtime/Cargo.toml | 31 +- .../minimal/runtime/build.rs | 0 .../minimal/runtime/src/lib.rs | 6 +- .../parachain}/LICENSE | 0 .../parachain}/README.md | 0 .../parachain}/node/Cargo.toml | 0 .../parachain}/node/build.rs | 0 .../parachain}/node/src/chain_spec.rs | 0 .../parachain}/node/src/cli.rs | 0 .../parachain}/node/src/command.rs | 0 .../parachain}/node/src/main.rs | 0 .../parachain}/node/src/rpc.rs | 0 .../parachain}/node/src/service.rs | 0 .../parachain}/pallets/template/Cargo.toml | 0 .../parachain}/pallets/template/README.md | 0 .../pallets/template/src/benchmarking.rs | 0 .../parachain}/pallets/template/src/lib.rs | 0 .../parachain}/pallets/template/src/mock.rs | 0 .../parachain}/pallets/template/src/tests.rs | 0 .../parachain}/polkadot-launch/config.json | 0 .../parachain}/runtime/Cargo.toml | 0 .../parachain}/runtime/build.rs | 0 .../parachain}/runtime/src/lib.rs | 0 .../runtime/src/weights/block_weights.rs | 0 .../runtime/src/weights/extrinsic_weights.rs | 0 .../parachain}/runtime/src/weights/mod.rs | 0 .../runtime/src/weights/paritydb_weights.rs | 0 .../runtime/src/weights/rocksdb_weights.rs | 0 .../parachain}/runtime/src/xcm_config.rs | 0 .../solo-chain}/LICENSE | 0 .../solo-chain}/README.md | 0 .../solo-chain}/docs/rust-setup.md | 0 .../solo-chain}/env-setup/README.md | 0 .../solo-chain}/env-setup/flake.lock | 0 .../solo-chain}/env-setup/flake.nix | 0 .../solo-chain}/env-setup/rust-toolchain.toml | 0 templates/solo-chain/node/Cargo.toml | 92 ++++++ .../solo-chain}/node/build.rs | 0 .../solo-chain}/node/src/benchmarking.rs | 2 +- .../solo-chain}/node/src/chain_spec.rs | 2 +- .../solo-chain}/node/src/cli.rs | 0 .../solo-chain}/node/src/command.rs | 2 +- .../solo-chain}/node/src/main.rs | 0 .../solo-chain}/node/src/rpc.rs | 2 +- .../solo-chain}/node/src/service.rs | 2 +- .../solo-chain}/pallets/template/Cargo.toml | 26 +- .../solo-chain}/pallets/template/README.md | 0 .../pallets/template/src/benchmarking.rs | 0 .../solo-chain}/pallets/template/src/lib.rs | 0 .../solo-chain}/pallets/template/src/mock.rs | 0 .../solo-chain}/pallets/template/src/tests.rs | 0 .../pallets/template/src/weights.rs | 0 templates/solo-chain/runtime/Cargo.toml | 151 +++++++++ .../solo-chain}/runtime/build.rs | 0 .../solo-chain}/runtime/src/lib.rs | 7 +- 72 files changed, 445 insertions(+), 559 deletions(-) delete mode 100644 substrate/bin/minimal/node/Cargo.toml delete mode 100644 substrate/bin/node-template/.editorconfig delete mode 100644 substrate/bin/node-template/env-setup/.envrc delete mode 100644 substrate/bin/node-template/node/Cargo.toml delete mode 100644 substrate/bin/node-template/runtime/Cargo.toml create mode 100644 templates/minimal/README.md create mode 100644 templates/minimal/node/Cargo.toml rename {substrate/bin => templates}/minimal/node/build.rs (100%) rename {substrate/bin => templates}/minimal/node/src/chain_spec.rs (100%) rename {substrate/bin => templates}/minimal/node/src/cli.rs (100%) rename {substrate/bin => templates}/minimal/node/src/command.rs (100%) rename {substrate/bin => templates}/minimal/node/src/lib.rs (94%) rename {substrate/bin => templates}/minimal/node/src/main.rs (100%) rename {substrate/bin => templates}/minimal/node/src/rpc.rs (100%) rename {substrate/bin => templates}/minimal/node/src/service.rs (100%) rename {substrate/bin => templates}/minimal/runtime/Cargo.toml (51%) rename {substrate/bin => templates}/minimal/runtime/build.rs (100%) rename {substrate/bin => templates}/minimal/runtime/src/lib.rs (98%) rename {cumulus/parachain-template => templates/parachain}/LICENSE (100%) rename {cumulus/parachain-template => templates/parachain}/README.md (100%) rename {cumulus/parachain-template => templates/parachain}/node/Cargo.toml (100%) rename {cumulus/parachain-template => templates/parachain}/node/build.rs (100%) rename {cumulus/parachain-template => templates/parachain}/node/src/chain_spec.rs (100%) rename {cumulus/parachain-template => templates/parachain}/node/src/cli.rs (100%) rename {cumulus/parachain-template => templates/parachain}/node/src/command.rs (100%) rename {cumulus/parachain-template => templates/parachain}/node/src/main.rs (100%) rename {cumulus/parachain-template => templates/parachain}/node/src/rpc.rs (100%) rename {cumulus/parachain-template => templates/parachain}/node/src/service.rs (100%) rename {cumulus/parachain-template => templates/parachain}/pallets/template/Cargo.toml (100%) rename {cumulus/parachain-template => templates/parachain}/pallets/template/README.md (100%) rename {cumulus/parachain-template => templates/parachain}/pallets/template/src/benchmarking.rs (100%) rename {cumulus/parachain-template => templates/parachain}/pallets/template/src/lib.rs (100%) rename {cumulus/parachain-template => templates/parachain}/pallets/template/src/mock.rs (100%) rename {cumulus/parachain-template => templates/parachain}/pallets/template/src/tests.rs (100%) rename {cumulus/parachain-template => templates/parachain}/polkadot-launch/config.json (100%) rename {cumulus/parachain-template => templates/parachain}/runtime/Cargo.toml (100%) rename {cumulus/parachain-template => templates/parachain}/runtime/build.rs (100%) rename {cumulus/parachain-template => templates/parachain}/runtime/src/lib.rs (100%) rename {cumulus/parachain-template => templates/parachain}/runtime/src/weights/block_weights.rs (100%) rename {cumulus/parachain-template => templates/parachain}/runtime/src/weights/extrinsic_weights.rs (100%) rename {cumulus/parachain-template => templates/parachain}/runtime/src/weights/mod.rs (100%) rename {cumulus/parachain-template => templates/parachain}/runtime/src/weights/paritydb_weights.rs (100%) rename {cumulus/parachain-template => templates/parachain}/runtime/src/weights/rocksdb_weights.rs (100%) rename {cumulus/parachain-template => templates/parachain}/runtime/src/xcm_config.rs (100%) rename {substrate/bin/node-template => templates/solo-chain}/LICENSE (100%) rename {substrate/bin/node-template => templates/solo-chain}/README.md (100%) rename {substrate/bin/node-template => templates/solo-chain}/docs/rust-setup.md (100%) rename {substrate/bin/node-template => templates/solo-chain}/env-setup/README.md (100%) rename {substrate/bin/node-template => templates/solo-chain}/env-setup/flake.lock (100%) rename {substrate/bin/node-template => templates/solo-chain}/env-setup/flake.nix (100%) rename {substrate/bin/node-template => templates/solo-chain}/env-setup/rust-toolchain.toml (100%) create mode 100644 templates/solo-chain/node/Cargo.toml rename {substrate/bin/node-template => templates/solo-chain}/node/build.rs (100%) rename {substrate/bin/node-template => templates/solo-chain}/node/src/benchmarking.rs (99%) rename {substrate/bin/node-template => templates/solo-chain}/node/src/chain_spec.rs (97%) rename {substrate/bin/node-template => templates/solo-chain}/node/src/cli.rs (100%) rename {substrate/bin/node-template => templates/solo-chain}/node/src/command.rs (99%) rename {substrate/bin/node-template => templates/solo-chain}/node/src/main.rs (100%) rename {substrate/bin/node-template => templates/solo-chain}/node/src/rpc.rs (97%) rename {substrate/bin/node-template => templates/solo-chain}/node/src/service.rs (99%) rename {substrate/bin/node-template => templates/solo-chain}/pallets/template/Cargo.toml (57%) rename {substrate/bin/node-template => templates/solo-chain}/pallets/template/README.md (100%) rename {substrate/bin/node-template => templates/solo-chain}/pallets/template/src/benchmarking.rs (100%) rename {substrate/bin/node-template => templates/solo-chain}/pallets/template/src/lib.rs (100%) rename {substrate/bin/node-template => templates/solo-chain}/pallets/template/src/mock.rs (100%) rename {substrate/bin/node-template => templates/solo-chain}/pallets/template/src/tests.rs (100%) rename {substrate/bin/node-template => templates/solo-chain}/pallets/template/src/weights.rs (100%) create mode 100644 templates/solo-chain/runtime/Cargo.toml rename {substrate/bin/node-template => templates/solo-chain}/runtime/build.rs (100%) rename {substrate/bin/node-template => templates/solo-chain}/runtime/src/lib.rs (98%) diff --git a/Cargo.lock b/Cargo.lock index c26c4081bbd9..8e36702bc284 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8104,7 +8104,7 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "minimal-node" -version = "4.0.0-dev" +version = "0.0.0" dependencies = [ "clap 4.5.1", "frame", @@ -8139,10 +8139,9 @@ dependencies = [ [[package]] name = "minimal-runtime" -version = "0.1.0" +version = "0.0.0" dependencies = [ "frame", - "frame-support", "pallet-balances", "pallet-sudo", "pallet-timestamp", @@ -8657,50 +8656,6 @@ dependencies = [ "kitchensink-runtime", ] -[[package]] -name = "node-template" -version = "4.0.0-dev" -dependencies = [ - "clap 4.5.1", - "frame-benchmarking", - "frame-benchmarking-cli", - "frame-system", - "futures", - "jsonrpsee", - "node-template-runtime", - "pallet-transaction-payment", - "pallet-transaction-payment-rpc", - "sc-basic-authorship", - "sc-cli", - "sc-client-api", - "sc-consensus", - "sc-consensus-aura", - "sc-consensus-grandpa", - "sc-executor", - "sc-network", - "sc-offchain", - "sc-rpc-api", - "sc-service", - "sc-telemetry", - "sc-transaction-pool", - "sc-transaction-pool-api", - "serde_json", - "sp-api", - "sp-block-builder", - "sp-blockchain", - "sp-consensus-aura", - "sp-consensus-grandpa", - "sp-core", - "sp-inherents", - "sp-io", - "sp-keyring", - "sp-runtime", - "sp-timestamp", - "substrate-build-script-utils", - "substrate-frame-rpc-system", - "try-runtime-cli", -] - [[package]] name = "node-template-release" version = "3.0.0" @@ -8715,45 +8670,6 @@ dependencies = [ "toml_edit 0.19.15", ] -[[package]] -name = "node-template-runtime" -version = "4.0.0-dev" -dependencies = [ - "frame-benchmarking", - "frame-executive", - "frame-support", - "frame-system", - "frame-system-benchmarking", - "frame-system-rpc-runtime-api", - "frame-try-runtime", - "pallet-aura", - "pallet-balances", - "pallet-grandpa", - "pallet-sudo", - "pallet-template", - "pallet-timestamp", - "pallet-transaction-payment", - "pallet-transaction-payment-rpc-runtime-api", - "parity-scale-codec", - "scale-info", - "serde_json", - "sp-api", - "sp-block-builder", - "sp-consensus-aura", - "sp-consensus-grandpa", - "sp-core", - "sp-genesis-builder", - "sp-inherents", - "sp-offchain", - "sp-runtime", - "sp-session", - "sp-std 14.0.0", - "sp-storage 19.0.0", - "sp-transaction-pool", - "sp-version", - "substrate-wasm-builder", -] - [[package]] name = "node-testing" version = "3.0.0-dev" @@ -10486,21 +10402,6 @@ dependencies = [ "sp-io", ] -[[package]] -name = "pallet-parachain-template" -version = "0.7.0" -dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", - "parity-scale-codec", - "scale-info", - "serde", - "sp-core", - "sp-io", - "sp-runtime", -] - [[package]] name = "pallet-parameters" version = "0.0.1" @@ -10960,7 +10861,6 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0", ] [[package]] @@ -11271,121 +11171,6 @@ dependencies = [ "staging-xcm-builder", ] -[[package]] -name = "parachain-template-node" -version = "0.1.0" -dependencies = [ - "clap 4.5.1", - "color-print", - "cumulus-client-cli", - "cumulus-client-collator", - "cumulus-client-consensus-aura", - "cumulus-client-consensus-common", - "cumulus-client-consensus-proposer", - "cumulus-client-service", - "cumulus-primitives-core", - "cumulus-primitives-parachain-inherent", - "cumulus-relay-chain-interface", - "frame-benchmarking", - "frame-benchmarking-cli", - "futures", - "jsonrpsee", - "log", - "pallet-transaction-payment-rpc", - "parachain-template-runtime", - "parity-scale-codec", - "polkadot-cli", - "polkadot-primitives", - "sc-basic-authorship", - "sc-chain-spec", - "sc-cli", - "sc-client-api", - "sc-consensus", - "sc-executor", - "sc-network", - "sc-network-sync", - "sc-offchain", - "sc-rpc", - "sc-service", - "sc-sysinfo", - "sc-telemetry", - "sc-tracing", - "sc-transaction-pool", - "sc-transaction-pool-api", - "serde", - "serde_json", - "sp-api", - "sp-block-builder", - "sp-blockchain", - "sp-consensus-aura", - "sp-core", - "sp-io", - "sp-keystore", - "sp-runtime", - "sp-timestamp", - "staging-xcm", - "substrate-build-script-utils", - "substrate-frame-rpc-system", - "substrate-prometheus-endpoint", -] - -[[package]] -name = "parachain-template-runtime" -version = "0.7.0" -dependencies = [ - "cumulus-pallet-aura-ext", - "cumulus-pallet-parachain-system", - "cumulus-pallet-session-benchmarking", - "cumulus-pallet-xcm", - "cumulus-pallet-xcmp-queue", - "cumulus-primitives-core", - "cumulus-primitives-utility", - "frame-benchmarking", - "frame-executive", - "frame-support", - "frame-system", - "frame-system-benchmarking", - "frame-system-rpc-runtime-api", - "frame-try-runtime", - "hex-literal", - "log", - "pallet-aura", - "pallet-authorship", - "pallet-balances", - "pallet-collator-selection", - "pallet-message-queue", - "pallet-parachain-template", - "pallet-session", - "pallet-sudo", - "pallet-timestamp", - "pallet-transaction-payment", - "pallet-transaction-payment-rpc-runtime-api", - "pallet-xcm", - "parachains-common", - "parity-scale-codec", - "polkadot-parachain-primitives", - "polkadot-runtime-common", - "scale-info", - "smallvec", - "sp-api", - "sp-block-builder", - "sp-consensus-aura", - "sp-core", - "sp-genesis-builder", - "sp-inherents", - "sp-offchain", - "sp-runtime", - "sp-session", - "sp-std 14.0.0", - "sp-transaction-pool", - "sp-version", - "staging-parachain-info", - "staging-xcm", - "staging-xcm-builder", - "staging-xcm-executor", - "substrate-wasm-builder", -] - [[package]] name = "parachains-common" version = "7.0.0" @@ -18177,6 +17962,87 @@ dependencies = [ "sha-1 0.9.8", ] +[[package]] +name = "solo-chain-node" +version = "4.0.0-dev" +dependencies = [ + "clap 4.5.1", + "frame-benchmarking-cli", + "frame-system", + "futures", + "jsonrpsee", + "pallet-transaction-payment", + "pallet-transaction-payment-rpc", + "sc-basic-authorship", + "sc-cli", + "sc-client-api", + "sc-consensus", + "sc-consensus-aura", + "sc-consensus-grandpa", + "sc-executor", + "sc-network", + "sc-offchain", + "sc-rpc-api", + "sc-service", + "sc-telemetry", + "sc-transaction-pool", + "sc-transaction-pool-api", + "serde_json", + "solo-chain-runtime", + "sp-api", + "sp-block-builder", + "sp-blockchain", + "sp-consensus-aura", + "sp-consensus-grandpa", + "sp-core", + "sp-inherents", + "sp-io", + "sp-keyring", + "sp-runtime", + "sp-timestamp", + "substrate-build-script-utils", + "substrate-frame-rpc-system", + "try-runtime-cli", +] + +[[package]] +name = "solo-chain-runtime" +version = "0.0.0" +dependencies = [ + "frame-benchmarking", + "frame-executive", + "frame-support", + "frame-system", + "frame-system-benchmarking", + "frame-system-rpc-runtime-api", + "frame-try-runtime", + "pallet-aura", + "pallet-balances", + "pallet-grandpa", + "pallet-sudo", + "pallet-template", + "pallet-timestamp", + "pallet-transaction-payment", + "pallet-transaction-payment-rpc-runtime-api", + "parity-scale-codec", + "scale-info", + "sp-api", + "sp-block-builder", + "sp-consensus-aura", + "sp-consensus-grandpa", + "sp-core", + "sp-genesis-builder", + "sp-inherents", + "sp-offchain", + "sp-runtime", + "sp-session", + "sp-std 14.0.0", + "sp-storage 19.0.0", + "sp-transaction-pool", + "sp-version", + "substrate-wasm-builder", +] + [[package]] name = "sp-api" version = "26.0.0" diff --git a/Cargo.toml b/Cargo.toml index d09f19f280cb..b945230fa4db 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,6 +3,7 @@ authors = ["Parity Technologies "] edition = "2021" repository = "https://github.com/paritytech/polkadot-sdk.git" license = "GPL-3.0-only" +homepage = "https://paritytech.github.io/polkadot-sdk/master/polkadot_sdk_docs/index.html" [workspace] resolver = "2" @@ -74,9 +75,6 @@ members = [ "cumulus/pallets/solo-to-para", "cumulus/pallets/xcm", "cumulus/pallets/xcmp-queue", - "cumulus/parachain-template/node", - "cumulus/parachain-template/pallets/template", - "cumulus/parachain-template/runtime", "cumulus/parachains/common", "cumulus/parachains/integration-tests/emulated/chains/parachains/assets/asset-hub-rococo", "cumulus/parachains/integration-tests/emulated/chains/parachains/assets/asset-hub-westend", @@ -218,11 +216,6 @@ members = [ "polkadot/xcm/xcm-simulator", "polkadot/xcm/xcm-simulator/example", "polkadot/xcm/xcm-simulator/fuzzer", - "substrate/bin/minimal/node", - "substrate/bin/minimal/runtime", - "substrate/bin/node-template/node", - "substrate/bin/node-template/pallets/template", - "substrate/bin/node-template/runtime", "substrate/bin/node/bench", "substrate/bin/node/cli", "substrate/bin/node/inspect", @@ -501,6 +494,17 @@ members = [ "substrate/utils/frame/try-runtime/cli", "substrate/utils/prometheus", "substrate/utils/wasm-builder", + + "templates/minimal/node", + "templates/minimal/runtime", + + "templates/solo-chain/node", + "templates/solo-chain/pallets/template", + "templates/solo-chain/runtime", + + # "templates/parachain/node", + # "templates/parachain/pallets/template", + # "templates/parachain/runtime", ] default-members = ["polkadot", "substrate/bin/node/cli"] diff --git a/substrate/bin/minimal/node/Cargo.toml b/substrate/bin/minimal/node/Cargo.toml deleted file mode 100644 index 02b3b0a735bf..000000000000 --- a/substrate/bin/minimal/node/Cargo.toml +++ /dev/null @@ -1,60 +0,0 @@ -[package] -name = "minimal-node" -version = "4.0.0-dev" -description = "A fresh FRAME-based Substrate node, ready for hacking." -authors = ["Substrate DevHub "] -homepage = "https://substrate.io/" -edition = "2021" -license = "MIT-0" -publish = false -repository = "https://github.com/substrate-developer-hub/substrate-node-template/" -build = "build.rs" - -[lints] -workspace = true - -[package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu"] - -[[bin]] -name = "minimal-node" - -[dependencies] -clap = { version = "4.5.1", features = ["derive"] } -futures = { version = "0.3.21", features = ["thread-pool"] } -futures-timer = "3.0.1" -jsonrpsee = { version = "0.22", features = ["server"] } -serde_json = "1.0.113" - -sc-cli = { path = "../../../client/cli" } -sc-executor = { path = "../../../client/executor" } -sc-network = { path = "../../../client/network" } -sc-service = { path = "../../../client/service" } -sc-telemetry = { path = "../../../client/telemetry" } -sc-transaction-pool = { path = "../../../client/transaction-pool" } -sc-transaction-pool-api = { path = "../../../client/transaction-pool/api" } -sc-consensus = { path = "../../../client/consensus/common" } -sc-consensus-manual-seal = { path = "../../../client/consensus/manual-seal" } -sc-rpc-api = { path = "../../../client/rpc-api" } -sc-basic-authorship = { path = "../../../client/basic-authorship" } -sc-offchain = { path = "../../../client/offchain" } -sc-client-api = { path = "../../../client/api" } - -sp-timestamp = { path = "../../../primitives/timestamp" } -sp-keyring = { path = "../../../primitives/keyring" } -sp-api = { path = "../../../primitives/api" } -sp-blockchain = { path = "../../../primitives/blockchain" } -sp-block-builder = { path = "../../../primitives/block-builder" } -sp-io = { path = "../../../primitives/io" } -sp-runtime = { path = "../../../primitives/runtime" } - -substrate-frame-rpc-system = { path = "../../../utils/frame/rpc/system" } - -frame = { path = "../../../frame", features = ["experimental", "runtime"] } -runtime = { package = "minimal-runtime", path = "../runtime" } - -[build-dependencies] -substrate-build-script-utils = { path = "../../../utils/build-script-utils" } - -[features] -default = [] diff --git a/substrate/bin/node-template/.editorconfig b/substrate/bin/node-template/.editorconfig deleted file mode 100644 index 5adac74ca24b..000000000000 --- a/substrate/bin/node-template/.editorconfig +++ /dev/null @@ -1,16 +0,0 @@ -root = true - -[*] -indent_style=space -indent_size=2 -tab_width=2 -end_of_line=lf -charset=utf-8 -trim_trailing_whitespace=true -insert_final_newline = true - -[*.{rs,toml}] -indent_style=tab -indent_size=tab -tab_width=4 -max_line_length=100 diff --git a/substrate/bin/node-template/env-setup/.envrc b/substrate/bin/node-template/env-setup/.envrc deleted file mode 100644 index 3550a30f2de3..000000000000 --- a/substrate/bin/node-template/env-setup/.envrc +++ /dev/null @@ -1 +0,0 @@ -use flake diff --git a/substrate/bin/node-template/node/Cargo.toml b/substrate/bin/node-template/node/Cargo.toml deleted file mode 100644 index 7a6955d2cec3..000000000000 --- a/substrate/bin/node-template/node/Cargo.toml +++ /dev/null @@ -1,92 +0,0 @@ -[package] -name = "node-template" -version = "4.0.0-dev" -description = "A fresh FRAME-based Substrate node, ready for hacking." -authors = ["Substrate DevHub "] -homepage = "https://substrate.io/" -edition.workspace = true -license = "MIT-0" -publish = false -repository = "https://github.com/substrate-developer-hub/substrate-node-template/" -build = "build.rs" - -[lints] -workspace = true - -[package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu"] - -[[bin]] -name = "node-template" - -[dependencies] -clap = { version = "4.5.1", features = ["derive"] } -futures = { version = "0.3.21", features = ["thread-pool"] } -serde_json = "1.0.113" - -sc-cli = { path = "../../../client/cli" } -sp-core = { path = "../../../primitives/core" } -sc-executor = { path = "../../../client/executor" } -sc-network = { path = "../../../client/network" } -sc-service = { path = "../../../client/service" } -sc-telemetry = { path = "../../../client/telemetry" } -sc-transaction-pool = { path = "../../../client/transaction-pool" } -sc-transaction-pool-api = { path = "../../../client/transaction-pool/api" } -sc-offchain = { path = "../../../client/offchain" } -sc-consensus-aura = { path = "../../../client/consensus/aura" } -sp-consensus-aura = { path = "../../../primitives/consensus/aura" } -sc-consensus = { path = "../../../client/consensus/common" } -sc-consensus-grandpa = { path = "../../../client/consensus/grandpa" } -sp-consensus-grandpa = { path = "../../../primitives/consensus/grandpa" } -sc-client-api = { path = "../../../client/api" } -sp-runtime = { path = "../../../primitives/runtime" } -sp-io = { path = "../../../primitives/io" } -sp-timestamp = { path = "../../../primitives/timestamp" } -sp-inherents = { path = "../../../primitives/inherents" } -sp-keyring = { path = "../../../primitives/keyring" } -frame-system = { path = "../../../frame/system" } -pallet-transaction-payment = { path = "../../../frame/transaction-payment", default-features = false } - -# These dependencies are used for the node template's RPCs -jsonrpsee = { version = "0.22", features = ["server"] } -sp-api = { path = "../../../primitives/api" } -sc-rpc-api = { path = "../../../client/rpc-api" } -sp-blockchain = { path = "../../../primitives/blockchain" } -sp-block-builder = { path = "../../../primitives/block-builder" } -sc-basic-authorship = { path = "../../../client/basic-authorship" } -substrate-frame-rpc-system = { path = "../../../utils/frame/rpc/system" } -pallet-transaction-payment-rpc = { path = "../../../frame/transaction-payment/rpc" } - -# These dependencies are used for runtime benchmarking -frame-benchmarking = { path = "../../../frame/benchmarking" } -frame-benchmarking-cli = { path = "../../../utils/frame/benchmarking-cli" } - -# Local Dependencies -node-template-runtime = { path = "../runtime" } - -# CLI-specific dependencies -try-runtime-cli = { path = "../../../utils/frame/try-runtime/cli", optional = true } - -[build-dependencies] -substrate-build-script-utils = { path = "../../../utils/build-script-utils" } - -[features] -default = [] -# Dependencies that are only required if runtime benchmarking should be build. -runtime-benchmarks = [ - "frame-benchmarking-cli/runtime-benchmarks", - "frame-benchmarking/runtime-benchmarks", - "frame-system/runtime-benchmarks", - "node-template-runtime/runtime-benchmarks", - "sc-service/runtime-benchmarks", - "sp-runtime/runtime-benchmarks", -] -# Enable features that allow the runtime to be tried and debugged. Name might be subject to change -# in the near future. -try-runtime = [ - "frame-system/try-runtime", - "node-template-runtime/try-runtime", - "pallet-transaction-payment/try-runtime", - "sp-runtime/try-runtime", - "try-runtime-cli/try-runtime", -] diff --git a/substrate/bin/node-template/runtime/Cargo.toml b/substrate/bin/node-template/runtime/Cargo.toml deleted file mode 100644 index 95d92e6eadf0..000000000000 --- a/substrate/bin/node-template/runtime/Cargo.toml +++ /dev/null @@ -1,125 +0,0 @@ -[package] -name = "node-template-runtime" -version = "4.0.0-dev" -description = "A fresh FRAME-based Substrate node, ready for hacking." -authors = ["Substrate DevHub "] -homepage = "https://substrate.io/" -edition.workspace = true -license = "MIT-0" -publish = false -repository = "https://github.com/substrate-developer-hub/substrate-node-template/" - -[lints] -workspace = true - -[package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu"] - -[dependencies] -codec = { package = "parity-scale-codec", version = "3.6.1", default-features = false, features = ["derive"] } -scale-info = { version = "2.10.0", default-features = false, features = ["derive", "serde"] } - -pallet-aura = { path = "../../../frame/aura", default-features = false } -pallet-balances = { path = "../../../frame/balances", default-features = false } -frame-support = { path = "../../../frame/support", default-features = false } -pallet-grandpa = { path = "../../../frame/grandpa", default-features = false } -pallet-sudo = { path = "../../../frame/sudo", default-features = false } -frame-system = { path = "../../../frame/system", default-features = false } -frame-try-runtime = { path = "../../../frame/try-runtime", default-features = false, optional = true } -pallet-timestamp = { path = "../../../frame/timestamp", default-features = false } -pallet-transaction-payment = { path = "../../../frame/transaction-payment", default-features = false } -frame-executive = { path = "../../../frame/executive", default-features = false } -sp-api = { path = "../../../primitives/api", default-features = false } -sp-block-builder = { path = "../../../primitives/block-builder", default-features = false } -sp-consensus-aura = { path = "../../../primitives/consensus/aura", default-features = false, features = ["serde"] } -sp-consensus-grandpa = { path = "../../../primitives/consensus/grandpa", default-features = false, features = ["serde"] } -sp-core = { path = "../../../primitives/core", default-features = false, features = ["serde"] } -sp-inherents = { path = "../../../primitives/inherents", default-features = false } -sp-offchain = { path = "../../../primitives/offchain", default-features = false } -sp-runtime = { path = "../../../primitives/runtime", default-features = false, features = ["serde"] } -sp-session = { path = "../../../primitives/session", default-features = false } -sp-std = { path = "../../../primitives/std", default-features = false } -sp-storage = { path = "../../../primitives/storage", default-features = false } -sp-transaction-pool = { path = "../../../primitives/transaction-pool", default-features = false } -sp-version = { path = "../../../primitives/version", default-features = false, features = ["serde"] } -serde_json = { version = "1.0.113", default-features = false, features = ["alloc"] } -sp-genesis-builder = { default-features = false, path = "../../../primitives/genesis-builder" } - -# Used for the node template's RPCs -frame-system-rpc-runtime-api = { path = "../../../frame/system/rpc/runtime-api", default-features = false } -pallet-transaction-payment-rpc-runtime-api = { path = "../../../frame/transaction-payment/rpc/runtime-api", default-features = false } - -# Used for runtime benchmarking -frame-benchmarking = { path = "../../../frame/benchmarking", default-features = false, optional = true } -frame-system-benchmarking = { path = "../../../frame/system/benchmarking", default-features = false, optional = true } - -# Local Dependencies -pallet-template = { path = "../pallets/template", default-features = false } - -[build-dependencies] -substrate-wasm-builder = { path = "../../../utils/wasm-builder", optional = true } - -[features] -default = ["std"] -std = [ - "codec/std", - "frame-benchmarking?/std", - "frame-executive/std", - "frame-support/std", - "frame-system-benchmarking?/std", - "frame-system-rpc-runtime-api/std", - "frame-system/std", - "frame-try-runtime?/std", - "pallet-aura/std", - "pallet-balances/std", - "pallet-grandpa/std", - "pallet-sudo/std", - "pallet-template/std", - "pallet-timestamp/std", - "pallet-transaction-payment-rpc-runtime-api/std", - "pallet-transaction-payment/std", - "scale-info/std", - "serde_json/std", - "sp-api/std", - "sp-block-builder/std", - "sp-consensus-aura/std", - "sp-consensus-grandpa/std", - "sp-core/std", - "sp-genesis-builder/std", - "sp-inherents/std", - "sp-offchain/std", - "sp-runtime/std", - "sp-session/std", - "sp-std/std", - "sp-storage/std", - "sp-transaction-pool/std", - "sp-version/std", - "substrate-wasm-builder", -] -runtime-benchmarks = [ - "frame-benchmarking/runtime-benchmarks", - "frame-support/runtime-benchmarks", - "frame-system-benchmarking/runtime-benchmarks", - "frame-system/runtime-benchmarks", - "pallet-balances/runtime-benchmarks", - "pallet-grandpa/runtime-benchmarks", - "pallet-sudo/runtime-benchmarks", - "pallet-template/runtime-benchmarks", - "pallet-timestamp/runtime-benchmarks", - "sp-runtime/runtime-benchmarks", -] -try-runtime = [ - "frame-executive/try-runtime", - "frame-support/try-runtime", - "frame-system/try-runtime", - "frame-try-runtime/try-runtime", - "pallet-aura/try-runtime", - "pallet-balances/try-runtime", - "pallet-grandpa/try-runtime", - "pallet-sudo/try-runtime", - "pallet-template/try-runtime", - "pallet-timestamp/try-runtime", - "pallet-transaction-payment/try-runtime", - "sp-runtime/try-runtime", -] -experimental = ["pallet-aura/experimental"] diff --git a/templates/minimal/README.md b/templates/minimal/README.md new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/templates/minimal/node/Cargo.toml b/templates/minimal/node/Cargo.toml new file mode 100644 index 000000000000..96e2bca56a34 --- /dev/null +++ b/templates/minimal/node/Cargo.toml @@ -0,0 +1,65 @@ +[package] +name = "minimal-node" +version = "0.0.0" +description = "A miniaml Substrate-based Substrate node, ready for hacking." +authors.workspace = true +homepage.workspace = true +repository.workspace = true +edition.workspace = true +license = "MIT-0" +publish = false +build = "build.rs" + +[lints] +workspace = true + +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] + +[[bin]] +name = "minimal-node" + +[dependencies] +clap = { version = "4.5.1", features = ["derive"] } +futures = { version = "0.3.21", features = ["thread-pool"] } +futures-timer = "3.0.1" +jsonrpsee = { version = "0.22", features = ["server"] } +serde_json = "1.0.113" + +sc-cli = { path = "../../../substrate/client/cli" } +sc-executor = { path = "../../../substrate/client/executor" } +sc-network = { path = "../../../substrate/client/network" } +sc-service = { path = "../../../substrate/client/service" } +sc-telemetry = { path = "../../../substrate/client/telemetry" } +sc-transaction-pool = { path = "../../../substrate/client/transaction-pool" } +sc-transaction-pool-api = { path = "../../../substrate/client/transaction-pool/api" } +sc-consensus = { path = "../../../substrate/client/consensus/common" } +sc-consensus-manual-seal = { path = "../../../substrate/client/consensus/manual-seal" } +sc-rpc-api = { path = "../../../substrate/client/rpc-api" } +sc-basic-authorship = { path = "../../../substrate/client/basic-authorship" } +sc-offchain = { path = "../../../substrate/client/offchain" } +sc-client-api = { path = "../../../substrate/client/api" } + +sp-timestamp = { path = "../../../substrate/primitives/timestamp" } +sp-keyring = { path = "../../../substrate/primitives/keyring" } +sp-api = { path = "../../../substrate/primitives/api" } +sp-blockchain = { path = "../../../substrate/primitives/blockchain" } +sp-block-builder = { path = "../../../substrate/primitives/block-builder" } +sp-io = { path = "../../../substrate/primitives/io" } +sp-runtime = { path = "../../../substrate/primitives/runtime" } + +substrate-frame-rpc-system = { path = "../../../substrate/utils/frame/rpc/system" } + +# Once the native runtime is gone, there should be little to no dependency on FRAME here, and +# certainly no dependency on the runtime. +frame = { path = "../../../substrate/frame", features = [ + "experimental", + "runtime", +] } +runtime = { package = "minimal-runtime", path = "../runtime" } + +[build-dependencies] +substrate-build-script-utils = { path = "../../../substrate/utils/build-script-utils" } + +[features] +default = [] diff --git a/substrate/bin/minimal/node/build.rs b/templates/minimal/node/build.rs similarity index 100% rename from substrate/bin/minimal/node/build.rs rename to templates/minimal/node/build.rs diff --git a/substrate/bin/minimal/node/src/chain_spec.rs b/templates/minimal/node/src/chain_spec.rs similarity index 100% rename from substrate/bin/minimal/node/src/chain_spec.rs rename to templates/minimal/node/src/chain_spec.rs diff --git a/substrate/bin/minimal/node/src/cli.rs b/templates/minimal/node/src/cli.rs similarity index 100% rename from substrate/bin/minimal/node/src/cli.rs rename to templates/minimal/node/src/cli.rs diff --git a/substrate/bin/minimal/node/src/command.rs b/templates/minimal/node/src/command.rs similarity index 100% rename from substrate/bin/minimal/node/src/command.rs rename to templates/minimal/node/src/command.rs diff --git a/substrate/bin/minimal/node/src/lib.rs b/templates/minimal/node/src/lib.rs similarity index 94% rename from substrate/bin/minimal/node/src/lib.rs rename to templates/minimal/node/src/lib.rs index c2065def736a..cb8ed3bd209d 100644 --- a/substrate/bin/minimal/node/src/lib.rs +++ b/templates/minimal/node/src/lib.rs @@ -1,4 +1,4 @@ -// This file is part of Substrate. +// This file is part of Polkadot Sdk. // Copyright (C) Parity Technologies (UK) Ltd. // SPDX-License-Identifier: Apache-2.0 diff --git a/substrate/bin/minimal/node/src/main.rs b/templates/minimal/node/src/main.rs similarity index 100% rename from substrate/bin/minimal/node/src/main.rs rename to templates/minimal/node/src/main.rs diff --git a/substrate/bin/minimal/node/src/rpc.rs b/templates/minimal/node/src/rpc.rs similarity index 100% rename from substrate/bin/minimal/node/src/rpc.rs rename to templates/minimal/node/src/rpc.rs diff --git a/substrate/bin/minimal/node/src/service.rs b/templates/minimal/node/src/service.rs similarity index 100% rename from substrate/bin/minimal/node/src/service.rs rename to templates/minimal/node/src/service.rs diff --git a/substrate/bin/minimal/runtime/Cargo.toml b/templates/minimal/runtime/Cargo.toml similarity index 51% rename from substrate/bin/minimal/runtime/Cargo.toml rename to templates/minimal/runtime/Cargo.toml index 296106544bbf..e818e87422b6 100644 --- a/substrate/bin/minimal/runtime/Cargo.toml +++ b/templates/minimal/runtime/Cargo.toml @@ -1,11 +1,12 @@ [package] name = "minimal-runtime" -version = "0.1.0" +version = "0.0.0" +description = "A minimal Polkadot Sdk based runtime, built with FRAME" authors.workspace = true -description = "A minimal Substrate example runtime" -edition.workspace = true +homepage.workspace = true repository.workspace = true -license.workspace = true +edition.workspace = true +license = "MIT-0" publish = false [lints] @@ -16,27 +17,27 @@ parity-scale-codec = { version = "3.0.0", default-features = false } scale-info = { version = "2.6.0", default-features = false } # this is a frame-based runtime, thus importing `frame` with runtime feature enabled. -frame = { path = "../../../frame", default-features = false, features = ["experimental", "runtime"] } -frame-support = { path = "../../../frame/support", default-features = false } +frame = { path = "../../../substrate/frame", default-features = false, features = [ + "experimental", + "runtime", +] } # pallets that we want to use -pallet-balances = { path = "../../../frame/balances", default-features = false } -pallet-sudo = { path = "../../../frame/sudo", default-features = false } -pallet-timestamp = { path = "../../../frame/timestamp", default-features = false } -pallet-transaction-payment = { path = "../../../frame/transaction-payment", default-features = false } -pallet-transaction-payment-rpc-runtime-api = { path = "../../../frame/transaction-payment/rpc/runtime-api", default-features = false } +pallet-balances = { path = "../../../substrate/frame/balances", default-features = false } +pallet-sudo = { path = "../../../substrate/frame/sudo", default-features = false } +pallet-timestamp = { path = "../../../substrate/frame/timestamp", default-features = false } +pallet-transaction-payment = { path = "../../../substrate/frame/transaction-payment", default-features = false } +pallet-transaction-payment-rpc-runtime-api = { path = "../../../substrate/frame/transaction-payment/rpc/runtime-api", default-features = false } # genesis builder that allows us to interacto with runtime genesis config -sp-genesis-builder = { path = "../../../primitives/genesis-builder", default-features = false } - +sp-genesis-builder = { path = "../../../substrate/primitives/genesis-builder", default-features = false } [build-dependencies] -substrate-wasm-builder = { path = "../../../utils/wasm-builder", optional = true } +substrate-wasm-builder = { path = "../../../substrate/utils/wasm-builder", optional = true } [features] default = ["std"] std = [ - "frame-support/std", "frame/std", "pallet-balances/std", "pallet-sudo/std", diff --git a/substrate/bin/minimal/runtime/build.rs b/templates/minimal/runtime/build.rs similarity index 100% rename from substrate/bin/minimal/runtime/build.rs rename to templates/minimal/runtime/build.rs diff --git a/substrate/bin/minimal/runtime/src/lib.rs b/templates/minimal/runtime/src/lib.rs similarity index 98% rename from substrate/bin/minimal/runtime/src/lib.rs rename to templates/minimal/runtime/src/lib.rs index 610289693d91..bd27d3cac0d3 100644 --- a/substrate/bin/minimal/runtime/src/lib.rs +++ b/templates/minimal/runtime/src/lib.rs @@ -22,7 +22,10 @@ include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); use frame::{ - deps::frame_support::weights::{FixedFee, NoFee}, + deps::frame_support::{ + genesis_builder_helper::{build_config, create_default_config}, + weights::{FixedFee, NoFee}, + }, prelude::*, runtime::{ apis::{ @@ -31,7 +34,6 @@ use frame::{ prelude::*, }, }; -use frame_support::genesis_builder_helper::{build_config, create_default_config}; #[runtime_version] pub const VERSION: RuntimeVersion = RuntimeVersion { diff --git a/cumulus/parachain-template/LICENSE b/templates/parachain/LICENSE similarity index 100% rename from cumulus/parachain-template/LICENSE rename to templates/parachain/LICENSE diff --git a/cumulus/parachain-template/README.md b/templates/parachain/README.md similarity index 100% rename from cumulus/parachain-template/README.md rename to templates/parachain/README.md diff --git a/cumulus/parachain-template/node/Cargo.toml b/templates/parachain/node/Cargo.toml similarity index 100% rename from cumulus/parachain-template/node/Cargo.toml rename to templates/parachain/node/Cargo.toml diff --git a/cumulus/parachain-template/node/build.rs b/templates/parachain/node/build.rs similarity index 100% rename from cumulus/parachain-template/node/build.rs rename to templates/parachain/node/build.rs diff --git a/cumulus/parachain-template/node/src/chain_spec.rs b/templates/parachain/node/src/chain_spec.rs similarity index 100% rename from cumulus/parachain-template/node/src/chain_spec.rs rename to templates/parachain/node/src/chain_spec.rs diff --git a/cumulus/parachain-template/node/src/cli.rs b/templates/parachain/node/src/cli.rs similarity index 100% rename from cumulus/parachain-template/node/src/cli.rs rename to templates/parachain/node/src/cli.rs diff --git a/cumulus/parachain-template/node/src/command.rs b/templates/parachain/node/src/command.rs similarity index 100% rename from cumulus/parachain-template/node/src/command.rs rename to templates/parachain/node/src/command.rs diff --git a/cumulus/parachain-template/node/src/main.rs b/templates/parachain/node/src/main.rs similarity index 100% rename from cumulus/parachain-template/node/src/main.rs rename to templates/parachain/node/src/main.rs diff --git a/cumulus/parachain-template/node/src/rpc.rs b/templates/parachain/node/src/rpc.rs similarity index 100% rename from cumulus/parachain-template/node/src/rpc.rs rename to templates/parachain/node/src/rpc.rs diff --git a/cumulus/parachain-template/node/src/service.rs b/templates/parachain/node/src/service.rs similarity index 100% rename from cumulus/parachain-template/node/src/service.rs rename to templates/parachain/node/src/service.rs diff --git a/cumulus/parachain-template/pallets/template/Cargo.toml b/templates/parachain/pallets/template/Cargo.toml similarity index 100% rename from cumulus/parachain-template/pallets/template/Cargo.toml rename to templates/parachain/pallets/template/Cargo.toml diff --git a/cumulus/parachain-template/pallets/template/README.md b/templates/parachain/pallets/template/README.md similarity index 100% rename from cumulus/parachain-template/pallets/template/README.md rename to templates/parachain/pallets/template/README.md diff --git a/cumulus/parachain-template/pallets/template/src/benchmarking.rs b/templates/parachain/pallets/template/src/benchmarking.rs similarity index 100% rename from cumulus/parachain-template/pallets/template/src/benchmarking.rs rename to templates/parachain/pallets/template/src/benchmarking.rs diff --git a/cumulus/parachain-template/pallets/template/src/lib.rs b/templates/parachain/pallets/template/src/lib.rs similarity index 100% rename from cumulus/parachain-template/pallets/template/src/lib.rs rename to templates/parachain/pallets/template/src/lib.rs diff --git a/cumulus/parachain-template/pallets/template/src/mock.rs b/templates/parachain/pallets/template/src/mock.rs similarity index 100% rename from cumulus/parachain-template/pallets/template/src/mock.rs rename to templates/parachain/pallets/template/src/mock.rs diff --git a/cumulus/parachain-template/pallets/template/src/tests.rs b/templates/parachain/pallets/template/src/tests.rs similarity index 100% rename from cumulus/parachain-template/pallets/template/src/tests.rs rename to templates/parachain/pallets/template/src/tests.rs diff --git a/cumulus/parachain-template/polkadot-launch/config.json b/templates/parachain/polkadot-launch/config.json similarity index 100% rename from cumulus/parachain-template/polkadot-launch/config.json rename to templates/parachain/polkadot-launch/config.json diff --git a/cumulus/parachain-template/runtime/Cargo.toml b/templates/parachain/runtime/Cargo.toml similarity index 100% rename from cumulus/parachain-template/runtime/Cargo.toml rename to templates/parachain/runtime/Cargo.toml diff --git a/cumulus/parachain-template/runtime/build.rs b/templates/parachain/runtime/build.rs similarity index 100% rename from cumulus/parachain-template/runtime/build.rs rename to templates/parachain/runtime/build.rs diff --git a/cumulus/parachain-template/runtime/src/lib.rs b/templates/parachain/runtime/src/lib.rs similarity index 100% rename from cumulus/parachain-template/runtime/src/lib.rs rename to templates/parachain/runtime/src/lib.rs diff --git a/cumulus/parachain-template/runtime/src/weights/block_weights.rs b/templates/parachain/runtime/src/weights/block_weights.rs similarity index 100% rename from cumulus/parachain-template/runtime/src/weights/block_weights.rs rename to templates/parachain/runtime/src/weights/block_weights.rs diff --git a/cumulus/parachain-template/runtime/src/weights/extrinsic_weights.rs b/templates/parachain/runtime/src/weights/extrinsic_weights.rs similarity index 100% rename from cumulus/parachain-template/runtime/src/weights/extrinsic_weights.rs rename to templates/parachain/runtime/src/weights/extrinsic_weights.rs diff --git a/cumulus/parachain-template/runtime/src/weights/mod.rs b/templates/parachain/runtime/src/weights/mod.rs similarity index 100% rename from cumulus/parachain-template/runtime/src/weights/mod.rs rename to templates/parachain/runtime/src/weights/mod.rs diff --git a/cumulus/parachain-template/runtime/src/weights/paritydb_weights.rs b/templates/parachain/runtime/src/weights/paritydb_weights.rs similarity index 100% rename from cumulus/parachain-template/runtime/src/weights/paritydb_weights.rs rename to templates/parachain/runtime/src/weights/paritydb_weights.rs diff --git a/cumulus/parachain-template/runtime/src/weights/rocksdb_weights.rs b/templates/parachain/runtime/src/weights/rocksdb_weights.rs similarity index 100% rename from cumulus/parachain-template/runtime/src/weights/rocksdb_weights.rs rename to templates/parachain/runtime/src/weights/rocksdb_weights.rs diff --git a/cumulus/parachain-template/runtime/src/xcm_config.rs b/templates/parachain/runtime/src/xcm_config.rs similarity index 100% rename from cumulus/parachain-template/runtime/src/xcm_config.rs rename to templates/parachain/runtime/src/xcm_config.rs diff --git a/substrate/bin/node-template/LICENSE b/templates/solo-chain/LICENSE similarity index 100% rename from substrate/bin/node-template/LICENSE rename to templates/solo-chain/LICENSE diff --git a/substrate/bin/node-template/README.md b/templates/solo-chain/README.md similarity index 100% rename from substrate/bin/node-template/README.md rename to templates/solo-chain/README.md diff --git a/substrate/bin/node-template/docs/rust-setup.md b/templates/solo-chain/docs/rust-setup.md similarity index 100% rename from substrate/bin/node-template/docs/rust-setup.md rename to templates/solo-chain/docs/rust-setup.md diff --git a/substrate/bin/node-template/env-setup/README.md b/templates/solo-chain/env-setup/README.md similarity index 100% rename from substrate/bin/node-template/env-setup/README.md rename to templates/solo-chain/env-setup/README.md diff --git a/substrate/bin/node-template/env-setup/flake.lock b/templates/solo-chain/env-setup/flake.lock similarity index 100% rename from substrate/bin/node-template/env-setup/flake.lock rename to templates/solo-chain/env-setup/flake.lock diff --git a/substrate/bin/node-template/env-setup/flake.nix b/templates/solo-chain/env-setup/flake.nix similarity index 100% rename from substrate/bin/node-template/env-setup/flake.nix rename to templates/solo-chain/env-setup/flake.nix diff --git a/substrate/bin/node-template/env-setup/rust-toolchain.toml b/templates/solo-chain/env-setup/rust-toolchain.toml similarity index 100% rename from substrate/bin/node-template/env-setup/rust-toolchain.toml rename to templates/solo-chain/env-setup/rust-toolchain.toml diff --git a/templates/solo-chain/node/Cargo.toml b/templates/solo-chain/node/Cargo.toml new file mode 100644 index 000000000000..5213a077dcbb --- /dev/null +++ b/templates/solo-chain/node/Cargo.toml @@ -0,0 +1,92 @@ +[package] +name = "solo-chain-node" +version = "4.0.0-dev" +description = "A solo-chain node template built with Substrate, part of Polkadot Sdk." +authors.workspace = true +homepage.workspace = true +repository.workspace = true +edition.workspace = true +license = "MIT-0" +publish = false + +[lints] +workspace = true + +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] + +[[bin]] +name = "solo-chain-node" + +[dependencies] +clap = { version = "4.5.1", features = ["derive"] } +futures = { version = "0.3.21", features = ["thread-pool"] } +serde_json = "1.0.113" +jsonrpsee = { version = "0.22", features = ["server"] } + +# substrate client +sc-cli = { path = "../../../substrate/client/cli" } +sp-core = { path = "../../../substrate/primitives/core" } +sc-executor = { path = "../../../substrate/client/executor" } +sc-network = { path = "../../../substrate/client/network" } +sc-service = { path = "../../../substrate/client/service" } +sc-telemetry = { path = "../../../substrate/client/telemetry" } +sc-transaction-pool = { path = "../../../substrate/client/transaction-pool" } +sc-transaction-pool-api = { path = "../../../substrate/client/transaction-pool/api" } +sc-offchain = { path = "../../../substrate/client/offchain" } +sc-consensus-aura = { path = "../../../substrate/client/consensus/aura" } +sp-consensus-aura = { path = "../../../substrate/primitives/consensus/aura" } +sc-consensus = { path = "../../../substrate/client/consensus/common" } +sc-consensus-grandpa = { path = "../../../substrate/client/consensus/grandpa" } +sp-consensus-grandpa = { path = "../../../substrate/primitives/consensus/grandpa" } +sc-client-api = { path = "../../../substrate/client/api" } +sc-rpc-api = { path = "../../../substrate/client/rpc-api" } +sc-basic-authorship = { path = "../../../substrate/client/basic-authorship" } + +# substrate primitives +sp-runtime = { path = "../../../substrate/primitives/runtime" } +sp-io = { path = "../../../substrate/primitives/io" } +sp-timestamp = { path = "../../../substrate/primitives/timestamp" } +sp-inherents = { path = "../../../substrate/primitives/inherents" } +sp-keyring = { path = "../../../substrate/primitives/keyring" } +sp-api = { path = "../../../substrate/primitives/api" } +sp-blockchain = { path = "../../../substrate/primitives/blockchain" } +sp-block-builder = { path = "../../../substrate/primitives/block-builder" } + +# frame and pallets +frame-system = { path = "../../../substrate/frame/system" } +pallet-transaction-payment = { path = "../../../substrate/frame/transaction-payment", default-features = false } +pallet-transaction-payment-rpc = { path = "../../../substrate/frame/transaction-payment/rpc" } +substrate-frame-rpc-system = { path = "../../../substrate/utils/frame/rpc/system" } + +# These dependencies are used for runtime benchmarking +frame-benchmarking-cli = { path = "../../../substrate/utils/frame/benchmarking-cli" } + +# Local Dependencies +solo-chain-runtime = { path = "../runtime" } + +# CLI-specific dependencies +try-runtime-cli = { path = "../../../substrate/utils/frame/try-runtime/cli", optional = true } + +[build-dependencies] +substrate-build-script-utils = { path = "../../../substrate/utils/build-script-utils" } + +[features] +default = [] +# Dependencies that are only required if runtime benchmarking should be build. +runtime-benchmarks = [ + "frame-benchmarking-cli/runtime-benchmarks", + "frame-system/runtime-benchmarks", + "solo-chain-runtime/runtime-benchmarks", + "sc-service/runtime-benchmarks", + "sp-runtime/runtime-benchmarks", +] +# Enable features that allow the runtime to be tried and debugged. Name might be subject to change +# in the near future. +try-runtime = [ + "frame-system/try-runtime", + "solo-chain-runtime/try-runtime", + "pallet-transaction-payment/try-runtime", + "sp-runtime/try-runtime", + "try-runtime-cli/try-runtime", +] diff --git a/substrate/bin/node-template/node/build.rs b/templates/solo-chain/node/build.rs similarity index 100% rename from substrate/bin/node-template/node/build.rs rename to templates/solo-chain/node/build.rs diff --git a/substrate/bin/node-template/node/src/benchmarking.rs b/templates/solo-chain/node/src/benchmarking.rs similarity index 99% rename from substrate/bin/node-template/node/src/benchmarking.rs rename to templates/solo-chain/node/src/benchmarking.rs index 6e29ad1a1231..7bc136b88f96 100644 --- a/substrate/bin/node-template/node/src/benchmarking.rs +++ b/templates/solo-chain/node/src/benchmarking.rs @@ -4,10 +4,10 @@ use crate::service::FullClient; -use node_template_runtime as runtime; use runtime::{AccountId, Balance, BalancesCall, SystemCall}; use sc_cli::Result; use sc_client_api::BlockBackend; +use solo_chain_runtime as runtime; use sp_core::{Encode, Pair}; use sp_inherents::{InherentData, InherentDataProvider}; use sp_keyring::Sr25519Keyring; diff --git a/substrate/bin/node-template/node/src/chain_spec.rs b/templates/solo-chain/node/src/chain_spec.rs similarity index 97% rename from substrate/bin/node-template/node/src/chain_spec.rs rename to templates/solo-chain/node/src/chain_spec.rs index 6e0d78f647a5..8e796fa258a0 100644 --- a/substrate/bin/node-template/node/src/chain_spec.rs +++ b/templates/solo-chain/node/src/chain_spec.rs @@ -1,5 +1,5 @@ -use node_template_runtime::{AccountId, RuntimeGenesisConfig, Signature, WASM_BINARY}; use sc_service::ChainType; +use solo_chain_runtime::{AccountId, RuntimeGenesisConfig, Signature, WASM_BINARY}; use sp_consensus_aura::sr25519::AuthorityId as AuraId; use sp_consensus_grandpa::AuthorityId as GrandpaId; use sp_core::{sr25519, Pair, Public}; diff --git a/substrate/bin/node-template/node/src/cli.rs b/templates/solo-chain/node/src/cli.rs similarity index 100% rename from substrate/bin/node-template/node/src/cli.rs rename to templates/solo-chain/node/src/cli.rs diff --git a/substrate/bin/node-template/node/src/command.rs b/templates/solo-chain/node/src/command.rs similarity index 99% rename from substrate/bin/node-template/node/src/command.rs rename to templates/solo-chain/node/src/command.rs index 3778df664229..24b83613f3f4 100644 --- a/substrate/bin/node-template/node/src/command.rs +++ b/templates/solo-chain/node/src/command.rs @@ -5,9 +5,9 @@ use crate::{ service, }; use frame_benchmarking_cli::{BenchmarkCmd, ExtrinsicFactory, SUBSTRATE_REFERENCE_HARDWARE}; -use node_template_runtime::{Block, EXISTENTIAL_DEPOSIT}; use sc_cli::SubstrateCli; use sc_service::PartialComponents; +use solo_chain_runtime::{Block, EXISTENTIAL_DEPOSIT}; use sp_keyring::Sr25519Keyring; impl SubstrateCli for Cli { diff --git a/substrate/bin/node-template/node/src/main.rs b/templates/solo-chain/node/src/main.rs similarity index 100% rename from substrate/bin/node-template/node/src/main.rs rename to templates/solo-chain/node/src/main.rs diff --git a/substrate/bin/node-template/node/src/rpc.rs b/templates/solo-chain/node/src/rpc.rs similarity index 97% rename from substrate/bin/node-template/node/src/rpc.rs rename to templates/solo-chain/node/src/rpc.rs index 246391adcbbe..1760c49d6fd3 100644 --- a/substrate/bin/node-template/node/src/rpc.rs +++ b/templates/solo-chain/node/src/rpc.rs @@ -8,8 +8,8 @@ use std::sync::Arc; use jsonrpsee::RpcModule; -use node_template_runtime::{opaque::Block, AccountId, Balance, Nonce}; use sc_transaction_pool_api::TransactionPool; +use solo_chain_runtime::{opaque::Block, AccountId, Balance, Nonce}; use sp_api::ProvideRuntimeApi; use sp_block_builder::BlockBuilder; use sp_blockchain::{Error as BlockChainError, HeaderBackend, HeaderMetadata}; diff --git a/substrate/bin/node-template/node/src/service.rs b/templates/solo-chain/node/src/service.rs similarity index 99% rename from substrate/bin/node-template/node/src/service.rs rename to templates/solo-chain/node/src/service.rs index 25cd65117841..b2131af2858d 100644 --- a/substrate/bin/node-template/node/src/service.rs +++ b/templates/solo-chain/node/src/service.rs @@ -1,13 +1,13 @@ //! Service and ServiceFactory implementation. Specialized wrapper over substrate service. use futures::FutureExt; -use node_template_runtime::{self, opaque::Block, RuntimeApi}; use sc_client_api::{Backend, BlockBackend}; use sc_consensus_aura::{ImportQueueParams, SlotProportion, StartAuraParams}; use sc_consensus_grandpa::SharedVoterState; use sc_service::{error::Error as ServiceError, Configuration, TaskManager, WarpSyncParams}; use sc_telemetry::{Telemetry, TelemetryWorker}; use sc_transaction_pool_api::OffchainTransactionPoolFactory; +use solo_chain_runtime::{self, opaque::Block, RuntimeApi}; use sp_consensus_aura::sr25519::AuthorityPair as AuraPair; use std::{sync::Arc, time::Duration}; diff --git a/substrate/bin/node-template/pallets/template/Cargo.toml b/templates/solo-chain/pallets/template/Cargo.toml similarity index 57% rename from substrate/bin/node-template/pallets/template/Cargo.toml rename to templates/solo-chain/pallets/template/Cargo.toml index 51410a71c7bc..bbd1bdadaff3 100644 --- a/substrate/bin/node-template/pallets/template/Cargo.toml +++ b/templates/solo-chain/pallets/template/Cargo.toml @@ -2,12 +2,12 @@ name = "pallet-template" version = "4.0.0-dev" description = "FRAME pallet template for defining custom runtime logic." -authors = ["Substrate DevHub "] -homepage = "https://substrate.io" +authors.workspace = true +homepage.workspace = true +repository.workspace = true edition.workspace = true license = "MIT-0" publish = false -repository = "https://github.com/substrate-developer-hub/substrate-node-template/" [lints] workspace = true @@ -19,16 +19,19 @@ targets = ["x86_64-unknown-linux-gnu"] codec = { package = "parity-scale-codec", version = "3.6.1", default-features = false, features = [ "derive", ] } -scale-info = { version = "2.10.0", default-features = false, features = ["derive"] } -frame-benchmarking = { path = "../../../../frame/benchmarking", default-features = false, optional = true } -frame-support = { path = "../../../../frame/support", default-features = false } -frame-system = { path = "../../../../frame/system", default-features = false } -sp-std = { path = "../../../../primitives/std", default-features = false } +scale-info = { version = "2.10.0", default-features = false, features = [ + "derive", +] } + +# frame deps +frame-benchmarking = { path = "../../../../substrate/frame/benchmarking", default-features = false, optional = true } +frame-support = { path = "../../../../substrate/frame/support", default-features = false } +frame-system = { path = "../../../../substrate/frame/system", default-features = false } [dev-dependencies] -sp-core = { path = "../../../../primitives/core" } -sp-io = { path = "../../../../primitives/io" } -sp-runtime = { path = "../../../../primitives/runtime" } +sp-core = { path = "../../../../substrate/primitives/core" } +sp-io = { path = "../../../../substrate/primitives/io" } +sp-runtime = { path = "../../../../substrate/primitives/runtime" } [features] default = ["std"] @@ -41,7 +44,6 @@ std = [ "sp-core/std", "sp-io/std", "sp-runtime/std", - "sp-std/std", ] runtime-benchmarks = [ "frame-benchmarking/runtime-benchmarks", diff --git a/substrate/bin/node-template/pallets/template/README.md b/templates/solo-chain/pallets/template/README.md similarity index 100% rename from substrate/bin/node-template/pallets/template/README.md rename to templates/solo-chain/pallets/template/README.md diff --git a/substrate/bin/node-template/pallets/template/src/benchmarking.rs b/templates/solo-chain/pallets/template/src/benchmarking.rs similarity index 100% rename from substrate/bin/node-template/pallets/template/src/benchmarking.rs rename to templates/solo-chain/pallets/template/src/benchmarking.rs diff --git a/substrate/bin/node-template/pallets/template/src/lib.rs b/templates/solo-chain/pallets/template/src/lib.rs similarity index 100% rename from substrate/bin/node-template/pallets/template/src/lib.rs rename to templates/solo-chain/pallets/template/src/lib.rs diff --git a/substrate/bin/node-template/pallets/template/src/mock.rs b/templates/solo-chain/pallets/template/src/mock.rs similarity index 100% rename from substrate/bin/node-template/pallets/template/src/mock.rs rename to templates/solo-chain/pallets/template/src/mock.rs diff --git a/substrate/bin/node-template/pallets/template/src/tests.rs b/templates/solo-chain/pallets/template/src/tests.rs similarity index 100% rename from substrate/bin/node-template/pallets/template/src/tests.rs rename to templates/solo-chain/pallets/template/src/tests.rs diff --git a/substrate/bin/node-template/pallets/template/src/weights.rs b/templates/solo-chain/pallets/template/src/weights.rs similarity index 100% rename from substrate/bin/node-template/pallets/template/src/weights.rs rename to templates/solo-chain/pallets/template/src/weights.rs diff --git a/templates/solo-chain/runtime/Cargo.toml b/templates/solo-chain/runtime/Cargo.toml new file mode 100644 index 000000000000..65973c6fc289 --- /dev/null +++ b/templates/solo-chain/runtime/Cargo.toml @@ -0,0 +1,151 @@ +[package] +name = "solo-chain-runtime" +version = "0.0.0" +description = "A solo-chain runtime template built with Substrate, part of Polkadot Sdk." +authors.workspace = true +homepage.workspace = true +repository.workspace = true +edition.workspace = true +license = "MIT-0" +publish = false + +[lints] +workspace = true + +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] + +[dependencies] +codec = { package = "parity-scale-codec", version = "3.6.1", default-features = false, features = [ + "derive", +] } +scale-info = { version = "2.10.0", default-features = false, features = [ + "derive", + "serde", +] } + +# frame +frame-support = { path = "../../../substrate/frame/support", default-features = false } +frame-system = { path = "../../../substrate/frame/system", default-features = false } +frame-try-runtime = { path = "../../../substrate/frame/try-runtime", default-features = false, optional = true } +frame-executive = { path = "../../../substrate/frame/executive", default-features = false } + +# frame pallets +pallet-aura = { path = "../../../substrate/frame/aura", default-features = false } +pallet-balances = { path = "../../../substrate/frame/balances", default-features = false } +pallet-grandpa = { path = "../../../substrate/frame/grandpa", default-features = false } +pallet-sudo = { path = "../../../substrate/frame/sudo", default-features = false } +pallet-timestamp = { path = "../../../substrate/frame/timestamp", default-features = false } +pallet-transaction-payment = { path = "../../../substrate/frame/transaction-payment", default-features = false } + +# primitives +sp-api = { path = "../../../substrate/primitives/api", default-features = false } +sp-block-builder = { path = "../../../substrate/primitives/block-builder", default-features = false } +sp-consensus-aura = { path = "../../../substrate/primitives/consensus/aura", default-features = false, features = [ + "serde", +] } +sp-consensus-grandpa = { path = "../../../substrate/primitives/consensus/grandpa", default-features = false, features = [ + "serde", +] } +sp-core = { path = "../../../substrate/primitives/core", default-features = false, features = [ + "serde", +] } +sp-inherents = { path = "../../../substrate/primitives/inherents", default-features = false } +sp-offchain = { path = "../../../substrate/primitives/offchain", default-features = false } +sp-runtime = { path = "../../../substrate/primitives/runtime", default-features = false, features = [ + "serde", +] } +sp-session = { path = "../../../substrate/primitives/session", default-features = false } +sp-std = { path = "../../../substrate/primitives/std", default-features = false } +sp-storage = { path = "../../../substrate/primitives/storage", default-features = false } +sp-transaction-pool = { path = "../../../substrate/primitives/transaction-pool", default-features = false } +sp-version = { path = "../../../substrate/primitives/version", default-features = false, features = [ + "serde", +] } +sp-genesis-builder = { default-features = false, path = "../../../substrate/primitives/genesis-builder" } + +# RPC related +frame-system-rpc-runtime-api = { path = "../../../substrate/frame/system/rpc/runtime-api", default-features = false } +pallet-transaction-payment-rpc-runtime-api = { path = "../../../substrate/frame/transaction-payment/rpc/runtime-api", default-features = false } + +# Used for runtime benchmarking +frame-benchmarking = { path = "../../../substrate/frame/benchmarking", default-features = false, optional = true } +frame-system-benchmarking = { path = "../../../substrate/frame/system/benchmarking", default-features = false, optional = true } + +# The pallet in this template. +pallet-template = { path = "../pallets/template", default-features = false } + +[build-dependencies] +substrate-wasm-builder = { path = "../../../substrate/utils/wasm-builder", optional = true } + +[features] +default = ["std"] +std = [ + "codec/std", + "scale-info/std", + + "frame-executive/std", + "frame-support/std", + "frame-system-benchmarking?/std", + "frame-system-rpc-runtime-api/std", + "frame-system/std", + + "frame-benchmarking?/std", + "frame-try-runtime?/std", + + "pallet-aura/std", + "pallet-balances/std", + "pallet-grandpa/std", + "pallet-sudo/std", + "pallet-template/std", + "pallet-timestamp/std", + "pallet-transaction-payment-rpc-runtime-api/std", + "pallet-transaction-payment/std", + + "sp-api/std", + "sp-block-builder/std", + "sp-consensus-aura/std", + "sp-consensus-grandpa/std", + "sp-core/std", + "sp-genesis-builder/std", + "sp-inherents/std", + "sp-offchain/std", + "sp-runtime/std", + "sp-session/std", + "sp-std/std", + "sp-storage/std", + "sp-transaction-pool/std", + "sp-version/std", + + "substrate-wasm-builder", +] + +runtime-benchmarks = [ + "frame-benchmarking/runtime-benchmarks", + "frame-support/runtime-benchmarks", + "frame-system-benchmarking/runtime-benchmarks", + "frame-system/runtime-benchmarks", + "pallet-balances/runtime-benchmarks", + "pallet-grandpa/runtime-benchmarks", + "pallet-sudo/runtime-benchmarks", + "pallet-template/runtime-benchmarks", + "pallet-timestamp/runtime-benchmarks", + "sp-runtime/runtime-benchmarks", +] + +try-runtime = [ + "frame-executive/try-runtime", + "frame-support/try-runtime", + "frame-system/try-runtime", + "frame-try-runtime/try-runtime", + "pallet-aura/try-runtime", + "pallet-balances/try-runtime", + "pallet-grandpa/try-runtime", + "pallet-sudo/try-runtime", + "pallet-template/try-runtime", + "pallet-timestamp/try-runtime", + "pallet-transaction-payment/try-runtime", + "sp-runtime/try-runtime", +] + +experimental = ["pallet-aura/experimental"] diff --git a/substrate/bin/node-template/runtime/build.rs b/templates/solo-chain/runtime/build.rs similarity index 100% rename from substrate/bin/node-template/runtime/build.rs rename to templates/solo-chain/runtime/build.rs diff --git a/substrate/bin/node-template/runtime/src/lib.rs b/templates/solo-chain/runtime/src/lib.rs similarity index 98% rename from substrate/bin/node-template/runtime/src/lib.rs rename to templates/solo-chain/runtime/src/lib.rs index 3b6a74be2512..bd5d09c96a02 100644 --- a/substrate/bin/node-template/runtime/src/lib.rs +++ b/templates/solo-chain/runtime/src/lib.rs @@ -1,8 +1,5 @@ #![cfg_attr(not(feature = "std"), no_std)] -// `construct_runtime!` does a lot of recursion and requires us to increase the limit to 256. -#![recursion_limit = "256"] -// Make the WASM binary available. #[cfg(feature = "std")] include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); @@ -22,7 +19,6 @@ use sp_version::NativeVersion; use sp_version::RuntimeVersion; use frame_support::genesis_builder_helper::{build_config, create_default_config}; -// A few exports that help ease life for downstream crates. pub use frame_support::{ construct_runtime, derive_impl, parameter_types, traits::{ @@ -257,7 +253,7 @@ impl pallet_template::Config for Runtime { // Create the runtime by composing the FRAME pallets that were previously configured. construct_runtime!( - pub enum Runtime { + pub struct Runtime { System: frame_system, Timestamp: pallet_timestamp, Aura: pallet_aura, @@ -265,6 +261,7 @@ construct_runtime!( Balances: pallet_balances, TransactionPayment: pallet_transaction_payment, Sudo: pallet_sudo, + // Include the custom logic from the pallet-template in the runtime. TemplateModule: pallet_template, } From e88f572ed2a960538546941a416ad7120ec397b5 Mon Sep 17 00:00:00 2001 From: kianenigma Date: Fri, 23 Feb 2024 13:06:53 +0000 Subject: [PATCH 05/21] finish repotting cumulus stuff --- Cargo.lock | 144 +++++++++++++++++- Cargo.toml | 15 +- .../frame/examples/default-config/src/lib.rs | 2 +- substrate/frame/system/src/lib.rs | 2 +- templates/minimal/node/Cargo.toml | 2 +- templates/minimal/pallets/template/Cargo.toml | 30 ++++ templates/minimal/pallets/template/src/lib.rs | 15 ++ templates/minimal/runtime/Cargo.toml | 2 +- templates/parachain/node/Cargo.toml | 38 ++--- templates/parachain/node/src/chain_spec.rs | 13 +- templates/parachain/node/src/command.rs | 2 +- templates/parachain/node/src/rpc.rs | 2 +- templates/parachain/node/src/service.rs | 6 +- .../parachain/pallets/template/Cargo.toml | 30 ++-- .../parachain/pallets/template/README.md | 2 +- .../pallets/template/src/benchmarking.rs | 37 +++-- .../parachain/pallets/template/src/lib.rs | 4 + .../pallets/template/src/weights.rs | 0 templates/parachain/runtime/Cargo.toml | 49 +++--- templates/parachain/runtime/src/lib.rs | 1 + templates/{solo-chain => solochain}/LICENSE | 0 templates/{solo-chain => solochain}/README.md | 0 .../docs/rust-setup.md | 0 .../env-setup/README.md | 0 .../env-setup/flake.lock | 0 .../env-setup/flake.nix | 0 .../env-setup/rust-toolchain.toml | 0 .../{solo-chain => solochain}/node/Cargo.toml | 12 +- .../{solo-chain => solochain}/node/build.rs | 0 .../node/src/benchmarking.rs | 2 +- .../node/src/chain_spec.rs | 2 +- .../{solo-chain => solochain}/node/src/cli.rs | 0 .../node/src/command.rs | 2 +- .../node/src/main.rs | 0 .../{solo-chain => solochain}/node/src/rpc.rs | 2 +- .../node/src/service.rs | 2 +- .../pallets/template/Cargo.toml | 0 .../pallets/template/README.md | 0 .../pallets/template/src/benchmarking.rs | 0 .../pallets/template/src/lib.rs | 0 .../pallets/template/src/mock.rs | 0 .../pallets/template/src/tests.rs | 0 .../solochain/pallets/template/src/weights.rs | 90 +++++++++++ .../runtime/Cargo.toml | 4 +- .../runtime/build.rs | 0 .../runtime/src/lib.rs | 0 46 files changed, 409 insertions(+), 103 deletions(-) create mode 100644 templates/minimal/pallets/template/Cargo.toml create mode 100644 templates/minimal/pallets/template/src/lib.rs rename templates/{solo-chain => parachain}/pallets/template/src/weights.rs (100%) rename templates/{solo-chain => solochain}/LICENSE (100%) rename templates/{solo-chain => solochain}/README.md (100%) rename templates/{solo-chain => solochain}/docs/rust-setup.md (100%) rename templates/{solo-chain => solochain}/env-setup/README.md (100%) rename templates/{solo-chain => solochain}/env-setup/flake.lock (100%) rename templates/{solo-chain => solochain}/env-setup/flake.nix (100%) rename templates/{solo-chain => solochain}/env-setup/rust-toolchain.toml (100%) rename templates/{solo-chain => solochain}/node/Cargo.toml (93%) rename templates/{solo-chain => solochain}/node/build.rs (100%) rename templates/{solo-chain => solochain}/node/src/benchmarking.rs (99%) rename templates/{solo-chain => solochain}/node/src/chain_spec.rs (97%) rename templates/{solo-chain => solochain}/node/src/cli.rs (100%) rename templates/{solo-chain => solochain}/node/src/command.rs (99%) rename templates/{solo-chain => solochain}/node/src/main.rs (100%) rename templates/{solo-chain => solochain}/node/src/rpc.rs (97%) rename templates/{solo-chain => solochain}/node/src/service.rs (99%) rename templates/{solo-chain => solochain}/pallets/template/Cargo.toml (100%) rename templates/{solo-chain => solochain}/pallets/template/README.md (100%) rename templates/{solo-chain => solochain}/pallets/template/src/benchmarking.rs (100%) rename templates/{solo-chain => solochain}/pallets/template/src/lib.rs (100%) rename templates/{solo-chain => solochain}/pallets/template/src/mock.rs (100%) rename templates/{solo-chain => solochain}/pallets/template/src/tests.rs (100%) create mode 100644 templates/solochain/pallets/template/src/weights.rs rename templates/{solo-chain => solochain}/runtime/Cargo.toml (97%) rename templates/{solo-chain => solochain}/runtime/build.rs (100%) rename templates/{solo-chain => solochain}/runtime/src/lib.rs (100%) diff --git a/Cargo.lock b/Cargo.lock index 03097d05187c..691c7f813ce6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -10104,6 +10104,15 @@ dependencies = [ "sp-weights", ] +[[package]] +name = "pallet-minimal-template" +version = "0.0.0" +dependencies = [ + "frame", + "parity-scale-codec", + "scale-info", +] + [[package]] name = "pallet-mixnet" version = "0.4.0" @@ -10403,6 +10412,20 @@ dependencies = [ "sp-io", ] +[[package]] +name = "pallet-parachain-template" +version = "4.0.0-dev" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-io", + "sp-runtime", +] + [[package]] name = "pallet-parameters" version = "0.0.1" @@ -11172,6 +11195,121 @@ dependencies = [ "staging-xcm-builder", ] +[[package]] +name = "parachain-node" +version = "0.0.0" +dependencies = [ + "clap 4.5.1", + "color-print", + "cumulus-client-cli", + "cumulus-client-collator", + "cumulus-client-consensus-aura", + "cumulus-client-consensus-common", + "cumulus-client-consensus-proposer", + "cumulus-client-service", + "cumulus-primitives-core", + "cumulus-primitives-parachain-inherent", + "cumulus-relay-chain-interface", + "frame-benchmarking", + "frame-benchmarking-cli", + "futures", + "jsonrpsee", + "log", + "pallet-transaction-payment-rpc", + "parachain-runtime", + "parity-scale-codec", + "polkadot-cli", + "polkadot-primitives", + "sc-basic-authorship", + "sc-chain-spec", + "sc-cli", + "sc-client-api", + "sc-consensus", + "sc-executor", + "sc-network", + "sc-network-sync", + "sc-offchain", + "sc-rpc", + "sc-service", + "sc-sysinfo", + "sc-telemetry", + "sc-tracing", + "sc-transaction-pool", + "sc-transaction-pool-api", + "serde", + "serde_json", + "sp-api", + "sp-block-builder", + "sp-blockchain", + "sp-consensus-aura", + "sp-core", + "sp-io", + "sp-keystore", + "sp-runtime", + "sp-timestamp", + "staging-xcm", + "substrate-build-script-utils", + "substrate-frame-rpc-system", + "substrate-prometheus-endpoint", +] + +[[package]] +name = "parachain-runtime" +version = "0.0.0" +dependencies = [ + "cumulus-pallet-aura-ext", + "cumulus-pallet-parachain-system", + "cumulus-pallet-session-benchmarking", + "cumulus-pallet-xcm", + "cumulus-pallet-xcmp-queue", + "cumulus-primitives-core", + "cumulus-primitives-utility", + "frame-benchmarking", + "frame-executive", + "frame-support", + "frame-system", + "frame-system-benchmarking", + "frame-system-rpc-runtime-api", + "frame-try-runtime", + "hex-literal", + "log", + "pallet-aura", + "pallet-authorship", + "pallet-balances", + "pallet-collator-selection", + "pallet-message-queue", + "pallet-parachain-template", + "pallet-session", + "pallet-sudo", + "pallet-timestamp", + "pallet-transaction-payment", + "pallet-transaction-payment-rpc-runtime-api", + "pallet-xcm", + "parachains-common", + "parity-scale-codec", + "polkadot-parachain-primitives", + "polkadot-runtime-common", + "scale-info", + "smallvec", + "sp-api", + "sp-block-builder", + "sp-consensus-aura", + "sp-core", + "sp-genesis-builder", + "sp-inherents", + "sp-offchain", + "sp-runtime", + "sp-session", + "sp-std 14.0.0", + "sp-transaction-pool", + "sp-version", + "staging-parachain-info", + "staging-xcm", + "staging-xcm-builder", + "staging-xcm-executor", + "substrate-wasm-builder", +] + [[package]] name = "parachains-common" version = "7.0.0" @@ -17968,7 +18106,7 @@ dependencies = [ ] [[package]] -name = "solo-chain-node" +name = "solochain-node" version = "4.0.0-dev" dependencies = [ "clap 4.5.1", @@ -17993,7 +18131,7 @@ dependencies = [ "sc-transaction-pool", "sc-transaction-pool-api", "serde_json", - "solo-chain-runtime", + "solochain-runtime", "sp-api", "sp-block-builder", "sp-blockchain", @@ -18011,7 +18149,7 @@ dependencies = [ ] [[package]] -name = "solo-chain-runtime" +name = "solochain-runtime" version = "0.0.0" dependencies = [ "frame-benchmarking", diff --git a/Cargo.toml b/Cargo.toml index 03dbb4bf2cf0..727a0849f49c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -495,16 +495,17 @@ members = [ "substrate/utils/prometheus", "substrate/utils/wasm-builder", - "templates/minimal/node", + "templates/minimal/pallets/template", "templates/minimal/runtime", + "templates/minimal/node", - "templates/solo-chain/node", - "templates/solo-chain/pallets/template", - "templates/solo-chain/runtime", + "templates/solochain/pallets/template", + "templates/solochain/runtime", + "templates/solochain/node", - # "templates/parachain/node", - # "templates/parachain/pallets/template", - # "templates/parachain/runtime", + "templates/parachain/pallets/template", + "templates/parachain/runtime", + "templates/parachain/node", ] default-members = ["polkadot", "substrate/bin/node/cli"] diff --git a/substrate/frame/examples/default-config/src/lib.rs b/substrate/frame/examples/default-config/src/lib.rs index cd1653e6c764..f7645521f500 100644 --- a/substrate/frame/examples/default-config/src/lib.rs +++ b/substrate/frame/examples/default-config/src/lib.rs @@ -108,7 +108,7 @@ pub mod pallet { } /// A type providing default configurations for this pallet in another environment. Examples - /// could be a parachain, or a solo-chain. + /// could be a parachain, or a solochain. /// /// Appropriate derive for `frame_system::DefaultConfig` needs to be provided. In this /// example, we simple derive `frame_system::config_preludes::TestDefaultConfig` again. diff --git a/substrate/frame/system/src/lib.rs b/substrate/frame/system/src/lib.rs index 069217bcee46..5dad8ecc11ee 100644 --- a/substrate/frame/system/src/lib.rs +++ b/substrate/frame/system/src/lib.rs @@ -300,7 +300,7 @@ pub mod pallet { type OnSetCode = (); } - /// Default configurations of this pallet in a solo-chain environment. + /// Default configurations of this pallet in a solochain environment. /// /// ## Considerations: /// diff --git a/templates/minimal/node/Cargo.toml b/templates/minimal/node/Cargo.toml index 1c3e128555f3..e468b2769613 100644 --- a/templates/minimal/node/Cargo.toml +++ b/templates/minimal/node/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "minimal-node" -version = "0.0.0" description = "A miniaml Substrate-based Substrate node, ready for hacking." +version = "0.0.0" authors.workspace = true homepage.workspace = true repository.workspace = true diff --git a/templates/minimal/pallets/template/Cargo.toml b/templates/minimal/pallets/template/Cargo.toml new file mode 100644 index 000000000000..6595902e0dcc --- /dev/null +++ b/templates/minimal/pallets/template/Cargo.toml @@ -0,0 +1,30 @@ +[package] +name = "pallet-minimal-template" +version = "0.0.0" +description = "A minimal pallet built with FRAME, part of Polkadot Sdk." +authors.workspace = true +homepage.workspace = true +repository.workspace = true +edition.workspace = true +license = "MIT-0" +publish = false + +[lints] +workspace = true + +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] + +[dependencies] +codec = { package = "parity-scale-codec", version = "3.0.0", features = [ + "derive", +], default-features = false } +scale-info = { version = "2.10.0", default-features = false, features = [ + "derive", +] } +frame = { path = "../../../../substrate/frame", default-features = false } + + +[features] +default = ["std"] +std = ["codec/std", "scale-info/std", "frame/std"] diff --git a/templates/minimal/pallets/template/src/lib.rs b/templates/minimal/pallets/template/src/lib.rs new file mode 100644 index 000000000000..e0f486638d67 --- /dev/null +++ b/templates/minimal/pallets/template/src/lib.rs @@ -0,0 +1,15 @@ +//! A shell pallet built with [`frame`]. + +#![cfg_attr(not(feature = "std"), no_std)] +use frame::prelude::*; + +#[frame::pallet] +pub mod pallet { + use super::*; + + #[pallet::config] + pub trait Config: frame_system::Config {} + + #[pallet::pallet] + pub struct Pallet(_); +} diff --git a/templates/minimal/runtime/Cargo.toml b/templates/minimal/runtime/Cargo.toml index e818e87422b6..9668bca6f9ba 100644 --- a/templates/minimal/runtime/Cargo.toml +++ b/templates/minimal/runtime/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "minimal-runtime" version = "0.0.0" -description = "A minimal Polkadot Sdk based runtime, built with FRAME" +description = "A solochain runtime template built with Substrate, part of Polkadot Sdk." authors.workspace = true homepage.workspace = true repository.workspace = true diff --git a/templates/parachain/node/Cargo.toml b/templates/parachain/node/Cargo.toml index 0ef678c4cbae..7faece550f87 100644 --- a/templates/parachain/node/Cargo.toml +++ b/templates/parachain/node/Cargo.toml @@ -1,14 +1,14 @@ [package] -name = "parachain-template-node" -version = "0.1.0" -authors = ["Anonymous"] -description = "A new Cumulus FRAME-based Substrate Node, ready for hacking together a parachain." -license = "Unlicense" -homepage = "https://substrate.io" +name = "parachain-node" +description = "A parachain node template built with Substrate and Cumulus, part of Polkadot Sdk." +version = "0.0.0" +authors.workspace = true +homepage.workspace = true repository.workspace = true edition.workspace = true -build = "build.rs" +license = "MIT-0" publish = false +build = "build.rs" [lints] workspace = true @@ -23,7 +23,7 @@ futures = "0.3.28" serde_json = { workspace = true, default-features = true } # Local -parachain-template-runtime = { path = "../runtime" } +parachain-runtime = { path = "../runtime" } # Substrate frame-benchmarking = { path = "../../../substrate/frame/benchmarking" } @@ -63,15 +63,15 @@ polkadot-primitives = { path = "../../../polkadot/primitives" } xcm = { package = "staging-xcm", path = "../../../polkadot/xcm", default-features = false } # Cumulus -cumulus-client-cli = { path = "../../client/cli" } -cumulus-client-collator = { path = "../../client/collator" } -cumulus-client-consensus-aura = { path = "../../client/consensus/aura" } -cumulus-client-consensus-common = { path = "../../client/consensus/common" } -cumulus-client-consensus-proposer = { path = "../../client/consensus/proposer" } -cumulus-client-service = { path = "../../client/service" } -cumulus-primitives-core = { path = "../../primitives/core" } -cumulus-primitives-parachain-inherent = { path = "../../primitives/parachain-inherent" } -cumulus-relay-chain-interface = { path = "../../client/relay-chain-interface" } +cumulus-client-cli = { path = "../../../cumulus/client/cli" } +cumulus-client-collator = { path = "../../../cumulus/client/collator" } +cumulus-client-consensus-aura = { path = "../../../cumulus/client/consensus/aura" } +cumulus-client-consensus-common = { path = "../../../cumulus/client/consensus/common" } +cumulus-client-consensus-proposer = { path = "../../../cumulus/client/consensus/proposer" } +cumulus-client-service = { path = "../../../cumulus/client/service" } +cumulus-primitives-core = { path = "../../../cumulus/primitives/core" } +cumulus-primitives-parachain-inherent = { path = "../../../cumulus/primitives/parachain-inherent" } +cumulus-relay-chain-interface = { path = "../../../cumulus/client/relay-chain-interface" } color-print = "0.3.4" [build-dependencies] @@ -83,14 +83,14 @@ runtime-benchmarks = [ "cumulus-primitives-core/runtime-benchmarks", "frame-benchmarking-cli/runtime-benchmarks", "frame-benchmarking/runtime-benchmarks", - "parachain-template-runtime/runtime-benchmarks", + "parachain-runtime/runtime-benchmarks", "polkadot-cli/runtime-benchmarks", "polkadot-primitives/runtime-benchmarks", "sc-service/runtime-benchmarks", "sp-runtime/runtime-benchmarks", ] try-runtime = [ - "parachain-template-runtime/try-runtime", + "parachain-runtime/try-runtime", "polkadot-cli/try-runtime", "sp-runtime/try-runtime", ] diff --git a/templates/parachain/node/src/chain_spec.rs b/templates/parachain/node/src/chain_spec.rs index a79c78699c07..4a52f7a533f6 100644 --- a/templates/parachain/node/src/chain_spec.rs +++ b/templates/parachain/node/src/chain_spec.rs @@ -1,5 +1,6 @@ use cumulus_primitives_core::ParaId; -use parachain_template_runtime::{AccountId, AuraId, Signature, EXISTENTIAL_DEPOSIT}; +use parachain_runtime as runtime; +use runtime::{AccountId, AuraId, Signature, EXISTENTIAL_DEPOSIT}; use sc_chain_spec::{ChainSpecExtension, ChainSpecGroup}; use sc_service::ChainType; use serde::{Deserialize, Serialize}; @@ -56,8 +57,8 @@ where /// Generate the session keys from individual elements. /// /// The input must be a tuple of individual keys (a single arg for now since we have just one key). -pub fn template_session_keys(keys: AuraId) -> parachain_template_runtime::SessionKeys { - parachain_template_runtime::SessionKeys { aura: keys } +pub fn template_session_keys(keys: AuraId) -> runtime::SessionKeys { + runtime::SessionKeys { aura: keys } } pub fn development_config() -> ChainSpec { @@ -68,8 +69,7 @@ pub fn development_config() -> ChainSpec { properties.insert("ss58Format".into(), 42.into()); ChainSpec::builder( - parachain_template_runtime::WASM_BINARY - .expect("WASM binary was not built, please build it!"), + runtime::WASM_BINARY.expect("WASM binary was not built, please build it!"), Extensions { relay_chain: "rococo-local".into(), // You MUST set this to the correct network! @@ -120,8 +120,7 @@ pub fn local_testnet_config() -> ChainSpec { #[allow(deprecated)] ChainSpec::builder( - parachain_template_runtime::WASM_BINARY - .expect("WASM binary was not built, please build it!"), + runtime::WASM_BINARY.expect("WASM binary was not built, please build it!"), Extensions { relay_chain: "rococo-local".into(), // You MUST set this to the correct network! diff --git a/templates/parachain/node/src/command.rs b/templates/parachain/node/src/command.rs index 72b3ab7bb4b9..6a018558cd8a 100644 --- a/templates/parachain/node/src/command.rs +++ b/templates/parachain/node/src/command.rs @@ -3,7 +3,7 @@ use std::net::SocketAddr; use cumulus_primitives_core::ParaId; use frame_benchmarking_cli::{BenchmarkCmd, SUBSTRATE_REFERENCE_HARDWARE}; use log::info; -use parachain_template_runtime::Block; +use parachain_runtime::Block; use sc_cli::{ ChainSpec, CliConfiguration, DefaultConfigurationValues, ImportParams, KeystoreParams, NetworkParams, Result, SharedParams, SubstrateCli, diff --git a/templates/parachain/node/src/rpc.rs b/templates/parachain/node/src/rpc.rs index bb52b974f0ce..b8afc84a46ca 100644 --- a/templates/parachain/node/src/rpc.rs +++ b/templates/parachain/node/src/rpc.rs @@ -7,7 +7,7 @@ use std::sync::Arc; -use parachain_template_runtime::{opaque::Block, AccountId, Balance, Nonce}; +use parachain_runtime::{opaque::Block, AccountId, Balance, Nonce}; pub use sc_rpc::DenyUnsafe; use sc_transaction_pool_api::TransactionPool; diff --git a/templates/parachain/node/src/service.rs b/templates/parachain/node/src/service.rs index 830b6e82f969..553cd76f81f6 100644 --- a/templates/parachain/node/src/service.rs +++ b/templates/parachain/node/src/service.rs @@ -5,7 +5,7 @@ use std::{sync::Arc, time::Duration}; use cumulus_client_cli::CollatorOptions; // Local Runtime Types -use parachain_template_runtime::{ +use parachain_runtime::{ opaque::{Block, Hash}, RuntimeApi, }; @@ -43,11 +43,11 @@ impl sc_executor::NativeExecutionDispatch for ParachainNativeExecutor { type ExtendHostFunctions = frame_benchmarking::benchmarking::HostFunctions; fn dispatch(method: &str, data: &[u8]) -> Option> { - parachain_template_runtime::api::dispatch(method, data) + parachain_runtime::api::dispatch(method, data) } fn native_version() -> sc_executor::NativeVersion { - parachain_template_runtime::native_version() + parachain_runtime::native_version() } } diff --git a/templates/parachain/pallets/template/Cargo.toml b/templates/parachain/pallets/template/Cargo.toml index 04858a161fa4..f2457d43edfd 100644 --- a/templates/parachain/pallets/template/Cargo.toml +++ b/templates/parachain/pallets/template/Cargo.toml @@ -1,12 +1,13 @@ [package] name = "pallet-parachain-template" -authors = ["Anonymous"] +version = "4.0.0-dev" description = "FRAME pallet template for defining custom runtime logic." -version = "0.7.0" -license = "Unlicense" -homepage = "https://substrate.io" +authors.workspace = true +homepage.workspace = true repository.workspace = true edition.workspace = true +license = "MIT-0" +publish = false [lints] workspace = true @@ -15,21 +16,22 @@ workspace = true targets = ["x86_64-unknown-linux-gnu"] [dependencies] -codec = { package = "parity-scale-codec", version = "3.0.0", features = ["derive"], default-features = false } -scale-info = { version = "2.10.0", default-features = false, features = ["derive"] } +codec = { package = "parity-scale-codec", version = "3.6.1", default-features = false, features = [ + "derive", +] } +scale-info = { version = "2.10.0", default-features = false, features = [ + "derive", +] } -# Substrate +# frame deps frame-benchmarking = { path = "../../../../substrate/frame/benchmarking", default-features = false, optional = true } frame-support = { path = "../../../../substrate/frame/support", default-features = false } frame-system = { path = "../../../../substrate/frame/system", default-features = false } [dev-dependencies] -serde = { workspace = true, default-features = true } - -# Substrate -sp-core = { path = "../../../../substrate/primitives/core", default-features = false } -sp-io = { path = "../../../../substrate/primitives/io", default-features = false } -sp-runtime = { path = "../../../../substrate/primitives/runtime", default-features = false } +sp-core = { path = "../../../../substrate/primitives/core" } +sp-io = { path = "../../../../substrate/primitives/io" } +sp-runtime = { path = "../../../../substrate/primitives/runtime" } [features] default = ["std"] @@ -41,7 +43,7 @@ runtime-benchmarks = [ ] std = [ "codec/std", - "frame-benchmarking/std", + "frame-benchmarking?/std", "frame-support/std", "frame-system/std", "scale-info/std", diff --git a/templates/parachain/pallets/template/README.md b/templates/parachain/pallets/template/README.md index 5a6461233465..9e4dc55267d6 100644 --- a/templates/parachain/pallets/template/README.md +++ b/templates/parachain/pallets/template/README.md @@ -1 +1 @@ -License: Unlicense +License: MIT-0 diff --git a/templates/parachain/pallets/template/src/benchmarking.rs b/templates/parachain/pallets/template/src/benchmarking.rs index 8bba2a09867d..5a262417629c 100644 --- a/templates/parachain/pallets/template/src/benchmarking.rs +++ b/templates/parachain/pallets/template/src/benchmarking.rs @@ -1,20 +1,35 @@ -//! Benchmarking setup for pallet-parachain-template - +//! Benchmarking setup for pallet-template +#![cfg(feature = "runtime-benchmarks")] use super::*; #[allow(unused)] use crate::Pallet as Template; -use frame_benchmarking::{benchmarks, impl_benchmark_test_suite, whitelisted_caller}; +use frame_benchmarking::v2::*; use frame_system::RawOrigin; -benchmarks! { - do_something { - let s in 0 .. 100; +#[benchmarks] +mod benchmarks { + use super::*; + + #[benchmark] + fn do_something() { + let value = 100u32.into(); let caller: T::AccountId = whitelisted_caller(); - }: _(RawOrigin::Signed(caller), s) - verify { - assert_eq!(Something::::get(), Some(s)); + #[extrinsic_call] + do_something(RawOrigin::Signed(caller), value); + + assert_eq!(Something::::get(), Some(value)); } -} -impl_benchmark_test_suite!(Template, crate::mock::new_test_ext(), crate::mock::Test,); + #[benchmark] + fn cause_error() { + Something::::put(100u32); + let caller: T::AccountId = whitelisted_caller(); + #[extrinsic_call] + cause_error(RawOrigin::Signed(caller)); + + assert_eq!(Something::::get(), Some(101u32)); + } + + impl_benchmark_test_suite!(Template, crate::mock::new_test_ext(), crate::mock::Test); +} diff --git a/templates/parachain/pallets/template/src/lib.rs b/templates/parachain/pallets/template/src/lib.rs index 24226d6cf406..03f7954d55c9 100644 --- a/templates/parachain/pallets/template/src/lib.rs +++ b/templates/parachain/pallets/template/src/lib.rs @@ -11,6 +11,8 @@ mod mock; #[cfg(test)] mod tests; +pub mod weights; + #[cfg(feature = "runtime-benchmarks")] mod benchmarking; @@ -24,6 +26,8 @@ pub mod pallet { pub trait Config: frame_system::Config { /// Because this pallet emits events, it depends on the runtime's definition of an event. type RuntimeEvent: From> + IsType<::RuntimeEvent>; + /// A type representing the weights required by the dispatchables of this pallet. + type WeightInfo: WeightInfo; } #[pallet::pallet] diff --git a/templates/solo-chain/pallets/template/src/weights.rs b/templates/parachain/pallets/template/src/weights.rs similarity index 100% rename from templates/solo-chain/pallets/template/src/weights.rs rename to templates/parachain/pallets/template/src/weights.rs diff --git a/templates/parachain/runtime/Cargo.toml b/templates/parachain/runtime/Cargo.toml index 44d96ffc4e62..70f0f595543e 100644 --- a/templates/parachain/runtime/Cargo.toml +++ b/templates/parachain/runtime/Cargo.toml @@ -1,12 +1,13 @@ [package] -name = "parachain-template-runtime" -version = "0.7.0" -authors = ["Anonymous"] -description = "A new Cumulus FRAME-based Substrate Runtime, ready for hacking together a parachain." -license = "Unlicense" -homepage = "https://substrate.io" +name = "parachain-runtime" +version = "0.0.0" +description = "A parachain runtime template built with Substrate and Cumulus, part of Polkadot Sdk." +authors.workspace = true +homepage.workspace = true repository.workspace = true edition.workspace = true +license = "MIT-0" +publish = false [lints] workspace = true @@ -18,16 +19,20 @@ targets = ["x86_64-unknown-linux-gnu"] substrate-wasm-builder = { path = "../../../substrate/utils/wasm-builder", optional = true } [dependencies] -codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } +codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = [ + "derive", +] } hex-literal = { version = "0.4.1", optional = true } log = { workspace = true } -scale-info = { version = "2.10.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.10.0", default-features = false, features = [ + "derive", +] } smallvec = "1.11.0" # Local pallet-parachain-template = { path = "../pallets/template", default-features = false } -# Substrate +# Substrate / FRAME frame-benchmarking = { path = "../../../substrate/frame/benchmarking", default-features = false, optional = true } frame-executive = { path = "../../../substrate/frame/executive", default-features = false } frame-support = { path = "../../../substrate/frame/support", default-features = false } @@ -35,6 +40,8 @@ frame-system = { path = "../../../substrate/frame/system", default-features = fa frame-system-benchmarking = { path = "../../../substrate/frame/system/benchmarking", default-features = false, optional = true } frame-system-rpc-runtime-api = { path = "../../../substrate/frame/system/rpc/runtime-api", default-features = false } frame-try-runtime = { path = "../../../substrate/frame/try-runtime", default-features = false, optional = true } + +# FRAME Pallets pallet-aura = { path = "../../../substrate/frame/aura", default-features = false } pallet-authorship = { path = "../../../substrate/frame/authorship", default-features = false } pallet-balances = { path = "../../../substrate/frame/balances", default-features = false } @@ -44,6 +51,8 @@ pallet-sudo = { path = "../../../substrate/frame/sudo", default-features = false pallet-timestamp = { path = "../../../substrate/frame/timestamp", default-features = false } pallet-transaction-payment = { path = "../../../substrate/frame/transaction-payment", default-features = false } pallet-transaction-payment-rpc-runtime-api = { path = "../../../substrate/frame/transaction-payment/rpc/runtime-api", default-features = false } + +# Substrate Primitives sp-api = { path = "../../../substrate/primitives/api", default-features = false } sp-block-builder = { path = "../../../substrate/primitives/block-builder", default-features = false } sp-consensus-aura = { path = "../../../substrate/primitives/consensus/aura", default-features = false } @@ -66,16 +75,18 @@ xcm-builder = { package = "staging-xcm-builder", path = "../../../polkadot/xcm/x xcm-executor = { package = "staging-xcm-executor", path = "../../../polkadot/xcm/xcm-executor", default-features = false } # Cumulus -cumulus-pallet-aura-ext = { path = "../../pallets/aura-ext", default-features = false } -cumulus-pallet-parachain-system = { path = "../../pallets/parachain-system", default-features = false, features = ["parameterized-consensus-hook"] } -cumulus-pallet-session-benchmarking = { path = "../../pallets/session-benchmarking", default-features = false } -cumulus-pallet-xcm = { path = "../../pallets/xcm", default-features = false } -cumulus-pallet-xcmp-queue = { path = "../../pallets/xcmp-queue", default-features = false } -cumulus-primitives-core = { path = "../../primitives/core", default-features = false } -cumulus-primitives-utility = { path = "../../primitives/utility", default-features = false } -pallet-collator-selection = { path = "../../pallets/collator-selection", default-features = false } -parachains-common = { path = "../../parachains/common", default-features = false } -parachain-info = { package = "staging-parachain-info", path = "../../parachains/pallets/parachain-info", default-features = false } +cumulus-pallet-aura-ext = { path = "../../../cumulus/pallets/aura-ext", default-features = false } +cumulus-pallet-parachain-system = { path = "../../../cumulus/pallets/parachain-system", default-features = false, features = [ + "parameterized-consensus-hook", +] } +cumulus-pallet-session-benchmarking = { path = "../../../cumulus/pallets/session-benchmarking", default-features = false } +cumulus-pallet-xcm = { path = "../../../cumulus/pallets/xcm", default-features = false } +cumulus-pallet-xcmp-queue = { path = "../../../cumulus/pallets/xcmp-queue", default-features = false } +cumulus-primitives-core = { path = "../../../cumulus/primitives/core", default-features = false } +cumulus-primitives-utility = { path = "../../../cumulus/primitives/utility", default-features = false } +pallet-collator-selection = { path = "../../../cumulus/pallets/collator-selection", default-features = false } +parachains-common = { path = "../../../cumulus/parachains/common", default-features = false } +parachain-info = { package = "staging-parachain-info", path = "../../../cumulus/parachains/pallets/parachain-info", default-features = false } [features] default = ["std"] diff --git a/templates/parachain/runtime/src/lib.rs b/templates/parachain/runtime/src/lib.rs index d9bc111fcef7..f926464f2cd1 100644 --- a/templates/parachain/runtime/src/lib.rs +++ b/templates/parachain/runtime/src/lib.rs @@ -488,6 +488,7 @@ impl pallet_collator_selection::Config for Runtime { /// Configure the pallet template in pallets/template. impl pallet_parachain_template::Config for Runtime { type RuntimeEvent = RuntimeEvent; + type WeightInfo = pallet_parachain_template::weights::SubstrateWeight; } // Create the runtime by composing the FRAME pallets that were previously configured. diff --git a/templates/solo-chain/LICENSE b/templates/solochain/LICENSE similarity index 100% rename from templates/solo-chain/LICENSE rename to templates/solochain/LICENSE diff --git a/templates/solo-chain/README.md b/templates/solochain/README.md similarity index 100% rename from templates/solo-chain/README.md rename to templates/solochain/README.md diff --git a/templates/solo-chain/docs/rust-setup.md b/templates/solochain/docs/rust-setup.md similarity index 100% rename from templates/solo-chain/docs/rust-setup.md rename to templates/solochain/docs/rust-setup.md diff --git a/templates/solo-chain/env-setup/README.md b/templates/solochain/env-setup/README.md similarity index 100% rename from templates/solo-chain/env-setup/README.md rename to templates/solochain/env-setup/README.md diff --git a/templates/solo-chain/env-setup/flake.lock b/templates/solochain/env-setup/flake.lock similarity index 100% rename from templates/solo-chain/env-setup/flake.lock rename to templates/solochain/env-setup/flake.lock diff --git a/templates/solo-chain/env-setup/flake.nix b/templates/solochain/env-setup/flake.nix similarity index 100% rename from templates/solo-chain/env-setup/flake.nix rename to templates/solochain/env-setup/flake.nix diff --git a/templates/solo-chain/env-setup/rust-toolchain.toml b/templates/solochain/env-setup/rust-toolchain.toml similarity index 100% rename from templates/solo-chain/env-setup/rust-toolchain.toml rename to templates/solochain/env-setup/rust-toolchain.toml diff --git a/templates/solo-chain/node/Cargo.toml b/templates/solochain/node/Cargo.toml similarity index 93% rename from templates/solo-chain/node/Cargo.toml rename to templates/solochain/node/Cargo.toml index 055d86b31d41..c3e1048f3b06 100644 --- a/templates/solo-chain/node/Cargo.toml +++ b/templates/solochain/node/Cargo.toml @@ -1,7 +1,7 @@ [package] -name = "solo-chain-node" +name = "solochain-node" version = "4.0.0-dev" -description = "A solo-chain node template built with Substrate, part of Polkadot Sdk." +description = "A solochain node template built with Substrate, part of Polkadot Sdk." authors.workspace = true homepage.workspace = true repository.workspace = true @@ -16,7 +16,7 @@ workspace = true targets = ["x86_64-unknown-linux-gnu"] [[bin]] -name = "solo-chain-node" +name = "solochain-node" [dependencies] clap = { version = "4.5.1", features = ["derive"] } @@ -63,7 +63,7 @@ substrate-frame-rpc-system = { path = "../../../substrate/utils/frame/rpc/system frame-benchmarking-cli = { path = "../../../substrate/utils/frame/benchmarking-cli" } # Local Dependencies -solo-chain-runtime = { path = "../runtime" } +solochain-runtime = { path = "../runtime" } # CLI-specific dependencies try-runtime-cli = { path = "../../../substrate/utils/frame/try-runtime/cli", optional = true } @@ -77,7 +77,7 @@ default = [] runtime-benchmarks = [ "frame-benchmarking-cli/runtime-benchmarks", "frame-system/runtime-benchmarks", - "solo-chain-runtime/runtime-benchmarks", + "solochain-runtime/runtime-benchmarks", "sc-service/runtime-benchmarks", "sp-runtime/runtime-benchmarks", ] @@ -85,7 +85,7 @@ runtime-benchmarks = [ # in the near future. try-runtime = [ "frame-system/try-runtime", - "solo-chain-runtime/try-runtime", + "solochain-runtime/try-runtime", "pallet-transaction-payment/try-runtime", "sp-runtime/try-runtime", "try-runtime-cli/try-runtime", diff --git a/templates/solo-chain/node/build.rs b/templates/solochain/node/build.rs similarity index 100% rename from templates/solo-chain/node/build.rs rename to templates/solochain/node/build.rs diff --git a/templates/solo-chain/node/src/benchmarking.rs b/templates/solochain/node/src/benchmarking.rs similarity index 99% rename from templates/solo-chain/node/src/benchmarking.rs rename to templates/solochain/node/src/benchmarking.rs index 7bc136b88f96..7d5ffc9d3127 100644 --- a/templates/solo-chain/node/src/benchmarking.rs +++ b/templates/solochain/node/src/benchmarking.rs @@ -7,7 +7,7 @@ use crate::service::FullClient; use runtime::{AccountId, Balance, BalancesCall, SystemCall}; use sc_cli::Result; use sc_client_api::BlockBackend; -use solo_chain_runtime as runtime; +use solochain_runtime as runtime; use sp_core::{Encode, Pair}; use sp_inherents::{InherentData, InherentDataProvider}; use sp_keyring::Sr25519Keyring; diff --git a/templates/solo-chain/node/src/chain_spec.rs b/templates/solochain/node/src/chain_spec.rs similarity index 97% rename from templates/solo-chain/node/src/chain_spec.rs rename to templates/solochain/node/src/chain_spec.rs index 8e796fa258a0..533c42c11f50 100644 --- a/templates/solo-chain/node/src/chain_spec.rs +++ b/templates/solochain/node/src/chain_spec.rs @@ -1,5 +1,5 @@ use sc_service::ChainType; -use solo_chain_runtime::{AccountId, RuntimeGenesisConfig, Signature, WASM_BINARY}; +use solochain_runtime::{AccountId, RuntimeGenesisConfig, Signature, WASM_BINARY}; use sp_consensus_aura::sr25519::AuthorityId as AuraId; use sp_consensus_grandpa::AuthorityId as GrandpaId; use sp_core::{sr25519, Pair, Public}; diff --git a/templates/solo-chain/node/src/cli.rs b/templates/solochain/node/src/cli.rs similarity index 100% rename from templates/solo-chain/node/src/cli.rs rename to templates/solochain/node/src/cli.rs diff --git a/templates/solo-chain/node/src/command.rs b/templates/solochain/node/src/command.rs similarity index 99% rename from templates/solo-chain/node/src/command.rs rename to templates/solochain/node/src/command.rs index 24b83613f3f4..4f51aeb84e22 100644 --- a/templates/solo-chain/node/src/command.rs +++ b/templates/solochain/node/src/command.rs @@ -7,7 +7,7 @@ use crate::{ use frame_benchmarking_cli::{BenchmarkCmd, ExtrinsicFactory, SUBSTRATE_REFERENCE_HARDWARE}; use sc_cli::SubstrateCli; use sc_service::PartialComponents; -use solo_chain_runtime::{Block, EXISTENTIAL_DEPOSIT}; +use solochain_runtime::{Block, EXISTENTIAL_DEPOSIT}; use sp_keyring::Sr25519Keyring; impl SubstrateCli for Cli { diff --git a/templates/solo-chain/node/src/main.rs b/templates/solochain/node/src/main.rs similarity index 100% rename from templates/solo-chain/node/src/main.rs rename to templates/solochain/node/src/main.rs diff --git a/templates/solo-chain/node/src/rpc.rs b/templates/solochain/node/src/rpc.rs similarity index 97% rename from templates/solo-chain/node/src/rpc.rs rename to templates/solochain/node/src/rpc.rs index 1760c49d6fd3..c68920c47131 100644 --- a/templates/solo-chain/node/src/rpc.rs +++ b/templates/solochain/node/src/rpc.rs @@ -9,7 +9,7 @@ use std::sync::Arc; use jsonrpsee::RpcModule; use sc_transaction_pool_api::TransactionPool; -use solo_chain_runtime::{opaque::Block, AccountId, Balance, Nonce}; +use solochain_runtime::{opaque::Block, AccountId, Balance, Nonce}; use sp_api::ProvideRuntimeApi; use sp_block_builder::BlockBuilder; use sp_blockchain::{Error as BlockChainError, HeaderBackend, HeaderMetadata}; diff --git a/templates/solo-chain/node/src/service.rs b/templates/solochain/node/src/service.rs similarity index 99% rename from templates/solo-chain/node/src/service.rs rename to templates/solochain/node/src/service.rs index b2131af2858d..27cc6957cba5 100644 --- a/templates/solo-chain/node/src/service.rs +++ b/templates/solochain/node/src/service.rs @@ -7,7 +7,7 @@ use sc_consensus_grandpa::SharedVoterState; use sc_service::{error::Error as ServiceError, Configuration, TaskManager, WarpSyncParams}; use sc_telemetry::{Telemetry, TelemetryWorker}; use sc_transaction_pool_api::OffchainTransactionPoolFactory; -use solo_chain_runtime::{self, opaque::Block, RuntimeApi}; +use solochain_runtime::{self, opaque::Block, RuntimeApi}; use sp_consensus_aura::sr25519::AuthorityPair as AuraPair; use std::{sync::Arc, time::Duration}; diff --git a/templates/solo-chain/pallets/template/Cargo.toml b/templates/solochain/pallets/template/Cargo.toml similarity index 100% rename from templates/solo-chain/pallets/template/Cargo.toml rename to templates/solochain/pallets/template/Cargo.toml diff --git a/templates/solo-chain/pallets/template/README.md b/templates/solochain/pallets/template/README.md similarity index 100% rename from templates/solo-chain/pallets/template/README.md rename to templates/solochain/pallets/template/README.md diff --git a/templates/solo-chain/pallets/template/src/benchmarking.rs b/templates/solochain/pallets/template/src/benchmarking.rs similarity index 100% rename from templates/solo-chain/pallets/template/src/benchmarking.rs rename to templates/solochain/pallets/template/src/benchmarking.rs diff --git a/templates/solo-chain/pallets/template/src/lib.rs b/templates/solochain/pallets/template/src/lib.rs similarity index 100% rename from templates/solo-chain/pallets/template/src/lib.rs rename to templates/solochain/pallets/template/src/lib.rs diff --git a/templates/solo-chain/pallets/template/src/mock.rs b/templates/solochain/pallets/template/src/mock.rs similarity index 100% rename from templates/solo-chain/pallets/template/src/mock.rs rename to templates/solochain/pallets/template/src/mock.rs diff --git a/templates/solo-chain/pallets/template/src/tests.rs b/templates/solochain/pallets/template/src/tests.rs similarity index 100% rename from templates/solo-chain/pallets/template/src/tests.rs rename to templates/solochain/pallets/template/src/tests.rs diff --git a/templates/solochain/pallets/template/src/weights.rs b/templates/solochain/pallets/template/src/weights.rs new file mode 100644 index 000000000000..7c42936e09f2 --- /dev/null +++ b/templates/solochain/pallets/template/src/weights.rs @@ -0,0 +1,90 @@ + +//! Autogenerated weights for pallet_template +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-04-06, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `Alexs-MacBook-Pro-2.local`, CPU: `` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 + +// Executed Command: +// ../../target/release/node-template +// benchmark +// pallet +// --chain +// dev +// --pallet +// pallet_template +// --extrinsic +// * +// --steps=50 +// --repeat=20 +// --wasm-execution=compiled +// --output +// pallets/template/src/weights.rs +// --template +// ../../.maintain/frame-weight-template.hbs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use core::marker::PhantomData; + +/// Weight functions needed for pallet_template. +pub trait WeightInfo { + fn do_something() -> Weight; + fn cause_error() -> Weight; +} + +/// Weights for pallet_template using the Substrate node and recommended hardware. +pub struct SubstrateWeight(PhantomData); +impl WeightInfo for SubstrateWeight { + /// Storage: TemplateModule Something (r:0 w:1) + /// Proof: TemplateModule Something (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + fn do_something() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 8_000_000 picoseconds. + Weight::from_parts(9_000_000, 0) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: TemplateModule Something (r:1 w:1) + /// Proof: TemplateModule Something (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + fn cause_error() -> Weight { + // Proof Size summary in bytes: + // Measured: `32` + // Estimated: `1489` + // Minimum execution time: 6_000_000 picoseconds. + Weight::from_parts(6_000_000, 1489) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } +} + +// For backwards compatibility and tests +impl WeightInfo for () { + /// Storage: TemplateModule Something (r:0 w:1) + /// Proof: TemplateModule Something (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + fn do_something() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 8_000_000 picoseconds. + Weight::from_parts(9_000_000, 0) + .saturating_add(RocksDbWeight::get().writes(1_u64)) + } + /// Storage: TemplateModule Something (r:1 w:1) + /// Proof: TemplateModule Something (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + fn cause_error() -> Weight { + // Proof Size summary in bytes: + // Measured: `32` + // Estimated: `1489` + // Minimum execution time: 6_000_000 picoseconds. + Weight::from_parts(6_000_000, 1489) + .saturating_add(RocksDbWeight::get().reads(1_u64)) + .saturating_add(RocksDbWeight::get().writes(1_u64)) + } +} diff --git a/templates/solo-chain/runtime/Cargo.toml b/templates/solochain/runtime/Cargo.toml similarity index 97% rename from templates/solo-chain/runtime/Cargo.toml rename to templates/solochain/runtime/Cargo.toml index 65973c6fc289..9866c001f36f 100644 --- a/templates/solo-chain/runtime/Cargo.toml +++ b/templates/solochain/runtime/Cargo.toml @@ -1,7 +1,7 @@ [package] -name = "solo-chain-runtime" +name = "solochain-runtime" version = "0.0.0" -description = "A solo-chain runtime template built with Substrate, part of Polkadot Sdk." +description = "A solochain runtime template built with Substrate, part of Polkadot Sdk." authors.workspace = true homepage.workspace = true repository.workspace = true diff --git a/templates/solo-chain/runtime/build.rs b/templates/solochain/runtime/build.rs similarity index 100% rename from templates/solo-chain/runtime/build.rs rename to templates/solochain/runtime/build.rs diff --git a/templates/solo-chain/runtime/src/lib.rs b/templates/solochain/runtime/src/lib.rs similarity index 100% rename from templates/solo-chain/runtime/src/lib.rs rename to templates/solochain/runtime/src/lib.rs From 9133b82088d4b0e6901c01eedfd4f2d635d639f9 Mon Sep 17 00:00:00 2001 From: kianenigma Date: Fri, 23 Feb 2024 13:07:55 +0000 Subject: [PATCH 06/21] fix --- .github/workflows/docs.yml | 30 ------------------- .../parachain/pallets/template/src/lib.rs | 2 +- 2 files changed, 1 insertion(+), 31 deletions(-) delete mode 100644 .github/workflows/docs.yml diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml deleted file mode 100644 index 78f3e3d52bb4..000000000000 --- a/.github/workflows/docs.yml +++ /dev/null @@ -1,30 +0,0 @@ -name: Rust Docs - -on: - push: - branches: [kiz-umbrella-crates] - -jobs: - docs: - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v2 - - - name: Setup Rust - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - override: true - components: rust-docs - target: wasm32-unknown-unknown - - - name: Generate docs - run: cargo doc -p developer-hub - - - name: Deploy - uses: JamesIves/github-pages-deploy-action@v4 - with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - BRANCH: gh-pages # The branch the action should deploy to. - FOLDER: target/doc # The folder the action should deploy. diff --git a/templates/parachain/pallets/template/src/lib.rs b/templates/parachain/pallets/template/src/lib.rs index 03f7954d55c9..11587d1df426 100644 --- a/templates/parachain/pallets/template/src/lib.rs +++ b/templates/parachain/pallets/template/src/lib.rs @@ -27,7 +27,7 @@ pub mod pallet { /// Because this pallet emits events, it depends on the runtime's definition of an event. type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// A type representing the weights required by the dispatchables of this pallet. - type WeightInfo: WeightInfo; + type WeightInfo: crate::weights::WeightInfo; } #[pallet::pallet] From ce03571a65b4da83918cb7e0fcd28972893fed8e Mon Sep 17 00:00:00 2001 From: kianenigma Date: Fri, 23 Feb 2024 13:14:43 +0000 Subject: [PATCH 07/21] fix mock --- templates/parachain/pallets/template/src/mock.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/templates/parachain/pallets/template/src/mock.rs b/templates/parachain/pallets/template/src/mock.rs index 411a16b116c8..f510a8b773ac 100644 --- a/templates/parachain/pallets/template/src/mock.rs +++ b/templates/parachain/pallets/template/src/mock.rs @@ -51,6 +51,7 @@ impl system::Config for Test { impl crate::Config for Test { type RuntimeEvent = RuntimeEvent; + type WeightInfo = (); } // Build genesis storage according to the mock runtime. From 3f0dde935df7c0053d49f3b0107b0b156f169510 Mon Sep 17 00:00:00 2001 From: kianenigma Date: Fri, 23 Feb 2024 13:19:54 +0000 Subject: [PATCH 08/21] remove more crates --- .github/scripts/check-workspace.py | 22 +-- .../bin/node-template/runtime/Cargo.toml | 125 ------------------ 2 files changed, 11 insertions(+), 136 deletions(-) delete mode 100644 substrate/bin/node-template/runtime/Cargo.toml diff --git a/.github/scripts/check-workspace.py b/.github/scripts/check-workspace.py index d200122fee9f..1f8f103e4e15 100644 --- a/.github/scripts/check-workspace.py +++ b/.github/scripts/check-workspace.py @@ -18,7 +18,7 @@ def parse_args(): parser.add_argument('workspace_dir', help='The directory to check', metavar='workspace_dir', type=str, nargs=1) parser.add_argument('--exclude', help='Exclude crate paths from the check', metavar='exclude', type=str, nargs='*', default=[]) - + args = parser.parse_args() return (args.workspace_dir[0], args.exclude) @@ -26,7 +26,7 @@ def main(root, exclude): workspace_crates = get_members(root, exclude) all_crates = get_crates(root, exclude) print(f'📦 Found {len(all_crates)} crates in total') - + check_duplicates(workspace_crates) check_missing(workspace_crates, all_crates) check_links(all_crates) @@ -48,14 +48,14 @@ def get_members(workspace_dir, exclude): if not 'members' in root_manifest['workspace']: return [] - + members = [] for member in root_manifest['workspace']['members']: if member in exclude: print(f'❌ Excluded member should not appear in the workspace {member}') sys.exit(1) members.append(member) - + return members # List all members of the workspace. @@ -74,12 +74,12 @@ def get_crates(workspace_dir, exclude_crates) -> dict: with open(path, "r") as f: content = f.read() manifest = toml.loads(content) - + if 'workspace' in manifest: if root != workspace_dir: print("⏩ Excluded recursive workspace at %s" % path) continue - + # Cut off the root path and the trailing /Cargo.toml. path = path[len(workspace_dir)+1:-11] name = manifest['package']['name'] @@ -87,7 +87,7 @@ def get_crates(workspace_dir, exclude_crates) -> dict: print("⏩ Excluded crate %s at %s" % (name, path)) continue crates[name] = (path, manifest) - + return crates # Check that there are no duplicate entries in the workspace. @@ -138,23 +138,23 @@ def check_deps(deps): if not 'path' in deps[dep]: broken.append((name, dep_name, "crate must be linked via `path`")) return - + def check_crate(deps): to_checks = ['dependencies', 'dev-dependencies', 'build-dependencies'] for to_check in to_checks: if to_check in deps: check_deps(deps[to_check]) - + # There could possibly target dependant deps: if 'target' in manifest: # Target dependant deps can only have one level of nesting: for _, target in manifest['target'].items(): check_crate(target) - + check_crate(manifest) - + links.sort() broken.sort() diff --git a/substrate/bin/node-template/runtime/Cargo.toml b/substrate/bin/node-template/runtime/Cargo.toml deleted file mode 100644 index 86bab0ca375a..000000000000 --- a/substrate/bin/node-template/runtime/Cargo.toml +++ /dev/null @@ -1,125 +0,0 @@ -[package] -name = "node-template-runtime" -version = "4.0.0-dev" -description = "A fresh FRAME-based Substrate node, ready for hacking." -authors = ["Substrate DevHub "] -homepage = "https://substrate.io/" -edition.workspace = true -license = "MIT-0" -publish = false -repository = "https://github.com/substrate-developer-hub/substrate-node-template/" - -[lints] -workspace = true - -[package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu"] - -[dependencies] -codec = { package = "parity-scale-codec", version = "3.6.1", default-features = false, features = ["derive"] } -scale-info = { version = "2.10.0", default-features = false, features = ["derive", "serde"] } - -pallet-aura = { path = "../../../frame/aura", default-features = false } -pallet-balances = { path = "../../../frame/balances", default-features = false } -frame-support = { path = "../../../frame/support", default-features = false } -pallet-grandpa = { path = "../../../frame/grandpa", default-features = false } -pallet-sudo = { path = "../../../frame/sudo", default-features = false } -frame-system = { path = "../../../frame/system", default-features = false } -frame-try-runtime = { path = "../../../frame/try-runtime", default-features = false, optional = true } -pallet-timestamp = { path = "../../../frame/timestamp", default-features = false } -pallet-transaction-payment = { path = "../../../frame/transaction-payment", default-features = false } -frame-executive = { path = "../../../frame/executive", default-features = false } -sp-api = { path = "../../../primitives/api", default-features = false } -sp-block-builder = { path = "../../../primitives/block-builder", default-features = false } -sp-consensus-aura = { path = "../../../primitives/consensus/aura", default-features = false, features = ["serde"] } -sp-consensus-grandpa = { path = "../../../primitives/consensus/grandpa", default-features = false, features = ["serde"] } -sp-core = { path = "../../../primitives/core", default-features = false, features = ["serde"] } -sp-inherents = { path = "../../../primitives/inherents", default-features = false } -sp-offchain = { path = "../../../primitives/offchain", default-features = false } -sp-runtime = { path = "../../../primitives/runtime", default-features = false, features = ["serde"] } -sp-session = { path = "../../../primitives/session", default-features = false } -sp-std = { path = "../../../primitives/std", default-features = false } -sp-storage = { path = "../../../primitives/storage", default-features = false } -sp-transaction-pool = { path = "../../../primitives/transaction-pool", default-features = false } -sp-version = { path = "../../../primitives/version", default-features = false, features = ["serde"] } -serde_json = { features = ["alloc"], workspace = true } -sp-genesis-builder = { default-features = false, path = "../../../primitives/genesis-builder" } - -# Used for the node template's RPCs -frame-system-rpc-runtime-api = { path = "../../../frame/system/rpc/runtime-api", default-features = false } -pallet-transaction-payment-rpc-runtime-api = { path = "../../../frame/transaction-payment/rpc/runtime-api", default-features = false } - -# Used for runtime benchmarking -frame-benchmarking = { path = "../../../frame/benchmarking", default-features = false, optional = true } -frame-system-benchmarking = { path = "../../../frame/system/benchmarking", default-features = false, optional = true } - -# Local Dependencies -pallet-template = { path = "../pallets/template", default-features = false } - -[build-dependencies] -substrate-wasm-builder = { path = "../../../utils/wasm-builder", optional = true } - -[features] -default = ["std"] -std = [ - "codec/std", - "frame-benchmarking?/std", - "frame-executive/std", - "frame-support/std", - "frame-system-benchmarking?/std", - "frame-system-rpc-runtime-api/std", - "frame-system/std", - "frame-try-runtime?/std", - "pallet-aura/std", - "pallet-balances/std", - "pallet-grandpa/std", - "pallet-sudo/std", - "pallet-template/std", - "pallet-timestamp/std", - "pallet-transaction-payment-rpc-runtime-api/std", - "pallet-transaction-payment/std", - "scale-info/std", - "serde_json/std", - "sp-api/std", - "sp-block-builder/std", - "sp-consensus-aura/std", - "sp-consensus-grandpa/std", - "sp-core/std", - "sp-genesis-builder/std", - "sp-inherents/std", - "sp-offchain/std", - "sp-runtime/std", - "sp-session/std", - "sp-std/std", - "sp-storage/std", - "sp-transaction-pool/std", - "sp-version/std", - "substrate-wasm-builder", -] -runtime-benchmarks = [ - "frame-benchmarking/runtime-benchmarks", - "frame-support/runtime-benchmarks", - "frame-system-benchmarking/runtime-benchmarks", - "frame-system/runtime-benchmarks", - "pallet-balances/runtime-benchmarks", - "pallet-grandpa/runtime-benchmarks", - "pallet-sudo/runtime-benchmarks", - "pallet-template/runtime-benchmarks", - "pallet-timestamp/runtime-benchmarks", - "sp-runtime/runtime-benchmarks", -] -try-runtime = [ - "frame-executive/try-runtime", - "frame-support/try-runtime", - "frame-system/try-runtime", - "frame-try-runtime/try-runtime", - "pallet-aura/try-runtime", - "pallet-balances/try-runtime", - "pallet-grandpa/try-runtime", - "pallet-sudo/try-runtime", - "pallet-template/try-runtime", - "pallet-timestamp/try-runtime", - "pallet-transaction-payment/try-runtime", - "sp-runtime/try-runtime", -] -experimental = ["pallet-aura/experimental"] From 5c2b83639a9247981dda892eee42d6e53209cf59 Mon Sep 17 00:00:00 2001 From: kianenigma Date: Thu, 29 Feb 2024 13:03:54 +0000 Subject: [PATCH 09/21] format toml files --- Cargo.toml | 6 +++--- templates/minimal/pallets/template/Cargo.toml | 2 +- templates/minimal/pallets/template/src/lib.rs | 1 + templates/solochain/node/Cargo.toml | 4 ++-- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 9bdb9864dbc5..a2e22e0b9271 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -498,17 +498,17 @@ members = [ "substrate/utils/prometheus", "substrate/utils/wasm-builder", + "templates/minimal/node", "templates/minimal/pallets/template", "templates/minimal/runtime", - "templates/minimal/node", + "templates/solochain/node", "templates/solochain/pallets/template", "templates/solochain/runtime", - "templates/solochain/node", + "templates/parachain/node", "templates/parachain/pallets/template", "templates/parachain/runtime", - "templates/parachain/node", ] default-members = ["polkadot", "substrate/bin/node/cli"] diff --git a/templates/minimal/pallets/template/Cargo.toml b/templates/minimal/pallets/template/Cargo.toml index 6595902e0dcc..6af11f64f7e7 100644 --- a/templates/minimal/pallets/template/Cargo.toml +++ b/templates/minimal/pallets/template/Cargo.toml @@ -27,4 +27,4 @@ frame = { path = "../../../../substrate/frame", default-features = false } [features] default = ["std"] -std = ["codec/std", "scale-info/std", "frame/std"] +std = ["codec/std", "frame/std", "scale-info/std"] diff --git a/templates/minimal/pallets/template/src/lib.rs b/templates/minimal/pallets/template/src/lib.rs index e0f486638d67..4ba87797164e 100644 --- a/templates/minimal/pallets/template/src/lib.rs +++ b/templates/minimal/pallets/template/src/lib.rs @@ -1,6 +1,7 @@ //! A shell pallet built with [`frame`]. #![cfg_attr(not(feature = "std"), no_std)] + use frame::prelude::*; #[frame::pallet] diff --git a/templates/solochain/node/Cargo.toml b/templates/solochain/node/Cargo.toml index c3e1048f3b06..79e56ee0299c 100644 --- a/templates/solochain/node/Cargo.toml +++ b/templates/solochain/node/Cargo.toml @@ -77,16 +77,16 @@ default = [] runtime-benchmarks = [ "frame-benchmarking-cli/runtime-benchmarks", "frame-system/runtime-benchmarks", - "solochain-runtime/runtime-benchmarks", "sc-service/runtime-benchmarks", + "solochain-runtime/runtime-benchmarks", "sp-runtime/runtime-benchmarks", ] # Enable features that allow the runtime to be tried and debugged. Name might be subject to change # in the near future. try-runtime = [ "frame-system/try-runtime", - "solochain-runtime/try-runtime", "pallet-transaction-payment/try-runtime", + "solochain-runtime/try-runtime", "sp-runtime/try-runtime", "try-runtime-cli/try-runtime", ] From 632bf05ed06d8fe5a95f0fb0422e3d8d74f8f6c2 Mon Sep 17 00:00:00 2001 From: kianenigma Date: Thu, 29 Feb 2024 13:07:57 +0000 Subject: [PATCH 10/21] fix minimal pallet feature flag --- templates/minimal/pallets/template/Cargo.toml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/templates/minimal/pallets/template/Cargo.toml b/templates/minimal/pallets/template/Cargo.toml index 6af11f64f7e7..fd5c58222d99 100644 --- a/templates/minimal/pallets/template/Cargo.toml +++ b/templates/minimal/pallets/template/Cargo.toml @@ -22,7 +22,9 @@ codec = { package = "parity-scale-codec", version = "3.0.0", features = [ scale-info = { version = "2.10.0", default-features = false, features = [ "derive", ] } -frame = { path = "../../../../substrate/frame", default-features = false } +frame = { path = "../../../../substrate/frame", default-features = false, features = [ + "experimental", +] } [features] From 26000e0ebbe964a7c81e9ee303f94b5b83ea8a86 Mon Sep 17 00:00:00 2001 From: kianenigma Date: Thu, 29 Feb 2024 13:35:18 +0000 Subject: [PATCH 11/21] rename a few things back to make the crate names more backwards compatible --- Cargo.lock | 19 ++++++++++--------- templates/minimal/node/Cargo.toml | 6 +++--- templates/minimal/pallets/template/src/lib.rs | 3 +++ templates/minimal/runtime/Cargo.toml | 5 ++++- templates/minimal/runtime/src/lib.rs | 9 +++++++-- templates/parachain/node/Cargo.toml | 8 ++++---- templates/parachain/node/src/chain_spec.rs | 2 +- templates/parachain/node/src/command.rs | 2 +- templates/parachain/node/src/rpc.rs | 2 +- templates/parachain/node/src/service.rs | 6 +++--- templates/parachain/runtime/Cargo.toml | 2 +- templates/solochain/node/Cargo.toml | 10 +++++----- templates/solochain/node/src/benchmarking.rs | 2 +- templates/solochain/node/src/chain_spec.rs | 2 +- templates/solochain/node/src/command.rs | 2 +- templates/solochain/node/src/rpc.rs | 2 +- templates/solochain/node/src/service.rs | 2 +- templates/solochain/runtime/Cargo.toml | 2 +- 18 files changed, 49 insertions(+), 37 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c0acb2ff4458..ed28c94a5d85 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8169,7 +8169,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] -name = "minimal-node" +name = "minimal-template-node" version = "0.0.0" dependencies = [ "clap 4.5.1", @@ -8177,7 +8177,7 @@ dependencies = [ "futures", "futures-timer", "jsonrpsee", - "minimal-runtime", + "minimal-template-runtime", "sc-basic-authorship", "sc-cli", "sc-client-api", @@ -8204,11 +8204,12 @@ dependencies = [ ] [[package]] -name = "minimal-runtime" +name = "minimal-template-runtime" version = "0.0.0" dependencies = [ "frame", "pallet-balances", + "pallet-minimal-template", "pallet-sudo", "pallet-timestamp", "pallet-transaction-payment", @@ -11306,7 +11307,7 @@ dependencies = [ ] [[package]] -name = "parachain-node" +name = "parachain-template-node" version = "0.0.0" dependencies = [ "clap 4.5.1", @@ -11326,7 +11327,7 @@ dependencies = [ "jsonrpsee", "log", "pallet-transaction-payment-rpc", - "parachain-runtime", + "parachain-template-runtime", "parity-scale-codec", "polkadot-cli", "polkadot-primitives", @@ -11364,7 +11365,7 @@ dependencies = [ ] [[package]] -name = "parachain-runtime" +name = "parachain-template-runtime" version = "0.0.0" dependencies = [ "cumulus-pallet-aura-ext", @@ -18270,7 +18271,7 @@ dependencies = [ ] [[package]] -name = "solochain-node" +name = "solochain-template-node" version = "4.0.0-dev" dependencies = [ "clap 4.5.1", @@ -18295,7 +18296,7 @@ dependencies = [ "sc-transaction-pool", "sc-transaction-pool-api", "serde_json", - "solochain-runtime", + "solochain-template-runtime", "sp-api", "sp-block-builder", "sp-blockchain", @@ -18313,7 +18314,7 @@ dependencies = [ ] [[package]] -name = "solochain-runtime" +name = "solochain-template-runtime" version = "0.0.0" dependencies = [ "frame-benchmarking", diff --git a/templates/minimal/node/Cargo.toml b/templates/minimal/node/Cargo.toml index e468b2769613..70c1feefccb0 100644 --- a/templates/minimal/node/Cargo.toml +++ b/templates/minimal/node/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "minimal-node" +name = "minimal-template-node" description = "A miniaml Substrate-based Substrate node, ready for hacking." version = "0.0.0" authors.workspace = true @@ -17,7 +17,7 @@ workspace = true targets = ["x86_64-unknown-linux-gnu"] [[bin]] -name = "minimal-node" +name = "minimal-template-node" [dependencies] clap = { version = "4.5.1", features = ["derive"] } @@ -56,7 +56,7 @@ frame = { path = "../../../substrate/frame", features = [ "experimental", "runtime", ] } -runtime = { package = "minimal-runtime", path = "../runtime" } +runtime = { package = "minimal-template-runtime", path = "../runtime" } [build-dependencies] substrate-build-script-utils = { path = "../../../substrate/utils/build-script-utils" } diff --git a/templates/minimal/pallets/template/src/lib.rs b/templates/minimal/pallets/template/src/lib.rs index 4ba87797164e..713f014bbe61 100644 --- a/templates/minimal/pallets/template/src/lib.rs +++ b/templates/minimal/pallets/template/src/lib.rs @@ -4,6 +4,9 @@ use frame::prelude::*; +// Re-export all pallet parts, this is needed to properly import the pallet into the runtime. +pub use pallet::*; + #[frame::pallet] pub mod pallet { use super::*; diff --git a/templates/minimal/runtime/Cargo.toml b/templates/minimal/runtime/Cargo.toml index 9668bca6f9ba..fdfcb01b7f60 100644 --- a/templates/minimal/runtime/Cargo.toml +++ b/templates/minimal/runtime/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "minimal-runtime" +name = "minimal-template-runtime" version = "0.0.0" description = "A solochain runtime template built with Substrate, part of Polkadot Sdk." authors.workspace = true @@ -32,6 +32,9 @@ pallet-transaction-payment-rpc-runtime-api = { path = "../../../substrate/frame/ # genesis builder that allows us to interacto with runtime genesis config sp-genesis-builder = { path = "../../../substrate/primitives/genesis-builder", default-features = false } +# local pallet templates +pallet-minimal-template = { path = "../pallets/template", default-features = false } + [build-dependencies] substrate-wasm-builder = { path = "../../../substrate/utils/wasm-builder", optional = true } diff --git a/templates/minimal/runtime/src/lib.rs b/templates/minimal/runtime/src/lib.rs index ab8eca5b4874..91859cf4a2f5 100644 --- a/templates/minimal/runtime/src/lib.rs +++ b/templates/minimal/runtime/src/lib.rs @@ -38,8 +38,8 @@ use frame::{ #[runtime_version] pub const VERSION: RuntimeVersion = RuntimeVersion { - spec_name: create_runtime_str!("minimal-runtime"), - impl_name: create_runtime_str!("minimal-runtime"), + spec_name: create_runtime_str!("minimal-template-runtime"), + impl_name: create_runtime_str!("minimal-template-runtime"), authoring_version: 1, spec_version: 0, impl_version: 1, @@ -73,6 +73,9 @@ construct_runtime!( Balances: pallet_balances, Sudo: pallet_sudo, TransactionPayment: pallet_transaction_payment, + + // our local pallet + Template: pallet_minimal_template, } ); @@ -106,6 +109,8 @@ impl pallet_transaction_payment::Config for Runtime { type LengthToFee = FixedFee<1, ::Balance>; } +impl pallet_minimal_template::Config for Runtime {} + type Block = frame::runtime::types_common::BlockOf; type Header = HeaderFor; diff --git a/templates/parachain/node/Cargo.toml b/templates/parachain/node/Cargo.toml index 7faece550f87..0498c16121e5 100644 --- a/templates/parachain/node/Cargo.toml +++ b/templates/parachain/node/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "parachain-node" +name = "parachain-template-node" description = "A parachain node template built with Substrate and Cumulus, part of Polkadot Sdk." version = "0.0.0" authors.workspace = true @@ -23,7 +23,7 @@ futures = "0.3.28" serde_json = { workspace = true, default-features = true } # Local -parachain-runtime = { path = "../runtime" } +parachain-template-runtime = { path = "../runtime" } # Substrate frame-benchmarking = { path = "../../../substrate/frame/benchmarking" } @@ -83,14 +83,14 @@ runtime-benchmarks = [ "cumulus-primitives-core/runtime-benchmarks", "frame-benchmarking-cli/runtime-benchmarks", "frame-benchmarking/runtime-benchmarks", - "parachain-runtime/runtime-benchmarks", + "parachain-template-runtime/runtime-benchmarks", "polkadot-cli/runtime-benchmarks", "polkadot-primitives/runtime-benchmarks", "sc-service/runtime-benchmarks", "sp-runtime/runtime-benchmarks", ] try-runtime = [ - "parachain-runtime/try-runtime", + "parachain-template-runtime/try-runtime", "polkadot-cli/try-runtime", "sp-runtime/try-runtime", ] diff --git a/templates/parachain/node/src/chain_spec.rs b/templates/parachain/node/src/chain_spec.rs index 4a52f7a533f6..16c91865cdb4 100644 --- a/templates/parachain/node/src/chain_spec.rs +++ b/templates/parachain/node/src/chain_spec.rs @@ -1,5 +1,5 @@ use cumulus_primitives_core::ParaId; -use parachain_runtime as runtime; +use parachain_template_runtime as runtime; use runtime::{AccountId, AuraId, Signature, EXISTENTIAL_DEPOSIT}; use sc_chain_spec::{ChainSpecExtension, ChainSpecGroup}; use sc_service::ChainType; diff --git a/templates/parachain/node/src/command.rs b/templates/parachain/node/src/command.rs index f7b983279f8b..82624ae0be59 100644 --- a/templates/parachain/node/src/command.rs +++ b/templates/parachain/node/src/command.rs @@ -4,7 +4,7 @@ use cumulus_client_service::storage_proof_size::HostFunctions as ReclaimHostFunc use cumulus_primitives_core::ParaId; use frame_benchmarking_cli::{BenchmarkCmd, SUBSTRATE_REFERENCE_HARDWARE}; use log::info; -use parachain_runtime::Block; +use parachain_template_runtime::Block; use sc_cli::{ ChainSpec, CliConfiguration, DefaultConfigurationValues, ImportParams, KeystoreParams, NetworkParams, Result, SharedParams, SubstrateCli, diff --git a/templates/parachain/node/src/rpc.rs b/templates/parachain/node/src/rpc.rs index b8afc84a46ca..bb52b974f0ce 100644 --- a/templates/parachain/node/src/rpc.rs +++ b/templates/parachain/node/src/rpc.rs @@ -7,7 +7,7 @@ use std::sync::Arc; -use parachain_runtime::{opaque::Block, AccountId, Balance, Nonce}; +use parachain_template_runtime::{opaque::Block, AccountId, Balance, Nonce}; pub use sc_rpc::DenyUnsafe; use sc_transaction_pool_api::TransactionPool; diff --git a/templates/parachain/node/src/service.rs b/templates/parachain/node/src/service.rs index f862d88594fb..4dd24803e9b1 100644 --- a/templates/parachain/node/src/service.rs +++ b/templates/parachain/node/src/service.rs @@ -5,7 +5,7 @@ use std::{sync::Arc, time::Duration}; use cumulus_client_cli::CollatorOptions; // Local Runtime Types -use parachain_runtime::{ +use parachain_template_runtime::{ opaque::{Block, Hash}, RuntimeApi, }; @@ -46,11 +46,11 @@ impl sc_executor::NativeExecutionDispatch for ParachainNativeExecutor { ); fn dispatch(method: &str, data: &[u8]) -> Option> { - parachain_runtime::api::dispatch(method, data) + parachain_template_runtime::api::dispatch(method, data) } fn native_version() -> sc_executor::NativeVersion { - parachain_runtime::native_version() + parachain_template_runtime::native_version() } } diff --git a/templates/parachain/runtime/Cargo.toml b/templates/parachain/runtime/Cargo.toml index d725428be638..250237342e9a 100644 --- a/templates/parachain/runtime/Cargo.toml +++ b/templates/parachain/runtime/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "parachain-runtime" +name = "parachain-template-runtime" version = "0.0.0" description = "A parachain runtime template built with Substrate and Cumulus, part of Polkadot Sdk." authors.workspace = true diff --git a/templates/solochain/node/Cargo.toml b/templates/solochain/node/Cargo.toml index 79e56ee0299c..c831e45783da 100644 --- a/templates/solochain/node/Cargo.toml +++ b/templates/solochain/node/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "solochain-node" +name = "solochain-template-node" version = "4.0.0-dev" description = "A solochain node template built with Substrate, part of Polkadot Sdk." authors.workspace = true @@ -16,7 +16,7 @@ workspace = true targets = ["x86_64-unknown-linux-gnu"] [[bin]] -name = "solochain-node" +name = "solochain-template-node" [dependencies] clap = { version = "4.5.1", features = ["derive"] } @@ -63,7 +63,7 @@ substrate-frame-rpc-system = { path = "../../../substrate/utils/frame/rpc/system frame-benchmarking-cli = { path = "../../../substrate/utils/frame/benchmarking-cli" } # Local Dependencies -solochain-runtime = { path = "../runtime" } +solochain-template-runtime = { path = "../runtime" } # CLI-specific dependencies try-runtime-cli = { path = "../../../substrate/utils/frame/try-runtime/cli", optional = true } @@ -78,7 +78,7 @@ runtime-benchmarks = [ "frame-benchmarking-cli/runtime-benchmarks", "frame-system/runtime-benchmarks", "sc-service/runtime-benchmarks", - "solochain-runtime/runtime-benchmarks", + "solochain-template-runtime/runtime-benchmarks", "sp-runtime/runtime-benchmarks", ] # Enable features that allow the runtime to be tried and debugged. Name might be subject to change @@ -86,7 +86,7 @@ runtime-benchmarks = [ try-runtime = [ "frame-system/try-runtime", "pallet-transaction-payment/try-runtime", - "solochain-runtime/try-runtime", + "solochain-template-runtime/try-runtime", "sp-runtime/try-runtime", "try-runtime-cli/try-runtime", ] diff --git a/templates/solochain/node/src/benchmarking.rs b/templates/solochain/node/src/benchmarking.rs index 7d5ffc9d3127..d1d8c2ccabaf 100644 --- a/templates/solochain/node/src/benchmarking.rs +++ b/templates/solochain/node/src/benchmarking.rs @@ -7,7 +7,7 @@ use crate::service::FullClient; use runtime::{AccountId, Balance, BalancesCall, SystemCall}; use sc_cli::Result; use sc_client_api::BlockBackend; -use solochain_runtime as runtime; +use solochain_template_runtime as runtime; use sp_core::{Encode, Pair}; use sp_inherents::{InherentData, InherentDataProvider}; use sp_keyring::Sr25519Keyring; diff --git a/templates/solochain/node/src/chain_spec.rs b/templates/solochain/node/src/chain_spec.rs index 533c42c11f50..be49f2c1fc73 100644 --- a/templates/solochain/node/src/chain_spec.rs +++ b/templates/solochain/node/src/chain_spec.rs @@ -1,5 +1,5 @@ use sc_service::ChainType; -use solochain_runtime::{AccountId, RuntimeGenesisConfig, Signature, WASM_BINARY}; +use solochain_template_runtime::{AccountId, RuntimeGenesisConfig, Signature, WASM_BINARY}; use sp_consensus_aura::sr25519::AuthorityId as AuraId; use sp_consensus_grandpa::AuthorityId as GrandpaId; use sp_core::{sr25519, Pair, Public}; diff --git a/templates/solochain/node/src/command.rs b/templates/solochain/node/src/command.rs index 4f51aeb84e22..42d1477f22f1 100644 --- a/templates/solochain/node/src/command.rs +++ b/templates/solochain/node/src/command.rs @@ -7,7 +7,7 @@ use crate::{ use frame_benchmarking_cli::{BenchmarkCmd, ExtrinsicFactory, SUBSTRATE_REFERENCE_HARDWARE}; use sc_cli::SubstrateCli; use sc_service::PartialComponents; -use solochain_runtime::{Block, EXISTENTIAL_DEPOSIT}; +use solochain_template_runtime::{Block, EXISTENTIAL_DEPOSIT}; use sp_keyring::Sr25519Keyring; impl SubstrateCli for Cli { diff --git a/templates/solochain/node/src/rpc.rs b/templates/solochain/node/src/rpc.rs index c68920c47131..fe2b6ca72ede 100644 --- a/templates/solochain/node/src/rpc.rs +++ b/templates/solochain/node/src/rpc.rs @@ -9,7 +9,7 @@ use std::sync::Arc; use jsonrpsee::RpcModule; use sc_transaction_pool_api::TransactionPool; -use solochain_runtime::{opaque::Block, AccountId, Balance, Nonce}; +use solochain_template_runtime::{opaque::Block, AccountId, Balance, Nonce}; use sp_api::ProvideRuntimeApi; use sp_block_builder::BlockBuilder; use sp_blockchain::{Error as BlockChainError, HeaderBackend, HeaderMetadata}; diff --git a/templates/solochain/node/src/service.rs b/templates/solochain/node/src/service.rs index c3e22b15748c..dc25f7579129 100644 --- a/templates/solochain/node/src/service.rs +++ b/templates/solochain/node/src/service.rs @@ -7,7 +7,7 @@ use sc_consensus_grandpa::SharedVoterState; use sc_service::{error::Error as ServiceError, Configuration, TaskManager, WarpSyncParams}; use sc_telemetry::{Telemetry, TelemetryWorker}; use sc_transaction_pool_api::OffchainTransactionPoolFactory; -use solochain_runtime::{self, opaque::Block, RuntimeApi}; +use solochain_template_runtime::{self, opaque::Block, RuntimeApi}; use sp_consensus_aura::sr25519::AuthorityPair as AuraPair; use std::{sync::Arc, time::Duration}; diff --git a/templates/solochain/runtime/Cargo.toml b/templates/solochain/runtime/Cargo.toml index 9866c001f36f..7ffb2348e23c 100644 --- a/templates/solochain/runtime/Cargo.toml +++ b/templates/solochain/runtime/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "solochain-runtime" +name = "solochain-template-runtime" version = "0.0.0" description = "A solochain runtime template built with Substrate, part of Polkadot Sdk." authors.workspace = true From f808428264bcc733d3c463ce5315d237a4d5109e Mon Sep 17 00:00:00 2001 From: kianenigma Date: Fri, 1 Mar 2024 15:59:05 +0000 Subject: [PATCH 12/21] fix build --- substrate/frame/Cargo.toml | 13 +++++++++---- templates/minimal/pallets/template/Cargo.toml | 1 + 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/substrate/frame/Cargo.toml b/substrate/frame/Cargo.toml index 3f148bf4c83b..6746723e72f7 100644 --- a/substrate/frame/Cargo.toml +++ b/substrate/frame/Cargo.toml @@ -19,8 +19,12 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] # external deps -parity-scale-codec = { version = "3.2.2", default-features = false, features = ["derive"] } -scale-info = { version = "2.6.0", default-features = false, features = ["derive"] } +parity-scale-codec = { version = "3.2.2", default-features = false, features = [ + "derive", +] } +scale-info = { version = "2.6.0", default-features = false, features = [ + "derive", +] } # primitive deps, used for developing FRAME pallets. sp-runtime = { default-features = false, path = "../primitives/runtime" } @@ -57,8 +61,6 @@ pallet-examples = { path = "./examples" } default = ["runtime", "std"] experimental = ["frame-support/experimental"] runtime = [ - "frame-executive", - "frame-system-rpc-runtime-api", "sp-api", "sp-block-builder", "sp-consensus-aura", @@ -68,6 +70,9 @@ runtime = [ "sp-session", "sp-transaction-pool", "sp-version", + + "frame-executive", + "frame-system-rpc-runtime-api", ] std = [ "frame-executive?/std", diff --git a/templates/minimal/pallets/template/Cargo.toml b/templates/minimal/pallets/template/Cargo.toml index fd5c58222d99..3d5a25d8da4c 100644 --- a/templates/minimal/pallets/template/Cargo.toml +++ b/templates/minimal/pallets/template/Cargo.toml @@ -24,6 +24,7 @@ scale-info = { version = "2.10.0", default-features = false, features = [ ] } frame = { path = "../../../../substrate/frame", default-features = false, features = [ "experimental", + "runtime", ] } From af1e6792d5b447c71d5df5c0dd7c0d0e2ee2a927 Mon Sep 17 00:00:00 2001 From: kianenigma Date: Mon, 4 Mar 2024 12:29:16 +0000 Subject: [PATCH 13/21] fix --- .gitlab/pipeline/build.yml | 2 +- templates/minimal/runtime/Cargo.toml | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.gitlab/pipeline/build.yml b/.gitlab/pipeline/build.yml index 423587c1fb57..f8de61355725 100644 --- a/.gitlab/pipeline/build.yml +++ b/.gitlab/pipeline/build.yml @@ -337,7 +337,7 @@ build-runtimes-polkavm: - .common-refs - .run-immediately script: - - SUBSTRATE_RUNTIME_TARGET=riscv cargo check -p minimal-runtime + - SUBSTRATE_RUNTIME_TARGET=riscv cargo check -p minimal-template-runtime - SUBSTRATE_RUNTIME_TARGET=riscv cargo check -p westend-runtime - SUBSTRATE_RUNTIME_TARGET=riscv cargo check -p rococo-runtime - SUBSTRATE_RUNTIME_TARGET=riscv cargo check -p polkadot-test-runtime diff --git a/templates/minimal/runtime/Cargo.toml b/templates/minimal/runtime/Cargo.toml index fdfcb01b7f60..9010d8961aaa 100644 --- a/templates/minimal/runtime/Cargo.toml +++ b/templates/minimal/runtime/Cargo.toml @@ -41,14 +41,19 @@ substrate-wasm-builder = { path = "../../../substrate/utils/wasm-builder", optio [features] default = ["std"] std = [ + "parity-scale-codec/std", + "scale-info/std", + "frame/std", + "pallet-balances/std", "pallet-sudo/std", "pallet-timestamp/std", "pallet-transaction-payment-rpc-runtime-api/std", "pallet-transaction-payment/std", - "parity-scale-codec/std", - "scale-info/std", + + "pallet-minimal-template/std", + "sp-genesis-builder/std", "substrate-wasm-builder", ] From 545931678c2441c7fcedc73847c7834db0771b1b Mon Sep 17 00:00:00 2001 From: kianenigma Date: Mon, 4 Mar 2024 12:42:20 +0000 Subject: [PATCH 14/21] unify versions and spec names --- Cargo.lock | 6 +++--- templates/minimal/node/Cargo.toml | 2 +- templates/minimal/pallets/template/Cargo.toml | 4 ++-- templates/minimal/runtime/Cargo.toml | 4 ++-- templates/parachain/node/Cargo.toml | 2 +- templates/parachain/pallets/template/Cargo.toml | 4 ++-- templates/parachain/runtime/Cargo.toml | 4 ++-- templates/parachain/runtime/src/lib.rs | 4 ++-- templates/solochain/node/Cargo.toml | 6 ++++-- templates/solochain/pallets/template/Cargo.toml | 4 ++-- templates/solochain/runtime/Cargo.toml | 4 ++-- templates/solochain/runtime/src/lib.rs | 4 ++-- 12 files changed, 25 insertions(+), 23 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2204cc467eff..a8dae27e06e2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -10526,7 +10526,7 @@ dependencies = [ [[package]] name = "pallet-parachain-template" -version = "4.0.0-dev" +version = "0.0.0" dependencies = [ "frame-benchmarking", "frame-support", @@ -10987,7 +10987,7 @@ dependencies = [ [[package]] name = "pallet-template" -version = "4.0.0-dev" +version = "0.0.0" dependencies = [ "frame-benchmarking", "frame-support", @@ -18279,7 +18279,7 @@ dependencies = [ [[package]] name = "solochain-template-node" -version = "4.0.0-dev" +version = "0.0.0" dependencies = [ "clap 4.5.1", "frame-benchmarking-cli", diff --git a/templates/minimal/node/Cargo.toml b/templates/minimal/node/Cargo.toml index 70c1feefccb0..cbf1076cbeb1 100644 --- a/templates/minimal/node/Cargo.toml +++ b/templates/minimal/node/Cargo.toml @@ -2,11 +2,11 @@ name = "minimal-template-node" description = "A miniaml Substrate-based Substrate node, ready for hacking." version = "0.0.0" +license = "MIT-0" authors.workspace = true homepage.workspace = true repository.workspace = true edition.workspace = true -license = "MIT-0" publish = false build = "build.rs" diff --git a/templates/minimal/pallets/template/Cargo.toml b/templates/minimal/pallets/template/Cargo.toml index 3d5a25d8da4c..9982e5ea53bc 100644 --- a/templates/minimal/pallets/template/Cargo.toml +++ b/templates/minimal/pallets/template/Cargo.toml @@ -1,12 +1,12 @@ [package] name = "pallet-minimal-template" -version = "0.0.0" description = "A minimal pallet built with FRAME, part of Polkadot Sdk." +version = "0.0.0" +license = "MIT-0" authors.workspace = true homepage.workspace = true repository.workspace = true edition.workspace = true -license = "MIT-0" publish = false [lints] diff --git a/templates/minimal/runtime/Cargo.toml b/templates/minimal/runtime/Cargo.toml index 9010d8961aaa..20ffb706eb49 100644 --- a/templates/minimal/runtime/Cargo.toml +++ b/templates/minimal/runtime/Cargo.toml @@ -1,12 +1,12 @@ [package] name = "minimal-template-runtime" -version = "0.0.0" description = "A solochain runtime template built with Substrate, part of Polkadot Sdk." +version = "0.0.0" +license = "MIT-0" authors.workspace = true homepage.workspace = true repository.workspace = true edition.workspace = true -license = "MIT-0" publish = false [lints] diff --git a/templates/parachain/node/Cargo.toml b/templates/parachain/node/Cargo.toml index 0498c16121e5..a0495c4d6fa1 100644 --- a/templates/parachain/node/Cargo.toml +++ b/templates/parachain/node/Cargo.toml @@ -2,11 +2,11 @@ name = "parachain-template-node" description = "A parachain node template built with Substrate and Cumulus, part of Polkadot Sdk." version = "0.0.0" +license = "MIT-0" authors.workspace = true homepage.workspace = true repository.workspace = true edition.workspace = true -license = "MIT-0" publish = false build = "build.rs" diff --git a/templates/parachain/pallets/template/Cargo.toml b/templates/parachain/pallets/template/Cargo.toml index f2457d43edfd..89eb9d517163 100644 --- a/templates/parachain/pallets/template/Cargo.toml +++ b/templates/parachain/pallets/template/Cargo.toml @@ -1,12 +1,12 @@ [package] name = "pallet-parachain-template" -version = "4.0.0-dev" description = "FRAME pallet template for defining custom runtime logic." +version = "0.0.0" +license = "MIT-0" authors.workspace = true homepage.workspace = true repository.workspace = true edition.workspace = true -license = "MIT-0" publish = false [lints] diff --git a/templates/parachain/runtime/Cargo.toml b/templates/parachain/runtime/Cargo.toml index 250237342e9a..9d9da2b4b974 100644 --- a/templates/parachain/runtime/Cargo.toml +++ b/templates/parachain/runtime/Cargo.toml @@ -1,12 +1,12 @@ [package] name = "parachain-template-runtime" -version = "0.0.0" description = "A parachain runtime template built with Substrate and Cumulus, part of Polkadot Sdk." +version = "0.0.0" +license = "MIT-0" authors.workspace = true homepage.workspace = true repository.workspace = true edition.workspace = true -license = "MIT-0" publish = false [lints] diff --git a/templates/parachain/runtime/src/lib.rs b/templates/parachain/runtime/src/lib.rs index fca49b1137f8..89899d286bb7 100644 --- a/templates/parachain/runtime/src/lib.rs +++ b/templates/parachain/runtime/src/lib.rs @@ -180,8 +180,8 @@ impl_opaque_keys! { #[sp_version::runtime_version] pub const VERSION: RuntimeVersion = RuntimeVersion { - spec_name: create_runtime_str!("template-parachain"), - impl_name: create_runtime_str!("template-parachain"), + spec_name: create_runtime_str!("parachain-template-runtime"), + impl_name: create_runtime_str!("parachain-template-runtime"), authoring_version: 1, spec_version: 1, impl_version: 0, diff --git a/templates/solochain/node/Cargo.toml b/templates/solochain/node/Cargo.toml index c831e45783da..fb23b941899e 100644 --- a/templates/solochain/node/Cargo.toml +++ b/templates/solochain/node/Cargo.toml @@ -1,14 +1,16 @@ [package] name = "solochain-template-node" -version = "4.0.0-dev" description = "A solochain node template built with Substrate, part of Polkadot Sdk." +version = "0.0.0" +license = "MIT-0" authors.workspace = true homepage.workspace = true repository.workspace = true edition.workspace = true -license = "MIT-0" publish = false +build = "build.rs" + [lints] workspace = true diff --git a/templates/solochain/pallets/template/Cargo.toml b/templates/solochain/pallets/template/Cargo.toml index bbd1bdadaff3..bd2347151989 100644 --- a/templates/solochain/pallets/template/Cargo.toml +++ b/templates/solochain/pallets/template/Cargo.toml @@ -1,12 +1,12 @@ [package] name = "pallet-template" -version = "4.0.0-dev" description = "FRAME pallet template for defining custom runtime logic." +version = "0.0.0" +license = "MIT-0" authors.workspace = true homepage.workspace = true repository.workspace = true edition.workspace = true -license = "MIT-0" publish = false [lints] diff --git a/templates/solochain/runtime/Cargo.toml b/templates/solochain/runtime/Cargo.toml index 7ffb2348e23c..0f89570f01d4 100644 --- a/templates/solochain/runtime/Cargo.toml +++ b/templates/solochain/runtime/Cargo.toml @@ -1,12 +1,12 @@ [package] name = "solochain-template-runtime" -version = "0.0.0" description = "A solochain runtime template built with Substrate, part of Polkadot Sdk." +version = "0.0.0" +license = "MIT-0" authors.workspace = true homepage.workspace = true repository.workspace = true edition.workspace = true -license = "MIT-0" publish = false [lints] diff --git a/templates/solochain/runtime/src/lib.rs b/templates/solochain/runtime/src/lib.rs index 0c4e4c13aae9..f8b57b4f400f 100644 --- a/templates/solochain/runtime/src/lib.rs +++ b/templates/solochain/runtime/src/lib.rs @@ -91,8 +91,8 @@ pub mod opaque { // https://docs.substrate.io/main-docs/build/upgrade#runtime-versioning #[sp_version::runtime_version] pub const VERSION: RuntimeVersion = RuntimeVersion { - spec_name: create_runtime_str!("node-template"), - impl_name: create_runtime_str!("node-template"), + spec_name: create_runtime_str!("solochain-template-runtime"), + impl_name: create_runtime_str!("solochain-template-runtime"), authoring_version: 1, // The version of the runtime specification. A full node will not attempt to use its native // runtime in substitute for the on-chain Wasm runtime unless all of `spec_name`, From 3a83c7f252d444953a41dde614e4d3b7a69450b4 Mon Sep 17 00:00:00 2001 From: kianenigma Date: Mon, 4 Mar 2024 12:42:53 +0000 Subject: [PATCH 15/21] revert to enum for now --- templates/solochain/runtime/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/solochain/runtime/src/lib.rs b/templates/solochain/runtime/src/lib.rs index f8b57b4f400f..335dbbd118c1 100644 --- a/templates/solochain/runtime/src/lib.rs +++ b/templates/solochain/runtime/src/lib.rs @@ -253,7 +253,7 @@ impl pallet_template::Config for Runtime { // Create the runtime by composing the FRAME pallets that were previously configured. construct_runtime!( - pub struct Runtime { + pub enum Runtime { System: frame_system, Timestamp: pallet_timestamp, Aura: pallet_aura, From 89f5bfe2f780582130af24c0934660242dd5fd0d Mon Sep 17 00:00:00 2001 From: kianenigma Date: Mon, 4 Mar 2024 12:46:01 +0000 Subject: [PATCH 16/21] remove license check script --- .github/workflows/check-licenses.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/check-licenses.yml b/.github/workflows/check-licenses.yml index e1e92d288cea..c32b6fcf89e0 100644 --- a/.github/workflows/check-licenses.yml +++ b/.github/workflows/check-licenses.yml @@ -42,5 +42,4 @@ jobs: shopt -s globstar npx @paritytech/license-scanner scan \ --ensure-licenses ${{ env.LICENSES }} \ - --exclude ./substrate/bin/node-template \ -- ./substrate/**/*.rs From 72057de60840812cfa44a99a74ff0bb41879070b Mon Sep 17 00:00:00 2001 From: kianenigma Date: Mon, 4 Mar 2024 13:02:31 +0000 Subject: [PATCH 17/21] remove needless [[bin]] --- templates/minimal/node/Cargo.toml | 3 --- templates/parachain/node/Cargo.toml | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/templates/minimal/node/Cargo.toml b/templates/minimal/node/Cargo.toml index cbf1076cbeb1..410cfc9f6c34 100644 --- a/templates/minimal/node/Cargo.toml +++ b/templates/minimal/node/Cargo.toml @@ -16,9 +16,6 @@ workspace = true [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] -[[bin]] -name = "minimal-template-node" - [dependencies] clap = { version = "4.5.1", features = ["derive"] } futures = { version = "0.3.21", features = ["thread-pool"] } diff --git a/templates/parachain/node/Cargo.toml b/templates/parachain/node/Cargo.toml index a0495c4d6fa1..b4f3a504a4d9 100644 --- a/templates/parachain/node/Cargo.toml +++ b/templates/parachain/node/Cargo.toml @@ -13,6 +13,9 @@ build = "build.rs" [lints] workspace = true +# [[bin]] +# name = "parachain-template-node" + [dependencies] clap = { version = "4.5.1", features = ["derive"] } log = { workspace = true, default-features = true } From ecc7d8b693146bdf0f267115ab3213e8897d9468 Mon Sep 17 00:00:00 2001 From: kianenigma Date: Mon, 4 Mar 2024 13:03:30 +0000 Subject: [PATCH 18/21] add prdoc --- prdoc/pr_3460.prdoc | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 prdoc/pr_3460.prdoc diff --git a/prdoc/pr_3460.prdoc b/prdoc/pr_3460.prdoc new file mode 100644 index 000000000000..f4b1e8c03d27 --- /dev/null +++ b/prdoc/pr_3460.prdoc @@ -0,0 +1,26 @@ +# Schema: Polkadot SDK PRDoc Schema (prdoc) v1.0.0 +# See doc at https://raw.githubusercontent.com/paritytech/polkadot-sdk/master/prdoc/schema_user.json + +title: Repot all templates + +doc: + - audience: Runtime Dev + description: | + This PR moves all templates into a single folder in the polkadot-sdk repo (`/templates`) and + unifies their crate names as well. Most notably, the crate name for what was formerly known + as `node-template` is no `solochain-template-node`. The other two crates in the template are + consequently called: `solochain-runtime-template` and `pallet-solochain-template`. + The other two template crate names follow a similar patter, just replacing `solochain` with + `parachain` or `minimal`. + + This PR is part of a bigger step toward automating the template repositories, see the + following: https://github.com/paritytech/polkadot-sdk/issues/3155 + +# the following crates are removed and renamed, although none are released. +crates: + - name: minimal-runtime # now called minimal-template-runtime + - name: minimal-node # now called minimal-template-node + - name: node-template # now called solochain-template-node + - name: node-template-runtime # now called solochain-template-runtime + - name: parachain-runtime # now called parachain-template-runtime + - name: parachain-node # now called parachain-template-node From c00aea2d482ab74e56ff5e123fa64798cc796451 Mon Sep 17 00:00:00 2001 From: kianenigma Date: Mon, 4 Mar 2024 13:05:29 +0000 Subject: [PATCH 19/21] also remove bin in solochain --- templates/solochain/node/Cargo.toml | 3 --- 1 file changed, 3 deletions(-) diff --git a/templates/solochain/node/Cargo.toml b/templates/solochain/node/Cargo.toml index fb23b941899e..48bb511bfd10 100644 --- a/templates/solochain/node/Cargo.toml +++ b/templates/solochain/node/Cargo.toml @@ -17,9 +17,6 @@ workspace = true [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] -[[bin]] -name = "solochain-template-node" - [dependencies] clap = { version = "4.5.1", features = ["derive"] } futures = { version = "0.3.21", features = ["thread-pool"] } From 3cc917536c87809965442d2a7c81a3d96328e8de Mon Sep 17 00:00:00 2001 From: kianenigma Date: Mon, 4 Mar 2024 13:07:40 +0000 Subject: [PATCH 20/21] redo prdoc --- prdoc/pr_3460.prdoc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/prdoc/pr_3460.prdoc b/prdoc/pr_3460.prdoc index f4b1e8c03d27..1f16fe089083 100644 --- a/prdoc/pr_3460.prdoc +++ b/prdoc/pr_3460.prdoc @@ -18,9 +18,9 @@ doc: # the following crates are removed and renamed, although none are released. crates: - - name: minimal-runtime # now called minimal-template-runtime - - name: minimal-node # now called minimal-template-node - - name: node-template # now called solochain-template-node - - name: node-template-runtime # now called solochain-template-runtime - - name: parachain-runtime # now called parachain-template-runtime - - name: parachain-node # now called parachain-template-node + - name: minimal-template-runtime # formerly called minimal-runtime + - name: minimal-template-node # formerly called minimal-node + - name: solochain-template-node # formerly called node-template + - name: solochain-template-runtime # formerly called node-template-runtime + - name: parachain-template-runtime # formerly called parachain-runtime + - name: parachain-template-runtime # formerly called parachain-node From a798f10a0984fd4fe08d35f8a6aabb137ddc7515 Mon Sep 17 00:00:00 2001 From: kianenigma Date: Tue, 5 Mar 2024 10:13:30 +0000 Subject: [PATCH 21/21] add impl --- templates/minimal/runtime/src/lib.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/templates/minimal/runtime/src/lib.rs b/templates/minimal/runtime/src/lib.rs index f31e8375a770..6920511e2765 100644 --- a/templates/minimal/runtime/src/lib.rs +++ b/templates/minimal/runtime/src/lib.rs @@ -109,6 +109,8 @@ impl pallet_transaction_payment::Config for Runtime { type LengthToFee = FixedFee<1, ::Balance>; } +impl pallet_minimal_template::Config for Runtime {} + type Block = frame::runtime::types_common::BlockOf; type Header = HeaderFor;