From 75f850ede91265658686a26b29a1f0bfdc7d4e4a Mon Sep 17 00:00:00 2001 From: Tomasz Polaczyk Date: Tue, 16 Jul 2024 18:30:33 +0200 Subject: [PATCH 1/5] Improve CI, update actions to match tanssi repo --- .../check_duplicate_git_dependencies.sh | 34 ++++++ .github/scripts/check_toml_lints.sh | 34 ++++++ .../workflow-templates/cargo-build/action.yml | 10 +- .github/workflows/build.yml | 110 +++++++++++------- 4 files changed, 142 insertions(+), 46 deletions(-) create mode 100755 .github/scripts/check_duplicate_git_dependencies.sh create mode 100755 .github/scripts/check_toml_lints.sh diff --git a/.github/scripts/check_duplicate_git_dependencies.sh b/.github/scripts/check_duplicate_git_dependencies.sh new file mode 100755 index 0000000..0d40168 --- /dev/null +++ b/.github/scripts/check_duplicate_git_dependencies.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +# Find duplicate git dependencies in Cargo.lock +# This can happen because in Cargo.toml we only specify the branch name, so if +# a new commit gets pushed to the branch, the Cargo.lock will be out of sync. +# In that case we need to manually run cargo update or edit the Cargo.lock file +# using search and replace. +# Then after a merge conflict, it can happen that not all crates have been updated. + +# Always run the commands from the "tanssi" dir +cd $(dirname $0)/../.. + +# Extract dependencies, sort them uniquely +deps=$(grep "source = \"git\+" Cargo.lock | sort -u) + +# Extract the base URLs before any query parameters or fragments +base_urls=$(echo "$deps" | sed -E 's|^(source = "git\+https://[^?#"]+)[^"]*|\1|') + +# Check for duplicate base URLs +duplicates=$(echo "$base_urls" | sort | uniq -d) + +if [[ -n $duplicates ]]; then + echo "Error: Duplicate dependencies found with the same URL:" + echo "$duplicates" + echo "" + echo "All git dependencies:" + echo "$deps" + echo "" + echo "Help: use this command to update polkadot-sdk to the latest commit:" + echo "cargo update -p sp_core" + exit 1 +else + echo "No duplicates found. All good!" +fi diff --git a/.github/scripts/check_toml_lints.sh b/.github/scripts/check_toml_lints.sh new file mode 100755 index 0000000..ddda361 --- /dev/null +++ b/.github/scripts/check_toml_lints.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +# Script to check that all the Cargo.toml files in the repo have an entry with +# [lints] workspace = true +# (except the root Cargo.toml, which should have the list of lints) +# If a Cargo.toml does not have this entry, running cargo clippy will use the +# default lints instead of our lints, which can lead to false positives and +# false negatives. + +# Always run the commands from the "tanssi" dir +cd $(dirname $0)/../.. + +# Initialize a flag to indicate failure +failure=0 + +# List files tracked by git, excluding those ignored by .gitignore +git ls-files | grep '^.*/Cargo.toml$' | while read -r file; do + # Check if the file contains the [lints]\nworkspace = true pattern + if ! grep -Pzoq "\[lints]\nworkspace = true" "$file"; then + # If the pattern is not found, print a message and set the failure flag + echo "Missing [lints] workspace = true in $file" + failure=1 + else + :; + # If found, print a confirmation message (optional) + #echo "[lints] workspace = true found in $file" + fi +done + +# Exit with a non-zero status if any Cargo.toml file was missing the required lines +if [ "$failure" -eq 1 ]; then + exit 1 +fi + diff --git a/.github/workflow-templates/cargo-build/action.yml b/.github/workflow-templates/cargo-build/action.yml index 762c679..149049e 100644 --- a/.github/workflow-templates/cargo-build/action.yml +++ b/.github/workflow-templates/cargo-build/action.yml @@ -26,7 +26,7 @@ runs: shell: bash run: | mkdir -p mold - curl -L --retry 10 --silent --show-error https://github.com/rui314/mold/releases/download/v1.1.1/mold-1.1.1-$(uname -m)-linux.tar.gz | tar -C $(realpath mold) --strip-components=1 -xzf - + wget https://github.com/rui314/mold/releases/download/v2.30.0/mold-2.30.0-$(uname -m)-linux.tar.gz -O - | tar -C $(realpath mold) --strip-components=1 -xzf - # With rustup's nice new toml format, we just need to run rustup show to install the toolchain # https://github.com/actions-rs/toolchain/issues/126#issuecomment-782989659 - name: Setup Rust toolchain @@ -40,9 +40,9 @@ runs: shell: bash run: | env - params=" --release" - if [ -n "${{ github.event.inputs.features }}" ]; then - params="$params --features ${{ github.event.inputs.features }}" + params=" --locked --release" + if [ -n "${{ inputs.features }}" ]; then + params="$params --features ${{ inputs.features }}" fi echo "cargo build $params" - cargo build $params \ No newline at end of file + cargo build $params diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a4f9eb1..cacafdf 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -50,7 +50,7 @@ jobs: echo "git_ref=$GITHUB_REF" >> $GITHUB_OUTPUT fi - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: ref: ${{ steps.check-git-ref.outputs.git_ref }} - name: Get Sha @@ -77,7 +77,7 @@ jobs: needs: ["set-tags"] steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: ref: ${{ needs.set-tags.outputs.git_ref }} - name: Find un-copyrighted files @@ -95,7 +95,7 @@ jobs: needs: ["set-tags"] steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: ref: ${{ needs.set-tags.outputs.git_ref }} - uses: gaurav-nelson/github-action-markdown-link-check@v1 @@ -109,7 +109,7 @@ jobs: needs: ["set-tags"] steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: ref: ${{ needs.set-tags.outputs.git_ref }} # With rustup's nice new toml format, we just need to run rustup show to install the toolchain @@ -117,55 +117,83 @@ jobs: - name: Setup Rust toolchain run: rustup show - name: Format code with rustfmt - run: cargo fmt -- --check + run: cargo fmt --all --check - ####### Building and Testing binaries ####### + ####### Static Analyses ####### - cargo-clippy: - runs-on: - labels: ubuntu-latest - needs: ["set-tags"] - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - ref: ${{ needs.set-tags.outputs.git_ref }} - - name: Install Protoc - uses: arduino/setup-protoc@v1 - - name: Setup Rust toolchain - run: rustup show - - name: Clippy - run: SKIP_WASM_BUILD=1 env -u RUSTFLAGS cargo clippy --features try-runtime,runtime-benchmarks + cargo-clippy: + runs-on: self-hosted + needs: ["set-tags"] + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + ref: ${{ needs.set-tags.outputs.git_ref }} - build: - runs-on: - labels: ubuntu-latest - needs: ["set-tags"] - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - ref: ${{ needs.set-tags.outputs.git_ref }} - - name: Install Protoc - uses: arduino/setup-protoc@v1 - - name: Cargo build - uses: ./.github/workflow-templates/cargo-build + - name: Setup Rust toolchain + run: rustup show + + - name: Check for duplicate git dependencies + run: ./.github/scripts/check_duplicate_git_dependencies.sh + + - name: Find toml files with lints key not set + run: ./.github/scripts/check_toml_lints.sh + + - name: Clippy + run: SKIP_WASM_BUILD=1 cargo clippy --all-targets --locked --workspace --features try-runtime,runtime-benchmarks + + cargo-toml-feature-propagation: + runs-on: ubuntu-latest + needs: ["set-tags"] + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + ref: ${{ needs.set-tags.outputs.git_ref }} + + - name: Setup Rust toolchain + run: rustup show + + - name: Install zepter + run: cargo install --locked -f zepter --version 1.1.0 - build-features: + - name: Run zepter + run: zepter run check + + toml-formatting: + runs-on: ubuntu-latest + needs: ["set-tags"] + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + ref: ${{ needs.set-tags.outputs.git_ref }} + + - name: Setup Rust toolchain + run: rustup show + + - name: Install toml-maid + run: cargo install --locked -f toml-maid + + - name: Run toml-maid + run: toml-maid --check + + + ####### Building and Testing binaries ####### + + build: runs-on: labels: ubuntu-latest needs: ["set-tags"] steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: ref: ${{ needs.set-tags.outputs.git_ref }} - name: Install Protoc uses: arduino/setup-protoc@v1 - name: Cargo build uses: ./.github/workflow-templates/cargo-build - with: - features: "try-runtime,runtime-benchmarks" rust-test: runs-on: @@ -177,7 +205,7 @@ jobs: SCCACHE_CACHE_SIZE: "100GB" steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: ref: ${{ needs.set-tags.outputs.git_ref }} - name: Install Protoc @@ -192,7 +220,7 @@ jobs: shell: bash run: | mkdir -p mold - curl -L --retry 10 --silent --show-error https://github.com/rui314/mold/releases/download/v1.1.1/mold-1.1.1-$(uname -m)-linux.tar.gz | tar -C $(realpath mold) --strip-components=1 -xzf - + curl -L --retry 10 --silent --show-error https://github.com/rui314/mold/releases/download/v2.30.0/mold-2.30.0-$(uname -m)-linux.tar.gz | tar -C $(realpath mold) --strip-components=1 -xzf - # With rustup's nice new toml format, we just need to run rustup show to install the toolchain # https://github.com/actions-rs/toolchain/issues/126#issuecomment-782989659 - name: Setup Rust toolchain @@ -206,4 +234,4 @@ jobs: run: | cargo test --release --all - name: Run sccache stat for check pre test - run: ${SCCACHE_PATH} --show-stats \ No newline at end of file + run: ${SCCACHE_PATH} --show-stats From c38fdb6f8d3946fcb929e903cabc69e9b12b3912 Mon Sep 17 00:00:00 2001 From: Tomasz Polaczyk Date: Tue, 16 Jul 2024 18:51:23 +0200 Subject: [PATCH 2/5] Fix and add missing config files --- .cargo/zepter.yaml | 43 +++++++ .../check_duplicate_git_dependencies.sh | 34 ------ .github/workflows/build.yml | 109 +++++++++--------- .rustfmt.toml | 6 + toml-maid.toml | 30 +++++ 5 files changed, 132 insertions(+), 90 deletions(-) create mode 100644 .cargo/zepter.yaml delete mode 100755 .github/scripts/check_duplicate_git_dependencies.sh create mode 100644 .rustfmt.toml create mode 100644 toml-maid.toml diff --git a/.cargo/zepter.yaml b/.cargo/zepter.yaml new file mode 100644 index 0000000..cc702c2 --- /dev/null +++ b/.cargo/zepter.yaml @@ -0,0 +1,43 @@ +# This file should be kept updated with the upstream config file: +# https://github.com/paritytech/polkadot-sdk/blob/master/.config/zepter.yaml + +version: + format: 1 + # Minimum version of the binary that is expected to work. This is just for printing a nice error + # message when someone tries to use an older version. + binary: 0.13.2 + +# The examples in this file assume crate `A` to have a dependency on crate `B`. +workflows: + check: + - [ + 'lint', + # Check that `A` activates the features of `B`. + 'propagate-feature', + # These are the features to check: + '--features=try-runtime,runtime-benchmarks,std', + # Do not try to add a new section into `[features]` of `A` only because `B` expose that feature. There are edge-cases where this is still needed, but we can add them manually. + '--left-side-feature-missing=ignore', + # Ignore the case that `A` it outside of the workspace. Otherwise it will report errors in external dependencies that we have no influence on. + '--left-side-outside-workspace=ignore', + # Some features imply that they activate a specific dependency as non-optional. Otherwise the default behaviour with a `?` is used. + '--feature-enables-dep=try-runtime:frame-try-runtime,runtime-benchmarks:frame-benchmarking', + # Auxillary flags: + '--offline', + '--locked', + '--show-path', + '--quiet', + ] + # Same as `check`, but with the `--fix` flag. + default: + - [ $check.0, '--fix' ] + +# Will be displayed when any workflow fails: +help: + text: | + Polkadot-SDK uses the Zepter CLI to detect abnormalities in the feature configuration. + It looks like one more more checks failed; please check the console output. You can try to automatically address them by running `zepter`. + Otherwise please ask directly in the Merge Request, GitHub Discussions or on Matrix Chat, thank you. + links: + - "https://github.com/paritytech/polkadot-sdk/issues/1831" + - "https://github.com/ggwpez/zepter" diff --git a/.github/scripts/check_duplicate_git_dependencies.sh b/.github/scripts/check_duplicate_git_dependencies.sh deleted file mode 100755 index 0d40168..0000000 --- a/.github/scripts/check_duplicate_git_dependencies.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash - -# Find duplicate git dependencies in Cargo.lock -# This can happen because in Cargo.toml we only specify the branch name, so if -# a new commit gets pushed to the branch, the Cargo.lock will be out of sync. -# In that case we need to manually run cargo update or edit the Cargo.lock file -# using search and replace. -# Then after a merge conflict, it can happen that not all crates have been updated. - -# Always run the commands from the "tanssi" dir -cd $(dirname $0)/../.. - -# Extract dependencies, sort them uniquely -deps=$(grep "source = \"git\+" Cargo.lock | sort -u) - -# Extract the base URLs before any query parameters or fragments -base_urls=$(echo "$deps" | sed -E 's|^(source = "git\+https://[^?#"]+)[^"]*|\1|') - -# Check for duplicate base URLs -duplicates=$(echo "$base_urls" | sort | uniq -d) - -if [[ -n $duplicates ]]; then - echo "Error: Duplicate dependencies found with the same URL:" - echo "$duplicates" - echo "" - echo "All git dependencies:" - echo "$deps" - echo "" - echo "Help: use this command to update polkadot-sdk to the latest commit:" - echo "cargo update -p sp_core" - exit 1 -else - echo "No duplicates found. All good!" -fi diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cacafdf..6c5c408 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -121,62 +121,59 @@ jobs: ####### Static Analyses ####### - cargo-clippy: - runs-on: self-hosted - needs: ["set-tags"] - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - ref: ${{ needs.set-tags.outputs.git_ref }} - - - name: Setup Rust toolchain - run: rustup show - - - name: Check for duplicate git dependencies - run: ./.github/scripts/check_duplicate_git_dependencies.sh - - - name: Find toml files with lints key not set - run: ./.github/scripts/check_toml_lints.sh - - - name: Clippy - run: SKIP_WASM_BUILD=1 cargo clippy --all-targets --locked --workspace --features try-runtime,runtime-benchmarks - - cargo-toml-feature-propagation: - runs-on: ubuntu-latest - needs: ["set-tags"] - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - ref: ${{ needs.set-tags.outputs.git_ref }} - - - name: Setup Rust toolchain - run: rustup show - - - name: Install zepter - run: cargo install --locked -f zepter --version 1.1.0 - - - name: Run zepter - run: zepter run check - - toml-formatting: - runs-on: ubuntu-latest - needs: ["set-tags"] - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - ref: ${{ needs.set-tags.outputs.git_ref }} - - - name: Setup Rust toolchain - run: rustup show - - - name: Install toml-maid - run: cargo install --locked -f toml-maid - - - name: Run toml-maid - run: toml-maid --check + cargo-clippy: + runs-on: ubuntu-latest + needs: ["set-tags"] + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + ref: ${{ needs.set-tags.outputs.git_ref }} + + - name: Setup Rust toolchain + run: rustup show + + - name: Find toml files with lints key not set + run: ./.github/scripts/check_toml_lints.sh + + - name: Clippy + run: SKIP_WASM_BUILD=1 cargo clippy --all-targets --locked --workspace --features try-runtime,runtime-benchmarks + + cargo-toml-feature-propagation: + runs-on: ubuntu-latest + needs: ["set-tags"] + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + ref: ${{ needs.set-tags.outputs.git_ref }} + + - name: Setup Rust toolchain + run: rustup show + + - name: Install zepter + run: cargo install --locked -f zepter --version 1.1.0 + + - name: Run zepter + run: zepter run check + + toml-formatting: + runs-on: ubuntu-latest + needs: ["set-tags"] + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + ref: ${{ needs.set-tags.outputs.git_ref }} + + - name: Setup Rust toolchain + run: rustup show + + - name: Install toml-maid + run: cargo install --locked -f toml-maid + + - name: Run toml-maid + run: toml-maid --check ####### Building and Testing binaries ####### diff --git a/.rustfmt.toml b/.rustfmt.toml new file mode 100644 index 0000000..13992e2 --- /dev/null +++ b/.rustfmt.toml @@ -0,0 +1,6 @@ +# Must be run in nightly: +# cargo +nightly fmt + +reorder_imports = true +max_width = 100 +imports_granularity = "One" \ No newline at end of file diff --git a/toml-maid.toml b/toml-maid.toml new file mode 100644 index 0000000..5b6eca7 --- /dev/null +++ b/toml-maid.toml @@ -0,0 +1,30 @@ +keys = [ + "workspace", + "name", + "package", + "bin", + "lib", + "test", + "lints", + "dependencies", + "dev-dependencies", + "build-dependencies", + "features", + "default", + "std", +] + +inline_keys = [ + "package", + "workspace", + "path", + "git", + "branch", + "rev", + "version", + "default-features", + "optional", + "features", +] + +sort_arrays = true From 2177d72976dbf6ab1f317558c602c5a33d914b89 Mon Sep 17 00:00:00 2001 From: Tomasz Polaczyk Date: Tue, 16 Jul 2024 18:58:01 +0200 Subject: [PATCH 3/5] toml-maid + zepter + workspace lints --- Cargo.lock | 1 + Cargo.toml | 25 ++++++++++++ .../orchestrator-chain-interface/Cargo.toml | 3 ++ .../authorities-noting/Cargo.toml | 39 +++++++++++++++++-- .../authorities-noting-inherent/Cargo.toml | 30 +++++++++++++- container-chain-primitives/xcm/Cargo.toml | 16 +++++++- pallets/xcm-executor-utils/Cargo.toml | 16 +++++++- primitives/chain-state-snapshot/Cargo.toml | 4 ++ primitives/collator-assignment/Cargo.toml | 8 +++- primitives/consensus/Cargo.toml | 3 ++ .../container-chain-genesis-data/Cargo.toml | 3 ++ primitives/core/Cargo.toml | 6 +++ .../impl-tanssi-pallets-config/Cargo.toml | 3 ++ .../slot-duration-runtime-api/Cargo.toml | 6 +++ test-sproof-builder/Cargo.toml | 8 +++- 15 files changed, 160 insertions(+), 11 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7fedc72..bc41f4a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5610,6 +5610,7 @@ name = "pallet-migrations" version = "0.1.0" source = "git+https://github.com/Moonsong-Labs/moonkit?branch=main#1f48a9892eca1ba1f48e20209a533b7bec3b83d0" dependencies = [ + "frame-benchmarking", "frame-support", "frame-system", "impl-trait-for-tuples", diff --git a/Cargo.toml b/Cargo.toml index 80add16..8b24df0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,6 +13,31 @@ resolver = "2" authors = [ "Moondance Labs" ] repository = "https://github.com/moondance-labs/dancekit" +[workspace.lints.clippy] +# Deny main lint groups +complexity = { level = "deny", priority = 1 } +correctness = { level = "deny", priority = 1 } +suspicious = { level = "deny", priority = 1 } + +# Add some additional lints +as_underscore = { level = "warn", priority = 1 } +cast_lossless = { level = "warn", priority = 1 } +cast_possible_wrap = { level = "warn", priority = 1 } +cast_precision_loss = { level = "warn", priority = 1 } +cast_sign_loss = { level = "warn", priority = 1 } +debug_assert_with_mut_call = { level = "warn", priority = 1 } +fn_to_numeric_cast_any = { level = "warn", priority = 1 } +invalid_upcast_comparisons = { level = "warn", priority = 1 } + +# Allow annoying lints and false positives +erasing_op = { level = "allow", priority = 2 } +identity_op = { level = "allow", priority = 2 } +too-many-arguments = { level = "allow", priority = 2 } +type_complexity = { level = "allow", priority = 2 } + +[workspace.lints.rust] +unsafe-code = { level = "deny", priority = 1 } + [workspace.dependencies] ccp-authorities-noting-inherent = { path = "container-chain-primitives/authorities-noting-inherent", default-features = false } diff --git a/client/orchestrator-chain-interface/Cargo.toml b/client/orchestrator-chain-interface/Cargo.toml index 65ef373..b0293b0 100644 --- a/client/orchestrator-chain-interface/Cargo.toml +++ b/client/orchestrator-chain-interface/Cargo.toml @@ -5,6 +5,9 @@ edition = "2021" license = "GPL-3.0-only" version = "0.1.0" +[lints] +workspace = true + [dependencies] async-trait = { workspace = true } futures = { workspace = true } diff --git a/container-chain-pallets/authorities-noting/Cargo.toml b/container-chain-pallets/authorities-noting/Cargo.toml index 92e015a..ba75287 100644 --- a/container-chain-pallets/authorities-noting/Cargo.toml +++ b/container-chain-pallets/authorities-noting/Cargo.toml @@ -8,6 +8,10 @@ version = "0.1.0" [package.metadata.docs.rs] targets = [ "x86_64-unknown-linux-gnu" ] + +[lints] +workspace = true + [dependencies] hex = { workspace = true, optional = true, features = [ "alloc" ] } log = { workspace = true } @@ -55,24 +59,51 @@ std = [ "ccp-authorities-noting-inherent/std", "cumulus-pallet-parachain-system/std", "cumulus-primitives-core/std", + "dp-chain-state-snapshot/std", + "dp-collator-assignment/std", + "dp-core/std", "frame-benchmarking/std", "frame-support/std", "frame-system/std", "hex", + "hex?/std", + "log/std", + "nimbus-primitives/std", "parity-scale-codec/std", + "polkadot-parachain-primitives/std", + "polkadot-primitives/std", "scale-info/std", "serde", + "serde?/std", "sp-consensus-aura/std", + "sp-core/std", + "sp-externalities/std", + "sp-inherents/std", + "sp-io/std", + "sp-runtime/std", "sp-state-machine/std", + "sp-std/std", "sp-trie/std", - "dp-chain-state-snapshot/std", - "dp-collator-assignment/std", - "dp-core/std", + "sp-version/std", + "test-relay-sproof-builder/std", ] runtime-benchmarks = [ "cumulus-pallet-parachain-system/runtime-benchmarks", + "cumulus-primitives-core/runtime-benchmarks", "frame-benchmarking", + "frame-benchmarking/runtime-benchmarks", + "frame-support/runtime-benchmarks", + "frame-system/runtime-benchmarks", "hex", "nimbus-primitives/runtime-benchmarks", + "polkadot-parachain-primitives/runtime-benchmarks", + "polkadot-primitives/runtime-benchmarks", + "sp-runtime/runtime-benchmarks", +] +try-runtime = [ + "cumulus-pallet-parachain-system/try-runtime", + "frame-support/try-runtime", + "frame-system/try-runtime", + "nimbus-primitives/try-runtime", + "sp-runtime/try-runtime", ] -try-runtime = [ "frame-support/try-runtime" ] diff --git a/container-chain-primitives/authorities-noting-inherent/Cargo.toml b/container-chain-primitives/authorities-noting-inherent/Cargo.toml index da5e913..3490c7d 100644 --- a/container-chain-primitives/authorities-noting-inherent/Cargo.toml +++ b/container-chain-primitives/authorities-noting-inherent/Cargo.toml @@ -5,6 +5,10 @@ description = "authorities-noting-inherent primitives" edition = "2021" license = "GPL-3.0-only" version = "0.1.0" + +[lints] +workspace = true + [dependencies] async-trait = { workspace = true, optional = true } parity-scale-codec = { workspace = true, features = [ "derive", "max-encoded-len" ] } @@ -44,4 +48,28 @@ tokio = { workspace = true } [features] default = [ "std" ] -std = [ "async-trait", "cumulus-primitives-core/std", "cumulus-primitives-parachain-inherent/std", "cumulus-relay-chain-interface", "nimbus-primitives/std", "parity-scale-codec/std", "scale-info/std", "sp-consensus-aura/std", "sp-core/std", "sp-inherents/std", "sp-io/std", "sp-runtime", "sp-state-machine", "sp-trie/std", "dc-orchestrator-chain-interface", "test-relay-sproof-builder/std", "dp-collator-assignment/std", "dp-core/std", "tracing" ] +std = [ + "async-trait", + "cumulus-primitives-core/std", + "cumulus-primitives-parachain-inherent/std", + "cumulus-relay-chain-interface", + "dc-orchestrator-chain-interface", + "dp-collator-assignment/std", + "dp-core/std", + "nimbus-primitives/std", + "parity-scale-codec/std", + "scale-info/std", + "sp-consensus-aura/std", + "sp-core/std", + "sp-inherents/std", + "sp-io/std", + "sp-runtime", + "sp-runtime?/std", + "sp-state-machine", + "sp-state-machine?/std", + "sp-std/std", + "sp-trie/std", + "test-relay-sproof-builder/std", + "tracing", + "tracing?/std", +] diff --git a/container-chain-primitives/xcm/Cargo.toml b/container-chain-primitives/xcm/Cargo.toml index f2b885f..2fd040c 100644 --- a/container-chain-primitives/xcm/Cargo.toml +++ b/container-chain-primitives/xcm/Cargo.toml @@ -6,6 +6,10 @@ description = "container-chain xcm primitives" edition = "2021" license = "GPL-3.0-only" version = "0.1.0" + +[lints] +workspace = true + [dependencies] parity-scale-codec = { workspace = true, features = [ "derive", "max-encoded-len" ] } @@ -27,4 +31,14 @@ staging-xcm-executor = { workspace = true } [features] default = [ "std" ] -std = [ "frame-support/std", "frame-system/std", "sp-core/std", "sp-io/std", "sp-std/std", "staging-xcm-executor/std", "staging-xcm/std" ] +std = [ + "frame-support/std", + "frame-system/std", + "parity-scale-codec/std", + "sp-core/std", + "sp-io/std", + "sp-runtime/std", + "sp-std/std", + "staging-xcm-executor/std", + "staging-xcm/std", +] diff --git a/pallets/xcm-executor-utils/Cargo.toml b/pallets/xcm-executor-utils/Cargo.toml index 783b546..bad07b2 100644 --- a/pallets/xcm-executor-utils/Cargo.toml +++ b/pallets/xcm-executor-utils/Cargo.toml @@ -9,6 +9,9 @@ version = "0.1.0" [package.metadata.docs.rs] targets = [ "x86_64-unknown-linux-gnu" ] +[lints] +workspace = true + [dependencies] log = { workspace = true } serde = { workspace = true, features = [ "derive" ] } @@ -37,10 +40,13 @@ std = [ "frame-benchmarking/std", "frame-support/std", "frame-system/std", - "parity-scale-codec/std", + "log/std", "pallet-migrations/std", + "parity-scale-codec/std", "scale-info/std", "serde/std", + "sp-core/std", + "sp-io/std", "sp-runtime/std", "sp-std/std", "staging-xcm/std", @@ -50,6 +56,12 @@ runtime-benchmarks = [ "frame-benchmarking/runtime-benchmarks", "frame-support/runtime-benchmarks", "frame-system/runtime-benchmarks", + "pallet-migrations/runtime-benchmarks", "sp-runtime/runtime-benchmarks", ] -try-runtime = [ "frame-support/try-runtime", "pallet-migrations/try-runtime" ] +try-runtime = [ + "frame-support/try-runtime", + "frame-system/try-runtime", + "pallet-migrations/try-runtime", + "sp-runtime/try-runtime", +] diff --git a/primitives/chain-state-snapshot/Cargo.toml b/primitives/chain-state-snapshot/Cargo.toml index eb20666..b668384 100644 --- a/primitives/chain-state-snapshot/Cargo.toml +++ b/primitives/chain-state-snapshot/Cargo.toml @@ -8,6 +8,10 @@ version = "0.1.0" [package.metadata.docs.rs] targets = [ "x86_64-unknown-linux-gnu" ] + +[lints] +workspace = true + [dependencies] # Substrate diff --git a/primitives/collator-assignment/Cargo.toml b/primitives/collator-assignment/Cargo.toml index f725842..c84aeb7 100644 --- a/primitives/collator-assignment/Cargo.toml +++ b/primitives/collator-assignment/Cargo.toml @@ -9,9 +9,12 @@ version = "0.1.0" [package.metadata.docs.rs] targets = [ "x86_64-unknown-linux-gnu" ] + +[lints] +workspace = true + [dependencies] hex-literal = { workspace = true } - log = { workspace = true } serde = { workspace = true, optional = true, features = [ "derive" ] } @@ -36,8 +39,11 @@ default = [ "std" ] std = [ "cumulus-primitives-core/std", "frame-support/std", + "log/std", "parity-scale-codec/std", "polkadot-primitives", + "polkadot-primitives?/std", + "scale-info/std", "serde/std", "sp-core/std", "sp-runtime/std", diff --git a/primitives/consensus/Cargo.toml b/primitives/consensus/Cargo.toml index d948e0b..dd63cee 100644 --- a/primitives/consensus/Cargo.toml +++ b/primitives/consensus/Cargo.toml @@ -8,6 +8,9 @@ version = "0.1.0" [package.metadata.docs.rs] targets = [ "x86_64-unknown-linux-gnu" ] +[lints] +workspace = true + [dependencies] cumulus-primitives-core = { workspace = true } frame-support = { workspace = true } diff --git a/primitives/container-chain-genesis-data/Cargo.toml b/primitives/container-chain-genesis-data/Cargo.toml index 22f69d2..b6024ca 100644 --- a/primitives/container-chain-genesis-data/Cargo.toml +++ b/primitives/container-chain-genesis-data/Cargo.toml @@ -9,6 +9,9 @@ version = "0.1.0" [package.metadata.docs.rs] targets = [ "x86_64-unknown-linux-gnu" ] +[lints] +workspace = true + [dependencies] hex = { workspace = true, optional = true, features = [ "alloc" ] } hex-literal = { workspace = true } diff --git a/primitives/core/Cargo.toml b/primitives/core/Cargo.toml index 55fecf7..4bfdda8 100644 --- a/primitives/core/Cargo.toml +++ b/primitives/core/Cargo.toml @@ -8,6 +8,10 @@ version = "0.1.0" [package.metadata.docs.rs] targets = [ "x86_64-unknown-linux-gnu" ] + +[lints] +workspace = true + [dependencies] hex-literal = { workspace = true } @@ -26,8 +30,10 @@ cumulus-primitives-core = { workspace = true } default = [ "std" ] std = [ "cumulus-primitives-core/std", + "frame-support/std", "parity-scale-codec/std", "sp-core/std", "sp-io/std", + "sp-runtime/std", "sp-std/std", ] diff --git a/primitives/impl-tanssi-pallets-config/Cargo.toml b/primitives/impl-tanssi-pallets-config/Cargo.toml index 4ecda7e..5cc438d 100644 --- a/primitives/impl-tanssi-pallets-config/Cargo.toml +++ b/primitives/impl-tanssi-pallets-config/Cargo.toml @@ -6,6 +6,9 @@ edition = "2021" license = "GPL-3.0-only" version = "0.1.0" +[lints] +workspace = true + [dependencies] impls = { workspace = true } sp-core = { workspace = true } diff --git a/primitives/slot-duration-runtime-api/Cargo.toml b/primitives/slot-duration-runtime-api/Cargo.toml index 055eec9..800675a 100644 --- a/primitives/slot-duration-runtime-api/Cargo.toml +++ b/primitives/slot-duration-runtime-api/Cargo.toml @@ -8,6 +8,10 @@ version = "0.1.0" [package.metadata.docs.rs] targets = [ "x86_64-unknown-linux-gnu" ] + +[lints] +workspace = true + [dependencies] # Substrate frame-support = { workspace = true } @@ -25,9 +29,11 @@ cumulus-primitives-core = { workspace = true } default = [ "std" ] std = [ "cumulus-primitives-core/std", + "frame-support/std", "parity-scale-codec/std", "sp-api/std", "sp-core/std", "sp-io/std", + "sp-runtime/std", "sp-std/std", ] diff --git a/test-sproof-builder/Cargo.toml b/test-sproof-builder/Cargo.toml index d094beb..e88eb43 100644 --- a/test-sproof-builder/Cargo.toml +++ b/test-sproof-builder/Cargo.toml @@ -3,6 +3,10 @@ name = "test-relay-sproof-builder" authors = [] edition = "2021" version = "0.1.0" + +[lints] +workspace = true + [dependencies] dp-collator-assignment = { workspace = true, optional = true } dp-core = { workspace = true, optional = true } @@ -21,11 +25,11 @@ cumulus-primitives-core = { workspace = true, optional = true } default = [ "std" ] std = [ "cumulus-primitives-core/std", + "dp-collator-assignment/std", + "dp-core/std", "frame-support/std", "parity-scale-codec/std", "sp-runtime/std", "sp-state-machine/std", "sp-trie/std", - "dp-collator-assignment/std", - "dp-core/std", ] From cd09f40885957f219bcf73b7d7b95db14d2308ea Mon Sep 17 00:00:00 2001 From: Tomasz Polaczyk Date: Tue, 16 Jul 2024 19:04:12 +0200 Subject: [PATCH 4/5] Add back protoc to clippy job --- .github/workflows/build.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6c5c408..193fdc8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -136,6 +136,9 @@ jobs: - name: Find toml files with lints key not set run: ./.github/scripts/check_toml_lints.sh + - name: Install Protoc + uses: arduino/setup-protoc@v1 + - name: Clippy run: SKIP_WASM_BUILD=1 cargo clippy --all-targets --locked --workspace --features try-runtime,runtime-benchmarks From 38f1da8e8a6ba921a511010bf828447f7677c46c Mon Sep 17 00:00:00 2001 From: Tomasz Polaczyk Date: Tue, 16 Jul 2024 19:26:54 +0200 Subject: [PATCH 5/5] Fix clippy error --- primitives/consensus/src/lib.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/primitives/consensus/src/lib.rs b/primitives/consensus/src/lib.rs index de8ed47..e308dcb 100644 --- a/primitives/consensus/src/lib.rs +++ b/primitives/consensus/src/lib.rs @@ -32,7 +32,9 @@ use {nimbus_primitives::NimbusSignature, sp_consensus_aura::digests::CompatibleD sp_api::decl_runtime_apis! { /// API necessary for block authorship with Tanssi. - pub trait TanssiAuthorityAssignmentApi { + pub trait TanssiAuthorityAssignmentApi + where AuthorityId: Codec + { /// Returns the authorities for a given paraId fn para_id_authorities(para_id: ParaId) -> Option>;