Skip to content

Generated Polkadot SDK Templates Emit Errors #5226

@shawntabrizi

Description

@shawntabrizi

When compiling the minimal-template, the following errors appear:

➜  minimal-template git:(master) cargo build --release
warning: unexpected `cfg` condition value: `try-runtime`
  --> pallets/template/src/lib.rs:20:12
   |
20 |     #[pallet::pallet]
   |               ^^^^^^
   |
   = note: expected values for `feature` are: `default` and `std`
   = help: consider adding `try-runtime` as a feature in `Cargo.toml`
   = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
   = note: `#[warn(unexpected_cfgs)]` on by default

warning: `pallet-minimal-template` (lib) generated 1 warning
warning: unexpected `cfg` condition value: `runtime-benchmarks`
  --> node/src/service.rs:30:7
   |
30 | #[cfg(feature = "runtime-benchmarks")]
   |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: expected values for `feature` are: `default`
   = help: consider adding `runtime-benchmarks` as a feature in `Cargo.toml`
   = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
   = note: `#[warn(unexpected_cfgs)]` on by default

warning: unexpected `cfg` condition value: `runtime-benchmarks`
  --> node/src/service.rs:34:11
   |
34 | #[cfg(not(feature = "runtime-benchmarks"))]
   |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: expected values for `feature` are: `default`
   = help: consider adding `runtime-benchmarks` as a feature in `Cargo.toml`
   = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration

warning: `minimal-template-node` (lib) generated 2 warnings
warning: unexpected `cfg` condition value: `try-runtime`
  --> node/src/command.rs:26:7
   |
26 | #[cfg(feature = "try-runtime")]
   |       ^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: expected values for `feature` are: `default`
   = help: consider adding `try-runtime` as a feature in `Cargo.toml`
   = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
   = note: `#[warn(unexpected_cfgs)]` on by default

warning: unexpected `cfg` condition value: `runtime-benchmarks`
  --> node/src/service.rs:30:7
   |
30 | #[cfg(feature = "runtime-benchmarks")]
   |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: expected values for `feature` are: `default`
   = help: consider adding `runtime-benchmarks` as a feature in `Cargo.toml`
   = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration

warning: `minimal-template-node` (bin "minimal-template-node") generated 3 warnings (1 duplicate)

This is because the templates lack the runtime-benchmarks or try_runtime features, but these features are being referenced within the service.rs file and command.rs file included in the template.

We need to either change the service file to exclude these feature gated parts of the code, or (probably better) include these features into the generated templates.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions